代客下单新增称重商品

This commit is contained in:
2024-12-03 15:03:05 +08:00
parent 01a5c81235
commit bfe0529036
2 changed files with 45 additions and 38 deletions

View File

@@ -8,13 +8,13 @@
<div class="">
<div>单价</div>
<div class="u-m-t-10">
<el-tag type="primary" size="medium">{{ item.lowPrice }}/{{ item.unitName }}</el-tag>
<el-tag type="primary" size="medium">{{ price }}/{{ item.unitName }}</el-tag>
</div>
</div>
<div>
<div class="u-font-14">重量</div>
<div class="u-m-t-10">
<el-input placeholder="请输入挂账金额" v-model="number" @input="inputNumber" @change="inputChange"
<el-input placeholder="请输入重量" v-model="number" @input="inputNumber" @change="inputChange"
@focus="inputFocus" @blur="inputBlur" :type="focus ? 'number' : 'text'">
<template slot="append">{{ item.unitName }}</template>
</el-input>
@@ -22,7 +22,7 @@
</div>
</div>
</key-board>
<div class="price u-text-left w-full"> {{ item.lowPrice * number }}</div>
<div class="price u-text-left w-full"> {{ allPrice }}</div>
<div class="confirm_btns u-flex u-m-t-20">
<el-button style="width: 100%;" type="primary" size="medium" @click="confirm">确定</el-button>
@@ -30,20 +30,22 @@
</div>
</el-dialog>
<choose-guazhang ref="refChooseGuazhang" @confirm="chooseGuazhangConfirm"></choose-guazhang>
</div>
</template>
<script>
import keyBoard from "./keyboard.vue";
import chooseGuazhang from "./choose-guazhang.vue";
export default {
components: { keyBoard, chooseGuazhang },
components: { keyBoard },
props: {
payMoney: {
type: [Number, String],
default: 0,
},
isShowVipPrice:{
type:Boolean,
default:false
}
},
data() {
return {
@@ -79,6 +81,17 @@ export default {
// }
},
},
computed:{
allPrice(){
return (this.price*this.number).toFixed(2);
},
price(){
if(!this.item){
return 0
}
return this.item.lowPrice;
}
},
methods: {
inputFocus() {
this.focus = true;
@@ -86,13 +99,6 @@ export default {
inputBlur() {
this.focus = false;
},
chooseGuazhangConfirm(e) {
this.guazhangRen = e;
},
guazhangShow() {
this.$refs.refChooseGuazhang.open();
},
inputNumber(e) {
console.log("inputNumber");
if (e * 1 > this.payMoney * 1) {
@@ -108,29 +114,24 @@ export default {
clear(e) {
console.log(e);
this.number = "";
this.item=""
},
confirm() {
// if (this.number * 1 > this.payMoney * 1) {
// return this.$message("已超出未结账金额");
// }
// if (this.number * 1 <= 0) {
// return this.$message("支付金额不正确");
// }
// if (!this.guazhangRen) {
// return this.$message("请选择挂账人");
// }
if(this.number*1<=0){
return this.$message("请输入重量");
}
this.$emit("confirm", this.item, this.number);
this.close();
},
open(item) {
console.log(item);
this.item = item
this.number = this.payMoney * 1;
this.show = true;
this.tips = "还需额外支付" + this.payMoney + "元";
},
close() {
this.show = false;
this.number = "";
this.item=""
},
},
mounted() { },