You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

85 lines
2.0 KiB

// pages/user/score.js
var app = getApp()
var WxParse = require('../../wxParse/wxParse.js');
var WXAPI = require('../../utils/server.js');
Page({
data: {
winWidth: 0,
winHeight: 0,
// tab切换
currentTab: 0,
score: null,
addscore: [],
fuscore: [],
remind: '加载中',
type: '',
bgcolor: 'https://mall.gylservice.com/pic/images/icon1/sign_bg.png'
},
//页面加载完成函数
onReady: function () {
var that = this;
that.setData({
remind: ''
});
},
onLoad: function () {
var that = this;
that.getRequest();
},
onPullDownRefresh: function () {
wx.showNavigationBarLoading() //在标题栏中显示加载
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
/**
* 滑动切换tab
*/
bindChange: function (e) {
console.log(e)
var that = this;
that.setData({
currentTab: e.detail.current,
type: e.detail.current==0?'':e.detail.current
});
that.getRequest();
},
/**
* 点击tab切换
*/
swichNav: function (e) {
console.log(e)
var that = this;
if (this.data.currentTab === e.target.dataset.current) {
return false;
} else {
that.setData({
currentTab: e.target.dataset.current,
type: e.target.dataset.current==0?'':e.target.dataset.current
})
that.getRequest();
}
},
// 进入我的积分
getRequest: function () {
var that = this
WXAPI.getIntegral({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
type: that.data.type,
pageno: 1,
pageSize: 100,
}).then(res => {
if (res.code == 200) {
var data = res.data;
that.setData({
score: data.score, // 当前可用积分
scoreNum: data.score-data.FrozenScore, // 积分
frozenScore: data.FrozenScore, // 冻结积分
sign: data.sign, // 全部明细
list: data.list, // 获取明细
})
}
});
}
})