order-detail.vue 8.3 KB

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