代客下单新增称重商品

This commit is contained in:
YeMingfei666 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() { },

View File

@ -1321,7 +1321,9 @@
<div class="key" @click="keyboradAdd('9')">9</div>
</div>
<div class="key-line">
<div class="key"></div>
<div class="key" @click="keyboradAdd('.')">
<span v-if="selGoods.isSku=='weight'">.</span>
</div>
<div class="key" @click="keyboradAdd('0')">0</div>
<div
class="key"
@ -1502,6 +1504,8 @@
<!-- 称重商品 -->
<popup-weight-goods
:isShowVipPrice="isShowVipPrice"
ref="refWeightGoods"
@confirm="refWeightGoodsConfirm"
>
@ -2361,15 +2365,9 @@ export default {
},
//
async refWeightGoodsConfirm(item,number){
let {masterId} =await this.getMasterId()
let obj = {
num:number *1,
masterId,
productId: this.selGoods.data.id,
}
// console.log(obj,'obj')
// console.log(this.selGoods,'')
this.chooseSkuConfirm()
console.log(item)
console.log(number)
this.goodsClick(item,number,true)
},
//
guazhangPayConfirm(guazhangren, price) {
@ -3299,6 +3297,9 @@ export default {
});
},
keyboradAdd(n) {
if(this.selGoods.isSku!='weight'&&n=='.'){
return
}
if (Number(this.keyborad.number) === 0) {
return (this.keyborad.number = n);
}
@ -3327,9 +3328,13 @@ export default {
},
changeKeyboradShow(show) {
if (show) {
this.selGoods=this.order.list[this.order.selIndex]
this.keyborad.number = `${this.order.list[this.order.selIndex].number}`;
}
this.keyborad.show = show;
if(!show){
this.selGoods=''
}
},
//
// getPrveCart() {
@ -4069,11 +4074,11 @@ export default {
}
},
//
async goodsClick(item) {
async goodsClick(item,number=0, isConfirm=false) {
// if (!this.table) {
// return this.$message.error("");
// }
if(item.type=='weigh'){
if(item.type=='weigh'&&!isConfirm){
return this.refWeightGoodsShow(item)
}
if (item.typeEnum === "sku") {
@ -4107,7 +4112,8 @@ export default {
// tableId: this.table.tableId,
// num: orderGoods.number * 1 + item.specList[0].suit, // 0
// });
orderGoods.number += item.specList[0].suit;
const suit=number||item.specList[0].suit
orderGoods.number +=suit*1 ;
this.order.number = orderGoods.number;
this.changeOrderSel(orderGoodsIndex);
} else {
@ -4122,7 +4128,7 @@ export default {
productId: item.id,
skuId: item.specList[0].id,
tableId: this.table.tableId,
num: item.specList[0].suit, // 0
num:number|| item.specList[0].suit, // 0
isPack: false, //
isWaitCall:this.isAllWaitCall //
});