order-detail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="order-detail">
  3. <view class="order-top sticky-top">
  4. <view class="order-status">{{ stateExpFormat(orderInfo.status) }}</view>
  5. <!-- 收货地址 -->
  6. <order-choose-address :addressInfo="userInfo" :disabled="true"></order-choose-address>
  7. </view>
  8. <!-- 特殊商品退货须知 -->
  9. <view class="return-instructions" v-if="returnGoodsStutas" v-html="helpContent"></view>
  10. <!-- 订单商品列表-->
  11. <view class="shop-list">
  12. <view class="shop-section" v-for="shopInfo in shopOrderList" :key="shopInfo.shopId">
  13. <order-supplier-area :shopInfo="shopInfo"></order-supplier-area>
  14. <tui-divider :height="48"></tui-divider>
  15. <!-- 商品统计 -->
  16. <!-- <view class="total">
  17. <view class="count">共{{ shopInfo.itemCount }}件商品</view>
  18. <view class="price">
  19. <text class="label">商品总额:</text>
  20. <text>¥{{ shopInfo.totalAmount | priceFormat }}</text>
  21. </view>
  22. </view> -->
  23. <view class="remark">
  24. <text class="label">留言:</text>
  25. <text class="content">{{ shopInfo.note }}</text>
  26. </view>
  27. <tui-divider :height="48"></tui-divider>
  28. <view class="description">
  29. <view class="collapse-content" v-if="isCollapse">
  30. <view class="row">
  31. <text class="label">商品总额:</text>
  32. <text class="content">¥{{ shopInfo.needPayAmount | priceFormat }}</text>
  33. </view>
  34. <view class="row">
  35. <text class="label">优惠:</text>
  36. <text class="content">¥{{ shopInfo.eachDiscount | priceFormat }}</text>
  37. </view>
  38. <view class="row">
  39. <text class="label">应付金额:</text>
  40. <text class="content">¥{{ shopInfo.realPay | priceFormat }}</text>
  41. </view>
  42. <view class="row">
  43. <text class="label">已付金额:</text>
  44. <text class="content">¥{{ shopInfo.receiptAmount | priceFormat }}</text>
  45. </view>
  46. </view>
  47. <view class="row">
  48. <text class="label active">待付金额:</text>
  49. <text class="content active">¥{{ shopInfo.restAmount | priceFormat }}</text>
  50. </view>
  51. <view class="collapse" :class="isCollapse ? 'arrowup' : 'arrowdown'" @click="onCollapse">
  52. {{ isCollapse ? '收起' : '展开' }}
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- 订单详细信息 -->
  58. <order-information :orderInfo="orderInfo"></order-information>
  59. <!-- 底部操作按钮 -->
  60. <view class="control fixed-bottom" v-if="orderInfo.userId == userId">
  61. <simple-safe-view>
  62. <order-contror :orderInfo="orderInfo" @confirm="handleConfirmClick"></order-contror>
  63. </simple-safe-view>
  64. </view>
  65. <!-- 操作弹窗 -->
  66. <tui-modal :show="modal" :content="modalText" @click="handleModalConfirm"></tui-modal>
  67. <!-- 失效商品列表 -->
  68. <order-invalid-modal
  69. :goodsList="invalidList"
  70. :visible="buyAgainModal"
  71. @confirm="buyAgainModalClick"
  72. @cancel="buyAgainModalHide"
  73. ></order-invalid-modal>
  74. </view>
  75. </template>
  76. <script>
  77. import { fetchOrderDetail } from '@/services/api/order.js'
  78. import orderList from '@/pages/views/order/mixins/orderList.js'
  79. import wechatPay from '@/pages/views/order/mixins/wechatPay.js'
  80. import { mapGetters } from 'vuex'
  81. export default {
  82. mixins: [orderList, wechatPay],
  83. data() {
  84. return {
  85. orderId: 0,
  86. discernReceiptList: [],
  87. orderInfo: {},
  88. shopOrderList: [],
  89. userInfo: {},
  90. isCollapse: false,
  91. returnGoodsStutas: false,
  92. helpContent: ''
  93. }
  94. },
  95. computed: {
  96. ...mapGetters(['userId'])
  97. },
  98. onLoad(options) {
  99. this.orderId = options.orderId
  100. this.fetchOrderDetail()
  101. this.$on('orderAction', type => {
  102. if (type === 'delete') {
  103. this.$router.navigateBack(1)
  104. } else {
  105. this.fetchOrderDetail()
  106. }
  107. })
  108. },
  109. methods: {
  110. async fetchOrderDetail() {
  111. try {
  112. const res = await fetchOrderDetail({ orderId: this.orderId })
  113. this.discernReceiptList = res.data.discernReceiptList
  114. this.orderInfo = res.data.order
  115. this.shopOrderList = res.data.shopOrderList
  116. this.userInfo = res.data.userInfo
  117. // 特殊商品退货须知
  118. this.returnGoodsStutas = res.data.returnGoodsStutas && res.data.returnGoodsStutas === 2 // 1:可以 2:不可以
  119. this.helpContent = res.data.helpContent
  120. } catch (e) {
  121. console.log(e)
  122. }
  123. },
  124. onCollapse() {
  125. this.isCollapse = !this.isCollapse
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .order-detail {
  132. padding-bottom: 150rpx;
  133. }
  134. .order-top {
  135. .order-status {
  136. font-size: 26rpx;
  137. color: #f83c6c;
  138. background-color: #fff;
  139. padding: 10rpx 24rpx 0;
  140. line-height: 30rpx;
  141. }
  142. }
  143. .control {
  144. @extend .cm-flex-center;
  145. flex-direction: column;
  146. justify-content: flex-start;
  147. align-items: flex-end;
  148. background-color: #fff;
  149. box-sizing: border-box;
  150. padding: 12rpx 24rpx;
  151. border-top: 1px solid #eee;
  152. }
  153. .return-instructions {
  154. font-size: 26rpx;
  155. color: #e15616;
  156. line-height: 42rpx;
  157. padding: 32rpx 50rpx;
  158. background-color: #fffaf8;
  159. text-align: justify;
  160. }
  161. .shop-list {
  162. .shop-section {
  163. padding: 24rpx;
  164. margin: 24rpx 0;
  165. background-color: #fff;
  166. .total {
  167. display: flex;
  168. justify-content: space-between;
  169. align-items: center;
  170. font-size: 26rpx;
  171. color: #333333;
  172. .count {
  173. font-weight: bold;
  174. }
  175. .price {
  176. color: #ff457b;
  177. .label {
  178. color: #333333;
  179. }
  180. }
  181. }
  182. }
  183. .remark {
  184. font-size: 26rpx;
  185. color: #333333;
  186. padding: 0 24rpx;
  187. margin: 8rpx 0;
  188. }
  189. .description {
  190. overflow: hidden;
  191. padding: 0 24rpx;
  192. font-size: 26rpx;
  193. .row {
  194. display: flex;
  195. justify-content: space-between;
  196. align-items: center;
  197. margin: 16rpx 0;
  198. .label {
  199. color: #999999;
  200. &.active {
  201. color: #333333;
  202. }
  203. }
  204. .content {
  205. color: #333333;
  206. &.active {
  207. color: #ff457b;
  208. }
  209. }
  210. }
  211. .collapse {
  212. display: flex;
  213. justify-content: center;
  214. align-items: center;
  215. width: 168rpx;
  216. height: 48rpx;
  217. margin: 24rpx auto 40rpx;
  218. border: 1rpx solid #e1e1e1;
  219. border-radius: 8rpx;
  220. font-size: 24rpx;
  221. color: #b2b2b2;
  222. &.arrowdown,
  223. &.arrowup {
  224. &::after {
  225. content: '';
  226. display: block;
  227. width: 30rpx;
  228. height: 30rpx;
  229. margin-left: 6rpx;
  230. background-repeat: no-repeat;
  231. background-size: 30rpx;
  232. background-position: center;
  233. background-image: url(https://static.caimei365.com/app/mini-hehe/icon/icon-arrowdown.png);
  234. }
  235. }
  236. &.arrowup {
  237. &::after {
  238. transform: rotateZ(180deg);
  239. }
  240. }
  241. }
  242. }
  243. }
  244. </style>