init
This commit is contained in:
47
pages/subpages/scoreLog/scoreLog.js
Normal file
47
pages/subpages/scoreLog/scoreLog.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import scoreLogApi from "../../../api/scoreLogApi"
|
||||
import scoreApi from '../../../api/scoreApi'
|
||||
|
||||
Page({
|
||||
|
||||
data: {
|
||||
residueScore:0,
|
||||
INScore:0,
|
||||
OUTScore:0,
|
||||
scoreLogList:[],
|
||||
categorys: {
|
||||
'SIGNIN': '打卡',
|
||||
'ACTIVEKAMI': '卡密',
|
||||
'DOWNLOAD': '下载',
|
||||
'EXCHANGEMEMBER': '兑换会员',
|
||||
'RECHARGE': '充值'
|
||||
}
|
||||
},
|
||||
goback(){
|
||||
wx.navigateBack(1)
|
||||
},
|
||||
onLoad(){
|
||||
let page = {
|
||||
current: 1,
|
||||
size: 20
|
||||
}
|
||||
scoreLogApi.page(page).then(res=>{
|
||||
this.setData({scoreLogList: res.data.records})
|
||||
|
||||
res.data.records.forEach(item=>{
|
||||
if (item.inOut=="IN") {
|
||||
this.setData({INScore:this.data.INScore+item.score})
|
||||
}
|
||||
if (item.inOut=="OUT") {
|
||||
this.setData({OUTScore:this.data.OUTScore+item.score})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
scoreApi.getUserScore().then(res=>{
|
||||
this.setData({
|
||||
residueScore: res.data
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user