From 37fe706d6a96467b9fb0471e5fdc50fbcd88e7bc Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Wed, 28 Jan 2026 18:09:47 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=82=B9=E9=A4=90=E9=A1=B5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=BD=AE=E6=92=AD=E5=9B=BE=E7=82=B9=E5=87=BB=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E8=BF=9B=E5=85=A5=E5=85=B7=E4=BD=93=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E5=88=86=E4=BA=AB=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E5=88=86=E4=BA=AB=EF=BC=8C=E5=9C=A8=E5=AF=B9=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E5=88=86=E4=BA=AB=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 1 + common/api/market/distribution.js | 9 + common/api/market/share.js | 26 + components/popup-distribution-group-code.vue | 141 ++ components/ymf-components/ymf-share-popup.vue | 220 +++ components/ymf-components/ymf-share.vue | 2 +- distribution/shop-detail/index.vue | 1271 +++++++++-------- groupBuying/goodsDetail/goodsDetail.vue | 5 +- groupBuying/index/index.vue | 1 + pages.json | 2 +- pages/index/index.vue | 1 + pages/index/indexs.vue | 4 +- pages/product/index.vue | 191 ++- scoreShop/detail/index.vue | 2 + scoreShop/index/index.vue | 2 + userPackage/goodsDetail/goodsDetail.vue | 1107 +++++++------- userPackage/index/index.vue | 5 +- userPackage/order/detail.vue | 2 +- utils/share.js | 148 +- 19 files changed, 1913 insertions(+), 1227 deletions(-) create mode 100644 common/api/market/share.js create mode 100644 components/popup-distribution-group-code.vue create mode 100644 components/ymf-components/ymf-share-popup.vue diff --git a/App.vue b/App.vue index fdda864..edd67f6 100644 --- a/App.vue +++ b/App.vue @@ -1,3 +1,4 @@ + + + diff --git a/components/ymf-components/ymf-share-popup.vue b/components/ymf-components/ymf-share-popup.vue new file mode 100644 index 0000000..b33d2d1 --- /dev/null +++ b/components/ymf-components/ymf-share-popup.vue @@ -0,0 +1,220 @@ + + + + + \ No newline at end of file diff --git a/components/ymf-components/ymf-share.vue b/components/ymf-components/ymf-share.vue index 62b7bf2..472b966 100644 --- a/components/ymf-components/ymf-share.vue +++ b/components/ymf-components/ymf-share.vue @@ -3,7 +3,7 @@ - + diff --git a/distribution/shop-detail/index.vue b/distribution/shop-detail/index.vue index 3da5184..e1cb053 100644 --- a/distribution/shop-detail/index.vue +++ b/distribution/shop-detail/index.vue @@ -26,12 +26,15 @@ {{ state.distributionUser.level }}级 {{ state.distributionUser.levelName }} - + - + 距离下一级还差: {{ juNextLvMoney }} - {{ config.upgradeType == 'cost' ? '元' : '人' }} + {{ config.upgradeType == 'cost' ? '元' : '人' }} + + + + .btn { + padding: 22rpx; + border-radius: 200rpx; + font-size: 32rpx; + color: #fff; + width: 556rpx; + text-align: center; + background-color: #e8ad7b; + border: 1px solid transparent; + + &.gray { + background: #fff; + color: #e8ad7b; + border-color: #e8ad7b; + } + } + } + + .waring { + background-color: rgba(255, 204, 0, 0.09); + padding: 32rpx 24rpx; + color: #ff8d28; + } + + .popup-content { + font-size: 28rpx; + min-height: 300px; + + .popup-content-top { + padding: 32rpx 28rpx; + border-bottom: 1px solid #ededed; + } + + .goods-info { + padding: 32rpx 28rpx; + border-bottom: 1px solid #ededed; + + .cover { + width: 184rpx; + height: 184rpx; + border-radius: 16rpx; + background: #d9d9d9; + + &.bg-fff { + background-color: #fff; + } + } + + .price { + font-size: 32rpx; + font-weight: 700; + color: #ed5a2e; + line-height: 46rpx; + } + + .old-price { + font-size: 32rpx; + color: #999; + text-decoration-line: line-through; + line-height: 48rpx; + } + + .limitBuyNum { + color: #666; + line-height: 42rpx; + } + } + + .bottom { + padding: 20rpx; + border-bottom: 1px solid #ededed; + + .price { + color: #ed5a2e; + font-size: 32rpx; + font-weight: 700; + } + } + + .btn { + display: flex; + padding: 22rpx 214rpx; + align-items: flex-start; + gap: 20rpx; + border-radius: 66rpx; + background: #e8ad7b; + font-size: 32rpx; + color: #fff; + font-size: 700; + } + } + + .w-full { + width: 100%; + } + + .groups { + padding: 28rpx 22rpx; + background-color: #fff; + + .item { + padding: 28rpx 0; + border-bottom: 2rpx solid #ededed; + + &:last-child { + border-bottom: none; + } + + .main-color { + color: #ed5a2e; + } + + .btn { + padding: 8rpx 26rpx; + border-radius: 36rpx; + background: #e8ad7b; + font-weight: 700; + color: #fff; + } + } + } + + .share-box { + top: 0; + position: absolute; + right: 0; + padding: 4rpx 30rpx; + border-radius: 0 0 0 24rpx; + color: #ed5a2e; + font-weight: 700; + background: #fff; + overflow: hidden; + + .share { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + opacity: 0; + } + } + + .goods-group { + padding: 32rpx 46rpx; + background-color: #fff; + + .name { + font-weight: 700; + font-size: 32rpx; + } + + .rotate { + transform: rotate(-90deg); + } + } + + .desc { + padding: 32rpx 46rpx; + background-color: #fff; + margin-top: 32rpx; + + .name { + font-weight: 700; + font-size: 32rpx; + } + + .table { + border: 2rpx solid #ededed; + border-radius: 8rpx; + margin: 0 52rpx; + + .header { + background: #f8f8f88f; + } + + .row { + border-top: 2rpx solid #ededed; + + &:first-child { + border-top: none; + } + } + } + + .rotate { + transform: rotate(-90deg); + } + } + + .guodu { + transition: all 0.3s; + } + \ No newline at end of file diff --git a/userPackage/index/index.vue b/userPackage/index/index.vue index 4b0c684..264ea2f 100644 --- a/userPackage/index/index.vue +++ b/userPackage/index/index.vue @@ -167,6 +167,7 @@ + @@ -513,9 +514,9 @@ }) }) - onLoad(() => { + onLoad((opt) => { APIusershopInfodetail({ - shopId: uni.cache.get('shopId') + shopId: uni.cache.get('shopId')||opt.shopId }).then(res => { console.log(res); shopInfo.value = res.shopInfo diff --git a/userPackage/order/detail.vue b/userPackage/order/detail.vue index c5023bc..7ac6ade 100644 --- a/userPackage/order/detail.vue +++ b/userPackage/order/detail.vue @@ -538,7 +538,7 @@ onShareAppMessage(async () => { query }; console.log('onShareAppMessage===', options); - return options; + return wxShare(options); }); onLoad(async (opt) => { diff --git a/utils/share.js b/utils/share.js index 8666384..335c2bb 100644 --- a/utils/share.js +++ b/utils/share.js @@ -2,6 +2,10 @@ import { autoBindInviteUser, autoGetInviteCode } from '@/common/api/market/distribution.js' + +import { + shareClaim +} from '@/common/api/market/share.js' import { APIshopUserInfo, APIusershopInfodetail @@ -10,8 +14,17 @@ import { productStore } from '@/stores/user.js'; const accountStore = productStore(); +// #ifdef MP-WEIXIN const accountInfo = wx.getAccountInfoSync(); export const envVersion = accountInfo.miniProgram.envVersion; +// #endif + +// #ifdef H5 +const accountInfo = {}; +export const envVersion = 'release' +// #endif + + let type = 3; if (envVersion === 'trial') { console.log('当前环境是体验版'); @@ -24,39 +37,78 @@ if (envVersion === 'trial') { console.log('当前环境是开发版或其他'); } +export const pageTags = { + '/userPackage/index/index': 'pp-list', //套餐推广列表页 + '/userPackage/goodsDetail/goodsDetail': 'pp-detail', //套餐推广商品详情页 + '/groupBuying/index/index': 'gb-list', //商品拼团列表页 + '/groupBuying/goodsDetail/goodsDetail': 'gb-detail', //商品拼团详情页 + '/distribution/shop-detail/index': 'dis', //全民股东页面 + '/pages/index/index': 'index', //店铺首页 + '/pages/product/index': 'eat', //点餐页 + '/pages/product/index?pTag=eat-detail': 'eat-detail', //点餐商品详情弹窗页 + '/scoreShop/index/index':'point' ,//积分商品 + '/scoreShop/detail/index':'point-detail' ,//积分商品详情 +} +export function returnPageTags(page) { + for (let key in pageTags) { + if (page.includes(key)) { + if (page.includes('/pages/product/index')) { + if (page.includes('showGoodsId=')||page.includes('goodsId=')) { + return 'eat-detail' + } else { + return 'eat' + } + } else { + return pageTags[key] + } + } + } + return '' +} /** * 绑定用户邀请关系(核心函数) * 功能说明:校验邀请码有效性,有效则调用自动绑定接口完成邀请关系绑定 * @param {Object} args - 绑定邀请关系的入参对象 - * @param {number} [args.shopUserId] - 需要绑定邀请人的用户ID(integer ,可选) - * @param {number} [args.shopId] - 店铺ID(integer ,可选) - * @param {string} args.inviteCode - 邀请人的邀请码(必填,非空校验通过后才会执行绑定逻辑) + * @param {number} args.fromUserId - 需要绑定邀请人的用户ID(integer ,必填) + * @param {number} args.shopId - 店铺ID(integer ,必填) + * @param {string} args.pTag - 来源页面类型 * @returns {void} 无返回值 */ export async function bindInvite(args) { // 解构入参对象,获取需要的核心参数 const { - shopUserId, + fromUserId, shopId, - inviteCode + pTag, } = args; - - // 校验邀请码有效性:若邀请码为空、null、undefined,则直接返回,不执行后续绑定逻辑 - if (!inviteCode || inviteCode === null || inviteCode === undefined) { + console.log('bindInvite',args); + if (!fromUserId || !shopId) { return; } const shopUserInfo = uni.cache.get('shopUserInfo') // 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数 - return await autoBindInviteUser({ - id: shopUserInfo.id, + return await shareClaim({ + tagType: pTag || '', shopId, - inviteCode + fromUserId: fromUserId, + toUserId: shopUserInfo.id }); } export function wxShare(par) { + const path = par.path + const pTag = returnPageTags(path) + if (pTag) { + par.path += '&pTag=' + pTag + par.query += '&pTag=' + pTag + } + console.log('pTag', pTag); + console.log('wxShare', { + ...par, + type + }); return { ...par, type @@ -67,15 +119,15 @@ export async function returnCommonQuery() { const shopId = uni.cache.get('shopId') const shopUserInfo = uni.cache.get('shopUserInfo') const shopInfo = uni.cache.get('shopInfo') - const inviteCode = await autoGetInviteCode({ - shopId: shopId, - shopUserId: shopUserInfo.id - }) + // const inviteCode = await autoGetInviteCode({ + // shopId: shopId, + // fromUserId: shopUserInfo.id + // }) const queryJson = { - inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null, + // inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null, shopId, - shopUserId: shopUserInfo.id, + fromUserId: shopUserInfo.id, } return Promise.resolve(queryJson) } @@ -104,10 +156,10 @@ export async function returnQuery(query, showkeys) { const shopId = uni.cache.get('shopId') const shopUserInfo = uni.cache.get('shopUserInfo') const shopInfo = uni.cache.get('shopInfo') - const inviteCode = await autoGetInviteCode({ - shopId: shopId, - shopUserId: shopUserInfo.id - }) + // const inviteCode = await autoGetInviteCode({ + // shopId: shopId, + // fromUserId: shopUserInfo.id + // }) const pages = getCurrentPages(); const currentPage = pages[pages.length - 1]; @@ -117,9 +169,9 @@ export async function returnQuery(query, showkeys) { let sharePath = `/${currentPath}`; const queryJson = { - inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null, + // inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null, shopId, - shopUserId: shopUserInfo.id, + fromUserId: shopUserInfo.id, ...query } for (const key in currentOptions) { @@ -132,8 +184,8 @@ export async function returnQuery(query, showkeys) { } } queryJson.shopId = shopId - queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null - queryJson.shopUserId = shopUserInfo.id + // queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null + queryJson.fromUserId = shopUserInfo.id let result = '' for (let key in queryJson) { @@ -178,14 +230,8 @@ export async function handleMixinOnLoad(opt, vm) { await accountStore.pageOnload() } uni.setStorageSync('loadFinsh', true) - // const shopId = uni.cache.get('shopId') - // const shopUserInfo = uni.cache.get('shopUserInfo') - // const shopInfo = uni.cache.get('shopInfo') - // const inviteCode = await autoGetInviteCode({ - // shopId: shopId, - // shopUserId: shopUserInfo.id - // }) - if (options.inviteCode) { + + if (options.shopId) { return await bindInvite(options) } } @@ -220,36 +266,7 @@ export function returnIndexBg() { // utils/share.js export const shareMixin = { - // async onLoad(opt) { - // console.log('onLoad'); - // const options = {} - // if (opt.q) { - // const q = decodeURIComponent(opt.q); - // const params = parseQueryString(q.split("?")[1]); - // Object.assign(options, params); - // } else { - // Object.assign(options, opt); - // } - // console.log('options', options); - // if (options.shopId) { - // uni.cache.set('shopId', options.shopId) - // } - // const shopId = uni.cache.get('shopId') - // const shopUserInfo = uni.cache.get('shopUserInfo') - // const shopInfo = uni.cache.get('shopInfo') - // const inviteCode = await autoGetInviteCode({ - // shopId: shopId, - // shopUserId: shopUserInfo.id - // }) - - // uni.setStorageSync('loadFinsh',true) - - - // if (options.inviteCode) { - // bindInvite(options) - // } - // }, async onShareAppMessage(res) { const shopInfo = uni.cache.get('shopInfo') @@ -261,10 +278,11 @@ export const shareMixin = { let sharePath = `/${currentPath}`; - const query = await returnQuery() + let query = await returnQuery() const indexBg = returnIndexBg() console.log('indexBg', indexBg); const imageUrl = indexBg || shopInfo.logo + // 全局默认配置(可被页面覆盖) const defaultShareConfig = { title: shopInfo.shopName, @@ -311,9 +329,11 @@ export const shareMixin = { let sharePath = `/${currentPath}`; - const query = await returnQuery() + let query = await returnQuery() const indexBg = returnIndexBg() const imageUrl = indexBg || shopInfo.logo + + const defaultTimelineConfig = { title: shopInfo.shopName, path: sharePath + '?' + query, From c0e277fd8f7ebe998665861463b39b242b3ff0ee Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Thu, 29 Jan 2026 14:36:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ymf-components/ymf-share-popup.vue | 29 ++++++++++--------- pages/product/index.vue | 7 +++-- 2 files changed, 21 insertions(+), 15 deletions(-) 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') From 189459845cfab3217e9db64fcc1ebf19e7517ab6 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Fri, 30 Jan 2026 10:11:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ymf-components/ymf-share-popup.vue | 3 ++- distribution/shop-detail/index.vue | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/ymf-components/ymf-share-popup.vue b/components/ymf-components/ymf-share-popup.vue index b795124..95d8b68 100644 --- a/components/ymf-components/ymf-share-popup.vue +++ b/components/ymf-components/ymf-share-popup.vue @@ -112,8 +112,9 @@ // console.log('分享组件挂载完毕:currentOptions',currentOptions); if(res){ Object.assign(config,res) + const rewardSharePages=res.rewardSharePages.split(',') const pTag = returnPageTags(path) - if(pTag&¤tOptions.fromUserId&&res.isSharedUserPopup){ + if( pTag&&rewardSharePages.includes(pTag)&¤tOptions.fromUserId&&res.isSharedUserPopup){ show.value=true } // if(res.sharedUserCouponId&&res.sharedUserCouponNum){ diff --git a/distribution/shop-detail/index.vue b/distribution/shop-detail/index.vue index e1cb053..5c61688 100644 --- a/distribution/shop-detail/index.vue +++ b/distribution/shop-detail/index.vue @@ -203,7 +203,7 @@ - + 加入股东群,优惠、活动多多{{'>>'}} @@ -434,7 +434,7 @@ if (res.distributionId) { options.type = 'activates'; } - if(res.distributionUser&&!res.distributionUser.firstIn){ + if(res.distributionUser&&!res.distributionUser.firstIn&&res.group&&res.group.isEnable){ showGroup.value=true } Object.assign(state, res);