更新
This commit is contained in:
@@ -44,27 +44,38 @@
|
||||
<h4 class="title">订单变更信息</h4>
|
||||
<el-divider></el-divider>
|
||||
<p class="tip">因炼厂单价发生变化,请重新选择策略</p>
|
||||
<el-table :data="tableData" border style="width: 70%">
|
||||
<el-table-column prop="date" label="" width="70px">
|
||||
<el-table :data="tableData" border style="width: 75%">
|
||||
<el-table-column prop="date" label="" width="55px">
|
||||
<template slot-scope="{ $index, row }">
|
||||
<el-checkbox v-model="row.isChecked" @change="val => selectPolicy($index, val)"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="策略类型"> </el-table-column>
|
||||
<el-table-column label="订单提货量">
|
||||
<template slot-scope="{ row }"> {{ row.preQuantity | toNumberFixed }}{{ controlWindows.addInfo.productMeasurement }} </template>
|
||||
<el-table-column label="订单提货量" width="145px">
|
||||
<template slot-scope="{ row }">
|
||||
<el-input
|
||||
v-checkNum
|
||||
v-if="row.type === '自定义提货量'"
|
||||
v-model="row.preQuantity"
|
||||
placeholder="提货数量"
|
||||
@change="val => changePreQuantity(row, val)"
|
||||
>
|
||||
<template slot="append">{{ controlWindows.addInfo.productMeasurement }}</template>
|
||||
</el-input>
|
||||
<p v-else>{{ row.preQuantity }}{{ controlWindows.addInfo.productMeasurement }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销售价格">
|
||||
<template slot-scope="{ row }"> {{ row.salePrice }}元 </template>
|
||||
<template slot-scope="{ row }"> {{ row.salePrice }} 元 </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="销售总金额">
|
||||
<template slot-scope="{ row }"> {{ row.preAmount | toNumberFixed }}元 </template>
|
||||
<template slot-scope="{ row }"> {{ row.preAmount }} 元 </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成本价格">
|
||||
<template slot-scope="{ row }"> {{ row.floorPrice }}元 </template>
|
||||
<template slot-scope="{ row }"> {{ row.floorPrice }} 元 </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成本总金额">
|
||||
<template slot-scope="{ row }"> {{ row.preCostAmount | toNumberFixed }}元 </template>
|
||||
<template slot-scope="{ row }"> {{ row.preCostAmount }} 元 </template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
@@ -91,23 +102,30 @@ export default {
|
||||
{
|
||||
isChecked: false,
|
||||
type: '原策略',
|
||||
salePrice: 100,
|
||||
preQuantity: 100,
|
||||
preAmount: 10000
|
||||
salePrice: '',
|
||||
preQuantity: '',
|
||||
preAmount: ''
|
||||
},
|
||||
{
|
||||
isChecked: false,
|
||||
type: '以提货量为准',
|
||||
salePrice: 100,
|
||||
preQuantity: 100,
|
||||
preAmount: 10000
|
||||
salePrice: '',
|
||||
preQuantity: '',
|
||||
preAmount: ''
|
||||
},
|
||||
// {
|
||||
// isChecked: false,
|
||||
// type: '以订单金额为准',
|
||||
// salePrice: '',
|
||||
// preQuantity: '',
|
||||
// preAmount: ''
|
||||
// },
|
||||
{
|
||||
isChecked: false,
|
||||
type: '以订单金额为准',
|
||||
salePrice: 100,
|
||||
preQuantity: 100,
|
||||
preAmount: 10000
|
||||
type: '自定义提货量',
|
||||
salePrice: '',
|
||||
preQuantity: '',
|
||||
preAmount: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -117,7 +135,7 @@ export default {
|
||||
if (val) {
|
||||
return Number(val).toFixed(2)
|
||||
} else {
|
||||
return '--'
|
||||
return '- -'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -137,6 +155,17 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
changePreQuantity(row, val) {
|
||||
let segment = val.match(/.?\d{0,2}/g)
|
||||
row.preQuantity = parseFloat(segment[0] + segment[1])
|
||||
if (isNaN(row.preQuantity)) {
|
||||
this.$message.error('数量输入错误,请重新输入')
|
||||
return
|
||||
}
|
||||
let { salePrice, floorPrice } = row
|
||||
row.preAmount = this.fixedHandle(salePrice * row.preQuantity)
|
||||
row.preCostAmount = this.fixedHandle(floorPrice * row.preQuantity)
|
||||
},
|
||||
selectPolicy(index, val) {
|
||||
if (val) {
|
||||
this.tableData.map(item => (item.isChecked = false))
|
||||
@@ -164,25 +193,42 @@ export default {
|
||||
preCostAmount: _floorPrice * preQuantity
|
||||
}
|
||||
},
|
||||
// 以订单金额为准
|
||||
// // 以订单金额为准
|
||||
// () => {
|
||||
// let _salePrice = this.newSalePrice
|
||||
// let _floorPrice = this.newCostPrice
|
||||
// return {
|
||||
// salePrice: _salePrice,
|
||||
// floorPrice: _floorPrice,
|
||||
// preQuantity: preAmount / _salePrice,
|
||||
// preAmount,
|
||||
// preCostAmount: _floorPrice * this.fixedHandle(preAmount / _salePrice)
|
||||
// }
|
||||
// },
|
||||
// 自定义数量
|
||||
() => {
|
||||
let _salePrice = this.newSalePrice
|
||||
let _floorPrice = this.newCostPrice
|
||||
return {
|
||||
salePrice: _salePrice,
|
||||
floorPrice: _floorPrice,
|
||||
preQuantity: preAmount / _salePrice,
|
||||
preAmount,
|
||||
preCostAmount: _floorPrice * this.fixedHandle(preAmount / _salePrice)
|
||||
preQuantity: '',
|
||||
preAmount: '',
|
||||
preCostAmount: ''
|
||||
}
|
||||
}
|
||||
]
|
||||
strategyArr.forEach((item, index) => {
|
||||
let originData = this.tableData[index]
|
||||
let data = item()
|
||||
if (originData.type === '自定义提货量') {
|
||||
Object.assign(originData, data)
|
||||
return
|
||||
}
|
||||
for (let key in data) {
|
||||
data[key] = this.fixedHandle(data[key])
|
||||
}
|
||||
Object.assign(this.tableData[index], data)
|
||||
Object.assign(originData, data)
|
||||
})
|
||||
|
||||
this.undergoChanges = true
|
||||
@@ -209,6 +255,11 @@ export default {
|
||||
this.$message.warning('炼厂单价发生变化,请选择变更策略')
|
||||
return
|
||||
}
|
||||
let target = targetPolicy[0]
|
||||
if (target.type === '自定义提货量' && target.preQuantity <= 0) {
|
||||
this.$message.warning('请输入提货数量')
|
||||
return
|
||||
}
|
||||
serve.orderSuccess({ id: this.controlWindows.addInfo.id, ...targetPolicy[0] }).then(res => {
|
||||
if (res.code == 20000) {
|
||||
this.$message.success(res.msg)
|
||||
@@ -239,11 +290,12 @@ export default {
|
||||
.el-drawer__header {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.el-input-group__append {
|
||||
padding: 0 7px;
|
||||
}
|
||||
}
|
||||
.confirm-submit {
|
||||
padding: 0 30px;
|
||||
.title {
|
||||
}
|
||||
> ul {
|
||||
display: flex;
|
||||
margin: 0 auto 30px;
|
||||
|
||||
Reference in New Issue
Block a user