sen
1 天以前 5abcde36961125cbf436f91b8c17610a6b5f8308
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<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>