{{ scope.row.name ? scope.row.name : '-' }}
+
+
+ {{ scope.row.useTime ? scope.row.useTime : '-' }}
+
+ {{ scope.row.source == 'activate' ? '充值活动' :
+ scope.row.source == 'invited' ? '好友分享' : '' }}
+
+
-
未使用
+ 未使用
{{ scope.row.overNum }}/{{ scope.row.num }}
已使用
{{ scope.row.tableName ? scope.row.tableName : '-' }}
+
+
diff --git a/src/views/coupon_manage/coupon_list.vue b/src/views/coupon_manage/coupon_list.vue
index 7a7d802..d334361 100644
--- a/src/views/coupon_manage/coupon_list.vue
+++ b/src/views/coupon_manage/coupon_list.vue
@@ -22,11 +22,12 @@
{{ `领券后${scope.row.validDays}天过期` }}
-->
-
+
@@ -57,7 +58,7 @@
item.saleAmount)
];
- console.log(p1);
- console.log(p2);
+ // console.log(p1);
+ // console.log(p2);
- this.initProduceChart(p1, p2);
+ // this.initProduceChart(p1, p2);
} catch (error) {
console.log(error);
}
diff --git a/src/views/invoicing/supplier_manage/purchase_detail.vue b/src/views/invoicing/supplier_manage/purchase_detail.vue
index 38e582c..1251f87 100644
--- a/src/views/invoicing/supplier_manage/purchase_detail.vue
+++ b/src/views/invoicing/supplier_manage/purchase_detail.vue
@@ -126,6 +126,8 @@
付款
账单付款记录
+ 出入库记录
@@ -172,12 +174,44 @@
+
+
+
diff --git a/src/views/login.vue b/src/views/login.vue
index 08a7449..6acb8bc 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -184,10 +184,8 @@ export default {
merchantName: this.loginForm.merchantName,
username: this.loginForm.username,
}))
-
-
- // this.$router.push({ path: this.redirect || '/' })
- window.location.href = './'
+ this.$router.push({ path: this.redirect || '/' })
+ // window.location.replace = './'
}).catch(() => {
this.loading = false
this.getCode()
diff --git a/src/views/order_manage/order_list.vue b/src/views/order_manage/order_list.vue
index 952e019..b158085 100644
--- a/src/views/order_manage/order_list.vue
+++ b/src/views/order_manage/order_list.vue
@@ -207,21 +207,24 @@ export default {
filters: {
orderTypeFilter(t) {
if (t) {
- return t && orderEnum.orderType.find(item => item.key == t).label;
+ const item= orderEnum.orderType.find(item => item.key == t);
+ return t && item?item.label:'';
} else {
return t;
}
},
sendTypeFilter(t) {
if (t) {
- return orderEnum.sendType.find(item => item.key == t).label;
+ const item= orderEnum.sendType.find(item => item.key == t);
+ return item?item.label:'';
} else {
return t;
}
},
statusFilter(t) {
if (t) {
- return t && orderEnum.status.find(item => item.key == t).label;
+ const item= orderEnum.status.find(item => item.key == t);
+ return t && item?item.label:'';
} else {
return t;
}
@@ -233,12 +236,10 @@ export default {
mounted() {
if (this.$route.query.tableName) {
this.query.tableName = this.$route.query.tableName
- console.log(this.$route.query.date,'体哦啊是1111')
- if(this.$route.query.date[0]){
- this.query.createdAt = this.$route.query.date
- }else{
- this.query.createdAt = []
- }
+ }
+ if (this.$route.query.timeValue) {
+ this.timeValue = this.$route.query.timeValue
+ this.timeChange(this.timeValue);
}
if (this.$route.query.orderNo) {
this.query.orderNo = this.$route.query.orderNo
diff --git a/src/views/shop/components/shopInfo.vue b/src/views/shop/components/shopInfo.vue
index 2cbec62..f55a2bd 100644
--- a/src/views/shop/components/shopInfo.vue
+++ b/src/views/shop/components/shopInfo.vue
@@ -1,7 +1,7 @@
@@ -86,6 +91,10 @@
+
+
\ No newline at end of file
diff --git a/src/views/tool/Instead/components/return-cart.vue b/src/views/tool/Instead/components/return-cart.vue
index 3b50d08..9f9e667 100644
--- a/src/views/tool/Instead/components/return-cart.vue
+++ b/src/views/tool/Instead/components/return-cart.vue
@@ -113,6 +113,7 @@ export default {
},
open(item) {
this.goods = item?item:this.goods;
+ console.log(item)
this.show = true;
if (item != "-999") {
this.number = 1;
diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue
index e219e29..f6c69d5 100644
--- a/src/views/tool/Instead/index.vue
+++ b/src/views/tool/Instead/index.vue
@@ -23,7 +23,7 @@
+
+
+
+ {{ scope.row.type == 'reject' ? '退货出库' : '供应商入库' }}
+
+
+
+
+ {{ scope.row.status == 'status' ? '正常 ' : '作废' }}
+
+
+
+
+
+
+ {{ dayjs(scope.row.stockTime).format('YYYY-MM-DD HH:mm:ss') }}
+
+
+
+
+
+ {
+ stockData.size = e;
+ stockData.page = 0;
+ gettbConsInfoFlowstock();
+ }" />
+
+
-
+
@@ -66,16 +66,12 @@
允许打包
-
-
-
-
-
+
@@ -127,11 +123,15 @@
-
+
+
+
-
+
diff --git a/src/views/tool/Instead/components/cart-item.vue b/src/views/tool/Instead/components/cart-item.vue
index 65b7197..94cd126 100644
--- a/src/views/tool/Instead/components/cart-item.vue
+++ b/src/views/tool/Instead/components/cart-item.vue
@@ -30,9 +30,7 @@
-
- 备注:{{ item.note || "" }}
-
+ 备注:{{ item.note || "" }}
备注:
@@ -69,15 +67,22 @@
-
¥0
-
- ¥{{ item.totalAmount }}
- ¥{{ (item.salePrice*item.number+(item.packAmount||0)).toFixed(2) }}
-
+
+ ¥0
+
+ ¥{{ item.totalAmount }}
+ ¥{{ isShowVipPrice ? vipAllPrice : allPrice }}
+
+
+
+ ¥{{ item.totalAmount }}
+
+
+
¥{{ vipAllPrice }}
+
+ ¥{{ allPrice }}
+
+
-
- {{ postPay ? "后付费" : "先付费" }}
+ {{ payAfter ? "后付费" : "先付费" }}
@@ -234,9 +239,7 @@
{{ vipUser.nickName }}
+
+
{{ vipUser.nickName }}
+
+ VIP{{ vipUser.isVip }}
+
+
余额:{{ vipUser.amount }}
@@ -81,7 +86,7 @@
@@ -172,7 +177,7 @@
-
+
-
- 已优惠¥{{ allGiftMoney }}
-
+
打印制作单
+
@@ -459,7 +483,7 @@
-
+
+
@@ -894,13 +1023,17 @@
-
+
+
+
+ 已优惠¥{{ youhuiAllPrice }}
+
+
+ 会员优惠
+ {{ vipDiscountPrice }}
+
+
-
+
+
+
![]()
-
+ 最小抵扣积分{{
+ points.res.minDeductionPoints
+ }}
+
+
+ *
+ {{ points.res.unusableReason || "" }}
+
+
+
{{
vipUser.id ? vipUser.nickName : "服务员下单"
}}
+
+ VIP{{ vipUser.isVip }}
+
余额:{{ vipUser.amount | to2 }}
- 积分:{{ vipUser.totalScore }}
+
+ 积分:{{ vipUser.accountPoints }}
+
+ 优惠券
+
+
+ 选择优惠券
+
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.type == 1 ? "优惠券" : "商品券" }}
+
+
+
+
+
+
+
+
+ ¥{{ scope.row.discountAmount }}
+
+
+
+
+
+ 删除
+
+
+
+
已选优惠券
+
+
+
+
+
+ {{ scope.row.productName }}
+
+ 门店优惠
-¥0.00
+
+
@@ -1233,6 +1368,16 @@
+
+
+
+
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 ||
@@ -1526,7 +1736,7 @@ export default {
},
title() {
// return this.table ? "代客下单" + `(${this.table.name})` : "代客下单";
- return '代客下单'
+ return "代客下单";
},
allGiftMoney() {
const nowprice = this.order.list
@@ -1537,7 +1747,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);
@@ -1569,9 +1779,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;
@@ -1605,17 +1819,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);
@@ -1628,10 +1843,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) => {
@@ -1690,6 +1939,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();
@@ -1706,23 +1962,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);
},
@@ -1731,7 +1988,7 @@ export default {
this.createOrder.discount = 1;
}
},
- "vipUser.id": async function (val) {
+ "vipUser.id": function (val, oldval) {
// if (!this.table.tableId) {
// return;
// }
@@ -1741,11 +1998,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 || "",
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) {
@@ -1863,6 +2130,68 @@ export default {
this.open(this.$route.query);
},
methods: {
+ 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) =>
@@ -1918,7 +2247,7 @@ export default {
if (!canJiesuan) {
return;
}
- this.$confirm("是否确认已现金收款:" + this.allPrice + "?", "快捷支付", {
+ this.$confirm("是否确认已现金收款:" + this.yinFuJinE + "?", "快捷支付", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
@@ -1940,7 +2269,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;
@@ -2024,7 +2353,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);
@@ -2032,16 +2361,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() {
@@ -2071,20 +2400,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;
@@ -2094,6 +2426,7 @@ export default {
this.table.status == "idle" &&
!this.shopInfo.isTableFee
) {
+ this.perpole = 1;
await this.changePerpole();
}
//设置就餐类型
@@ -2109,22 +2442,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() {
@@ -2168,18 +2490,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") {
@@ -2204,13 +2552,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;
@@ -2249,7 +2598,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,
@@ -2325,7 +2674,7 @@ export default {
this.$refs.refMoneyKeyboard.open();
},
changePostPay(val) {
- this.postPay = val;
+ this.payAfter = val;
},
//改变是否打印
changeIsPrint(e) {
@@ -2384,20 +2733,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.couponId,
+ 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();
@@ -2467,15 +2843,18 @@ 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";
@@ -2483,9 +2862,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",
@@ -2493,8 +2872,7 @@ export default {
return this.close();
}
if (!this.isPrverOrder) {
- const { masterId } = await this.getMasterId();
- this.masterId = masterId;
+ await this.getMasterId();
}
this.isCreateOrder = true;
},
@@ -2585,7 +2963,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") {
@@ -2636,7 +3014,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);
}
},
//选择挂单确认
@@ -2988,7 +3367,7 @@ export default {
}
} else {
//添加
- console.log(this.table)
+ console.log(this.table);
res = await addCart({
masterId: this.masterId,
vipUserId: this.vipUser.id,
@@ -3139,9 +3518,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;
@@ -3286,6 +3665,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,
@@ -3338,16 +3720,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;
}
@@ -3360,7 +3739,7 @@ export default {
this.masterId = params.masterId;
}
if (key == "isJieZhang") {
- this.postPay = false;
+ this.payAfter = false;
} else {
this.setPostPay();
}
@@ -3369,9 +3748,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") {
@@ -3381,13 +3759,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) {
@@ -3402,18 +3778,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 res = await tbOrderInfoDetail(
params ? params.orderId : this.createOrder.data.id
);
+ 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) {
@@ -3426,21 +3829,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 {
@@ -3501,6 +3889,11 @@ export default {
优惠券
- -¥0.00
+ -¥{{ coupdiscount }}
+
+
积分抵扣
+ -¥{{ points.toMoney | to2 }}
整单改价
@@ -937,7 +1070,9 @@
应付金额
¥{{
- (createOrder.data.amount * createOrder.discount) | to2
+ currentPayMoney - points.toMoney <= 0
+ ? 0
+ : (currentPayMoney - points.toMoney) | to2
}}