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
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
8
pages/subpages/scoreLog/scoreLog.json
Normal file
8
pages/subpages/scoreLog/scoreLog.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-nav-bar": "@vant/weapp/nav-bar/index",
|
||||
"van-sticky": "@vant/weapp/sticky/index",
|
||||
"van-empty": "@vant/weapp/empty/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
37
pages/subpages/scoreLog/scoreLog.wxml
Normal file
37
pages/subpages/scoreLog/scoreLog.wxml
Normal file
@@ -0,0 +1,37 @@
|
||||
<van-sticky>
|
||||
<van-nav-bar
|
||||
title="积分详情"
|
||||
left-text="返回"
|
||||
left-arrow
|
||||
bind:click-left="goback"
|
||||
/>
|
||||
</van-sticky>
|
||||
|
||||
<view class="card integral_total">
|
||||
<view class="integral_total_item">
|
||||
<text class="integral_total_value">{{OUTScore}}</text>
|
||||
<text class="integral_total_category">出账积分</text>
|
||||
</view>
|
||||
<view class="integral_total_item">
|
||||
<text class="integral_total_value totalPoint">{{residueScore}}</text>
|
||||
<text class="integral_total_category">剩余积分</text>
|
||||
</view>
|
||||
<view class="integral_total_item">
|
||||
<text class="integral_total_value">{{INScore}}</text>
|
||||
<text class="integral_total_category">入账积分</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card-blank">
|
||||
<text style="color: #777;">历史积分</text>
|
||||
</view>
|
||||
|
||||
<view class="card integral_detail" wx:for="{{scoreLogList}}" wx:key="index">
|
||||
<view class="integral_detail_content">
|
||||
<text class="integral_detail_title">{{categorys[item.category]}}</text>
|
||||
<text class="integral_detail_date">{{item.createTime}}</text>
|
||||
</view>
|
||||
<text class="integral_detail_value">{{item.inOut=="IN"?"+":'-'}}{{item.score}}</text>
|
||||
</view>
|
||||
|
||||
<van-empty wx:if="{{scoreLogList.length==0}}" description="暂时没有积分记录~" />
|
||||
58
pages/subpages/scoreLog/scoreLog.wxss
Normal file
58
pages/subpages/scoreLog/scoreLog.wxss
Normal file
@@ -0,0 +1,58 @@
|
||||
.integral_total{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.integral_total_item{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.integral_total_value{
|
||||
font-weight: bold;
|
||||
font-size: 28px;
|
||||
color: #FFCE46;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.integral_total_category{
|
||||
color: #777;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.integral_detail{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.integral_detail_content{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.integral_detail_title{
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.integral_detail_date{
|
||||
font-size: 12px;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.integral_detail_value{
|
||||
font-weight: bold;
|
||||
color: #FFCE46;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.totalPoint{
|
||||
font-size: 34px;
|
||||
color: #CDDC39;
|
||||
}
|
||||
Reference in New Issue
Block a user