<template>
|
<view class="container">
|
<Nav title="调度详情" custom-back="/pages/beReferred/index" />
|
|
<InfoSection :list="infoList" />
|
|
<scroll-view class="content-scroll" scroll-y>
|
<view class="button-section">
|
<u-button class="btn-item" type="primary" @click="goThistory" text="行程历史" />
|
<u-button class="btn-item" type="success" @click="goToAdvanceList" text="垫付列表" />
|
</view>
|
</scroll-view>
|
</view>
|
</template>
|
|
<script>
|
import InfoSection from '@/components/InfoSection/index.vue'
|
import { getcarDispatch } from '@/common/examine'
|
|
const INFO_FIELDS = Object.freeze([
|
{ key: 'dispatchNo', label: '调度单号' },
|
{ key: 'licensePlate', label: '车牌号' },
|
{ key: 'transportLine', label: '路线' },
|
{ key: 'customerName', label: '客户' },
|
{ key: 'statusStr', label: '当前状态', status: true, default: '待发车' },
|
{ key: 'latestDeparture', label: '最晚发车时间' },
|
{ key: 'shipperAddress', label: '装货地' },
|
{ key: 'receiverAddress', label: '卸货地' }
|
])
|
|
export default {
|
components: { InfoSection },
|
|
data() {
|
return {
|
formData: {},
|
infoList: []
|
}
|
},
|
|
onLoad(options) {
|
this.formData = options
|
if (options.id) {
|
this.loadDispatchInfo()
|
}
|
},
|
|
methods: {
|
async loadDispatchInfo() {
|
const fields = INFO_FIELDS.map(f => ({ ...f, value: f.default || '' }))
|
this.infoList = fields
|
try {
|
const res = await getcarDispatch(this.formData.id)
|
this.infoList = fields.map(f => ({ ...f, value: res[f.key] ?? f.value }))
|
} catch {
|
uni.$u.toast('获取调度信息失败')
|
}
|
},
|
|
goThistory() {
|
uni.$u.route(`/pages/travelItinerary/index?id=${this.formData.id}&name=行程历史&statusStr=${encodeURIComponent(this.formData.statusStr || '')}&router=/pages/examine/detail`)
|
},
|
|
goToAdvanceList() {
|
uni.$u.route(`/pages/paymentList/index?name=垫付列表&router=/pages/examine/detail&id=${this.formData.id}`)
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.container {
|
display: flex;
|
flex-direction: column;
|
height: 100vh;
|
background-color: #f7f7f7;
|
}
|
|
.content-scroll {
|
flex: 1;
|
}
|
|
.button-section {
|
display: flex;
|
flex-direction: column;
|
gap: 20rpx;
|
padding: 30rpx;
|
background-color: #fff;
|
margin: 20rpx;
|
border-radius: 12rpx;
|
}
|
|
.btn-item {
|
width: 100%;
|
}
|
</style>
|