logistics.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <div class="order-wrapper">
  3. <div class="navtop" v-if="getRouter === 'buyer'" style="margin-bottom: 0.1rem;background: #fff;padding:0.2rem">
  4. <div class="navtop_title" style="color: #666;font-size: 0.28rem;">请选择发货单查看对应的物流信息</div>
  5. <div class="ids clearfix">
  6. <div style="margin-top: 5px" v-for="(item, index) in idsList" v-bind:key="index">
  7. <span class="mobile-cart-check" :class="index === nowIds ? 'active': ''" @click.stop.prevent="changeInds(index)"></span>
  8. <span @click.stop.prevent="changeInds(index)">{{item}}</span>
  9. </div>
  10. </div>
  11. </div>
  12. <div class="logistics_top clearfix">
  13. <div class="pull-left">
  14. <div class="name">订单编号:<span class="red">{{detailsInfo.orderid}}</span></div>
  15. <div class="name">配送方式:<span>{{detailsInfo.sendType === 1301 ? '第三方配送' : (detailsInfo.sendType === 1302 ? '卖家配送': '上门自提')}}</span></div>
  16. <div class="name">配送商:<span>{{logistics.companyName || '-'}}</span></div>
  17. <div class="name">运单号:<span class="red">{{logistics.number || '-'}}</span></div>
  18. </div>
  19. <div class="pull-right">
  20. <template v-if="status === 'signin'">已签收</template>
  21. <template v-else-if="status === 'send'">派件中</template>
  22. <template v-else-if="status === 'transit'">运输中</template>
  23. <template v-else>已发货</template>
  24. </div>
  25. </div>
  26. <ul class="logistics_ul" v-if="logisticsInfo.length > 0">
  27. <li class="clearfix" v-for="(item, index) in logisticsInfo">
  28. <div class="pull-left" :class="index > 0 ? '' : 'marginL'">
  29. <div class="logistics_icon" :class="index > 0 ? '' : 'active'">
  30. <div class="red" v-if="index === 0"></div>
  31. </div>
  32. </div>
  33. <div class="pull-right" :class="index > 0 ? '' : 'marginT'">
  34. <div class="logistics_time">{{item.AcceptTime}}</div>
  35. <div class="logistics_info">{{item.AcceptStation}}</div>
  36. </div>
  37. </li>
  38. </ul>
  39. <div class="nologistics" v-else>
  40. <img src="/images/order/nologistics.png"/>
  41. <div>暂无物流信息</div>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import axios from '~plugins/axios'
  47. export default {
  48. name: 'logistics',
  49. layout: 'mobile',
  50. middleware: 'authenticated',
  51. data() {
  52. return {
  53. detailsInfo: {},
  54. logistics: {},
  55. logisticsInfo: {},
  56. status: '',
  57. idsList: [],
  58. nowIds: 0
  59. }
  60. },
  61. async asyncData ({route}) {
  62. let res
  63. let resultInfo
  64. if (route.query.type === 'buyer') {
  65. res = await axios.get(`/trade/order/${route.query.uuid}`)
  66. res.data[0].sendType = JSON.parse(res.data[0].jsonRule).method
  67. resultInfo = res.data[0]
  68. } else {
  69. res = await axios.get(`/trade/purchase/purchaseId/${route.query.uuid}`)
  70. resultInfo = res.data.data
  71. }
  72. let _idsList = resultInfo.inIds && resultInfo.inIds.split(',') || []
  73. return {
  74. detailsInfo: resultInfo,
  75. idsList: _idsList
  76. }
  77. },
  78. computed: {
  79. getRouter() {
  80. return this.$route.query.type
  81. }
  82. },
  83. created() {
  84. this.getInfo()
  85. // }
  86. },
  87. methods: {
  88. changeInds(ind) {
  89. this.nowIds = ind
  90. this.logistics = {}
  91. this.getInfo()
  92. },
  93. getInfo() {
  94. if (this.$route.query.type === 'buyer') {
  95. this.$http.get(`/trade/order/invoiceid?id=${this.detailsInfo.id}&invoiceid=${this.idsList[this.nowIds]}`).then(data => {
  96. this.logistics = data.data.data.logistics
  97. this.$http.get(`/kdn/logistics/query?companyName=${this.logistics.companyName}&logisticsCode=${this.logistics.number}`).then(res => {
  98. let str = res.data.traces
  99. this.logisticsInfo = JSON.parse(res.data.traces).reverse()
  100. if (str.indexOf('揽件') !== -1 || str.indexOf('收件') !== -1 || str.indexOf('转运') !== -1 || str.indexOf('运输') !== -1 || str.indexOf('发往') !== -1 ||
  101. str.indexOf('发出') !== -1 || str.indexOf('收入') !== -1 || str.indexOf('扫描') !== -1 || str.indexOf('到达') !== -1) {
  102. this.status = 'transit'
  103. }
  104. if (str.indexOf('派送') !== -1 || str.indexOf('派件') !== -1) {
  105. this.status = 'send'
  106. }
  107. if (str.indexOf('签收') !== -1) {
  108. this.status = 'signin'
  109. }
  110. })
  111. })
  112. } else {
  113. this.$http.get(`/trade/logistics/${this.detailsInfo.lgtId}`).then(data => {
  114. this.logistics = data.data
  115. this.$http.get(`/kdn/logistics/query?companyName=${this.logistics.companyName}&logisticsCode=${this.logistics.number}`).then(res => {
  116. let str = res.data.traces
  117. this.logisticsInfo = JSON.parse(res.data.traces).reverse()
  118. if (str.indexOf('揽件') !== -1 || str.indexOf('收件') !== -1 || str.indexOf('转运') !== -1 || str.indexOf('运输') !== -1 || str.indexOf('发往') !== -1 ||
  119. str.indexOf('发出') !== -1 || str.indexOf('收入') !== -1 || str.indexOf('扫描') !== -1 || str.indexOf('到达') !== -1) {
  120. this.status = 'transit'
  121. }
  122. if (str.indexOf('派送') !== -1 || str.indexOf('派件') !== -1) {
  123. this.status = 'send'
  124. }
  125. if (str.indexOf('签收') !== -1) {
  126. this.status = 'signin'
  127. }
  128. })
  129. })
  130. }
  131. }
  132. }
  133. }
  134. </script>
  135. <style scoped lang='scss'>
  136. @mixin overFlowHidden {
  137. overflow: hidden;
  138. text-overflow: ellipsis;
  139. white-space: nowrap;
  140. }
  141. @mixin lineHeight($value) {
  142. height: $value;
  143. line-height: $value;
  144. }
  145. .order-wrapper {
  146. background: #f1f3f6;
  147. margin: 1.26rem 0 0.98rem 0;
  148. height: calc(100vh - 0.88rem - 0.98rem);
  149. overflow-y: scroll;
  150. .logistics_top {
  151. padding: 0.2rem;
  152. background: #fff;
  153. margin-bottom: 0.2rem;
  154. .pull-left {
  155. font-size: 0.28rem;
  156. color: #333;
  157. .name {
  158. @include lineHeight(0.5rem);
  159. }
  160. .red {
  161. color: #f43938
  162. }
  163. }
  164. .pull-right {
  165. font-size: 0.32rem;
  166. color: #f43938
  167. }
  168. }
  169. .logistics_ul {
  170. background: #fff;
  171. padding: 0.2rem;
  172. height: calc(100vh - 0.88rem - 0.98rem - 2.62rem);
  173. overflow-y: auto;
  174. li {
  175. position: relative;
  176. border-left: 2px solid #e4e5ea;
  177. margin-left: 0.2rem;
  178. .pull-left {
  179. position: absolute;
  180. left: -4px;
  181. top: 0.36rem;
  182. .logistics_icon {
  183. width: 6px;
  184. height: 6px;
  185. border-radius: 50%;
  186. background: #e4e5ea;
  187. &.active {
  188. width: 20px;
  189. height: 20px;
  190. border-radius: 50%;
  191. background: #fcc1c0;
  192. position: relative;
  193. &~.logistics_line {
  194. margin-left: 9px;
  195. }
  196. .red {
  197. position: absolute;
  198. width: 12px;
  199. height: 12px;
  200. background: #f32f2f;
  201. margin-left: 4px;
  202. margin-top: 4px;
  203. border-radius: 50%;
  204. }
  205. }
  206. }
  207. &.marginL {
  208. left: -10px;
  209. top: 0px
  210. }
  211. }
  212. .pull-right {
  213. padding-top: 0.2rem;
  214. font-size: 0.24rem;
  215. color: #333;
  216. border-bottom: 1px solid #f3f3f3;
  217. padding-bottom: 0.2rem;
  218. width: 6.4rem;
  219. .logistics_time {
  220. @include lineHeight(20px);
  221. }
  222. .logistics_info {
  223. margin-top: 0.2rem;
  224. word-break:break-all;
  225. word-wrap: break-word;
  226. line-height: 0.45rem
  227. }
  228. &.marginT {
  229. padding-top: 0px;
  230. }
  231. }
  232. }
  233. }
  234. .nologistics {
  235. height: calc(100vh - 0.88rem - 0.98rem - 2.62rem);
  236. text-align: center;
  237. padding-top: 2rem;
  238. img {
  239. width: 1.87rem;
  240. height: 1.87rem;
  241. }
  242. div {
  243. font-size: 0.32rem;
  244. color: #999999;
  245. margin-top: 0.2rem;
  246. }
  247. }
  248. .navtop {
  249. .ids{
  250. div {
  251. width: 100%;
  252. font-size: 0.24rem;
  253. color: #333;
  254. line-height: .36rem;
  255. .mobile-cart-check{
  256. min-width: .36rem;
  257. height: .36rem;
  258. background: url(/images/mobile/center/user/car-noChecked.png) no-repeat;
  259. background-size: contain;
  260. vertical-align: middle;
  261. margin-bottom: .02rem;
  262. display: inline-block;
  263. margin-right: 0.11rem;
  264. display: inline-block;
  265. vertical-align: middle;
  266. &.active {
  267. background-image: url(/images/mobile/center/user/car-checked.png);
  268. }
  269. }
  270. }
  271. }
  272. }
  273. }
  274. </style>