pay-result.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <app-layout>
  3. <template v-if="result">
  4. <view class="pay-result mb-24">
  5. <image class="top-pic mb-24" :src="appImg.mall.order_pay_success"></image>
  6. <view class="mb-24" style="font-weight: bold;">订单提交成功</view>
  7. <view class="pay-price mb-24">¥{{result.total_pay_price}}</view>
  8. <view class="dir-left-nowrap main-center">
  9. <view class="btn-wrap">
  10. <view class="return-btn"
  11. style="color: #999999;border-color: #e2e2e2"
  12. @click="reLaunch('/pages/index/index')">返回首页
  13. </view>
  14. </view>
  15. <view class="btn-wrap">
  16. <view class="return-btn"
  17. :class="[`${theme}-color`,`${theme}-border`,]"
  18. @click="redirectTo(orderPageUrl)">查看订单
  19. </view>
  20. </view>
  21. </view>
  22. <view v-if="showGift" class="gift">
  23. <image class="background" :src="appImg.mall.order_pay_result_coupon"></image>
  24. <view class="title">恭喜你获得</view>
  25. <scroll-view scroll-y class="gift-scroll">
  26. <template v-if="result.send_data && result.send_data.send_integral_num>0">
  27. <view class="item dir-left-nowrap cross-center">
  28. <view class="box-grow-0">
  29. <image class="integral-img" src="/static/image/integral.png"></image>
  30. </view>
  31. <view class="box-grow-1">
  32. <view class="send-data-name mb-12">{{result.send_data.send_integral_num}}积分</view>
  33. <view class="send-data-desc">即时到账</view>
  34. </view>
  35. <view class="box-grow-0">
  36. <app-form-id>
  37. <view class="return-btn small"
  38. :class="[`${theme}-background`,`${theme}-border`,]"
  39. @click="redirectTo('/pages/index/index')">
  40. 立即使用
  41. </view>
  42. </app-form-id>
  43. </view>
  44. </view>
  45. </template>
  46. <template v-if="result.send_data && result.send_data.send_balance>0">
  47. <view class="item dir-left-nowrap cross-center">
  48. <view class="box-grow-0">
  49. <image class="hongbao-img" src="/static/image/hongbao.png"></image>
  50. </view>
  51. <view class="box-grow-1">
  52. <view class="send-data-name mb-12">{{result.send_data.send_balance}}元余额红包</view>
  53. <view class="send-data-desc">即时到账</view>
  54. </view>
  55. <view class="box-grow-0">
  56. <app-form-id>
  57. <view class="return-btn small"
  58. :class="[`${theme}-background`,`${theme}-border`,]"
  59. @click="redirectTo('/pages/index/index')">
  60. 立即使用
  61. </view>
  62. </app-form-id>
  63. </view>
  64. </view>
  65. </template>
  66. <template v-if="result.user_coupon_list && result.user_coupon_list.length">
  67. <view class="item dir-left-nowrap cross-center"
  68. v-for="(item,index) in result.user_coupon_list"
  69. :key="index">
  70. <view class="box-grow-0 dir-left-nowrap cross-bottom main-center">
  71. <template v-if="item.type==1">
  72. <view class="coupon-discount">{{item.discount}}</view>
  73. <view class="coupon-discount-unit">折</view>
  74. </template>
  75. <template v-if="item.type==2">
  76. <view class="coupon-price-unit">¥</view>
  77. <view class="coupon-price">{{item.sub_price}}</view>
  78. </template>
  79. </view>
  80. <view class="box-grow-1">
  81. <view class="coupon-name mb-12">{{item.name}}</view>
  82. <view class="coupon-desc">
  83. <block v-if="item.min_price>0">满{{item.min_price}}元可用</block>
  84. <block v-else>满任意金额可用</block>
  85. </view>
  86. <view class="coupon-desc" v-if="item.discount_limit">优惠上限:¥{{item.discount_limit}}</view>
  87. </view>
  88. <view class="box-grow-0">
  89. <app-form-id>
  90. <view class="return-btn small"
  91. :class="[`${theme}-background`,`${theme}-border`,]"
  92. @click="redirectTo(item.appoint_type == 4 ? '/plugins/scan_code/index/index': '/pages/coupon/index/index')">
  93. 立即使用
  94. </view>
  95. </app-form-id>
  96. </view>
  97. </view>
  98. </template>
  99. <template v-if="result.card_list && result.card_list.length">
  100. <view class="item dir-left-nowrap cross-center" v-for="(item,index) in result.card_list"
  101. :key="index">
  102. <view class="box-grow-0">
  103. <image class="card-img" :src="item.pic_url"></image>
  104. </view>
  105. <view class="box-grow-1">
  106. <view class="card-name">{{item.name}}</view>
  107. </view>
  108. <view class="box-grow-0">
  109. <app-form-id>
  110. <view class="return-btn small"
  111. :class="[`${theme}-background`,`${theme}-border`,]"
  112. @click="redirectTo('/pages/card/index/index')">
  113. 立即使用
  114. </view>
  115. </app-form-id>
  116. </view>
  117. </view>
  118. </template>
  119. </scroll-view>
  120. </view>
  121. </view>
  122. <app-related-suggestion-product v-if="recommendGoodsList && recommendGoodsList.length"
  123. :list="recommendGoodsList"
  124. text="您或许会喜欢"
  125. ></app-related-suggestion-product>
  126. <app-order-share-modal v-if="shareCheck"></app-order-share-modal>
  127. </template>
  128. </app-layout>
  129. </template>
  130. <script>
  131. import {mapState} from 'vuex';
  132. import AppRelatedSuggestionProduct
  133. from '../../components/page-component/app-related-suggestion-product/app-related-suggestion-product';
  134. import appOrderShareModal from "../../components/page-component/app-order-share-modal/app-order-share-modal.vue";
  135. export default {
  136. name: 'pay-result',
  137. components: {
  138. AppRelatedSuggestionProduct,
  139. appOrderShareModal
  140. },
  141. data() {
  142. return {
  143. payment_order_union_id: null,
  144. result: null,
  145. redirectUrl: null,
  146. recommendGoodsList: null,
  147. shareCheck: false,
  148. };
  149. },
  150. computed: {
  151. ...mapState({
  152. theme: state => state.mallConfig.theme,
  153. appImg: state => state.mallConfig.__wxapp_img,
  154. }),
  155. showGift() {
  156. if (!this.result) {
  157. return false;
  158. }
  159. if (
  160. (this.result.send_data && this.result.send_data.send_integral_num > 0) ||
  161. (this.result.send_data && this.result.send_data.send_balance > 0) ||
  162. (this.result.user_coupon_list && this.result.user_coupon_list.length) ||
  163. (this.result.card_list && this.result.card_list.length)
  164. ) {
  165. return true;
  166. }
  167. return false;
  168. },
  169. },
  170. onLoad(options) {
  171. this.payment_order_union_id = options.payment_order_union_id;
  172. this.orderPageUrl = decodeURIComponent(options.order_page_url || '/pages/order/index/index?status=0');
  173. this.loadData();
  174. this.loadRecommendGoodsList();
  175. },
  176. methods: {
  177. loadData() {
  178. this.$showLoading({
  179. type: 'global',
  180. });
  181. this.$request({
  182. url: this.$api.order.pay_result,
  183. data: {
  184. payment_order_union_id: this.payment_order_union_id,
  185. },
  186. }).then(response => {
  187. this.$hideLoading();
  188. if (response.code === 0) {
  189. this.result = response.data;
  190. this.shareCheck = this.result.shareCheck;
  191. if (this.result.order_page_url) {
  192. this.orderPageUrl = this.result.order_page_url;
  193. }
  194. }
  195. }).catch(e => {
  196. this.$hideLoading();
  197. });
  198. },
  199. redirectTo(url) {
  200. uni.redirectTo({
  201. url: url,
  202. });
  203. },
  204. reLaunch(url) {
  205. uni.reLaunch({
  206. url: url,
  207. });
  208. },
  209. loadRecommendGoodsList() {
  210. this.$request({
  211. url: this.$api.goods.new_recommend,
  212. method: 'get',
  213. data: {
  214. type: 'order_pay',
  215. },
  216. }).then(response => {
  217. if (response.code === 0) {
  218. this.recommendGoodsList = response.data.list;
  219. }
  220. }).catch(e => {
  221. });
  222. },
  223. }
  224. }
  225. </script>
  226. <style scoped lang="scss">
  227. .return-btn {
  228. height: #{72rpx};
  229. line-height: #{70rpx};
  230. border: #{1rpx} solid;
  231. border-radius: #{1000rpx};
  232. padding: 0 #{32rpx};
  233. font-size: $uni-font-size-general-one;
  234. }
  235. .return-btn:active {
  236. box-shadow: inset 0 0 #{100rpx} rgba(0, 0, 0, .15);
  237. }
  238. .return-btn.small {
  239. height: #{60rpx};
  240. line-height: #{58rpx};
  241. padding: 0 #{24rpx};
  242. font-size: #{24rpx};
  243. }
  244. .mb-12 {
  245. margin-bottom: #{12rpx};
  246. }
  247. .mb-24 {
  248. margin-bottom: #{24rpx};
  249. }
  250. .pay-result {
  251. text-align: center;
  252. background: #fff;
  253. padding: #{36rpx};
  254. .top-pic {
  255. width: #{220rpx};
  256. height: #{172rpx};
  257. }
  258. .pay-price {
  259. color: $uni-general-color-one;
  260. }
  261. .default-border {
  262. border-color: $uni-general-color-two;
  263. }
  264. .btn-wrap {
  265. padding: #{36rpx};
  266. }
  267. .gift {
  268. position: relative;
  269. padding: #{24rpx};
  270. border-radius: #{20rpx};
  271. background: #ffbe6a;
  272. .background {
  273. position: absolute;
  274. left: 0;
  275. top: 0;
  276. width: 100%;
  277. height: #{102rpx};
  278. z-index: 0;
  279. }
  280. .title {
  281. text-align: center;
  282. font-weight: bold;
  283. color: #fff;
  284. margin-bottom: #{24rpx};
  285. }
  286. .gift-scroll {
  287. max-height: #{400rpx};
  288. }
  289. .item {
  290. background: #fff;
  291. margin-bottom: #{24rpx};
  292. border-radius: #{18rpx};
  293. padding: #{18rpx};
  294. min-height: #{160rpx};
  295. > view:nth-of-type(1) {
  296. min-width: #{180rpx};
  297. }
  298. > view:nth-of-type(2) {
  299. text-align: left;
  300. margin-left: #{10rpx};
  301. }
  302. }
  303. .item:last-child {
  304. margin-bottom: 0;
  305. }
  306. .coupon-discount,
  307. .coupon-discount-unit,
  308. .coupon-price-unit,
  309. .coupon-price {
  310. color: $uni-important-color-red;
  311. line-height: 1;
  312. }
  313. .coupon-discount-unit,
  314. .coupon-price-unit {
  315. line-height: 1.15;
  316. }
  317. .coupon-price,
  318. .coupon-discount {
  319. font-size: #{48rpx};
  320. }
  321. .hongbao-img,
  322. .integral-img,
  323. .card-img {
  324. width: #{80rpx};
  325. height: #{80rpx};
  326. border-radius: #{1000rpx};
  327. }
  328. .coupon-name,
  329. .card-name {
  330. white-space: nowrap;
  331. overflow: hidden;
  332. text-overflow: ellipsis;
  333. }
  334. .send-data-desc,
  335. .coupon-desc {
  336. font-size: $uni-font-size-weak-one;
  337. color: $uni-general-color-one;
  338. }
  339. }
  340. }
  341. </style>