diff --git a/components/ymf-components/ymf-share-popup.vue b/components/ymf-components/ymf-share-popup.vue index b33d2d1..b795124 100644 --- a/components/ymf-components/ymf-share-popup.vue +++ b/components/ymf-components/ymf-share-popup.vue @@ -94,34 +94,37 @@ } const config = reactive({}) async function getData(id) { - const shopId = id||uni.cache.get('shopId') + const pages = getCurrentPages(); + const currentPage = pages[pages.length - 1]; + const currentPath = currentPage.route; + const currentOptions = currentPage.options; + const path = `/${currentPath}`; + + const shopId = id||currentOptions.shopId||uni.cache.get('shopId') + // console.log('分享组件挂载完毕:shopId',shopId); if (!shopId) { return } shareConfig({ shopId }).then(res => { + // console.log('分享组件挂载完毕:shareConfig',res); + // console.log('分享组件挂载完毕:currentOptions',currentOptions); if(res){ Object.assign(config,res) - if(res.sharedUserCouponId&&res.sharedUserCouponNum&&res.isSharedUserPopup){ - const pages = getCurrentPages(); - const currentPage = pages[pages.length - 1]; - const currentPath = currentPage.route; - const currentOptions = currentPage.options; - const path = `/${currentPath}`; - - const pTag = returnPageTags(path) - if(pTag&¤tOptions.fromUserId){ - show.value=true - } - + const pTag = returnPageTags(path) + if(pTag&¤tOptions.fromUserId&&res.isSharedUserPopup){ + show.value=true } + // if(res.sharedUserCouponId&&res.sharedUserCouponNum){ + // } } }) } watch(()=>userStore.shopInfo.id,(newval)=>{ if(newval){ + // getData() shareConfig({ shopId:newval }).then(res => { diff --git a/pages/product/index.vue b/pages/product/index.vue index 946666f..b1a6dc4 100644 --- a/pages/product/index.vue +++ b/pages/product/index.vue @@ -2588,10 +2588,13 @@ const pTag=returnPageTags(shareSwiperItem.value.jumpPagePath) let query = jsonToUrl(queryJson) query +=('&'+shareSwiperItem.value.extendParam) + const shopName = uni.cache.get('shopInfo').shopName || '' + const path=shareSwiperItem.value.jumpPagePath?shareSwiperItem.value.jumpPagePath:'/pages/product/index?type=beforehand' + console.log('path',path); const json={ imageUrl:shareSwiperItem.value.imageUrl, - path: shareSwiperItem.value.jumpPagePath+'&'+query, - title:shareSwiperItem.value.name, + path: path+'&'+query, + title:shareSwiperItem.value.name+ (shopName ? `-${shopName}` : ''), } if(pTag==='pp-detail'){ json.path=json.path.replace('goodsId','id')