From 2745c27e571263e1fcef1e61cae6e6fedd82e90d Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Thu, 10 Aug 2023 19:00:44 +0800 Subject: [PATCH] 新会员有礼的跳转的优化 --- app.js | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- packageA/pages/profile/profile.js | 6 +++++- packageE/pages/togoin/togoin.js | 7 ++++++- packageE/pages/user/labels/labels.js | 9 +++++++-- 4 files changed, 81 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index 0392cb7..eb0f6b8 100644 --- a/app.js +++ b/app.js @@ -1455,10 +1455,71 @@ App({ }) } return cx_arr; - }, + }, + + //-- 获取判断注册成功后,是跳转等级卡,还是新人有礼 -- + async go_to_page(func){ + + //新判断新人有礼 + var res= await getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", { + data: { + storeId: os.stoid, + userId: this.globalData.user_id + } + }); + + if (res.data.code == 0) { + var actid = res.data.data.id; //活动id + var giftBagId = res.data.data.giftBagId; //礼包id + var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId; + this.goto(new_nav); + return false; + } + //如果已经是等级卡了就跳过 + if(this.globalData.userInfo.card_field){ + //没有等级卡和新人有礼的时候 + if(func) func(); + return false; + } + var dj_buy=await getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + this.globalData.setting.stoid+ "&type=3", {}); + var ob = { isout: 0, isbuy: 0 }; + if (dj_buy.data.code == 0) { + var arr = dj_buy.data.data.pageData; + //----如果数组不为空---- + if (arr.length > 0) { + arr.forEach(function (val, ind) { + if (val.is_sy == 0 || val.is_sy == 1) { + ob.isbuy = 1; + var now = ut.gettimestamp(); + if (now > val.end_time) ob.isout = 1; + return false; + } + }) + } + } + + //-- 获取等级卡,直接去买等级卡 -- + if(ob.isbuy && !ob.isout){ + //-- 获取等级卡购买的数量 -- + var conf=await getApp().promiseGet("/api/weshop/storeconfig/get/" + this.globalData.setting.stoid, {}); + //-- 获取等级卡的会员已经购买的数量 --- + var dj=await getApp().promiseGet("/api/weshop/users/getUserCard/" + this.globalData.setting.stoid, {}); + var dj_num=0; + if(dj.data.code==0){ + dj_num=dj.data.data?dj.data.data:0; + } + if (conf.data.code == 0 && conf.data.data.dj_num>0 && conf.data.data.dj_num>dj_num) { + var nav = "pages/user/plus/plus"; + this.goto(nav); + return false; + } + } + //没有等级卡和新人有礼的时候 + if(func) func(); + } - }); +}); diff --git a/packageA/pages/profile/profile.js b/packageA/pages/profile/profile.js index a7dc0c7..ee69960 100644 --- a/packageA/pages/profile/profile.js +++ b/packageA/pages/profile/profile.js @@ -1040,7 +1040,11 @@ Page({ getApp().globalData.login_back = 1; wx.setStorageSync("userinfo", e.data.data); wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = s.getFullUrl(a.globalData.userInfo.head_pic); - wx.navigateBack({delta: 1}) + //wx.navigateBack({delta: 1}) + //-- 看情况,是跳转等级卡,还是跳转到新人有礼 -- + getApp().go_to_page(function (){ + wx.navigateBack({ delta: 1 }) + }) }, failStatus: function (t) { diff --git a/packageE/pages/togoin/togoin.js b/packageE/pages/togoin/togoin.js index d7501ef..50a78ab 100644 --- a/packageE/pages/togoin/togoin.js +++ b/packageE/pages/togoin/togoin.js @@ -357,7 +357,12 @@ Page({ } }) - wx.navigateBack({ delta: 1 }) + //-- 看情况,是跳转等级卡,还是跳转到新人有礼 -- + getApp().go_to_page(function (){ + wx.navigateBack({ delta: 1 }) + }) + + }, failStatus: function (t) { diff --git a/packageE/pages/user/labels/labels.js b/packageE/pages/user/labels/labels.js index f8e918f..6c4d4ee 100644 --- a/packageE/pages/user/labels/labels.js +++ b/packageE/pages/user/labels/labels.js @@ -273,9 +273,14 @@ Page({ // check_label: arr // }) // th.goto(); - wx.reLaunch({ - url: '/pages/user/index/index', + // wx.reLaunch({ + // url: '/pages/user/index/index', + // }) + //-- 看情况,是跳转等级卡,还是跳转到新人有礼 -- + getApp().go_to_page(function (){ + wx.navigateBack({ delta: 1 }) }) + }, 2000); } else { getApp().my_warnning("系统繁忙,请稍后再试", 0, th); -- libgit2 0.21.4