integral_order_status.vue 7.2 KB

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