From d94b5a2e261e5d4cf5bf9bf74a9546839f19f42e Mon Sep 17 00:00:00 2001 From: abson Date: Mon, 7 Mar 2022 17:58:07 +0800 Subject: [PATCH] 专享礼包分享朋友重构 导购问题 --- pages/giftpack/buygiftpack/giftpackbuy.js | 43 ++++++++++++++++++++++++------------------- pages/giftpack/buygiftpack/giftpackbuy.wxml | 2 +- pages/giftpack/giftpacklist/giftpacklist.js | 25 +++++++++++++++++-------- pages/giftpack/mygiftpack/mygiftpack.js | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------ pages/giftpack/mygiftpack/mygiftpack.wxml | 2 +- 5 files changed, 110 insertions(+), 89 deletions(-) diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 93f7af1..dccbaa0 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -29,14 +29,20 @@ Page({ first_leader: e.globalData.first_leader || 0, // 推荐人ID }, onLoad: function (options) { - + this.setData({ + params: options, + }) + + }, + init() { var th = this; - var my_confirm = th.selectComponent("#my_confirm"); //组件的id - my_confirm.open_cancel(0); - th.setData({ + let options = this.data?.params; + this.setData({ getStorageID: a.stoid, getUserID: d.user_id }); + var my_confirm = th.selectComponent("#my_confirm"); //组件的id + my_confirm.open_cancel(0); //-- 获取分享人的ID -- var first_leader = options.first_leader || getApp().globalData.first_leader; if (first_leader) { @@ -52,8 +58,6 @@ Page({ } }) } - - getApp().request.promiseGet("/api/weshop/ad/page?pid=901&store_id=" + os.stoid, { data: { enabled: 1 @@ -72,19 +76,18 @@ Page({ }); } }) - - + this.getList(); }, onShow: function () { //--先判断会员状态-- - getApp().is_Single_page(this,function(){ + getApp().is_Single_page(this, function () { var user_info = getApp().globalData.userInfo; if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - getApp().goto('/pages/togoin/togoin'); - return false; + getApp().goto('/pages/togoin/togoin'); + return false; } - this.getList(); }) + this.init(); }, //购买礼包 @@ -190,7 +193,7 @@ Page({ if (getApp().globalData.guide_id) { json.guide_id = getApp().globalData.guide_id; } - console.log(json,'json'); + console.log(json, 'json'); var data = JSON.stringify(json); var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; getApp().request.json_post(url, json, @@ -201,7 +204,7 @@ Page({ getApp().my_warnning(res.data.msg, 0, th); } }, - function (res) {}) + function (res) { }) }) @@ -245,7 +248,7 @@ Page({ getApp().my_warnning(res.data.msg, 0, th); } }, - function (res) {}) + function (res) { }) }) }, @@ -271,12 +274,14 @@ Page({ wareCard: arr3, total: res.data.data.total, ismore: ismore, - is_read: 1 + is_read: 1, + is_get:1 }), wx.stopPullDownRefresh(); //停止下拉刷新 } else { th.setData({ is_read: 1, - ismore: 1 + ismore: 1, + is_get:1 }) } } @@ -326,7 +331,7 @@ Page({ if (pagePath.indexOf('/') != 0) { pagePath = '/' + pagePath; } - pagePath += "?first_leader="+this.data.getUserID; + pagePath += "?first_leader=" + this.data.getUserID; return { title: "专享礼包", path: pagePath, @@ -340,7 +345,7 @@ Page({ if (pagePath.indexOf('/') != 0) { pagePath = '/' + pagePath; } - pagePath += "?first_leader="+this.data.getUserID; + pagePath += "?first_leader=" + this.data.getUserID; return { title: '专享礼包', imageUrl: this.data.ad_data.ad_code, diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxml b/pages/giftpack/buygiftpack/giftpackbuy.wxml index e711329..ab4a751 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.wxml +++ b/pages/giftpack/buygiftpack/giftpackbuy.wxml @@ -94,7 +94,7 @@ - + diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index b5eaf11..7e8a399 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -32,14 +32,22 @@ Page({ first_leader: e.globalData.first_leader || 0, // 推荐人ID }, onLoad: function (options) { + this.setData({ + params:options, + }) + }, + init(){ + let options = this.data?.params; var th = this; - th.setData({ + this.setData({ + getUserID: d.user_id, + getStorageID: a.stoid, + }) + this.setData({ isBuy: options.isBuy, getGiftID: options.lbId, orderSn: options.orderSn, - getUserID: d.user_id, }) - if (options.lbId) th.data.lbId = options.lbId; //-- 获取分享人的ID -- var first_leader = options.first_leader || getApp().globalData.first_leader; @@ -57,6 +65,11 @@ Page({ }) } th.close(); + if (this.data.isBuy == 0) { + this.GetMyGiftList(); + } else { + this.GetBuyGiftList(); + } }, onShow: function () { @@ -67,11 +80,7 @@ Page({ getApp().goto('/pages/togoin/togoin'); return false; } - if (this.data.isBuy == 0) { - this.GetMyGiftList(); - } else { - this.GetBuyGiftList(); - } + this.init(); }) }, GetBuyPrice: function (e) { diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index bb6574b..8e0d3d7 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -25,19 +25,24 @@ Page({ curpage: 1, //当前分页数 pageSize: 10, //页大小 total: 0, //总数量 - ad_data:null, + ad_data: null, first_leader: e.globalData.first_leader || 0, // 推荐人ID }, + onLoad: function (options) { + this.setData({ + params: options, + }) + }, - onLoad: function(options) { + init() { + let options = this.data?.params; var th = this; - th.setData({ + this.setData({ getStorageID: a.stoid, getUserID: d.user_id, loadingType: 0, getDate: i.formatTime(new Date().getTime()) }); - //-- 获取分享人的ID -- var first_leader = options.first_leader || getApp().globalData.first_leader; if (first_leader) { @@ -53,39 +58,39 @@ Page({ } }) } - - getApp().request.promiseGet("/api/weshop/ad/page?pid=901&store_id=" + os.stoid, { - data: { - enabled: 1 - } - }).then(res => { - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ - var a = res.data.data.pageData; - var tt = { - 'ad_code': os.imghost + a[0].ad_code, - 'media_link': '', - 'ad_weapplink':a[0].ad_weapplink, - 'bgcolor':a[0].bgcolor, - }; - th.setData({ad_data:tt}); - } - }) + getApp().request.promiseGet("/api/weshop/ad/page?pid=901&store_id=" + os.stoid, { + data: { + enabled: 1 + } + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { + var a = res.data.data.pageData; + var tt = { + 'ad_code': os.imghost + a[0].ad_code, + 'media_link': '', + 'ad_weapplink': a[0].ad_weapplink, + 'bgcolor': a[0].bgcolor, + }; + th.setData({ ad_data: tt }); + } + }) + this.getList(); }, - onShow: function() { + onShow: function () { //--先判断会员状态-- - getApp().is_Single_page(this,function () { + getApp().is_Single_page(this, function () { var user_info = getApp().globalData.userInfo; if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - getApp().goto('/pages/togoin/togoin'); - return false; + getApp().goto('/pages/togoin/togoin'); + return false; } - this.getList(); + this.init() }) - + }, - getList: function() { + getList: function () { var th = this; getApp().request.get('/api/weshop/marketing/my/giftbag/page', { @@ -96,7 +101,7 @@ Page({ page: th.data.curpage, pageSize: th.data.pageSize }, - success: function(res) { + success: function (res) { if (res.data.code == 0) { th.data.curpage++; var arr1 = th.data.wareCard; @@ -108,12 +113,14 @@ Page({ wareCard: arr3, total: res.data.data.total, ismore: ismore, - is_read: 1 + is_read: 1, + is_get:1, }), wx.stopPullDownRefresh(); //停止下拉刷新 } else { th.setData({ is_read: 1, - ismore:1 + ismore: 1, + is_get:1, }) } @@ -123,7 +130,7 @@ Page({ }, //销毁界面跳转 - redirectTo: function(e) { + redirectTo: function (e) { var th = this; var url = e.currentTarget.dataset.url; //销毁跳转 @@ -132,13 +139,13 @@ Page({ }); }, //不销毁界面跳转 - navigateTo: function(e) { + navigateTo: function (e) { var th = this; var url = e.currentTarget.dataset.url; getApp().goto(url); }, //下拉事件 - onReachBottom: function() { + onReachBottom: function () { var th = this; if (th.data.total <= th.data.pageSize) return; if (th.data.ismore) return; @@ -146,7 +153,7 @@ Page({ }, //图片失败,默认图片 - bind_bnerr2: function(e) { + bind_bnerr2: function (e) { var _errImg = e.target.dataset.errorimg; var _errObj = {}; _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; @@ -154,33 +161,33 @@ Page({ }, -//--- 分享设置 -- -onShareAppMessage: function (e) { - var curPage=this; - var pagePath = curPage.route; //当前页面url - if (pagePath.indexOf('/') != 0) { - pagePath = '/' + pagePath; - } - pagePath += "?first_leader="+ this.data.getUserID; - return { - title: "专享礼包", - path:pagePath, - } -}, + //--- 分享设置 -- + onShareAppMessage: function (e) { + var curPage = this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + pagePath += "?first_leader=" + this.data.getUserID; + return { + title: "专享礼包", + path: pagePath, + } + }, - onShareTimeline() { - var curPage=this; - var pagePath = curPage.route; //当前页面url - if (pagePath.indexOf('/') != 0) { - pagePath = '/' + pagePath; + onShareTimeline() { + var curPage = this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + pagePath += "?first_leader=" + this.data.getUserID; + return { + title: '专享礼包', + imageUrl: this.data.ad_data.ad_code, + path: pagePath, } - pagePath += "?first_leader="+ this.data.getUserID; - return { - title: '专享礼包', - imageUrl: this.data.ad_data.ad_code, - path: pagePath, - } - }, + }, }); \ No newline at end of file diff --git a/pages/giftpack/mygiftpack/mygiftpack.wxml b/pages/giftpack/mygiftpack/mygiftpack.wxml index 5d9fc3e..3adf1e9 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.wxml +++ b/pages/giftpack/mygiftpack/mygiftpack.wxml @@ -96,7 +96,7 @@ - + -- libgit2 0.21.4