integral_order_status.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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 @tap="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. import {
  44. integralOrderDetails,
  45. } from '@/api/activity.js';
  46. import {
  47. openOrderSubscribe
  48. } from '@/utils/SubscribeMessage.js';
  49. import {
  50. toLogin
  51. } from '@/libs/login.js';
  52. import {
  53. mapGetters
  54. } from "vuex";
  55. import colors from "@/mixins/color";
  56. export default {
  57. components: {},
  58. mixins: [colors],
  59. data() {
  60. return {
  61. orderId: '',
  62. order_pay_info: {
  63. paid: 1,
  64. _status: {}
  65. },
  66. isAuto: false, //没有授权的不会自动授权
  67. isShowAuth: false, //是否隐藏授权
  68. status: 0,
  69. msg: '',
  70. couponsHidden: true,
  71. couponList: []
  72. };
  73. },
  74. computed: mapGetters(['isLogin']),
  75. watch: {
  76. isLogin: {
  77. handler: function(newV, oldV) {
  78. if (newV) {
  79. this.getOrderPayInfo();
  80. }
  81. },
  82. deep: true
  83. }
  84. },
  85. onLoad: function(options) {
  86. if (!options.order_id) return this.$util.Tips({
  87. title: '缺少参数无法查看订单兑换状态'
  88. }, {
  89. tab: 3,
  90. url: 1
  91. });
  92. this.orderId = options.order_id;
  93. this.status = options.status || 0;
  94. this.msg = options.msg || '';
  95. if (this.isLogin) {
  96. this.getOrderPayInfo();
  97. } else {
  98. toLogin();
  99. }
  100. // #ifdef H5
  101. document.addEventListener('visibilitychange', (e) => {
  102. let state = document.visibilityState
  103. if (state == 'hidden') {
  104. console.log('用户离开了');
  105. }
  106. if (state == 'visible') {
  107. this.getOrderPayInfo();
  108. }
  109. });
  110. // #endif
  111. },
  112. methods: {
  113. openTap() {
  114. this.$set(this, 'couponsHidden', !this.couponsHidden);
  115. },
  116. onLoadFun: function() {
  117. this.getOrderPayInfo();
  118. },
  119. /**
  120. *
  121. * 兑换完成查询兑换状态
  122. *
  123. */
  124. getOrderPayInfo: function() {
  125. let that = this;
  126. uni.showLoading({
  127. title: '正在加载中'
  128. });
  129. integralOrderDetails(that.orderId).then(res => {
  130. uni.hideLoading();
  131. that.$set(that, 'order_pay_info', res.data);
  132. uni.setNavigationBarTitle({
  133. title: 兑换成功
  134. });
  135. that.getOrderCoupon();
  136. }).catch(err => {
  137. uni.hideLoading();
  138. });
  139. },
  140. getOrderCoupon() {
  141. let that = this;
  142. orderCoupon(that.orderId).then(res => {
  143. that.couponList = res.data;
  144. })
  145. },
  146. /**
  147. * 去首页关闭当前所有页面
  148. */
  149. goIndex: function(e) {
  150. uni.switchTab({
  151. url: '/pages/index/index'
  152. })
  153. },
  154. /**
  155. *
  156. * 去订单详情页面
  157. */
  158. goOrderDetails: function(e) {
  159. let that = this;
  160. uni.navigateTo({
  161. url: '/pages/points_mall/integral_order_details?order_id=' + that.orderId
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss">
  168. .coupons {
  169. .title {
  170. margin: 30rpx 0 25rpx 0;
  171. .line {
  172. width: 70rpx;
  173. height: 1px;
  174. background: #DCDCDC;
  175. }
  176. .name {
  177. font-size: 24rpx;
  178. color: #999;
  179. margin: 0 10rpx;
  180. }
  181. }
  182. .list {
  183. padding: 0 20rpx;
  184. .item {
  185. margin-bottom: 20rpx;
  186. box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.06);
  187. .price {
  188. width: 236rpx;
  189. height: 160rpx;
  190. font-size: 26rpx;
  191. color: #fff;
  192. font-weight: 800;
  193. text {
  194. font-size: 54rpx;
  195. }
  196. }
  197. .text {
  198. width: 385rpx;
  199. .name {
  200. font-size: #282828;
  201. font-size: 30rpx;
  202. }
  203. .priceMin {
  204. font-size: 24rpx;
  205. color: #999;
  206. margin-top: 10rpx;
  207. }
  208. .time {
  209. font-size: 24rpx;
  210. color: #999;
  211. margin-top: 15rpx;
  212. }
  213. }
  214. }
  215. .open {
  216. font-size: 24rpx;
  217. color: #999;
  218. margin-top: 30rpx;
  219. .iconfont {
  220. font-size: 25rpx;
  221. margin: 5rpx 0 0 10rpx;
  222. }
  223. }
  224. }
  225. }
  226. .payment-status {
  227. background-color: #fff;
  228. margin: 195rpx 30rpx 0 30rpx;
  229. border-radius: 10rpx;
  230. padding: 1rpx 0 28rpx 0;
  231. }
  232. .payment-status .icons {
  233. font-size: 70rpx;
  234. width: 140rpx;
  235. height: 140rpx;
  236. border-radius: 50%;
  237. color: #fff;
  238. text-align: center;
  239. line-height: 140rpx;
  240. text-shadow: 0px 4px 0px rgba(255,255,255,0.5);
  241. border: 6rpx solid #f5f5f5;
  242. margin: -76rpx auto 0 auto;
  243. background-color: #999;
  244. }
  245. .payment-status .icons.icon-iconfontguanbi {
  246. text-shadow: 0px 4px 0px #6c6d6d;
  247. }
  248. .payment-status .iconfont.fail {
  249. text-shadow: 0px 4px 0px #7a7a7a;
  250. }
  251. .payment-status .status {
  252. font-size: 32rpx;
  253. font-weight: bold;
  254. text-align: center;
  255. margin: 25rpx 0 37rpx 0;
  256. }
  257. .payment-status .wrapper {
  258. border: 1rpx solid #eee;
  259. margin: 0 30rpx 47rpx 30rpx;
  260. padding: 35rpx 0;
  261. border-left: 0;
  262. border-right: 0;
  263. }
  264. .payment-status .wrapper .item {
  265. font-size: 28rpx;
  266. color: #282828;
  267. }
  268. .payment-status .wrapper .item~.item {
  269. margin-top: 20rpx;
  270. }
  271. .payment-status .wrapper .item .itemCom {
  272. color: #666;
  273. }
  274. .payment-status .returnBnt {
  275. width: 630rpx;
  276. height: 86rpx;
  277. border-radius: 50rpx;
  278. color: #fff;
  279. font-size: 30rpx;
  280. text-align: center;
  281. line-height: 86rpx;
  282. margin: 0 auto 20rpx auto;
  283. }
  284. </style>