integral_order_status.vue 6.7 KB

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