order-pay.vue 7.5 KB

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