order-detail.vue 7.1 KB

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