|
|
|
@ -20,7 +20,7 @@ |
|
|
|
|
</view> |
|
|
|
|
<view class="line req"> |
|
|
|
|
<view class="name">使用期限</view> |
|
|
|
|
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" @change="calcDate(item, !item.authority)"> |
|
|
|
|
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" @input="calcDate(item, !item.authority)"> |
|
|
|
|
<view class="val unit" @click="showUnit(i)"> |
|
|
|
|
<text>{{ units.find(e => e.value === item.options).text }}</text> |
|
|
|
|
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image> |
|
|
|
@ -40,7 +40,7 @@ |
|
|
|
|
<view class="line req"> |
|
|
|
|
<view class="name">数量</view> |
|
|
|
|
<view v-if="item.authority" class="val">1</view> |
|
|
|
|
<input v-else type="number" v-model="item.accountNum" placeholder="请输入" @change="calcFinalPrice(item)"> |
|
|
|
|
<input v-else type="number" v-model="item.accountNum" placeholder="请输入" @input="calcFinalPrice(item)"> |
|
|
|
|
</view> |
|
|
|
|
<view class="line"> |
|
|
|
|
<view class="name">{{ item.authority ? '市场价' : '市场单价' }}</view> |
|
|
|
@ -61,7 +61,7 @@ |
|
|
|
|
<view class="line req"> |
|
|
|
|
<view class="name">成交价</view> |
|
|
|
|
<view class="inline"> |
|
|
|
|
<input type="number" v-model="item.finalPrice" placeholder="请输入" @change="calcFinalValue(item)"> |
|
|
|
|
<input type="number" v-model="item.finalPrice" placeholder="请输入" @input="calcFinalValue(item)"> |
|
|
|
|
元 |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -82,6 +82,7 @@ |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
customerId: '', |
|
|
|
|
timer: null, |
|
|
|
|
units: [{ |
|
|
|
|
text: '日', |
|
|
|
|
value: 0 |
|
|
|
@ -154,7 +155,6 @@ |
|
|
|
|
} catch (e) {} |
|
|
|
|
}, |
|
|
|
|
showUnit(i) { |
|
|
|
|
console.log(333, this.$refs, this.$refs.unit[i].show) |
|
|
|
|
this.$refs.unit[i].show() |
|
|
|
|
}, |
|
|
|
|
// 收缩产品 |
|
|
|
@ -173,6 +173,8 @@ |
|
|
|
|
}, |
|
|
|
|
// 使用期限转换以及计算剩余天数 |
|
|
|
|
calcDate(row, fromData) { |
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
this.timer = setTimeout(() => { |
|
|
|
|
const { periodOfUse, options } = row |
|
|
|
|
let optionsData = 0 |
|
|
|
|
if (periodOfUse) { |
|
|
|
@ -227,9 +229,13 @@ |
|
|
|
|
} |
|
|
|
|
// 折扣率 |
|
|
|
|
this.calcDiscount(row) |
|
|
|
|
}, 500) |
|
|
|
|
}, |
|
|
|
|
// 计算结算价及平台服务费 |
|
|
|
|
dealSettlePrice(row) { |
|
|
|
|
console.log(33, row) |
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
this.timer = setTimeout(() => { |
|
|
|
|
const unit = row.options // 使用期限单位 |
|
|
|
|
const useUnit = row.periodOfUse // 使用期限 |
|
|
|
|
let sPrice = '' |
|
|
|
@ -252,25 +258,36 @@ |
|
|
|
|
if (row.settlementPrice) { |
|
|
|
|
row.serviceFee = (row.settlementPrice * 0.1).toFixed(2) |
|
|
|
|
} |
|
|
|
|
}, 500) |
|
|
|
|
}, |
|
|
|
|
// 计算折扣率 |
|
|
|
|
calcDiscount(row) { |
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
this.timer = setTimeout(() => { |
|
|
|
|
const price = row.authority ? row.finalPrice : row.finalValue |
|
|
|
|
const { marketValue } = row |
|
|
|
|
console.log(66, row) |
|
|
|
|
// (原价-现价)÷原价 x100% |
|
|
|
|
if (price) row.discountRate = marketValue != 0 ? ((marketValue - price) / marketValue * 100).toFixed(2) + '%' : '0%' |
|
|
|
|
}, 500) |
|
|
|
|
}, |
|
|
|
|
// 成交价修改后,计算成交单价,数据才需要 计算规则:成交价/账号数/时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
|
|
|
|
calcFinalValue(row) { |
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
this.timer = setTimeout(() => { |
|
|
|
|
const { authority, periodOfUse, options, accountNum, finalPrice } = row |
|
|
|
|
if (!authority && periodOfUse && accountNum && finalPrice) { |
|
|
|
|
row.finalValue = (finalPrice / accountNum / periodOfUse).toFixed(2) |
|
|
|
|
} |
|
|
|
|
// 折扣率 |
|
|
|
|
this.calcDiscount(row) |
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
}, 500) |
|
|
|
|
}, |
|
|
|
|
// 计算成交价。计算规则:成交单价*账号数*时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
|
|
|
|
calcFinalPrice(row) { |
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
this.timer = setTimeout(() => { |
|
|
|
|
const { finalValue, accountNum, periodOfUse, finalPrice } = row |
|
|
|
|
if (periodOfUse) { |
|
|
|
|
if (accountNum) { |
|
|
|
@ -288,6 +305,7 @@ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
}, 500) |
|
|
|
|
}, |
|
|
|
|
// 确定 |
|
|
|
|
submit() { |
|
|
|
|