pay-result.vue 15 KB

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