index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view>
  3. <view class='payment-status'>
  4. <!--失败时: 用icon-iconfontguanbi fail替换icon-duihao2 bg-color-->
  5. <view class='iconfont icons icon-duihao2 bg-color' v-if="order_pay_info.paid || order_pay_info.payType == 'offline'"></view>
  6. <view class='iconfont icons icon-iconfontguanbi' v-else></view>
  7. <!-- 失败时:订单支付失败 -->
  8. <view class='status' v-if="order_pay_info.payType != 'offline'">{{order_pay_info.paid ? '订单支付成功':'订单支付失败'}}</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'>{{order_pay_info.orderId}}</view>
  14. </view>
  15. <view class='item acea-row row-between-wrapper'>
  16. <view>下单时间</view>
  17. <view class='itemCom'>{{order_pay_info.createTime?order_pay_info.createTime:'-'}}</view>
  18. </view>
  19. <view class='item acea-row row-between-wrapper'>
  20. <view>支付方式</view>
  21. <view class='itemCom' v-if="order_pay_info.payType=='weixin'">微信支付</view>
  22. <view class='itemCom' v-else-if="order_pay_info.payType=='yue'">余额支付</view>
  23. <view class='itemCom' v-else-if="order_pay_info.payType=='offline'">线下支付</view>
  24. <view class='itemCom' v-else-if="order_pay_info.payType=='alipay'">支付宝支付</view>
  25. </view>
  26. <view class='item acea-row row-between-wrapper'>
  27. <view>支付金额</view>
  28. <view class='itemCom'>{{order_pay_info.payPrice}}</view>
  29. </view>
  30. <!--失败时加上这个 -->
  31. <view class='item acea-row row-between-wrapper' v-if="order_pay_info.paid==0 && order_pay_info.payType != 'offline'">
  32. <view>失败原因</view>
  33. <view class='itemCom'>{{status==2 ? '取消支付':msg}}</view>
  34. </view>
  35. </view>
  36. <!--失败时: 重新购买 -->
  37. <view @tap="goOrderDetails">
  38. <button formType="submit" class='returnBnt bg-color' hover-class='none'>查看订单</button>
  39. </view>
  40. <!-- <view @tap="goOrderDetails" v-if="order_pay_info.paid==0 && status==1">
  41. <button class='returnBnt bg-color' hover-class='none'>重新购买</button>
  42. </view>
  43. <view @tap="goOrderDetails" v-if="order_pay_info.paid==0 && status==2">
  44. <button class='returnBnt bg-color' hover-class='none'>重新支付</button>
  45. </view> -->
  46. <button @click="goPink(order_pay_info.pinkId)" class='returnBnt cart-color' formType="submit" hover-class='none' v-if="order_pay_info.pinkId && order_pay_info.paid!=0 && status!=2 && status!=1">邀请好友参团</button>
  47. <button @click="goIndex" class='returnBnt cart-color' formType="submit" hover-class='none' v-else>返回首页</button>
  48. </view>
  49. <!-- #ifdef MP -->
  50. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  51. <!-- #endif -->
  52. </view>
  53. </template>
  54. <script>
  55. import {
  56. getOrderDetail
  57. } from '@/api/order.js';
  58. import {
  59. openOrderSubscribe
  60. } from '@/utils/SubscribeMessage.js';
  61. import {
  62. toLogin
  63. } from '@/libs/login.js';
  64. import {
  65. mapGetters
  66. } from "vuex";
  67. // #ifdef MP
  68. import authorize from '@/components/Authorize';
  69. // #endif
  70. export default {
  71. components: {
  72. // #ifdef MP
  73. authorize
  74. // #endif
  75. },
  76. data() {
  77. return {
  78. orderId: '',
  79. order_pay_info: {
  80. paid: 1,
  81. _status: {}
  82. },
  83. isAuto: false, //没有授权的不会自动授权
  84. isShowAuth: false ,//是否隐藏授权
  85. status:0,
  86. msg:''
  87. };
  88. },
  89. computed: mapGetters(['isLogin']),
  90. watch:{
  91. isLogin:{
  92. handler:function(newV,oldV){
  93. if(newV){
  94. this.getOrderPayInfo();
  95. }
  96. },
  97. deep:true
  98. }
  99. },
  100. onLoad: function(options) {
  101. if (!options.order_id) return this.$util.Tips({
  102. title: '缺少参数无法查看订单支付状态'
  103. }, {
  104. tab: 3,
  105. url: 1
  106. });
  107. this.orderId = options.order_id;
  108. this.status = options.status || 0;
  109. this.msg = options.msg || '';
  110. if (this.isLogin) {
  111. this.getOrderPayInfo();
  112. } else {
  113. toLogin();
  114. }
  115. },
  116. methods: {
  117. onLoadFun: function() {
  118. this.getOrderPayInfo();
  119. },
  120. /**
  121. *
  122. * 支付完成查询支付状态
  123. *
  124. */
  125. getOrderPayInfo: function() {
  126. let that = this;
  127. uni.showLoading({
  128. title: '正在加载中'
  129. });
  130. getOrderDetail(that.orderId).then(res => {
  131. uni.hideLoading();
  132. that.$set(that, 'order_pay_info', res.data);
  133. uni.setNavigationBarTitle({
  134. title: res.data.paid ? '支付成功' : '支付失败'
  135. });
  136. }).catch(err => {
  137. uni.hideLoading();
  138. });
  139. },
  140. /**
  141. * 去首页关闭当前所有页面
  142. */
  143. goIndex: function(e) {
  144. uni.switchTab({
  145. url: '/pages/index/index'
  146. });
  147. },
  148. // 去参团页面;
  149. goPink:function(id){
  150. uni.navigateTo({
  151. url: '/pages/activity/goods_combination_status/index?id='+id
  152. });
  153. },
  154. /**
  155. *
  156. * 去订单详情页面
  157. */
  158. goOrderDetails: function(e) {
  159. let that = this;
  160. // #ifdef MP
  161. uni.showLoading({
  162. title: '正在加载',
  163. })
  164. openOrderSubscribe().then(res => {
  165. uni.hideLoading();
  166. uni.navigateTo({
  167. url: '/pages/order_details/index?order_id=' + that.orderId
  168. });
  169. }).catch(() => {
  170. nui.hideLoading();
  171. });
  172. // #endif
  173. // #ifndef MP
  174. uni.navigateTo({
  175. url: '/pages/order_details/index?order_id=' + that.orderId
  176. })
  177. // #endif
  178. }
  179. }
  180. }
  181. </script>
  182. <style>
  183. .icon-iconfontguanbi{
  184. background-color: #999 !important;
  185. text-shadow: none !important;
  186. }
  187. .payment-status {
  188. background-color: #fff;
  189. margin: 195rpx 30rpx 0 30rpx;
  190. border-radius: 10rpx;
  191. padding: 1rpx 0 28rpx 0;
  192. }
  193. .payment-status .icons {
  194. font-size: 70rpx;
  195. width: 140rpx;
  196. height: 140rpx;
  197. border-radius: 50%;
  198. color: #fff;
  199. text-align: center;
  200. line-height: 140rpx;
  201. text-shadow: 0px 4px 0px #df1e14;
  202. border: 6rpx solid #f5f5f5;
  203. margin: -76rpx auto 0 auto;
  204. background-color: #999;
  205. }
  206. .payment-status .iconfont {
  207. font-size: 70rpx;
  208. width: 140rpx;
  209. height: 140rpx;
  210. border-radius: 50%;
  211. color: #fff;
  212. text-align: center;
  213. line-height: 140rpx;
  214. text-shadow: 0px 4px 0px #df1e14;
  215. border: 6rpx solid #f5f5f5;
  216. margin: -76rpx auto 0 auto;
  217. background-color: #999;
  218. }
  219. .payment-status .iconfont.fail {
  220. text-shadow: 0px 4px 0px #7a7a7a;
  221. }
  222. .payment-status .status {
  223. font-size: 32rpx;
  224. font-weight: bold;
  225. text-align: center;
  226. margin: 25rpx 0 37rpx 0;
  227. }
  228. .payment-status .wrapper {
  229. border: 1rpx solid #eee;
  230. margin: 0 30rpx 47rpx 30rpx;
  231. padding: 35rpx 0;
  232. border-left: 0;
  233. border-right: 0;
  234. }
  235. .payment-status .wrapper .item {
  236. font-size: 28rpx;
  237. color: #282828;
  238. }
  239. .payment-status .wrapper .item~.item {
  240. margin-top: 20rpx;
  241. }
  242. .payment-status .wrapper .item .itemCom {
  243. color: #666;
  244. }
  245. .payment-status .returnBnt {
  246. width: 630rpx;
  247. height: 86rpx;
  248. border-radius: 50rpx;
  249. color: #fff;
  250. font-size: 30rpx;
  251. text-align: center;
  252. line-height: 86rpx;
  253. margin: 0 auto 20rpx auto;
  254. }
  255. </style>