logisticsDetails.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <!-- 物流详情 -->
  3. <view class="card_logist">
  4. <u-navbar title="物流详情" autoBack placeholder></u-navbar>
  5. <map style="width: 100%;height: 500rpx;z-index: 2" id="container" :latitude="latitude" :longitude="longitude"
  6. :scale="scale" :polyline="polylineList" :markers="markersList">
  7. </map>
  8. <view class="card_logistics">
  9. <!-- <view class="center_in img_head" @click="clickImg">
  10. <u-image :class="logisticsFlag ? '' : 'overturn'" src="../../static/unfold.png" width="80rpx"
  11. height="50rpx"></u-image>
  12. </view> -->
  13. <view v-if="logisticsFlag">
  14. <view class="title_logistics">物流详情</view>
  15. <view class="card_steps" :key="Math.random()" v-if="activitiesList.length > 0">
  16. <x-steps :infoList="activitiesList"></x-steps>
  17. </view>
  18. <view v-else style="padding-bottom: 20rpx;">
  19. <u-empty mode="data" text="暂无物流信息"></u-empty>
  20. </view>
  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: 3,
  39. title: '待配送',
  40. }, {
  41. id: 4,
  42. title: '配送中',
  43. }, {
  44. id: 5,
  45. title: '已送达',
  46. }, {
  47. id: 6,
  48. title: '已拒收',
  49. }, {
  50. id: 6,
  51. title: '已拒收',
  52. }],
  53. polylineList: [],
  54. markersList: [],
  55. logisticsFlag: true,
  56. }
  57. },
  58. mounted() {
  59. var orderList = this.$cache.getCache('orderDetails')
  60. this.orderList = orderList
  61. this.$nextTick(() => {
  62. setTimeout(() => {
  63. this.getList()
  64. })
  65. })
  66. },
  67. methods: {
  68. getList() {
  69. this.$api.get('/api/waybill-logistics', {
  70. waybillNo: this.orderList.waybillNo,
  71. }).then(res => {
  72. if (res.code == 200) {
  73. var arrList = res.data.list
  74. arrList.forEach(async (item) => {
  75. item.backgroundColor = '#ffffff'
  76. item.text = ''
  77. let arr = ''
  78. this.statusList.forEach((item1) => {
  79. if (item.status == item1.id) {
  80. arr = item1.title
  81. }
  82. });
  83. let yonTitle = ''
  84. if (item.coolerBox.id) {
  85. yonTitle = item.coolerBox.name
  86. }
  87. item.text = item.address + '【' + yonTitle + '】' + ' ' + '您的货物' + arr
  88. })
  89. arrList[0].backgroundColor = '#2979ff'
  90. this.activitiesList = arrList.reverse()
  91. this.getTrack()
  92. }
  93. })
  94. },
  95. // 获取轨迹
  96. getTrack() {
  97. this.$api.get('/api/waybill-task/locus', {
  98. waybillNo: this.orderList.waybillNo,
  99. }).then(res => {
  100. if (res.code == 200) {
  101. let arr = res.data
  102. let arrList = []
  103. if (arr.length > 0) {
  104. arr.forEach(item => {
  105. if (item.T_site != '0,0' && item.T_site) {
  106. const arr1 = item.T_site.split(',')
  107. const list = {
  108. latitude: arr1[1],
  109. longitude: arr1[0],
  110. }
  111. arrList.push(list)
  112. }
  113. })
  114. let polyline = [{
  115. width: 30,
  116. points: arrList,
  117. color: '#3591FC',
  118. arrowLine: true,
  119. arrowIconPath: '/static/task/arrows.png',
  120. }]
  121. this.polylineList = polyline
  122. const markers0 = {
  123. latitude: arrList[0].latitude,
  124. longitude: arrList[0].longitude,
  125. id: 0,
  126. iconPath: '/static/task/startpoint.png',
  127. width: 20,
  128. height: 23
  129. }
  130. const markers1 = {
  131. latitude: arrList[arrList.length - 1].latitude,
  132. longitude: arrList[arrList.length - 1].longitude,
  133. id: 1,
  134. iconPath: '/static/task/endpoint.png',
  135. width: 20,
  136. height: 23
  137. }
  138. this.markersList[0] = markers0
  139. this.markersList[1] = markers1
  140. this.latitude = arrList[arrList.length - 1].latitude
  141. this.longitude = arrList[arrList.length - 1].longitude
  142. // console.log(this.polylineList, this.markersList, 266)
  143. this.$forceUpdate()
  144. }
  145. }
  146. })
  147. },
  148. clickImg() {
  149. if (this.logisticsFlag) {
  150. this.logisticsFlag = false
  151. } else {
  152. this.logisticsFlag = true
  153. }
  154. }
  155. }
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. #map {
  160. width: 100%;
  161. height: 500rpx;
  162. }
  163. .loading-icon {
  164. color: #333;
  165. font-size: 28rpx;
  166. padding: 10px;
  167. background-color: rgba(255, 255, 255, 0.8);
  168. border-radius: 5px;
  169. text-align: center;
  170. }
  171. .card_logist ::v-deep .u-navbar__content {
  172. z-index: 2004;
  173. }
  174. .card_logistics {
  175. // width: calc(100% - 40rpx);
  176. // margin: 20rpx 20rpx 0rpx 20rpx;
  177. width: 100%;
  178. height: auto;
  179. background-color: #fff;
  180. border-top-right-radius: 10rpx;
  181. border-top-left-radius: 10rpx;
  182. }
  183. .img_head {
  184. padding: 10rpx 0rpx;
  185. }
  186. .title_logistics {
  187. font-weight: 600;
  188. padding: 30rpx 20rpx 0rpx 20rpx;
  189. }
  190. .card_steps {
  191. padding: 20rpx;
  192. }
  193. .overturn {
  194. transform: rotate(180deg);
  195. }
  196. </style>