logistics.vue 7.9 KB

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