Commit f96e4f7c authored by beisir's avatar beisir

feat:测试app分享环境

parent 6a49e2f9
......@@ -379,5 +379,5 @@ export function appShareEventChange({ title, desc, link, imgUrl, posterUrl }) {
}
}
};
Bridge.showShareView(data);
jsBridge.showShareView(data);
}
......@@ -86,7 +86,6 @@ import { setAppTitleColor } from '@/service/utils.service';
import { registeredEvents } from '@/service/sa.service';
import { isNull } from '@/service/validation.service';
import config from '@/config';
console.log(config.localHost);
let topicIndex;
export default {
// eslint-disable-next-line vue/name-property-casing
......@@ -196,6 +195,7 @@ export default {
async openShareEvent() {
const activity_id = this.activityId;
const shareInfo = await this.getShareData();
console.log(shareInfo);
this.$store.dispatch('goods_share_open', shareInfo);
registeredEvents('H5_GroupZeroYuanPurchaseActivityPageSharePopupBtnClick', {
activity_id
......@@ -331,6 +331,7 @@ async function getActivityList(urlQuery, next) {
vm.activityId = activityId;
vm.goodsTemp = t;
localStorage.set('activityId', activityId);
vm.setTitleColor(t.bgcolor);
vm.getGoodsList(true);
vm.reload = false;
});
......
......@@ -19,25 +19,16 @@
</cr-tab>
</cr-tabs>
<share-pic ref="sharePic" :share-pic-data="sharePicData" @outputPicUrl="outputPicUrl" />
<!-- <cr-action-sheet
v-model="showExpressPopup"
title="请选择物流单号"
cancel-txt="关闭"
round
:actions="expressActions"
@click="toExpress"
/> -->
</div>
</template>
<script>
import groupBuyApi from '@/api/groupBuy';
import List from './components/List';
import { isApp } from '@/service/validation.service';
import localStorage from '@/service/localStorage.service';
import { EventBus } from '@/service/utils.service';
import { isApp, isWxMp } from '@/service/validation.service';
import sharePic from '@/components/sharePic';
import qs from 'qs';
import MpBridge from '@/service/mp';
import config from '@/config';
const commonParams = {
loading: false,
finished: false,
......@@ -98,23 +89,26 @@ export default {
mounted() {
this.getstatusQuery();
this.getList();
// this.onShareEventChange();
},
beforeDestroy() {
console.log('订单页EventBusClose');
const name = this.$route.name;
EventBus.$off(`shareClickItem${name}`);
},
created() {
this.nativeBridge = new MpBridge();
},
methods: {
outputPicUrl(posterUrl) {
this.nativeBridge.openNewUrl({
newUrl: `/pages/goodshare/index?url=${encodeURIComponent(JSON.stringify(posterUrl))}`
});
async outputPicUrl(posterUrl) {
if (isApp) {
// 如果是app环境直接调用app方法
const shareInfo = await this.getShareData({ ...this.sharePicData, posterUrl });
this.$store.dispatch('goods_share_open', shareInfo);
}
if (isWxMp) {
// 如果是小程序则默认跳转小程序的海报保存页面
this.nativeBridge.openNewUrl({
newUrl: `/pages/goodshare/index?url=${encodeURIComponent(JSON.stringify(posterUrl))}`
});
}
},
async getShareData(shareInfo) {
// 处理详情页面分享数据
const linkPath = qs.stringify({
h: 0,
skuNo: shareInfo.skuNo,
......@@ -124,21 +118,20 @@ export default {
templateId: shareInfo.templateId,
templateDetailId: shareInfo.templateId
});
const detailUrl = `${window.location.origin}/groupBuy/skuInfoSmallPic?${linkPath}`;
const detailUrl = `${config.localHost}/groupBuy/skuInfoSmallPic?${linkPath}`;
return Promise.resolve({
title: shareInfo.skuName,
desc: '',
link: `pages/webview/webview?url=${encodeURIComponent(JSON.stringify(detailUrl))}`, // 页面地址
imgUrl: shareInfo.skuImg // 图片地
imgUrl: shareInfo.skuImg, // 图片地
posterUrl: shareInfo.posterUrl
});
},
async onShareEventChange({ ev, nativeBridge }) {
const vm = this;
console.log('订单页EventBusOpen');
const shareDic = await vm.getShareData(vm.sharePicData);
console.log(shareDic);
const shareDic = await this.getShareData(this.sharePicData);
if (ev === 'pic') {
// 分享海报跳转小程序海报分享页面
vm.$refs.sharePic.createAndUploadPic();
this.$refs.sharePic.createAndUploadPic();
}
if (ev === 'weixin') {
// 分享朋友派发微信postMessage事件
......@@ -165,9 +158,15 @@ export default {
async openShareEvent(info) {
try {
const [res] = await groupBuyApi.getGroupShareInfo(info.orderNo);
console.log(res);
this.sharePicData = res;
this.$store.dispatch('goods_share_open');
if (isWxMp) {
// 如果是微信弹出底部框
this.$store.dispatch('goods_share_open');
}
if (isApp) {
// 如果是app则先调用创建海报组件
this.$refs.sharePic.createAndUploadPic();
}
} catch (err) {
console.log(err);
}
......@@ -183,121 +182,6 @@ export default {
break;
}
},
orderRefundPopup(cashCouponCancelNote, showCashCouponCancelNote) {
let tips = {
message: this.currentOrder.cancelNote || '宝贝马上就要发货了,您真的要取消吗?',
confirmButtonText: '仍要取消',
cancelButtonText: '留下商品',
onConfirm: () => {
this.showCancelPopup = true;
}
};
if (
this.currentOrder.skuList[0].skuSource === 5 ||
this.currentOrder.skuList[0].skuSource === 6
) {
tips = {
message: '该商品暂不支持取消,您可以在收货时直接拒收,钱款原路退回付款账户中',
confirmButtonText: '知道了',
showCancelButton: false
};
}
if (showCashCouponCancelNote) {
tips = {
message: cashCouponCancelNote,
confirmButtonText: '确认退货',
cancelButtonText: '不退了',
onConfirm: () => {
this.showCancelPopup = true;
}
};
}
this.$dialog(tips);
},
orderCancelPopup() {
this.showCancelPopup = true;
},
// 售后中
toRefund() {
if (this.currentOrder.currentSku.havingService) {
localStorage.set('orderInfo', this.currentOrder);
this.$router.push({
name: 'refundDetail'
});
return;
}
if ([2, 5, 6].indexOf(this.currentOrder.currentSku.skuSource) > -1) {
this.$dialog({
message: '您购买的商品确认收货后才可以申请售后哦!',
confirmButtonText: '知道了',
showCancelButton: false
});
return;
}
},
toPay() {
this.$router.push({ name: 'pay', query: { orderNo: this.currentOrder.orderNo } });
},
toGoods() {
this.$router.push({
path: '/goodDetail',
query: { skuNo: this.currentOrder.skuList[0].skuNo }
});
},
orderConfirmPopup() {
if (!this.currentOrder.orderNo) return;
// this.$dialog({
// title: '确定该订单已收货吗?',
// onConfirm: () => {
// orderApi
// .orderConfirm({
// orderNo: this.currentOrder.orderNo,
// status: 41
// })
// .then(res => {
// if (res[0]) {
// this.updateCurrentOrder(41, '交易完成');
// this.$toast('操作成功');
// }
// });
// }
// });
},
handleCancelstatus() {
this.updateCurrentOrder(51, '交易关闭');
},
updateCurrentOrder(status, txt) {
this.$set(this.navList[this.currentTab].list[this.currentOrder.index], `orderStatus`, status);
this.$set(
this.navList[this.currentTab].list[this.currentOrder.index],
`orderStatusText`,
txt
);
},
expressActionsCheck() {
const { expressInfoList } = this.currentOrder;
if (expressInfoList.length > 1) {
this.expressActions = expressInfoList.map(item => {
return {
name: item.deliveryNo,
deliveryNo: item.deliveryNo,
expressCompanyCode: item.expressCompanyCode
};
});
this.showExpressPopup = true;
} else {
this.toExpress(expressInfoList[0]);
}
},
toExpress(item) {
this.$router.push({
path: '/expressDetail',
query: { ...item, deliveryOrderId: this.currentOrder.orderNo }
});
},
orderNotify() {
this.$toast.success('已通知卖家');
},
setNavListData(key, val) {
this.$set(this.navList[this.currentTab], key, val);
},
......
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