代客下单增加根据店铺配置的就餐类型来判断该就餐类型是否可用

This commit is contained in:
YeMingfei666 2024-10-08 09:53:00 +08:00
parent e6e0ecced6
commit 4056eae94f
1 changed files with 89 additions and 52 deletions

View File

@ -177,7 +177,7 @@
<el-button-group>
<el-button
:class="{ active: item.value == useTypes.sel }"
:disabled="order.old.list.length > 0"
:disabled="order.old.list.length > 0||item.disabled"
v-for="(item, index) in useTypes.list"
@click="changeUseType(item.value)"
:key="index"
@ -237,8 +237,11 @@
</div>
</template>
</div>
<el-button @click="clearCart" type="text" size="mini"
:disabled="order.list.length<=0"
<el-button
@click="clearCart"
type="text"
size="mini"
:disabled="order.list.length <= 0"
>清空</el-button
>
</div>
@ -305,19 +308,18 @@
<template v-if="order.seatFee && order.seatFee.totalAmount > 0">
<div class="list">
<div class="carts_list_title">餐位费</div>
<cart-item
@itemClick="changeOrderExtraSel"
:canChangeNumber="false"
key="seatFee"
:index="0"
:item="order.seatFee"
isSeatFee
:selIndex="order.extra.selIndex"
:placeNum="-10"
:selPlaceNum="order.selPlaceNum"
></cart-item>
</div>
<cart-item
@itemClick="changeOrderExtraSel"
:canChangeNumber="false"
key="seatFee"
:index="0"
:item="order.seatFee"
isSeatFee
:selIndex="order.extra.selIndex"
:placeNum="-10"
:selPlaceNum="order.selPlaceNum"
></cart-item>
</div>
</template>
<div class="order_remark" v-if="note.content">
订单备注 {{ note.content }}
@ -519,9 +521,13 @@
prveOrder.list.length
}}</span>
</div> -->
<div class="btn"
:class="{ disabled: order.selIndex < 0 }"
@click="refNoteShow(true)">单品备注</div>
<div
class="btn"
:class="{ disabled: order.selIndex < 0 }"
@click="refNoteShow(true)"
>
单品备注
</div>
<div class="btn" @click="refNoteShow(false)">整单备注</div>
<div
@ -1185,14 +1191,17 @@ export default {
shopInfo: {},
//
useTypes: {
list:[],
list: [
{
name: "堂食",
value: "dine-in",
disabled:true
},
{
name: "自取",
value: "takeout",
disabled:true
},
],
sel: "dine-in",
@ -1360,7 +1369,10 @@ export default {
computed: {
disableTuicai() {
return (
this.order.placeNum==1 ||this.order.selIndex>=0||!this.order.selGoods||this.order.old.list.length<=0||
this.order.placeNum == 1 ||
this.order.selIndex >= 0 ||
!this.order.selGoods ||
this.order.old.list.length <= 0 ||
this.order.selGoods.status == "return"
);
},
@ -1420,7 +1432,12 @@ export default {
.reduce((a, b) => {
return a + b.number * b.salePrice;
}, 0);
return (oldPrice + price + this.order.seatFee.totalAmount * (this.order.seatFee.status=='return'?0:1)).toFixed(2);
return (
oldPrice +
price +
this.order.seatFee.totalAmount *
(this.order.seatFee.status == "return" ? 0 : 1)
).toFixed(2);
},
allNumber() {
const oldNumber = this.order.old.list.reduce((a, b) => {
@ -1619,7 +1636,6 @@ export default {
// this.getCategory();
// this.refToggle('refScanCode',true)
// this.refToggle("refDiscount", true);
this.getShopInfo();
console.log(this.$route.query.tableId);
this.open(this.$route.query.tableId ? this.$route.query : "");
},
@ -1670,7 +1686,7 @@ export default {
},
changeOrderUseType(useType) {
if (useType && this.order.list.length) {
const tableId = useType=='takeout'?undefined: this.table.tableId;
const tableId = useType == "takeout" ? undefined : this.table.tableId;
$changeUseType({
useType,
tableId,
@ -1723,8 +1739,8 @@ export default {
},
//
async changePerpole() {
if(!this.table.tableId){
return
if (!this.table.tableId) {
return;
}
const res = await $choseCount({
masterId: this.masterId,
@ -1739,12 +1755,16 @@ export default {
const res = await this.getMasterId();
this.masterId = res.masterId;
//1
if (!this.perpole&&this.table.status == "idle" && !this.shopInfo.isTableFee) {
if (
!this.perpole &&
this.table.status == "idle" &&
!this.shopInfo.isTableFee
) {
this.perpole = 1;
await this.changePerpole();
}
//
const item=this.table;
const item = this.table;
if (item && item.useType) {
localStorage.setItem("useType", item.useType);
this.useTypes.sel =
@ -1755,12 +1775,12 @@ export default {
this.getCart();
this.getCacheOrder();
console.log(this.isCreateOrder);
if (!this.shopInfo.isTableFee && this.table.tableId && this.perpole > 0 ) {
if (!this.shopInfo.isTableFee && this.table.tableId && this.perpole > 0) {
//
const seatFee = await $choseCount({
masterId: this.masterId,
tableId: this.table.tableId,
num: res.seatFee?res.seatFee.totalNumber: this.perpole,
num: res.seatFee ? res.seatFee.totalNumber : this.perpole,
});
console.log(seatFee);
this.order.seatFee = seatFee;
@ -1940,29 +1960,31 @@ export default {
},
async refOrderNoteConfirm(note) {
//
if(this.isDanNote){
const cart=this.order.list[this.order.selIndex]
const res= await $updateCart({
if (this.isDanNote) {
const cart = this.order.list[this.order.selIndex];
const res = await $updateCart({
cartId: cart.id,
productId: cart.productId,
skuId: cart.skuId,
tableId: this.table.tableId,
note:note,
note: note,
num: cart.number, // 0
});
this.$set(this.order.list, this.order.selIndex, res);
this.$set(this.order.list, this.order.selIndex, res);
this.$notify({
title: "更新成功",
type: "success",
});
}else{
} else {
//
this.note.content = note;
}
},
refNoteShow(isDan=false) {
refNoteShow(isDan = false) {
this.isDanNote = isDan;
const note=isDan?this.order.list[this.order.selIndex].note:this.note.content;
const note = isDan
? this.order.list[this.order.selIndex].note
: this.note.content;
this.$refs.refOrderNote.open(note);
},
//
@ -2091,9 +2113,9 @@ export default {
return $getMasterId({
tableId: this.table.tableId,
vipUserId: this.vipUser.id,
useType:this.useTypes.sel=='takeout'?'takeout':'',
useType: this.useTypes.sel == "takeout" ? "takeout" : "",
});
}else{
} else {
// return $getMasterId({
// useType:'takeout',
// vipUserId: this.vipUser.id,
@ -2872,7 +2894,7 @@ export default {
},
async getGoods() {
const res = await getGoodsLists(this.goods.query);
let $goodsMap={}
let $goodsMap = {};
const goods = res.records.filter((v) => {
if (!v) {
return false;
@ -2881,23 +2903,38 @@ export default {
if (v.typeEnum !== "sku") {
isShow = v.specList.length >= 1;
}
v.specList.map(spe=>{
$goodsMap[`${v.id}_${spe.id}`]=spe;
})
v.specList.map((spe) => {
$goodsMap[`${v.id}_${spe.id}`] = spe;
});
return isShow;
});
console.log($goodsMap)
console.log($goodsMap);
this.goods.list = goods;
this.goods.total = res.total;
this.$goodsData = goods;
},
async open(params) {
const shopId = localStorage.getItem("shopId");
const shopInfo = await tbShopInfo(shopId);
for(let i in shopInfo.eatModel){
let model=shopInfo.eatModel[i];
model=model=='take-out'?model.replace(/-/g,""):model;
console.log(model);
const item=this.useTypes.list.find(v=>v.value==model);
console.log(item);
if(item){
item.disabled=false;
}
}
this.shopInfo = shopInfo;
this.setPostPay();
this.setUseType();
this.getGoods();
this.getCategory();
this.getTable();
console.log(params);
const res=await this.getMasterId()
console.log(res)
const res = await this.getMasterId();
console.log(res);
if (!params) {
//
return;
@ -4376,12 +4413,12 @@ input[type="number"]::-webkit-outer-spin-button {
.pay_btns .el-button:disabled {
border: 1px solid #dcdfe6;
}
.order_remark{
font-size: 14px;
color: #666;
margin-top: 5px;
max-width: 340px;
word-break: break-all;
.order_remark {
font-size: 14px;
color: #666;
margin-top: 5px;
max-width: 340px;
word-break: break-all;
}
</style>