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