logistics.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div class="order-wrapper">
  3. <div class="com-mobile-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p>物流信息
  6. </p>
  7. </div>
  8. <div class="logistics_top clearfix">
  9. <div class="pull-left">
  10. <div class="name">订单编号:<span class="red">{{detailsInfo.orderid}}</span></div>
  11. <div class="name">配送方式:<span>{{detailsInfo.sendType === 1301 ? '第三方配送' : (detailsInfo.sendType === 1302 ? '卖家配送': '上门自提')}}</span></div>
  12. <div class="name">配送商:<span>{{logistics.companyName || '-'}}</span></div>
  13. <div class="name">运单号:<span class="red">{{logistics.number || '-'}}</span></div>
  14. </div>
  15. <div class="pull-right">
  16. <template v-if="status === 'signin'">已签收</template>
  17. <template v-else-if="status === 'send'">派件中</template>
  18. <template v-else-if="status === 'transit'">运输中</template>
  19. <template v-else>已发货</template>
  20. </div>
  21. </div>
  22. <ul class="logistics_ul" v-if="logisticsInfo.length > 0">
  23. <li class="clearfix" v-for="(item, index) in logisticsInfo">
  24. <div class="pull-left" :class="index > 0 ? '' : 'marginL'">
  25. <div class="logistics_icon" :class="index > 0 ? '' : 'active'">
  26. <div class="red" v-if="index === 0"></div>
  27. </div>
  28. </div>
  29. <div class="pull-right" :class="index > 0 ? '' : 'marginT'">
  30. <div class="logistics_time">{{item.AcceptTime}}</div>
  31. <div class="logistics_info">{{item.AcceptStation}}</div>
  32. </div>
  33. </li>
  34. </ul>
  35. <div class="nologistics" v-else>
  36. <img src="/images/order/nologistics.png"/>
  37. <div>暂无物流信息</div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import axios from '~plugins/axios'
  43. export default {
  44. name: 'logistics',
  45. layout: 'mobile',
  46. middleware: 'authenticated',
  47. data() {
  48. return {
  49. detailsInfo: {},
  50. logistics: {},
  51. logisticsInfo: {},
  52. status: ''
  53. }
  54. },
  55. async asyncData ({route}) {
  56. let res
  57. let resultInfo
  58. if (route.query.type === 'buyer') {
  59. res = await axios.get(`/trade/order/${route.query.uuid}`)
  60. resultInfo = res.data[0]
  61. } else {
  62. res = await axios.get(`/trade/purchase/purchaseId/${route.query.uuid}`)
  63. resultInfo = res.data.data
  64. }
  65. return {
  66. detailsInfo: resultInfo
  67. }
  68. },
  69. created() {
  70. if (this.detailsInfo.lgtId) {
  71. this.$http.get(`/trade/logistics/${this.detailsInfo.lgtId}`).then(data => {
  72. this.logistics = data.data
  73. this.$http.get(`/kdn/logistics/query?companyName=${data.data.companyName}&logisticsCode=${data.data.number}`).then(res => {
  74. let str = res.data.traces
  75. this.logisticsInfo = JSON.parse(res.data.traces).reverse()
  76. if (str.indexOf('揽件') !== -1 || str.indexOf('收件') !== -1 || str.indexOf('转运') !== -1 || str.indexOf('运输') !== -1 || str.indexOf('发往') !== -1 ||
  77. str.indexOf('发出') !== -1 || str.indexOf('收入') !== -1 || str.indexOf('扫描') !== -1 || str.indexOf('到达') !== -1) {
  78. this.status = 'transit'
  79. }
  80. if (str.indexOf('派送') !== -1 || str.indexOf('派件') !== -1) {
  81. this.status = 'send'
  82. }
  83. if (str.indexOf('签收') !== -1) {
  84. this.status = 'signin'
  85. }
  86. })
  87. })
  88. }
  89. }
  90. }
  91. </script>
  92. <style scoped lang='scss'>
  93. @mixin overFlowHidden {
  94. overflow: hidden;
  95. text-overflow: ellipsis;
  96. white-space: nowrap;
  97. }
  98. @mixin lineHeight($value) {
  99. height: $value;
  100. line-height: $value;
  101. }
  102. .order-wrapper {
  103. background: #f1f3f6;
  104. margin: 0.88rem 0 0.98rem 0;
  105. height: calc(100vh - 0.88rem - 0.98rem);
  106. overflow-y: scroll;
  107. .logistics_top {
  108. padding: 0.2rem;
  109. background: #fff;
  110. margin-bottom: 0.2rem;
  111. .pull-left {
  112. font-size: 0.28rem;
  113. color: #333;
  114. .name {
  115. @include lineHeight(0.5rem);
  116. }
  117. .red {
  118. color: #f43938
  119. }
  120. }
  121. .pull-right {
  122. font-size: 0.32rem;
  123. color: #f43938
  124. }
  125. }
  126. .logistics_ul {
  127. background: #fff;
  128. padding: 0.2rem;
  129. height: calc(100vh - 0.88rem - 0.98rem - 2.62rem);
  130. overflow-y: auto;
  131. li {
  132. position: relative;
  133. border-left: 2px solid #e4e5ea;
  134. margin-left: 0.2rem;
  135. .pull-left {
  136. position: absolute;
  137. left: -4px;
  138. top: 0.36rem;
  139. .logistics_icon {
  140. width: 6px;
  141. height: 6px;
  142. border-radius: 50%;
  143. background: #e4e5ea;
  144. &.active {
  145. width: 20px;
  146. height: 20px;
  147. border-radius: 50%;
  148. background: #fcc1c0;
  149. position: relative;
  150. &~.logistics_line {
  151. margin-left: 9px;
  152. }
  153. .red {
  154. position: absolute;
  155. width: 12px;
  156. height: 12px;
  157. background: #f32f2f;
  158. margin-left: 4px;
  159. margin-top: 4px;
  160. border-radius: 50%;
  161. }
  162. }
  163. }
  164. &.marginL {
  165. left: -10px;
  166. top: 0px
  167. }
  168. }
  169. .pull-right {
  170. padding-top: 0.2rem;
  171. font-size: 0.24rem;
  172. color: #333;
  173. border-bottom: 1px solid #f3f3f3;
  174. padding-bottom: 0.2rem;
  175. width: 6.4rem;
  176. .logistics_time {
  177. @include lineHeight(20px);
  178. }
  179. .logistics_info {
  180. margin-top: 0.2rem;
  181. word-break:break-all;
  182. word-wrap: break-word;
  183. line-height: 0.45rem
  184. }
  185. &.marginT {
  186. padding-top: 0px;
  187. }
  188. }
  189. }
  190. }
  191. .nologistics {
  192. height: calc(100vh - 0.88rem - 0.98rem - 2.62rem);
  193. text-align: center;
  194. padding-top: 2rem;
  195. img {
  196. width: 1.87rem;
  197. height: 1.87rem;
  198. }
  199. div {
  200. font-size: 0.32rem;
  201. color: #999999;
  202. margin-top: 0.2rem;
  203. }
  204. }
  205. }
  206. </style>