logistics-details.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="logistics_details">
  3. <view class="logistics">
  4. <view class="freight"><image src="../../static/icon/freight.png" mode=""></image></view>
  5. <view>
  6. <view>
  7. <text>{{ express_com }}</text>
  8. </view>
  9. <view style="font-size:28rpx;margin-top:25rpx;">物流单号:{{ express_number }}</view>
  10. </view>
  11. </view>
  12. <view class="step" v-if="trackList.length > 0">
  13. <view class="stepCon" v-for="(item, index) in trackList" :key="index">
  14. <!-- <view class="left"> -->
  15. <view class="date">
  16. <view>{{ item.AcceptTime | formDate }}</view>
  17. <view>{{ item.AcceptTime | formDate1 }}</view>
  18. </view>
  19. <view class="progress">
  20. <view class="circle" v-if="index != 0"></view>
  21. <image src="../../static/icon/activer-circle.png" v-else></image>
  22. <view :class="[index == 0 ? 'active' : 'line']"></view>
  23. <!-- <view class="circle" v-show="index == trackList.length - 1"></view> -->
  24. </view>
  25. <!-- </view> -->
  26. <view class="progressCon" :class="[index == 0 ? 'now' : 'before']">{{ item.AcceptStation }}</view>
  27. </view>
  28. </view>
  29. <view v-else class="error_tip">物流信息不存在</view>
  30. </view>
  31. </template>
  32. <script>
  33. import { _API_GetExpressTrack } from '../../apis/order.js';
  34. export default {
  35. data() {
  36. return {
  37. express_com: '', //物流公司名称
  38. express_number: '', //运单号
  39. trackList: [] //物流进程
  40. };
  41. },
  42. onLoad(options) {
  43. this.express_com = options.express_com;
  44. this.express_number = options.express_number;
  45. if (options.id) {
  46. this.getLogisticsTrack(options.id);
  47. }
  48. },
  49. methods: {
  50. getLogisticsTrack(id) {
  51. uni.showLoading({
  52. title: '加载中'
  53. });
  54. _API_GetExpressTrack({
  55. id
  56. }).then(res => {
  57. uni.hideLoading();
  58. if (res.code === 200) {
  59. if (res.data.Traces.length === 0) {
  60. uni.showModal({
  61. content: res.data.message || '物流信息不存在',
  62. showCancel: false
  63. });
  64. return false;
  65. }
  66. let list = res.data.Traces;
  67. this.trackList = list.sort((a, b) => b.AcceptTime - a.AcceptTime);
  68. console.log(res.data, '物流信息');
  69. }
  70. });
  71. }
  72. },
  73. filters: {
  74. formDate(time) {
  75. var date = new Date(time);
  76. var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  77. var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  78. var today = month + '-' + day;
  79. return today;
  80. },
  81. formDate1(time) {
  82. var date = new Date(time);
  83. var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
  84. var minute = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
  85. var today = hours + ':' + minute;
  86. return today;
  87. }
  88. }
  89. };
  90. </script>
  91. <style lang="scss">
  92. .logistics_details {
  93. min-height: 100%;
  94. background: $app-base-bg;
  95. display: flex;
  96. flex-direction: column;
  97. .error_tip {
  98. padding: 20px;
  99. text-align: center;
  100. }
  101. .logistics {
  102. width: 100%;
  103. height: 160rpx;
  104. background: #f76454;
  105. color: #fff;
  106. font-size: 36rpx;
  107. display: flex;
  108. align-items: center;
  109. flex-shink: 0;
  110. .freight {
  111. image {
  112. height: 128rpx;
  113. width: 128rpx;
  114. margin: 0 33rpx 0 60rpx;
  115. }
  116. }
  117. }
  118. .step {
  119. margin-top: 20rpx;
  120. background: #fff;
  121. flex: 1;
  122. padding: 60rpx 0;
  123. .stepCon {
  124. display: flex;
  125. justify-content: flex-start;
  126. align-items: stretch;
  127. // height: 192rpx;
  128. min-height: 120rpx;
  129. padding: 0 30rpx 0 43rpx;
  130. .date {
  131. width: 11%;
  132. flex-shrink: 0;
  133. image {
  134. height: 60rpx;
  135. width: 60rpx;
  136. }
  137. }
  138. .progress {
  139. display: flex;
  140. flex-direction: column;
  141. align-items: center;
  142. // height: 192rpx;
  143. flex: 1;
  144. margin: 0 9rpx 0 30rpx;
  145. // width: 10%;
  146. flex-shrink: 0;
  147. .line {
  148. width: 4rpx;
  149. background: #ccc;
  150. height: 100%;
  151. }
  152. .active {
  153. width: 4rpx;
  154. background: #f76454;
  155. height: 100%;
  156. }
  157. .circle {
  158. height: 18rpx;
  159. width: 18rpx;
  160. background-color: #ccc;
  161. border-radius: 50%;
  162. }
  163. image {
  164. margin-top: 6rpx;
  165. height: 24rpx;
  166. width: 24rpx;
  167. }
  168. }
  169. // .left {
  170. // flex-shrink: 0;
  171. // width: 20%;
  172. // display: flex;
  173. // justify-content: flex-start;
  174. // align-items: center;
  175. // }
  176. .progressCon {
  177. width: 540rpx;
  178. padding: 0 0 10rpx;
  179. }
  180. .now {
  181. color: #181818;
  182. }
  183. .before {
  184. color: #aaaaaa;
  185. }
  186. }
  187. .stepCon:last-child {
  188. .line {
  189. display: none;
  190. }
  191. }
  192. }
  193. }
  194. </style>