+
@@ -972,62 +1409,116 @@
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
-
+
-
+
@@ -1054,8 +1545,6 @@ import popupWeightGoods from "./components/popup-weight-goods.vue";
import dialogpackage from "./components/dialogpackage.vue";
import transfertoPinpin from "./components/transfertoPinpin.vue";
-
-
import dayjs from "dayjs";
import { tbShopInfo } from "@/api/user";
import { hasPermission } from "@/utils/limits.js";
@@ -1108,11 +1597,13 @@ import { returnProductCoupAllPrice } from "./quan_util.js";
let $goodsPayPriceMap = {};
import { $status } from "@/utils/table.js";
import PopupChooseGuazhang from "./components/popup-choose-guazhang.vue";
+import { forEach } from "jszip";
let $originTableList = [];
export default {
components: {
- popupWeightGoods, popQuanHexiao,
+ popupWeightGoods,
+ popQuanHexiao,
popupChooseGuazhang,
cartChangePrice,
popTuanQuan,
@@ -1131,7 +1622,7 @@ export default {
chooseDinersNumber,
PopupChooseGuazhang,
dialogpackage,
- transfertoPinpin
+ transfertoPinpin,
},
data() {
return {
@@ -1354,14 +1845,27 @@ export default {
};
},
computed: {
+ cktableList() {
+ // 使用 reduce 方法统计指定值出现的次数
+ // const count = this.tableList.reduce((acc, cur) => {
+ // if (cur.status == "using") {
+ // return acc + 1;
+ // }
+ // return acc;
+ // }, 0);
+ if(this.tableList){
+ let res = this.tableList.filter((i)=>i.status == 'using')
+ return res.length >=2 ?true:false
+ }else{
+ return false
+ }
+ },
returnPrintText() {
if (this.order.selIndex < 0) {
return "免厨打";
}
- const cart = this.order.list[this.order.selIndex]
- return (cart.isPrint || cart.isPrint === null)
- ? "免厨打"
- : "打印";
+ const cart = this.order.list[this.order.selIndex];
+ return cart.isPrint || cart.isPrint === null ? "免厨打" : "打印";
},
returnWaingText() {
if (this.order.selIndex < 0) {
@@ -1387,11 +1891,14 @@ export default {
},
gaijia() {
if (!this.createOrder.data.amount) {
- return 0
+ return 0;
}
const disCountOriginPrice =
this.createOrder.data.amount - this.productCouponDiscountAmount;
- const discountPrice = ((1 - this.createOrder.discount) * disCountOriginPrice).toFixed(2)
+ const discountPrice = (
+ (1 - this.createOrder.discount) *
+ disCountOriginPrice
+ ).toFixed(2);
return discountPrice;
},
pointsCanDicountMoney() {
@@ -1410,15 +1917,19 @@ export default {
return n;
},
productCouponDiscountAmount() {
- const n = this.quansSelArr.filter(v => v.type == 2).reduce((prve, cur) => {
- return prve + cur.discountAmount * 1;
- }, 0);
+ const n = this.quansSelArr
+ .filter((v) => v.type == 2)
+ .reduce((prve, cur) => {
+ return prve + cur.discountAmount * 1;
+ }, 0);
return n;
},
fullCouponDiscountAmount() {
- const n = this.quansSelArr.filter(v => v.type == 1).reduce((prve, cur) => {
- return prve + cur.discountAmount * 1;
- }, 0);
+ const n = this.quansSelArr
+ .filter((v) => v.type == 1)
+ .reduce((prve, cur) => {
+ return prve + cur.discountAmount * 1;
+ }, 0);
return n;
},
currentPayMoney() {
@@ -1426,7 +1937,11 @@ export default {
const discount = this.createOrder.discount || 1;
// const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney)
// const total = amount - this.gaijia - this.coupdiscount;
- const total = amount - this.productCouponDiscountAmount - this.gaijia - this.fullCouponDiscountAmount;
+ const total =
+ amount -
+ this.productCouponDiscountAmount -
+ this.gaijia -
+ this.fullCouponDiscountAmount;
return total <= 0 ? 0 : total;
},
yinFuJinE() {
@@ -1445,9 +1960,9 @@ export default {
this.order.selIndex >= 0 ||
!this.order.selGoods ||
this.order.old.list.length <= 0 ||
- this.order.selGoods.status == "return"
- || this.order.selGoods.useType == 'dine-in'
- || this.order.selGoods.useType == 'dine-in-before'
+ this.order.selGoods.status == "return" ||
+ this.order.selGoods.useType == "dine-in" ||
+ this.order.selGoods.useType == "dine-in-before"
);
},
title() {
@@ -1634,8 +2149,8 @@ export default {
const cartNumber = this.order.list.reduce((a, b) => {
return a + b.number * 1;
}, 0);
- const total = oldNumber + cartNumber
- return (Math.floor(total) == total ? total : total.toFixed(2));
+ const total = oldNumber + cartNumber;
+ return Math.floor(total) == total ? total : total.toFixed(2);
},
selGoodsHide() {
this.selGoods.show = false;
@@ -1855,7 +2370,7 @@ export default {
const oldGoods = this.order.old.list.find((v) => {
return v.productId === productId && v.skuId === skuId;
});
- const newNum = this.order.number + (oldGoods ? oldGoods.number : 0)
+ const newNum = this.order.number + (oldGoods ? oldGoods.number : 0);
$updateCart({
cartId: item.id,
productId,
@@ -1897,7 +2412,7 @@ export default {
methods: {
//美团抖音团购券核销弹窗
refQuanHexiaoOpen() {
- this.$refs.refQuanHexiao.open()
+ this.$refs.refQuanHexiao.open();
},
//称重商品弹窗
refWeightGoodsShow(item) {
@@ -1905,13 +2420,20 @@ export default {
},
//称重商品确认
async refWeightGoodsConfirm(item, number) {
- console.log(item)
- console.log(number)
- this.goodsClick(item, number, true)
+ console.log(item);
+ console.log(number);
+ this.goodsClick(item, number, true);
},
//套餐下单
async dialogpackageconfirm(item, multipleSelection) {
- this.goodsClick(item, 1, true, multipleSelection.flatMap(subArray => subArray.map(item => item.proId)))
+ this.goodsClick(
+ item,
+ 1,
+ true,
+ multipleSelection.flatMap((subArray) =>
+ subArray.map((item) => item.proId)
+ )
+ );
},
//挂账人支付确认
guazhangPayConfirm(guazhangren, price) {
@@ -1937,7 +2459,7 @@ export default {
updateCartItem(res) {
if (res) {
// this.order.list[this.order.selIndex] = res;
- this.$set(this.order.list, this.order.selIndex, res)
+ this.$set(this.order.list, this.order.selIndex, res);
}
},
// 单品改价
@@ -2251,7 +2773,7 @@ export default {
this.shopInfo = res;
this.setPostPay();
this.setUseType();
- } catch (error) { }
+ } catch (error) {}
},
//更改就餐方式
changeUseType(type) {
@@ -2336,7 +2858,7 @@ export default {
});
});
})
- .catch(() => { });
+ .catch(() => {});
},
//退菜
async refReturnCartConfirm(e) {
@@ -2495,9 +3017,9 @@ export default {
if (!canDiscount) {
return;
}
- const amount = (this.createOrder.data.amount - this.productCouponDiscountAmount).toFixed(
- 2
- );
+ const amount = (
+ this.createOrder.data.amount - this.productCouponDiscountAmount
+ ).toFixed(2);
console.log(amount);
this.refToggle("refDiscount", true, {
amount,
@@ -2768,7 +3290,7 @@ export default {
res ? { orderId: res.id } : { orderId: this.createOrder.data.id }
);
res = true;
- } catch (error) { }
+ } catch (error) {}
if (!res) {
this.createOrder.status = "success";
return;
@@ -2842,8 +3364,8 @@ export default {
});
},
keyboradAdd(n) {
- if (this.selGoods.isSku != 'weight' && n == '.') {
- return
+ if (this.selGoods.isSku != "weight" && n == ".") {
+ return;
}
if (Number(this.keyborad.number) === 0) {
return (this.keyborad.number = n);
@@ -2873,12 +3395,12 @@ export default {
},
changeKeyboradShow(show) {
if (show) {
- this.selGoods = this.order.list[this.order.selIndex]
+ this.selGoods = this.order.list[this.order.selIndex];
this.keyborad.number = `${this.order.list[this.order.selIndex].number}`;
}
this.keyborad.show = show;
if (!show) {
- this.selGoods = ''
+ this.selGoods = "";
}
},
// 获取本地缓存挂单
@@ -2891,25 +3413,15 @@ export default {
// });
// },
clicktransfertoPinpin() {
- // 使用 reduce 方法统计指定值出现的次数
- const count = this.tableList.reduce((acc, cur) => {
- if (cur.status == 'using') {
- return acc + 1;
- }
- return acc;
- }, 0);
- console.log(count)
- if (count >= 2) {
+
// console.log(this.order, this.masterId, this.table.tableId, this.tableList)
// 订单信息,取餐码,用餐类型,桌台号id,台桌列表
- this.$refs.refransfertoPinpin.open(this.order, this.masterId, this.table.tableId, this.tableList);
- } else {
- this.$message({
- message: '暂无可转台桌!',
- type: 'warning'
- })
- return false;
- }
+ this.$refs.refransfertoPinpin.open(
+ this.order,
+ this.masterId,
+ this.table.tableId,
+ this.tableList
+ );
},
//右侧控制按钮点击事件
async orderBtnsClick(key) {
@@ -2938,7 +3450,8 @@ export default {
return this.removeCart();
}
if (key === "print") {
- const isPrint = (orderGoods.isPrint || orderGoods.isPrint === null) ? true : false;
+ const isPrint =
+ orderGoods.isPrint || orderGoods.isPrint === null ? true : false;
this.updateOrder({ isPrint: !isPrint });
return;
}
@@ -2952,10 +3465,10 @@ export default {
orderId: this.createOrder.data.id,
masterId: this.masterId,
tableId: this.table.tableId,
- isWaitCall: !this.isAllWaitCall ? 1 : 0
- })
+ isWaitCall: !this.isAllWaitCall ? 1 : 0,
+ });
this.isAllWaitCall = !this.isAllWaitCall;
- this.getCart()
+ this.getCart();
return;
}
if (key === "save") {
@@ -2993,7 +3506,7 @@ export default {
} else {
selGoods =
this.order.old.list[this.order.selPlaceNum - 1].info[
- this.order.old.selIndex
+ this.order.old.selIndex
];
}
console.log(selGoods);
@@ -3212,7 +3725,7 @@ export default {
});
});
})
- .catch(() => { });
+ .catch(() => {});
},
skuNumberAdd() {
const number = Number(this.skuGoods.number);
@@ -3285,9 +3798,9 @@ export default {
name = name.substring(0, name.length - 1);
// const item = this.selGoods.data.specList.find((v) => v.specSnap === name);
const item = this.selGoods.skuMap[name];
- console.log(this.selGoods, '调试1')
- console.log(name, '调试2')
- console.log(item, '调试1')
+ console.log(this.selGoods, "调试1");
+ console.log(name, "调试2");
+ console.log(item, "调试1");
if (!item.isGrounding) {
//该商品已经下架
return this.$notify({
@@ -3361,7 +3874,7 @@ export default {
tableId: this.table.tableId,
num: this.skuGoods.number, // 0会删除此商品
isPack: false, // 是否打包
- isWaitCall: this.isAllWaitCall //是否等叫
+ isWaitCall: this.isAllWaitCall, //是否等叫
});
this.orderListPush({ ...res, specSnap: name });
// this.orderListPush({
@@ -3500,7 +4013,7 @@ export default {
this.order.orderId = "";
this.perpole = "";
this.useTypes.sel = "dine-in";
- this.getTable()
+ this.getTable();
},
//设置购物车数据
setCart(res) {
@@ -3509,12 +4022,12 @@ export default {
const { seatFee } = res;
this.order.seatFee = seatFee
? {
- ...seatFee,
- totalNumber: seatFee.num || seatFee.number,
- num: seatFee.number,
- name: seatFee.name || seatFee.productName,
- totalAmount: seatFee.priceAmount || seatFee.totalAmount,
- }
+ ...seatFee,
+ totalNumber: seatFee.num || seatFee.number,
+ num: seatFee.number,
+ name: seatFee.name || seatFee.productName,
+ totalAmount: seatFee.priceAmount || seatFee.totalAmount,
+ }
: this.order.seatFee;
console.log(this.order.seatFee);
this.perpole = res.seatFee ? res.seatFee.totalNumber : 1;
@@ -3527,30 +4040,31 @@ export default {
console.log(this.order.old.list);
} catch (error) {
//当购物车数据发生错误时会导致页面报错购物车商品不展示
- this.$confirm('购物车数据结构错误,是否清空购物车商品?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- $clearCart({
- masterId: this.masterId,
- tableId: this.table.tableId,
- }).then((res) => {
- this.order.list = [];
- this.changeOrderSel(-1);
+ this.$confirm("购物车数据结构错误,是否清空购物车商品?", "提示", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ $clearCart({
+ masterId: this.masterId,
+ tableId: this.table.tableId,
+ }).then((res) => {
+ this.order.list = [];
+ this.changeOrderSel(-1);
+ this.$message({
+ type: "success",
+ message: "清除成功!",
+ });
+ });
+ })
+ .catch(() => {
this.$message({
- type: "success",
- message: "清除成功!",
+ type: "info",
+ message: "已取消",
});
});
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消'
- });
- });
}
-
},
//获取购物车数据
async getCart() {
@@ -3642,18 +4156,22 @@ export default {
}
},
//根据右侧商品单规格多规格做不同处理
- async goodsClick(item, number = 0, isConfirm = false, multipleSelection = '') {
-
+ async goodsClick(
+ item,
+ number = 0,
+ isConfirm = false,
+ multipleSelection = ""
+ ) {
// if (!this.table) {
// return this.$message.error("暂不支持无桌台下单,请先选择桌台");
// }
- if (item.type == 'weigh' && !isConfirm) {
- return this.refWeightGoodsShow(item)
+ if (item.type == "weigh" && !isConfirm) {
+ return this.refWeightGoodsShow(item);
}
// 这是套餐
- if (item.type == 'package' && !isConfirm) {
+ if (item.type == "package" && !isConfirm) {
this.$refs.refdialogpackage.open(item);
- return false
+ return false;
}
if (item.typeEnum === "sku") {
this.selGoods.data = item;
@@ -3686,7 +4204,7 @@ export default {
// tableId: this.table.tableId,
// num: orderGoods.number * 1 + item.specList[0].suit, // 0会删除此商品
// });
- const suit = number || item.specList[0].suit
+ const suit = number || item.specList[0].suit;
orderGoods.number += suit * 1;
this.order.number = orderGoods.number;
this.changeOrderSel(orderGoodsIndex);
@@ -3705,7 +4223,7 @@ export default {
num: number || item.specList[0].suit, // 0会删除此商品
isPack: false, // 是否打包
isWaitCall: this.isAllWaitCall, //是否等叫
- groupProductIdList: multipleSelection
+ groupProductIdList: multipleSelection,
});
this.orderListPush(res);
}
@@ -3740,13 +4258,13 @@ export default {
},
async open(params) {
const item = {
- name: params.table_name,
- tableId: params.tableId,
- useType: params.useType,
- maxCapacity: params.maxCapacity * 1,
- masterId: params.masterId,
- orderId: params.orderId,
- },
+ name: params.table_name,
+ tableId: params.tableId,
+ useType: params.useType,
+ maxCapacity: params.maxCapacity * 1,
+ masterId: params.masterId,
+ orderId: params.orderId,
+ },
key = params.key,
perpoleNumber = params.num || "";
this.key = key;
@@ -4516,7 +5034,9 @@ input[type="number"]::-webkit-outer-spin-button {
display: none !important;
}
-::v-deep .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner {
+::v-deep
+ .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled)
+ .el-radio__inner {
box-shadow: none !important;
}
@@ -4709,7 +5229,8 @@ input[type="number"]::-webkit-outer-spin-button {
margin-bottom: 10px;
}
- .order-list-all {}
+ .order-list-all {
+ }
.order {
border-radius: 6px;
@@ -5208,7 +5729,11 @@ input[type="number"]::-webkit-outer-spin-button {
.weight {
height: 15px;
- background: linear-gradient(124deg, rgb(115, 201, 105) 6%, rgb(39, 146, 27) 93%);
+ background: linear-gradient(
+ 124deg,
+ rgb(115, 201, 105) 6%,
+ rgb(39, 146, 27) 93%
+ );
border-radius: 2px;
font-size: 12px;
text-align: center;
@@ -5412,7 +5937,7 @@ input[type="number"]::-webkit-outer-spin-button {
border: none;
}
-.pay_btns .el-button+.el-button {
+.pay_btns .el-button + .el-button {
margin-left: 0;
}
@@ -5432,4 +5957,4 @@ input[type="number"]::-webkit-outer-spin-button {
max-width: 340px;
word-break: break-all;
}
-
\ No newline at end of file
+