-
+
![]()
{{
vipUser.id ? vipUser.nickName : "服务员下单"
}}
+
+ VIP{{ vipUser.isVip }}
+
余额:{{ vipUser.amount | to2 }}
-
积分:{{ vipUser.totalScore }}
+
+ 积分:{{ vipUser.accountPoints }}
+
-
+
+
已选优惠券
+
+
+
+
+
+
+
+ {{ scope.row.type == 1 ? "优惠券" : "商品券" }}
+
+
+
+
+
+
+
+ {{ scope.row.productName }}
+
+
+
+
+
+
+
+ ¥{{ scope.row.discountAmount }}
+
+
+
+
+
+ 删除
+
+
+
+
@@ -894,13 +1045,17 @@
门店优惠
-¥0.00
-
@@ -1256,14 +1428,17 @@ import chooseTable from "./components/choose-table-master.vue";
import cartItem from "./components/cart-item.vue";
import scanPay from "./components/scan-pay.vue";
import moneyDiscount from "./components/discount.vue";
+import quansPop from "./components/quans.vue";
import orderNote from "./components/note.vue";
import chooseDinersNumber from "./components/choose-diners-number.vue";
import returnCart from "./components/return-cart.vue";
import moneyKeyboard from "./components/money-keyboard.vue";
+import caiAdd from "./components/popup-linshiCai.vue";
import dayjs from "dayjs";
import { tbShopInfo } from "@/api/user";
import { hasPermission } from "@/utils/limits.js";
import { tbOrderInfoDetail } from "@/api/order";
+import { queryAllShopUser } from "@/api/shop";
import {
getGoodsLists,
@@ -1287,7 +1462,9 @@ import {
tbShopTableGet,
$changeUseType,
$returnTableDetail,
- $activateByOrderId
+ $activateByOrderId,
+ $calcUsablePoints,
+ $calcDeDuctionPoints,
} from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop";
import {
@@ -1299,12 +1476,16 @@ import {
returnGiftArr,
returnPackFee,
formatOrderGoodsList,
+ returnVipDiscountPrice,
+ returnCouponAllPrice,
} from "./util.js";
import { $status } from "@/utils/table.js";
let $originTableList = [];
export default {
components: {
+ caiAdd,
+ quansPop,
returnCart,
chooseUser,
chooseTable,
@@ -1318,6 +1499,20 @@ export default {
},
data() {
return {
+ //积分抵扣
+ points: {
+ res: {
+ usable: true,
+ },
+ selected: "",
+ minDeductionPoints: 0,
+ maxUsablePoints: 0,
+ usable: false,
+ value: 0,
+ toMoney: 0,
+ },
+ //选中可用优惠券
+ quansSelArr: [],
//台桌搜索文字
tableSearchText: "",
//是否允许收款
@@ -1369,7 +1564,7 @@ export default {
title: "支付",
},
//true后付款false先付款
- postPay: true,
+ payAfter: true,
//是否打印
isPrint: false,
// 备注
@@ -1516,6 +1711,49 @@ export default {
};
},
computed: {
+ isShowVipPrice() {
+ return this.vipUser.isVip ? true : false;
+ },
+ coupdiscount() {
+ return returnCouponAllPrice(
+ this.quansSelArr,
+ this.createOrder.data.detailList || [],
+ this.vipUser
+ );
+ },
+ goodsDisCount() {
+ const goodsQuanArr = this.quansSelArr.filter((v) => v.type == 2);
+ let result = 0;
+ if (goodsQuanArr.length < 0) {
+ result = 0;
+ } else {
+ result = goodsQuanArr.reduce((a, b) => {
+ const item = this.createOrder.data.detailList.find(
+ (v) => v.productId == b.proId
+ );
+ const memberPrice = item.memberPrice ? item.memberPrice : item.price;
+ const price = item
+ ? this.vipUser.isVip
+ ? memberPrice
+ : item.price
+ : 0;
+ return a + price;
+ }, 0);
+ }
+ return result.toFixed(2);
+ },
+
+ currentPayMoney() {
+ const amount = this.createOrder.data.amount || 0;
+ const discount = this.createOrder.discount || 1;
+ // const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney)
+ const total = (amount - this.coupdiscount) * this.createOrder.discount;
+ return total <= 0 ? 0 : total;
+ },
+ yinFuJinE() {
+ const total = this.currentPayMoney - (this.points.toMoney || 0);
+ return total.toFixed(2);
+ },
disableTuicai() {
return (
this.order.placeNum == 1 ||
@@ -1527,7 +1765,7 @@ export default {
},
title() {
// return this.table ? "代客下单" + `(${this.table.name})` : "代客下单";
- return '代客下单'
+ return "代客下单";
},
allGiftMoney() {
const nowprice = this.order.list
@@ -1538,7 +1776,7 @@ export default {
const oldPrice = this.order.old.list.reduce((a, b) => {
const total = b.info
- .filter((v) => v.isGift === "true")
+ .filter((v) => v.isGift === "true" || v.status === "return")
.reduce((prve, cur) => {
return prve + cur.number * cur.salePrice;
}, 0);
@@ -1570,9 +1808,13 @@ export default {
return total;
},
giftLen() {
- const nowlen = this.order.list.filter((v) => v.isGift === "true").length;
+ const nowlen = this.order.list.filter(
+ (v) => v.isGift === "true" || v.status === "return"
+ ).length;
const oldlen = this.order.old.list.reduce((prve, cur) => {
- const arr = cur.info.filter((v) => v.isGift === "true");
+ const arr = cur.info.filter(
+ (v) => v.isGift === "true" || v.status === "return"
+ );
prve.push(...arr);
return prve;
}, []).length;
@@ -1606,17 +1848,18 @@ export default {
}, "");
return result.substring(0, result.length - 1);
},
+
allPrice() {
const oldPrice = this.order.old.list.reduce((a, b) => {
const bTotal = b.info
- .filter((v) => v.isGift !== "true" && v.status !== "return")
+ .filter((v) => v)
.reduce((prve, cur) => {
return prve + cur.number * cur.salePrice;
}, 0);
return a + bTotal;
}, 0);
const price = this.order.list
- .filter((v) => v.isGift !== "true")
+ .filter((v) => v)
.reduce((a, b) => {
return a + b.number * b.salePrice;
}, 0);
@@ -1629,10 +1872,44 @@ export default {
this.order.seatFee.totalAmount *
(returnStatus.includes(this.order.seatFee.status) ? 0 : 1);
return (
- (oldPrice + price + +packFee + seatFee) *
+ (oldPrice + price + +packFee + seatFee - this.youhuiAllPrice) *
this.createOrder.discount
).toFixed(2);
},
+ vipDiscountPrice() {
+ if (!this.vipUser.isVip) {
+ return 0;
+ }
+ const oldMemberPrice = this.order.old.list.reduce((a, b) => {
+ const bTotal = b.info
+ .filter(
+ (v) =>
+ v.isGift !== "true" &&
+ v.status !== "return" &&
+ v.memberPrice &&
+ v.memberPrice != v.salePrice
+ )
+ .reduce((prve, cur) => {
+ return prve + cur.number * (cur.salePrice - cur.memberPrice);
+ }, 0);
+ return a + bTotal;
+ }, 0);
+ const nowMemberprice = this.order.list
+ .filter(
+ (v) =>
+ v.isGift !== "true" &&
+ v.status !== "return" &&
+ v.memberPrice &&
+ v.memberPrice != v.salePrice
+ )
+ .reduce((a, b) => {
+ return a + b.number * (b.salePrice - b.memberPrice);
+ }, 0);
+ return (oldMemberPrice + nowMemberprice).toFixed(2);
+ },
+ youhuiAllPrice() {
+ return (this.vipDiscountPrice * 1 + this.allGiftMoney * 1).toFixed(2);
+ },
allNumber() {
const oldNumber = this.order.old.list.reduce((a, b) => {
const bTotal = b.info.reduce((prve, cur) => {
@@ -1691,6 +1968,13 @@ export default {
this.goods.status = "loadmore";
this.getGoods();
},
+ currentPayMoney: function (newval) {
+ if (this.createOrder.data.memberId || this.vipUser.id) {
+ this.getCalcUsablePoints().then((res) => {
+ this.pointsValueChange(this.points.value);
+ });
+ }
+ },
"useTypes.sel": function (newval, oldval) {
console.log(newval);
this.setPostPay();
@@ -1707,23 +1991,24 @@ export default {
// })
}
},
- table(newval, oldval) {
- this.setPostPay();
- this.setUseType();
- if(oldval.tableId&&newval.tableId){
- this.perpole = 1;
- this.isCreateOrder = false;
- }
- if(this.key=='isJieZhang'){
- this.isCreateOrder = false;
- this.key=''
- }
- if (newval && newval.tableId) {
- this.createOrder.data.amount = 0;
- this.createOrder.data.id = "";
- this.onTableChange();
- }
- },
+ // table(newval, oldval) {
+ // this.setPostPay();
+ // this.setUseType();
+ // if (oldval.tableId && newval.tableId) {
+ // this.perpole = 1;
+ // this.isCreateOrder = false;
+ // }
+ // if (this.key == "isJieZhang") {
+ // this.isCreateOrder = false;
+ // this.key = "";
+ // return;
+ // }
+ // if (newval && newval.tableId) {
+ // this.createOrder.data.amount = 0;
+ // this.createOrder.data.id = "";
+ // this.onTableChange();
+ // }
+ // },
masterId: function (val) {
console.log(val);
},
@@ -1732,7 +2017,7 @@ export default {
this.createOrder.discount = 1;
}
},
- "vipUser.id": async function (val) {
+ "vipUser.id": function (val, oldval) {
// if (!this.table.tableId) {
// return;
// }
@@ -1742,12 +2027,21 @@ export default {
// masterId = res.masterId;
// }
// this.masterId = masterId;
+ console.log("this.createOrder.data");
+ console.log(this.createOrder.data);
$setUser({
tableId: this.table.tableId,
masterId: this.masterId,
vipUserId: val,
- orderId:this.createOrder.data.id||'',
+ orderId: this.createOrder.data.id || "",
type: val === "" ? 1 : 0,
+ }).then((res) => {
+ if (this.isCreateOrder) {
+ this.createOrder.data.memberId = val.id;
+ this.getOrderData().then(() => {
+ this.pointsValueChange(this.points.value);
+ });
+ }
});
},
"prveOrder.list.length": function (val) {
@@ -1865,6 +2159,74 @@ export default {
this.open(this.$route.query);
},
methods: {
+ lingshicaiShow() {
+ this.$refs.refPopAddCai.open();
+ },
+ delQuan(row) {
+ const index = this.quansSelArr.findIndex((v) => v.id == row.id);
+ console.log(index);
+ if (index != -1) {
+ this.quansSelArr.splice(index, 1);
+ }
+ },
+ async getCalcUsablePoints() {
+ const memberId = this.createOrder.data.memberId || this.vipUser.id;
+ if (!memberId) {
+ return;
+ }
+ const pointsRes = await $calcUsablePoints({
+ memberId: memberId,
+ orderAmount: this.currentPayMoney.toFixed(2),
+ });
+ this.points.res = pointsRes;
+ // this.points.minDeductionPoints = pointsRes.minDeductionPoints;
+ this.points.maxUsablePoints = pointsRes.maxUsablePoints;
+ if (this.points.selected) {
+ this.points.value = Math.min(
+ this.vipUser.accountPoints,
+ this.points.res.maxUsablePoints || 0
+ );
+ }
+ return pointsRes;
+ },
+ //根据积分输入值变化计算抵扣金额
+ pointsValueChange(e) {
+ console.log(e);
+ if (e == 0 || !e) {
+ return (this.points.toMoney = 0);
+ }
+ $calcDeDuctionPoints({
+ memberId: this.createOrder.data.memberId || this.vipUser.id,
+ orderAmount: this.currentPayMoney.toFixed(2),
+ points: e,
+ }).then((res) => {
+ this.points.toMoney = res * 1;
+ });
+ },
+ //积分抵扣类型改变
+ pointsChange(e) {
+ console.log(e);
+ if (e == 1) {
+ this.points.value = Math.min(
+ this.vipUser.accountPoints,
+ this.points.res.maxUsablePoints || 0
+ );
+ this.pointsValueChange(this.points.value);
+ }
+ },
+ showQuan() {
+ this.$refs.refQuans.open(
+ {
+ id: this.createOrder.data.id,
+ memberId: this.createOrder.data.memberId || this.vipUser.id,
+ },
+ [...this.quansSelArr]
+ );
+ },
+ quansConfirm(e) {
+ console.log(e);
+ this.quansSelArr = [...e];
+ },
searchInput(e) {
console.log(e);
this.tableList = $originTableList.filter((v) =>
@@ -1920,7 +2282,7 @@ export default {
if (!canJiesuan) {
return;
}
- this.$confirm("是否确认已现金收款:" + this.allPrice + "?", "快捷支付", {
+ this.$confirm("是否确认已现金收款:" + this.yinFuJinE + "?", "快捷支付", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
@@ -1942,7 +2304,7 @@ export default {
vipUserId: this.vipUser.id,
tableId: this.table.tableId,
note: this.note.content,
- postPay: this.postPay,
+ payAfter: this.payAfter,
orderld: this.order.orderId,
});
this.isCreateOrder = true;
@@ -2026,7 +2388,7 @@ export default {
localStorage.setItem("useType", "takeout");
} else {
//堂食
- useType = `dine-in-${this.postPay ? "after" : "before"}`;
+ useType = `dine-in-${this.payAfter ? "after" : "before"}`;
localStorage.setItem("useType", useType);
}
this.changeOrderUseType(useType);
@@ -2034,16 +2396,16 @@ export default {
//设置先付后付
setPostPay() {
// 自取
- // postPay true 后付 false 先付
+ // payAfter true 后付 false 先付
if (this.useTypes.sel == "takeout") {
- this.postPay = false;
+ this.payAfter = false;
} else {
//munchies 先付 restaurant 后付
- this.postPay = this.shopInfo.registerType == "munchies" ? false : true;
+ this.payAfter = this.shopInfo.registerType == "munchies" ? false : true;
}
- console.log('this.postPay')
- console.log(this.postPay)
+ console.log("this.payAfter");
+ console.log(this.payAfter);
},
//获取店铺信息
async getShopInfo() {
@@ -2073,20 +2435,23 @@ export default {
tableId: this.table.tableId,
num: this.perpole,
});
- this.order.seatFee = res
+ this.order.seatFee = res;
this.perpole = res.totalNumber || res.number;
return res;
},
//台桌变化时重新获取取餐号、购物车数据,如果是正在结账状态,创建订单到待支付页面
async onTableChange() {
- const perpole=this.perpole || ''
+ this.order.list = [];
+ this.order.old.list = [];
+ console.log("onTableChange");
+ const perpole = this.perpole || "";
const tableRes = await $returnTableDetail({
tableId: this.table.tableId,
});
console.log(tableRes);
- const orderId=tableRes.orderId ||this.table.orderId
+ const orderId = tableRes.orderId || this.table.orderId;
if (orderId) {
- this.getOrderData({ orderId:orderId });
+ return this.getOrderData({ orderId: orderId });
}
const res = await this.getMasterId();
this.masterId = res.masterId;
@@ -2096,6 +2461,7 @@ export default {
this.table.status == "idle" &&
!this.shopInfo.isTableFee
) {
+ this.perpole = 1;
await this.changePerpole();
}
//设置就餐类型
@@ -2111,22 +2477,11 @@ export default {
this.getCart();
}
this.getCacheOrder();
- console.log(this.isCreateOrder);
- this.perpole=perpole||this.perpole
+ this.perpole = perpole || this.perpole;
if (!this.shopInfo.isTableFee && this.table.tableId && this.perpole > 0) {
//不免餐位费
await this.changePerpole();
}
- // if (this.isCreateOrder) {
- // this.toCreateOrder(true);
- // }
- },
- // 获取台桌详情
- async getTableDetail() {
- const res = await tbShopTableGet({
- qrcode: this.table.tableId,
- });
- console.log(res);
},
//打印制作单
printOrder() {
@@ -2170,18 +2525,44 @@ export default {
shopId: localStorage.getItem("shopId"),
});
this.tableList = content.filter(
- (v) => v.status != "closed" && v.status != "cleaning"
+ (v) =>
+ v.status != "closed" &&
+ v.status != "cleaning" &&
+ v.status != "unbind"
);
$originTableList = this.tableList;
} catch (error) {
console.log(error);
}
},
+ async getTableDetail(tableId) {
+ const res = await $returnTableDetail({
+ tableId: tableId ? tableId : this.table.tableId,
+ });
+ this.table = { tableId, ...res };
+ return res;
+ },
async changeTable(item) {
- if (this.table || this.order.list.length <= 0) {
+ console.log("changeTable");
+ console.log(this.table, this.table.tableId);
+ if (
+ (this.table && this.table.tableId) ||
+ (!this.table && !this.tableId && this.order.list.length <= 0)
+ ) {
+ //台桌已选,再选台桌视为切换台桌
+ //无台桌下单,且购物车列表为空,选台桌也视为切换台桌
+ this.table = item;
+ this.tableShow = false;
+ this.setPostPay();
+ this.setUseType();
+ this.onTableChange();
+ return;
+ }
+ if (this.table && this.order.list.length <= 0) {
this.table = item;
this.tableShow = false;
console.log(this.table);
+ this.onTableChange();
return;
}
if (item.status != "idle") {
@@ -2206,13 +2587,14 @@ export default {
console.log(e);
}
}
+ this.tableShow = false;
await $choseTable({
masterId: this.masterId,
tableId: item.tableId,
isClear: res1 == "confirm" ? true : false,
});
this.table = item;
- this.tableShow = false;
+ this.onTableChange();
},
chooseDinersNumberConfirm(e) {
this.perpole = e;
@@ -2251,7 +2633,7 @@ export default {
if (!canDiscount) {
return;
}
- const { amount } = this.createOrder.data;
+ const amount = this.createOrder.data.amount - this.coupdiscount;
this.refToggle("refDiscount", true, {
amount,
discount: this.createOrder.discount * 100,
@@ -2327,7 +2709,7 @@ export default {
this.$refs.refMoneyKeyboard.open();
},
changePostPay(val) {
- this.postPay = val;
+ this.payAfter = val;
},
//改变是否打印
changeIsPrint(e) {
@@ -2386,20 +2768,47 @@ export default {
orderId: this.createOrder.data.id,
payType: this.order.payType,
});
+ if (this.order.payType == "cash") {
+ return this.$confirm(
+ "是否确认已现金收款:" + this.yinFuJinE + "?",
+ "快捷支付",
+ {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ }
+ ).then(() => {
+ this.pays();
+ });
+ }
this.pays();
},
// 支付订单
async pays() {
this.loading = true;
+ const userCouponInfos = this.quansSelArr.reduce((prve, cur) => {
+ const index = prve.findIndex((v) => v.userCouponId == cur.couponId);
+ if (index != -1) {
+ prve[index].num += cur.num;
+ } else {
+ prve.push({
+ userCouponId: cur.id,
+ num: cur.num,
+ });
+ }
+ return prve;
+ }, []);
try {
const res = await $payOrder({
tableId: this.table.tableId,
masterId: this.masterId,
orderId: this.createOrder.data.id,
payType: this.order.payType,
- vipUserId: this.vipUser.id,
+ vipUserId: this.createOrder.data.memberId || this.vipUser.id,
discount: this.createOrder.discount,
code: this.createOrder.code,
+ userCouponInfos,
+ pointsNum: this.points.value,
});
this.loading = false;
this.payOrderSuccess();
@@ -2469,15 +2878,20 @@ export default {
if (!this.shopInfo.isTableFee) {
await this.changePerpole();
}
- res = await $createOrder({
- masterId: this.order.masterId || this.masterId,
- vipUserId: this.vipUser.id,
- tableId: this.table.tableId,
- note: this.note.content,
- postPay: this.postPay,
- orderld: this.order.orderId,
- });
- this.getOrderData({ orderId: res.id });
+ if (this.order.list.length > 0) {
+ res = await $createOrder({
+ masterId: this.order.masterId || this.masterId,
+ vipUserId: this.createOrder.data.memberId || this.vipUser.id,
+ tableId: this.table.tableId,
+ note: this.note.content,
+ payAfter: this.payAfter,
+ orderld: this.order.orderId,
+ });
+ }
+ await this.getOrderData(
+ res ? { orderId: res.id } : { orderId: this.createOrder.data.id }
+ );
+ res = true;
} catch (error) {}
if (!res) {
this.createOrder.status = "success";
@@ -2485,9 +2899,9 @@ export default {
}
//后付款
this.createOrder.status = "success";
- this.order.list=[];
+ this.order.list = [];
// this.getCart();
- if (this.postPay && !isNowPay) {
+ if (this.payAfter && !isNowPay) {
this.$notify({
title: "下单成功",
type: "success",
@@ -2495,8 +2909,7 @@ export default {
return this.close();
}
if (!this.isPrverOrder) {
- const { masterId } = await this.getMasterId();
- this.masterId = masterId;
+ await this.getMasterId();
}
this.isCreateOrder = true;
},
@@ -2587,7 +3000,7 @@ export default {
//右侧控制按钮点击事件
orderBtnsClick(key) {
const orderGoods = this.order.list[this.order.selIndex];
- if (this.key != "isJieZhang" && this.postPay) {
+ if (this.key != "isJieZhang" && this.payAfter) {
this.createOrderClose();
}
if (key === "sku") {
@@ -2638,7 +3051,8 @@ export default {
return;
}
if (key === "returnCart") {
- this.refToggle("refReturnCart", true);
+ const selGoods = this.order.old.list[this.order.old.selIndex];
+ this.refToggle("refReturnCart", true, selGoods);
}
},
//选择挂单确认
@@ -2990,7 +3404,7 @@ export default {
}
} else {
//添加
- console.log(this.table)
+ console.log(this.table);
res = await addCart({
masterId: this.masterId,
vipUserId: this.vipUser.id,
@@ -3141,9 +3555,9 @@ export default {
this.order.seatFee = seatFee
? {
...seatFee,
- totalNumber: seatFee.num||seatFee.number,
+ totalNumber: seatFee.num || seatFee.number,
num: seatFee.number,
- name: seatFee.name|| seatFee.productName,
+ name: seatFee.name || seatFee.productName,
totalAmount: seatFee.priceAmount || seatFee.totalAmount,
}
: this.order.seatFee;
@@ -3288,6 +3702,9 @@ export default {
} else {
//增加
console.log(item);
+ if (item.specList.length <= 0) {
+ return this.$message.error("该商品缺少skuID,skuList是空数组");
+ }
res = await addCart({
masterId: this.masterId,
vipUserId: this.vipUser.id,
@@ -3340,16 +3757,13 @@ export default {
key = params.key,
perpoleNumber = params.num || "";
this.key = key;
- this.perpole = perpoleNumber;
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;
}
@@ -3362,7 +3776,7 @@ export default {
this.masterId = params.masterId;
}
if (key == "isJieZhang") {
- this.postPay = false;
+ this.payAfter = false;
} else {
this.setPostPay();
}
@@ -3371,9 +3785,8 @@ export default {
this.getCategory();
this.getTable();
console.log(params);
-
+
if (key == "isJieZhang") {
- this.table = params.tableId ? { name: item.name } : "";
if (params.orderId) {
const orderRes = await this.getOrderData(params);
if (orderRes.status != "unpaid") {
@@ -3383,13 +3796,11 @@ export default {
this.isCreateOrder = true;
return;
}
- if( key == "isPayOrder" ){
- this.isCreateOrder =true
+ if (key == "isPayOrder") {
+ this.isCreateOrder = true;
}
- if(params.orderId) {
- const orderRes = await this.getOrderData(params);
- }
-
+ this.perpole = perpoleNumber;
+
// this.getCart();
// this.getCacheOrder();
// if (!params) {
@@ -3404,26 +3815,45 @@ export default {
? item.useType
: item.useType.replace(/-after|-before/g, "");
}
-
this.table = params.tableId ? item : "";
+ if (params.tableId) {
+ this.onTableChange();
+ }
},
+
async getOrderData(params) {
- const orderId= params ? params.orderId : this.createOrder.data.id
-
+ const orderId = params ? params.orderId : this.createOrder.data.id;
+
const res = await tbOrderInfoDetail(
params ? params.orderId : this.createOrder.data.id
);
- if(res.memberId){
- $activateByOrderId({
- orderId,memberId:res.memberId
- })
+ this.masterId = res.masterId ? res.masterId : this.masterId;
+ if (res.tableId) {
+ await this.getTableDetail(res.tableId);
}
-
+ //空闲并且免餐位费设置默认就餐人数1
+ if (this.table.tableId && !this.shopInfo.isTableFee) {
+ this.perpole = res.seatInfo ? res.seatInfo.num : 1;
+ await this.changePerpole();
+ }
+ this.createOrder.data = res;
+ if (res.memberId) {
+ await this.getCalcUsablePoints();
+ queryAllShopUser({ id: res.memberId }).then((res) => {
+ if (res.content[0]) {
+ this.vipUser = res.content[0];
+ this.points.maxUsablePoints = Math.min(
+ this.points.maxUsablePoints,
+ this.vipUser.accountPoints || 0
+ );
+ }
+ });
+ }
+
if (res.status != "unpaid") {
return res;
}
- this.createOrder.data = res;
this.order.packFee.totalAmount = res.seatInfo || { totalAmount: 0 };
const goodsMap = {};
for (let i in res.detailList) {
@@ -3436,21 +3866,6 @@ export default {
}
}
}
- this.order.seatFee = res.seatInfo
- ? {
- ...res.seatInfo,
- totalNumber: res.seatInfo.num,
- number: res.seatInfo.num,
- name: res.seatInfo.productName,
- totalAmount: res.seatInfo.priceAmount,
- }
- : {
- name: "客座费",
- number: res.seatCount || 0,
- totalNumber: res.seatCount || 0,
- totalAmount: res.seatAmount || 0,
- status: "",
- };
this.order.old.list = Object.entries(goodsMap).map(([key, value]) => ({
info: value.map((v) => {
return {
@@ -3511,6 +3926,18 @@ export default {