| | |
| | | <el-form-item label="优惠"> |
| | | <!-- {{ discount }} --> |
| | | <el-input-number ref="inputNumber" style="width: 150px" v-model="discount" :precision="1" :step="0.1" |
| | | :max="10" :min="0" @change="numberChange" :disabled="isfalse"></el-input-number> |
| | | :max="10" :min="0" @change="debounceNumberChange" :disabled="isfalse"></el-input-number> |
| | | </el-form-item> |
| | | <el-form-item label="实收金额"> |
| | | <el-input placeholder="实收金额" v-model="TotalPrice" style="width: 206px"></el-input> |
| | | <el-input placeholder="实收金额" v-model="TotalPrice" style="width: 206px" |
| | | @input="changeXianjia" @blur="numberChangeXianPrice(discount, discount)"/> |
| | | </el-form-item> |
| | | <br /> |
| | | |
| | |
| | | </el-form-item> |
| | | <el-form-item label="优惠"> |
| | | <el-input-number style="width: 140px" v-model="discount" :precision="1" :step="0.1" :max="10" :min="0" |
| | | @change="numberChange" :disabled="isfalse"></el-input-number> |
| | | @change="debounceNumberChange" :disabled="isfalse"></el-input-number> |
| | | </el-form-item> |
| | | <el-form-item label="实收金额"> |
| | | <el-input v-model="formInline.paidIn" placeholder="实付" style="width: 94px"> |
| | |
| | | mounted() { }, |
| | | |
| | | methods: { |
| | | debounceNumberChange(currentValue, oldValue) { |
| | | clearTimeout(this.debounceTimer); |
| | | this.debounceTimer = setTimeout(() => { |
| | | this.numberChange(currentValue, oldValue); |
| | | }, 300); |
| | | }, |
| | | changeXianjia() { |
| | | // 原始折扣率计算 |
| | | if (this.TotalPrice1 !== 0) { |
| | | this.discount = |
| | | (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10; |
| | | } |
| | | |
| | | }, |
| | | clear() { |
| | | this.form.firmId = ""; |
| | | }, |
| | |
| | | this.discount = oldValue; |
| | | }); |
| | | }, |
| | | |
| | | numberChangeXianPrice(currentValue, oldValue) { |
| | | this.$confirm("确定修改所有子项的折扣吗?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | this.discount = currentValue; |
| | | if (this.discount < this.getInfodis) { |
| | | this.discount = this.getInfodis; |
| | | } |
| | | let totalYsprice = new Big(0) |
| | | this.tableData1.forEach((item) => { |
| | | item.discount = this.discount; |
| | | const ordPrice = new Big(item.ordPrice); |
| | | const discount = new Big(item.discount); |
| | | const result = ordPrice.times(discount.div(10)) |
| | | item.nowPrice = result.toNumber(); |
| | | totalYsprice = totalYsprice.plus(new Big(item.nowPrice)); |
| | | }) |
| | | if (!totalYsprice.eq(this.TotalPrice)) { |
| | | const diff = new Big(this.TotalPrice).minus(totalYsprice); |
| | | if (this.tableData1.length > 0) { |
| | | const lastItem = this.tableData1[this.tableData1.length - 1] |
| | | const newYsPrice = new Big(lastItem.nowPrice).plus(diff).toNumber() |
| | | console.log("hhh", this.tableData1[this.tableData1.length - 1].nowPrice,newYsPrice) |
| | | this.$set(this.tableData1[this.tableData1.length - 1], 'nowPrice', newYsPrice) |
| | | } |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | this.discount = oldValue; |
| | | }); |
| | | }, |
| | | /** 登记提交按钮 */ |
| | | submitForm() { |
| | | let _this = this; |