diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 40e65b3..1f29d89 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -18,13 +18,16 @@ Page({ contentdown: '加载更多', contentrefresh: '加载中...', contentnomore: '已加载全部' - } + }, + is_read:0,//礼包列表是否全部加载完毕 }, onLoad: function(options) { var th = this; + var my_confirm = th.selectComponent("#my_confirm"); //组件的id + my_confirm.open_cancel(0); th.setData({ getStorageID: a.stoid, - getUserID: 5682130 + getUserID: d.user_id }) }, onShow: function() { @@ -40,7 +43,7 @@ Page({ GetBuyPrice: function(e) { var that = this.data; var th = this; - var lbId = e.currentTarget.dataset.lbId;//活动id + var id = e.currentTarget.dataset.id;//活动id var my_confirm = th.selectComponent("#my_confirm"); //组件的id my_confirm.open( "是否确定购买该礼包", @@ -50,11 +53,12 @@ Page({ my_confirm.open_cancel(0); }, function() { + my_confirm.open_cancel(0); var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 "buyType": '2', //1=积分兑换 2=余额购买 - "lbId": lbId, //礼包Id + "lbId": id, //礼包Id "storeId": that.getStorageID, //商家Id "userId": that.getUserID, //用户ID "buyFrom": 2 @@ -70,7 +74,20 @@ Page({ }, // 设置请求的 header success: function (res) { if (res.data.code == 0) { - window.location.href = th.data.url + '/Mobile/Payment/getPay.html?stoid=' + that.getStorageID + '&order_sn=' + res.data.data.orderSn + '&recharge_type=6'; + res=res.data.data; + wx.requestPayment({ + timeStamp: String(res.timeStamp), + nonceStr: res.nonceStr, + package: res.packageValue, + signType: res.signType, + paySign: res.paySign, + success: function (n) { + + }, + fail: function (n) { + + } + }); } else { getApp().my_warnning(res.data.msg, 0, th); } @@ -87,7 +104,7 @@ Page({ GetBuyIntegral: function(e) { var that = this.data; var th = this; - var lbId = e.currentTarget.dataset.lbId;//活动id + var id = e.currentTarget.dataset.id;//活动id var my_confirm = th.selectComponent("#my_confirm"); //组件的id my_confirm.open( "是否确定兑换该礼包", @@ -97,16 +114,25 @@ Page({ my_confirm.open_cancel(0); }, function() { - getApp().request.post('/api/weshop/marketing/buy/receive/gift/record/insert', { - data: { - "actId": '', //活动Id - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 - "buyType": '1', //1=积分兑换 2=余额购买 - "lbId": 26, //礼包Id - "storeId": that.getStorageID, //商家Id - "userId": that.getUserID //用户ID - }, - success: function success(res) { + my_confirm.open_cancel(0); + var json = { + "actId": '', //活动Id + "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 + "buyType": '1', //1=积分兑换 2=余额购买 + "lbId": id, //礼包Id + "storeId": that.getStorageID, //商家Id + "userId": that.getUserID //用户ID + }; + var data = JSON.stringify(json); + var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; + wx.request({ + url: url, + data: data, + method: 'post', + header: { + 'content-type': 'application/json' + }, // 设置请求的 header + success: function (res) { if (res.data.code == 0) { getApp().my_warnning("兑换成功!", 1, th); } else { @@ -129,7 +155,7 @@ Page({ _this.setData({ loadingType: 1 }) - getApp().request.get('/api/weshop/marketing/my/giftbag/page', { + getApp().request.get('/api/weshop/marketing/giftbag/page', { data: { "storeId": that.getStorageID, //商家ID "userId": that.getUserID, //用户ID @@ -153,30 +179,43 @@ Page({ }) } else { var wareCard = that.wareCard; + var is_read = 0; if (wareCard.length < res.data.data.total) { for (var i = 0; i < res.data.data.pageData.length; i++) { wareCard.push(res.data.data.pageData[i]); } + }else{ + is_read:1 } _this.setData({ - wareCard: wareCard - }) - _this.setData({ + wareCard: wareCard, + is_read: is_read, loadingType: 0 }) } } else { - getApp().my_warnning(res.data.msg, 0, th); + getApp().my_warnning(res.data.msg, 0, _this); } } }) }, - //界面跳转 - goto: function(e) { + //销毁界面跳转 + redirectTo: function(e) { + var th = this; + var url = e.currentTarget.dataset.url; + //销毁跳转 + wx.redirectTo({ + url: url + }); + }, + //不销毁界面跳转 + navigateTo:function(e){ var th = this; var url = e.currentTarget.dataset.url; - getApp().goto(url); + wx.navigateTo({ + url: url, + }) } }) \ No newline at end of file diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxml b/pages/giftpack/buygiftpack/giftpackbuy.wxml index bc7d106..162d566 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.wxml +++ b/pages/giftpack/buygiftpack/giftpackbuy.wxml @@ -1,6 +1,6 @@ - + @@ -8,18 +8,18 @@ - 我的礼包 + 我的礼包 - - - + + + - {{items.giftTitle}} + {{items.giftTitle}} @@ -45,32 +45,32 @@ {{"已售:"+items.giftQty+"件"}} - - + + - - + + - + - + 当前暂无礼包 - 去获取 + 去获取 - + ———— 到底了 ———— diff --git a/pages/giftpack/giftpacklist/giftpacklist.wxml b/pages/giftpack/giftpacklist/giftpacklist.wxml index 504dc91..c5a5350 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.wxml +++ b/pages/giftpack/giftpacklist/giftpacklist.wxml @@ -1,10 +1,10 @@ - + - {{giftTitle}} + {{giftTitle}} {{"兑换截至时间:"+giftDate}} @@ -40,19 +40,19 @@ - + - + - + - + - + @@ -67,13 +67,13 @@ - + - + - + 已自动到账 @@ -96,22 +96,22 @@ - 立即购买 + 立即购买 - 立即兑换 + 立即兑换 - 立即购买 + 立即购买 - 立即兑换 + 立即兑换 @@ -119,7 +119,7 @@ - 立即使用 + 立即使用 diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index f2d85fa..c679c3b 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -18,7 +18,8 @@ Page({ contentdown: '加载更多', contentrefresh: '加载中...', contentnomore: '已加载全部' - } + }, + is_resad:0,//数据是否全部加载完成 }, onLoad: function(options) { @@ -27,7 +28,7 @@ Page({ var th = this; th.setData({ getStorageID: a.stoid, - getUserID: 5682130 + getUserID: d.user_id }) }, onShow: function() { @@ -100,27 +101,28 @@ Page({ loadingType: 2 }) } else { - // console.log(_this.wareCard.length); - // console.log(res.data.data.pageData.length); var wareCard = that.wareCard; + var is_resad = 0; // if (_this.wareCard.length < res.data.data.pageData.length) { if (wareCard.length < res.data.data.total) { for (var i = 0; i < res.data.data.pageData.length; i++) { wareCard.push(res.data.data.pageData[i]); } + }else{ + is_resad=1 } _this.setData({ - wareCard: wareCard + wareCard: wareCard, + is_resad: is_resad }) // _this.loadingType = 0; _this.setData({ loadingType: 0 }) - console.log(_this.wareCard); } } else { - console.log(res.data.msg); + } } }); @@ -146,10 +148,22 @@ Page({ var Time = new Date(TimeNum); return Time.getTime() / 1000; }, - goto: function(e) { + //销毁界面跳转 + redirectTo: function (e) { var th = this; - var url = e.currentTarget.dataset.url; - getApp().goto(url); + var url = e.currentTarget.dataset.url; + //销毁跳转 + wx.redirectTo({ + url: url + }); + }, + //不销毁界面跳转 + navigateTo: function (e) { + var th = this; + var url = e.currentTarget.dataset.url; + wx.navigateTo({ + url: url, + }) } }); \ No newline at end of file diff --git a/pages/giftpack/mygiftpack/mygiftpack.wxml b/pages/giftpack/mygiftpack/mygiftpack.wxml index 92f2f04..97c8b55 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.wxml +++ b/pages/giftpack/mygiftpack/mygiftpack.wxml @@ -5,7 +5,7 @@ - 礼包列表 + 礼包列表 @@ -14,13 +14,12 @@ - - + + - + - @@ -43,7 +42,7 @@ - {{item.giftTitle}} + {{item.giftTitle}} @@ -83,26 +82,28 @@ - + - + - + 当前暂无礼包 - 去获取 + 去获取 + ———— 到底了 ———— + diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml index 25f9ee2..3efcfc0 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -212,10 +212,14 @@ 我的地址 - + 我的服务 + + + 我的礼包 +