pull/17/head^2
xiaozhiyong 2 years ago
parent cefb6d1c26
commit a68db2dae3
  1. 78
      src/views/order/components/confirmSubmit.vue

@ -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)

Loading…
Cancel
Save