|
|
@@ -143,7 +143,7 @@ export function ProductInformation({
|
|
|
const { showToast } = useCustomToast();
|
|
|
|
|
|
// 记录当前哪个选项组刚刚被点击(用于实现“点击组内全部可点”)
|
|
|
- const [lastClickedOptionId, setLastClickedOptionId] = useState<number>(productOptions[0].id );
|
|
|
+ const [lastClickedOptionId, setLastClickedOptionId] = useState<number>(productOptions[0]?.id );
|
|
|
|
|
|
const [productQty, setProductQty] = useState(1);
|
|
|
|
|
|
@@ -318,8 +318,8 @@ export function ProductInformation({
|
|
|
throw new Error(`Unexpected: no variant matches selected ${JSON.stringify(selected)}`);
|
|
|
}
|
|
|
if(variant.priceIndices) {
|
|
|
- totalLinePrice = Number(variant.priceIndices[0].min_price) * productQty;
|
|
|
- totalNowPrice = Number(variant.priceIndices[0].regular_min_price) * productQty;
|
|
|
+ totalLinePrice = Number(variant.priceIndices[0].regular_min_price) * productQty;
|
|
|
+ totalNowPrice = Number(variant.priceIndices[0].min_price) * productQty;
|
|
|
}
|
|
|
if(totalLinePrice !== totalNowPrice) {
|
|
|
save = totalLinePrice - totalNowPrice;
|