代客下单增加单品改价,挂账,等叫,免厨打等功能

This commit is contained in:
YeMingfei666 2024-11-28 17:50:27 +08:00
parent b0868703a5
commit 45eaccb9ac
5 changed files with 210 additions and 40 deletions

View File

@ -54,3 +54,15 @@ export function $checkCoupon(data) {
} }
}); });
} }
//整体等叫/取消等叫
export function $waitCall(data) {
return request({
url: '/api/place/waitCall',
method: "put",
data:{
useType:getUseType(),
shopId: localStorage.getItem("shopId"),
...data
}
});
}

View File

@ -4,8 +4,12 @@
:class="[isActive]" :class="[isActive]"
@click="itemClick" @click="itemClick"
> >
<span class="absolute pack" v-if="item.isPack === 'true'"> </span> <div class="absolute status-box">
<span class="absolute tui" v-if="item.status === 'return'"> 退 </span> <span class="pack" v-if="item.isPack === 'true'"> </span>
<span class="da" v-if="item.isPrint"> </span>
<span class="isWaitCall" v-if="item.isWaitCall"> </span>
<span class="tui" v-if="item.status === 'return'"> 退 </span>
</div>
<div class="flex u-col-top"> <div class="flex u-col-top">
<div class="img"> <div class="img">
<div <div
@ -30,7 +34,7 @@
</div> </div>
<div class="" v-if="placeNum == 0"> <div class="" v-if="placeNum == 0">
<div class="note" v-if="item.note">备注:{{ item.note || "" }}</div> <div class="note" v-if="item.note">备注:{{ item.note }}</div>
<div class="note flex" v-else> <div class="note flex" v-else>
<span>备注:</span> <span>备注:</span>
<span class="el-icon-edit u-font-12" @click="editNote"></span> <span class="el-icon-edit u-font-12" @click="editNote"></span>
@ -74,11 +78,23 @@
<span v-else> {{ isShowVipPrice ? vipAllPrice : allPrice }}</span> <span v-else> {{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
</div> </div>
</template> </template>
<template v-else-if="item.discountSaleAmount">
<div>{{ discountNewPrice }}</div>
<div class="free-price">
<span> {{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
</div>
</template>
<template v-else> <template v-else>
<div v-if="isSeatFee">{{ item.totalAmount }}</div> <div v-if="isSeatFee">{{ item.totalAmount }}</div>
<div v-else> <div v-else>
<div v-if="isShowVipPrice&&vipAllPrice!=allPrice">{{ vipAllPrice }}</div> <div v-if="isShowVipPrice && vipAllPrice != allPrice">
<div :class="{ 'free-price': isShowVipPrice&&vipAllPrice!=allPrice }"> {{ vipAllPrice }}
</div>
<div
:class="{
'free-price': isShowVipPrice && vipAllPrice != allPrice,
}"
>
<span> {{ allPrice }}</span> <span> {{ allPrice }}</span>
</div> </div>
</div> </div>
@ -142,13 +158,21 @@ export default {
}; };
}, },
computed: { computed: {
discountNewPrice(){
const item = this.item;
const originPrice=this.isShowVipPrice?this.vipAllPrice:this.allPrice
const discount=(this.item.discountSaleAmount*this.item.number)
return (originPrice-discount).toFixed(2)
},
vipAllPrice() { vipAllPrice() {
const item = this.item; const item = this.item;
const price = const price =
this.isShowVipPrice && this.isShowVipPrice &&
item.memberPrice != null && item.memberPrice != null &&
item.memberPrice != undefined item.memberPrice != undefined
? (item.memberPrice<=0?item.salePrice:item.memberPrice) ? item.memberPrice <= 0
? item.salePrice
: item.memberPrice
: item.salePrice; : item.salePrice;
return (price * item.number + (item.packAmount || 0)).toFixed(2); return (price * item.number + (item.packAmount || 0)).toFixed(2);
}, },
@ -262,27 +286,36 @@ export default {
justify-content: space-between; justify-content: space-between;
background-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);
transition: all 0.3s; transition: all 0.3s;
.pack { .status-box {
width: 18px;
position: absolute;
top: 4px;
right: 100%; right: 100%;
display: flex;
flex-direction: column;
gap: 2px;
> span {
display: block;
width: 18px; width: 18px;
height: 18px; height: 18px;
background: #35ac6a;
border-radius: 4px 0 4px 0; border-radius: 4px 0 4px 0;
font-size: 12px; font-size: 12px;
color: #fff;
text-align: center;
line-height: 17px; line-height: 17px;
text-align: center;
color: #fff;
}
}
.isWaitCall {
background: #d3adf7;
}
.pack {
background: #35ac6a;
}
.da {
background: #35ac6a;
} }
.tui { .tui {
right: 100%;
width: 18px;
height: 18px;
background: #ac4735; background: #ac4735;
border-radius: 4px 0 4px 0;
font-size: 12px;
color: #fff;
text-align: center;
line-height: 17px;
} }
&.active { &.active {
background-color: rgba(0, 0, 0, 0.04); background-color: rgba(0, 0, 0, 0.04);

View File

@ -131,9 +131,9 @@ export default {
this.max=returnCartPrice(this.goods,this.vipUser) this.max=returnCartPrice(this.goods,this.vipUser)
this.show = true; this.show = true;
if (item.productId != "-999") { if (item.productId != "-999") {
this.number = 1;
} else { } else {
this.number = item.num; this.price = item.discountSaleAmount||'';
} }
}, },
close() { close() {

View File

@ -143,8 +143,10 @@ export default {
if (this.number * 1 <= 0) { if (this.number * 1 <= 0) {
return this.$message("支付金额不正确"); return this.$message("支付金额不正确");
} }
console.log(this.number); if (!this.guazhangRen) {
this.$emit("confirm", this.number); return this.$message("请选择挂账人");
}
this.$emit("confirm",this.guazhangRen, this.number);
this.close(); this.close();
}, },
open(number) { open(number) {

View File

@ -399,11 +399,18 @@
<div slot="content"> <div slot="content">
<div <div
class="u-flex color-000 u-font-14 u-row-between" class="u-flex color-000 u-font-14 u-row-between"
v-if="vipDiscountPrice > 0" v-if="vipDiscountPrice * 1 > 0"
> >
<span class="font-bold">会员优惠 </span> <span class="font-bold">会员优惠 </span>
<span class="">{{ vipDiscountPrice }} </span> <span class="">{{ vipDiscountPrice }} </span>
</div> </div>
<div
class="u-flex color-000 u-font-14 u-row-between"
v-if="discountSaleAmount * 1 > 0"
>
<span class="font-bold">单品改价优惠 </span>
<span class="">{{ discountSaleAmount }} </span>
</div>
</div> </div>
<span> 已优惠{{ youhuiAllPrice }} </span> <span> 已优惠{{ youhuiAllPrice }} </span>
<i class="el-icon-arrow-right"></i> <i class="el-icon-arrow-right"></i>
@ -638,6 +645,14 @@
@click="orderBtnsClick('returnCart')" @click="orderBtnsClick('returnCart')"
> >
退菜 退菜
</div>
<div
@click="orderBtnsClick('print')"
:class="{ disabled: order.selIndex < 0 }"
class="btn"
>
{{ returnPrintText }}
</div> </div>
<div <div
@click="refPopChangePriceShow" @click="refPopChangePriceShow"
@ -646,8 +661,21 @@
> >
单品改价 单品改价
</div> </div>
<div class="btn">等叫</div> <div
<div class="btn no-wrap u-font-12">取消全部等叫</div> class="btn"
@click="orderBtnsClick('isWaitCall')"
:class="{ disabled: order.selIndex < 0 }"
>
{{ returnWaingText }}
</div>
<div
class="btn no-wrap u-font-12"
@click="orderBtnsClick('AllWaitCall')"
:class="{ disabled: isCreateOrder}"
>
{{ returnWaingAllText }}
</div>
<!-- <div <!-- <div
class="btn" class="btn"
@ -1041,7 +1069,7 @@
:disabledPayType="disabledPayType" :disabledPayType="disabledPayType"
> >
</pay-type> </pay-type>
<el-button @click="guazhangShow">挂账</el-button> <el-button @click="guazhangShow" size="medium">挂账</el-button>
<div style="margin-top: 20px"> <div style="margin-top: 20px">
<el-button type="primary" size="medium" @click="payOrder"> <el-button type="primary" size="medium" @click="payOrder">
<span>立即支付</span> <span>立即支付</span>
@ -1450,7 +1478,11 @@
@confirm="tuanQuanConfirm" @confirm="tuanQuanConfirm"
></pop-tuan-quan> ></pop-tuan-quan>
<!-- 挂账 --> <!-- 挂账 -->
<popup-choose-guazhang ref="refGuaZhang" :payMoney="yinFuJinE"></popup-choose-guazhang> <popup-choose-guazhang
ref="refGuaZhang"
:payMoney="yinFuJinE"
@confirm="guazhangPayConfirm"
></popup-choose-guazhang>
</div> </div>
</template> </template>
@ -1507,7 +1539,7 @@ import {
} from "@/api/table"; } from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop"; import { tbShopCategoryGet } from "@/api/shop";
import { $checkCoupon } from "@/api/Instead"; import { $checkCoupon,$waitCall } from "@/api/Instead";
import { import {
isCanBuy, isCanBuy,
arrayContainsAll, arrayContainsAll,
@ -1524,7 +1556,7 @@ import { returnProductCoupAllPrice } from "./quan_util.js";
//0n //0n
let $goodsPayPriceMap = {}; let $goodsPayPriceMap = {};
import { $status } from "@/utils/table.js"; import { $status } from "@/utils/table.js";
import PopupChooseGuazhang from './components/popup-choose-guazhang.vue'; import PopupChooseGuazhang from "./components/popup-choose-guazhang.vue";
let $originTableList = []; let $originTableList = [];
export default { export default {
@ -1549,6 +1581,8 @@ export default {
}, },
data() { data() {
return { return {
//
guazhangRen: "",
disabledPayType: [], disabledPayType: [],
// //
points: { points: {
@ -1762,9 +1796,33 @@ export default {
}, },
}, },
timer: null, timer: null,
isAllWaitCall: false,
}; };
}, },
computed: { computed: {
returnPrintText(){
if (this.order.selIndex < 0) {
return "免厨打";
}
return this.order.list[this.order.selIndex].isPrint
? "免厨打"
: "打印";
},
returnWaingText() {
if (this.order.selIndex < 0) {
return "等叫";
}
return this.order.list[this.order.selIndex].isWaitCall == 1
? "取消等叫"
: "等叫";
},
isHasWaiting() {
const waitingArr = this.order.list.filter((v) => v.isWaitCall == 1);
return waitingArr.length > 0 ? true : false;
},
returnWaingAllText() {
return this.isAllWaitCall ? "取消全部等叫" : "整单等叫";
},
pointsDiscountAmount() { pointsDiscountAmount() {
if (this.points.selected) { if (this.points.selected) {
return this.points.toMoney; return this.points.toMoney;
@ -1970,8 +2028,28 @@ export default {
}, 0); }, 0);
return (oldMemberPrice + nowMemberprice).toFixed(2); return (oldMemberPrice + nowMemberprice).toFixed(2);
}, },
discountSaleAmount() {
const oldTotal = this.order.old.list.reduce((a, b) => {
const bTotal = b.info
.filter((v) => v.discountSaleAmount && v.discountSaleAmount > 0)
.reduce((prve, cur) => {
return prve + cur.number * cur.discountSaleAmount;
}, 0);
return a + bTotal;
}, 0);
const nowTotal = this.order.list
.filter((v) => v.discountSaleAmount && v.discountSaleAmount > 0)
.reduce((a, b) => {
return a + b.number * b.discountSaleAmount;
}, 0);
return (oldTotal + nowTotal).toFixed(2);
},
youhuiAllPrice() { youhuiAllPrice() {
return (this.vipDiscountPrice * 1 + this.allGiftMoney * 1).toFixed(2); return (
this.vipDiscountPrice * 1 +
this.allGiftMoney * 1 +
this.discountSaleAmount * 1
).toFixed(2);
}, },
allNumber() { allNumber() {
const oldNumber = this.order.old.list.reduce((a, b) => { const oldNumber = this.order.old.list.reduce((a, b) => {
@ -2246,6 +2324,14 @@ export default {
this.open(this.$route.query); this.open(this.$route.query);
}, },
methods: { methods: {
//
guazhangPayConfirm(guazhangren, price) {
this.guazhangRen = guazhangren;
this.pays({
creditBuyerId: this.guazhangRen.id,
payType: "creditBuyer",
});
},
// //
guazhangShow() { guazhangShow() {
this.$refs.refGuaZhang.open(); this.$refs.refGuaZhang.open();
@ -2261,7 +2347,8 @@ export default {
// //
updateCartItem(res) { updateCartItem(res) {
if (res) { if (res) {
this.order.list[this.order.selIndex] = res; // this.order.list[this.order.selIndex] = res;
this.$set(this.order.list, this.order.selIndex, res)
} }
}, },
// //
@ -2972,7 +3059,7 @@ export default {
this.pays(); this.pays();
}, },
// //
async pays() { async pays(par) {
this.loading = true; this.loading = true;
const userCouponInfos = this.quansSelArr.reduce((prve, cur) => { const userCouponInfos = this.quansSelArr.reduce((prve, cur) => {
const index = prve.findIndex((v) => v.userCouponId == cur.couponId); const index = prve.findIndex((v) => v.userCouponId == cur.couponId);
@ -3004,8 +3091,9 @@ export default {
vipUserId: this.createOrder.data.memberId || this.vipUser.id, vipUserId: this.createOrder.data.memberId || this.vipUser.id,
discount: this.createOrder.discount, discount: this.createOrder.discount,
code: this.createOrder.code, code: this.createOrder.code,
userCouponInfos, userCouponInfos: userCouponInfos.length > 0 ? userCouponInfos : "",
pointsNum: this.points.value, pointsNum: this.points.value,
...par,
}); });
this.loading = false; this.loading = false;
this.payOrderSuccess(); this.payOrderSuccess();
@ -3133,7 +3221,16 @@ export default {
updateOrder(par = {}) { updateOrder(par = {}) {
let item = this.order.list[this.order.selIndex]; let item = this.order.list[this.order.selIndex];
console.log(this.table); console.log(this.table);
const { productId, skuId, isPack, isGift, number, id } = item; const {
productId,
skuId,
isPack,
isGift,
number,
id,
isPrint,
isWaitCall,
} = item;
$updateCart({ $updateCart({
cartId: id, cartId: id,
masterId: this.masterId, masterId: this.masterId,
@ -3144,6 +3241,8 @@ export default {
num: number, num: number,
isPack: isPack === "true" ? true : false, isPack: isPack === "true" ? true : false,
isGift: isGift === "true" ? true : false, isGift: isGift === "true" ? true : false,
isPrint,
isWaitCall,
...par, ...par,
}).then((res) => { }).then((res) => {
this.$set(this.order.list, this.order.selIndex, { this.$set(this.order.list, this.order.selIndex, {
@ -3196,7 +3295,7 @@ export default {
// }, // },
// //
orderBtnsClick(key) { async orderBtnsClick(key) {
const orderGoods = this.order.list[this.order.selIndex]; const orderGoods = this.order.list[this.order.selIndex];
if (this.key != "isJieZhang" && this.payAfter) { if (this.key != "isJieZhang" && this.payAfter) {
this.createOrderClose(); this.createOrderClose();
@ -3221,6 +3320,27 @@ export default {
if (key === "del") { if (key === "del") {
return this.removeCart(); return this.removeCart();
} }
if (key === "print") {
const isPrint = orderGoods.isPrint;
this.updateOrder({ isPrint: !isPrint });
return;
}
if (key === "isWaitCall") {
const isWaitCall = orderGoods.isWaitCall;
this.updateOrder({ isWaitCall: !isWaitCall });
return;
}
if (key == "AllWaitCall") {
await $waitCall({
orderId:this.createOrder.data.id,
masterId:this.masterId,
tableId:this.table.tableId,
isWaitCall: !this.isAllWaitCall?1:0
})
this.isAllWaitCall=!this.isAllWaitCall;
this.getCart()
return;
}
if (key === "save") { if (key === "save") {
this.prveOrder.list.push({ this.prveOrder.list.push({
cart: this.order.list, cart: this.order.list,
@ -3621,6 +3741,7 @@ export default {
tableId: this.table.tableId, tableId: this.table.tableId,
num: this.skuGoods.number, // 0 num: this.skuGoods.number, // 0
isPack: false, // isPack: false, //
isWaitCall:this.isAllWaitCall //
}); });
this.orderListPush({ ...res, specSnap: name }); this.orderListPush({ ...res, specSnap: name });
// this.orderListPush({ // this.orderListPush({
@ -3726,6 +3847,7 @@ export default {
}, },
reset() { reset() {
// this.goods.list = []; // this.goods.list = [];
this.guazhangRen = "";
this.order.status = ""; this.order.status = "";
this.loading = false; this.loading = false;
this.table = ""; this.table = "";
@ -3922,6 +4044,7 @@ export default {
tableId: this.table.tableId, tableId: this.table.tableId,
num: item.specList[0].suit, // 0 num: item.specList[0].suit, // 0
isPack: false, // isPack: false, //
isWaitCall:this.isAllWaitCall //
}); });
this.orderListPush(res); this.orderListPush(res);
} }