1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

通过微信开发者工具 商城模板 创建新小程序

This commit is contained in:
2023-03-06 23:52:24 +08:00
parent ada464a8cc
commit c21ff901d5
393 changed files with 52952 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
import { fetchCouponList } from '../../../services/coupon/index';
Page({
data: {
status: 0,
list: [
{
text: '可使用',
key: 0,
},
{
text: '已使用',
key: 1,
},
{
text: '已失效',
key: 2,
},
],
couponList: [],
},
onLoad() {
this.init();
},
init() {
this.fetchList();
},
fetchList(status = this.data.status) {
let statusInFetch = '';
switch (Number(status)) {
case 0: {
statusInFetch = 'default';
break;
}
case 1: {
statusInFetch = 'useless';
break;
}
case 2: {
statusInFetch = 'disabled';
break;
}
default: {
throw new Error(`unknown fetchStatus: ${statusInFetch}`);
}
}
fetchCouponList(statusInFetch).then((couponList) => {
this.setData({ couponList });
});
},
tabChange(e) {
const { value } = e.detail;
this.setData({ status: value });
this.fetchList(value);
},
goCouponCenterHandle() {
wx.showToast({ title: '去领券中心', icon: 'none' });
},
onPullDownRefresh_() {
this.setData(
{
couponList: [],
},
() => {
this.fetchList();
},
);
},
});