123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <!-- 物流详情 -->
- <view class="card_logist">
- <u-navbar title="物流详情" autoBack placeholder></u-navbar>
- <view style="width: 100%;">
- <map style="width: 100%;height: 500rpx;" id="container" :latitude="latitude" :longitude="longitude"
- :scale="scale" :polyline="polylineList" :markers="markersList">
- <view slot="loading">
- <view class="loading-icon">加载中...</view>
- </view>
- </map>
- </view>
- <view class="card_logistics">
- <view class="title_logistics">物流详情</view>
- <view class="card_steps" :key="Math.random()" v-if="activitiesList.length > 0">
- <!-- <uni-steps direction="column" :options="activitiesList" :active="active"></uni-steps> -->
- <x-steps :infoList="activitiesList"></x-steps>
- </view>
- <view v-else style="padding-bottom: 20rpx;">
- <u-empty mode="data" text="暂无物流信息"></u-empty>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- orderList: {},
- trackList: [],
- map: null,
- longitude: 106.6282014,
- latitude: 26.64669,
- scale: 14,
- activitiesList: [],
- active: 0,
- statusList: [{
- id: 1,
- title: '待派单',
- }, {
- id: 2,
- title: '待装车',
- }, {
- id: 3,
- title: '待入库',
- }, {
- id: 4,
- title: '已装车',
- }, {
- id: 5,
- title: '已入库',
- }, {
- id: 6,
- title: '已下车',
- }, {
- id: 7,
- title: '已出库',
- }, {
- id: 8,
- title: '已签收',
- }, {
- id: 9,
- title: '待装箱',
- }, {
- id: 10,
- title: '已装箱',
- }, {
- id: 11,
- title: '已出箱',
- }],
- polylineList: [],
- markersList: [],
- }
- },
- mounted() {
- var orderList = this.$cache.getCache('orderDetails')
- this.orderList = orderList
- this.$nextTick(() => {
- setTimeout(() => {
- this.getList()
- })
- })
- },
- methods: {
- getList() {
- this.$api.get('/api/waybill-logistics', {
- waybillNo: this.orderList.waybillNo,
- }).then(res => {
- if (res.code == 200) {
- var arrList = res.data.list
- arrList.forEach(async (item) => {
- item.backgroundColor = '#ffffff'
- item.text = ''
- let arr = this.statusList.filter((i) => {
- return item.status == i.id;
- });
- let yonTitle = ''
- let phone = ''
- if (item.car.id) {
- yonTitle = item.car.carNo
- phone = item.car.user.phone
- } else if (item.warehouse.id) {
- yonTitle = item.warehouse.name
- phone = item.warehouse.user.phone
- } else if (item.coolerBox.id) {
- yonTitle = item.coolerBox.name
- }
- // const trapeze = await this.reverseGeocode(item.lng, item.lat)
- item.phone = phone
- item.text = item.address + '【' + yonTitle + '】'
- item.text1 = '您的货物' + arr[0].title
- })
- arrList[0].backgroundColor = '#2979ff'
- this.activitiesList = arrList.reverse()
- this.getTrack()
- }
- })
- },
- // 获取轨迹
- getTrack() {
- this.$api.get('/api/waybill-task/locus', {
- waybillNo: this.orderList.waybillNo,
- }).then(res => {
- if (res.code == 200) {
- let arr = res.data
- let arrList = []
- arr.forEach(item => {
- const arr1 = item.T_site.split(',')
- const list = {
- latitude: arr1[1],
- longitude: arr1[0],
- }
- arrList.push(list)
- })
- let polyline = [{
- width: 30,
- points: arrList,
- color: '#3591FC',
- arrowLine: true,
- arrowIconPath: '/static/task/arrows.png',
- }]
- this.polylineList = polyline
- const markers0 = {
- latitude: arrList[0].latitude,
- longitude: arrList[0].longitude,
- id: 0,
- iconPath: '/static/task/startpoint.png',
- width: 20,
- height: 23
- }
- const markers1 = {
- latitude: arrList[arrList.length - 1].latitude,
- longitude: arrList[arrList.length - 1].longitude,
- id: 1,
- iconPath: '/static/task/endpoint.png',
- width: 20,
- height: 23
- }
- this.markersList[0] = markers0
- this.markersList[1] = markers1
- this.latitude = arrList[arrList.length - 1].latitude
- this.longitude = arrList[arrList.length - 1].longitude
- // console.log(this.polylineList, this.markersList, 266)
- this.$forceUpdate()
- }
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- #map {
- width: 100%;
- height: 500rpx;
- }
- .loading-icon {
- color: #333;
- font-size: 28rpx;
- padding: 10px;
- background-color: rgba(255, 255, 255, 0.8);
- border-radius: 5px;
- text-align: center;
- }
- .card_logist ::v-deep .u-navbar__content {
- z-index: 2024;
- }
- .card_logistics {
- width: calc(100% - 40rpx);
- margin: 20rpx;
- height: auto;
- background-color: #fff;
- border-radius: 10rpx;
- }
- .title_logistics {
- font-weight: 600;
- padding: 20rpx 20rpx 0rpx 20rpx;
- }
- .card_steps {
- padding: 20rpx;
- }
- </style>
|