订单修复

dev_2022-03-03 V2.2.2
yujialong 3 years ago
parent 17f90ca911
commit cb3795b69f
  1. 188
      src/views/order/AddOrder.vue

@ -813,87 +813,103 @@ export default {
let form = res.orderDetails.order;//
let contract = res.orderDetails.contractInformation ? res.orderDetails.contractInformation : {}; //
const { orderOther } = res.orderDetails
const productId = orderOther.map(e => e.dataOrCourseId)
this.$post(this.api.renew, {
authority: orderOther[0].authority,
customerId: form.customerId,
productId
}).then(res => {
const renewList = res.orderOthers
let list = orderOther.map(e => {
const item = renewList.find(n => n.dataOrCourseId === e.dataOrCourseId)
if (item) {
//
if (this.renewDisabled) {
let end = Date.parse(item.endTime);
let now = +new Date();
if (now < end) {
let time = new Date(item.endTime.split(" ")[0])
time = new Date(time.setDate(time.getDate() + 1))
e.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`
} else {
//
e.startTime = "";
}
e.endTime = "";
e.periodOfUse = "";
} else {
e.startTime = item.startTime.split(" ")[0];
e.endTime = item.endTime.split(" ")[0];
}
if (orderOther.find(e => e.authority)) {
this.$post(this.api.renew, {
authority: 1,
customerId: form.customerId,
productId: orderOther.filter(e => e.authority).map(e => e.dataOrCourseId)
}).then(res => {
const renewList = res.orderOthers
if (orderOther.find(e => !e.authority)) {
this.$post(this.api.renew, {
authority: 0,
customerId: form.customerId,
productId: orderOther.filter(e => !e.authority).map(e => e.dataOrCourseId)
}).then(res => {
renewList.push(...res.orderOthers)
this.setStartDate(renewList, contract, form, orderOther)
}).catch(err => {})
} else {
this.setStartDate(renewList, contract, form, orderOther)
}
return e;
});//
if (this.renewDisabled) { //
this.contract = {
contractName: "",
contractFile: "",
contractMoney: "",
contractNumber: "",
startTime: "",
endTime: ""
};
} else {
this.contract = {
contractName: contract.contractName,
contractMoney: contract.contractMoney,
contractNumber: contract.contractNumber,
startTime: contract.startTime ? contract.startTime : "",
endTime: contract.endTime ? contract.endTime : "",
contractId: contract.contractId,
uploadList: {
name: contract.contractFile ? contract.contractFile.split("/").pop() : "",
url: contract.contractFile
}
};
if (contract.startTime && contract.endTime) {
this.contractTime = [contract.startTime, contract.endTime];
}).catch(err => {})
}
});
},
setStartDate(renewList, contract, form, orderOther) {
console.log(33, renewList, contract, form)
let list = orderOther.map(e => {
const item = renewList.find(n => n.dataOrCourseId === e.dataOrCourseId && n.authority === e.authority)
if (item) {
//
if (this.renewDisabled) {
let end = Date.parse(item.endTime);
let now = +new Date();
if (now < end) {
let time = new Date(item.endTime.split(" ")[0])
time = new Date(time.setDate(time.getDate() + 1))
e.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`
} else {
//
e.startTime = "";
}
e.endTime = "";
e.periodOfUse = "";
} else {
e.startTime = item.startTime.split(" ")[0];
e.endTime = item.endTime.split(" ")[0];
}
this.form = {
orderNumber: form.orderNumber,
createTime: form.createTime,
provinceId: form.provinceId,
orderContact: form.orderContact,
email: form.email,
customerId: form.customerId,
customerName: form.customerName,
orderType: form.orderType,
cityId: form.cityId,
phone: form.phone,
orderAmount: form.orderAmount,
orderId: form.orderId,
options: form.options,
};
this.coursePermissions = list.filter(i => i.authority === 1);
this.dataPlatformPermissions = list.filter(i => i.authority === 0);
this.$nextTick(() => {
if(this.form.provinceId){
this.getCityData()
}
});
}).catch(err => {})
}
return e;
});//
if (this.renewDisabled) { //
this.contract = {
contractName: "",
contractFile: "",
contractMoney: "",
contractNumber: "",
startTime: "",
endTime: ""
};
} else {
this.contract = {
contractName: contract.contractName,
contractMoney: contract.contractMoney,
contractNumber: contract.contractNumber,
startTime: contract.startTime ? contract.startTime : "",
endTime: contract.endTime ? contract.endTime : "",
contractId: contract.contractId,
uploadList: {
name: contract.contractFile ? contract.contractFile.split("/").pop() : "",
url: contract.contractFile
}
};
if (contract.startTime && contract.endTime) {
this.contractTime = [contract.startTime, contract.endTime];
}
}
this.form = {
orderNumber: form.orderNumber,
createTime: form.createTime,
provinceId: form.provinceId,
orderContact: form.orderContact,
email: form.email,
customerId: form.customerId,
customerName: form.customerName,
orderType: form.orderType,
cityId: form.cityId,
phone: form.phone,
orderAmount: form.orderAmount,
orderId: form.orderId,
options: form.options,
};
this.coursePermissions = list.filter(i => i.authority === 1);
this.dataPlatformPermissions = list.filter(i => i.authority === 0);
this.$nextTick(() => {
if(this.form.provinceId){
this.getCityData()
}
});
},
//
@ -1102,7 +1118,7 @@ export default {
await this.$post(this.api.renew, params).then(res => {
this.coursePermissions.map(e => {
res.orderOthers.map(el => {
if (el.dataOrCourseId === e.dataOrCourseId) {
if (el.dataOrCourseId === e.dataOrCourseId && el.authority) {
let time = el.endTime.split(" ")[0];
let arr = time.split("-");
e.startTime = arr[0] + "-" + arr[1] + "-" + (+arr[2] + 1);
@ -1174,7 +1190,7 @@ export default {
dataOrCourseId: e.id,// id
productName: e.productName,//
periodOfUse: "",// 使
startTime: "",//
startTime: new Date(),//
endTime: "", //
remainingPeriod: "",//
marketValue: e.market,//
@ -1214,7 +1230,7 @@ export default {
await this.$post(this.api.renew, params).then(res => {
this.dataPlatformPermissions.map(e => {
res.orderOthers.map(el => {
if (el.dataOrCourseId === e.dataOrCourseId) {
if (el.dataOrCourseId === e.dataOrCourseId && !el.authority) {
let time = el.endTime.split(" ")[0];
let arr = time.split("-");
e.startTime = arr[0] + "-" + arr[1] + "-" + (+arr[2] + 1);
@ -1331,10 +1347,12 @@ export default {
id: row.dataOrCourseId,
startTime: date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
}).then(res => {
orderRepeat.includes(row.id) && orderRepeat.splice(orderRepeat.findIndex(e => e === row.id), 1)
let time = new Date(res.endTime)
time = new Date(time.setDate(time.getDate() + 1))
row.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`
if (res.endTime) {
orderRepeat.includes(row.id) && orderRepeat.splice(orderRepeat.findIndex(e => e === row.id), 1)
let time = new Date(res.endTime)
time = new Date(time.setDate(time.getDate() + 1))
row.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`
}
}).catch(res => {
this.repeatMsg = res.message
orderRepeat.includes(row.id) || orderRepeat.push(row.id)

Loading…
Cancel
Save