detailsSuccess.vue
5.08 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!-- 已完成 - 详情 -->
<template>
<!-- 详情 -->
<view class="details">
<DetailsNav title="任务详情"></DetailsNav>
<!-- 取件状态列表 -->
<view class="container">
<!-- 垂直滚动区域 scroll和swiper的高度都要给且是一样的高度-->
<scroll-view scroll-y="true" class="successSwiperH">
<view class="cont" v-if="Object.keys(itemData).length > 0">
<!-- 通用卡片组件 - 待提货 - 带开关 -->
<CardCont title="基本信息" :open="true">
<DetailsBaseInfo :itemData="itemData"></DetailsBaseInfo>
</CardCont>
<CardCont title="车辆司机信息">
<view class="carInfo">
<view class="line"> <text class="tit">车牌号</text> <text class="ritEl">{{itemData.licensePlate}}</text>
</view>
<view class="line"> <text class="tit">司机姓名</text> <text class="ritEl">{{itemData.driverName}}</text>
</view>
</view>
</CardCont>
<CardCont title="运输路线">
<RouteCont :itemData="itemData" type="route"></RouteCont>
</CardCont>
<CardCont title="物品信息" :label="`共计: ${amount}单`">
<OrderCont :itemData="orders" @searchHandle="searchHandle"></OrderCont>
</CardCont>
<CardCont title="提货凭证">
<view class="upPicCont">
<div class="tit">回单凭证</div>
<view class="upPicContImg">
<img class="image" v-for="item in itemData.cargoPickUpPicture" :src="item" alt="" srcset="">
</view>
</view>
<view class="upPicCont">
<div class="tit">提货照片</div>
<view class="upPicContImg">
<img class="image" v-for="item in itemData.cargoPicture" :src="item" alt="" srcset="">
</view>
</view>
</CardCont>
<CardCont title="交货信息">
<view class="upPicCont">
<div class="tit">回单凭证</div>
<view class="upPicContImg">
<img class="image" v-for="item in itemData.deliverPicture" :src="item" alt="" srcset="">
</view>
</view>
<view class="upPicCont">
<div class="tit">货品照片</div>
<view class="upPicContImg">
<img class="image" v-for="item in itemData.transportCertificate" :src="item" alt="" srcset="">
</view>
</view>
</CardCont>
<CardCont title="异常信息">
</CardCont>
</view>
<!-- 无数据显示 -->
<view v-if="Object.keys(itemData).length === 0">
<EmptyPage emptyInfo="暂无数据!" />
</view>
<!-- end -->
</scroll-view>
</view>
<!-- end -->
</view>
</template>
<script setup>
import {
ref,
reactive,
onMounted,
onUpdated,
watch,
watchEffect,
computed,
inject
} from 'vue';
import {
useStore
} from 'vuex';
// 导入接口
import {
GetTaskDetails,
GetTaskDetailsOrders,
TakeDelivery
} from '@/pages/api/index.js';
// 导入组件
import DetailsNav from '@/components/DetailsNav/index.vue'
import EmptyPage from '@/components/EmptyPage/index.vue'
import DetailsBaseInfo from './components/DetailsBaseInfo.vue'
import OrderCont from './components/OrderCont.vue'
import RouteCont from './components/RouteCont.vue'
// 主体部分
import CardCont from '@/components/CardCont/index.vue';
// 接口调用
import {
upload
} from '@/pages/api/index.js'
// ------定义变量------
const store = useStore(); //vuex获取储存数据
const itemData = ref({});
const orders = ref([]); // 货物信息列表
const amount = ref(0); // 货物信息总数
const id = ref('') // 任务Id
const cargoPickUpPicture = ref([]) // 提货凭证
const cargoPicture = ref([]) // 货物照片
const isTake = ref(true) // 是否可提货
const taskId = ref('')
// ------生命周期------
onMounted(() => {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1].$page.options;
id.value = currentPage.id;
getDetailsInfo();
});
// ------定义方法------
// 获取任务详情的数据
const getDetailsInfo = async () => {
// 获取任务详情的数据
await GetTaskDetails(id.value)
.then(res => {
const {
data
} = res
if (res.code === 200) {
itemData.value = data
getOrders(data.transportTaskId)
} else {
return uni.showToast({
title: res.msg,
duration: 1000,
icon: 'none'
});
}
})
.catch(err => {});
};
// 获取物品订单信息
const getOrders = async (orderId, transportOrderId='' ) => {
const params = {
transportOrderId,
taskId: orderId,
page: 1,
pageSize: 100
}
await GetTaskDetailsOrders(params)
.then(res => {
if (res.code === 200) {
amount.value = res.data.counts ? res.data.counts : 0
orders.value = res.data.items
} else {
return uni.showToast({
title: res.msg,
duration: 1000,
icon: 'none'
});
}
})
.catch(err => {});
}
// 物品信息搜索
function searchHandle(transportOrderId) {
getOrders(itemData.value.transportTaskId, transportOrderId)
}
</script>
<style src="./index.scss" lang="scss"></style>
<style lang="scss" scoped>
.details {
.successSwiperH {
height: calc(100vh - 160rpx);
padding-bottom: 26rpx;
}
}
</style>