diff --git a/pages/active/limited-time/limited-time.vue b/pages/active/limited-time/limited-time.vue
index b61d4a2..3f68712 100644
--- a/pages/active/limited-time/limited-time.vue
+++ b/pages/active/limited-time/limited-time.vue
@@ -25,16 +25,15 @@
-
+
-
+ -->
@@ -126,7 +125,7 @@ export default {
},
// 获取秒杀
onGetSeckillCurrent(type = 'current') {
- const url = type === 'current' ? getSeckillCurrent : getSeckillPreview;
+ const url = type === 'current' ? getSeckillCurrent : getSeckillPreview;
url()
.then((res) => {
if (res.bizcode === 100) {
diff --git a/pages/active/super-subsidy/super-subsidy.vue b/pages/active/super-subsidy/super-subsidy.vue
index d874b98..a9449e2 100644
--- a/pages/active/super-subsidy/super-subsidy.vue
+++ b/pages/active/super-subsidy/super-subsidy.vue
@@ -17,14 +17,14 @@
-
+
diff --git a/pages/other_package/productInfo/productInfo.vue b/pages/other_package/productInfo/productInfo.vue
index d902715..6dc1a8a 100644
--- a/pages/other_package/productInfo/productInfo.vue
+++ b/pages/other_package/productInfo/productInfo.vue
@@ -153,7 +153,7 @@
@click="onZiXun">
咨询
-
+
购物车
@@ -165,8 +165,7 @@
+ :style="isCoupon ? 'width: 400rpx' : ''" @click="checkSpecification(true, 'buy')">
立即购买
@@ -191,7 +190,8 @@
-
+
+
@@ -211,21 +211,30 @@
{{ selectSpecificationTempl.price }}
- {{ orderInfo.minPrice }}
- - {{ orderInfo.maxPrice }}
+ {{ skuBySpecInfo.supplyPrice }}
+ - {{ skuBySpecInfo.price }}
优惠券{{
orderInfo.couponPrice }}
- ¥{{ orderInfo.adPrice }}
- 优惠卷已优惠¥{{
- orderInfo.couponPrice }}
+ ¥{{ skuBySpecInfo.supplyPrice }}
+
+ 优惠券已优惠¥{{
+ orderInfo.couponPrice }}
+
+ 库存
+ {{ skuBySpecInfo.stock || 0 }}件
+
+
- 库存
- {{ orderInfo.inventory || 0 }}件
+
+ 已选规格: {{ skuBySpecInfo.skuName }}
+
+
@@ -422,6 +431,7 @@ export default {
curAmount: 0, // 当前人剩余优惠券金额
activedType: "", // 活动类型
activityId: "", // 秒杀活动ID
+ skuBySpecInfo: {},
};
},
onBackPress(options) {
@@ -885,6 +895,8 @@ export default {
if (this.activedType === 'seckill') {
data.minPrice = data.activity?.activityPrice;
}
+
+ console.log("查询详细内容---", data)
this.orderInfo = data;
}
},
@@ -1033,6 +1045,13 @@ export default {
})),
}));
this.refreshSpecOptionState();
+ // 默认选中每组规格的第一个可用选项(若均无可用则选中第一个选项)
+ this.specificationList.forEach((group, groupIndex) => {
+ const defaultItem = group.items.find((item) => !item.disabled) || group.items[0];
+ if (defaultItem) {
+ this.clickSpecification(groupIndex, group, defaultItem);
+ }
+ });
return true;
},
@@ -1100,6 +1119,12 @@ export default {
this.specificationList[groupIndex].selectVal = oItem.n;
this.refreshSpecOptionState();
+ const skuBySpecBash = this.getSkuBySpecValueIds(this.selectedSpecValueIds) || {};
+ console.log("----111", skuBySpecBash)
+
+ this.skuBySpecInfo = { ...this.orderInfo, skuImage: skuBySpecBash.skuImage, stock: skuBySpecBash.stock, supplyPrice: skuBySpecBash.supplyPrice, price: skuBySpecBash.price, skuName: skuBySpecBash.skuName }
+ console.log("----222", this.orderInfo)
+
if (this.selectedSpecValueIds.every((id) => id != null)) {
const currentSelectSpecification = this.skuBySpecKey[this.selectedSpecValueIds.join("_")] || {};
this.selectSpecificationTempl = currentSelectSpecification;
@@ -1109,6 +1134,20 @@ export default {
this.selectSpecificationTempl = {};
}
},
+ // 根据规格 ID 数组(如 [颜色id, 尺码id] -> [146913, 146916])获取单条 SKU 对象
+ getSkuBySpecValueIds(specValueIds) {
+ if (!specValueIds || !specValueIds.length) return null;
+ // 方式一:直接通过预先拼接的 key ("146913_146916") 获取 (O(1))
+ const key = specValueIds.join("_");
+ if (this.skuBySpecKey && this.skuBySpecKey[key]) {
+ return this.skuBySpecKey[key];
+ }
+ // 方式二:在 specificationTempl (skus) 数组中按 specValueIds 检索匹配
+ return (this.specificationTempl || []).find((sku) => {
+ const ids = sku.valueIds || JSON.parse(sku.specValueIds || "[]");
+ return specValueIds.every((id) => ids.map(Number).includes(Number(id)));
+ }) || null;
+ },
// 选择规格
selectSpecificationFun(index, item) {
console.log("selectSpecificationTempl");
@@ -1619,9 +1658,15 @@ export default {
margin-top: 10rpx;
}
+ .coupon_content_stock {
+ display: flex;
+ font-size: 22rpx;
+ color: #808080;
+ margin-top: 10rpx;
+ }
+
.inventory_warp {
display: flex;
- font-weight: 500;
font-size: 24rpx;
color: #808080;
margin-top: 16rpx;