integral_order_status.vue 7.1 KB

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