增加套餐

This commit is contained in:
GaoHao
2024-12-05 10:44:15 +08:00
parent e17d5ffcaa
commit 282d1673d1
3 changed files with 322 additions and 147 deletions

View File

@@ -6,12 +6,12 @@ const proxyApi = "/api"
// const proxyApi = 'http://192.168.1.15:9888/cashierService' // 王伟 // const proxyApi = 'http://192.168.1.15:9888/cashierService' // 王伟
// const proxyApi = 'http://192.168.1.27:9888/cashierService' // 帆哥 // const proxyApi = 'http://192.168.1.27:9888/cashierService' // 帆哥
// const proxyApiwws = 'ws://192.168.1.15:9888/netty' // 测试 // const proxyApiwws = 'ws://192.168.1.15:9888/netty' // 测试
// const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试 const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试 const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试
// const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布 // const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布
// const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布 // const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布
const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上 // const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上
const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上 // const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上
// #endif // #endif
// #ifdef H5 // #ifdef H5

View File

@@ -102,7 +102,7 @@
</view> </view>
<view v-else > <view v-else >
<view class="panelfiveitemNum"> <view class="panelfiveitemNum">
<view class="sku-wrap flex-center" v-if="item.productSkuResult != null" <view class="sku-wrap flex-center" v-if="item.productSkuResult != null || (item.type == 'package'&&item.groupType == 1)"
@click.stop="clickspecifications(item,index,index1)"> @click.stop="clickspecifications(item,index,index1)">
<text class="t">选规格</text> <text class="t">选规格</text>
<text class="dot num" <text class="dot num"
@@ -203,7 +203,7 @@
</view> </view>
</view> </view>
<view v-else > <view v-else >
<view class="flex-end" v-if="item1.productSkuResult != null"> <view class="flex-end" v-if="item1.productSkuResult != null || (item1.type == 'package'&&item1.groupType == 1) ">
<view class="sku-wrap flex-center" <view class="sku-wrap flex-center"
@click.stop="clickspecifications(item1,index,index1)"> @click.stop="clickspecifications(item1,index,index1)">
<text class="t">选规格</text> <text class="t">选规格</text>
@@ -300,12 +300,13 @@
v-if="specifications.tagSnap"> v-if="specifications.tagSnap">
<view class="shop_sku_box_name"> <view class="shop_sku_box_name">
{{item.name}} {{item.name}}
<text v-if="specifications.type=='package'" style="margin-left: 10rpx;">({{item.number}}/{{item.count}})</text>
</view> </view>
<!-- :class="item.start == index1 ?'shop_sku_box_item_selected':''"> --> <!-- :class="item.start == index1 ?'shop_sku_box_item_selected':''"> -->
<view class="flex-start"> <view class="flex-start">
<view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1" <view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1"
@click="morloe(item1,index,index1,item)" @click="morloe(item1,index,index1,item)"
:class="{'shop_sku_box_item_selected': item.start == index1, 'disabled': !item1.disabled || !item1.isGrounding || item1.isPauseSale==1}" :class="{'shop_sku_box_item_selected': item.start == index1 || item1.selected, 'disabled': !item1.disabled || !item1.isGrounding || item1.isPauseSale==1}"
> >
{{item1.name}} {{item1.name}}
<view class="shop_sku_box_item_tip" v-if="item1.isGrounding == false"> <view class="shop_sku_box_item_tip" v-if="item1.isGrounding == false">
@@ -407,6 +408,7 @@
shopId: "", shopId: "",
tableCode: "", tableCode: "",
orderAMeal: true, orderAMeal: true,
groupProductldList: [],
} }
}, },
onPageScroll(e) { onPageScroll(e) {
@@ -711,6 +713,9 @@
} else { } else {
num = this.skuNumber + this.amountcartNumber; num = this.skuNumber + this.amountcartNumber;
} }
if (item.type == 'package'&&item.groupType == 1) {
num = this.amountcartNumber;
}
let params = { let params = {
"skuId": this.skuId, "skuId": this.skuId,
"num": num, //数量 "num": num, //数量
@@ -721,6 +726,10 @@
"note": item.note, "note": item.note,
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
} }
//套餐数据
if ( this.groupProductldList.length > 0 ) {
params.groupProductldList = this.groupProductldList;
}
if (this.shopInfo.storeInfo.eatModel.indexOf('dine-in') != -1) { params.tableId = this.tableCode;} if (this.shopInfo.storeInfo.eatModel.indexOf('dine-in') != -1) { params.tableId = this.tableCode;}
this.addCart(params); this.addCart(params);
}, },
@@ -748,6 +757,7 @@
if (res.code == 0) { if (res.code == 0) {
this.showShopsku = false; this.showShopsku = false;
this.pagemetashow = false; this.pagemetashow = false;
this.isSpec = false;
} }
}, },
@@ -804,16 +814,23 @@
* @param {Object} index1 * @param {Object} index1
*/ */
async clickspecifications(item1, index, index1, type) { async clickspecifications(item1, index, index1, type) {
if ( item1.isPauseSale != 0 || item1.isSale == 0 ) {
return;
}
this.skuidname = [] this.skuidname = []
this.specifications = item1 this.specifications = item1
this.specifications.indexa = index this.specifications.indexa = index
this.specifications.indexb = index1 this.specifications.indexb = index1
this.specifications.typeName = type this.specifications.typeName = type
if ( item1.type == 'package'&&item1.groupType == 1 ) {
this.groupProductldList = [];
this.optionalPackage(item1, index, index1, type)
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
return;
}
if ( item1.isPauseSale != 0 || item1.isSale == 0 ) {
return;
}
try { try {
if (item1.productSkuResult == null) { if (item1.productSkuResult == null||(item1.type == 'package'&&item1.groupType == 0)) {
this.isSpec = true; this.isSpec = true;
// 但但单个规格弹框的处理 // 但但单个规格弹框的处理
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量 this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
@@ -876,7 +893,39 @@
//TODO handle the exception //TODO handle the exception
} }
}, },
/**
* 可选套餐处理
*/
optionalPackage(item1, index, index1, type) {
this.specifications = item1
this.skuidname = [];
this.specifications.tagSnap = item1.proGroupVo.map((item,index) => {
let res = {
id: item1.id, //商品id
name: item.title,
count: item.count,
number: item.number,
start: -1,
children: []
}
item.goods.forEach((v, e) => {
res.children.push({
name: v.proName,
proId: v.proId, //商品id
disabled: true,
isGrounding: true,
isPauseSale: 0,
selected: false,
})
})
return res
})
this.salePrice = this.isVip == 1 && item1.lowMemberPrice > 0 ? item1.lowMemberPrice : item1.lowPrice // 价格
this.showShopsku = true //打开弹框
console.log(this.specifications)
},
/** /**
* 规格选择监听 * 规格选择监听
* @param {Object} e * @param {Object} e
@@ -885,73 +934,114 @@
* @param {Object} item * @param {Object} item
*/ */
async morloe(e, index, index1, item) { async morloe(e, index, index1, item) {
if (!e.isGrounding || !e.disabled || e.isPauseSale == 1) { //套餐处理
return; if ( this.specifications.type == 'package'&&this.specifications.groupType == 1){
} // 当前分类下选中数量
this.isSpec = true;
let querySpecList = []; let number = 0;
this.skuBtnText = "添加到购物车"; this.skuidname = [];
this.isSpec = true; this.groupProductldList = []
// 设置当前选中下标 this.specifications.tagSnap[index].children.map(v=>{
if (this.specifications.tagSnap[index].start != index1) { if ( v.selected ) { number++ }
this.$set(this.specifications.tagSnap[index], 'start', index1) })
} else { // 判断选择数量是否大于可选数量
this.$set(this.specifications.tagSnap[index], 'start', -1) if ( number < item.number ) {
index = index - 1; this.specifications.tagSnap[index].children[index1].selected = !e.selected
} } else {
this.skuidname = []; this.specifications.tagSnap[index].children[index1].selected = false
// 选择规格下面的其他规格可点击状态重置 }
this.specifications.tagSnap.forEach((val, i, arr) => { this.specifications.tagSnap.forEach(v=>{
if (i > index) { v.children.forEach(v1=>{
val.children.forEach((v1, e1) => { if (v1.selected) {
v1.isGrounding = i == (index+1) ? false : true; this.groupProductldList.push(v1.proId)
v1.isPauseSale = i == (index+1) ? 1 : 0; }
v1.disabled = i == (index+1) ? true : false;
}) })
val.start = -1; })
// 获取下一个没有选中的分类
for (let i = 0; i < this.specifications.tagSnap.length; i++) {
let count = 0;
for (let o = 0; o < this.specifications.tagSnap[i].children.length; o++) {
if (this.specifications.tagSnap[i].children[o].selected ) {
count++
}
}
if ( count < this.specifications.tagSnap[i].number ) {
this.isSpec = false;
this.skuBtnText = `${this.specifications.tagSnap[i].name}选择数量不足`
break; // 终止循环
}
} }
if (val.start >= 0) { } else {
this.skuidname.push(val.children[val.start].name) if (!e.isGrounding || !e.disabled || e.isPauseSale == 1) {
return;
} }
})
let querySpecList = [];
this.skuBtnText = "添加到购物车";
this.isSpec = true;
// 设置当前选中下标
if (this.specifications.tagSnap[index].start != index1) {
this.$set(this.specifications.tagSnap[index], 'start', index1)
} else {
this.$set(this.specifications.tagSnap[index], 'start', -1)
index = index - 1;
}
this.skuidname = [];
// 选择规格下面的其他规格可点击状态重置
this.specifications.tagSnap.forEach((val, i, arr) => {
if (i > index) {
val.children.forEach((v1, e1) => {
v1.isGrounding = i == (index+1) ? false : true;
v1.isPauseSale = i == (index+1) ? 1 : 0;
v1.disabled = i == (index+1) ? true : false;
})
val.start = -1;
}
if (val.start >= 0) {
this.skuidname.push(val.children[val.start].name)
}
})
// 获取下一个没有选中的分类
for (let i = 0; i < this.specifications.tagSnap.length; i++) {
if (this.specifications.tagSnap[i].start < 0) {
this.isSpec = false;
this.skuBtnText = `您还没选择${this.specifications.tagSnap[i].name}`
break; // 终止循环
}
}
let filteredJson;
let isSkuidname = [];
//提前下一列规格循环,查看是否有下架规格
if (this.specifications.tagSnap[index + 1]) {
for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
// 上下架状态处理
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[index + 1].children[o].isGrounding = true;
break; // 终止循环
}
}
// 售罄状态处理
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[index + 1].children[o].isPauseSale = 0;
break; // 终止循环
}
}
}
}
this.hodgepodge(this.specifications, 2)
}
// 获取下一个没有选中的分类
for (let i = 0; i < this.specifications.tagSnap.length; i++) {
if (this.specifications.tagSnap[i].start < 0) {
this.isSpec = false;
this.skuBtnText = `您还没选择${this.specifications.tagSnap[i].name}`
break; // 终止循环
}
}
let filteredJson;
let isSkuidname = [];
//提前下一列规格循环,查看是否有下架规格
if (this.specifications.tagSnap[index + 1]) {
for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
// 上下架状态处理
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[index + 1].children[o].isGrounding = true;
break; // 终止循环
}
}
// 售罄状态处理
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[index + 1].children[o].isPauseSale = 0;
break; // 终止循环
}
}
}
}
this.$forceUpdate(); this.$forceUpdate();
this.hodgepodge(this.specifications, 2)
}, },
/** /**

View File

@@ -70,7 +70,7 @@
</view> </view>
</view> </view>
<view v-else > <view v-else >
<view class="flex-end" v-if="item1.productSkuResult != null"> <view class="flex-end" v-if="item1.productSkuResult != null || (item1.type == 'package'&&item1.groupType == 1)">
<view class="sku-wrap flex-center" <view class="sku-wrap flex-center"
@click.stop="clickspecifications(item1,index1)"> @click.stop="clickspecifications(item1,index1)">
<text class="t">选规格</text> <text class="t">选规格</text>
@@ -126,11 +126,12 @@
v-if="specifications.tagSnap"> v-if="specifications.tagSnap">
<view class="shop_sku_box_name"> <view class="shop_sku_box_name">
{{item.name}} {{item.name}}
<text v-if="specifications.type=='package'" style="margin-left: 10rpx;">({{item.number}}/{{item.count}})</text>
</view> </view>
<view class="flex-start"> <view class="flex-start">
<view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1" <view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1"
@click="morloe(item1,index,index1,item)" @click="morloe(item1,index,index1,item)"
:class="{'shop_sku_box_item_selected': item.start == index1, 'disabled': !item1.disabled || !item1.isGrounding || item1.isPauseSale==1}" :class="{'shop_sku_box_item_selected': item.start == index1 || item1.selected, 'disabled': !item1.disabled || !item1.isGrounding || item1.isPauseSale==1}"
> >
{{item1.name}} {{item1.name}}
<view class="shop_sku_box_item_tip" v-if="item1.isGrounding == false"> <view class="shop_sku_box_item_tip" v-if="item1.isGrounding == false">
@@ -193,11 +194,6 @@
pagemetashow: false, pagemetashow: false,
userInfo: uni.cache.get('userInfo'), //个人信息 userInfo: uni.cache.get('userInfo'), //个人信息
opacity: false, //是否显示 opacity: false, //是否显示
fillHeight: 0, // 填充高度,用于最后一项低于滚动区域时使用
leftArray: [],
mainArray: [],
leftIndex: 0,
isFixed: false,
showShopInfo: false, //店铺信息弹窗是否显示 showShopInfo: false, //店铺信息弹窗是否显示
showShopsku: false, //多规格弹窗是否显示 showShopsku: false, //多规格弹窗是否显示
skuId: null, // 多规格ID skuId: null, // 多规格ID
@@ -216,8 +212,6 @@
salePrice: '', //钱数 salePrice: '', //钱数
cartListsdatashow: false, //是否显示购物车 cartListsdatashow: false, //是否显示购物车
showCart: false, showCart: false,
lastbottom: '', //元素最低端的距离
scrollxleft: true,
orderdetailFlag: true, orderdetailFlag: true,
searchList: [], searchList: [],
@@ -225,6 +219,8 @@
shopId: null, shopId: null,
tableCode: null, tableCode: null,
groupProductldList: [],
} }
}, },
onPageScroll(e) { onPageScroll(e) {
@@ -420,6 +416,9 @@
} else { } else {
num = this.skuNumber + this.amountcartNumber; num = this.skuNumber + this.amountcartNumber;
} }
if (item.type == 'package'&&item.groupType == 1) {
num = this.amountcartNumber;
}
let params = { let params = {
"skuId": this.skuId, "skuId": this.skuId,
"num": num, //数量 "num": num, //数量
@@ -430,6 +429,10 @@
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'), "tableId": uni.cache.get('tableCode'),
} }
//套餐数据
if ( this.groupProductldList.length > 0 ) {
params.groupProductldList = this.groupProductldList;
}
this.addCart(params); this.addCart(params);
}, },
@@ -455,6 +458,8 @@
if (res.code == 0) { if (res.code == 0) {
this.showShopsku = false; this.showShopsku = false;
this.pagemetashow = false; this.pagemetashow = false;
this.isSpec = false;
} }
}, },
@@ -512,15 +517,22 @@
* @param {Object} index1 * @param {Object} index1
*/ */
async clickspecifications(item1, index1, type) { async clickspecifications(item1, index1, type) {
if ( item1.isPauseSale != 0 || item1.isSale == 0) {
return;
}
this.skuidname = [] this.skuidname = []
this.specifications = item1 this.specifications = item1
this.specifications.indexb = index1 this.specifications.indexb = index1
this.specifications.typeName = type this.specifications.typeName = type
if ( item1.type == 'package'&&item1.groupType == 1 ) {
this.groupProductldList = [];
this.optionalPackage(item1, index, index1, type)
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
return;
}
if ( item1.isPauseSale != 0 || item1.isSale == 0) {
return;
}
try { try {
if (item1.productSkuResult == null) { if (item1.productSkuResult == null||(item1.type == 'package'&&item1.groupType == 0)) {
this.isSpec = true; this.isSpec = true;
// 但但单个规格弹框的处理 // 但但单个规格弹框的处理
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量 this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
@@ -581,7 +593,39 @@
//TODO handle the exception //TODO handle the exception
} }
}, },
/**
* 可选套餐处理
*/
optionalPackage(item1, index, index1, type) {
this.specifications = item1
this.skuidname = [];
this.specifications.tagSnap = item1.proGroupVo.map((item,index) => {
let res = {
id: item1.id, //商品id
name: item.title,
count: item.count,
number: item.number,
start: -1,
children: []
}
item.goods.forEach((v, e) => {
res.children.push({
name: v.proName,
proId: v.proId, //商品id
disabled: true,
isGrounding: true,
isPauseSale: 0,
selected: false,
})
})
return res
})
this.salePrice = this.isVip == 1 && item1.lowMemberPrice > 0 ? item1.lowMemberPrice : item1.lowPrice // 价格
this.showShopsku = true //打开弹框
console.log(this.specifications)
},
/** /**
* 规格选择监听 * 规格选择监听
* @param {Object} e * @param {Object} e
@@ -590,74 +634,114 @@
* @param {Object} item * @param {Object} item
*/ */
async morloe(e, index, index1, item) { async morloe(e, index, index1, item) {
//套餐处理
if (!e.isGrounding || !e.disabled || e.isPauseSale == 1) { if ( this.specifications.type == 'package'&&this.specifications.groupType == 1){
return; // 当前分类下选中数量
} this.isSpec = true;
let number = 0;
let querySpecList = []; this.skuidname = [];
this.skuBtnText = "添加到购物车"; this.groupProductldList = []
this.isSpec = true; this.specifications.tagSnap[index].children.map(v=>{
// 设置当前选中下标 if ( v.selected ) { number++ }
if (this.specifications.tagSnap[index].start != index1) { })
this.$set(this.specifications.tagSnap[index], 'start', index1) // 判断选择数量是否大于可选数量
} else { if ( number < item.number ) {
this.$set(this.specifications.tagSnap[index], 'start', -1) this.specifications.tagSnap[index].children[index1].selected = !e.selected
index = index - 1; } else {
} this.specifications.tagSnap[index].children[index1].selected = false
this.skuidname = []; }
// 选择规格下面的其他规格可点击状态重置 this.specifications.tagSnap.forEach(v=>{
this.specifications.tagSnap.forEach((val, i, arr) => { v.children.forEach(v1=>{
if (i > index) { if (v1.selected) {
val.children.forEach((v1, e1) => { this.groupProductldList.push(v1.proId)
v1.isGrounding = i == (index+1) ? false : true; }
v1.isPauseSale = i == (index+1) ? 1 : 0;
v1.disabled = i == (index+1) ? true : false;
}) })
val.start = -1; })
} // 获取下一个没有选中的分类
if (val.start >= 0) { for (let i = 0; i < this.specifications.tagSnap.length; i++) {
this.skuidname.push(val.children[val.start].name) let count = 0;
} for (let o = 0; o < this.specifications.tagSnap[i].children.length; o++) {
}) if (this.specifications.tagSnap[i].children[o].selected ) {
count++
// 获取下一个没有选中的分类
for (let i = 0; i < this.specifications.tagSnap.length; i++) {
if (this.specifications.tagSnap[i].start < 0) {
this.isSpec = false;
this.skuBtnText = `您还没选择${this.specifications.tagSnap[i].name}`
break; // 终止循环
}
}
let filteredJson;
let isSkuidname = [];
//提前下一列规格循环,查看是否有下架规格
if (this.specifications.tagSnap[index + 1]) {
for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
// 上下架状态处理
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[index + 1].children[o].isGrounding = true;
break; // 终止循环
} }
} }
// 售罄状态处理 if ( count < this.specifications.tagSnap[i].number ) {
for (let i = 0; i < filteredJson.length; i++) { this.isSpec = false;
if (filteredJson[i].isPauseSale == 0) { this.skuBtnText = `${this.specifications.tagSnap[i].name}选择数量不足`
this.specifications.tagSnap[index + 1].children[o].isPauseSale = 0; break; // 终止循环
break; // 终止循环
}
} }
} }
} else {
if (!e.isGrounding || !e.disabled || e.isPauseSale == 1) {
return;
}
let querySpecList = [];
this.skuBtnText = "添加到购物车";
this.isSpec = true;
// 设置当前选中下标
if (this.specifications.tagSnap[index].start != index1) {
this.$set(this.specifications.tagSnap[index], 'start', index1)
} else {
this.$set(this.specifications.tagSnap[index], 'start', -1)
index = index - 1;
}
this.skuidname = [];
// 选择规格下面的其他规格可点击状态重置
this.specifications.tagSnap.forEach((val, i, arr) => {
if (i > index) {
val.children.forEach((v1, e1) => {
v1.isGrounding = i == (index+1) ? false : true;
v1.isPauseSale = i == (index+1) ? 1 : 0;
v1.disabled = i == (index+1) ? true : false;
})
val.start = -1;
}
if (val.start >= 0) {
this.skuidname.push(val.children[val.start].name)
}
})
// 获取下一个没有选中的分类
for (let i = 0; i < this.specifications.tagSnap.length; i++) {
if (this.specifications.tagSnap[i].start < 0) {
this.isSpec = false;
this.skuBtnText = `您还没选择${this.specifications.tagSnap[i].name}`
break; // 终止循环
}
}
let filteredJson;
let isSkuidname = [];
//提前下一列规格循环,查看是否有下架规格
if (this.specifications.tagSnap[index + 1]) {
for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
// 上下架状态处理
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[index + 1].children[o].isGrounding = true;
break; // 终止循环
}
}
// 售罄状态处理
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[index + 1].children[o].isPauseSale = 0;
break; // 终止循环
}
}
}
}
this.hodgepodge(item, 2)
} }
this.$forceUpdate(); this.$forceUpdate();
this.hodgepodge(item, 2)
}, },
/** /**
@@ -669,6 +753,7 @@
*/ */
async hodgepodge(item, a, c, num) { //此接口去获取商品id !!!赋值库存 数量 价格等 async hodgepodge(item, a, c, num) { //此接口去获取商品id !!!赋值库存 数量 价格等
try { try {
let res = await this.api.productqueryProductSku({ let res = await this.api.productqueryProductSku({
code: uni.cache.get('tableCode'), code: uni.cache.get('tableCode'),
shopId: this.shopId, shopId: this.shopId,