提交优惠券,积分修改(领券部分没做)
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
// pages/discountCoupon/index.js
|
||||
|
||||
import request from "../../utils/request"
|
||||
import { getCurrentCoupons, getCurrentIntegral, getRedeemableCoupons } from "../../service/system";
|
||||
import { alertInfo, loadingFunc } from "../../utils/index";
|
||||
const { OK } = request;
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
currentList: [],
|
||||
canGetList: [],
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -28,7 +35,32 @@ Page({
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
async getCurrent() {
|
||||
const that = this;
|
||||
loadingFunc(async() => {
|
||||
const { code, message, data = [], } = await getCurrentCoupons();
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
that.setData({
|
||||
currentList: data
|
||||
})
|
||||
})
|
||||
},
|
||||
getCanGet() {
|
||||
const that = this;
|
||||
loadingFunc(async() => {
|
||||
const { code, message, data = [], } = await getRedeemableCoupons({ type: 1 });
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
that.setData({
|
||||
currentList: data
|
||||
})
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
|
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"navigator": "/components/navigator/index"
|
||||
"navigator": "/components/navigator/index",
|
||||
"van-tab": "@vant/weapp/tab/index",
|
||||
"van-tabs": "@vant/weapp/tabs/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
@@ -1,2 +1,16 @@
|
||||
<!--pages/discountCoupon/index.wxml-->
|
||||
<navigator title="我的优惠券" canBack="{{true}}" />
|
||||
<navigator title="我的优惠券" canBack="{{true}}" />
|
||||
<van-tabs active="{{ active }}" bind:change="onChange">
|
||||
<van-tab title="我的优惠券">
|
||||
<view wx:if="{{currentList.length}}">
|
||||
|
||||
</view>
|
||||
<empty bind:refresh="getCurrent" />
|
||||
</van-tab>
|
||||
<van-tab title="领券中心">
|
||||
<view wx:if="{{canGetList.length}}">
|
||||
|
||||
</view>
|
||||
<empty bind:refresh="getCanGet" />
|
||||
</van-tab>
|
||||
</van-tabs>
|
Reference in New Issue
Block a user