index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div class="container">
  3. <div v-if="result.code === 'success'" class="result">
  4. <img class="result-pic" :src="result.pic" alt="" />
  5. <div class="result-title">{{ result.title }}</div>
  6. <van-button type="primary" class="result-btn" @click="goUBOXBind">
  7. 去绑定支付宝账号
  8. </van-button>
  9. </div>
  10. <div v-if="result.code === 'registered'" class="result">
  11. <img class="result-pic" :src="result.pic" alt="" />
  12. <div class="result-title">{{ result.title }}</div>
  13. <van-button type="primary" class="result-btn" @click="goUBOXBind">
  14. 去绑定支付宝账号
  15. </van-button>
  16. </div>
  17. <div v-if="result.code === 'fail'" class="result">
  18. <img class="result-pic" :src="result.pic" alt="" />
  19. <div class="result-title">{{ result.title }}</div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import { getURLParameters } from "@/utils";
  25. const resultMap = {
  26. 200: {
  27. code: "success",
  28. pic: require("@/assets/images/result_1.png"),
  29. title: "继续完成绑定支付宝账号,即可开门消费。",
  30. },
  31. fail: {
  32. code: "fail",
  33. pic: require("@/assets/images/result_2.png"),
  34. title: "系统异常,请勿重复操作。",
  35. },
  36. 6010: {
  37. code: "registered",
  38. pic: require("@/assets/images/result_2.png"),
  39. title: "用户已注册,请勿重复操作。",
  40. },
  41. };
  42. export default {
  43. data() {
  44. return {
  45. result: {},
  46. };
  47. },
  48. created() {
  49. const { code: statusCode } = getURLParameters();
  50. this.result = resultMap[statusCode]
  51. ? resultMap[statusCode]
  52. : resultMap["fail"];
  53. // this.aliPayReady()
  54. },
  55. methods: {
  56. // aliPayReady() {
  57. // function ready(callback) {
  58. // // 如果jsbridge已经注入则直接调用
  59. // if (window.AlipayJSBridge) {
  60. // callback && callback()
  61. // } else {
  62. // // 如果没有注入则监听注入的事件
  63. // document.addEventListener('AlipayJSBridgeReady', callback, false)
  64. // }
  65. // }
  66. // ready(function () {
  67. // console.log('AlipayJSBridge 初始化完毕')
  68. // })
  69. // },
  70. // exitApp() {
  71. // AlipayJSBridge.call('exitApp')
  72. // },
  73. // openScan() {
  74. // AlipayJSBridge.call(
  75. // 'scan',
  76. // {
  77. // scanType: ['qrCode', 'barCode'],
  78. // actionType: 'scanAndRoute',
  79. // },
  80. // function (result) {
  81. // alert(JSON.stringify(result))
  82. // },
  83. // )
  84. // },
  85. /**
  86. * 跳转到友宝绑定支付宝页面
  87. */
  88. goUBOXBind() {
  89. location.href = `http://cashier.aicebox.com/user/bind/init/1036_100811_dt1`;
  90. },
  91. },
  92. };
  93. </script>
  94. <style lang="scss" scoped>
  95. .container {
  96. box-sizing: border-box;
  97. padding: 24px;
  98. }
  99. .result {
  100. display: flex;
  101. flex-direction: column;
  102. align-items: center;
  103. &-pic {
  104. width: 200px;
  105. height: 170px;
  106. }
  107. &-title {
  108. margin-top: 24px;
  109. font-size: 18px;
  110. color: #333;
  111. font-weight: bold;
  112. }
  113. &-tips {
  114. margin-top: 8px;
  115. font-size: 14px;
  116. color: #333;
  117. }
  118. &-btn {
  119. margin-top: 30px;
  120. width: 100%;
  121. font-size: 15px;
  122. background: #4684ff;
  123. border-color: #4684ff;
  124. border-radius: 24px;
  125. overflow: hidden;
  126. }
  127. }
  128. </style>