From 27ed4cbe9a5ed24d103fe6ab583d36e223e39c82 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Wed, 24 Apr 2019 16:04:06 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=A6=96=E9=A1=B5=E7=A7=AF=E5=88=86][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:[=E9=A6=96=E9=A1=B5=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E5=85=A5=E5=8F=A3=E4=BF=AE=E6=94=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=E7=9A=84=E7=A7=AF=E5=88=86]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/integralmall/index.js | 36 ++++++++++++++++++++++++++++------- pages/integralmall/index.wxml | 2 +- pages/main/index.js | 3 +-- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/pages/integralmall/index.js b/pages/integralmall/index.js index 399d40a..50aaaf8 100644 --- a/pages/integralmall/index.js +++ b/pages/integralmall/index.js @@ -21,17 +21,13 @@ Page({ actUrl: imgurl.act.url, loading: true, content: '数据正在加载中', - reloadIf: false + reloadIf: false, + creditAmount: 0 }, onLoad: function (options) { let that = this; - console.log(options) - if (options &&options.credit){ - that.setData({ - credit: options.credit - }) - } var todayDate = new Date().getTime(); + that.getPoints(); that.setData({ optionsData: options, todayDate: todayDate @@ -58,6 +54,31 @@ Page({ }) } }, + // 获得积分,渲染页面 + getPoints(){ + let that = this; + Http.get({ + url: config.api.integralList, + data: { + pageNum: 1, + pageSize: 1, + } + }).then(res => { + wx.stopPullDownRefresh(); + that.setData({ + creditAmount: res.data.list[0].creditAmount + }); + }) + .catch(err => { + wx.stopPullDownRefresh(); + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, gotojifen(){ wx.navigateTo({ url: '/pages/integralmall/integraHistory/index', @@ -168,5 +189,6 @@ Page({ onPullDownRefresh: function (e) { let that = this; that.getList(1); + that.getPoints(); } }) \ No newline at end of file diff --git a/pages/integralmall/index.wxml b/pages/integralmall/index.wxml index 8304e3c..ee06c5f 100644 --- a/pages/integralmall/index.wxml +++ b/pages/integralmall/index.wxml @@ -2,7 +2,7 @@ 我的积分 - {{credit}} + {{creditAmount}} diff --git a/pages/main/index.js b/pages/main/index.js index 935b38d..542d986 100644 --- a/pages/main/index.js +++ b/pages/main/index.js @@ -111,9 +111,8 @@ Page({ }, //跳往积分商城 gotouser:function(){ - let credit = this.data.credit; wx.navigateTo({ - url: `/pages/integralmall/index?credit=${credit}` + url: `/pages/integralmall/index` }) }, //跳往砍价专场