<template> <div class="domain" :style="{'--main-color':themeColor['--main-color'],'--minor-color':themeColor['--minor-color']}"> <!-- <view class="ant-daipinglun">1</view> --> <!-- <goods-list id="goodsList"></goods-list> --> <!-- <scroll-view @scroll="scrolls" @scrolltolower="scrolltolower" style="height:100vh;overflow-y:auto;" scroll-y="true"> --> <div style="position:relative;"> <div v-if="showSpokesManHome"> <get-index-homepage class="getIndexHomePage"></get-index-homepage> </div> <ThemeDataPlant></ThemeDataPlant> <div v-for="(item,index) in pageData" :key="index"> <div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1"> <banner :datas="item"></banner> </div> <div v-else-if="item.componentCode=='goods-list' && item.componentInfo.visible == 1" style="height:100%;"> <goods-list :class="'goodsListItem' + index" :datas="item"></goods-list> </div> <div v-else-if="item.componentCode == 'area-navigation' && item.componentInfo.visible == 1"> <area-navigation :datas="item" :changeLocation="changeLocation"></area-navigation> </div> <div v-else-if="item.componentCode == 'cube-nav' && item.componentInfo.visible == 1"> <cube-nav :datas="item"></cube-nav> </div> <div v-else-if="item.componentCode == 'time-limited-discount' && item.componentInfo.visible == 1"> <time-limited-discount :class="'time-limited-discount'+index" :datas="item" :k="index"></time-limited-discount> </div> <div v-if="item.componentCode == 'links' && item.componentInfo.visible == 1"> <links :datas="item"></links> </div> <div v-if="item.componentCode == 'interval' && item.componentInfo.visible == 1"> <interval :datas="item"></interval> </div> <div v-if="item.componentCode == 'partition' && item.componentInfo.visible == 1"> <partition :datas="item"></partition> </div> <div v-if="item.componentCode == 'shop-popup' && item.componentInfo.visible == 1"> <shop-popup :datas="item"></shop-popup> </div> <div v-if="item.componentCode == 'float-button' && item.componentInfo.visible == 1"> <float-button :datas="item"></float-button> </div> <div v-if="item.componentCode == 'text-text' && item.componentInfo.visible == 1"> <text-text :datas="item"></text-text> </div> <div v-if="item.componentCode == 'img-text' && item.componentInfo.visible == 1"> <img-text :datas="item"></img-text> </div> <div v-if="item.componentCode == 'goods-search' && item.componentInfo.visible == 1"> <goods-search :datas="item"></goods-search> </div> <div v-if="item.componentCode == 'notice' && item.componentInfo.visible == 1"> <notice :datas="item"></notice> </div> <div v-if="item.componentCode == 'pop-up' && item.componentInfo.visible == 1"> <pop-up :datas="item"></pop-up> </div> <div v-if="item.componentCode == 'coupon' && item.componentInfo.visible == 1"> <coupon :datas="item"></coupon> </div> <div v-if="item.componentCode == 'integral-turntable' && item.componentInfo.visible == 1"> <integralTurntable :datas="item"></integralTurntable> </div> <div v-if="item.componentCode == 'speedy-nav' && item.componentInfo.visible == 1"> <speedy-nav :datas="item"></speedy-nav> </div> <div v-if="item.componentCode == 'video-player' && item.componentInfo.visible == 1" > <video-player :datas="item" :indexs="index"></video-player> </div> <div v-if="item.componentCode == 'official-account' && item.componentInfo.visible == 1"> <official-account></official-account> </div> <div v-if="item.componentCode == 'transverse-label' && item.componentInfo.visible == 1"> <transverse-label :datas="item" :componentIndex="index"></transverse-label> </div> <div v-if="item.componentCode == 'photo-gallery' && item.componentInfo.visible == 1"> <photo-gallery :datas="item"></photo-gallery> </div> <div v-if="item.componentCode == 'live-broadcast' && item.componentInfo.visible == 1"> <live-broadcast :datas="item"></live-broadcast> </div> <div v-if="item.componentCode == 'information' && item.componentInfo.visible == 1"> <information :datas="item"></information> </div> <div v-if="item.componentCode == 'share-picture' && item.componentInfo.visible == 1"> <share-picture :datas="item"></share-picture> </div> <div v-if="item.componentCode == 'merchants-list' && item.componentInfo.visible == 1"> <merchants-list :class="'merchants-list' +index" :datas="item"></merchants-list> </div> <div v-if="item.componentCode == 'spell-group' && item.componentInfo.visible == 1"> <spell-group :datas="item"></spell-group> </div> <div v-if="item.componentCode == 'wo-timeout' && item.componentInfo.visible == 1"> <wo-timeout :datas="item"></wo-timeout> </div> <div v-if="item.componentCode == 'custom-list' && item.componentInfo.visible == 1"> <custom-list :datas="item"></custom-list> </div> <div v-if="item.componentCode == 'rich-text' && item.componentInfo.visible == 1"> <rich-text :datas="item"></rich-text> </div> </div> <bottomCont></bottomCont> </div> <share-popup></share-popup> <div v-if="showMyCard"> <my-card></my-card> </div> <div v-if="showHomepage"> <set-my-homepage :getDistributorHomepageName="getDistributorHomepageName"></set-my-homepage> </div> <div v-if="applySucessEntry"> <apply-sucess-entry></apply-sucess-entry> </div> <NewUser :showNewUser="showNewUser" @togiftbag="togiftbag"></NewUser> <new-polite :showgiftBag="showgiftBag" @closeHandle="closeHandle" :MyNewGiftList="newGiftList"></new-polite> <!-- 底部栏 --> <custom-tab-bar class="custom-tab-bar" :selected="active"></custom-tab-bar> <!-- 生日弹窗 --> <keep-alive> <birth-popup :birthGifts="birthGifts" :isShowBirth="isShowBirth" v-show="true"></birth-popup> </keep-alive> <couponPopup></couponPopup> </div> </template> <script> import shop from "@/api/shop"; import promote from "@/api/promote"; import index from "@/api/index"; import live from "@/api/live"; import bottomCont from "../../components/bottomCont" import ThemeDataPlant from "../../components/ThemeDataPlant" import links from '@/components/basicTool/link/index.vue' import interval from '@/components/basicTool/interval/index.vue' import partition from '@/components/basicTool/partition/index.vue' import shopPopup from '@/components/basicTool/shop-popup/index.vue' import woTimeout from '@/components/basicTool/wo-timeout/index.vue' import transverseLabel from '@/components/basicTool/transverse-label/index.vue' import information from '@/components/content/information/index.vue' import text from '@/components/content/text' import imgText from '@/components/content/imgText' import coupon from '@/components/activity/coupon' import integralTurntable from '@/components/activity/integralTurntable' import spellGroup from '@/components/activity/spellGroup' import birthPopup from '@/components/birthPopup/birthPopup.vue' import birth from '@/api/popup' import couponPopup from '@/components/couponPopup.vue' import NewUser from "../../components/newCustomer/newUser"; import NewPolite from "../../components/newCustomer/newPolite"; import customList from "../../components/custom-list"; import richText from "../../components/basicTool/rich-text"; import { setTabBarActive, checkTabbarPage,themeColor, checkShowConditionIds } from "../../utils/mayi.js"; import indexApi from "@/api/index.js"; import { throttle, concatUrl } from "../../utils/index.js" import mpvueCropper from '@/components/mpvue-cropper' const app = getApp(); export default { data() { return { pageInfo: {}, pageData: {}, themeColor:{ '--main-color':"", '--minor-color':"", }, changeLocation : '', beforeScrollTop:0, showSpokesManHome: false,//分销商货架是否展示 showMyCard: false, showHomepage: false,//分销商首页入口 applySucessEntry: false,//成为分销弹框 getDistributorHomepageName: '',//小店入口名称 active:-1, toHomePage: false,//是否分销隔断 options: 1, // 新人有礼 newGiftList:[], newCustomerGiftActivityId: "", //新客活动id showNewUser: false, //新客有礼入口 showgiftBag: false, //新客礼包弹框 timer: null, isShowBirth: false, // 是否展示生日礼品 birthGifts: "", }; }, components:{ links, interval, partition, shopPopup, bottomCont, ThemeDataPlant, 'text-text':text, 'img-text':imgText, coupon, integralTurntable, transverseLabel, information, spellGroup, couponPopup, NewUser, NewPolite, birthPopup, mpvueCropper, woTimeout, 'custom-list':customList, 'rich-text':richText, }, onShareAppMessage(res) { let {shopCode} = app.globalData.shopInfo; if (res.from === "button") { return new Promise((resolve,reject)=>{ shop.getShopInfo({ shopMixId: shopCode }).then(res=>{ if(res.data.code ==200){ let {shopName} = res.data.data; let logoUrl = app.DFSImg(res.data.data.logoUrl,500,400,0); resolve({ title: shopName, path: "/pages/home/main", imageUrl:logoUrl, success: function(res) { console.log("成功", res); } }); } }) }).then(res=>{ return { ...res, } }) } // return { // title: shareVal.title, // path: "page/home/main", // imageUrl:shareVal.imageUrl, // success: function(res) { // console.log("成功", res); // } // }; }, onReady(){ // 上报首页打开时间 if (wx.canIUse('reportPerformance')) { const performance = wx.getPerformance() const observer = performance.createObserver((entryList) => { let getEntries=entryList.getEntries() wx.reportPerformance(2001, getEntries[0]['duration']) this.$mpBehavior.monitorPerformance(getEntries[0]) }) observer.observe({ entryTypes: ['render'] }) } wx.showShareMenu({ withShareTicket: true, menus: ['shareAppMessage', 'shareTimeline'] }) // 查询是否展示生日礼品 // this.isShowBirth = true // 测试 wx.getStorage({ key: 'sessionid', success: res => { console.log('tz登录', res); this.getBirthGift(this) }, fail: err => { this.isShowBirth = false console.log('tz未登录', err, this.isShowBirth); console.log('未登录状态=====================', err) } }) }, onLoad(options) { console.log('--------on--------------load') //进页面存储需要绑定的信息 if(options.userId||options.spokesmanRelId) { wx.setStorage({ key: "becomeInfo", data: JSON.stringify(options) }); } if(options.scene){ //新二维码扫码进入 wx.nextTick(() => { indexApi.getShareSceneRecord(options.scene).then(res=>{ if(res.data.code == '200'){ this.page = res.data.data.pageUri; let paramsObj = JSON.parse(res.data.data.scene); wx.setStorageSync('attractingCustomerChannelId',paramsObj.attractingCustomerChannelId); wx.setStorageSync(this.$store.state.mixid+'storeId',paramsObj.storeId); wx.setStorageSync(this.$store.state.mixid+'sellerId',paramsObj.sellerId); console.log(res.data.data) console.log(wx.getStorageSync("openid")) console.log(333333) if(wx.getStorageSync("openid")) { indexApi.addRecord( { attractingCustomersChannelId: paramsObj.attractingCustomerChannelId, miniOpenId: wx.getStorageSync("openid"), registerFlag: 1, newRegisterFlag: 0, } ).then(ele=>{ //清空引客渠道id if(ele.data.data) { wx.setStorageSync('attractingCustomerChannelId',''); } }) } } }).catch((err)=>{ }) }); } Object.assign(this.$data, this.$options.data()); if (options.from && options.from == "logout") { //来自用户登出 wx.removeStorage({ key: "sessionid" }); wx.removeStorage({ key: "openid" }); } this.options = wx.getStorageSync("becomeInfo"); this.changeLocation = options.changeLocation || '' if(this.changeLocation == 1){ console.log('this.$store.state.extConfig',this.$store.state.extConfig) app.getShopInfo(this.$store.state.extConfig); app.getThemePage(this.$store.state.extConfig); } let that = this; if(wx.getStorageSync("sessionid")) { //获取个人名片入口 app.fenxiaoModel.getHomePageQuickAccess().then(res=>{ that.showMyCard = res; }) //获取分销信息 this.getSpokesmanInit(wx.getStorageSync("becomeInfo")?JSON.parse(wx.getStorageSync("becomeInfo")):'') } // 来源 if (options.from == "logout") { //来自用户登出 wx.removeStorage({ key: "sessionid" }); wx.removeStorage({ key: "openid" }); } // 获取页面数据 if (this.mpApp.globalData.pageList) { that.init(this.mpApp.globalData.pageList); } else { this.mpApp.pageCallBack = function (params) { that.init(params); }; } if(themeColor['--main-color']!='#ffffff'){ this.themeColor = themeColor }else { this.mpApp.themeColorCallBack=(res)=>{ this.themeColor = res } } // 新人有礼弹窗 this.newUserFun(); }, onShow() { // 设置显示条件 console.log('--------on--------------show') //分销隔流 if(this.toHomePage) { let linkVal = '/personalCenter/spokesmanCenter/mine/spokesmanHomePage?from=_goodsInfo' app.$themeToLink({ type: 1, link:linkVal, }); } this.getCartNum(); if(checkTabbarPage('/')!=-1){ this.active=checkTabbarPage('/') } this.$mp.page.onPageScroll= (el)=>{ throttle(this.scrolls(el),100) }; }, methods: { async setVisible(pageList, cb) { // 首页显示条件 let pageInfo = pageList.filter((item) => item.pageCode == 1)[0]; let pageData = JSON.parse(pageInfo.pageData); // 查询显示条件id let showConditionIds = checkShowConditionIds(pageData); // 查询可显示的条件 let { data: ids ,isAreaNavigation} = await this.checkCondition(showConditionIds); // 没有定位组件 // if (!isAreaNavigation) { // cb() // return // } // 设置visible pageInfo.pageData = this.updateCondition(pageData, ids); console.log(showConditionIds, "--------------5454", ids, pageInfo); cb(pageInfo) }, checkCondition({ allCondition }) { return new Promise((resolve, reject) => { // 获取 let params = { showConditionIds:allCondition, region: "" }; shop .checkShowCondition(params) .then((res) => { console.log(params, "check显示条件", res.data); if (res.data.code == 200) { resolve(res.data); } }) .catch((err) => { console.log("check显示条件失败", err); }); }); }, updateCondition(pageData, ids) { pageData.forEach((item) => { pollCondition(item); }); function pollCondition(data) { if (Object.prototype.toString.call(data) === "[object Object]") { // 如果等于2(仅登录显示)且登录时显示 visible重新赋值1 // 如果等于2且未登录不展示 visible重新赋值0 // 如果等于3(仅登录隐藏)且登录时不展示 visible重新赋值1 // 如果等于3且未登录展示 if(data.visible>1){ console.log(data,wx.getStorageSync('sessionid'),'------491') } if (data.visible && data.visible > 1 && data.visibleCopy == undefined) { data.visibleCopy = data.visible; console.log(data.visibleCopy,'--data.visibleCopy') } if ((data.visibleCopy == 2 && wx.getStorageSync('sessionid')) || (data.visibleCopy == 3 && !wx.getStorageSync('sessionid')) ) { data.visible = 1; } else if ((data.visibleCopy == 2 && !wx.getStorageSync('sessionid')) || (data.visibleCopy == 3 && wx.getStorageSync('sessionid')) ) { data.visible = 0; } else { if (data.condition != "" && data.condition != undefined) { data.visible = ids.some((item) => { return item == data.condition; }) ? 1 : 0; } } for (const key in data) { if (data.hasOwnProperty(key)) { const element = data[key]; if ( Object.prototype.toString.call(element) === "[object Object]" ) { if (element.visible && element.visible > 1 && element.visibleCopy == undefined) { element.visibleCopy = element.visible; } if ((element.visibleCopy == 2 && wx.getStorageSync('sessionid')) || (element.visibleCopy == 3 && !wx.getStorageSync('sessionid')) ) { element.visible = 1; } else if ((element.visibleCopy == 2 && !wx.getStorageSync('sessionid')) || (element.visibleCopy == 3 && wx.getStorageSync('sessionid')) ) { element.visible = 0; } else { if (element.condition != "" && element.condition != undefined) { console.log("979797", element.condition); element.visible = ids.some((item) => { return item == element.condition; }) ? 1 : 0; } } pollCondition(element); } else if ( Object.prototype.toString.call(element) === "[object Array]" && element.length > 0 ) { element.forEach((item) => { pollCondition(item); }); } } } } } return JSON.stringify(pageData); }, init(pageList) { this.getCartNum(); this.active=checkTabbarPage('/'); this.setVisible(this.mpApp.globalData.pageList,(res)=>{ this.pageInfo = res; this.pageData = JSON.parse(this.pageInfo.pageData); }); console.log("36----------------------559", this.pageData,this.pageInfo.pageSettingData); console.log(app.globalData.shopInfo,'app') wx.setNavigationBarTitle({title : app.globalData.shopInfo.shopName}) if(wx.getStorageSync("sessionid")) { //清空门店id wx.setStorageSync(this.$store.state.mixid+'storeId','') wx.setStorageSync(this.$store.state.mixid+'sellerId','') console.log(111222,app.fenxiaoModel) app.fenxiaoModel.query_isEntry().then((data)=>{ //分销弹框信息 console.log(data,3333444) if ( data.applyRemind == "true" && data.displayEntry == "true" ) { this.applySucessEntry = true; }else if ( data.applyRemindByDistributor == "true" && data.displayEntryByDistributor == "true" ) { this.applySucessEntry = true } let footerVal = {...app.globalData.footerVal}; footerVal.componentData.list.forEach(res=>{ if(res.link.name=="分销员中心"&&data.displayEntry == 'true') { res.show = true }else if(res.link.name=="分销员中心"&&data.displayEntry == 'false') { res.show = false }else if(res.link.name=="分销商中心"&&data.displayEntryByDistributor == 'true') { res.show = true }else if(res.link.name=="分销商中心"&&data.displayEntryByDistributor == 'false') { res.show = false } }) app.globalData.footerVal = footerVal; this.$mp.page.selectComponent(".custom-tab-bar").init(); // that.applySucessEntry = res; }) }else { let footerVal = {...app.globalData.footerVal}; console.log('"分销员中心"',footerVal) if (footerVal.componentData) { footerVal.componentData.list.forEach(res=>{ if(res.link.name=="分销员中心"||res.link.name=="分销商中心") { res.show = false } }) app.globalData.footerVal = footerVal; this.$mp.page.selectComponent(".custom-tab-bar").init(); } } }, getSpokesmanInit(extConfig) { //绑定上下级关系 app.fenxiaoModel.becomeRelation(extConfig).then(res=>{ if(res) { wx.removeStorage({ key: "becomeInfo" }); } //获取分销基本信息 this.getSpokesmanInfo(extConfig) }) }, getSpokesmanInfo(extConfig) { let linkVal = '/personalCenter/spokesmanCenter/mine/spokesmanHomePage?from=_goodsInfo'; app.fenxiaoModel.getSpokesmanInfo(true).then(res=>{ if( res&& res!='-1'&& res.distributorHomepage&& res.distributorHomepage != 'null'&& res.parentPartitionHomepageFlag == '1' ) { this.toHomePage = true; // let linkVal = '/personalCenter/spokesmanCenter/mine/spokesmanHomePage?from=_goodsInfo' app.$themeToLink({ type: 1, link:linkVal, }); } if(res && res.id ){ app.fenxiaoModel.getDistributorHomepage(res).then(ele=>{ if(ele.id) { this.getDistributorHomepageName = '我的小店'; }else { this.getDistributorHomepageName = '一键开店'; } }); } if( res&& res.parentSpokesmanDistributionModel == '1'&& res.distributorHomepage.id) { this.showSpokesManHome = true; }else { this.showSpokesManHome = false; } console.log(res,555666) if(res&&res.distributionModel == '1') { this.showHomepage = true; }else{ this.showHomepage = false; } }) }, scrolls(el){ // this.setFooterShow(el); if (this.pageData) { for (let i = 0; i < this.pageData.length; i++) { const element = this.pageData[i] if(element.componentCode=="time-limited-discount"){ let com=this.$mp.page.selectComponent(".time-limited-discount"+i) ; com && com.getScroll(el); } if(element.componentCode=="goods-list"){ let com=this.$mp.page.selectComponent(".goodsListItem"+i) ; com && com.getScroll(el); } if(element.componentCode=="merchants-list"){ let com=this.$mp.page.selectComponent(".merchants-list"+i) ; com && com.getScroll(el); } } } if(this.$mp.page && this.$mp.page.selectComponent(".getIndexHomePage")){ this.$mp.page.selectComponent(".getIndexHomePage").getScroll(el); } if(this.$mp.page && this.$mp.page.selectComponent(".goodsListItem")){ this.$mp.page.selectComponent(".goodsListItem").getScroll(el); } }, setFooterShow(el){ // return let afterScrollTop = el.scrollTop; let delta = afterScrollTop - this.beforeScrollTop; let {showFlag} = this.$mp.page.selectComponent(".custom-tab-bar").data; if( Math.abs(delta) < 10 || afterScrollTop < 0 || this.beforeScrollTop < 0 || (delta>0 && showFlag=='down') || (delta<0 && showFlag=='up') ){ this.beforeScrollTop = afterScrollTop; return; } this.$mp.page.selectComponent(".custom-tab-bar").setData({'showFlag':delta>0?'down':'up'}) console.log('---------383') }, scrolltolower(){ console.log("scrolltolower") }, getCartNum() { app.cartApi.my_cart_count().then(res => { if (res.data.code == 200) { this.$mp.page.selectComponent(".custom-tab-bar").setData({"cartNum": Number(res.data.data)}); } }); }, newUserFun(){ promote.query_org_new_customer_gift().then(res=>{ if (res.data.code == 200 && res.data.data) { console.log(res.data.data,'----------------------------res.data') this.newGiftList = []; res.data.data.coupons.forEach((item) => { if (item.couponQty >= 1) { for (var i = 0; i < item.couponQty; i++) { item.preferentialMoney = parseFloat(item.preferentialMoney); item.preferentialDiscount = parseFloat(item.preferentialDiscount); item.meetMoneyUse = parseFloat(item.meetMoneyUse); this.newGiftList.push(item); } } }); this.newCustomerGiftActivityId = res.data.data.id; // 如果有活动 if (res.data.data != null) { setTimeout(() => { if (!wx.getStorageSync("sessionid")) { this.showNewUser = true; } else { this.showNewUser = false; //入口隐藏 live.getUserInfo().then((res) => { if (res.data.code == 200) { // 已经领取过的话,就判断是否展示弹框 // 判断是否是新客 let isNewUser = false; res.data.data.tagNames.forEach(function (item) { console.log(item.tagName + "999999"); if (item.tagName == "新客") { isNewUser = true; } }); if (res.data.data.obtainNewCustomerGiftFlag == "true") { //如果领取过 this.showNewUser = false; // 判断是否需要展示弹框 // 如果需要弹,并且是新用户的话 if ( res.data.data.showDialogNewCustomerGiftFlag == "true" && isNewUser == true ) { this.showgiftBag = true; //弹框展示 console.log(this.showgiftBag,'showgiftBag-----------1') this.showNewUser = false; //入口隐藏 this.getUserreceiveGift(); //定时查我领取的新客礼包 } else { // 不是新用户, this.showNewUser = false; //入口关闭 this.showgiftBag = false; //弹框不显示 console.log(this.showgiftBag,'showgiftBag-----------2') } } else { // 未领取过的,判断是不是新用户 if (isNewUser == true) { // 是新用户的,弹弹框提示, this.showgiftBag = true; console.log(this.showgiftBag,'showgiftBag-----------3') this.getUserreceiveGift(); } else { // 不是新用户, this.showNewUser = false; //入口关闭 this.showgiftBag = false; //弹框不显示 console.log(this.showgiftBag,'showgiftBag-----------4') } } } }); } }, 1000); } else { // 没活动 this.showNewUser = false; } } else { // Toast(res.msg); } }) }, getUserreceiveGift() { this.timer = setInterval(() => { // 查询我领取的新客礼品 promote.query_my_new_customer_gift().then((res) => { if (res.data.code == 200) { // data为null就是没有查询到我领取的优惠券,就再调一次领取优惠券接口手动领取下 if (res.data.data == null) { console.log("没领到"); } else { clearInterval(this.timer); } } else { Toast(res.data.msg); clearInterval(this.timer); } }); }, 5000); }, togiftbag() { // 弹框展开之后,点击立即领取,然后去判断是否登录 // 如果没有登录,就到登录页面去完成注册,登录,如果是已经登录过的,点击立即领取之后就直接显示知道了 if (this.newGiftList.toString().length <= 0) { this.showgiftBag = false; } else { this.showgiftBag = true; } }, closeHandle() { // 关闭弹框之后调取消接口就隐藏,不展示 if (wx.getStorageSync("sessionid")) { index.cancelNewCustome(this.newCustomerGiftActivityId).then((res) => { // console.log(res,'ooooooooo123'); if (res.data.code == 200) { // 接口调成功之后,就关闭弹框 this.showgiftBag = false; } else { Toast(res.data.msg); this.showgiftBag = false; } }); } else { this.showgiftBag = false; } }, getBirthGift(that) { birth.getQueryGift().then(res => { let result = res.data if(result.code == -1 || result.msg == '没有查询到用户信息'){ wx.removeStorage({ key: "sessionid" }); wx.removeStorage({ key: "openid" }); } console.log(JSON.stringify(result), that, 'tztztz初始化') if (result.data.gifts !== null && result.data.gifts.length > 0) { // 判断礼物是否领取完成 let showPopup = false; let arr = []; for (let i = 0; i < result.data.gifts.length; i++) { // 未领取的礼物添加到数组中 if (result.data.gifts[i].executeStatus !== "1") { showPopup = true; arr.push(result.data.gifts[i]); } } if (showPopup) { // 替换原有数组 result.data.gifts = arr; that.toggleData(result.data) } } }); }, toggleData(res) { this.isShowBirth = true; console.log(this.isShowBirth, JSON.stringify(res) + 'tzToggleData') this.birthGifts = res; } }, async onShareAppMessage(res){ console.log(res) let newHref = '/pages/home/main'; let title = app.globalData.shopInfo.shopName; let hasInvitationStatus = 0; if(wx.getStorageSync("sessionid")) { await app.fenxiaoModel.getSpokesmanidByShare().then(data=>{ hasInvitationStatus = data.hasInvitationStatus; }) await app.fenxiaoModel.getSpokesmanInfo().then(data=>{ let newData = {} if(data != null ) { if (hasInvitationStatus == 1) { newData = { spokesmanGroupId: data.groupId, spokesmanShopId: data.shopId, spokesmanRelId: data.id, userId: data.userId } }else { newData = { userId: data.userId } } } newHref = concatUrl(newHref,newData) }) } let imageUrl = ''; //多主题自定义分享标题和图片 if(this.pageInfo.pageSettingData&&JSON.parse(this.pageInfo.pageSettingData).shareTitle) { title = JSON.parse(this.pageInfo.pageSettingData).shareTitle } if(this.pageInfo.pageSettingData&&JSON.parse(this.pageInfo.pageSettingData).shareImg) { imageUrl = JSON.parse(this.pageInfo.pageSettingData).shareImg } console.log(newHref,3333555666,title,res) return { title: title, // 默认是小程序的名称 path: newHref, // 默认是当前页面 imageUrl: imageUrl, success: function(res) { // 转发成功之后的回调 if (res.errMsg == "shareAppMessage:ok") { console.log(res, "分享成功"); } }, fail: function() { // 转发失败之后的回调 if (res.errMsg == "shareAppMessage:fail cancel") { // 用户取消转发 console.log(res, "分享失败"); } else if (res.errMsg == "shareAppMessage:fail") { // 转发失败,其中 detail message 为详细失败信息 } }, complete: function() { // 转发结束之后的回调(转发成不成功都会执行) } }; }, onShareTimeline(res) { console.log(res,'-----onShareTimeline') }, onPullDownRefresh(){ setTimeout(() => { wx.stopPullDownRefresh(); }, 1500); console.log('onPullDownRefresh',this.$store.state.extConfig) app.getShopInfo(this.$store.state.extConfig); app.getThemePage(this.$store.state.extConfig); } }; </script> <style> .domain { /* text-align: center; */ /* padding-top: 50%; */ } </style>