数据库雪花 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
@@ -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);