更新
This commit is contained in:
@@ -64,7 +64,7 @@
|
|||||||
<template slot-scope="{ row }"> {{ row.floorPrice }}元 </template>
|
<template slot-scope="{ row }"> {{ row.floorPrice }}元 </template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="成本总金额">
|
<el-table-column label="成本总金额">
|
||||||
<template slot-scope="{ row }"> {{ row.floorPrice * row.preQuantity | toNumberFixed }}元 </template>
|
<template slot-scope="{ row }"> {{ (row.floorPrice * row.preQuantity) | toNumberFixed }}元 </template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</template>
|
</template>
|
||||||
@@ -126,7 +126,7 @@ export default {
|
|||||||
let { productId, salePrice, floorPrice } = this.controlWindows.addInfo
|
let { productId, salePrice, floorPrice } = this.controlWindows.addInfo
|
||||||
if (productId) {
|
if (productId) {
|
||||||
serve.getRefineryProduct(productId).then(res => {
|
serve.getRefineryProduct(productId).then(res => {
|
||||||
let data = res.data;
|
let data = res.data
|
||||||
if (data.salePrice2company != salePrice || data.floorPrice != floorPrice) {
|
if (data.salePrice2company != salePrice || data.floorPrice != floorPrice) {
|
||||||
console.log('价格发生变化了捏')
|
console.log('价格发生变化了捏')
|
||||||
// 新的价格
|
// 新的价格
|
||||||
@@ -147,29 +147,65 @@ export default {
|
|||||||
policyPopulation() {
|
policyPopulation() {
|
||||||
let { salePrice, floorPrice, preQuantity, preAmount } = this.controlWindows.addInfo
|
let { salePrice, floorPrice, preQuantity, preAmount } = this.controlWindows.addInfo
|
||||||
// console.log(salePrice, preQuantity, preAmount)
|
// console.log(salePrice, preQuantity, preAmount)
|
||||||
if ((salePrice, preQuantity, preAmount)) {
|
if (salePrice && floorPrice && preQuantity && preAmount) {
|
||||||
// 原策略
|
let strategyArr = [
|
||||||
Object.assign(this.tableData[0], { salePrice: salePrice.toFixed(2),
|
// 原策略
|
||||||
floorPrice: floorPrice.toFixed(2),
|
{ salePrice: salePrice, floorPrice: floorPrice, preQuantity: preQuantity, preAmount: preAmount },
|
||||||
preQuantity: preQuantity.toFixed(2),
|
// 以提货量为准
|
||||||
preAmount: preAmount.toFixed(2) })
|
{
|
||||||
// 以提货量为准
|
salePrice: this.newSalePrice,
|
||||||
Object.assign(this.tableData[1], {
|
floorPrice: this.newCostPrice,
|
||||||
salePrice: (this.newSalePrice).toFixed(2),
|
preQuantity: preQuantity,
|
||||||
floorPrice: (this.newCostPrice).toFixed(2),
|
preAmount: +this.newSalePrice * +preQuantity
|
||||||
preQuantity: preQuantity.toFixed(2),
|
},
|
||||||
preAmount: (+this.newSalePrice * +preQuantity).toFixed(2)
|
// 以订单金额为准
|
||||||
})
|
{
|
||||||
// 以订单金额为准
|
salePrice: this.newSalePrice,
|
||||||
Object.assign(this.tableData[2], {
|
floorPrice: this.newCostPrice,
|
||||||
salePrice: (this.newSalePrice).toFixed(2),
|
preQuantity: +preAmount / +this.newSalePrice,
|
||||||
floorPrice: (this.newCostPrice).toFixed(2),
|
preAmount: preAmount
|
||||||
preQuantity: (+preAmount / +this.newSalePrice).toFixed(2),
|
}
|
||||||
preAmount: preAmount.toFixed(2)
|
]
|
||||||
|
strategyArr.forEach((item, index) => {
|
||||||
|
for (let key in item) {
|
||||||
|
item[key] = this.fixedHandle(item[key])
|
||||||
|
}
|
||||||
|
Object.assign(this.tableData[index], item)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// // 原策略
|
||||||
|
// Object.assign(this.tableData[0], { salePrice: salePrice, floorPrice: floorPrice, preQuantity: preQuantity, preAmount: preAmount })
|
||||||
|
// // 以提货量为准
|
||||||
|
// Object.assign(this.tableData[1], {
|
||||||
|
// salePrice: this.newSalePrice,
|
||||||
|
// floorPrice: this.newCostPrice,
|
||||||
|
// preQuantity: preQuantity,
|
||||||
|
// preAmount: +this.newSalePrice * +preQuantity
|
||||||
|
// })
|
||||||
|
// // 以订单金额为准
|
||||||
|
// Object.assign(this.tableData[2], {
|
||||||
|
// salePrice: this.newSalePrice,
|
||||||
|
// floorPrice: this.newCostPrice,
|
||||||
|
// preQuantity: +preAmount / +this.newSalePrice,
|
||||||
|
// preAmount: preAmount
|
||||||
|
// })
|
||||||
this.undergoChanges = true
|
this.undergoChanges = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
fixedHandle(val) {
|
||||||
|
val = parseFloat(val)
|
||||||
|
if (!isNaN(val)) {
|
||||||
|
let fixedLength4 = val.toFixed(4)
|
||||||
|
let length = fixedLength4.length
|
||||||
|
let fixedLength3 = fixedLength4.slice(0, length - 1)
|
||||||
|
fixedLength3 *= 100
|
||||||
|
fixedLength3 = Math.round(fixedLength3)
|
||||||
|
fixedLength3 /= 100
|
||||||
|
let fixedLength2 = fixedLength3.toFixed(2)
|
||||||
|
return fixedLength2
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
},
|
||||||
submit() {
|
submit() {
|
||||||
if (this.undergoChanges) {
|
if (this.undergoChanges) {
|
||||||
let targetPolicy = this.tableData.filter(item => item.isChecked)
|
let targetPolicy = this.tableData.filter(item => item.isChecked)
|
||||||
|
|||||||
Reference in New Issue
Block a user