修改运输金额管理,修改查看结算单页
This commit is contained in:
parent
afb46f9e7b
commit
0aba0aabb6
@ -317,10 +317,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-container {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-container {
|
.filter-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -371,10 +371,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-container {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-title {
|
.page-title {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
|
@ -195,10 +195,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-container {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-container {
|
.filter-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -171,9 +171,8 @@ export default {
|
|||||||
SettlementPdf
|
SettlementPdf
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const defaultStartDate = new Date();
|
|
||||||
const defaultEndDate = new Date();
|
|
||||||
return {
|
return {
|
||||||
|
orderId: '',
|
||||||
loading: false,
|
loading: false,
|
||||||
scenicAreaOptions: [],
|
scenicAreaOptions: [],
|
||||||
settlementStatus: 0,
|
settlementStatus: 0,
|
||||||
@ -182,9 +181,9 @@ export default {
|
|||||||
query: {
|
query: {
|
||||||
batchNo: "",
|
batchNo: "",
|
||||||
scenicArea: "",
|
scenicArea: "",
|
||||||
dateRange: [defaultStartDate, defaultEndDate],
|
dateRange: [],
|
||||||
},
|
},
|
||||||
defaultDateRange: [defaultStartDate, defaultEndDate],
|
defaultDateRange: [],
|
||||||
page: {
|
page: {
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 10
|
size: 10
|
||||||
@ -209,9 +208,20 @@ export default {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// 获取订单详情并处理数据
|
// 获取订单详情并处理数据
|
||||||
const orderId = this.$route.query.orderId
|
this.orderId = this.$route.query.orderId
|
||||||
if (orderId) {
|
if(this.orderId) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
this.getOrderDetail(this.orderId)
|
||||||
|
} else {
|
||||||
|
this.$message.error('没有提供订单ID')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getOrderStatusText,
|
||||||
|
getSettlementStatusText,
|
||||||
|
getOrderStatusClass,
|
||||||
|
getSettlementStatusClass,
|
||||||
|
async getOrderDetail(orderId) {
|
||||||
try {
|
try {
|
||||||
const settleOrderDetail = await getSettleOrderDetail(orderId)
|
const settleOrderDetail = await getSettleOrderDetail(orderId)
|
||||||
await Promise.all(settleOrderDetail.map(async (item) => {
|
await Promise.all(settleOrderDetail.map(async (item) => {
|
||||||
@ -224,8 +234,9 @@ export default {
|
|||||||
item.createBy = pilotResponse.name
|
item.createBy = pilotResponse.name
|
||||||
|
|
||||||
// 获取景区名称
|
// 获取景区名称
|
||||||
const scenic = scenicResponse.find(s => s.key === item.attractionId)
|
console.log(this.scenicAreaOptions)
|
||||||
item.scenicName = scenic ? scenic.value : ''
|
const scenic = this.scenicAreaOptions.find(s => s.value === item.attractionId)
|
||||||
|
item.scenicName = scenic ? scenic.label : ''
|
||||||
}))
|
}))
|
||||||
this.originalData = settleOrderDetail // 保存原始数据
|
this.originalData = settleOrderDetail // 保存原始数据
|
||||||
this.tableData = settleOrderDetail
|
this.tableData = settleOrderDetail
|
||||||
@ -239,13 +250,7 @@ export default {
|
|||||||
} finally {
|
} finally {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
getOrderStatusText,
|
|
||||||
getSettlementStatusText,
|
|
||||||
getOrderStatusClass,
|
|
||||||
getSettlementStatusClass,
|
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
try {
|
try {
|
||||||
@ -290,10 +295,10 @@ export default {
|
|||||||
},
|
},
|
||||||
async handleCancelSettlement() {
|
async handleCancelSettlement() {
|
||||||
try {
|
try {
|
||||||
await updateSettleOrderStatus(this.$route.query.orderId, 3)
|
await updateSettleOrderStatus(this.orderId, 3)
|
||||||
this.settlementStatus = 3
|
this.settlementStatus = 3
|
||||||
this.$message.success('取消结算成功')
|
this.$message.success('取消结算成功')
|
||||||
this.handleSearch() // 刷新数据
|
this.getOrderDetail(this.orderId) // 刷新数据
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error canceling settlement:', error)
|
console.error('Error canceling settlement:', error)
|
||||||
this.$message.error('取消结算失败')
|
this.$message.error('取消结算失败')
|
||||||
@ -307,9 +312,9 @@ export default {
|
|||||||
this.page.current = val;
|
this.page.current = val;
|
||||||
},
|
},
|
||||||
async handlePrint() {
|
async handlePrint() {
|
||||||
if (this.$route.query.orderId) {
|
if (this.orderId) {
|
||||||
try {
|
try {
|
||||||
// Wait for Vue to render the component
|
// 等待VUE渲染组件
|
||||||
await this.$nextTick()
|
await this.$nextTick()
|
||||||
await this.$refs.settlementPdf.generatePDF()
|
await this.$refs.settlementPdf.generatePDF()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -322,11 +327,11 @@ export default {
|
|||||||
},
|
},
|
||||||
async handleStatusChange(status) {
|
async handleStatusChange(status) {
|
||||||
try {
|
try {
|
||||||
await updateSettleOrderStatus(this.$route.query.orderId, status)
|
await updateSettleOrderStatus(this.orderId, status)
|
||||||
this.settlementStatus = status
|
this.settlementStatus = status
|
||||||
const statusText = status === 1 ? '已确认' : '已完成'
|
const statusText = status === 1 ? '已确认' : '已完成'
|
||||||
this.$message.success(`结算单状态已更新为:${statusText}`)
|
this.$message.success(`结算单状态已更新为:${statusText}`)
|
||||||
this.handleSearch() // 刷新数据
|
this.getOrderDetail(this.orderId) // 刷新数据
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error updating settlement status:', error)
|
console.error('Error updating settlement status:', error)
|
||||||
this.$message.error('更新结算状态失败')
|
this.$message.error('更新结算状态失败')
|
||||||
@ -337,10 +342,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-container {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-title {
|
.page-title {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
|
@ -7,21 +7,13 @@
|
|||||||
>
|
>
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<el-form ref="feeForm" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="feeForm" :model="form" :rules="rules" label-width="100px">
|
||||||
<!-- 景区名称(只读) -->
|
|
||||||
<el-form-item label="景区名称" prop="scenicName">
|
|
||||||
<el-input v-model="form.scenicName" disabled></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<!-- 金额输入(带校验) -->
|
<!-- 金额输入(带校验) -->
|
||||||
<el-form-item label="金额 (KG)" prop="feePerKg">
|
<el-form-item label="金额 (KG)" prop="feePerKg">
|
||||||
<el-input-number
|
<el-input
|
||||||
v-model="form.feePerKg"
|
v-model="form.feePerKg"
|
||||||
:min="0.01"
|
|
||||||
:step="0.01"
|
|
||||||
:precision="2"
|
|
||||||
placeholder="请输入金额"
|
placeholder="请输入金额"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
></el-input-number>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -34,65 +26,65 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { edit } from "@/api/system/scenic";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SetFeeModal',
|
name: "SetFeeModal",
|
||||||
props: {
|
props: {
|
||||||
visible: {
|
visible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: true
|
required: true,
|
||||||
},
|
},
|
||||||
scenicInfo: {
|
scenicInfo: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => null
|
default: () => null,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
scenicName: '',
|
|
||||||
feePerKg: null,
|
feePerKg: null,
|
||||||
id: null
|
id: null,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
feePerKg: [
|
feePerKg: [
|
||||||
{ required: true, message: '请输入金额', trigger: 'blur' },
|
{ required: true, message: "请输入金额", trigger: "blur" },
|
||||||
{ type: 'number', min: 0.01, message: '金额必须大于 0', trigger: 'blur' }
|
],
|
||||||
]
|
},
|
||||||
}
|
};
|
||||||
}
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
scenicInfo(newVal) {
|
scenicInfo(newVal) {
|
||||||
if (newVal) {
|
if (newVal) {
|
||||||
this.form = {
|
this.form = {
|
||||||
scenicName: newVal.scenicName || '',
|
|
||||||
feePerKg: newVal.feePerKg || null,
|
feePerKg: newVal.feePerKg || null,
|
||||||
id: newVal.id || null
|
id: newVal.id || null,
|
||||||
}
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleCancel() {
|
||||||
|
this.$emit("update:visible", false);
|
||||||
|
this.$refs.feeForm.resetFields();
|
||||||
|
},
|
||||||
async handleSubmit() {
|
async handleSubmit() {
|
||||||
try {
|
try {
|
||||||
const valid = await this.$refs.feeForm.validate()
|
const valid = await this.$refs.feeForm.validate();
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// 模拟请求成功(不调用真实 API)
|
await edit({
|
||||||
console.log('提交的数据:', {
|
|
||||||
id: this.form.id,
|
id: this.form.id,
|
||||||
feePerKg: this.form.feePerKg
|
price: this.form.feePerKg,
|
||||||
})
|
});
|
||||||
|
this.$message.success("设置成功");
|
||||||
this.$message.success('设置成功')
|
this.$emit("success");
|
||||||
this.$emit('success')
|
this.handleCancel();
|
||||||
this.handleCancel()
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('表单验证失败', error)
|
console.error("修改景区价格失败:", error);
|
||||||
this.$message.error('请输入正确的金额')
|
this.$message.error(error.message || "修改失败");
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- 搜索栏 -->
|
<!-- 搜索栏 -->
|
||||||
<el-card class="box-card">
|
|
||||||
<div class="filter-container">
|
<div class="filter-container">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="query.scenicName"
|
v-model="query.scenicName"
|
||||||
@ -12,16 +11,17 @@
|
|||||||
<el-button type="primary" @click="handleSearch">查询</el-button>
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
||||||
<el-button @click="handleReset">重置</el-button>
|
<el-button @click="handleReset">重置</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<el-table :data="tableData" stripe style="width: 100%">
|
<el-table :data="tableData" stripe style="width: 100%">
|
||||||
<el-table-column prop="areaName" label="区域名称" align="left" />
|
<el-table-column prop="areaName" label="区域名称" align="left" />
|
||||||
<el-table-column prop="scenicName" label="景区名称" align="left" />
|
<el-table-column prop="scenicName" label="景区名称" align="left" />
|
||||||
<el-table-column prop="feePerKg" label="金额 / KG" align="left" />
|
<el-table-column prop="feePerKg" label="金额 / KG" align="center" />
|
||||||
<el-table-column label="操作" width="120" align="center" fixed="right">
|
<el-table-column label="操作" width="120" align="center" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="primary" size="mini" @click="handleSetFee(scope.row)">设置金额</el-button>
|
<el-button type="primary" size="mini" @click="handleSetFee(scope.row)"
|
||||||
|
>设置金额</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -49,17 +49,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import SetFeeModal from "./components/SetFeeModal.vue";
|
||||||
|
import { list } from "@/api/system/scenic";
|
||||||
export default {
|
export default {
|
||||||
name: 'TransportFee',
|
name: "TransportFee",
|
||||||
components: {
|
components: {
|
||||||
SetFeeModal
|
SetFeeModal,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 查询条件
|
// 查询条件
|
||||||
query: {
|
query: {
|
||||||
scenicName: ''
|
scenicName: "",
|
||||||
},
|
},
|
||||||
// 表格数据
|
// 表格数据
|
||||||
tableData: [],
|
tableData: [],
|
||||||
@ -67,74 +68,84 @@ export default {
|
|||||||
page: {
|
page: {
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
total: 0
|
total: 0,
|
||||||
},
|
},
|
||||||
// 弹窗控制
|
// 弹窗控制
|
||||||
setFeeVisible: false,
|
setFeeVisible: false,
|
||||||
currentScenicInfo: null
|
currentScenicInfo: null,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchData()
|
this.fetchData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fetchData() {
|
async fetchData() {
|
||||||
// 模拟数据填充
|
try {
|
||||||
this.tableData = [
|
const params = {
|
||||||
{ areaName: '华南区', scenicName: '白云山', feePerKg: 5.5 },
|
page: this.page.current - 1,
|
||||||
{ areaName: '华东区', scenicName: '西湖', feePerKg: 4.8 }
|
size: this.page.size,
|
||||||
]
|
name: this.query.scenicName,
|
||||||
this.page.total = 2
|
};
|
||||||
|
const { content, totalElements } = await list(params);
|
||||||
|
this.tableData = content.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
areaName: item.areaName,
|
||||||
|
scenicName: item.name,
|
||||||
|
feePerKg: item.price ? item.price + '元' : "无",
|
||||||
|
}));
|
||||||
|
this.page.total = parseInt(totalElements);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取景区数据失败:", error);
|
||||||
|
this.$message.error("获取景区数据失败");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 搜索
|
// 搜索
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
this.page.current = 1
|
this.page.current = 1;
|
||||||
this.fetchData()
|
this.fetchData();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 重置
|
// 重置
|
||||||
handleReset() {
|
handleReset() {
|
||||||
this.query = {
|
this.query = {
|
||||||
scenicName: ''
|
scenicName: "",
|
||||||
}
|
};
|
||||||
this.page.current = 1
|
this.page.current = 1;
|
||||||
this.fetchData()
|
this.fetchData();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 分页大小变更
|
// 分页大小变更
|
||||||
handleSizeChange(size) {
|
handleSizeChange(size) {
|
||||||
this.page.size = size
|
this.page.size = size;
|
||||||
this.fetchData()
|
this.fetchData();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 当前页变更
|
// 当前页变更
|
||||||
handleCurrentChange(current) {
|
handleCurrentChange(current) {
|
||||||
this.page.current = current
|
this.page.current = current;
|
||||||
this.fetchData()
|
this.fetchData();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 设置金额按钮
|
// 设置金额按钮
|
||||||
handleSetFee(row) {
|
handleSetFee(row) {
|
||||||
this.currentScenicInfo = row
|
this.currentScenicInfo = {
|
||||||
this.setFeeVisible = true
|
id: row.id,
|
||||||
|
scenicName: row.scenicName,
|
||||||
|
feePerKg: row.feePerKg,
|
||||||
|
};
|
||||||
|
this.setFeeVisible = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 设置金额成功回调
|
// 设置金额成功回调
|
||||||
handleSetFeeSuccess() {
|
handleSetFeeSuccess() {
|
||||||
this.setFeeVisible = false
|
this.setFeeVisible = false;
|
||||||
this.fetchData()
|
this.fetchData();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-container {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-container {
|
.filter-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
Loading…
Reference in New Issue
Block a user