提交优惠券,积分修改(领券部分没做)

This commit is contained in:
2024-12-06 17:41:26 +08:00
parent 34c2cb76e7
commit 9bc3cb5584
20 changed files with 198 additions and 105 deletions

View File

@@ -1,6 +1,7 @@
// pages/integral/index.js
import request from "../../utils/request"
import { getCurrentIntegral } from "../../service/system";
import { getCurrentIntegral, getRedeemableCoupons } from "../../service/system";
import { alertInfo, loadingFunc } from "../../utils/index";
const { OK } = request;
Page({
@@ -10,6 +11,10 @@ Page({
*/
data: {
integral: 0,
page: 1,
size: 20,
list: [],
totalPage: 0,
},
/**
@@ -31,6 +36,28 @@ Page({
*/
onShow() {
this.getIntegral();
this.getCoupons();
},
async getCoupons() {
const { page, size } = this.data
const { code, message, data, total } = await getRedeemableCoupons({ page, size, type: 2 })
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
list: data,
totalPage: Math.ceil(total / size),
})
},
refresh() {
const that = this;
that.setData({
page: 1,
size: 20
}, () => {
that.getCoupons()
})
},
jumpToRecord() {
wx.navigateTo({
@@ -47,6 +74,7 @@ Page({
integral: data?.balance || 0
})
},
/**
* 生命周期函数--监听页面隐藏
*/