【拼团商品详情】

1. 整理变量
pull/1/MERGE
YunaiV 2023-06-15 20:54:32 +08:00
parent 31c96a5c76
commit 31ead800b1
2 changed files with 99 additions and 127 deletions

View File

@ -123,14 +123,13 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 评论 TODO --> <!-- 评论 -->
<view class='userEvaluation borRadius14' id="past1"> <view class='userEvaluation borRadius14' id="past1">
<view class='title acea-row row-between-wrapper' :style="replyCount==0?'border-bottom-left-radius:14rpx;border-bottom-right-radius:14rpx;':''"> <view class='title acea-row row-between-wrapper' :style="replyCount===0?'border-bottom-left-radius:14rpx;border-bottom-right-radius:14rpx;':''">
<view>用户评价<i>({{replyCount}})</i></view> <view>用户评价<i>({{replyCount}})</i></view>
<navigator class='praise' hover-class='none' <navigator class='praise' hover-class='none'
:url='"/pages/users/goods_comment_list/index?productId="+storeInfo.productId'> :url='"/pages/users/goods_comment_list/index?productId="+spu.productId'>
<i>好评</i><text class='font-color'>{{replyChance || 0}}%</text> <i>好评</i><text class='font-color'>{{ replyChance || 0}}%</text>
<text class='iconfont icon-jiantou'></text> <text class='iconfont icon-jiantou'></text>
</navigator> </navigator>
</view> </view>
@ -204,7 +203,7 @@
@iptCartNum="iptCartNum" @iptCartNum="iptCartNum"
@close="closeAttr" @close="closeAttr"
/> />
<!-- TODO 芋艿 --> <!-- 左侧的分销提示 -->
<shareRedPackets <shareRedPackets
:sharePacket="sharePacket" :sharePacket="sharePacket"
@listenerActionSheet="listenerActionSheet" @listenerActionSheet="listenerActionSheet"
@ -309,6 +308,10 @@
runningRecords: [], // 进行中的拼团记录 runningRecords: [], // 进行中的拼团记录
AllIndex: 2, // runningRecords 展示的数量,用于收起 AllIndex: 2, // runningRecords 展示的数量,用于收起
AllIndexDefault: 0, // AllIndex 的默认值,用于收起 AllIndexDefault: 0, // AllIndex 的默认值,用于收起
circular: true, // 进行中的拼团记录的轮播相关的 4 个变量
autoplay: true,
interval: 3000,
duration: 500,
// ========== 商品相关变量 ========== // ========== 商品相关变量 ==========
spu: {}, // 商品 SPU 详情 spu: {}, // 商品 SPU 详情
@ -334,52 +337,37 @@
// ========== 收藏相关的变量 ========== // ========== 收藏相关的变量 ==========
userCollect: false, userCollect: false,
// TODO 芋艿:未整理 // ========== 分销相关的变量 ==========
qrcodeSize: 600, // 二维码的大小
promotionCode: '', // 二维码图片
imgTop: '', // 商品图片的 base64 码
errT: '', // 获得小程序码失败的提示文本
posters: false, // 分享弹窗的开关
weixinStatus: false, // 微信分享是否打开
canvasStatus: false, // 是否显示海报
H5ShareBox: false, // 公众号分享的弹出
posterbackgd: '/static/images/posterbackgd.png', // 海报的背景,用于海报的生成
storeImage: '', // 下载商品图片后的文件地址
actionSheetHidden: true, // 微信小程序的右上角分享的弹出
posterImage: '', // 海报路径
sharePacket: { // 分销弹出信息
isState: true, // 默认不显示
},
circular: true, // ========== 顶部 nav + scroll 相关的变量 ==========
autoplay: true, returnShow: true, // 判断顶部 [返回] 是否出现
interval: 3000, homeTop: 20, // 头部的 top 位置
duration: 500, height: 0, // 窗口 height 高度
productValue: [], scrollY: 0, // 滚动的 Y 轴
maxAllIndex: 0, scrollTop: 0, // 滚动条的 top 位置
limitNum: 1, lock: false, // 是否锁定 scroll 下
timeer: null, topArr: [], // 每个 nav 的 top 位置
iSplus: false, heightArr: [], // 每个 nav 的 height 高度
navH: "", navH: "", // 头部 nav 高度
navList: ['商品', '评价', '详情'], opacity: 0, // 头部 nav 的透明度
opacity: 0, navList: ['商品', '评价', '详情'],
scrollY: 0, navActive: 0, // 选中的 navList 下标
topArr: [],
toView: '',
height: 0,
heightArr: [],
lock: false,
scrollTop: 0,
storeInfo: {}, storeInfo: {},
imgUrls: [],
sharePacket: {
isState: true, //默认不显示
},
posters: false,
weixinStatus: false,
posterImageStatus: false,
canvasStatus: false, //海报绘图标签
storeImage: '', //海报产品图
promotionCode: '', //二维码图片
posterImage: '', //海报路径
posterbackgd: '/static/images/posterbackgd.png',
navActive: 0,
actionSheetHidden: false,
attrTxt: '',
cart_num: '',
isAuto: false, //没有授权的不会自动授权
imgTop: '',
qrcodeSize: 600,
H5ShareBox: false, //公众号分享图片
errT: '',
returnShow: true,
homeTop: 20
} }
}, },
watch: { watch: {
@ -394,74 +382,47 @@
}, },
//#endif //#endif
onLoad(options) { onLoad(options) {
let that = this
this.$store.commit("PRODUCT_TYPE", 'normal'); this.$store.commit("PRODUCT_TYPE", 'normal');
this.$nextTick(() => { // 设置商品列表高度
// #ifdef MP uni.getSystemInfo({
const menuButton = uni.getMenuButtonBoundingClientRect(); success: res => {
const query = uni.createSelectorQuery().in(this); this.height = res.windowHeight
query //res.windowHeight:获取整个窗口高度为px,*2为rpx;98为头部占据的高度;
.select('#home') },
.boundingClientRect(data => { });
this.homeTop = menuButton.top * 2 + menuButton.height - data.height;
})
.exec();
// #endif
});
// #ifdef MP // #ifdef MP
this.navH = app.globalData.navHeight; this.navH = app.globalData.navHeight;
// #endif // #endif
// #ifndef MP // #ifndef MP
this.navH = 96; this.navH = 96;
// #endif // #endif
//设置商品列表高度
uni.getSystemInfo({ // 校验参数是否正确
success: function(res) { if (!options.scene && !options.id){
that.height = res.windowHeight this.$util.Tips({
//res.windowHeight:获取整个窗口高度为px,*2为rpx;98为头部占据的高度; title: '缺少参数无法查看商品'
}, }, {
}); url: '/pages/index/index'
if (options.hasOwnProperty('id') || options.scene) { });
if (options.scene) { // 仅仅小程序扫码进入 return;
let qrCodeValue = this.$util.getUrlParams(decodeURIComponent(options.scene)); }
let mapeMpQrCodeValue = this.$util.formatMpQrCodeData(qrCodeValue); // 解析 id 商品编号
app.globalData.spread = mapeMpQrCodeValue.spread; if (options.scene) { // 仅仅小程序扫码进入
this.id = mapeMpQrCodeValue.id; // TODO 芋艿:code 是啥
setTimeout(()=>{ let qrCodeValue = this.$util.getUrlParams(decodeURIComponent(options.scene));
spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {}) let mapeMpQrCodeValue = this.$util.formatMpQrCodeData(qrCodeValue);
},2000) app.globalData.spread = mapeMpQrCodeValue.spread;
}else{ this.id = mapeMpQrCodeValue.id;
this.id = options.id; // TODO 芋艿:code 是啥
} setTimeout(()=>{
if (this.isLogin) { spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {})
this.combinationDetail(); }, 2000)
} else { } else {
// #ifdef H5 || APP-PLUS this.id = options.id;
try { }
uni.setStorageSync('comGoodsId', options.id);
} catch (e) {} // 获取拼团信息
// #endif this.combinationDetail();
this.$Cache.set('login_back_url',
`/pages/activity/goods_combination_details/index?id=${options.id}&spread=${options.pid?options.pid:0}`
);
toLogin();
}
} else {
try {
let val = uni.getStorageSync('comGoodsId');
if (val != '') {
this.id = val
this.combinationDetail();
}
} catch (e) {
uni.showToast({
title: '参数错误',
icon: 'none',
duration: 1000,
mask: true,
})
}
}
}, },
//#ifdef MP //#ifdef MP
onShareAppMessage() { onShareAppMessage() {
@ -472,6 +433,20 @@
}; };
}, },
//#endif //#endif
onReady() {
this.$nextTick(() => {
// 设置微信的头部 top 位置
// #ifdef MP
const menuButton = uni.getMenuButtonBoundingClientRect();
const query = uni.createSelectorQuery().in(this);
query.select('#home')
.boundingClientRect(data => {
this.homeTop = menuButton.top * 2 + menuButton.height - data.height;
})
.exec();
// #endif
});
},
methods: { methods: {
// ========== 拼团活动相关 ========== // ========== 拼团活动相关 ==========
combinationDetail() { combinationDetail() {

View File

@ -252,7 +252,6 @@
posters: false, // 分享弹窗的开关 posters: false, // 分享弹窗的开关
weixinStatus: false, // 微信分享是否打开 weixinStatus: false, // 微信分享是否打开
canvasStatus: false, // 是否显示海报 canvasStatus: false, // 是否显示海报
imagePath: '', // 海报路径
H5ShareBox: false, // 公众号分享的弹出 H5ShareBox: false, // 公众号分享的弹出
posterbackgd: '/static/images/posterbackgd.png', // 海报的背景,用于海报的生成 posterbackgd: '/static/images/posterbackgd.png', // 海报的背景,用于海报的生成
storeImage: '', // 下载商品图片后的文件地址 storeImage: '', // 下载商品图片后的文件地址
@ -330,21 +329,19 @@
return; return;
} }
// 解析 id 商品编号 // 解析 id 商品编号
if (options.hasOwnProperty('id') || options.scene){ if (options.scene) { // 仅仅小程序扫码进入
if (options.scene) { // 仅仅小程序扫码进入 // TODO 芋艿:code 是啥
// TODO 芋艿:code 是啥 let qrCodeValue = this.$util.getUrlParams(decodeURIComponent(options.scene));
let qrCodeValue = this.$util.getUrlParams(decodeURIComponent(options.scene)); let mapeMpQrCodeValue = this.$util.formatMpQrCodeData(qrCodeValue);
let mapeMpQrCodeValue = this.$util.formatMpQrCodeData(qrCodeValue); app.globalData.spread = mapeMpQrCodeValue.spread;
app.globalData.spread = mapeMpQrCodeValue.spread; this.id = mapeMpQrCodeValue.id;
this.id = mapeMpQrCodeValue.id; // TODO 芋艿:code 是啥
// TODO 芋艿:code 是啥 setTimeout(()=>{
setTimeout(()=>{ spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {})
spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {}) },2000)
},2000) } else {
} else { this.id = options.id;
this.id = options.id; }
}
}
// 获得秒杀详情 // 获得秒杀详情
this.getSeckillDetail(); this.getSeckillDetail();