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`
})
},
//跳往砍价专场