-
-
¥{{ skuGoods.data.salePrice | to2 }}
-
-
{{ skuText }}
-
库存:{{ skuGoods.data.stockNumber || 0 }}
+
+
+
+
¥ {{ skuGoods.data.salePrice | to2 }}
+
+ {{ skuText }}
+ 库存:{{ skuGoods.data.stockNumber || 0 }}
+
+
+
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -1305,10 +1339,7 @@ export default {
},
skuGoods: {
number: 1,
- data: {
- stockNumber: 0,
- salePrice: 0,
- },
+ data: undefined,
},
selGoods: {
isEdit: false,
@@ -1324,12 +1355,13 @@ export default {
informationdialogshow: false,
informationdialogshowedit: false,
goods: {
+ status:'loadmore',//loadmore end
list: [],
query: {
productId: "",
categoryId: "",
page: 1,
- size: 20,
+ size: 66,
},
loading: false,
total: 0,
@@ -1566,13 +1598,22 @@ export default {
this.selGoods.show = false;
},
CanConfirm() {
- if (!this.selGoods.skuList.length) {
- return true;
- }
- return (
- this.selGoods.skuList.filter((v) => v.sel !== "").length !==
- this.selGoods.skuList.length
- );
+ // if (!this.skuGoods.data) {
+ // return;
+ // }
+ // if (!this.selGoods.skuList.length) {
+ // return true;
+ // }
+ // const canBuyArr = this.selGoods.skuList.filter((v) =>
+ // isCanBuy(v, this.selGoods.isStock)
+ // );
+ // if (canBuyArr.length <= 0) {
+ // return true;
+ // }
+ // return (
+ // this.selGoods.skuList.filter((v) => v.sel !== "").length !==
+ // this.selGoods.skuList.length
+ // );
},
},
filters: {
@@ -1596,6 +1637,7 @@ export default {
"goods.query.categoryId": function (newval) {
this.goods.query.page = 1;
this.goods.list = [];
+ this.goods.status='loadmore'
this.getGoods();
},
"useTypes.sel": function (newval, oldval) {
@@ -2340,14 +2382,14 @@ export default {
// 获取取餐号
async getMasterId() {
- const res=await $getMasterId({
- tableId: this.table.tableId,
- orderId: this.table.orderId,
- vipUserId: this.vipUser.id,
- useType: this.useTypes.sel == "takeout" ? "takeout" : ""
- })
- this.masterId=res.masterId;
- return res
+ const res = await $getMasterId({
+ tableId: this.table.tableId,
+ orderId: this.table.orderId,
+ vipUserId: this.vipUser.id,
+ useType: this.useTypes.sel == "takeout" ? "takeout" : "",
+ });
+ this.masterId = res.masterId;
+ return res;
},
onSelGoodsSkuClose() {
this.selGoods.isEdit = false;
@@ -2900,7 +2942,7 @@ export default {
.filter((v) => v.specSnap.match(i))
.every((v) => {
// return isCanBuy(v,this.selGoods.data.isStock)
- return !isCanBuy(v, true);
+ return !isCanBuy(v, this.selGoods.data);
});
}
}
@@ -3023,7 +3065,7 @@ export default {
return prve;
}, {});
const canBudyGoods = this.selGoods.data.specList
- .filter((v) => isCanBuy(v, true))
+ .filter((v) => isCanBuy(v, this.selGoods.data))
.sort((a, b) => {
const aNumber = a.specSnap.split(",").reduce((prve, cur) => {
return prve + skuMapNumber[cur];
@@ -3037,6 +3079,7 @@ export default {
},
//设置商品默认选中,规格禁止以及选中
setSkugoodsDefaultInit() {
+ this.skuGoods.data = undefined;
const skuList = this.selGoods.skuList;
const goodsListMap = this.selGoods.skuMap;
const skuGoods = this.findGoods(skuList, goodsListMap);
@@ -3125,6 +3168,10 @@ export default {
}
},
async getGoods() {
+ if(this.goods.status=='end'){
+ return
+ }
+ this.goods.status='loadmore'
const res = await getGoodsLists(this.goods.query);
let $goodsMap = {};
const goods = res.records.filter((v) => {
@@ -3143,6 +3190,7 @@ export default {
for (let i in goods) {
this.goods.list.push(goods[i]);
}
+ this.goods.status= this.goods.list.length>=res.total ? 'end' : 'loadmore'
this.goods.total = res.total;
this.$goodsData = goods;
},
diff --git a/src/views/tool/Instead/util.js b/src/views/tool/Instead/util.js
index 3b7bd4d..6967221 100644
--- a/src/views/tool/Instead/util.js
+++ b/src/views/tool/Instead/util.js
@@ -1,6 +1,13 @@
//判断商品是否可以下单
-export function isCanBuy(goods,isStock) {
- return goods.isGrounding && goods.isPauseSale == 0 && (isStock?goods.stockNumber > 0:true) ;
+export function isCanBuy(skuGoods,goods) {
+ if(goods.typeEnum=='normal'){
+ //单规格
+ return goods.isGrounding&&goods.isPauseSale==0&&(goods.isStock?goods.stockNumber>0:true);
+ }else{
+ //多规格
+ return goods.isGrounding&&goods.isPauseSale==0&&skuGoods.isGrounding&&skuGoods.isPauseSale==0&&(goods.isStock?goods.stockNumber>0:true);
+
+ }
}
// 一个数组是否包含另外一个数组全部元素
@@ -15,6 +22,8 @@ export function arrayContainsAll(arr1, arr2) {
//n项 n-1项组合,生成全部结果
export function generateCombinations(arr, k) {
+ console.log(arr)
+ console.log(k)
let result = [];
function helper(index, current) {
From 709036c05022f96b7d412d9c6bbc63e8555df2bb Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Fri, 25 Oct 2024 14:50:52 +0800
Subject: [PATCH 06/10] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A0=E5=8F=B0?=
=?UTF-8?q?=E6=A1=8C=E4=B8=8B=E5=8D=95=E5=88=87=E6=8D=A2=E5=8F=B0=E6=A1=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/table.js | 11 +++
.../tool/Instead/components/scan-pay.vue | 35 ++++----
src/views/tool/Instead/index.vue | 84 ++++++++++++++-----
3 files changed, 97 insertions(+), 33 deletions(-)
diff --git a/src/api/table.js b/src/api/table.js
index 57bf688..1a691c3 100644
--- a/src/api/table.js
+++ b/src/api/table.js
@@ -450,3 +450,14 @@ export function $returnOrder(data) {
}
});
}
+//获取台桌详情状态
+export function $returnTableDetail(data) {
+ return request({
+ url: '/api/tbShopTable/state',
+ method: "get",
+ params:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
diff --git a/src/views/tool/Instead/components/scan-pay.vue b/src/views/tool/Instead/components/scan-pay.vue
index fd68e0e..a4c7099 100644
--- a/src/views/tool/Instead/components/scan-pay.vue
+++ b/src/views/tool/Instead/components/scan-pay.vue
@@ -118,6 +118,7 @@ export default {
number: "0",
show: false,
timer: null,
+ payPar:{}
};
},
watch: {
@@ -136,18 +137,10 @@ export default {
this.$refs.refInputCode.focus();
});
} else {
+ this.getPayUrl()
this.tips = "请用户使用微信/支付宝扫描付款码";
this.startGetOrderInfo();
- this.$nextTick(() => {
- QRCode.toCanvas(
- this.$refs.canvas,
- this.paymentQrcode,{width: 160,
- height: 160,},
- function (error) {
- console.log(error);
- }
- );
- });
+
}
},
number(newval) {
@@ -193,14 +186,28 @@ export default {
this.close();
this.$emit("confirm", this.form.code);
},
+ getPayUrl(){
+ $getOrderPayUrl(this.payPar).then((res) => {
+ console.log(res);
+ this.paymentQrcode = res;
+ this.$nextTick(() => {
+ QRCode.toCanvas(
+ this.$refs.canvas,
+ this.paymentQrcode,{width: 160,
+ height: 160,},
+ function (error) {
+ console.log(error);
+ }
+ );
+ });
+ });
+ },
open(data) {
this.show = true;
this.form.money = Number(this.price).toFixed(2);
+ this.payPar=data
if (this.openSwitch) {
- $getOrderPayUrl({ orderId: this.order.id||data.id,payAmount:this.form.money||data.settlementAmount }).then((res) => {
- console.log(res);
- this.paymentQrcode = res;
- });
+ // this.getPayUrl();
}
this.$nextTick(() => {
this.$refs.refInputCode.focus();
diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue
index 0ad93a2..38864c5 100644
--- a/src/views/tool/Instead/index.vue
+++ b/src/views/tool/Instead/index.vue
@@ -54,7 +54,7 @@
@click="changeTable(item, index)"
>
{{ item.name }}
-
+
{{
status[item.status] ? status[item.status].label : ""
}}