代客下单新增称重商品

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 class="">
<div>单价</div> <div>单价</div>
<div class="u-m-t-10"> <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>
<div> <div>
<div class="u-font-14">重量</div> <div class="u-font-14">重量</div>
<div class="u-m-t-10"> <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'"> @focus="inputFocus" @blur="inputBlur" :type="focus ? 'number' : 'text'">
<template slot="append">{{ item.unitName }}</template> <template slot="append">{{ item.unitName }}</template>
</el-input> </el-input>
@ -22,7 +22,7 @@
</div> </div>
</div> </div>
</key-board> </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"> <div class="confirm_btns u-flex u-m-t-20">
<el-button style="width: 100%;" type="primary" size="medium" @click="confirm">确定</el-button> <el-button style="width: 100%;" type="primary" size="medium" @click="confirm">确定</el-button>
@ -30,20 +30,22 @@
</div> </div>
</el-dialog> </el-dialog>
<choose-guazhang ref="refChooseGuazhang" @confirm="chooseGuazhangConfirm"></choose-guazhang>
</div> </div>
</template> </template>
<script> <script>
import keyBoard from "./keyboard.vue"; import keyBoard from "./keyboard.vue";
import chooseGuazhang from "./choose-guazhang.vue";
export default { export default {
components: { keyBoard, chooseGuazhang }, components: { keyBoard },
props: { props: {
payMoney: { payMoney: {
type: [Number, String], type: [Number, String],
default: 0, default: 0,
}, },
isShowVipPrice:{
type:Boolean,
default:false
}
}, },
data() { data() {
return { 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: { methods: {
inputFocus() { inputFocus() {
this.focus = true; this.focus = true;
@ -86,13 +99,6 @@ export default {
inputBlur() { inputBlur() {
this.focus = false; this.focus = false;
}, },
chooseGuazhangConfirm(e) {
this.guazhangRen = e;
},
guazhangShow() {
this.$refs.refChooseGuazhang.open();
},
inputNumber(e) { inputNumber(e) {
console.log("inputNumber"); console.log("inputNumber");
if (e * 1 > this.payMoney * 1) { if (e * 1 > this.payMoney * 1) {
@ -108,29 +114,24 @@ export default {
clear(e) { clear(e) {
console.log(e); console.log(e);
this.number = ""; this.number = "";
this.item=""
}, },
confirm() { confirm() {
// if (this.number * 1 > this.payMoney * 1) { if(this.number*1<=0){
// return this.$message(""); return this.$message("请输入重量");
// } }
// if (this.number * 1 <= 0) {
// return this.$message("");
// }
// if (!this.guazhangRen) {
// return this.$message("");
// }
this.$emit("confirm", this.item, this.number); this.$emit("confirm", this.item, this.number);
this.close(); this.close();
}, },
open(item) { open(item) {
console.log(item);
this.item = item this.item = item
this.number = this.payMoney * 1;
this.show = true; this.show = true;
this.tips = "还需额外支付" + this.payMoney + "元";
}, },
close() { close() {
this.show = false; this.show = false;
this.number = ""; this.number = "";
this.item=""
}, },
}, },
mounted() { }, mounted() { },

View File

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