代客下单增加根据店铺配置的就餐类型来判断该就餐类型是否可用
This commit is contained in:
parent
e6e0ecced6
commit
4056eae94f
|
|
@ -177,7 +177,7 @@
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button
|
<el-button
|
||||||
:class="{ active: item.value == useTypes.sel }"
|
: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"
|
v-for="(item, index) in useTypes.list"
|
||||||
@click="changeUseType(item.value)"
|
@click="changeUseType(item.value)"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|
@ -237,8 +237,11 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<el-button @click="clearCart" type="text" size="mini"
|
<el-button
|
||||||
:disabled="order.list.length<=0"
|
@click="clearCart"
|
||||||
|
type="text"
|
||||||
|
size="mini"
|
||||||
|
:disabled="order.list.length <= 0"
|
||||||
>清空</el-button
|
>清空</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -305,19 +308,18 @@
|
||||||
<template v-if="order.seatFee && order.seatFee.totalAmount > 0">
|
<template v-if="order.seatFee && order.seatFee.totalAmount > 0">
|
||||||
<div class="list">
|
<div class="list">
|
||||||
<div class="carts_list_title">餐位费</div>
|
<div class="carts_list_title">餐位费</div>
|
||||||
<cart-item
|
<cart-item
|
||||||
@itemClick="changeOrderExtraSel"
|
@itemClick="changeOrderExtraSel"
|
||||||
:canChangeNumber="false"
|
:canChangeNumber="false"
|
||||||
key="seatFee"
|
key="seatFee"
|
||||||
:index="0"
|
:index="0"
|
||||||
:item="order.seatFee"
|
:item="order.seatFee"
|
||||||
isSeatFee
|
isSeatFee
|
||||||
:selIndex="order.extra.selIndex"
|
:selIndex="order.extra.selIndex"
|
||||||
:placeNum="-10"
|
:placeNum="-10"
|
||||||
:selPlaceNum="order.selPlaceNum"
|
:selPlaceNum="order.selPlaceNum"
|
||||||
></cart-item>
|
></cart-item>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<div class="order_remark" v-if="note.content">
|
<div class="order_remark" v-if="note.content">
|
||||||
订单备注: {{ note.content }}
|
订单备注: {{ note.content }}
|
||||||
|
|
@ -519,9 +521,13 @@
|
||||||
prveOrder.list.length
|
prveOrder.list.length
|
||||||
}}</span>
|
}}</span>
|
||||||
</div> -->
|
</div> -->
|
||||||
<div class="btn"
|
<div
|
||||||
:class="{ disabled: order.selIndex < 0 }"
|
class="btn"
|
||||||
@click="refNoteShow(true)">单品备注</div>
|
:class="{ disabled: order.selIndex < 0 }"
|
||||||
|
@click="refNoteShow(true)"
|
||||||
|
>
|
||||||
|
单品备注
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="btn" @click="refNoteShow(false)">整单备注</div>
|
<div class="btn" @click="refNoteShow(false)">整单备注</div>
|
||||||
<div
|
<div
|
||||||
|
|
@ -1185,14 +1191,17 @@ export default {
|
||||||
shopInfo: {},
|
shopInfo: {},
|
||||||
//就餐饭方式
|
//就餐饭方式
|
||||||
useTypes: {
|
useTypes: {
|
||||||
|
list:[],
|
||||||
list: [
|
list: [
|
||||||
{
|
{
|
||||||
name: "堂食",
|
name: "堂食",
|
||||||
value: "dine-in",
|
value: "dine-in",
|
||||||
|
disabled:true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "自取",
|
name: "自取",
|
||||||
value: "takeout",
|
value: "takeout",
|
||||||
|
disabled:true
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
sel: "dine-in",
|
sel: "dine-in",
|
||||||
|
|
@ -1360,7 +1369,10 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
disableTuicai() {
|
disableTuicai() {
|
||||||
return (
|
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"
|
this.order.selGoods.status == "return"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
@ -1420,7 +1432,12 @@ export default {
|
||||||
.reduce((a, b) => {
|
.reduce((a, b) => {
|
||||||
return a + b.number * b.salePrice;
|
return a + b.number * b.salePrice;
|
||||||
}, 0);
|
}, 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() {
|
allNumber() {
|
||||||
const oldNumber = this.order.old.list.reduce((a, b) => {
|
const oldNumber = this.order.old.list.reduce((a, b) => {
|
||||||
|
|
@ -1619,7 +1636,6 @@ export default {
|
||||||
// this.getCategory();
|
// this.getCategory();
|
||||||
// this.refToggle('refScanCode',true)
|
// this.refToggle('refScanCode',true)
|
||||||
// this.refToggle("refDiscount", true);
|
// this.refToggle("refDiscount", true);
|
||||||
this.getShopInfo();
|
|
||||||
console.log(this.$route.query.tableId);
|
console.log(this.$route.query.tableId);
|
||||||
this.open(this.$route.query.tableId ? this.$route.query : "");
|
this.open(this.$route.query.tableId ? this.$route.query : "");
|
||||||
},
|
},
|
||||||
|
|
@ -1670,7 +1686,7 @@ export default {
|
||||||
},
|
},
|
||||||
changeOrderUseType(useType) {
|
changeOrderUseType(useType) {
|
||||||
if (useType && this.order.list.length) {
|
if (useType && this.order.list.length) {
|
||||||
const tableId = useType=='takeout'?undefined: this.table.tableId;
|
const tableId = useType == "takeout" ? undefined : this.table.tableId;
|
||||||
$changeUseType({
|
$changeUseType({
|
||||||
useType,
|
useType,
|
||||||
tableId,
|
tableId,
|
||||||
|
|
@ -1723,8 +1739,8 @@ export default {
|
||||||
},
|
},
|
||||||
//更改就餐人数
|
//更改就餐人数
|
||||||
async changePerpole() {
|
async changePerpole() {
|
||||||
if(!this.table.tableId){
|
if (!this.table.tableId) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
const res = await $choseCount({
|
const res = await $choseCount({
|
||||||
masterId: this.masterId,
|
masterId: this.masterId,
|
||||||
|
|
@ -1739,12 +1755,16 @@ export default {
|
||||||
const res = await this.getMasterId();
|
const res = await this.getMasterId();
|
||||||
this.masterId = res.masterId;
|
this.masterId = res.masterId;
|
||||||
//空闲并且免餐位费设置默认就餐人数1
|
//空闲并且免餐位费设置默认就餐人数1
|
||||||
if (!this.perpole&&this.table.status == "idle" && !this.shopInfo.isTableFee) {
|
if (
|
||||||
|
!this.perpole &&
|
||||||
|
this.table.status == "idle" &&
|
||||||
|
!this.shopInfo.isTableFee
|
||||||
|
) {
|
||||||
this.perpole = 1;
|
this.perpole = 1;
|
||||||
await this.changePerpole();
|
await this.changePerpole();
|
||||||
}
|
}
|
||||||
//设置就餐类型
|
//设置就餐类型
|
||||||
const item=this.table;
|
const item = this.table;
|
||||||
if (item && item.useType) {
|
if (item && item.useType) {
|
||||||
localStorage.setItem("useType", item.useType);
|
localStorage.setItem("useType", item.useType);
|
||||||
this.useTypes.sel =
|
this.useTypes.sel =
|
||||||
|
|
@ -1755,12 +1775,12 @@ export default {
|
||||||
this.getCart();
|
this.getCart();
|
||||||
this.getCacheOrder();
|
this.getCacheOrder();
|
||||||
console.log(this.isCreateOrder);
|
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({
|
const seatFee = await $choseCount({
|
||||||
masterId: this.masterId,
|
masterId: this.masterId,
|
||||||
tableId: this.table.tableId,
|
tableId: this.table.tableId,
|
||||||
num: res.seatFee?res.seatFee.totalNumber: this.perpole,
|
num: res.seatFee ? res.seatFee.totalNumber : this.perpole,
|
||||||
});
|
});
|
||||||
console.log(seatFee);
|
console.log(seatFee);
|
||||||
this.order.seatFee = seatFee;
|
this.order.seatFee = seatFee;
|
||||||
|
|
@ -1940,29 +1960,31 @@ export default {
|
||||||
},
|
},
|
||||||
async refOrderNoteConfirm(note) {
|
async refOrderNoteConfirm(note) {
|
||||||
//单品备注
|
//单品备注
|
||||||
if(this.isDanNote){
|
if (this.isDanNote) {
|
||||||
const cart=this.order.list[this.order.selIndex]
|
const cart = this.order.list[this.order.selIndex];
|
||||||
const res= await $updateCart({
|
const res = await $updateCart({
|
||||||
cartId: cart.id,
|
cartId: cart.id,
|
||||||
productId: cart.productId,
|
productId: cart.productId,
|
||||||
skuId: cart.skuId,
|
skuId: cart.skuId,
|
||||||
tableId: this.table.tableId,
|
tableId: this.table.tableId,
|
||||||
note:note,
|
note: note,
|
||||||
num: cart.number, // 0会删除此商品
|
num: cart.number, // 0会删除此商品
|
||||||
});
|
});
|
||||||
this.$set(this.order.list, this.order.selIndex, res);
|
this.$set(this.order.list, this.order.selIndex, res);
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: "更新成功",
|
title: "更新成功",
|
||||||
type: "success",
|
type: "success",
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
//订单备注
|
//订单备注
|
||||||
this.note.content = note;
|
this.note.content = note;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
refNoteShow(isDan=false) {
|
refNoteShow(isDan = false) {
|
||||||
this.isDanNote = isDan;
|
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);
|
this.$refs.refOrderNote.open(note);
|
||||||
},
|
},
|
||||||
// 支付订单前的处理
|
// 支付订单前的处理
|
||||||
|
|
@ -2091,9 +2113,9 @@ export default {
|
||||||
return $getMasterId({
|
return $getMasterId({
|
||||||
tableId: this.table.tableId,
|
tableId: this.table.tableId,
|
||||||
vipUserId: this.vipUser.id,
|
vipUserId: this.vipUser.id,
|
||||||
useType:this.useTypes.sel=='takeout'?'takeout':'',
|
useType: this.useTypes.sel == "takeout" ? "takeout" : "",
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
// return $getMasterId({
|
// return $getMasterId({
|
||||||
// useType:'takeout',
|
// useType:'takeout',
|
||||||
// vipUserId: this.vipUser.id,
|
// vipUserId: this.vipUser.id,
|
||||||
|
|
@ -2872,7 +2894,7 @@ export default {
|
||||||
},
|
},
|
||||||
async getGoods() {
|
async getGoods() {
|
||||||
const res = await getGoodsLists(this.goods.query);
|
const res = await getGoodsLists(this.goods.query);
|
||||||
let $goodsMap={}
|
let $goodsMap = {};
|
||||||
const goods = res.records.filter((v) => {
|
const goods = res.records.filter((v) => {
|
||||||
if (!v) {
|
if (!v) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2881,23 +2903,38 @@ export default {
|
||||||
if (v.typeEnum !== "sku") {
|
if (v.typeEnum !== "sku") {
|
||||||
isShow = v.specList.length >= 1;
|
isShow = v.specList.length >= 1;
|
||||||
}
|
}
|
||||||
v.specList.map(spe=>{
|
v.specList.map((spe) => {
|
||||||
$goodsMap[`${v.id}_${spe.id}`]=spe;
|
$goodsMap[`${v.id}_${spe.id}`] = spe;
|
||||||
})
|
});
|
||||||
return isShow;
|
return isShow;
|
||||||
});
|
});
|
||||||
console.log($goodsMap)
|
console.log($goodsMap);
|
||||||
this.goods.list = goods;
|
this.goods.list = goods;
|
||||||
this.goods.total = res.total;
|
this.goods.total = res.total;
|
||||||
this.$goodsData = goods;
|
this.$goodsData = goods;
|
||||||
},
|
},
|
||||||
async open(params) {
|
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.getGoods();
|
||||||
this.getCategory();
|
this.getCategory();
|
||||||
this.getTable();
|
this.getTable();
|
||||||
console.log(params);
|
console.log(params);
|
||||||
const res=await this.getMasterId()
|
const res = await this.getMasterId();
|
||||||
console.log(res)
|
console.log(res);
|
||||||
if (!params) {
|
if (!params) {
|
||||||
//无台桌代客下单
|
//无台桌代客下单
|
||||||
return;
|
return;
|
||||||
|
|
@ -4376,12 +4413,12 @@ input[type="number"]::-webkit-outer-spin-button {
|
||||||
.pay_btns .el-button:disabled {
|
.pay_btns .el-button:disabled {
|
||||||
border: 1px solid #dcdfe6;
|
border: 1px solid #dcdfe6;
|
||||||
}
|
}
|
||||||
.order_remark{
|
.order_remark {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #666;
|
color: #666;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
max-width: 340px;
|
max-width: 340px;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
Loading…
Reference in New Issue