Commit 1ec1d109 authored by spc's avatar spc

fixed

parent 355d62f2
...@@ -505,6 +505,17 @@ export default { ...@@ -505,6 +505,17 @@ export default {
// 根据商品类型设置规格选项 // 根据商品类型设置规格选项
this.setSpecOptions(data.skus); this.setSpecOptions(data.skus);
// 检查接口返回是否包含 activityId 和 sessionKey,如果有则设置为秒杀商品
if (data.activityId && data.sessionKey) {
this.isSeckill = true;
this.seckillParams = {
activityId: data.activityId,
sessionKey: data.sessionKey,
appGoodsId: data.id || this.goodsData.id || ''
};
console.log('普通商品详情接口返回秒杀参数,设置为秒杀商品:', this.seckillParams);
}
} else { } else {
uni.showToast({ uni.showToast({
title: response.msg || '获取商品详情失败', title: response.msg || '获取商品详情失败',
...@@ -584,6 +595,17 @@ export default { ...@@ -584,6 +595,17 @@ export default {
// 秒杀商品固定数量为1 // 秒杀商品固定数量为1
this.quantity = 1; this.quantity = 1;
// 检查接口返回是否包含 activityId 和 sessionKey,更新秒杀参数
if (data.activityId && data.sessionKey) {
this.isSeckill = true;
this.seckillParams = {
activityId: data.activityId,
sessionKey: data.sessionKey,
appGoodsId: data.id || this.goodsData.id || ''
};
console.log('秒杀商品详情接口返回秒杀参数:', this.seckillParams);
}
} else { } else {
uni.showToast({ uni.showToast({
title: response.msg || '获取秒杀商品详情失败', title: response.msg || '获取秒杀商品详情失败',
...@@ -1101,11 +1123,11 @@ export default { ...@@ -1101,11 +1123,11 @@ export default {
storeId: this.orderParams.storeId || '', storeId: this.orderParams.storeId || '',
projectId: this.orderParams.projectId || '', projectId: this.orderParams.projectId || '',
// 秒杀相关参数 // 秒杀相关参数(如果有 activityId 和 sessionKey 则传递,即使原本是普通商品)
isSeckill: this.isSeckill, isSeckill: this.isSeckill,
activityId: this.seckillParams.activityId, activityId: this.seckillParams.activityId || '',
sessionKey: this.seckillParams.sessionKey, sessionKey: this.seckillParams.sessionKey || '',
appGoodsId: this.seckillParams.appGoodsId appGoodsId: this.seckillParams.appGoodsId || ''
}; };
console.log('结算页面参数:', settlementParams); console.log('结算页面参数:', settlementParams);
......
...@@ -285,11 +285,11 @@ export default { ...@@ -285,11 +285,11 @@ export default {
parsePageParams(options) { parsePageParams(options) {
console.log('结算页面接收到的参数:', options); console.log('结算页面接收到的参数:', options);
// 判断是否为秒杀 // 判断是否为秒杀:如果有 activityId 和 sessionKey,则判断为秒杀
this.isSeckill = !!(options.isSeckill === 'true' || options.isSeckill === true || options.activityId); this.isSeckill = !!(options.isSeckill === 'true' || options.isSeckill === true || (options.activityId && options.sessionKey));
// 解析秒杀参数 // 解析秒杀参数
if (this.isSeckill) { if (this.isSeckill && options.activityId && options.sessionKey) {
this.seckillParams = { this.seckillParams = {
activityId: options.activityId || '', activityId: options.activityId || '',
sessionKey: options.sessionKey || '', sessionKey: options.sessionKey || '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment