integral_order_status.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='payment-status'>
  4. <!--失败时: 用icon-iconfontguanbi fail替换icon-duihao2 bg-color-->
  5. <view class='iconfont icons icon-duihao2 bg-color'></view>
  6. <!-- 失败时:商品兑换失败 -->
  7. <view class='status' v-if="order_pay_info.pay_type != 'offline'">商品兑换成功
  8. </view>
  9. <view class='status' v-else>订单创建成功</view>
  10. <view class='wrapper'>
  11. <view class='item acea-row row-between-wrapper'>
  12. <view>订单编号</view>
  13. <view class='itemCom'>{{orderId}}</view>
  14. </view>
  15. <view class='item acea-row row-between-wrapper'>
  16. <view>兑换时间</view>
  17. <view class='itemCom'>{{order_pay_info.add_time}}</view>
  18. </view>
  19. <view class='item acea-row row-between-wrapper'>
  20. <view>兑换方式</view>
  21. <view class='itemCom'>积分兑换</view>
  22. </view>
  23. <view class='item acea-row row-between-wrapper'>
  24. <view>兑换积分</view>
  25. <view class='itemCom'>{{order_pay_info.total_price}}</view>
  26. </view>
  27. <!--失败时加上这个 -->
  28. <view class='item acea-row row-between-wrapper'
  29. v-if="order_pay_info.paid==0 && order_pay_info.pay_type != 'offline'">
  30. <view>失败原因</view>
  31. <view class='itemCom'>{{status==2 ? '取消兑换':msg}}</view>
  32. </view>
  33. </view>
  34. <!--失败时: 重新购买 -->
  35. <view @click="goOrderDetails">
  36. <button formType="submit" class='returnBnt bg-color' hover-class='none'>查看详情</button>
  37. </view>
  38. <button @click="goIndex" class='returnBnt cart-color' formType="submit" hover-class='none'>返回首页</button>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. // +----------------------------------------------------------------------
  44. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  45. // +----------------------------------------------------------------------
  46. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  47. // +----------------------------------------------------------------------
  48. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  49. // +----------------------------------------------------------------------
  50. // | Author: CRMEB Team <admin@crmeb.com>
  51. // +----------------------------------------------------------------------
  52. import { integralOrderDetails } from '@/api/activity.js';
  53. import { openOrderSubscribe } from '@/utils/SubscribeMessage.js';
  54. import { toLogin } from '@/libs/login.js';
  55. import { mapGetters } from "vuex";
  56. export default {
  57. components: {},
  58. data() {
  59. return {
  60. orderId: '',
  61. order_pay_info: {
  62. paid: 1,
  63. _status: {}
  64. },
  65. status: 0,
  66. msg: '',
  67. couponsHidden: true,
  68. couponList: []
  69. };
  70. },
  71. computed: mapGetters(['isLogin']),
  72. watch: {
  73. isLogin: {
  74. handler: function(newV, oldV) {
  75. if (newV) {
  76. //#ifndef MP
  77. this.getOrderPayInfo();
  78. //#endif
  79. }
  80. },
  81. deep: true
  82. }
  83. },
  84. onLoad: function(options) {
  85. if (!options.order_id) return this.$util.Tips({
  86. title: '缺少参数无法查看订单兑换状态'
  87. }, {
  88. tab: 3,
  89. url: 1
  90. });
  91. this.orderId = options.order_id;
  92. this.status = options.status || 0;
  93. this.msg = options.msg || '';
  94. if (this.isLogin) {
  95. this.getOrderPayInfo();
  96. } else {
  97. toLogin();
  98. }
  99. // #ifdef H5
  100. document.addEventListener('visibilitychange', (e) => {
  101. let state = document.visibilityState
  102. if (state == 'hidden') {
  103. console.log('用户离开了');
  104. }
  105. if (state == 'visible') {
  106. this.getOrderPayInfo();
  107. }
  108. });
  109. // #endif
  110. },
  111. methods: {
  112. openTap() {
  113. this.$set(this, 'couponsHidden', !this.couponsHidden);
  114. },
  115. /**
  116. *
  117. * 兑换完成查询兑换状态
  118. *
  119. */
  120. getOrderPayInfo: function() {
  121. let that = this;
  122. uni.showLoading({
  123. title: '正在加载中'
  124. });
  125. integralOrderDetails(that.orderId).then(res => {
  126. uni.hideLoading();
  127. that.$set(that, 'order_pay_info', res.data);
  128. uni.setNavigationBarTitle({
  129. title: 兑换成功
  130. });
  131. that.getOrderCoupon();
  132. }).catch(err => {
  133. uni.hideLoading();
  134. });
  135. },
  136. getOrderCoupon() {
  137. let that = this;
  138. orderCoupon(that.orderId).then(res => {
  139. that.couponList = res.data;
  140. })
  141. },
  142. /**
  143. * 去首页关闭当前所有页面
  144. */
  145. goIndex: function(e) {
  146. uni.switchTab({
  147. url: '/pages/index/index'
  148. })
  149. },
  150. /**
  151. *
  152. * 去订单详情页面
  153. */
  154. goOrderDetails: function(e) {
  155. let that = this;
  156. uni.navigateTo({
  157. url: '/pages/points_mall/integral_order_details?order_id=' + that.orderId
  158. })
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss">
  164. .coupons {
  165. .title {
  166. margin: 30rpx 0 25rpx 0;
  167. .line {
  168. width: 70rpx;
  169. height: 1px;
  170. background: #DCDCDC;
  171. }
  172. .name {
  173. font-size: 24rpx;
  174. color: #999;
  175. margin: 0 10rpx;
  176. }
  177. }
  178. .list {
  179. padding: 0 20rpx;
  180. .item {
  181. margin-bottom: 20rpx;
  182. box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.06);
  183. .price {
  184. width: 236rpx;
  185. height: 160rpx;
  186. font-size: 26rpx;
  187. color: #fff;
  188. font-weight: 800;
  189. text {
  190. font-size: 54rpx;
  191. }
  192. }
  193. .text {
  194. width: 385rpx;
  195. .name {
  196. font-size: #282828;
  197. font-size: 30rpx;
  198. }
  199. .priceMin {
  200. font-size: 24rpx;
  201. color: #999;
  202. margin-top: 10rpx;
  203. }
  204. .time {
  205. font-size: 24rpx;
  206. color: #999;
  207. margin-top: 15rpx;
  208. }
  209. }
  210. }
  211. .open {
  212. font-size: 24rpx;
  213. color: #999;
  214. margin-top: 30rpx;
  215. .iconfont {
  216. font-size: 25rpx;
  217. margin: 5rpx 0 0 10rpx;
  218. }
  219. }
  220. }
  221. }
  222. .payment-status {
  223. background-color: #fff;
  224. margin: 195rpx 30rpx 0 30rpx;
  225. border-radius: 10rpx;
  226. padding: 1rpx 0 28rpx 0;
  227. }
  228. .payment-status .icons {
  229. font-size: 70rpx;
  230. width: 140rpx;
  231. height: 140rpx;
  232. border-radius: 50%;
  233. color: #fff;
  234. text-align: center;
  235. line-height: 140rpx;
  236. text-shadow: 0px 4px 0px rgba(255,255,255,0.5);
  237. border: 6rpx solid #f5f5f5;
  238. margin: -76rpx auto 0 auto;
  239. background-color: #999;
  240. }
  241. .payment-status .icons.icon-iconfontguanbi {
  242. text-shadow: 0px 4px 0px #6c6d6d;
  243. }
  244. .payment-status .iconfont.fail {
  245. text-shadow: 0px 4px 0px #7a7a7a;
  246. }
  247. .payment-status .status {
  248. font-size: 32rpx;
  249. font-weight: bold;
  250. text-align: center;
  251. margin: 25rpx 0 37rpx 0;
  252. }
  253. .payment-status .wrapper {
  254. border: 1rpx solid #eee;
  255. margin: 0 30rpx 47rpx 30rpx;
  256. padding: 35rpx 0;
  257. border-left: 0;
  258. border-right: 0;
  259. }
  260. .payment-status .wrapper .item {
  261. font-size: 28rpx;
  262. color: #282828;
  263. }
  264. .payment-status .wrapper .item~.item {
  265. margin-top: 20rpx;
  266. }
  267. .payment-status .wrapper .item .itemCom {
  268. color: #666;
  269. }
  270. .payment-status .returnBnt {
  271. width: 630rpx;
  272. height: 86rpx;
  273. border-radius: 50rpx;
  274. color: #fff;
  275. font-size: 30rpx;
  276. text-align: center;
  277. line-height: 86rpx;
  278. margin: 0 auto 20rpx auto;
  279. }
  280. </style>