logisticsDetails.nvue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <!-- 物流详情 -->
  3. <view class="card_logist">
  4. <view class="map_card">
  5. <map style="width: 100%;" :style="{height:windowHeight * 2 + 'rpx'}" :latitude="latitude"
  6. :longitude="longitude" :enable-3D="true" :scale="scale" :polyline="polylineList" :markers="markers" :v-if="showmap">
  7. </map>
  8. </view>
  9. <view class="card_logistics">
  10. <view class="img_head" @click="clickImg">
  11. <image style="width: 80rpx;height: 40rpx;transform: rotate(0deg);" v-if="logisticsFlag"
  12. src="../../static/unfold.png"></image>
  13. <image style="width: 80rpx;height: 40rpx;transform: rotate(180deg);" v-else
  14. src="../../static/unfold.png"></image>
  15. </view>
  16. <view class="card_wlxq" v-if="logisticsFlag">
  17. <text class="title_logistics_il">物流详情</text>
  18. <view class="card_steps" v-if="activitiesList.length > 0">
  19. <view class="steps">
  20. <view class="steps_item" v-for="(i, index) in activitiesList" :key="index">
  21. <view class="s_r">
  22. <text class="line"
  23. :style="{ backgroundColor: index != 0 ? '#EAEAEA' : 'rgba(0,0,0,0)' }"></text>
  24. <text class="index_title" :style="{ backgroundColor: i.backgroundColor, color: color }">
  25. </text>
  26. <text class="line1"
  27. :style="{ backgroundColor: index != activitiesList.length - 1 ? '#EAEAEA' : 'rgba(0,0,0,0)' }">
  28. </text>
  29. </view>
  30. <view class="s_l">
  31. <text class="title_scacm_34">{{ i.text }}
  32. <text v-if="i.phone">
  33. 联系电话:<text style="color: #f29100;margin-right: 15rpx;">{{i.phone}}</text>
  34. </text>
  35. {{ i.text1 }}
  36. </text>
  37. <text class="date_scacm">{{ i.createdAt || ''}}</text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="not_card" v-else style="padding-bottom: 20rpx;">
  43. <image style="width: 280rpx;height: 220rpx;padding: 30rpx;" src="../../static/task/not.png"></image>
  44. <text class="not_title">暂无物流信息</text>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. const ENV = require('../../.env.js')
  52. export default {
  53. data() {
  54. return {
  55. windowHeight: uni.getSystemInfoSync().windowHeight, //屏幕高度
  56. orderList: {},
  57. trackList: [],
  58. map: null,
  59. longitude: 106.6282014,
  60. latitude: 26.64669,
  61. scale: 13,
  62. activitiesList: [],
  63. active: 0,
  64. statusList: [{
  65. id: 3,
  66. title: '待配送',
  67. }, {
  68. id: 4,
  69. title: '配送中',
  70. }, {
  71. id: 5,
  72. title: '已送达',
  73. }, {
  74. id: 6,
  75. title: '已拒收',
  76. }],
  77. polylineList: [],
  78. markers: [],
  79. logisticsFlag: true,
  80. showmap: false,
  81. color: '#fff',
  82. }
  83. },
  84. mounted() {
  85. uni.setNavigationBarTitle({
  86. title: '物流详情',
  87. })
  88. var orderList = uni.getStorageSync('orderDetails')
  89. this.orderList = orderList
  90. this.$nextTick(() => {
  91. setTimeout(() => {
  92. this.getList()
  93. })
  94. })
  95. },
  96. methods: {
  97. getList() {
  98. uni.request({
  99. url: ENV.APP_DEV_URL + '/api/waybill-logistics',
  100. method: 'GET',
  101. data: {
  102. waybillNo: this.orderList.waybillNo,
  103. },
  104. success: (res) => {
  105. if (res.data.code == 200) {
  106. var arrList = res.data.data.list
  107. arrList.forEach(async (item) => {
  108. item.backgroundColor = '#ffffff'
  109. item.text = ''
  110. let arr = ''
  111. this.statusList.forEach((item1) => {
  112. if (item.status == item1.id) {
  113. arr = item1.title
  114. }
  115. });
  116. let yonTitle = ''
  117. if (item.coolerBox.id) {
  118. yonTitle = item.coolerBox.name
  119. }
  120. item.text = item.address + '【' + yonTitle + '】' + ' ' + '您的货物' +
  121. arr
  122. })
  123. arrList[0].backgroundColor = '#2979ff'
  124. this.activitiesList = arrList.reverse()
  125. this.getTrack()
  126. }
  127. },
  128. fail: (err) => {
  129. // 处理请求失败情况
  130. }
  131. });
  132. },
  133. // 获取轨迹
  134. getTrack() {
  135. uni.request({
  136. url: ENV.APP_DEV_URL + '/api/waybill-task/locus',
  137. method: 'GET',
  138. data: {
  139. waybillNo: this.orderList.waybillNo,
  140. },
  141. success: (res) => {
  142. if (res.data.code == 200) {
  143. let arr = res.data.data
  144. let arrList = []
  145. if (arr.length > 0) {
  146. arr.forEach(item => {
  147. if (item.T_site != '0,0' && item.T_site) {
  148. const arr1 = item.T_site.split(',')
  149. const list = {
  150. latitude: arr1[1],
  151. longitude: arr1[0],
  152. }
  153. arrList.push(list)
  154. }
  155. })
  156. let polyline = [{
  157. points: arrList,
  158. color: '#3591FC',
  159. width: 15,
  160. arrowLine: true,
  161. }]
  162. this.polylineList = polyline
  163. const markers0 = {
  164. latitude: arrList[0].latitude,
  165. longitude: arrList[0].longitude,
  166. id: 0,
  167. iconPath: '/static/task/startpoint.png',
  168. width: 35,
  169. height: 35,
  170. }
  171. const markers1 = {
  172. latitude: arrList[arrList.length - 1].latitude,
  173. longitude: arrList[arrList.length - 1].longitude,
  174. id: 1,
  175. iconPath: '/static/task/endpoint.png',
  176. width: 35,
  177. height: 35,
  178. }
  179. let markers = []
  180. markers.push(markers0)
  181. markers.push(markers1)
  182. this.markers = markers
  183. this.latitude = arrList[arrList.length - 1].latitude
  184. this.longitude = arrList[arrList.length - 1].longitude
  185. this.$forceUpdate()
  186. this.showmap = true;
  187. }
  188. }
  189. },
  190. fail: (err) => {
  191. // 处理请求失败情况
  192. }
  193. });
  194. },
  195. clickImg() {
  196. if (this.logisticsFlag) {
  197. this.logisticsFlag = false
  198. } else {
  199. this.logisticsFlag = true
  200. }
  201. }
  202. }
  203. }
  204. </script>
  205. <style lang="scss" scoped>
  206. .card_logist {
  207. position: fixed;
  208. top: 0;
  209. left: 0;
  210. right: 0;
  211. bottom: 0;
  212. display: flex;
  213. }
  214. .card_logistics {
  215. z-index: 2023;
  216. position: absolute;
  217. display: flex;
  218. bottom: 0;
  219. left: 20rpx;
  220. right: 20rpx;
  221. // width: calc(100% - 40rpx);
  222. // margin: 20rpx 20rpx 0rpx 20rpx;
  223. background-color: #fff;
  224. border-top-right-radius: 10rpx;
  225. border-top-left-radius: 10rpx;
  226. }
  227. .img_head {
  228. display: flex;
  229. justify-content: center;
  230. align-items: center;
  231. padding: 10rpx 0rpx;
  232. }
  233. .card_wlxq {
  234. display: flex;
  235. flex: 1;
  236. }
  237. .title_logistics_il {
  238. font-size: 30rpx;
  239. font-weight: 600;
  240. padding: 0rpx 20rpx 0rpx 20rpx;
  241. }
  242. .card_steps {
  243. display: flex;
  244. padding: 20rpx;
  245. }
  246. .overturn {
  247. transform: rotate(180deg);
  248. }
  249. .steps {
  250. display: flex;
  251. flex-direction: column;
  252. flex: 1;
  253. }
  254. .steps_item {
  255. display: flex;
  256. flex-direction: row;
  257. flex: 1;
  258. }
  259. .s_r {
  260. padding: 0 20rpx;
  261. display: flex;
  262. flex-direction: column;
  263. align-items: center;
  264. width: 50rpx;
  265. }
  266. .line {
  267. width: 5rpx;
  268. height: 20rpx;
  269. }
  270. .line1 {
  271. width: 5rpx;
  272. height: 90rpx;
  273. }
  274. .index_title {
  275. width: 24rpx;
  276. height: 24rpx;
  277. border-radius: 50rpx;
  278. border: 4rpx solid #e3eeff;
  279. }
  280. .s_l {
  281. flex: 1;
  282. height: 120rpx;
  283. display: flex;
  284. flex-direction: column;
  285. padding-bottom: 20rpx;
  286. }
  287. .date_scacm {
  288. font-size: 23rpx;
  289. color: #afb4be;
  290. }
  291. .title_scacm_34 {
  292. font-size: 28rpx;
  293. font-weight: 500;
  294. color: rgba(102, 102, 102, 1);
  295. }
  296. .not_card {
  297. display: flex;
  298. justify-content: center;
  299. flex-direction: column;
  300. align-items: center;
  301. }
  302. .not_title {
  303. font-size: 30rpx;
  304. color: #afb4be;
  305. }
  306. </style>