Commit 2745c27e571263e1fcef1e61cae6e6fedd82e90d

Authored by yvan.ni
1 parent 49dc1331

新会员有礼的跳转的优化

... ... @@ -1455,10 +1455,71 @@ App({
1455 1455 })
1456 1456 }
1457 1457 return cx_arr;
1458   - },
  1458 + },
  1459 +
  1460 + //-- 获取判断注册成功后,是跳转等级卡,还是新人有礼 --
  1461 + async go_to_page(func){
  1462 +
  1463 + //新判断新人有礼
  1464 + var res= await getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", {
  1465 + data: {
  1466 + storeId: os.stoid,
  1467 + userId: this.globalData.user_id
  1468 + }
  1469 + });
  1470 +
  1471 + if (res.data.code == 0) {
  1472 + var actid = res.data.data.id; //活动id
  1473 + var giftBagId = res.data.data.giftBagId; //礼包id
  1474 + var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId;
  1475 + this.goto(new_nav);
  1476 + return false;
  1477 + }
1459 1478  
  1479 + //如果已经是等级卡了就跳过
  1480 + if(this.globalData.userInfo.card_field){
  1481 + //没有等级卡和新人有礼的时候
  1482 + if(func) func();
  1483 + return false;
  1484 + }
1460 1485  
  1486 + var dj_buy=await getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + this.globalData.setting.stoid+ "&type=3", {});
  1487 + var ob = { isout: 0, isbuy: 0 };
  1488 + if (dj_buy.data.code == 0) {
  1489 + var arr = dj_buy.data.data.pageData;
  1490 + //----如果数组不为空----
  1491 + if (arr.length > 0) {
  1492 + arr.forEach(function (val, ind) {
  1493 + if (val.is_sy == 0 || val.is_sy == 1) {
  1494 + ob.isbuy = 1;
  1495 + var now = ut.gettimestamp();
  1496 + if (now > val.end_time) ob.isout = 1;
  1497 + return false;
  1498 + }
  1499 + })
  1500 + }
  1501 + }
  1502 +
  1503 + //-- 获取等级卡,直接去买等级卡 --
  1504 + if(ob.isbuy && !ob.isout){
  1505 + //-- 获取等级卡购买的数量 --
  1506 + var conf=await getApp().promiseGet("/api/weshop/storeconfig/get/" + this.globalData.setting.stoid, {});
  1507 + //-- 获取等级卡的会员已经购买的数量 ---
  1508 + var dj=await getApp().promiseGet("/api/weshop/users/getUserCard/" + this.globalData.setting.stoid, {});
  1509 + var dj_num=0;
  1510 + if(dj.data.code==0){
  1511 + dj_num=dj.data.data?dj.data.data:0;
  1512 + }
  1513 + if (conf.data.code == 0 && conf.data.data.dj_num>0 && conf.data.data.dj_num>dj_num) {
  1514 + var nav = "pages/user/plus/plus";
  1515 + this.goto(nav);
  1516 + return false;
  1517 + }
  1518 + }
  1519 + //没有等级卡和新人有礼的时候
  1520 + if(func) func();
  1521 + }
1461 1522  
1462   - });
  1523 +});
1463 1524  
1464 1525  
... ...
packageA/pages/profile/profile.js
... ... @@ -1040,7 +1040,11 @@ Page({
1040 1040 getApp().globalData.login_back = 1;
1041 1041 wx.setStorageSync("userinfo", e.data.data);
1042 1042 wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = s.getFullUrl(a.globalData.userInfo.head_pic);
1043   - wx.navigateBack({delta: 1})
  1043 + //wx.navigateBack({delta: 1})
  1044 + //-- 看情况,是跳转等级卡,还是跳转到新人有礼 --
  1045 + getApp().go_to_page(function (){
  1046 + wx.navigateBack({ delta: 1 })
  1047 + })
1044 1048  
1045 1049 },
1046 1050 failStatus: function (t) {
... ...
packageE/pages/togoin/togoin.js
... ... @@ -357,7 +357,12 @@ Page({
357 357 }
358 358 })
359 359  
360   - wx.navigateBack({ delta: 1 })
  360 + //-- 看情况,是跳转等级卡,还是跳转到新人有礼 --
  361 + getApp().go_to_page(function (){
  362 + wx.navigateBack({ delta: 1 })
  363 + })
  364 +
  365 +
361 366  
362 367 },
363 368 failStatus: function (t) {
... ...
packageE/pages/user/labels/labels.js
... ... @@ -273,9 +273,14 @@ Page({
273 273 // check_label: arr
274 274 // })
275 275 // th.goto();
276   - wx.reLaunch({
277   - url: '/pages/user/index/index',
  276 + // wx.reLaunch({
  277 + // url: '/pages/user/index/index',
  278 + // })
  279 + //-- 看情况,是跳转等级卡,还是跳转到新人有礼 --
  280 + getApp().go_to_page(function (){
  281 + wx.navigateBack({ delta: 1 })
278 282 })
  283 +
279 284 }, 2000);
280 285 } else {
281 286 getApp().my_warnning("系统繁忙,请稍后再试", 0, th);
... ...