logistics.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view class="detail">
  3. <u-navbar title="物流详情" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
  4. <!-- 包裹 -->
  5. <view class="pack" v-if="deliverList.length>1">
  6. <u-tabs @change="changeTab" :scrollable="false" :list="packList" lineWidth="20" lineHeight="4"
  7. lineColor="#E96737" :activeStyle="{
  8. color: '#333',
  9. transform: 'scale(1.1)',
  10. width: '50px',
  11. }" :inactiveStyle="{
  12. color: '#666666',
  13. transform: 'scale(1)',
  14. width: '50px'
  15. }" itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;text-align: center;">
  16. </u-tabs>
  17. </view>
  18. <!-- 商品 -->
  19. <view class="goods">
  20. <view class="goods-title">商品信息</view>
  21. <view class="goods-item" v-for="(item, index) in deliverListData[listIndex]" :key="index">
  22. <image :src="item.picUrl" mode="aspectFit"></image>
  23. <view class="info">
  24. <view class="info-title ells">{{ item.title }}</view>
  25. <view class="info-num flex">
  26. <view class="info-num-sku ells-one">规格:{{ item.properties || '-' }}</view>
  27. <view class="info-num-goods">共{{ item.goodsNum }}件</view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 配送方式 -->
  33. <view class="mode">
  34. <view class="mode-item">
  35. <view>配送方式:</view>
  36. <view>{{ deliverListData[listIndex][0].companyName ? "快递发货" : "无需物流" }}</view>
  37. </view>
  38. <view class="mode-item" v-if="deliverListData[listIndex][0].companyName">
  39. <view>{{ deliverListData[listIndex][0].companyName }}:</view>
  40. <view class="flex" @click="copyDeliveryFlowId(deliverListData[listIndex][0].deliveryFlowId)">
  41. <text>{{ deliverListData[listIndex][0].deliveryFlowId }}</text>
  42. <view class="copy flex">
  43. <text>复制</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 物流信息 -->
  49. <view class="logistics" v-if="deliverListData[listIndex][0].companyName && logistics!==''">
  50. <u-steps current="0" direction="column" dot activeColor="#F9822C">
  51. <u-steps-item :desc="item.context" :title="item.status + ' ' + item.time"
  52. v-for="(item,index) in logistics">
  53. </u-steps-item>
  54. </u-steps>
  55. </view>
  56. <view class="logistics" v-else-if="deliverListData[listIndex][0].companyName">
  57. <view style="color: #b1b1b1;">
  58. 暂无物流信息
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import env from '../../config/env.js'
  65. import $http from '@/utils/request.js'
  66. export default {
  67. data() {
  68. return {
  69. info: '',
  70. list: [{
  71. picUrl: '',
  72. deliveryFlowId: '',
  73. deliveryId: '',
  74. }],
  75. orderId: '',
  76. deliverList: [{
  77. companyName: '',
  78. }],
  79. deliverListData: [
  80. [{
  81. companyName: ''
  82. }]
  83. ],
  84. ListData: [],
  85. listIndex: 0,
  86. logistics: '',
  87. packList: []
  88. }
  89. },
  90. onLoad(opthios) {
  91. this.orderId = opthios.id
  92. this.getDetail()
  93. },
  94. methods: {
  95. changeTab(e) {
  96. this.listIndex = e.index
  97. if (this.deliverListData[this.listIndex][0].deliveryFlowId == "") {
  98. return
  99. }
  100. let data = {
  101. deliveryFlowId: this.deliverListData[this.listIndex][0].deliveryFlowId,
  102. deliveryId: this.deliverListData[this.listIndex][0].deliveryId,
  103. }
  104. $http.post('/api/v1/mp/logistics/query', data).then(res => {
  105. if (res.code == 500) {
  106. uni.hideToast();
  107. }
  108. if (res.code == 0) {
  109. this.logistics = res.data
  110. }
  111. })
  112. },
  113. getDetail() {
  114. uni.showLoading({
  115. title: '加载中'
  116. });
  117. $http.post('/api/v1/mp/user/deliver/order/detail', {
  118. orderId: this.orderId
  119. }).then(res => {
  120. uni.hideLoading();
  121. this.info = res.data
  122. this.deliverList = res.data.deliverList;
  123. res.data.items.forEach(item => {
  124. let picUrlArr = item.picUrl.split(',')
  125. item.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/170'
  126. })
  127. res.data.deliverList && res.data.deliverList.forEach((item, index) => {
  128. item.items.forEach((ele) => {
  129. let picUrlArr = ele.picUrl.split(",");
  130. ele.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/170';
  131. this.ListData.push(item.items)
  132. this.packList.push({ name: `包裹${ index + 1 }` })
  133. });
  134. });
  135. this.deliverListData = this.ListData
  136. this.list = res.data.items
  137. this.logisticsQuery()
  138. }).catch(() => {
  139. uni.hideLoading();
  140. })
  141. },
  142. jumpPosition(index) {
  143. this.listIndex = index
  144. this.logisticsQuery()
  145. },
  146. copyDeliveryFlowId(id) {
  147. uni.setClipboardData({
  148. data: id,
  149. });
  150. },
  151. }
  152. }
  153. </script>
  154. <style lang="scss" scopen>
  155. .aside-active {
  156. color: #f27120;
  157. border-bottom: 4rpx solid #f27120;
  158. }
  159. </style>
  160. <style lang="scss" scoped>
  161. .detail {
  162. padding-bottom: 160rpx;
  163. }
  164. // 包裹
  165. .pack {
  166. display: flex;
  167. background-color: #fff;
  168. }
  169. // 商品
  170. .goods {
  171. margin: 26rpx 34rpx 22rpx;
  172. background-color: #fff;
  173. padding: 20rpx 36rpx;
  174. border-radius: 20rpx;
  175. &-title {
  176. font-size: 30rpx;
  177. line-height: 30rpx;
  178. margin-bottom: 22rpx;
  179. }
  180. // 商品列表
  181. &-item{
  182. display: flex;
  183. image {
  184. width: 220rpx;
  185. height: 200rpx;
  186. border-radius: 12rpx;
  187. margin-right: 24rpx;
  188. }
  189. .info {
  190. display: flex;
  191. flex-direction: column;
  192. justify-content: space-between;
  193. flex: 1;
  194. padding: 8rpx 0;
  195. &-title {
  196. font-weight: bold;
  197. line-height: 40rpx;
  198. }
  199. &-num {
  200. justify-content: space-between;
  201. &-sku {
  202. flex: 1;
  203. color: #666666;
  204. font-size: 26rpx;
  205. }
  206. &-goods {
  207. color: #666666;
  208. font-size: 26rpx;
  209. }
  210. }
  211. }
  212. }
  213. }
  214. // 配送方式
  215. .mode {
  216. margin: 0 34rpx 22rpx;
  217. background-color: #fff;
  218. padding: 20rpx 36rpx;
  219. border-radius: 20rpx;
  220. &-item {
  221. display: flex;
  222. margin-bottom: 22rpx;
  223. .copy {
  224. height: 100%;
  225. margin-left: 8rpx;
  226. text-align: center;
  227. border-radius: 12rpx;
  228. font-size: 24rpx;
  229. line-height: 24rpx;
  230. padding: 0 6rpx;
  231. background-color: rgba(153, 153, 153, .1);
  232. text {
  233. display: inline-block;
  234. transform: scale(0.8);
  235. }
  236. }
  237. }
  238. &-item:last-child {
  239. margin-bottom: 0;
  240. }
  241. }
  242. // 物流信息
  243. .logistics {
  244. margin: 0 34rpx 22rpx;
  245. background-color: #fff;
  246. padding: 20rpx 36rpx;
  247. border-radius: 20rpx;
  248. }
  249. </style>