diff --git a/src/views/order/components/confirmSubmit.vue b/src/views/order/components/confirmSubmit.vue index e27fe78..671d0a4 100644 --- a/src/views/order/components/confirmSubmit.vue +++ b/src/views/order/components/confirmSubmit.vue @@ -44,27 +44,38 @@

订单变更信息

因炼厂单价发生变化,请重新选择策略

- - + + - - + + - + - + - + - + @@ -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;