pay-result.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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="[themeObject.color, 'return-btn']" @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" :class="getTheme">
  35. <app-form-id>
  36. <view class="return-btn small"
  37. :class="[`${getTheme}-m-back`,`${getTheme}-m-border`, getTheme]"
  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" :class="getTheme">
  55. <app-form-id>
  56. <view class="return-btn small"
  57. :class="[`${getTheme}-m-back`,`${getTheme}-m-border`, getTheme]"
  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" :class="getTheme">
  88. <app-form-id>
  89. <view class="return-btn small"
  90. :class="[`${getTheme}-m-back`,`${getTheme}-m-border`, getTheme]"
  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" :class="getTheme">
  108. <app-form-id>
  109. <view class="return-btn small"
  110. :class="[themeObject.back,`${getTheme}-m-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. :theme-object="themeObject"
  126. ></app-related-suggestion-product>
  127. <app-order-share-modal v-if="shareCheck"></app-order-share-modal>
  128. </template>
  129. </app-layout>
  130. </template>
  131. <script>
  132. import {mapGetters, mapState} from 'vuex';
  133. import AppRelatedSuggestionProduct
  134. from '../../components/page-component/app-related-suggestion-product/app-related-suggestion-product';
  135. import appOrderShareModal from "../../components/page-component/app-order-share-modal/app-order-share-modal.vue";
  136. export default {
  137. name: 'pay-result',
  138. components: {
  139. AppRelatedSuggestionProduct,
  140. appOrderShareModal
  141. },
  142. data() {
  143. return {
  144. payment_order_union_id: null,
  145. result: null,
  146. redirectUrl: null,
  147. recommendGoodsList: null,
  148. shareCheck: false,
  149. orderPageUrl: false,
  150. community: false
  151. };
  152. },
  153. computed: {
  154. ...mapState({
  155. appImg: state => state.mallConfig.__wxapp_img,
  156. }),
  157. ...mapGetters('mallConfig', {
  158. getTheme: 'getTheme',
  159. }),
  160. showGift() {
  161. if (!this.result || this.community) {
  162. return false;
  163. }
  164. let { send_data, user_coupon_list, card_list } = this.result;
  165. 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)) {
  166. return true;
  167. }
  168. return false;
  169. },
  170. themeObject:function() {
  171. return {
  172. back: this.getTheme + '-m-back ' + this.getTheme,
  173. backP: this.getTheme + '-m-back-p ' + this.getTheme,
  174. backO: this.getTheme + '-m-back-o ' + this.getTheme,
  175. theme: this.getTheme,
  176. color: this.getTheme + '-m-text ' + this.getTheme,
  177. sBack: this.getTheme + '-s-back ' + this.getTheme,
  178. border: this.getTheme + '-m-border ' + this.getTheme,
  179. }
  180. },
  181. },
  182. onLoad(options) {
  183. this.payment_order_union_id = options.payment_order_union_id;
  184. this.orderPageUrl = decodeURIComponent(options.order_page_url || '/pages/order/index/index?status=0');
  185. if(options.order_page_url === '/plugins/community/order/order') {
  186. this.orderPageUrl = this.orderPageUrl + '?is_user=1'
  187. this.community = true;
  188. }
  189. this.loadData();
  190. this.loadRecommendGoodsList();
  191. },
  192. methods: {
  193. loadData() {
  194. this.$showLoading({
  195. type: 'global',
  196. });
  197. this.$request({
  198. url: this.$api.order.pay_result,
  199. data: {
  200. payment_order_union_id: this.payment_order_union_id
  201. }
  202. }).then(response => {
  203. this.$hideLoading();
  204. if (response.code === 0) {
  205. this.result = response.data;
  206. this.shareCheck = this.result.shareCheck;
  207. if (this.result.order_page_url) {
  208. this.orderPageUrl = this.result.order_page_url;
  209. }
  210. }
  211. }).catch(() => {
  212. this.$hideLoading();
  213. });
  214. },
  215. redirectTo(url) {
  216. uni.redirectTo({
  217. url: url,
  218. });
  219. },
  220. reLaunch(url) {
  221. uni.reLaunch({
  222. url: url,
  223. });
  224. },
  225. loadRecommendGoodsList() {
  226. if (this.community) {
  227. return false;
  228. }
  229. this.$request({
  230. url: this.$api.goods.new_recommend,
  231. method: 'get',
  232. data: {
  233. type: 'order_pay',
  234. },
  235. }).then(response => {
  236. if (response.code === 0) {
  237. this.recommendGoodsList = response.data.list;
  238. }
  239. }).catch(() => {
  240. });
  241. },
  242. }
  243. }
  244. </script>
  245. <style scoped lang="scss">
  246. .return-btn {
  247. height: #{72rpx};
  248. line-height: #{70rpx};
  249. border: #{2rpx} solid;
  250. border-radius: #{1000rpx};
  251. padding: 0 #{32rpx};
  252. font-size: $uni-font-size-general-one;
  253. }
  254. .return-btn:active {
  255. box-shadow: inset 0 0 #{100rpx} rgba(0, 0, 0, .15);
  256. }
  257. .return-btn.small {
  258. height: #{60rpx};
  259. line-height: #{58rpx};
  260. padding: 0 #{24rpx};
  261. font-size: #{24rpx};
  262. color: #ffffff;
  263. }
  264. .mb-12 {
  265. margin-bottom: #{12rpx};
  266. }
  267. .mb-24 {
  268. margin-bottom: #{24rpx};
  269. }
  270. .pay-result {
  271. text-align: center;
  272. background: #fff;
  273. padding: #{36rpx};
  274. &.over-page {
  275. position: absolute;
  276. width: 100%;
  277. height: 100%;
  278. }
  279. .top-pic {
  280. width: #{220rpx};
  281. height: #{172rpx};
  282. }
  283. .pay-price {
  284. color: $uni-general-color-one;
  285. }
  286. .default-border {
  287. border-color: $uni-general-color-two;
  288. }
  289. .btn-wrap {
  290. padding: #{36rpx};
  291. }
  292. .gift {
  293. position: relative;
  294. padding: #{24rpx};
  295. border-radius: #{20rpx};
  296. background: #ffbe6a;
  297. .background {
  298. position: absolute;
  299. left: 0;
  300. top: 0;
  301. width: 100%;
  302. height: #{102rpx};
  303. z-index: 0;
  304. }
  305. .title {
  306. text-align: center;
  307. font-weight: bold;
  308. color: #fff;
  309. margin-bottom: #{24rpx};
  310. }
  311. .gift-scroll {
  312. max-height: #{400rpx};
  313. }
  314. .item {
  315. background: #fff;
  316. margin-bottom: #{24rpx};
  317. border-radius: #{18rpx};
  318. padding: #{18rpx};
  319. min-height: #{160rpx};
  320. > view:nth-of-type(1) {
  321. min-width: #{180rpx};
  322. }
  323. > view:nth-of-type(2) {
  324. text-align: left;
  325. margin-left: #{10rpx};
  326. }
  327. }
  328. .item:last-child {
  329. margin-bottom: 0;
  330. }
  331. .coupon-discount,
  332. .coupon-discount-unit,
  333. .coupon-price-unit,
  334. .coupon-price {
  335. color: $uni-important-color-red;
  336. line-height: 1;
  337. }
  338. .coupon-discount-unit,
  339. .coupon-price-unit {
  340. line-height: 1.15;
  341. }
  342. .coupon-price,
  343. .coupon-discount {
  344. font-size: #{48rpx};
  345. }
  346. .hongbao-img,
  347. .integral-img,
  348. .card-img {
  349. width: #{80rpx};
  350. height: #{80rpx};
  351. border-radius: #{1000rpx};
  352. }
  353. .coupon-name,
  354. .card-name {
  355. white-space: nowrap;
  356. overflow: hidden;
  357. text-overflow: ellipsis;
  358. }
  359. .send-data-desc,
  360. .coupon-desc {
  361. font-size: $uni-font-size-weak-one;
  362. color: $uni-general-color-one;
  363. }
  364. }
  365. }
  366. </style>