|
@@ -156,9 +156,13 @@
|
|
|
元
|
|
|
</el-form-item>
|
|
|
<el-form-item label="售卖价格" prop="saleAmount">
|
|
|
- <el-input-number v-model="formPrice.saleAmount" controls-position="right" :min="0"></el-input-number>
|
|
|
+ <el-input-number v-model="formPrice.saleAmount" controls-position="right" @change="handleChange" :min="0"></el-input-number>
|
|
|
元
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="比例" prop="discount">
|
|
|
+ <el-input-number v-model="formPrice.discount" controls-position="right" @blur="blurChange" :min="0" :max="100"></el-input-number>
|
|
|
+ %
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="结算价" prop="costAmount">
|
|
|
<el-input-number v-model="formPrice.costAmount" controls-position="right" :min="0"></el-input-number>
|
|
|
元
|
|
@@ -230,6 +234,28 @@ export default {
|
|
|
this.getCityListFun()
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 输入比例计算结算价
|
|
|
+ blurChange() {
|
|
|
+ if(this.formPrice.saleAmount && this.formPrice.discount) {
|
|
|
+ let costPrice = this.formPrice.saleAmount * this.formPrice.discount / 100
|
|
|
+ this.formPrice.costAmount = costPrice.toFixed(2)
|
|
|
+ } else {
|
|
|
+ this.$set(this.formPrice, 'costAmount', null)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //销售价改变 计算结算价格
|
|
|
+ handleChange(newVal, oldVal) {
|
|
|
+ if(newVal != oldVal) {
|
|
|
+ this.$set(this.formPrice, 'costAmount', null)
|
|
|
+ // this.$set(this.formPrice,'discount',null)
|
|
|
+ if(this.formPrice.discount) {
|
|
|
+ let costPrice = this.formPrice.saleAmount * this.formPrice.discount / 100
|
|
|
+ this.formPrice.costAmount = costPrice.toFixed(2)
|
|
|
+ } else {
|
|
|
+ this.$set(this.formPrice,'costAmount',null)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 打开弹框
|
|
|
* @date 2023-11-22
|