confirmation.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div class="confirmation">
  3. <div class="confirmation-bg">
  4. <div class="confirmation-tips">
  5. <template v-if="status[currentStatus]">
  6. <van-icon
  7. :name="status[currentStatus].key"
  8. v-if="status[currentStatus].key"
  9. />
  10. {{ status[currentStatus].name }}
  11. </template>
  12. </div>
  13. <div class="confirmation-obtain" v-if="currentStatus !== 2">
  14. 3大权益已开通&nbsp;&nbsp;云机已到账
  15. </div>
  16. </div>
  17. <div class="confirmation-container">
  18. <div class="jump">
  19. <img
  20. src="@/assets/image/claimCloudPhone/confirmation-btn.png"
  21. class="jump-btn"
  22. @click="download"
  23. />
  24. <div @click="toH5">暂不下载,使用网页版</div>
  25. </div>
  26. <div class="confirmation-guide">
  27. <div class="confirmation-guide-title">
  28. 您可在云应用/浏览器直接下载安装应用
  29. </div>
  30. <img
  31. src="@/assets/image/claimCloudPhone/confirmation-guide.png"
  32. alt=""
  33. />
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. auth: false,
  41. name: 'confirmation',
  42. head: {
  43. title: '0元购机,尽情享受',
  44. },
  45. components: {},
  46. data() {
  47. return {
  48. bargainingStatusInfo: {},
  49. status: {
  50. 1: {
  51. name: '支付成功',
  52. key: 'passed',
  53. },
  54. 2: {
  55. name: '支付中...',
  56. key: 0,
  57. },
  58. 3: {
  59. name: '支付失败',
  60. key: 'close',
  61. },
  62. },
  63. currentStatus: '',
  64. index: 1,
  65. H5_URL: process.env.H5_URL,
  66. };
  67. },
  68. mounted() {
  69. this.getPayStatus();
  70. this.bargainingStatusInfo = JSON.parse(
  71. localStorage.getItem('bargainingStatusInfo'),
  72. );
  73. },
  74. methods: {
  75. getPayStatus(bool = true) {
  76. if (bool) {
  77. this.$toast.loading({
  78. message: '加载中...',
  79. forbidClick: true,
  80. duration: 0,
  81. });
  82. }
  83. this.$axios
  84. .$get('pay/v1/alipay/h5/spend/getPayStatus', {
  85. params: {
  86. myOrderNum: localStorage.getItem('activityPurchaseMyOrderNum'),
  87. },
  88. })
  89. .then((res) => {
  90. if (res.success) {
  91. this.currentStatus = res.data;
  92. if (+res.data === 2) {
  93. if (this.index === 2) {
  94. this.currentStatus = 3;
  95. this.$set(
  96. this.status[this.currentStatus],
  97. 'name',
  98. '去app查看结果',
  99. );
  100. this.index = 1;
  101. return;
  102. }
  103. this.index++;
  104. setTimeout(() => {
  105. this.getPayStatus(false);
  106. }, 2000);
  107. }
  108. }
  109. })
  110. .finally(() => {
  111. this.$toast.clear();
  112. });
  113. },
  114. download() {
  115. location.href = this.$userAgent.isAndroid
  116. ? this.bargainingStatusInfo.downloadAndroidUrl
  117. : 'https://www.androidscloud.com';
  118. },
  119. toH5() {
  120. location.href = this.H5_URL + '/cloud/phone/web/#/';
  121. },
  122. },
  123. };
  124. </script>
  125. <style lang="less" scoped>
  126. .confirmation {
  127. height: 100%;
  128. background: #f4f6f8;
  129. .confirmation-bg {
  130. height: 215px;
  131. background: #ff707d;
  132. padding-top: 38px;
  133. border-radius: 0px 0px 46px 46px;
  134. .confirmation-tips {
  135. font-family: PingFangSC, PingFang SC;
  136. font-weight: 400;
  137. font-size: 22px;
  138. color: #ffffff;
  139. line-height: 30px;
  140. text-align: center;
  141. font-style: normal;
  142. .van-icon-passed {
  143. margin-right: 5px;
  144. }
  145. }
  146. .confirmation-obtain {
  147. font-family: PingFangSC, PingFang SC;
  148. font-weight: 400;
  149. font-size: 14px;
  150. color: #fff5dc;
  151. line-height: 20px;
  152. text-align: center;
  153. font-style: normal;
  154. margin-top: 12px;
  155. }
  156. }
  157. .confirmation-container {
  158. padding: 0 26px;
  159. .jump {
  160. height: 146px;
  161. padding: 41px 45px 0;
  162. box-sizing: border-box;
  163. background: #ffffff;
  164. border-radius: 8px;
  165. margin-top: -100px;
  166. margin-bottom: 16px;
  167. overflow: hidden;
  168. & > div:last-of-type {
  169. margin-top: 12px;
  170. font-family: PingFangSC, PingFang SC;
  171. font-weight: 400;
  172. font-size: 12px;
  173. color: #666666;
  174. line-height: 17px;
  175. text-align: center;
  176. font-style: normal;
  177. }
  178. .jump-btn {
  179. height: 46px;
  180. width: 100%;
  181. }
  182. }
  183. .confirmation-guide {
  184. background: #ffffff;
  185. border-radius: 8px;
  186. padding: 16px 10px;
  187. .confirmation-guide-title {
  188. font-family: PingFangSC, PingFang SC;
  189. font-weight: bold;
  190. font-size: 16px;
  191. color: #0a132b;
  192. text-align: center;
  193. font-style: normal;
  194. }
  195. & > img {
  196. width: 100%;
  197. margin: 22px 0;
  198. }
  199. }
  200. }
  201. }
  202. </style>