Commit 7bdf6a64 authored by beisir's avatar beisir

feat:update shareGroup

parent bfa869a1
...@@ -52,5 +52,8 @@ export default { ...@@ -52,5 +52,8 @@ export default {
return http.get(`${talosHost}/api/kdsp/group-order/list`, { return http.get(`${talosHost}/api/kdsp/group-order/list`, {
params params
}); });
},
getGroupShareInfo(orderNo) {
return http.get(`${talosHost}/api/kdsp/groupShareInfo?orderNo=${orderNo}`);
} }
}; };
...@@ -34,7 +34,6 @@ export default { ...@@ -34,7 +34,6 @@ export default {
}), }),
showShare: { showShare: {
get() { get() {
console.log(this.$store.state.pay);
return this.$store.state.pay.showShare; return this.$store.state.pay.showShare;
}, },
set() { set() {
...@@ -50,24 +49,11 @@ export default { ...@@ -50,24 +49,11 @@ export default {
methods: { methods: {
shareCloseChange() {}, shareCloseChange() {},
bundleShareClickItem(ev) { bundleShareClickItem(ev) {
if (ev === 'wexin') { if (ev === 'weixin') {
this.shareDialogConfirm(); this.shareDialogConfirm();
} }
EventBus.$emit('shareClickItem', ev); const nativeBridge = this.nativeBridge;
// if (ev === 'pic') { EventBus.$emit('shareClickItem', { ev, nativeBridge });
// const { posterUrl } = this.shareInfo;
// this.nativeBridge.openNewUrl({
// newUrl: `/pages/goodshare/index?url=${encodeURIComponent(JSON.stringify(posterUrl))}`
// });
// }
// if (ev === 'weixin') {
// this.nativeBridge.run({
// event: 'showShareView',
// data: {
// shareDic: this.shareInfo
// }
// });
// }
registeredEvents('H5_GroupZeroYuanPurchaseActivityPageSharePopupWindowBtnClick', { registeredEvents('H5_GroupZeroYuanPurchaseActivityPageSharePopupWindowBtnClick', {
sku_no: '', sku_no: '',
buttons_name: '', // 按钮名称 buttons_name: '', // 按钮名称
......
This diff is collapsed.
...@@ -89,7 +89,8 @@ import { isWxMp, isApp } from '@/service/validation.service'; ...@@ -89,7 +89,8 @@ import { isWxMp, isApp } from '@/service/validation.service';
import Bridge from '@qg/js-bridge'; import Bridge from '@qg/js-bridge';
import MpBridge from '@/service/mp'; import MpBridge from '@/service/mp';
import { registeredEvents } from '@/service/sa.service'; import { registeredEvents } from '@/service/sa.service';
import { EventBus } from '@/service/utils.service';
import groupBuyApi from '@/api/groupBuy';
export default { export default {
name: 'OrderSkuList', name: 'OrderSkuList',
components: { components: {
...@@ -106,6 +107,8 @@ export default { ...@@ -106,6 +107,8 @@ export default {
}, },
data() { data() {
return { return {
shareInfo: null,
nativeBridge: null, nativeBridge: null,
gpCountDown: new Date('2021-09-12 00:00:00').getTime(), gpCountDown: new Date('2021-09-12 00:00:00').getTime(),
...@@ -148,6 +151,9 @@ export default { ...@@ -148,6 +151,9 @@ export default {
if (isApp) this.nativeBridge = new Bridge(); if (isApp) this.nativeBridge = new Bridge();
else if (isWxMp) this.nativeBridge = new MpBridge(); else if (isWxMp) this.nativeBridge = new MpBridge();
}, },
mounted() {
this.onShareEventChange();
},
methods: { methods: {
goGroupDetails(skuInfo) { goGroupDetails(skuInfo) {
this.nativeBridge.openNewUrl({ this.nativeBridge.openNewUrl({
...@@ -157,33 +163,29 @@ export default { ...@@ -157,33 +163,29 @@ export default {
goGroupPayPages(skuInfo) { goGroupPayPages(skuInfo) {
this.$router.push(`/pay?orderNo=${skuInfo.orderNo}`); this.$router.push(`/pay?orderNo=${skuInfo.orderNo}`);
}, },
async getGroupShareInfo(order) {
const res = await groupBuyApi.getGroupShareInfo(order);
console.log(res);
},
async openShareEvent(skuInfo) { async openShareEvent(skuInfo) {
let options = await this.getShareData(skuInfo); // this.getGroupShareInfo('1440970158226214912');
this.$store.dispatch('goods_share_open', options); this.shareInfo = skuInfo;
this.$store.dispatch('goods_share_open');
registeredEvents('H5_MyPuzzlePageGroupOrderBtnClick', { registeredEvents('H5_MyPuzzlePageGroupOrderBtnClick', {
sku_no: '', sku_no: '',
leader_user_id: '' leader_user_id: ''
}); });
}, },
async getShareData(skuInfo) {
return Promise.resolve({
title: skuInfo.skuName,
desc: '我正在免费拿商品,请你帮帮我',
link: `${window.location.origin}/activity/zeroBuy`, // 页面地址
imgUrl: skuInfo.imageUrl // 图片地
});
// await
},
toDetail(goodsItem) { toDetail(goodsItem) {
const { skuNo, skuList, activityInfoId, activityHundredGroupId } = goodsItem; const { skuList, activityInfoId, activityHundredGroupId } = goodsItem;
this.$router.push({ this.$router.push({
path: '/groupBuy/skuInfoSmallPic', path: '/groupBuy/skuInfoSmallPic',
query: { query: {
h: 0, h: 0,
skuNo, skuNo: skuList[0].skuNo,
activityHundredGroupId, groupBuyGroupId: activityHundredGroupId,
goodsSpecialId: skuList[0].goodsSpecialId, goodsSpecialId: skuList[0].goodsSpecialId,
activityId: activityInfoId, activityId: activityInfoId,
templateId: skuList[0].activityTemplateInfoId, templateId: skuList[0].activityTemplateInfoId,
...@@ -197,8 +199,37 @@ export default { ...@@ -197,8 +199,37 @@ export default {
onOptionClick(orderInfo, eventType) { onOptionClick(orderInfo, eventType) {
this.$emit(EVENT_CLICK, { orderInfo, eventType }); this.$emit(EVENT_CLICK, { orderInfo, eventType });
}, },
toHome() { async getShareData(shareInfo) {
this.$router.replace({ path: '/home' }); return {
title: shareInfo.skuName,
link: `${window.location.origin}/activity/zeroBuy`, // 页面地址
imgUrl: shareInfo.skuImg // 图片地
};
},
onShareEventChange() {
EventBus.$on('shareClickItem', async function({ ev, nativeBridge }) {
if (ev === 'pic') {
// 分享海报跳转小程序海报分享页面
// nativeBridge.openNewUrl({
// newUrl: `/pages/goodshare/index?url=${encodeURIComponent(
// JSON.stringify(shareDic.posterUrl)
// )}`
// });
}
if (ev === 'weixin') {
// const res = await groupBuyApi.getGroupShareInfo(this.shareInfo.order);
const [res] = await groupBuyApi.getGroupShareInfo('1440884214932389888');
console.log(res);
const shareDic = await this.getShareData(res);
// 分享朋友派发微信postMessage事件
nativeBridge.run({
event: 'showShareView',
data: {
shareDic
}
});
}
});
} }
} }
}; };
......
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