logistics.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 = await axios.get(`/trade/purchase/purchaseId/${route.query.uuid}`)
  57. let logistics = await axios.get(`/trade/logistics/${res.data.data.lgtId}`)
  58. let logisticsInfo = await axios.get(`/kdn/logistics/query?companyName=${logistics.data.companyName}&logisticsCode=${logistics.data.number}`)
  59. let str = logisticsInfo.data.traces
  60. let status = ''
  61. if (str.indexOf('揽件') !== -1 || str.indexOf('收件') !== -1 || str.indexOf('转运') !== -1 || str.indexOf('运输') !== -1 || str.indexOf('发往') !== -1 ||
  62. str.indexOf('发出') !== -1 || str.indexOf('收入') !== -1 || str.indexOf('扫描') !== -1 || str.indexOf('到达') !== -1) {
  63. status = 'transit'
  64. }
  65. if (str.indexOf('派送') !== -1 || str.indexOf('派件') !== -1) {
  66. status = 'send'
  67. }
  68. if (str.indexOf('签收') !== -1) {
  69. status = 'signin'
  70. }
  71. return {
  72. detailsInfo: res.data.data,
  73. logistics: logistics.data,
  74. logisticsInfo: JSON.parse(logisticsInfo.data.traces).reverse(),
  75. status: status
  76. }
  77. }
  78. }
  79. </script>
  80. <style scoped lang='scss'>
  81. @mixin overFlowHidden {
  82. overflow: hidden;
  83. text-overflow: ellipsis;
  84. white-space: nowrap;
  85. }
  86. @mixin lineHeight($value) {
  87. height: $value;
  88. line-height: $value;
  89. }
  90. .order-wrapper {
  91. background: #f1f3f6;
  92. margin: 0.88rem 0 0.98rem 0;
  93. height: calc(100vh - 0.88rem - 0.98rem);
  94. overflow-y: scroll;
  95. .logistics_top {
  96. padding: 0.2rem;
  97. background: #fff;
  98. margin-bottom: 0.2rem;
  99. .pull-left {
  100. font-size: 0.28rem;
  101. color: #333;
  102. .name {
  103. @include lineHeight(0.5rem);
  104. }
  105. .red {
  106. color: #f43938
  107. }
  108. }
  109. .pull-right {
  110. font-size: 0.32rem;
  111. color: #f43938
  112. }
  113. }
  114. .logistics_ul {
  115. background: #fff;
  116. padding: 0.2rem;
  117. height: calc(100vh - 0.88rem - 0.98rem - 2.62rem);
  118. overflow-y: auto;
  119. li {
  120. position: relative;
  121. border-left: 2px solid #e4e5ea;
  122. margin-left: 0.2rem;
  123. .pull-left {
  124. position: absolute;
  125. left: -4px;
  126. top: 0.36rem;
  127. .logistics_icon {
  128. width: 6px;
  129. height: 6px;
  130. border-radius: 50%;
  131. background: #e4e5ea;
  132. &.active {
  133. width: 20px;
  134. height: 20px;
  135. border-radius: 50%;
  136. background: #fcc1c0;
  137. position: relative;
  138. &~.logistics_line {
  139. margin-left: 9px;
  140. }
  141. .red {
  142. position: absolute;
  143. width: 12px;
  144. height: 12px;
  145. background: #f32f2f;
  146. margin-left: 4px;
  147. margin-top: 4px;
  148. border-radius: 50%;
  149. }
  150. }
  151. }
  152. &.marginL {
  153. left: -10px;
  154. top: 0px
  155. }
  156. }
  157. .pull-right {
  158. padding-top: 0.2rem;
  159. font-size: 0.24rem;
  160. color: #333;
  161. border-bottom: 1px solid #f3f3f3;
  162. padding-bottom: 0.2rem;
  163. width: 6.4rem;
  164. .logistics_time {
  165. @include lineHeight(20px);
  166. }
  167. .logistics_info {
  168. margin-top: 0.2rem;
  169. word-break:break-all;
  170. word-wrap: break-word;
  171. line-height: 0.45rem
  172. }
  173. &.marginT {
  174. padding-top: 0px;
  175. }
  176. }
  177. }
  178. }
  179. .nologistics {
  180. height: calc(100vh - 0.88rem - 0.98rem - 2.62rem);
  181. text-align: center;
  182. padding-top: 2rem;
  183. img {
  184. width: 1.87rem;
  185. height: 1.87rem;
  186. }
  187. div {
  188. font-size: 0.32rem;
  189. color: #999999;
  190. margin-top: 0.2rem;
  191. }
  192. }
  193. }
  194. </style>