logistics.vue 6.2 KB

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