logisticsDetails.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <!-- 物流详情 -->
  3. <view class="card_logist">
  4. <u-navbar title="物流详情" autoBack placeholder></u-navbar>
  5. <view style="width: 100%;">
  6. <map style="width: 100%;height: 500rpx;" id="container" :latitude="latitude" :longitude="longitude"
  7. :scale="scale" :polyline="polylineList" :markers="markersList">
  8. <view slot="loading">
  9. <view class="loading-icon">加载中...</view>
  10. </view>
  11. </map>
  12. </view>
  13. <view class="card_logistics">
  14. <view class="title_logistics">物流详情</view>
  15. <view class="card_steps" :key="Math.random()" v-if="activitiesList.length > 0">
  16. <!-- <uni-steps direction="column" :options="activitiesList" :active="active"></uni-steps> -->
  17. <x-steps :infoList="activitiesList"></x-steps>
  18. </view>
  19. <view v-else style="padding-bottom: 20rpx;">
  20. <u-empty mode="data" text="暂无物流信息"></u-empty>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. orderList: {},
  30. trackList: [],
  31. map: null,
  32. longitude: 106.6282014,
  33. latitude: 26.64669,
  34. scale: 14,
  35. activitiesList: [],
  36. active: 0,
  37. statusList: [{
  38. id: 1,
  39. title: '待派单',
  40. }, {
  41. id: 2,
  42. title: '待装车',
  43. }, {
  44. id: 3,
  45. title: '待入库',
  46. }, {
  47. id: 4,
  48. title: '已装车',
  49. }, {
  50. id: 5,
  51. title: '已入库',
  52. }, {
  53. id: 6,
  54. title: '已下车',
  55. }, {
  56. id: 7,
  57. title: '已出库',
  58. }, {
  59. id: 8,
  60. title: '已签收',
  61. }],
  62. polylineList: [],
  63. markersList: [],
  64. }
  65. },
  66. mounted() {
  67. var orderList = this.$cache.getCache('orderDetails')
  68. this.orderList = orderList
  69. this.$nextTick(() => {
  70. setTimeout(() => {
  71. this.getList()
  72. })
  73. })
  74. },
  75. methods: {
  76. getList() {
  77. this.$api.get('/api/waybill-logistics', {
  78. waybillNo: this.orderList.waybillNo,
  79. }).then(res => {
  80. if (res.code == 200) {
  81. var arrList = res.data.list
  82. arrList.forEach(async (item) => {
  83. item.backgroundColor = '#ffffff'
  84. item.text = ''
  85. let arr = this.statusList.filter((i) => {
  86. return item.status == i.id;
  87. });
  88. let yonTitle = ''
  89. let phone = ''
  90. if (item.car.id) {
  91. yonTitle = item.car.carNo
  92. phone = item.car.user.phone
  93. } else if (item.warehouse.id) {
  94. yonTitle = item.warehouse.name
  95. phone = item.warehouse.user.phone
  96. }
  97. // const trapeze = await this.reverseGeocode(item.lng, item.lat)
  98. item.phone = phone
  99. item.text = item.address + '【' + yonTitle + '】'
  100. item.text1 = '您的货物' + arr[0].title
  101. })
  102. arrList[0].backgroundColor = '#2979ff'
  103. this.activitiesList = arrList.reverse()
  104. this.getTrack()
  105. }
  106. })
  107. },
  108. // 获取轨迹
  109. getTrack() {
  110. this.$api.get('/api/waybill-task/locus', {
  111. waybillNo: this.orderList.waybillNo,
  112. }).then(res => {
  113. if (res.code == 200) {
  114. let arr = res.data
  115. let arrList = []
  116. arr.forEach(item => {
  117. const arr1 = item.T_site.split(',')
  118. const list = {
  119. latitude: arr1[1],
  120. longitude: arr1[0],
  121. }
  122. arrList.push(list)
  123. })
  124. let polyline = [{
  125. width: 30,
  126. points: arrList,
  127. color: '#3591FC',
  128. arrowLine: true,
  129. arrowIconPath: '/static/task/arrows.png',
  130. }]
  131. this.polylineList = polyline
  132. const markers0 = {
  133. latitude: arrList[0].latitude,
  134. longitude: arrList[0].longitude,
  135. id: 0,
  136. iconPath: '/static/task/startpoint.png',
  137. width: 20,
  138. height: 23
  139. }
  140. const markers1 = {
  141. latitude: arrList[arrList.length - 1].latitude,
  142. longitude: arrList[arrList.length - 1].longitude,
  143. id: 1,
  144. iconPath: '/static/task/endpoint.png',
  145. width: 20,
  146. height: 23
  147. }
  148. this.markersList[0] = markers0
  149. this.markersList[1] = markers1
  150. this.latitude = arrList[arrList.length - 1].latitude
  151. this.longitude = arrList[arrList.length - 1].longitude
  152. // console.log(this.polylineList, this.markersList, 266)
  153. this.$forceUpdate()
  154. }
  155. })
  156. },
  157. }
  158. }
  159. </script>
  160. <style lang="scss" scoped>
  161. #map {
  162. width: 100%;
  163. height: 500rpx;
  164. }
  165. .loading-icon {
  166. color: #333;
  167. font-size: 28rpx;
  168. padding: 10px;
  169. background-color: rgba(255, 255, 255, 0.8);
  170. border-radius: 5px;
  171. text-align: center;
  172. }
  173. .card_logist ::v-deep .u-navbar__content {
  174. z-index: 2024;
  175. }
  176. .card_logistics {
  177. width: calc(100% - 40rpx);
  178. margin: 20rpx;
  179. height: auto;
  180. background-color: #fff;
  181. border-radius: 10rpx;
  182. }
  183. .title_logistics {
  184. font-weight: 600;
  185. padding: 20rpx 20rpx 0rpx 20rpx;
  186. }
  187. .card_steps {
  188. padding: 20rpx;
  189. }
  190. </style>