order-pay.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="order-pay">
  3. <view class="top-tip">请对每家店铺分别进行付款</view>
  4. <template v-for="order in orderList">
  5. <view class="shop-info" :key="order.shopId">
  6. <view class="shop-name">{{ order.shopName }}</view>
  7. <view class="product-list">
  8. <template v-for="product in order.orderProductList">
  9. <view class="product" :key="product.orderProductId">
  10. <image class="cover" :src="product.productImage" mode="widthFix"></image>
  11. <view class="content">
  12. <view class="count">×{{ product.num }}</view>
  13. <view class="title">{{ product.name }}</view>
  14. <view class="unit">规格:{{ product.productUnit }}</view>
  15. <view class="tags">
  16. <!-- 促销 自营 -->
  17. <view class="tag cx" v-if="userId === product.heUserId">促销</view>
  18. <view class="tag cx" v-else>自营</view>
  19. <!-- 拼团价 活动价 限时特价 券后价 -->
  20. <view class="tag pt" v-if="isCollagePrice(product)">拼团价</view>
  21. <view class="tag hd" v-else-if="isActivityPrice(product)">活动价</view>
  22. <view class="tag other" v-else-if="isDiscountPrice(product)">限时特价</view>
  23. <view class="tag other" v-else-if="product.couponStatus > 1">
  24. {{ product.couponInfo }}
  25. </view>
  26. <view class="tag other" v-else-if="product.couponStatus > 0">券后价</view>
  27. </view>
  28. <view class="price">
  29. <text class="active">¥{{ product.price | priceFormat }}</text>
  30. <text class="deleted">¥{{ product.normalPrice | priceFormat }}</text>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. </view>
  36. <view class="total">
  37. <text>优惠:¥{{ order.eachDiscount | priceFormat }}</text>
  38. <text>已付:¥{{ order.receiptAmount | priceFormat }}</text>
  39. </view>
  40. <view class="foot" v-if="order.receiptStatus !== 3">
  41. <view class="price">
  42. <text>待付:</text>
  43. <text class="active">¥{{ order.restAmount | priceFormat }}</text>
  44. </view>
  45. <view class="submit" @click="onPayOrder(order)">付款</view>
  46. </view>
  47. </view>
  48. </template>
  49. <view class="shop-info">
  50. <view class="shop-name">采美快递物流商</view>
  51. <view class="product-list">
  52. <view class="product">
  53. <image
  54. class="cover"
  55. src="https://static.caimei365.com/app/mini-hehe/icon/icon-logistics.png"
  56. mode="widthFix"
  57. ></image>
  58. <view class="content between">
  59. <view class="title">运费</view>
  60. <view class="price"><text>¥0</text></view>
  61. <view class="count">×1</view>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- <view class="total">
  66. <text>优惠:¥20.00</text>
  67. <text>已付:¥0</text>
  68. </view> -->
  69. <view class="foot">
  70. <view class="price">
  71. <text>待付:</text>
  72. <text class="active">¥0</text>
  73. </view>
  74. <!-- <view class="submit" @click="onPay">付款</view> -->
  75. </view>
  76. </view>
  77. <!-- 操作弹窗 -->
  78. <tui-modal :show="modal" content="确认支付?" :maskClosable="false" @click="handleModalConfirm"></tui-modal>
  79. </view>
  80. </template>
  81. <script>
  82. import { mapGetters } from 'vuex'
  83. import wechatPay from './mixins/wechatPay.js'
  84. import { fetchOrderDetail } from '@/services/api/order.js'
  85. export default {
  86. mixins: [wechatPay],
  87. data() {
  88. return {
  89. orderId: '',
  90. modal: false,
  91. orderList: [],
  92. orderInfo: {}
  93. }
  94. },
  95. computed: {
  96. ...mapGetters(['userId'])
  97. },
  98. onLoad(option) {
  99. this.orderId = option.orderId
  100. this.getOrderDetail() // 获取订单支付列表
  101. this.orderPaySuccess() // 支付回调执行函数
  102. },
  103. methods: {
  104. // 支付成功回调
  105. orderPaySuccess() {
  106. this.$on('orderPaySuccess', orderInfo => {
  107. if (this.collageFlag === 1) {
  108. uni.redirectTo({ url: `share-buy/share-buy-detail?collageId=${this.collageId}` })
  109. } else {
  110. uni.setStorageSync('PAY_ORDER_INFO', orderInfo)
  111. this.$router.redirectTo('order/pay-success')
  112. }
  113. })
  114. },
  115. // 确认支付
  116. handleModalConfirm(e) {
  117. this.modal = false
  118. if (!e.index) return
  119. this.miniWxPayFor(this.orderInfo)
  120. },
  121. // 子订单支付
  122. onPayOrder(orderInfo) {
  123. orderInfo.payableAmount = orderInfo.restAmount
  124. this.orderInfo = orderInfo
  125. this.modal = true
  126. },
  127. // 获取订单支付列表
  128. async getOrderDetail() {
  129. try {
  130. const { data } = await fetchOrderDetail({ orderId: this.orderId })
  131. this.orderList = data.shopOrderList
  132. } catch (e) {
  133. console.log('获取订单信息失败')
  134. console.log(e)
  135. }
  136. },
  137. // 活动价
  138. isActivityPrice(product) {
  139. return product.activeStatus > 0 || product.actProduct === '1'
  140. },
  141. // 拼团价
  142. isCollagePrice(product) {
  143. return product.collageStatus > 0 || product.actProduct === '2'
  144. },
  145. // 限时特价
  146. isDiscountPrice(product) {
  147. return product.discountStatus > 0 || product.actProduct === '3'
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .order-pay {
  154. min-height: 100vh;
  155. background: #f7f7f7;
  156. .top-tip {
  157. position: sticky;
  158. top: 0;
  159. z-index: 99;
  160. width: 750rpx;
  161. height: 80rpx;
  162. line-height: 80rpx;
  163. padding: 0 24rpx;
  164. background: #fff3f7;
  165. color: #ff457b;
  166. font-size: 26rpx;
  167. box-sizing: border-box;
  168. }
  169. .shop-info {
  170. padding: 32rpx 24rpx;
  171. background-color: #fff;
  172. margin-bottom: 20rpx;
  173. .shop-name {
  174. font-size: 30rpx;
  175. color: #333333;
  176. font-weight: bold;
  177. }
  178. .product-list {
  179. .product {
  180. display: flex;
  181. margin: 20rpx 0;
  182. .cover {
  183. width: 180rpx;
  184. height: 180rpx;
  185. border-radius: 8rpx;
  186. background-color: #f7f7f7;
  187. }
  188. .content {
  189. position: relative;
  190. width: 500rpx;
  191. margin-left: 16rpx;
  192. .count {
  193. position: absolute;
  194. bottom: 0;
  195. right: 0;
  196. font-size: 26rpx;
  197. color: #666;
  198. }
  199. &.between {
  200. display: flex;
  201. flex-direction: column;
  202. justify-content: space-between;
  203. }
  204. .title {
  205. font-size: 28rpx;
  206. color: #333333;
  207. text-align: justify;
  208. height: 72rpx;
  209. line-height: 36rpx;
  210. }
  211. .unit {
  212. font-size: 20rpx;
  213. color: #999999;
  214. margin: 8rpx 0;
  215. }
  216. }
  217. .price {
  218. font-size: 26rpx;
  219. .active {
  220. color: #ff457b;
  221. }
  222. .deleted {
  223. margin-left: 24rpx;
  224. font-size: 24rpx;
  225. color: #999;
  226. text-decoration: line-through;
  227. }
  228. }
  229. }
  230. }
  231. .total {
  232. padding-left: 220rpx - 24rpx;
  233. margin: 16rpx 0 20rpx;
  234. font-size: 26rpx;
  235. color: #333;
  236. text {
  237. &:nth-child(2) {
  238. margin-left: 56rpx;
  239. }
  240. }
  241. }
  242. .foot {
  243. display: flex;
  244. justify-content: flex-end;
  245. align-items: center;
  246. .price {
  247. font-size: 26rpx;
  248. color: #333333;
  249. .active {
  250. color: #ff457b;
  251. }
  252. }
  253. .submit {
  254. display: flex;
  255. justify-content: center;
  256. align-items: center;
  257. width: 160rpx;
  258. height: 64rpx;
  259. margin-left: 40rpx;
  260. background: linear-gradient(90deg, #fa55bf 0%, #f83c6c 100%);
  261. color: #ffffff;
  262. border-radius: 32rpx;
  263. font-size: 26rpx;
  264. }
  265. }
  266. }
  267. }
  268. </style>