order-detail.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="order-detail" :class="{ hasBottom: hasControlNav }">
  3. <tui-skeleton v-if="isRequest" loadingType="2"></tui-skeleton>
  4. <view class="detail-top">
  5. <!-- 订单状态 -->
  6. <view class="order-status">{{ stateExpFormat(orderInfo.status) }}</view>
  7. <!-- 收货地址 -->
  8. <cm-choose-address :addressData="userInfo" disabled></cm-choose-address>
  9. </view>
  10. <!-- 订单商品列表 -->
  11. <template v-for="(shopOrder, shopOrderIndex) in shopOrderList">
  12. <view class="grid" :key="shopOrderIndex"></view>
  13. <view class="shop-section" :key="shopOrderIndex">
  14. <!-- 供应商 -->
  15. <view class="origin">
  16. <image class="cover" :src="shopOrder.shopLogo"></image>
  17. <view class="name">{{ shopOrder.shopName }}</view>
  18. </view>
  19. <!-- 商品列表 -->
  20. <view class="goods-list">
  21. <!-- 商品信息 -->
  22. <view class="order-goods" v-for="goods in shopOrder.orderProductList" :key="goods.productId">
  23. <cm-order-prodcut :goods-data="goods"></cm-order-prodcut>
  24. </view>
  25. </view>
  26. <view class="line"></view>
  27. <!-- 统计 -->
  28. <!-- <view class="total">
  29. <view class="count">共{{ shopOrder.itemCount }}件商品</view>
  30. <view class="status">
  31. <text class="label">商品总额:</text>
  32. <text>¥{{ shopOrder.totalAmount | formatPrice }}</text>
  33. </view>
  34. </view> -->
  35. <view class="description">
  36. <view class="row"> <text class="label">商品总额:</text> <text>¥200</text> </view>
  37. <view class="row"> <text class="label">优惠:</text> <text>¥200</text> </view>
  38. <view class="row"> <text class="label">应付金额:</text> <text>¥200</text> </view>
  39. <view class="row"> <text class="label">已付金额:</text> <text>¥200</text> </view>
  40. <view class="row"> <text class="label">待付金额:</text> <text>¥200</text> </view>
  41. <view class="collapse">收起</view>
  42. </view>
  43. </view>
  44. </template>
  45. <view class="grid"></view>
  46. <!-- 订单详细信息 -->
  47. <cm-order-information :orderInfo="orderInfo"></cm-order-information>
  48. <!-- 操作 -->
  49. <view class="order-control" v-if="hasControlNav" :class="{ 'has-bottom': isIphoneX }">
  50. <cm-order-control-nav
  51. :orderInfo="orderInfo"
  52. @confirm="handleConfirmClick"
  53. :hasBottom="isIphoneX"
  54. @change="getButtonCount"
  55. ></cm-order-control-nav>
  56. </view>
  57. <!-- 操作弹窗 -->
  58. <tui-modal
  59. :show="modal"
  60. :content="modalText"
  61. :size="32"
  62. :maskClosable="false"
  63. color="#333"
  64. shape="circle"
  65. @click="handleModalConfirm"
  66. ></tui-modal>
  67. <!-- 加载框 -->
  68. <cm-loading :visible="isSubLoading" :text="loadingText"></cm-loading>
  69. <!-- 失效商品列表 -->
  70. <cm-order-invalid-modal
  71. :goodsList="invalidList"
  72. :visible="buyAgainModal"
  73. @confirm="buyAgainModalClick"
  74. @cancel="buyAgainModalHide"
  75. ></cm-order-invalid-modal>
  76. <!-- 底部占位 -->
  77. <view class="reserved" v-if="isIphoneX"></view>
  78. </view>
  79. </template>
  80. <script>
  81. import CmChooseAddress from '@/components/cm-module/cm-choose-address/cm-choose-address.vue' //地址信息
  82. import CmOrderProdcut from '@/components/cm-module/cm-order-prodcut/cm-order-prodcut.vue'
  83. import CmOrderInformation from '@/components/cm-module/cm-order-information/cm-order-information.vue'
  84. import CmOrderControlNav from '@/components/cm-module/cm-order-control-nav/cm-order-control-nav.vue'
  85. import CmOrderInvalidModal from '@/components/cm-module/cm-order-invalid-modal/cm-order-invalid-modal.vue'
  86. import CmLoading from '@/components/cm-module/cm-loading/cm-loading.vue'
  87. import orderList from './mixins/orderList.js'
  88. import wechatPay from './mixins/wechatPay.js'
  89. import { mapGetters } from 'vuex'
  90. export default {
  91. mixins: [wechatPay, orderList],
  92. components: {
  93. CmOrderProdcut,
  94. CmOrderInformation,
  95. CmOrderControlNav,
  96. CmOrderInvalidModal,
  97. CmLoading,
  98. CmChooseAddress
  99. },
  100. data() {
  101. return {
  102. isRequest: false,
  103. orderId: '',
  104. discernReceiptList: [],
  105. shopOrderList: [],
  106. orderInfo: {},
  107. userInfo: {}
  108. }
  109. },
  110. computed: {
  111. ...mapGetters(['userId', 'userIdentity', 'isIphoneX']),
  112. // 当前用户是否为协销
  113. isDealer() {
  114. return this.userIdentity === 2
  115. },
  116. hasControlNav() {
  117. return this.orderInfo.buyUserId === this.userId
  118. }
  119. },
  120. onLoad(option) {
  121. this.orderId = option.orderId
  122. this.getOrderDetail()
  123. this.$on('orderAction', () => {
  124. this.getOrderDetail()
  125. })
  126. this.orderPaySuccess()
  127. },
  128. beforeDestroy() {
  129. this.$off('orderAction')
  130. },
  131. methods: {
  132. // 支付回调执行函数
  133. orderPaySuccess() {
  134. this.$on('orderPaySuccess', () => {
  135. const orderInfo = this.hanldOrder.order
  136. this.getOrderDetail()
  137. if (orderInfo.collageFlag) {
  138. uni.navigateTo({ url: `/pages/fight-order/fight-detail?collageId=${orderInfo.collageId}` })
  139. } else {
  140. uni.redirectTo({ url: '/pages/order/success' })
  141. }
  142. })
  143. },
  144. getOrderDetail() {
  145. this.OrderService.QueryOrderDetails({ orderId: this.orderId })
  146. .then(res => {
  147. this.discernReceiptList = res.data.discernReceiptList
  148. this.shopOrderList = res.data.shopOrderList
  149. this.orderInfo = res.data.order
  150. this.userInfo = res.data.userInfo
  151. this.isRequest = false
  152. })
  153. .catch(err => {
  154. this.$util.modal('提示', '订单查询失败,请稍后重试~', '确定', '', false, () => {
  155. this.$api.switchTabTo('/pages/tabBar/index/index')
  156. })
  157. })
  158. },
  159. getButtonCount(e) {
  160. this.buttonCount = e.count
  161. console.log(e.count)
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .order-detail {
  168. min-height: 100vh;
  169. background: #f7f7f7;
  170. padding-top: 138rpx + 60rpx;
  171. box-sizing: border-box;
  172. &.has-bottom {
  173. padding-bottom: 100rpx;
  174. }
  175. .order-status {
  176. height: 60rpx;
  177. font-size: 26rpx;
  178. line-height: 26rpx;
  179. padding: 34rpx 24rpx 0;
  180. box-sizing: border-box;
  181. color: #ff457b;
  182. background: #fff;
  183. }
  184. .detail-top {
  185. height: 134rpx + 60rpx;
  186. position: fixed;
  187. top: 0;
  188. z-index: 999;
  189. }
  190. .grid {
  191. height: 20rpx;
  192. background: #f7f7f7;
  193. }
  194. .shop-section {
  195. background: #fff;
  196. overflow: hidden;
  197. .line {
  198. width: 702rpx;
  199. height: 1px;
  200. background: #f7f7f7;
  201. margin: 0 auto;
  202. }
  203. .origin {
  204. padding: 0 24rpx;
  205. margin-top: 24rpx;
  206. margin-bottom: 16rpx;
  207. display: flex;
  208. justify-content: flex-start;
  209. align-items: center;
  210. .cover {
  211. width: 56rpx;
  212. height: 56rpx;
  213. border-radius: 4rpx;
  214. border: 1px solid #f7f7f7;
  215. box-sizing: border-box;
  216. }
  217. .name {
  218. margin-left: 16rpx;
  219. font-size: 30rpx;
  220. color: #333333;
  221. font-weight: bold;
  222. }
  223. }
  224. .goods-list {
  225. margin-bottom: 32rpx;
  226. .order-goods {
  227. padding-top: 32rpx;
  228. &:first-child {
  229. padding-top: 0;
  230. }
  231. }
  232. }
  233. }
  234. .total {
  235. display: flex;
  236. justify-content: space-between;
  237. align-items: center;
  238. padding: 0 24rpx;
  239. margin: 32rpx 0;
  240. font-size: 26rpx;
  241. color: #333333;
  242. .count {
  243. font-weight: bold;
  244. }
  245. .status {
  246. color: #ff457b;
  247. .label {
  248. color: #333333;
  249. }
  250. }
  251. }
  252. .order-control {
  253. position: fixed;
  254. width: 100%;
  255. box-sizing: border-box;
  256. height: 100rpx;
  257. display: flex;
  258. justify-content: flex-end;
  259. align-items: center;
  260. bottom: 0;
  261. background: #fff;
  262. &.has-bottom {
  263. bottom: 50rpx;
  264. }
  265. }
  266. }
  267. </style>