logisticsDetails.nvue 7.2 KB

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