数据库雪花 id,导致的商品规格无法选择

This commit is contained in:
taozhengyang
2025-05-25 18:22:55 +08:00
parent 1f169a1ed1
commit a871ea7a5f
3 changed files with 24 additions and 24 deletions

View File

@@ -133,7 +133,7 @@
});
const state = reactive({
selectedSku: {}, // 选中的 SKU
currentPropertyArray: [], // 当前选中的属性,实际是个 Map。key 是 property 编号value 是 value 编号
currentPropertyArray: {}, // 当前选中的属性,实际是个 Map。key 是 property 编号value 是 value 编号
grouponNum: props.grouponNum,
});
@@ -212,7 +212,7 @@
noChooseValueIds.splice(index, 1);
} else {
// 循环去除当前已选择的 value 属性值 id
state.currentPropertyArray.forEach((currentPropertyId) => {
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
if (currentPropertyId.toString() !== '') {
return;
}
@@ -229,8 +229,8 @@
let choosePropertyIds = [];
if (!isChecked) {
// 当前已选择的 property
state.currentPropertyArray.forEach((currentPropertyId, currentValueId) => {
if (currentPropertyId !== '') {
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentValueId]) => {
if (currentValueId !== '') {
// currentPropertyId 为空是反选 填充的
choosePropertyIds.push(currentValueId);
}
@@ -261,9 +261,9 @@
continue;
}
let isOk = true;
state.currentPropertyArray.forEach((propertyId) => {
// propertyId 不为空,并且,这个 条 sku 没有被选中,则排除
if (propertyId.toString() !== '' && sku.value_id_array.indexOf(propertyId) < 0) {
Object.entries(state.currentPropertyArray).forEach(([propertyId, valueId]) => {
// valueId 不为空,并且,这个 条 sku 没有被选中,则排除
if (valueId.toString() !== '' && sku.value_id_array.indexOf(valueId) < 0) {
isOk = false;
}
});
@@ -292,7 +292,7 @@
// 选中的 property 大类
let choosePropertyId = [];
state.currentPropertyArray.forEach((currentPropertyId) => {
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
if (currentPropertyId !== '') {
// currentPropertyId 为空是反选 填充的
choosePropertyId.push(currentPropertyId);

View File

@@ -126,7 +126,7 @@
const state = reactive({
goodsInfo: computed(() => props.modelValue),
selectedSku: {},
currentPropertyArray: [],
currentPropertyArray: {},
});
const getShowPriceText = computed(() => {
let priceText = `${fen2yuan(state.goodsInfo.price)}`;
@@ -209,7 +209,7 @@
noChooseValueIds.splice(index, 1);
} else {
// 循环去除当前已选择的 value 属性值 id
state.currentPropertyArray.forEach((currentPropertyId) => {
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
if (currentPropertyId.toString() !== '') {
return;
}
@@ -226,8 +226,8 @@
let choosePropertyIds = [];
if (!isChecked) {
// 当前已选择的 property
state.currentPropertyArray.forEach((currentPropertyId, currentValueId) => {
if (currentPropertyId !== '') {
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentValueId]) => {
if (currentValueId !== '') {
// currentPropertyId 为空是反选 填充的
choosePropertyIds.push(currentValueId);
}
@@ -258,9 +258,9 @@
continue;
}
let isOk = true;
state.currentPropertyArray.forEach((propertyId) => {
// propertyId 不为空,并且,这个 条 sku 没有被选中,则排除
if (propertyId.toString() !== '' && sku.value_id_array.indexOf(propertyId) < 0) {
Object.entries(state.currentPropertyArray).forEach(([propertyId, valueId]) => {
// valueId 不为空,并且,这个 条 sku 没有被选中,则排除
if (valueId.toString() !== '' && sku.value_id_array.indexOf(valueId) < 0) {
isOk = false;
}
});
@@ -289,7 +289,7 @@
// 选中的 property 大类
let choosePropertyId = [];
state.currentPropertyArray.forEach((currentPropertyId) => {
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
if (currentPropertyId !== '') {
// currentPropertyId 为空是反选 填充的
choosePropertyId.push(currentPropertyId);

View File

@@ -111,7 +111,7 @@
const state = reactive({
selectedSku: {}, // 选中的 SKU
currentPropertyArray: [], // 当前选中的属性,实际是个 Map。key 是 property 编号value 是 value 编号
currentPropertyArray: {}, // 当前选中的属性,实际是个 Map。key 是 property 编号value 是 value 编号
});
const propertyList = convertProductPropertyList(props.goodsInfo.skus);
@@ -202,7 +202,7 @@
noChooseValueIds.splice(index, 1);
} else {
// 循环去除当前已选择的 value 属性值 id
state.currentPropertyArray.forEach((currentPropertyId) => {
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
if (currentPropertyId.toString() !== '') {
return;
}
@@ -219,8 +219,8 @@
let choosePropertyIds = [];
if (!isChecked) {
// 当前已选择的 property
state.currentPropertyArray.forEach((currentPropertyId, currentValueId) => {
if (currentPropertyId !== '') {
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentValueId]) => {
if (currentValueId !== '') {
// currentPropertyId 为空是反选 填充的
choosePropertyIds.push(currentValueId);
}
@@ -251,9 +251,9 @@
continue;
}
let isOk = true;
state.currentPropertyArray.forEach((propertyId) => {
// propertyId 不为空,并且,这个 条 sku 没有被选中,则排除
if (propertyId.toString() !== '' && sku.value_id_array.indexOf(propertyId) < 0) {
Object.entries(state.currentPropertyArray).forEach(([propertyId, valueId]) => {
// valueId 不为空,并且,这个 条 sku 没有被选中,则排除
if (valueId.toString() !== '' && sku.value_id_array.indexOf(valueId) < 0) {
isOk = false;
}
});
@@ -282,7 +282,7 @@
// 选中的 property 大类
let choosePropertyId = [];
state.currentPropertyArray.forEach((currentPropertyId) => {
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
if (currentPropertyId !== '') {
// currentPropertyId 为空是反选 填充的
choosePropertyId.push(currentPropertyId);