logistics.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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.changeTab({ index: 0 })
  138. }).catch(() => {
  139. uni.hideLoading();
  140. })
  141. },
  142. copyDeliveryFlowId(id) {
  143. uni.setClipboardData({
  144. data: id,
  145. });
  146. },
  147. }
  148. }
  149. </script>
  150. <style lang="scss" scopen>
  151. .aside-active {
  152. color: #f27120;
  153. border-bottom: 4rpx solid #f27120;
  154. }
  155. </style>
  156. <style lang="scss" scoped>
  157. .detail {
  158. padding-bottom: 160rpx;
  159. }
  160. // 包裹
  161. .pack {
  162. display: flex;
  163. background-color: #fff;
  164. }
  165. // 商品
  166. .goods {
  167. margin: 26rpx 34rpx 22rpx;
  168. background-color: #fff;
  169. padding: 20rpx 36rpx;
  170. border-radius: 20rpx;
  171. &-title {
  172. font-size: 30rpx;
  173. line-height: 30rpx;
  174. margin-bottom: 22rpx;
  175. }
  176. // 商品列表
  177. &-item{
  178. display: flex;
  179. image {
  180. width: 220rpx;
  181. height: 200rpx;
  182. border-radius: 12rpx;
  183. margin-right: 24rpx;
  184. }
  185. .info {
  186. display: flex;
  187. flex-direction: column;
  188. justify-content: space-between;
  189. flex: 1;
  190. padding: 8rpx 0;
  191. &-title {
  192. font-weight: bold;
  193. line-height: 40rpx;
  194. }
  195. &-num {
  196. justify-content: space-between;
  197. &-sku {
  198. flex: 1;
  199. color: #666666;
  200. font-size: 26rpx;
  201. }
  202. &-goods {
  203. color: #666666;
  204. font-size: 26rpx;
  205. }
  206. }
  207. }
  208. }
  209. }
  210. // 配送方式
  211. .mode {
  212. margin: 0 34rpx 22rpx;
  213. background-color: #fff;
  214. padding: 20rpx 36rpx;
  215. border-radius: 20rpx;
  216. &-item {
  217. display: flex;
  218. margin-bottom: 22rpx;
  219. .copy {
  220. height: 100%;
  221. margin-left: 8rpx;
  222. text-align: center;
  223. border-radius: 12rpx;
  224. font-size: 24rpx;
  225. line-height: 24rpx;
  226. padding: 0 6rpx;
  227. background-color: rgba(153, 153, 153, .1);
  228. text {
  229. display: inline-block;
  230. transform: scale(0.8);
  231. }
  232. }
  233. }
  234. &-item:last-child {
  235. margin-bottom: 0;
  236. }
  237. }
  238. // 物流信息
  239. .logistics {
  240. margin: 0 34rpx 22rpx;
  241. background-color: #fff;
  242. padding: 20rpx 36rpx;
  243. border-radius: 20rpx;
  244. }
  245. </style>