|
|
|
@ -190,7 +190,7 @@ |
|
|
|
|
<el-input :class="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),calculateDiscount($event,scope.row)]" |
|
|
|
|
@change="[allAmount($event,scope.row),calculateDiscountCourse($event,scope.row)]" |
|
|
|
|
v-model="scope.row.finalPrice" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<span style="margin-left:5px">万</span> |
|
|
|
@ -203,7 +203,6 @@ |
|
|
|
|
<el-input :class="scope.row.settlementPrice === '' && whetherSubmit?'red':''" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
@input="scope.row.settlementPrice = scope.row.settlementPrice.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" |
|
|
|
|
@change="[allAmount($event,scope.row),calculateDiscount($event,scope.row)]" |
|
|
|
|
v-model="scope.row.settlementPrice" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<span style="margin-left:5px">万</span> |
|
|
|
@ -324,7 +323,7 @@ |
|
|
|
|
<el-table-column label="市场单价" align="center" min-width="160"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input disabled v-model="scope.row.marketPrice" placeholder="" |
|
|
|
|
<el-input disabled v-model="scope.row.marketValue" placeholder="" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<span style="margin-left:5px">元 / 账号</span> |
|
|
|
|
</div> |
|
|
|
@ -333,11 +332,11 @@ |
|
|
|
|
<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="scope.row.finalValue === '' && whetherSubmit?'red':''" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
@input="scope.row.finalPrice = scope.row.finalPrice.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" |
|
|
|
|
@change="[dealComputers($event,scope.row),calculateDiscount($event,scope.row),userAmount($event,scope.row)]" |
|
|
|
|
v-model="scope.row.finalPrice" |
|
|
|
|
@input="scope.row.finalValue = scope.row.finalValue.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" |
|
|
|
|
@change="[dealComputers($event,scope.row),calculateDiscount($event,scope.row)]" |
|
|
|
|
v-model="scope.row.finalValue" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<span style="margin-left:5px">元 / 账号</span> |
|
|
|
|
</div> |
|
|
|
@ -345,7 +344,6 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="折扣率" align="center" min-width="140"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<!-- <div class="discountRate"> --> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input disabled v-model="scope.row.discountRate" placeholder="" |
|
|
|
|
type="text"></el-input> |
|
|
|
@ -359,7 +357,7 @@ |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
@input="scope.row.accountNum = scope.row.accountNum.replace(/[^0-9.]/g,'')" |
|
|
|
|
v-model="scope.row.accountNum" |
|
|
|
|
@change="[dealComputers($event,scope.row),dealBargain($event,scope.row),calculateDiscount($event,scope.row)]" |
|
|
|
|
@change="[dealComputers($event,scope.row),dealBargain($event,scope.row)]" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
@ -368,11 +366,11 @@ |
|
|
|
|
<el-table-column label="成交价" align="center" min-width="180"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input :class="scope.row.totalAmount === '' && whetherSubmit?'red':''" |
|
|
|
|
<el-input :class="scope.row.finalPrice === '' && whetherSubmit?'red':''" |
|
|
|
|
:disabled="viewDisabled||editDisabled" |
|
|
|
|
@blur="[allAmount($event,scope.row),allAmountChange($event,scope.row),calculateDiscount($event,scope.row)]" |
|
|
|
|
@input="scope.row.totalAmount = scope.row.totalAmount.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" |
|
|
|
|
v-model="scope.row.totalAmount" |
|
|
|
|
@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> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
@ -383,7 +381,6 @@ |
|
|
|
|
<el-input :class="scope.row.settlementPrice === '' && whetherSubmit?'red':''" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
@input="scope.row.settlementPrice = scope.row.settlementPrice.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" |
|
|
|
|
@change="[allAmount($event,scope.row),calculateDiscount($event,scope.row)]" |
|
|
|
|
v-model="scope.row.settlementPrice" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<span style="margin-left:5px">万</span> |
|
|
|
@ -965,7 +962,7 @@ export default { |
|
|
|
|
if (this.dataPlatformPermissions.length) { |
|
|
|
|
let dataVerify = |
|
|
|
|
this.dataPlatformPermissions.some(e => { |
|
|
|
|
if (!e.periodOfUse || e.finalPrice === '' || !e.accountNum || e.totalAmount === '') { |
|
|
|
|
if (!e.periodOfUse || e.finalPrice === '' || !e.accountNum || e.settlementPrice === '') { |
|
|
|
|
return false; |
|
|
|
|
} else { |
|
|
|
|
return true; |
|
|
|
@ -1122,9 +1119,10 @@ export default { |
|
|
|
|
ship: 0,// 发货否(0未发货,1已发货,默认不发货) |
|
|
|
|
authority: 1, // 区分权限 0为数据平台权限,1为课程权限 |
|
|
|
|
options: 1, |
|
|
|
|
settlementPrice: '', // 结算单价 |
|
|
|
|
settlementMethod: '', // 结算方式,0为单价,1为分成 |
|
|
|
|
businessProportion: '', // 商务占比 |
|
|
|
|
settlementPrice: '', // 结算价 |
|
|
|
|
settlementMethod: e.settlementMethod, // 结算方式,0为单价,1为分成 |
|
|
|
|
settlementPriceUnit: e.settlementPrice, // 结算单价 |
|
|
|
|
businessProportion: e.businessProportion, // 商务占比 |
|
|
|
|
}; |
|
|
|
|
that.coursePermissions.push(obj); |
|
|
|
|
}; |
|
|
|
@ -1229,8 +1227,10 @@ export default { |
|
|
|
|
startTime: new Date(),// 开始 |
|
|
|
|
endTime: "", // 终止 |
|
|
|
|
remainingPeriod: "",// 剩余期限 |
|
|
|
|
marketValue: e.market,// 市场价 |
|
|
|
|
marketValue: e.market, // 市场价 |
|
|
|
|
marketValue: e.market, // 市场单价 |
|
|
|
|
finalPrice: '',// 成交价 |
|
|
|
|
finalValue: '', // 成交单价 |
|
|
|
|
discountRate: "",// 折扣率 |
|
|
|
|
accountNum: "",// 账号数 |
|
|
|
|
totalAmount: orderType === 2 ? 0 : '',// 总价 |
|
|
|
@ -1238,9 +1238,10 @@ export default { |
|
|
|
|
ship: 0,// 发货否(0未发货,1已发货,默认不发货) |
|
|
|
|
authority: 0,// 数据平台权限 |
|
|
|
|
options:1, |
|
|
|
|
settlementPrice: '', // 结算单价 |
|
|
|
|
settlementMethod: '', // 结算方式,0为单价,1为分成 |
|
|
|
|
businessProportion: '', // 商务占比 |
|
|
|
|
settlementPrice: '', // 结算价 |
|
|
|
|
settlementMethod: e.settlementMethod, // 结算方式,0为单价,1为分成 |
|
|
|
|
settlementPriceUnit: e.settlementPrice, // 结算单价 |
|
|
|
|
businessProportion: e.businessProportion, // 商务占比 |
|
|
|
|
}; |
|
|
|
|
that.dataPlatformPermissions.push(obj); |
|
|
|
|
}; |
|
|
|
@ -1315,16 +1316,16 @@ export default { |
|
|
|
|
handleNaN(val) { |
|
|
|
|
return isNaN(val) ? 0 : val |
|
|
|
|
}, |
|
|
|
|
// 计算折扣率 |
|
|
|
|
calculateDiscount(val, row) { |
|
|
|
|
// 课程计算折扣率 |
|
|
|
|
calculateDiscountCourse(val, row) { |
|
|
|
|
if (row.finalPrice) |
|
|
|
|
debugger |
|
|
|
|
row.discountRate = (row.finalPrice / row.marketValue * 100).toFixed(2) + "%"; |
|
|
|
|
}, |
|
|
|
|
// 已知成交和总额,计算账号数目 |
|
|
|
|
userAmount(val, row) { |
|
|
|
|
if (val && row.totalAmount) { |
|
|
|
|
// row.accountNum = this.handleNaN(Math.round(row.totalAmount / val)) |
|
|
|
|
} |
|
|
|
|
// 数据计算折扣率 |
|
|
|
|
calculateDiscount(val, row) { |
|
|
|
|
if (row.finalValue) |
|
|
|
|
row.discountRate = (row.finalValue / row.marketValue * 100).toFixed(2) + "%"; |
|
|
|
|
}, |
|
|
|
|
// 合同起止日期选择 |
|
|
|
|
contractTimeChange(val) { |
|
|
|
@ -1335,6 +1336,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 新增数据平台权限时,计算总的金额数目 |
|
|
|
|
allAmount($event, row) { |
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
// 课程权限总价 |
|
|
|
|
let courseArr = []; |
|
|
|
|
this.coursePermissions.map(e => { |
|
|
|
@ -1349,25 +1351,29 @@ export default { |
|
|
|
|
let dataTotalPrice = dataArr.reduce((a, b) => a + b, 0); |
|
|
|
|
this.form.orderAmount = courseTotalPrice * 10000 + dataTotalPrice; |
|
|
|
|
}, |
|
|
|
|
// 总金额触发--计算账号或市场价 |
|
|
|
|
allAmountChange(val, row) { |
|
|
|
|
if (row.totalAmount) { |
|
|
|
|
let all = row.totalAmount; |
|
|
|
|
if (row.accountNum) {// 若有账号 |
|
|
|
|
row.finalPrice = this.handleNaN(Math.round(all / row.accountNum).toFixed(2)) |
|
|
|
|
} |
|
|
|
|
if (row.finalPrice) {// 若有市场价 |
|
|
|
|
// row.accountNum = Math.floor(all / row.finalPrice); |
|
|
|
|
row.accountNum = this.handleNaN(Math.round(all / row.finalPrice)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 成交价修改后,计算成交单价 计算规则:成交价/账号数/时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
|
|
|
|
dealFinalValue(val, row) { |
|
|
|
|
const { periodOfUse, options, accountNum, finalPrice } = row |
|
|
|
|
if (periodOfUse && accountNum && finalPrice) { |
|
|
|
|
debugger |
|
|
|
|
row.finalValue = (finalPrice / accountNum / periodOfUse * (!options ? |
|
|
|
|
365 : |
|
|
|
|
options === 1 ? |
|
|
|
|
12 : |
|
|
|
|
1)).toFixed(2) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 计算成交总额 |
|
|
|
|
// 计算成交价。计算规则:成交单价*账号数*时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
|
|
|
|
dealComputers(e, row) { |
|
|
|
|
if (row.finalPrice && row.accountNum) { |
|
|
|
|
row.totalAmount = this.handleNaN(Math.round((row.finalPrice) * (row.accountNum)).toFixed(2)) |
|
|
|
|
} |
|
|
|
|
this.allAmount(); |
|
|
|
|
const { finalValue, accountNum, periodOfUse, options } = row |
|
|
|
|
if (finalValue && accountNum) { |
|
|
|
|
row.finalPrice = ((!options ? |
|
|
|
|
finalValue / 365 * periodOfUse : |
|
|
|
|
options === 1 ? |
|
|
|
|
finalValue / 12 * periodOfUse : |
|
|
|
|
finalValue * periodOfUse) * accountNum).toFixed(2) |
|
|
|
|
} |
|
|
|
|
this.allAmount(e, row) |
|
|
|
|
}, |
|
|
|
|
// 计算成交价 |
|
|
|
|
dealBargain(e, row) { |
|
|
|
@ -1375,9 +1381,31 @@ export default { |
|
|
|
|
row.finalPrice = this.handleNaN(Math.round(row.totalAmount / row.accountNum).toFixed(2)) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 计算结算价 |
|
|
|
|
dealSettlePrice(row) { |
|
|
|
|
debugger |
|
|
|
|
|
|
|
|
|
const unit = row.options // 使用期限单位 |
|
|
|
|
const useUnit = row.periodOfUse // 使用期限 |
|
|
|
|
let sPrice = '' |
|
|
|
|
if (row.settlementMethod === '0') { |
|
|
|
|
// 结算单价。计算规则:结算单价(**元/年)*购买时长(单位年)*数量(课程为1,数据为账号数量) |
|
|
|
|
const priceUnit = row.settlementPriceUnit |
|
|
|
|
sPrice = ((!unit ? |
|
|
|
|
priceUnit / 365 * useUnit : |
|
|
|
|
unit === 1 ? |
|
|
|
|
priceUnit / 12 * useUnit : |
|
|
|
|
priceUnit * useUnit) * (row.authority ? |
|
|
|
|
1 : |
|
|
|
|
row.accountNum)).toFixed(2) |
|
|
|
|
} else { |
|
|
|
|
// 比例分成。计算规则:成交价*商务分成比例 |
|
|
|
|
sPrice = row.finalPrice * row.businessProportion / 100 |
|
|
|
|
} |
|
|
|
|
row.settlementPrice = this.handleNaN(sPrice) |
|
|
|
|
}, |
|
|
|
|
// 使用期限转换以及计算剩余天数 |
|
|
|
|
deadLine(e,row,options, isDate) { |
|
|
|
|
debugger |
|
|
|
|
let optionsData = '' |
|
|
|
|
if(e > 0){ |
|
|
|
|
if (options == 1){ |
|
|
|
@ -1399,10 +1427,10 @@ export default { |
|
|
|
|
let endYear = timestamp - time |
|
|
|
|
let endYears = endYear/1000/60/60/24 |
|
|
|
|
row.remainingPeriod = endYears |
|
|
|
|
const unit = row.options // 使用期限单位 |
|
|
|
|
const useUnit = row.periodOfUse // 使用期限 |
|
|
|
|
// 计算市场价(课程才需要) |
|
|
|
|
if (row.authority) { |
|
|
|
|
const unit = row.options // 使用期限单位 |
|
|
|
|
const useUnit = row.periodOfUse // 使用期限 |
|
|
|
|
const price = row.marketPrice // 市场单价 |
|
|
|
|
// 结算单价是元/年,所以如果选择的不是年,要进行换算(日:/365,月:/12) |
|
|
|
|
row.marketValue = (!unit ? |
|
|
|
@ -1411,6 +1439,7 @@ export default { |
|
|
|
|
price / 12 * useUnit : |
|
|
|
|
price * useUnit).toFixed(2) |
|
|
|
|
} |
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
// 只有改变了起止日期才需要调接口查询订单,该接口作用是把开始时间传过去,会返回一个提示或者时间,如果是时间,则把时间+1天,如果是提示,则无法保存 |
|
|
|
|
if (isDate) { |
|
|
|
|
const cId = row.dataOrCourseId |
|
|
|
|