|
@@ -171,6 +171,12 @@ export default {
|
|
|
this.option = option || {}
|
|
this.option = option || {}
|
|
|
this.goodsId = Number(option.goodsId || 0)
|
|
this.goodsId = Number(option.goodsId || 0)
|
|
|
this.groupBuyId = Number(option.id || option.groupBuyId || 0)
|
|
this.groupBuyId = Number(option.id || option.groupBuyId || 0)
|
|
|
|
|
+ // 分享链接需带 account,进入页时同步到本地存储(与商品详情页一致,shopId 作 account 兜底)
|
|
|
|
|
+ const account = Number(option.account || option.shopId || 0)
|
|
|
|
|
+ if (account > 0) {
|
|
|
|
|
+ uni.setStorageSync('account', account)
|
|
|
|
|
+ this.option.account = account
|
|
|
|
|
+ }
|
|
|
this.init()
|
|
this.init()
|
|
|
},
|
|
},
|
|
|
onUnload() {
|
|
onUnload() {
|
|
@@ -399,21 +405,28 @@ export default {
|
|
|
this.$msg('海报生成功能即将上线')
|
|
this.$msg('海报生成功能即将上线')
|
|
|
this.showShareMenu = false
|
|
this.showShareMenu = false
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 组装分享参数,path 必须携带 account 以便好友进入对应店铺
|
|
|
|
|
+ * 注意:不能带 hdId。hdId 是"用户-花艺师"专属绑定关系(后端校验 hd.userId 需等于当前登录用户),
|
|
|
|
|
+ * 分享给其他好友后,好友的 userId 与 hdId 绑定的 userId 不一致,会被后端清空门店信息(mainId=0),
|
|
|
|
|
+ * 进而报"无效门店",因此分享链接只保留 account,不透传 hdId
|
|
|
|
|
+ */
|
|
|
buildSharePayload() {
|
|
buildSharePayload() {
|
|
|
const remain = this.openGroup
|
|
const remain = this.openGroup
|
|
|
? Number(this.openGroup.remainNum)
|
|
? Number(this.openGroup.remainNum)
|
|
|
: Math.max(0, (this.goods.groupSize || 3) - 1)
|
|
: Math.max(0, (this.goods.groupSize || 3) - 1)
|
|
|
const title = remain > 0 ? `还差${remain}人成团` : (this.goods.name || '一起来拼团')
|
|
const title = remain > 0 ? `还差${remain}人成团` : (this.goods.name || '一起来拼团')
|
|
|
const imageUrl = this.goods.coverUrl || this.goods.cover || ''
|
|
const imageUrl = this.goods.coverUrl || this.goods.cover || ''
|
|
|
|
|
+ const account = this.account || uni.getStorageSync('account') || ''
|
|
|
let path = ''
|
|
let path = ''
|
|
|
if (this.shareGroupId) {
|
|
if (this.shareGroupId) {
|
|
|
- path = `pages/groupBuy/detail?id=${this.shareGroupId}&account=${this.account}`
|
|
|
|
|
|
|
+ path = `pages/groupBuy/detail?id=${this.shareGroupId}&account=${account}`
|
|
|
} else {
|
|
} else {
|
|
|
- path = `pages/groupBuy/detail?goodsId=${this.goods.goodsId || this.goodsId}&account=${this.account}`
|
|
|
|
|
|
|
+ path = `pages/groupBuy/detail?goodsId=${this.goods.goodsId || this.goodsId}&account=${account}`
|
|
|
}
|
|
}
|
|
|
- if (this.hdId) path += `&hdId=${this.hdId}`
|
|
|
|
|
return { title, path, imageUrl }
|
|
return { title, path, imageUrl }
|
|
|
},
|
|
},
|
|
|
|
|
+ /** 初始化 H5/小程序分享数据,pagePath 与 onShareAppMessage 保持一致 */
|
|
|
setupShare() {
|
|
setupShare() {
|
|
|
const payload = this.buildSharePayload()
|
|
const payload = this.buildSharePayload()
|
|
|
this.shareData = payload
|
|
this.shareData = payload
|