提交优惠券,积分修改(领券部分没做)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// pages/integralRecord/index.js
|
||||
import request from "../../utils/request"
|
||||
import { getIntegralRecord } from "../../service/system";
|
||||
import { alertInfo, loadingFunc } from "../../utils";
|
||||
import { alertInfo, loadingFunc } from "../../utils/index";
|
||||
const { OK } = request;
|
||||
Page({
|
||||
|
||||
@@ -30,11 +30,27 @@ Page({
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
list: data || [],
|
||||
list: data?.map(item => {
|
||||
item.type = ['充值增加', '系统增加', '系统减少', '冲正减少', '退费减少', '兑换优惠券', '积分清零'][item.type]
|
||||
item.nowBalance = Number(item.nowBalance || 0)
|
||||
item.lastBalance = Number(item.lastBalance || 0)
|
||||
item.value = item.nowBalance - item.lastBalance;
|
||||
item.value = item.value > 0 ? `+${item.value}` : item.value
|
||||
return item
|
||||
}) || [],
|
||||
total,
|
||||
totalPage: Math.ceil(total / size),
|
||||
})
|
||||
},
|
||||
refresh() {
|
||||
const that = this;
|
||||
this.setData({
|
||||
page: 1,
|
||||
size: 20,
|
||||
}, () => {
|
||||
that.init();
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
@@ -51,7 +67,15 @@ Page({
|
||||
await that.init();
|
||||
})
|
||||
},
|
||||
|
||||
async onChangePage(e) {
|
||||
const page = e.detail.currentIndex;
|
||||
const that = this;
|
||||
this.setData({
|
||||
page
|
||||
}, () => {
|
||||
that.init();
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
|
@@ -1,6 +1,10 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"navigator": "/components/navigator/index"
|
||||
"navigator": "/components/navigator/index",
|
||||
"van-cell": "@vant/weapp/cell/index",
|
||||
"van-cell-group": "@vant/weapp/cell-group/index",
|
||||
"empty": "/components/empty/index",
|
||||
"pagination": "/components/pagination/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
@@ -1,2 +1,24 @@
|
||||
<!--pages/integralRecord/index.wxml-->
|
||||
<navigator title="积分明细" canBack="{{true}}" />
|
||||
|
||||
<view wx:if="{{list.length}}">
|
||||
<van-cell-group>
|
||||
<van-cell
|
||||
wx:for="{{list}}"
|
||||
wx:key="id"
|
||||
title="{{item.type}}"
|
||||
value="{{item.value}}"
|
||||
label="{{item.createdAt}}"
|
||||
border="{{ false }}"
|
||||
/>
|
||||
</van-cell-group>
|
||||
<pagination
|
||||
currentIndex="{{page}}"
|
||||
totalPage="{{totalPage}}"
|
||||
bind:pagingChange="onChangePage"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view wx:else>
|
||||
<empty bind:refresh="refresh" />
|
||||
</view>
|
Reference in New Issue
Block a user