logistics.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <template>
  2. <view class="detail">
  3. <u-navbar title="物流详情" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
  4. <!-- 物流信息 -->
  5. <view class="detail-info" v-if="deliverList.length>1?true:false">
  6. <view class="detail-info-one" v-for="(item,index) in deliverList" :key="index" @click="jumpPosition(index)" :class="{'aside-active':listIndex === index}"> 包裹{{index+1}} </view>
  7. </view>
  8. <view class="detail-info">
  9. <view class="detail-info-title">商品信息</view>
  10. <view class="detail-info-content">
  11. <view class="detail-info-content-goods">
  12. <view class="flex detail-info-content-goods__detail" v-for="(item,index) in deliverListData[listIndex]" :key="index">
  13. <view class="detail-info-content-goods__detail__left">
  14. <view class="img">
  15. <image class="img" :src="item.picUrl" mode="aspectFill">
  16. </image>
  17. </view>
  18. </view>
  19. <view class="detail-info-content-goods__detail__right">
  20. <view class="ells title">{{ item.title }}</view>
  21. <view class="sku" v-if="item.properties">规格:{{ item.properties }}
  22. </view>
  23. <view class="num">数量:{{ item.goodsNum }}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="detail-info">
  30. <view class="detail-info-content-desc">
  31. <view>配送方式:</view>
  32. <view>{{ deliverListData[listIndex][0].companyName ? "快递发货" : "无需物流" }}</view>
  33. </view>
  34. <view class="detail-info-content-desc" v-if="deliverListData[listIndex][0].companyName?true:false">
  35. <view>{{ deliverListData[listIndex][0].companyName }}:</view>
  36. <view class="copy" @click="copyDeliveryFlowId(deliverListData[listIndex][0].deliveryFlowId)">复制</view>
  37. <view>{{ deliverListData[listIndex][0].deliveryFlowId }}</view>
  38. </view>
  39. </view>
  40. <view class="detail-info" v-if="deliverListData[listIndex][0].companyName && logistics!==''?true:false">
  41. <u-steps current="0" direction="column" dot>
  42. <u-steps-item :desc="item.context" :title="item.status + ' ' + item.time"
  43. v-for="(item,index) in logistics">
  44. <!-- <text class="slot-icon" slot="icon" v-if="item.status == '签收'">签</text> -->
  45. <!-- <text class="slot-icon" slot="icon" v-else-if="item.status == '揽收'">揽</text>
  46. <text class="slot-icon" slot="icon" v-else-if="item.status == '在途'">途</text> -->
  47. </u-steps-item>
  48. </u-steps>
  49. </view>
  50. <view v-else-if="deliverListData[listIndex][0].companyName?true:false" class="detail-info">
  51. <view style="color: #b1b1b1;">
  52. 暂无物流信息
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import env from '../../config/env.js'
  59. import $http from '@/utils/request.js'
  60. export default {
  61. data() {
  62. return {
  63. info: '',
  64. list: [{
  65. picUrl: '',
  66. deliveryFlowId: '',
  67. deliveryId: '',
  68. }],
  69. orderId: '',
  70. deliverList: [{
  71. companyName:'',
  72. }],
  73. deliverListData:[
  74. [{companyName:''}]
  75. ],
  76. ListData:[],
  77. listIndex: 0,
  78. logistics: '',
  79. }
  80. },
  81. onLoad(opthios) {
  82. this.orderId = opthios.id
  83. this.getDetail()
  84. },
  85. methods: {
  86. getDetail() {
  87. // uni.showLoading({
  88. // title: '加载中'
  89. // });
  90. $http.post('/api/v1/mp/user/deliver/order/detail', {
  91. orderId: this.orderId
  92. }).then(res => {
  93. // uni.hideLoading();
  94. this.info = res.data
  95. this.deliverList = res.data.deliverList;
  96. res.data.items.forEach(item => {
  97. let picUrlArr = item.picUrl.split(',')
  98. item.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/170'
  99. })
  100. res.data.deliverList && res.data.deliverList.forEach((item) => {
  101. item.items.forEach((ele) => {
  102. let picUrlArr = ele.picUrl.split(",");
  103. ele.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/170';
  104. this.ListData.push(item.items)
  105. });
  106. });
  107. this.deliverListData = this.ListData
  108. this.list = res.data.items
  109. this.logisticsQuery()
  110. }).catch(() => {
  111. // uni.hideLoading();
  112. })
  113. },
  114. jumpPosition(index) {
  115. this.listIndex = index
  116. this.logisticsQuery()
  117. },
  118. copyDeliveryFlowId(id) {
  119. uni.setClipboardData({
  120. data: id,
  121. });
  122. },
  123. logisticsQuery() {
  124. if (this.deliverListData[this.listIndex][0].deliveryFlowId == "") {
  125. return
  126. }
  127. let data = {
  128. deliveryFlowId: this.deliverListData[this.listIndex][0].deliveryFlowId,
  129. deliveryId: this.deliverListData[this.listIndex][0].deliveryId,
  130. }
  131. $http.post('/api/v1/mp/logistics/query', data).then(res => {
  132. if(res.code == 500) {
  133. uni.hideToast();
  134. }
  135. if (res.code == 0) {
  136. this.logistics = res.data
  137. }
  138. })
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scopen>
  144. .aside-active {
  145. color: #f27120;
  146. border-bottom: 2rpx solid #f27120;
  147. }
  148. </style>
  149. <style lang="scss" scoped>
  150. .detail {
  151. margin: 10rpx;
  152. padding-bottom: 160rpx;
  153. &-state {
  154. padding: 28rpx;
  155. margin-bottom: 20rpx;
  156. background-color: #FFFFFF;
  157. &-title {
  158. line-height: 40rpx;
  159. font-weight: bold;
  160. display: inline-block;
  161. }
  162. &-time {
  163. line-height: 40rpx;
  164. color: #b1b1b1;
  165. float: right;
  166. }
  167. }
  168. &-info {
  169. margin-bottom: 20rpx;
  170. padding: 20rpx 28rpx;
  171. background-color: #FFFFFF;
  172. &-one {
  173. height: 60rpx;
  174. padding: 1px;
  175. line-height: 60rpx;
  176. text-align: center;
  177. display: inline-block;
  178. margin-right: 20rpx;
  179. }
  180. &-title {
  181. line-height: 40rpx;
  182. font-weight: bold;
  183. }
  184. &-content {
  185. &-goods {
  186. &__detail {
  187. padding: 20rpx 0;
  188. justify-content: space-between;
  189. border-bottom: 1px solid rgba(236, 236, 236, 100);
  190. &__left {
  191. display: flex;
  192. height: 170rpx;
  193. .img {
  194. image {
  195. width: 170rpx;
  196. height: 170rpx;
  197. margin-right: 20rpx;
  198. }
  199. }
  200. }
  201. &__right {
  202. flex: 1;
  203. display: flex;
  204. height: 170rpx;
  205. flex-direction: column;
  206. justify-content: space-between;
  207. align-items: flex-start;
  208. font-size: 30rpx;
  209. .title {
  210. font-weight: bold;
  211. }
  212. .sku {
  213. color: #8C8C8C;
  214. }
  215. }
  216. }
  217. &__detail:last-child {
  218. border: none;
  219. }
  220. }
  221. &-money {
  222. margin-top: 40rpx;
  223. &__item {
  224. display: flex;
  225. align-items: center;
  226. justify-content: space-between;
  227. line-height: 40rpx;
  228. margin-bottom: 24rpx;
  229. }
  230. }
  231. &-toatl {
  232. padding-top: 24rpx;
  233. display: flex;
  234. align-items: center;
  235. justify-content: flex-end;
  236. font-weight: bold;
  237. }
  238. &-desc {
  239. position: relative;
  240. display: flex;
  241. line-height: 40rpx;
  242. margin-top: 20rpx;
  243. margin-bottom: 24rpx;
  244. view:first-child {
  245. width: 150rpx;
  246. }
  247. view:last-child {
  248. width: calc(100% - 150rpx)
  249. }
  250. .copy {
  251. position: absolute;
  252. right: 0;
  253. top: -6rpx;
  254. width: 136rpx;
  255. height: 52rpx;
  256. line-height: 52rpx;
  257. text-align: center;
  258. color: rgba(149, 149, 149, 100);
  259. border: 1px solid rgba(187, 187, 187, 100);
  260. border-radius: 10rpx;
  261. }
  262. }
  263. &-desc:last-child {
  264. margin-bottom: 0;
  265. }
  266. &-deliver {
  267. &__detail {
  268. padding: 20rpx 0;
  269. justify-content: space-between;
  270. border-bottom: 1px solid rgba(236, 236, 236, 100);
  271. &__left {
  272. display: flex;
  273. height: 170rpx;
  274. .img {
  275. image {
  276. width: 170rpx;
  277. height: 170rpx;
  278. margin-right: 20rpx;
  279. }
  280. }
  281. }
  282. &__right {
  283. flex: 1;
  284. display: flex;
  285. height: 170rpx;
  286. flex-direction: column;
  287. justify-content: space-between;
  288. align-items: flex-end;
  289. .num {
  290. width: 100%;
  291. justify-content: space-between;
  292. .sku {
  293. color: #8C8C8C;
  294. }
  295. }
  296. }
  297. }
  298. &__detail:last-child {
  299. border: none;
  300. }
  301. }
  302. }
  303. .border {
  304. border-bottom: 1px solid rgba(236, 236, 236, 100);
  305. }
  306. .border:last-child {
  307. border: none;
  308. }
  309. }
  310. }
  311. </style>