logistics.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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.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. this.$http.get(`/trade/order/invoiceid?id=${this.detailsInfo.id}&invoiceid=${this.idsList[this.nowIds]}`).then(data => {
  95. this.logistics = data.data.data.logistics
  96. this.$http.get(`/kdn/logistics/query?companyName=${this.logistics.companyName}&logisticsCode=${this.logistics.number}`).then(res => {
  97. let str = res.data.traces
  98. this.logisticsInfo = JSON.parse(res.data.traces).reverse()
  99. if (str.indexOf('揽件') !== -1 || str.indexOf('收件') !== -1 || str.indexOf('转运') !== -1 || str.indexOf('运输') !== -1 || str.indexOf('发往') !== -1 ||
  100. str.indexOf('发出') !== -1 || str.indexOf('收入') !== -1 || str.indexOf('扫描') !== -1 || str.indexOf('到达') !== -1) {
  101. this.status = 'transit'
  102. }
  103. if (str.indexOf('派送') !== -1 || str.indexOf('派件') !== -1) {
  104. this.status = 'send'
  105. }
  106. if (str.indexOf('签收') !== -1) {
  107. this.status = 'signin'
  108. }
  109. })
  110. })
  111. }
  112. }
  113. }
  114. </script>
  115. <style scoped lang='scss'>
  116. @mixin overFlowHidden {
  117. overflow: hidden;
  118. text-overflow: ellipsis;
  119. white-space: nowrap;
  120. }
  121. @mixin lineHeight($value) {
  122. height: $value;
  123. line-height: $value;
  124. }
  125. .order-wrapper {
  126. background: #f1f3f6;
  127. margin: 1.26rem 0 0.98rem 0;
  128. height: calc(100vh - 0.88rem - 0.98rem);
  129. overflow-y: scroll;
  130. .logistics_top {
  131. padding: 0.2rem;
  132. background: #fff;
  133. margin-bottom: 0.2rem;
  134. .pull-left {
  135. font-size: 0.28rem;
  136. color: #333;
  137. .name {
  138. @include lineHeight(0.5rem);
  139. }
  140. .red {
  141. color: #f43938
  142. }
  143. }
  144. .pull-right {
  145. font-size: 0.32rem;
  146. color: #f43938
  147. }
  148. }
  149. .logistics_ul {
  150. background: #fff;
  151. padding: 0.2rem;
  152. height: calc(100vh - 0.88rem - 0.98rem - 2.62rem);
  153. overflow-y: auto;
  154. li {
  155. position: relative;
  156. border-left: 2px solid #e4e5ea;
  157. margin-left: 0.2rem;
  158. .pull-left {
  159. position: absolute;
  160. left: -4px;
  161. top: 0.36rem;
  162. .logistics_icon {
  163. width: 6px;
  164. height: 6px;
  165. border-radius: 50%;
  166. background: #e4e5ea;
  167. &.active {
  168. width: 20px;
  169. height: 20px;
  170. border-radius: 50%;
  171. background: #fcc1c0;
  172. position: relative;
  173. &~.logistics_line {
  174. margin-left: 9px;
  175. }
  176. .red {
  177. position: absolute;
  178. width: 12px;
  179. height: 12px;
  180. background: #f32f2f;
  181. margin-left: 4px;
  182. margin-top: 4px;
  183. border-radius: 50%;
  184. }
  185. }
  186. }
  187. &.marginL {
  188. left: -10px;
  189. top: 0px
  190. }
  191. }
  192. .pull-right {
  193. padding-top: 0.2rem;
  194. font-size: 0.24rem;
  195. color: #333;
  196. border-bottom: 1px solid #f3f3f3;
  197. padding-bottom: 0.2rem;
  198. width: 6.4rem;
  199. .logistics_time {
  200. @include lineHeight(20px);
  201. }
  202. .logistics_info {
  203. margin-top: 0.2rem;
  204. word-break:break-all;
  205. word-wrap: break-word;
  206. line-height: 0.45rem
  207. }
  208. &.marginT {
  209. padding-top: 0px;
  210. }
  211. }
  212. }
  213. }
  214. .nologistics {
  215. height: calc(100vh - 0.88rem - 0.98rem - 2.62rem);
  216. text-align: center;
  217. padding-top: 2rem;
  218. img {
  219. width: 1.87rem;
  220. height: 1.87rem;
  221. }
  222. div {
  223. font-size: 0.32rem;
  224. color: #999999;
  225. margin-top: 0.2rem;
  226. }
  227. }
  228. .navtop {
  229. .ids{
  230. div {
  231. width: 100%;
  232. font-size: 0.24rem;
  233. color: #333;
  234. line-height: .36rem;
  235. .mobile-cart-check{
  236. min-width: .36rem;
  237. height: .36rem;
  238. background: url(/images/mobile/center/user/car-noChecked.png) no-repeat;
  239. background-size: contain;
  240. vertical-align: middle;
  241. margin-bottom: .02rem;
  242. display: inline-block;
  243. margin-right: 0.11rem;
  244. display: inline-block;
  245. vertical-align: middle;
  246. &.active {
  247. background-image: url(/images/mobile/center/user/car-checked.png);
  248. }
  249. }
  250. }
  251. }
  252. }
  253. }
  254. </style>