order-pay.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. <template v-if="product.activeStatus">
  17. <view class="tag type1" v-if="userId === product.heUserId">促销</view>
  18. <view class="tag type1" v-else>自营</view>
  19. <view
  20. class="tag type2"
  21. v-if="product.ladderList && product.ladderList.length > 0"
  22. >
  23. 活动价
  24. </view>
  25. </template>
  26. </view>
  27. <view class="price">
  28. <text class="active">¥{{ product.price | formatPrice }}</text>
  29. <text class="deleted">¥{{ product.normalPrice | formatPrice }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. </view>
  35. <view class="total">
  36. <text v-if="order.eachDiscount">优惠:¥{{ order.eachDiscount }}</text>
  37. <text v-if="order.receiptAmount">已付:¥{{ order.receiptAmount }}</text>
  38. </view>
  39. <view class="foot" v-if="order.receiptStatus !== 3">
  40. <view class="price">
  41. <text>待付:</text>
  42. <text class="active">¥{{ order.restAmount | formatPrice }}</text>
  43. </view>
  44. <view class="submit" @click="onPayOrder(order)">付款</view>
  45. </view>
  46. </view>
  47. </template>
  48. <!-- <view class="shop-info">
  49. <view class="shop-name">采美快递物流商</view>
  50. <view class="product-list">
  51. <view class="product">
  52. <image class="cover" src="https://static.caimei365.com/app/mini-hehe/icon/icon-logistics.png" mode="widthFix"></image>
  53. <view class="content between">
  54. <view class="title">运费</view>
  55. <view class="price"><text>¥50.00</text></view>
  56. <view class="count">×7</view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="total">
  61. <text>优惠:¥20.00</text>
  62. <text>已付:¥0</text>
  63. </view>
  64. <view class="foot">
  65. <view class="price">
  66. <text>待付:</text>
  67. <text class="active">¥100.00</text>
  68. </view>
  69. <view class="submit" @click="onPay">付款</view>
  70. </view>
  71. </view> -->
  72. <!-- 操作弹窗 -->
  73. <tui-modal
  74. :show="modal"
  75. content="确认支付?"
  76. :size="32"
  77. :maskClosable="false"
  78. color="#333"
  79. shape="circle"
  80. @click="handleModalConfirm"
  81. ></tui-modal>
  82. <!-- 加载框 -->
  83. <cm-loading :visible="isSubLoading" :text="loadingText"></cm-loading>
  84. </view>
  85. </template>
  86. <script>
  87. import { mapGetters } from 'vuex'
  88. import wechatPay from './mixins/wechatPay.js'
  89. import CmLoading from '@/components/cm-module/cm-loading/cm-loading.vue'
  90. export default {
  91. mixins: [wechatPay],
  92. components: {
  93. CmLoading
  94. },
  95. data() {
  96. return {
  97. orderId: '',
  98. modal: false,
  99. orderList: [],
  100. hanldOrder: {
  101. order: {}
  102. }
  103. }
  104. },
  105. computed: {
  106. ...mapGetters(['userId'])
  107. },
  108. onLoad(option) {
  109. this.orderId = option.orderId
  110. this.getOrderDetail()
  111. this.orderPaySuccess()
  112. },
  113. methods: {
  114. // 支付回调执行函数
  115. orderPaySuccess() {
  116. this.$on('orderPaySuccess', () => {
  117. const orderInfo = this.hanldOrder.order
  118. this.getOrderDetail()
  119. if (orderInfo.collageFlag) {
  120. uni.navigateTo({ url: `/pages/fight-order/fight-detail?collageId=${orderInfo.collageId}` })
  121. } else {
  122. uni.redirectTo({ url: '/pages/order/success' })
  123. }
  124. })
  125. },
  126. handleModalConfirm(e) {
  127. this.modal = false
  128. if (!e.index) return
  129. this.miniWxPayFor(this.hanldOrder.order)
  130. },
  131. // 子订单支付
  132. onPayOrder(orderInfo) {
  133. orderInfo.payableAmount = orderInfo.restAmount
  134. this.hanldOrder.order = orderInfo
  135. this.modal = true
  136. },
  137. getOrderDetail() {
  138. this.OrderService.QueryOrderDetails({ orderId: this.orderId })
  139. .then(res => {
  140. this.orderList = res.data.shopOrderList
  141. })
  142. .catch(err => {
  143. this.$util.modal('提示', '订单查询失败,请稍后重试~', '确定', '', false, () => {
  144. this.$api.switchTabTo('/pages/tabBar/index/index')
  145. })
  146. })
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .order-pay {
  153. min-height: 100vh;
  154. background: #f7f7f7;
  155. .top-tip {
  156. position: sticky;
  157. top: 0;
  158. z-index: 99;
  159. width: 750rpx;
  160. height: 80rpx;
  161. line-height: 80rpx;
  162. padding: 0 24rpx;
  163. background: #fff3f7;
  164. color: #ff457b;
  165. font-size: 26rpx;
  166. box-sizing: border-box;
  167. }
  168. .shop-info {
  169. padding: 32rpx 24rpx;
  170. background-color: #fff;
  171. margin-bottom: 20rpx;
  172. .shop-name {
  173. font-size: 30rpx;
  174. color: #333333;
  175. font-weight: bold;
  176. }
  177. .product-list {
  178. .product {
  179. display: flex;
  180. margin: 20rpx 0;
  181. .cover {
  182. width: 180rpx;
  183. height: 180rpx;
  184. border-radius: 8rpx;
  185. background-color: #f7f7f7;
  186. }
  187. .content {
  188. position: relative;
  189. width: 500rpx;
  190. margin-left: 16rpx;
  191. .count {
  192. position: absolute;
  193. bottom: 0;
  194. right: 0;
  195. font-size: 26rpx;
  196. color: #666;
  197. }
  198. &.between {
  199. display: flex;
  200. flex-direction: column;
  201. justify-content: space-between;
  202. }
  203. .title {
  204. font-size: 28rpx;
  205. color: #333333;
  206. text-align: justify;
  207. height: 72rpx;
  208. line-height: 36rpx;
  209. }
  210. .unit {
  211. font-size: 20rpx;
  212. color: #999999;
  213. margin: 8rpx 0;
  214. }
  215. .tags {
  216. display: flex;
  217. justify-content: flex-start;
  218. align-items: center;
  219. width: 100%;
  220. height: 30rpx;
  221. .tag {
  222. margin-right: 8rpx;
  223. font-size: 22rpx;
  224. height: 30rpx;
  225. line-height: 30rpx;
  226. text-align: center;
  227. &.type1 {
  228. padding: 0 8rpx;
  229. background: #f83c6c;
  230. border-radius: 4rpx;
  231. color: #fff;
  232. }
  233. &.type2 {
  234. width: 80rpx;
  235. color: #f83c6c;
  236. background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png) top
  237. center no-repeat;
  238. background-size: contain;
  239. }
  240. &.type3 {
  241. width: 80rpx;
  242. background: linear-gradient(270deg, #ff457b 0%, #b03bb8 51%, #6431f2 100%);
  243. color: #fff;
  244. border-radius: 4rpx;
  245. }
  246. &.type4 {
  247. border: 1rpx solid #f83c6c;
  248. padding: 0 6rpx;
  249. color: #f83c6c;
  250. border-radius: 4rpx;
  251. }
  252. }
  253. }
  254. }
  255. .price {
  256. font-size: 26rpx;
  257. .active {
  258. color: #ff457b;
  259. }
  260. .deleted {
  261. margin-left: 24rpx;
  262. font-size: 24rpx;
  263. color: #999;
  264. text-decoration: line-through;
  265. }
  266. }
  267. }
  268. }
  269. .total {
  270. padding-left: 220rpx - 24rpx;
  271. margin: 16rpx 0 20rpx;
  272. font-size: 26rpx;
  273. color: #333;
  274. text {
  275. &:nth-child(2) {
  276. margin-left: 56rpx;
  277. }
  278. }
  279. }
  280. .foot {
  281. display: flex;
  282. justify-content: flex-end;
  283. align-items: center;
  284. .price {
  285. font-size: 26rpx;
  286. color: #333333;
  287. .active {
  288. color: #ff457b;
  289. }
  290. }
  291. .submit {
  292. display: flex;
  293. justify-content: center;
  294. align-items: center;
  295. width: 160rpx;
  296. height: 64rpx;
  297. margin-left: 40rpx;
  298. background: linear-gradient(90deg, #fa55bf 0%, #f83c6c 100%);
  299. color: #ffffff;
  300. border-radius: 32rpx;
  301. font-size: 26rpx;
  302. }
  303. }
  304. }
  305. }
  306. </style>