logisticsDetails.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. id: 9,
  63. title: '待装箱',
  64. }, {
  65. id: 10,
  66. title: '已装箱',
  67. }, {
  68. id: 11,
  69. title: '已出箱',
  70. }],
  71. polylineList: [],
  72. markersList: [],
  73. }
  74. },
  75. mounted() {
  76. var orderList = this.$cache.getCache('orderDetails')
  77. this.orderList = orderList
  78. this.$nextTick(() => {
  79. setTimeout(() => {
  80. this.getList()
  81. })
  82. })
  83. },
  84. methods: {
  85. getList() {
  86. this.$api.get('/api/waybill-logistics', {
  87. waybillNo: this.orderList.waybillNo,
  88. }).then(res => {
  89. if (res.code == 200) {
  90. var arrList = res.data.list
  91. arrList.forEach(async (item) => {
  92. item.backgroundColor = '#ffffff'
  93. item.text = ''
  94. let arr = this.statusList.filter((i) => {
  95. return item.status == i.id;
  96. });
  97. let yonTitle = ''
  98. let phone = ''
  99. if (item.car.id) {
  100. yonTitle = item.car.carNo
  101. phone = item.car.user.phone
  102. } else if (item.warehouse.id) {
  103. yonTitle = item.warehouse.name
  104. phone = item.warehouse.user.phone
  105. } else if (item.coolerBox.id) {
  106. yonTitle = item.coolerBox.name
  107. }
  108. // const trapeze = await this.reverseGeocode(item.lng, item.lat)
  109. item.phone = phone
  110. item.text = item.address + '【' + yonTitle + '】'
  111. item.text1 = '您的货物' + arr[0].title
  112. })
  113. arrList[0].backgroundColor = '#2979ff'
  114. this.activitiesList = arrList.reverse()
  115. this.getTrack()
  116. }
  117. })
  118. },
  119. // 获取轨迹
  120. getTrack() {
  121. this.$api.get('/api/waybill-task/locus', {
  122. waybillNo: this.orderList.waybillNo,
  123. }).then(res => {
  124. if (res.code == 200) {
  125. let arr = res.data
  126. let arrList = []
  127. arr.forEach(item => {
  128. const arr1 = item.T_site.split(',')
  129. const list = {
  130. latitude: arr1[1],
  131. longitude: arr1[0],
  132. }
  133. arrList.push(list)
  134. })
  135. let polyline = [{
  136. width: 30,
  137. points: arrList,
  138. color: '#3591FC',
  139. arrowLine: true,
  140. arrowIconPath: '/static/task/arrows.png',
  141. }]
  142. this.polylineList = polyline
  143. const markers0 = {
  144. latitude: arrList[0].latitude,
  145. longitude: arrList[0].longitude,
  146. id: 0,
  147. iconPath: '/static/task/startpoint.png',
  148. width: 20,
  149. height: 23
  150. }
  151. const markers1 = {
  152. latitude: arrList[arrList.length - 1].latitude,
  153. longitude: arrList[arrList.length - 1].longitude,
  154. id: 1,
  155. iconPath: '/static/task/endpoint.png',
  156. width: 20,
  157. height: 23
  158. }
  159. this.markersList[0] = markers0
  160. this.markersList[1] = markers1
  161. this.latitude = arrList[arrList.length - 1].latitude
  162. this.longitude = arrList[arrList.length - 1].longitude
  163. // console.log(this.polylineList, this.markersList, 266)
  164. this.$forceUpdate()
  165. }
  166. })
  167. },
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. #map {
  173. width: 100%;
  174. height: 500rpx;
  175. }
  176. .loading-icon {
  177. color: #333;
  178. font-size: 28rpx;
  179. padding: 10px;
  180. background-color: rgba(255, 255, 255, 0.8);
  181. border-radius: 5px;
  182. text-align: center;
  183. }
  184. .card_logist ::v-deep .u-navbar__content {
  185. z-index: 2024;
  186. }
  187. .card_logistics {
  188. width: calc(100% - 40rpx);
  189. margin: 20rpx;
  190. height: auto;
  191. background-color: #fff;
  192. border-radius: 10rpx;
  193. }
  194. .title_logistics {
  195. font-weight: 600;
  196. padding: 20rpx 20rpx 0rpx 20rpx;
  197. }
  198. .card_steps {
  199. padding: 20rpx;
  200. }
  201. </style>