|
|
|
@ -24,7 +24,7 @@ |
|
|
|
|
<span>基本信息</span> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
|
|
|
|
<el-form class="info" ref="form" :model="form" :rules="rules" label-width="120px"> |
|
|
|
|
<el-col :span="6" :offset="5"> |
|
|
|
|
<el-form-item label="订单编号"> |
|
|
|
|
<el-input v-model="form.orderNumber" disabled placeholder="自动生成"></el-input> |
|
|
|
@ -171,43 +171,40 @@ |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="市场价" align="center" min-width="110"> |
|
|
|
|
<el-table-column label="市场价" align="center" min-width="170"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input disabled v-model="scope.row.marketValue" placeholder="" |
|
|
|
|
<el-input class="normal" disabled v-model="scope.row.marketValue" placeholder="" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<span style="margin-left:5px">万</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="折扣率 " align="center" min-width="100"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input disabled v-model="scope.row.discountRate" placeholder="" |
|
|
|
|
<el-input class="normal" disabled v-model="scope.row.discountRate" placeholder="" |
|
|
|
|
type="text" size="small" style="width: 100%"></el-input> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="成交价" align="center" min-width="130"> |
|
|
|
|
<el-table-column label="成交价" align="center" min-width="170"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input :class="scope.row.finalPrice === '' && whetherSubmit?'red':''" |
|
|
|
|
<el-input :class="['normal', scope.row.finalPrice === '' && whetherSubmit?'red':'']" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
@input="scope.row.finalPrice = scope.row.finalPrice.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" |
|
|
|
|
@change="[allAmount($event,scope.row),calculateDiscountCourse($event,scope.row)]" |
|
|
|
|
v-model="scope.row.finalPrice" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<span style="margin-left:5px">万</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="结算价" align="center" min-width="130"> |
|
|
|
|
<el-table-column label="结算价" align="center" min-width="170"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input :class="scope.row.settlementPrice === '' && whetherSubmit?'red':''" |
|
|
|
|
<el-input :class="['normal', scope.row.settlementPrice === '' && whetherSubmit?'red':'']" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
@input="scope.row.settlementPrice = scope.row.settlementPrice.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" |
|
|
|
|
v-model="scope.row.settlementPrice" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<span style="margin-left:5px">万</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -347,7 +344,7 @@ |
|
|
|
|
<el-table-column label="折扣率" align="center" min-width="140"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input disabled v-model="scope.row.discountRate" placeholder="" |
|
|
|
|
<el-input class="normal" disabled v-model="scope.row.discountRate" placeholder="" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
@ -355,7 +352,7 @@ |
|
|
|
|
<el-table-column label="账号数" align="center" min-width="120"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input :class="!scope.row.accountNum&&whetherSubmit?'red':''" |
|
|
|
|
<el-input :class="['normal', !scope.row.accountNum&&whetherSubmit?'red':'']" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
@input="scope.row.accountNum = scope.row.accountNum.replace(/[^0-9.]/g,'')" |
|
|
|
|
v-model="scope.row.accountNum" |
|
|
|
@ -368,25 +365,23 @@ |
|
|
|
|
<el-table-column label="成交价" align="center" min-width="180"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input :class="scope.row.finalPrice === '' && whetherSubmit?'red':''" |
|
|
|
|
<el-input :class="['normal', scope.row.finalPrice === '' && whetherSubmit?'red':'']" |
|
|
|
|
:disabled="viewDisabled||editDisabled" |
|
|
|
|
@blur="[allAmount($event,scope.row),dealFinalValue($event,scope.row)]" |
|
|
|
|
@input="scope.row.finalPrice = scope.row.finalPrice.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" |
|
|
|
|
v-model="scope.row.finalPrice" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<span style="margin-left:5px">万</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="结算价" align="center" min-width="130"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input :class="scope.row.settlementPrice === '' && whetherSubmit?'red':''" |
|
|
|
|
<el-input :class="['normal', scope.row.settlementPrice === '' && whetherSubmit?'red':'']" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
@input="scope.row.settlementPrice = scope.row.settlementPrice.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" |
|
|
|
|
v-model="scope.row.settlementPrice" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<span style="margin-left:5px">万</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -839,34 +834,87 @@ export default { |
|
|
|
|
this.$get(this.api.orderDetail, { orderId: +id }).then(res => { |
|
|
|
|
let form = res.orderDetails.order;// 基本信息 |
|
|
|
|
let contract = res.orderDetails.contractInformation ? res.orderDetails.contractInformation : {}; // 合同 |
|
|
|
|
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.orderType === 2 ? 0 : form.orderAmount, // 如果是试用的订单,则订单金额显示为0 |
|
|
|
|
orderId: form.orderId, |
|
|
|
|
options: form.options, |
|
|
|
|
businessManagerId: form.businessManagerId ? +form.businessManagerId : '' |
|
|
|
|
}; |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
form.provinceId && this.getCityData() |
|
|
|
|
}); |
|
|
|
|
const { orderOther } = res.orderDetails |
|
|
|
|
const promises = [] |
|
|
|
|
const { customerId } = form |
|
|
|
|
const list = [] |
|
|
|
|
if (orderOther.find(e => e.authority)) { |
|
|
|
|
promises.push(new Promise((resolve, reject) => { |
|
|
|
|
this.$post(this.api.renew, { |
|
|
|
|
authority: 1, |
|
|
|
|
customerId: form.customerId, |
|
|
|
|
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) |
|
|
|
|
} |
|
|
|
|
}).then(({ orderOthers }) => { |
|
|
|
|
list.push(...orderOthers) |
|
|
|
|
resolve() |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
})) |
|
|
|
|
} |
|
|
|
|
if (orderOther.find(e => !e.authority)) { |
|
|
|
|
promises.push(new Promise((resolve, reject) => { |
|
|
|
|
this.$post(this.api.renew, { |
|
|
|
|
authority: 0, |
|
|
|
|
customerId, |
|
|
|
|
productId: orderOther.filter(e => !e.authority).map(e => e.dataOrCourseId) |
|
|
|
|
}).then(({ orderOthers }) => { |
|
|
|
|
list.push(...orderOthers) |
|
|
|
|
resolve() |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
})) |
|
|
|
|
} |
|
|
|
|
Promise.all(promises).then(_ => { |
|
|
|
|
this.setStartDate(list, orderOther) |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
setStartDate(renewList, contract, form, orderOther) { |
|
|
|
|
const { orderType } = form |
|
|
|
|
setStartDate(renewList, orderOther) { |
|
|
|
|
console.log(555) |
|
|
|
|
let list = orderOther.map(e => { |
|
|
|
|
if (orderType === 2) e.finalPrice = 0 // 如果是试用的订单,则成交价显示为0 |
|
|
|
|
const item = renewList.find(n => n.dataOrCourseId === e.dataOrCourseId && n.authority === e.authority) // 匹配renew接口返回的数据 |
|
|
|
|
if (item) { |
|
|
|
|
// 处于续费 |
|
|
|
@ -891,55 +939,8 @@ export default { |
|
|
|
|
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.orderType === 2 ? 0 : form.orderAmount, // 如果是试用的订单,则订单金额显示为0 |
|
|
|
|
orderId: form.orderId, |
|
|
|
|
options: form.options, |
|
|
|
|
businessManagerId: +form.businessManagerId |
|
|
|
|
}; |
|
|
|
|
this.coursePermissions = list.filter(i => i.authority === 1); |
|
|
|
|
this.dataPlatformPermissions = list.filter(i => i.authority === 0); |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
if(this.form.provinceId){ |
|
|
|
|
this.getCityData() |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 新增订单 |
|
|
|
|
submitOrder() { |
|
|
|
@ -1345,7 +1346,7 @@ export default { |
|
|
|
|
let total = 0 |
|
|
|
|
const list = [...this.coursePermissions, ...this.dataPlatformPermissions] |
|
|
|
|
list.map(e => total += +e.finalPrice) |
|
|
|
|
this.form.orderAmount = total * 10000 |
|
|
|
|
this.form.orderAmount = total |
|
|
|
|
}, |
|
|
|
|
// 成交价修改后,计算成交单价 计算规则:成交价/账号数/时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
|
|
|
|
dealFinalValue(val, row) { |
|
|
|
@ -1384,10 +1385,10 @@ export default { |
|
|
|
|
priceUnit / 12 * useUnit : |
|
|
|
|
priceUnit * useUnit) * (row.authority ? |
|
|
|
|
1 : |
|
|
|
|
row.accountNum) / 10000).toFixed(2) |
|
|
|
|
row.accountNum)).toFixed(2) |
|
|
|
|
} else { |
|
|
|
|
// 比例分成。计算规则:成交价*商务分成比例(单位是万) |
|
|
|
|
sPrice = row.finalPrice * row.businessProportion / 100 / 10000 |
|
|
|
|
sPrice = row.finalPrice * row.businessProportion / 100 |
|
|
|
|
} |
|
|
|
|
row.settlementPrice = this.handleNaN(sPrice) |
|
|
|
|
}, |
|
|
|
@ -1424,7 +1425,7 @@ export default { |
|
|
|
|
price / 365 * useUnit : |
|
|
|
|
unit === 1 ? |
|
|
|
|
price / 12 * useUnit : |
|
|
|
|
price * useUnit) / 10000).toFixed(2) |
|
|
|
|
price * useUnit)).toFixed(2) |
|
|
|
|
} |
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
// 只有改变了起止日期才需要调接口查询订单,该接口作用是把开始时间传过去,会返回一个提示或者时间,如果是时间,则把时间+1天,如果是提示,则无法保存 |
|
|
|
@ -1628,6 +1629,9 @@ export default { |
|
|
|
|
/deep/ .contractDate .el-date-editor--daterange.el-input__inner { |
|
|
|
|
width: 100%; |
|
|
|
|
} |
|
|
|
|
.info .el-select { |
|
|
|
|
width: 100%; |
|
|
|
|
} |
|
|
|
|
.mag { |
|
|
|
|
margin-right: 20px; |
|
|
|
|
} |
|
|
|
|