修改称重商品提交时只保留两位小数

This commit is contained in:
YeMingfei666 2024-12-05 09:05:40 +08:00
parent dbf34179e9
commit 8c16d95ead
1 changed files with 3 additions and 25 deletions

View File

@ -62,23 +62,6 @@ export default {
}, },
watch: { watch: {
number(newval) { number(newval) {
//
// if (newval == '.' || newval == '0.') {
// this.number = newval;
// } else {
if (newval * 1 > this.payMoney * 1) {
this.number = this.payMoney;
this.number = newval;
}
if (newval * 1 > this.payMoney * 1) {
this.tips = "已超出未结账金额";
} else {
const shengyu = this.payMoney - this.number;
this.tips =
shengyu > 0 ? "还需额外支付" + shengyu.toFixed(2) + "元" : "";
}
// }
}, },
}, },
computed:{ computed:{
@ -100,15 +83,10 @@ export default {
this.focus = false; this.focus = false;
}, },
inputNumber(e) { inputNumber(e) {
console.log("inputNumber"); console.log(e);
if (e * 1 > this.payMoney * 1) {
this.tips = "已超出未结账金额";
}
}, },
inputChange(e) { inputChange(e) {
if (e * 1 > this.payMoney * 1) {
this.tips = "已超出未结账金额";
}
console.log(e); console.log(e);
}, },
clear(e) { clear(e) {
@ -120,7 +98,7 @@ export default {
if(this.number*1<=0){ if(this.number*1<=0){
return this.$message("请输入重量"); return this.$message("请输入重量");
} }
this.$emit("confirm", this.item, this.number); this.$emit("confirm", this.item, (this.number*1).toFixed(2));
this.close(); this.close();
}, },
open(item) { open(item) {