-
-
¥{{ 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) {