优化绑定商品耗材负数

This commit is contained in:
duan 2024-07-10 18:30:04 +08:00
parent 74a180cba1
commit c626bca335
1 changed files with 7 additions and 9 deletions

View File

@ -92,7 +92,7 @@
<template v-for="(ele, index) in commodityArr">
<template v-if="ele.names">
<br />
<el-form-item label="商品名称" >
<el-form-item label="商品名称">
{{ ele.names }}
</el-form-item>
<br />
@ -111,7 +111,7 @@
</el-form-item>
<el-form-item label="单位耗材值">
<el-input v-model="ele.surplusStock" type=number placeholder="请输入单位耗材值"
@blur="handleKeyUp($event, ele.surplusStock)"></el-input>
@input="handleKeyUp($event, index)"></el-input>
</el-form-item>
</template>
@ -275,13 +275,11 @@ export default {
.match(/^\d*(\.?\d{0,2})/g)[0] || ''
},
handleKeyUp(value, data) {
console.log(value, data, '体哦傲视1')
// if (value < 0) {
// data = value * -1
// }
// this.ele.surplusStock = this.ele.surplusStock.replace(/[^0-9.]/g, '');
handleKeyUp(value, index) {
console.log(value, index, '体哦傲视1')
if (value < 0) {
this.commodityArr[index].surplusStock = (value * -1)
}
},
selectShop(res) {
this.commodityArr = []