From 20597e952095f7183e9a0e344bb1505420616dc9 Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期六, 11 一月 2025 18:09:01 +0800 Subject: [PATCH] 222 --- src/views/system/comp/index.vue | 39 ++++++++++++++++++++++----------------- 1 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/views/system/comp/index.vue b/src/views/system/comp/index.vue index e835cee..ee61488 100644 --- a/src/views/system/comp/index.vue +++ b/src/views/system/comp/index.vue @@ -170,10 +170,6 @@ <el-form-item label="鍘熶环" prop="price"> <el-input v-model="forms.price" placeholder="璇疯緭鍏ュ師浠�" style="width: 130px" /> </el-form-item> - <!-- <el-form-item label="鎶樻墸" prop="limits"> - <el-input v-model="forms.limits" placeholder="璇疯緭鍏ユ姌鎵�" style="width: 130px" @change="numberChange" /> - </el-form-item> --> - <el-form-item label="浼樻儬浠�" prop="ysPrice"> <el-input v-model="forms.ysPrice" placeholder="璇疯緭鍏ュ簲鏀�" style="width: 120px" /> </el-form-item> @@ -358,7 +354,7 @@ <el-table-column label="鎶樻墸" width="151"> <template slot-scope="scope"> <!-- 鍙緭鍏ョ函鏁板瓧鎶樻墸 --> - <el-input-number v-model.number="scope.row.limits" + <el-input-number v-model.number="scope.row.limits" @input="validateDiscount(scope.row)" placeholder="杈撳叆鎶樻墸" size="small" type="number" :min="0" :step="0.1" :precision="1" :max="20"> </el-input-number> </template> @@ -804,6 +800,26 @@ this.getList(); }, methods: { + validateDiscount(row) { + if (row.limits > 10) { + row.limits = 10; // 寮哄埗灏嗗�艰缃负鏈�澶у�� + } else if (row.limits < 0) { + row.limits = 0; // 寮哄埗灏嗗�艰缃负鏈�灏忓�� + } + this.updateProPrice(row); // 鏇存柊浠锋牸鎴栧叾浠栭�昏緫 + }, + updateProPrice(row) { + console.log('1234') + const proPrice = new Big(row.proPrice); + + const limits = new Big(row.limits); + const result = proPrice.times(limits.div(10)); // ordPrice * (discount / 10) + row.ysPrice = result.toNumber(); + this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => { + return sum.plus(new Big(item.ysPrice || '0')); + }, new Big(0)).toNumber(); + this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10 + }, debounceNumberChange(currentValue, oldValue) { clearTimeout(this.debounceTimer); this.debounceTimer = setTimeout(() => { @@ -819,17 +835,7 @@ } }, - updateProPrice(row) { - const proPrice = new Big(row.proPrice); - - const limits = new Big(row.limits); - const result = proPrice.times(limits.div(10)); // ordPrice * (discount / 10) - row.ysPrice = result.toNumber(); - // this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => { - // return sum.plus(new Big(item.ysPrice || '0')); - // }, new Big(0)).toNumber(); - this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10 - }, + getList() { this.$nextTick(() => { this.$refs.inputName.focus(); @@ -1008,7 +1014,6 @@ const limits = new Big(item.limits); const result = proPrice.times(limits.div(10)); // ordPrice * (discount / 10) item.ysPrice = result.toNumber(); - console.log("numberChange") this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => { return sum.plus(new Big(item.ysPrice || '0')); }, new Big(0)); -- Gitblit v1.8.0