integral_order_status.vue 6.7 KB

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