11
This commit is contained in:
parent
1babcd6ff2
commit
f378872e8a
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-dialog title="订单信息" :visible.sync="dialogVisible" width="700px" v-if="orderDatalist">
|
<el-dialog title="订单信息" :visible.sync="dialogVisible" width="1000px" v-if="orderDatalist">
|
||||||
<div class="description" v-loading="loading">
|
<div class="description" v-loading="loading">
|
||||||
<div class="title">用户信息</div>
|
<div class="title">用户信息</div>
|
||||||
<div class="acea-row">
|
<div class="acea-row">
|
||||||
|
@ -72,14 +72,16 @@
|
||||||
<div class="li" style="display: flex; flex-wrap: nowrap; width: 100%; align-items: center; margin-top: 10px;"
|
<div class="li" style="display: flex; flex-wrap: nowrap; width: 100%; align-items: center; margin-top: 10px;"
|
||||||
v-for="(item, index) in zdlist" :key="index">
|
v-for="(item, index) in zdlist" :key="index">
|
||||||
<div style="margin-right: 20px;">状态: {{ item.repaymentStatus }}</div>
|
<div style="margin-right: 20px;">状态: {{ item.repaymentStatus }}</div>
|
||||||
<div style="margin-right: 20px;">还款金额: {{ item.repaymentAmount }}</div>
|
<div style="margin-right: 20px;">还款金额:</div>
|
||||||
<div class="text" style="margin-right: 8px;">还款时间:</div>
|
<el-input v-model="item.repaymentAmount" placeholder="账单金额" class="selWidth" size="small" clearable>
|
||||||
<el-date-picker v-model="item.repaymentDeadlineStr" type="date" placeholder="选择日期"
|
</el-input>
|
||||||
:disabled="item.repaymentStatus != '待还款'">
|
<div class="text" style="margin-right: 4px;">还款时间:</div>
|
||||||
|
<el-date-picker v-model="item.repaymentDeadlineStr" type="date" placeholder="选择日期">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
<el-button size="small" @click="changetime(item.id,item.repaymentDeadlineStr)" class="mr10" :disabled="item.repaymentStatus != '待还款'"
|
|
||||||
v-hasPermi="['admin:channel:update']">确定</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
|
<el-button type="primary" size="small" @click="changetimes()" class="mr10" s
|
||||||
|
v-hasPermi="['admin:channel:update']" style="margin-left: 800px;">确定</el-button>
|
||||||
<template v-if="orderDatalist.statusStr.key === 'toBeWrittenOff' && orderDatalist.systemStore">
|
<template v-if="orderDatalist.statusStr.key === 'toBeWrittenOff' && orderDatalist.systemStore">
|
||||||
<div class="description-term">提货码:{{ orderDatalist.verifyCode }}</div>
|
<div class="description-term">提货码:{{ orderDatalist.verifyCode }}</div>
|
||||||
<div class="description-term">门店名称:{{ orderDatalist.systemStore.name }}</div>
|
<div class="description-term">门店名称:{{ orderDatalist.systemStore.name }}</div>
|
||||||
|
@ -149,7 +151,7 @@ import {
|
||||||
infobyconditionApi
|
infobyconditionApi
|
||||||
} from '@/api/user'
|
} from '@/api/user'
|
||||||
import { orderDetailApi, getLogisticsInfoApi, changePrice } from '@/api/order';
|
import { orderDetailApi, getLogisticsInfoApi, changePrice } from '@/api/order';
|
||||||
import { changetime } from '@/api/marketing';
|
import { changetime } from '@/api/marketing';
|
||||||
export default {
|
export default {
|
||||||
name: 'OrderDetail',
|
name: 'OrderDetail',
|
||||||
props: {
|
props: {
|
||||||
|
@ -173,29 +175,111 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() { },
|
mounted() { },
|
||||||
methods: {
|
methods: {
|
||||||
changetime(id,repaymentDeadlineStr){
|
changetimes() {
|
||||||
let repaymentDeadlineStrs=repaymentDeadlineStr
|
// console.log(id,'repaymentAmountrepaymentAmount');
|
||||||
let date = new Date(repaymentDeadlineStrs);
|
let totalRepaymentAmount = 0; // 初始化总额为0
|
||||||
let year = date.getFullYear();
|
this.zdlist.forEach(item => {
|
||||||
let month = (date.getMonth() + 1).toString().padStart(2, '0');
|
// console.log(id,'repaymentAmountrepaymentAmount');
|
||||||
let day = date.getDate().toString().padStart(2, '0');
|
let repaymentDeadlineStrs = item.repaymentDeadlineStr;
|
||||||
repaymentDeadlineStrs = `${year}-${month}-${day}`;
|
let date = new Date(repaymentDeadlineStrs);
|
||||||
|
let year = date.getFullYear();
|
||||||
|
let month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||||
|
let day = date.getDate().toString().padStart(2, '0');
|
||||||
|
repaymentDeadlineStrs = `${year}-${month}-${day}`;
|
||||||
|
// 替换原字段值
|
||||||
|
let repaymentAmount = parseFloat(item.repaymentAmount);
|
||||||
|
|
||||||
|
// 计算总额
|
||||||
|
totalRepaymentAmount += repaymentAmount;
|
||||||
|
});
|
||||||
|
console.log(totalRepaymentAmount,'totalRepaymentAmounttotalRepaymentAmount');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let data = {
|
if (totalRepaymentAmount != this.repaymentAmount) {
|
||||||
repaymentDeadlineStr: repaymentDeadlineStrs,
|
this.$confirm('此操作将会修改订单总金额, 是否继续?', '提示', {
|
||||||
// repaymentAmount:repaymentDeadlineStrs
|
confirmButtonText: '确定',
|
||||||
}
|
cancelButtonText: '取消',
|
||||||
changetime(id, data).then((res) => {
|
type: 'warning'
|
||||||
// console.log("11111111111111111---------"+JSON.stringify(res))
|
}).then(() => {
|
||||||
|
setTimeout(() => {
|
||||||
if (res.code == 500) {
|
this.repaymentAmount=totalRepaymentAmount
|
||||||
this.$message.error(res.msg);
|
this.sunchange()
|
||||||
}
|
this.zdlist.forEach(item => {
|
||||||
|
let data = {
|
||||||
|
repaymentDeadlineStr: item.repaymentDeadlineStr,
|
||||||
|
repaymentAmount: item.repaymentAmount
|
||||||
|
};
|
||||||
|
console.log(data);
|
||||||
|
changetime(item.id, data).then((res) => {
|
||||||
|
if (res.code == 500) {
|
||||||
|
this.$message.error(res.msg);
|
||||||
|
} else {
|
||||||
|
this.$message.success(res.msg);
|
||||||
|
// 更新 this.zdlist
|
||||||
|
// 这里根据接口返回的数据更新 this.zdlist,例如:
|
||||||
|
// item.someField = res.someField;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, 200);
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消修改'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}, 200);
|
} else {
|
||||||
|
this.zdlist.forEach(item => {
|
||||||
|
let data = {
|
||||||
|
repaymentDeadlineStr: item.repaymentDeadlineStr,
|
||||||
|
repaymentAmount: item.repaymentAmount
|
||||||
|
};
|
||||||
|
console.log(data);
|
||||||
|
changetime(item.id, data).then((res) => {
|
||||||
|
if (res.code == 500) {
|
||||||
|
this.$message.error(res.msg);
|
||||||
|
} else {
|
||||||
|
this.$message.success(res.msg);
|
||||||
|
// 更新 this.zdlist
|
||||||
|
// 这里根据接口返回的数据更新 this.zdlist,例如:
|
||||||
|
// item.someField = res.someField;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
// this.$confirm('此操作将会修改订单总金额, 是否继续?', '提示', {
|
||||||
|
// confirmButtonText: '确定',
|
||||||
|
// cancelButtonText: '取消',
|
||||||
|
// type: 'warning'
|
||||||
|
// }).then(() => {
|
||||||
|
// setTimeout(() => {
|
||||||
|
// let data = {
|
||||||
|
// repaymentDeadlineStr: item.repaymentDeadlineStrs,
|
||||||
|
// repaymentAmount: item.repaymentAmount
|
||||||
|
// }
|
||||||
|
// console.log(data,);
|
||||||
|
// changetime(item.id, data).then((res) => {
|
||||||
|
// // console.log("11111111111111111---------"+JSON.stringify(res))
|
||||||
|
|
||||||
|
// if (res.code == 500) {
|
||||||
|
// this.$message.error(res.msg);
|
||||||
|
// } else {
|
||||||
|
// this.$message.success(res.msg);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// });
|
||||||
|
// }, 200);
|
||||||
|
// }).catch(() => {
|
||||||
|
// this.$message({
|
||||||
|
// type: 'info',
|
||||||
|
// message: '已取消修改'
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
openLogistics() {
|
openLogistics() {
|
||||||
this.getOrderData();
|
this.getOrderData();
|
||||||
|
@ -219,34 +303,31 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async sunchange() {
|
async sunchange() {
|
||||||
console.log(this.orderDatalist, 'this.orderDatalistthis.orderDatalist');
|
let newRepaymentAmount = parseFloat(this.repaymentAmount);
|
||||||
if (typeof this.repaymentAmount === 'string') {
|
|
||||||
// 将字符串转换为数字
|
|
||||||
let amount = parseFloat(this.repaymentAmount);
|
|
||||||
|
|
||||||
// 检查是否为有效数字
|
// 检查是否为有效数字
|
||||||
if (!isNaN(amount)) {
|
if (!isNaN(newRepaymentAmount)) {
|
||||||
// 将数字转换为两位小数的字符串
|
// 将数字转换为两位小数的字符串
|
||||||
this.repaymentAmount = amount.toFixed(2);
|
this.repaymentAmount = newRepaymentAmount.toFixed(2);
|
||||||
if (this.repaymentAmount != this.orderDatalist.payPrice) {
|
|
||||||
let data = {
|
|
||||||
payPrice: this.repaymentAmount,
|
|
||||||
orderNo: this.orderDatalist.orderId
|
|
||||||
}
|
|
||||||
await changePrice(data).then((res) => {
|
|
||||||
console.log(res, 'resres');
|
|
||||||
|
|
||||||
|
// 检查是否需要进行接口请求
|
||||||
|
if (this.repaymentAmount !== this.orderDatalist.payPrice) {
|
||||||
|
let data = {
|
||||||
|
payPrice: this.repaymentAmount,
|
||||||
|
orderNo: this.orderDatalist.orderId
|
||||||
|
};
|
||||||
|
|
||||||
this.getDetail(this.id);
|
await changePrice(data)
|
||||||
}).catch(error => {
|
.then((res) => {
|
||||||
console.error(error); // 打印捕获的错误
|
console.log(res, 'resres');
|
||||||
})
|
this.getDetail(this.id);
|
||||||
}
|
})
|
||||||
}
|
.catch(error => {
|
||||||
}
|
console.error(error); // 打印捕获的错误
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
}
|
||||||
|
},
|
||||||
getDetail(id) {
|
getDetail(id) {
|
||||||
this.id = id
|
this.id = id
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user