|
|
|
@ -174,12 +174,11 @@ |
|
|
|
|
<el-table-column label="市场价" align="center" min-width="170"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input class="normal" disabled v-model="scope.row.marketValue" placeholder="" |
|
|
|
|
type="text"></el-input> |
|
|
|
|
<el-input class="normal" disabled v-model="scope.row.marketValue" type="text"></el-input> 元 |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="折扣率 " align="center" min-width="100"> |
|
|
|
|
<el-table-column label="折扣率 " align="center" min-width="110"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input class="normal" disabled v-model="scope.row.discountRate" placeholder="" |
|
|
|
|
type="text" size="small" style="width: 100%"></el-input> |
|
|
|
@ -193,7 +192,7 @@ |
|
|
|
|
@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> |
|
|
|
|
type="text"></el-input> 元 |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -204,7 +203,7 @@ |
|
|
|
|
: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> |
|
|
|
|
type="text"></el-input> 元 |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -222,18 +221,25 @@ |
|
|
|
|
@click="delCourseForm(scope.$index)" |
|
|
|
|
style="margin-right:10px;" |
|
|
|
|
>删除</el-button> |
|
|
|
|
<!-- 1: 未生效,2:生效中,3:已过期 --> |
|
|
|
|
<!-- |
|
|
|
|
1、查看时不可操作 |
|
|
|
|
2、发货和启用不要同时出现,生效前只会显示发货不发货按钮,生效后只显示禁启用按钮 |
|
|
|
|
3、处理中的订单显示发货,不显示禁用 |
|
|
|
|
--> |
|
|
|
|
<el-switch |
|
|
|
|
v-if="scope.row.status === 1 || dispose || isAdd" |
|
|
|
|
style="margin-right:10px;" |
|
|
|
|
v-if='dispose || (!editDisabled&&!viewDisabled)' |
|
|
|
|
v-model="scope.row.ship" |
|
|
|
|
:active-value="1" |
|
|
|
|
:inactive-value="0" |
|
|
|
|
:active-text="scope.row.ship ? '已发货' : '未发货'" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
@change="handleDeliver($event,scope.row)"> |
|
|
|
|
</el-switch> |
|
|
|
|
<el-switch |
|
|
|
|
v-show="scope.row.ship && editDisabled && !dispose" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
v-if="!dispose && (scope.row.status === 2 || scope.row.status === 3)" |
|
|
|
|
:disabled="viewDisabled || scope.row.status === 3" |
|
|
|
|
v-model="scope.row.isEnable" |
|
|
|
|
:active-value="1" |
|
|
|
|
:inactive-value="0" |
|
|
|
@ -362,26 +368,26 @@ |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<!-- 金额自动计算,计算方式:账号数*成交价,且可以手动修改,保留两位小数 --> |
|
|
|
|
<el-table-column label="成交价" align="center" min-width="180"> |
|
|
|
|
<el-table-column label="成交价" align="center" min-width="160"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input :class="['normal', scope.row.finalPrice === '' && whetherSubmit?'red':'']" |
|
|
|
|
<el-input style="width: 80%" :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> |
|
|
|
|
type="text"></el-input> 元 |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="结算价" align="center" min-width="130"> |
|
|
|
|
<el-table-column label="结算价" align="center" min-width="160"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input :class="['normal', scope.row.settlementPrice === '' && whetherSubmit?'red':'']" |
|
|
|
|
<el-input style="width: 80%" :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> |
|
|
|
|
type="text"></el-input> 元 |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -395,8 +401,8 @@ |
|
|
|
|
style="margin-right:10px;" |
|
|
|
|
>删除</el-button> |
|
|
|
|
<el-switch |
|
|
|
|
v-if="scope.row.status === 1 || dispose || isAdd" |
|
|
|
|
style="margin-right:10px;" |
|
|
|
|
v-if='dispose || (!editDisabled&&!viewDisabled)' |
|
|
|
|
v-model="scope.row.ship" |
|
|
|
|
:active-value="1" |
|
|
|
|
:inactive-value="0" |
|
|
|
@ -404,7 +410,7 @@ |
|
|
|
|
@change="handleDeliver($event,scope.row)"> |
|
|
|
|
</el-switch> |
|
|
|
|
<el-switch |
|
|
|
|
v-show="scope.row.ship && editDisabled && !dispose" |
|
|
|
|
v-if="!dispose && (scope.row.status === 2 || scope.row.status === 3)" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
v-model="scope.row.isEnable" |
|
|
|
|
:active-value="1" |
|
|
|
@ -883,6 +889,7 @@ export default { |
|
|
|
|
const promises = [] |
|
|
|
|
const { customerId } = form |
|
|
|
|
const list = [] |
|
|
|
|
// 课程和数据的分别调接口查询 |
|
|
|
|
if (orderOther.find(e => e.authority)) { |
|
|
|
|
promises.push(new Promise((resolve, reject) => { |
|
|
|
|
this.$post(this.api.renew, { |
|
|
|
@ -913,14 +920,13 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
setStartDate(renewList, orderOther) { |
|
|
|
|
console.log(555) |
|
|
|
|
let list = orderOther.map(e => { |
|
|
|
|
const now = Date.now() |
|
|
|
|
const item = renewList.find(n => n.dataOrCourseId === e.dataOrCourseId && n.authority === e.authority) // 匹配renew接口返回的数据 |
|
|
|
|
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)) |
|
|
|
@ -936,6 +942,15 @@ export default { |
|
|
|
|
e.endTime = item.endTime.split(" ")[0]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const startTime = new Date(e.startTime) |
|
|
|
|
const endTime = new Date(e.endTime) |
|
|
|
|
// 1: 未生效,2:生效中,3:已过期 |
|
|
|
|
e.status = now < startTime ? |
|
|
|
|
1 : |
|
|
|
|
now > startTime && now < endTime ? |
|
|
|
|
2 : |
|
|
|
|
3 |
|
|
|
|
if (e.status === 3) e.isEnable = 0 // 已过期的,变成禁用状态,且不能启用 |
|
|
|
|
return e; |
|
|
|
|
});// 俩列表 |
|
|
|
|
|
|
|
|
@ -1126,7 +1141,7 @@ export default { |
|
|
|
|
ship: 0,// 发货否(0未发货,1已发货,默认不发货) |
|
|
|
|
authority: 1, // 区分权限 0为数据平台权限,1为课程权限 |
|
|
|
|
options: 1, |
|
|
|
|
settlementPrice: '', // 结算价 |
|
|
|
|
settlementPrice: orderType === 2 ? 0 : '', // 结算价 |
|
|
|
|
settlementMethod: e.settlementMethod, // 结算方式,0为单价,1为分成 |
|
|
|
|
settlementPriceUnit: e.settlementPrice, // 结算单价 |
|
|
|
|
businessProportion: e.businessProportion, // 商务占比 |
|
|
|
@ -1234,10 +1249,10 @@ export default { |
|
|
|
|
startTime: new Date(),// 开始 |
|
|
|
|
endTime: "", // 终止 |
|
|
|
|
remainingPeriod: "",// 剩余期限 |
|
|
|
|
marketValue: e.market, // 市场价 |
|
|
|
|
marketValue: e.market, // 市场单价 |
|
|
|
|
finalPrice: '',// 成交价 |
|
|
|
|
finalValue: '', // 成交单价 |
|
|
|
|
marketValue: '', // 市场单价(订单里需要保存的) |
|
|
|
|
marketPrice: e.market, // 原始市场单价(产品里添加的) |
|
|
|
|
finalPrice: orderType === 2 ? 0 : '',// 成交价 |
|
|
|
|
finalValue: orderType === 2 ? 0 : '', // 成交单价 |
|
|
|
|
discountRate: "",// 折扣率 |
|
|
|
|
accountNum: "",// 账号数 |
|
|
|
|
totalAmount: orderType === 2 ? 0 : '',// 总价 |
|
|
|
@ -1245,7 +1260,7 @@ export default { |
|
|
|
|
ship: 0,// 发货否(0未发货,1已发货,默认不发货) |
|
|
|
|
authority: 0,// 数据平台权限 |
|
|
|
|
options:1, |
|
|
|
|
settlementPrice: '', // 结算价 |
|
|
|
|
settlementPrice: orderType === 2 ? 0 : '', // 结算价 |
|
|
|
|
settlementMethod: e.settlementMethod, // 结算方式,0为单价,1为分成 |
|
|
|
|
settlementPriceUnit: e.settlementPrice, // 结算单价 |
|
|
|
|
businessProportion: e.businessProportion, // 商务占比 |
|
|
|
@ -1357,18 +1372,16 @@ export default { |
|
|
|
|
options === 1 ? |
|
|
|
|
12 : |
|
|
|
|
1)).toFixed(2) |
|
|
|
|
this.calculateDiscount(val, row) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 计算成交价。计算规则:成交单价*账号数*时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
|
|
|
|
dealComputers(e, row) { |
|
|
|
|
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) |
|
|
|
|
row.finalPrice = Math.round(finalValue * periodOfUse * accountNum) |
|
|
|
|
} |
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
this.allAmount(e, row) |
|
|
|
|
}, |
|
|
|
|
// 计算结算价 |
|
|
|
@ -1376,7 +1389,7 @@ export default { |
|
|
|
|
const unit = row.options // 使用期限单位 |
|
|
|
|
const useUnit = row.periodOfUse // 使用期限 |
|
|
|
|
let sPrice = '' |
|
|
|
|
if (row.settlementMethod === '0') { |
|
|
|
|
if (row.settlementMethod == 0) { |
|
|
|
|
// 结算单价。计算规则:结算单价(**元/年)*购买时长(单位年)*数量(课程为1,数据为账号数量)(单位是万) |
|
|
|
|
const priceUnit = row.settlementPriceUnit |
|
|
|
|
sPrice = ((!unit ? |
|
|
|
@ -1388,7 +1401,7 @@ export default { |
|
|
|
|
row.accountNum)).toFixed(2) |
|
|
|
|
} else { |
|
|
|
|
// 比例分成。计算规则:成交价*商务分成比例(单位是万) |
|
|
|
|
sPrice = row.finalPrice * row.businessProportion / 100 |
|
|
|
|
sPrice = (row.finalPrice * row.businessProportion / 100).toFixed(2) |
|
|
|
|
} |
|
|
|
|
row.settlementPrice = this.handleNaN(sPrice) |
|
|
|
|
}, |
|
|
|
@ -1417,17 +1430,15 @@ export default { |
|
|
|
|
row.remainingPeriod = endYears |
|
|
|
|
const unit = row.options // 使用期限单位 |
|
|
|
|
const useUnit = row.periodOfUse // 使用期限 |
|
|
|
|
// 计算市场价(课程才需要) |
|
|
|
|
if (row.authority) { |
|
|
|
|
const price = row.marketPrice // 市场单价 |
|
|
|
|
let price = row.marketPrice // 市场单价 |
|
|
|
|
// 结算单价是元/年,所以如果选择的不是年,要进行换算(日:/365,月:/12) |
|
|
|
|
row.marketValue = ((!unit ? |
|
|
|
|
price / 365 * useUnit : |
|
|
|
|
unit === 1 ? |
|
|
|
|
price / 12 * useUnit : |
|
|
|
|
price * useUnit)).toFixed(2) |
|
|
|
|
} |
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
|
|
|
|
|
this.dealComputers(e, row) |
|
|
|
|
// 只有改变了起止日期才需要调接口查询订单,该接口作用是把开始时间传过去,会返回一个提示或者时间,如果是时间,则把时间+1天,如果是提示,则无法保存 |
|
|
|
|
if (isDate) { |
|
|
|
|
const cId = row.dataOrCourseId |
|
|
|
|