Commit 747bbc4c by 高淑倩

add: 优惠券列表

parent 91e90b33
......@@ -4,5 +4,5 @@
text-align: center;
font-size: 21rpx;
color: #bfbfbf;
margin-top: 45rpx;
/* margin-top: 45rpx; */
}
\ No newline at end of file
......@@ -79,6 +79,10 @@ wxService.page({
noMore: true
})
this.initIntegralCouponList(this.data.pageNo, this.data.pageSize)
}else {
this.setData({
noMore: true
})
}
},
})
\ No newline at end of file
......@@ -19,27 +19,45 @@ wxService.page({
}
],
navIndex:'1',
params:{
pageNo:1,
pageSize:10
},
pageNo: 1,
pageSize: 10,
queryData:{
"brandId": 0,
"couponSettingId": 0,
"status": 0,
"title": ""
//"brandId": 1002,
//"couponSettingId": 0,
//"status": 0,
//"title": ""
},
totalPages:''
totalPages: 0,
totalElements: 0,
invalidTotalElements: 0,
couponList: [],
invalidCouponList: [],
currentTab: 0,
noMoreCoupon: false,
noMoreCouponInvalid: false
},
//滑动切换
swiperTab: function (e) {
var that = this;
that.setData({
currentTab: e.detail.current
});
},
//点击切换
clickTab: function (e) {
var that = this;
if (this.data.currentTab === e.target.dataset.current) {
return false;
} else {
that.setData({
currentTab: e.target.dataset.current
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
onLoad: function (options) {},
/**
* 生命周期函数--监听页面显示
*/
......@@ -47,70 +65,61 @@ wxService.page({
this.setData({
'queryData.status': this.data.navIndex
})
this.getCouponList()
this.getCouponList(this.data.pageNo,this.data.pageSize)
},
//切换tab
switchTab(e){
this.setData({
navIndex: e.currentTarget.dataset.index,
'queryData.status': e.currentTarget.dataset.index
})
this.getCouponList()
},
// switchTab(e){
// this.setData({
// navIndex: e.currentTarget.dataset.index,
// 'queryData.status': e.currentTarget.dataset.index
// })
// this.getCouponList(this.data.pageNo,this.data.pageSize)
// },
//获取优惠券列表
getCouponList(type){
getCouponList(pageNo,pageSize){
wx.showLoading({
title: '加载中'
})
this.setData({
'queryData.status': this.data.navIndex
})
wxService.post(`/coupon/coupon/setting/list?pageNo=${this.data.params.pageNo}&pageSize=${this.data.params.pageSize}`, this.queryData).then(res => {
let couponList = [];
couponList = this.data.params.pageNo == 1 ? res.data.data : this.data.couponList.concat(res.data.data);
// const params = this.data.queryData
const params = {}
wxService.post(`/coupon/coupon/setting/list?pageNo=${pageNo}&pageSize=${pageSize}`, params).then(res => {
const {result,data} = res.data
if(result == 0){
wx.hideLoading()
this.setData({
couponList,
totalPages: res.data.data.totalPages,
couponList: this.data.pageNo == 1? [...data.content]: [...this.data.couponList,...data.content],
totalPages: data.totalPages,
totalElements: data.totalElements
})
wx.hideLoading();
if (type && type.pullDown) wx.stopPullDownRefresh();
}
}).finally(() => {
wx.hideLoading();
this.setData({
couponList: ''
})
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.setData({
params: {
pageNo: 1,
pageSize: 10,
},
})
this.getCouponList({
pullDown: true
});
},
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
bindDownLoad: function () {
if (this.data.params.pageNo < this.data.totalPages) {
onReachBottom: function () {
if (this.data.pageNo < this.data.totalPages) {
this.setData({
params: {
pageNo: this.data.params.pageNo + 1,
pageSize: 10
},
loadDataDone: true
pageNo: this.data.pageNo + 1,
// loadDataDone: true
})
this.getCouponList(this.data.pageNo,this.data.pageSize)
} else {
this.setData({
noMoreCoupon: true
})
this.getCouponList()
}
},
})
\ No newline at end of file
{
"enablePullDownRefresh":true,
"navigationBarTitleText": "我的卡券",
"usingComponents": {}
"usingComponents": {
"no-more": "/component/noMore/noMore"
}
}
\ No newline at end of file
<!--pages/userCenter.wxml-->
<view class='page-coupons'>
<view class='tabs-wrap'>
<view wx:for='{{nav}}' wx:key='{{index}}' class="tab-nav fs-25 {{navIndex == item.type ? 'nav-active' : ''}}" data-index='{{item.type}}' bindtap='switchTab'>{{item.name}}(0)</view>
<!--<view class='tabs-wrap'>
<view wx:for='{{nav}}' wx:key='{{index}}' class="tab-nav fs-25 {{navIndex == item.type ? 'nav-active' : ''}}" data-index='{{item.type}}' bindtap='switchTab'>{{item.name}}({{item.type ? totalElements:invalidTotalElements }})</view>
</view>-->
<view class="swiper-tab">
<view class="swiper-tab-item {{currentTab==0?'active':''}}" data-current="0" bindtap="clickTab">可使用 ({{totalElements}})</view>
<view class="swiper-tab-item {{currentTab==1?'active':''}}" data-current="1" bindtap="clickTab">已失效 ({{invalidTotalElements}})</view>
</view>
<scroll-view scroll-y bindscrolltolower="bindDownLoad">
<swiper current="{{currentTab}}" duration="300" bindchange="swiperTab">
<swiper-item wx:if="{{couponList.length}}">
<scroll-view scroll-y>
<view class='coupon-wrap'>
<view class='coupon-list'>
<view
class='coupon-list'
wx:for="{{couponList}}"
wx:for-item="item"
wx:for-index="k"
wx:key="{{k}}"
>
<navigator hover-class='none' url='/pages/couponDetail/couponDetail'>
<image class='coupon-bg' src='/assets/imgs/coupon-bg.png'></image>
<view wx:if="{{invalidCouponList.length}}">
<view class='invalid-coupon' />
<image src='/assets/imgs/invalid.png' class='invalid-img' />
</view>
<image class='coupon-bg' src='/assets/imgs/coupon-bg.png' />
<view class='coupon-img'>
<image src='/assets/imgs/qr-code.png'></image>
<image src='/assets/imgs/qr-code.png' />
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>卡劵名称</view>
<view class='coupon-time fs-24'>时间</view>
<view class='coupon-desc fs-24'>是个梵蒂冈设计费郭德纲发电机房</view>
<view class='coupon-name fs-28'>{{item.couponSetting.typeDesc}}</view>
<view class='coupon-time fs-24'>{{item.couponSetting.startTime}} 至 {{item.couponSetting.endTime}}</view>
<view class='coupon-desc fs-24'>{{item.couponSetting.typeDesc}}</view>
</view>
<view class='coupon-code fs-24'>出示劵码</view>
</navigator>
</view>
<view class='coupon-list'>
<!-- 失效 -->
<view class='invalid-coupon'></view>
<image src='/assets/imgs/invalid.png' class='invalid-img'></image>
<!-- 未失效 -->
<image class='coupon-bg' src='/assets/imgs/coupon-bg.png'></image>
</view>
</scroll-view>
<no-more wx:if="{{noMoreCoupon}}" />
<view class='empty-wrap' wx:if="{{!couponList.length}}">
<view class='empty-info'>
<image class='empty-img' src='/assets/imgs/empty-coupon.png' />
<view class='empty-text'>没有任何卡劵</view>
</view>
</view>
</swiper-item>
<swiper-item>
<scroll-view scroll-y wx:if="{{invalidCouponList.length}}">
<view class='coupon-wrap'>
<view
class='coupon-list'
wx:for="{{invalidCouponList}}"
wx:for-item="item"
wx:for-index="k"
wx:key="{{k}}"
>
<view class='invalid-coupon' />
<image src='/assets/imgs/invalid.png' class='invalid-img' />
<image class='coupon-bg' src='/assets/imgs/coupon-bg.png' />
<view class='coupon-img'>
<image src='/assets/imgs/qr-code.png'></image>
<image src='/assets/imgs/qr-code.png' />
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>卡劵名称</view>
<view class='coupon-time fs-24'>时间</view>
<view class='coupon-desc fs-24'>是个梵蒂冈设计费郭德纲发电机房</view>
<view class='coupon-name fs-28'>{{item.couponSetting.typeDesc}}</view>
<view class='coupon-time fs-24'>{{item.couponSetting.startTime}} 至 {{item.couponSetting.endTime}}</view>
<view class='coupon-desc fs-24'>{{item.couponSetting.typeDesc}}</view>
</view>
<view class='coupon-code fs-24'>出示劵码</view>
</view>
</view>
<view class='empty-wrap'>
</scroll-view>
<no-more wx:if="{{noMoreCouponInvalid}}" />
<view class='empty-wrap' wx:if="{{!invalidCouponList.length}}">
<view class='empty-info'>
<image class='empty-img' src='/assets/imgs/empty-coupon.png'></image>
<image class='empty-img' src='/assets/imgs/empty-coupon.png' />
<view class='empty-text'>没有任何卡劵</view>
</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
</view>
/* pages/userCenter.wxss */
@import './../../base/base.wxss';
.page-coupons{
position: relative;
}
.tabs-wrap{
height: 86rpx;
}
......@@ -100,3 +103,29 @@
top: 31rpx;
z-index: 4;
}
.swiper-tab{
width: 100%;
height: 86rpx;
line-height: 86rpx;
display: flex;
background-color: #ffffff;
color: #666666;
position:fixed;
z-index:1;
}
.swiper-tab-item{
flex: 1;
text-align: center;
}
.active{
color: #05c35b;
border-bottom: 4rpx solid #05c35b;
}
swiper {
width: 100%;
flex: 1;
height:100vh;
padding-bottom:20rpx;
position: absolute;
top: 100rpx;
}
......@@ -12,7 +12,8 @@ wxService.page({
integralNum: 1246,
pageNo: 1,
pageSize: 30,
integralList: []
integralList: [],
noMore: false
},
/**
* 生命周期函数--监听页面加载
......@@ -21,9 +22,7 @@ wxService.page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
......@@ -92,7 +91,9 @@ wxService.page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.setData({
noMore: true
})
},
/**
......
{
"enablePullDownRefresh":true,
"navigationBarTitleText": "积分流水",
"usingComponents": {
"no-more": "/component/noMore/noMore"
......
......@@ -24,7 +24,7 @@
<view class="detail-num" wx:if="{{item.operation}}">+ {{item.changeValue}}</view>
<view class="detail-num minus" wx:if="{{!item.operation}}">- {{item.changeValue}}</view>
</view>
<no-more />
<no-more wx:if="{{noMore}}"/>
</view>
</view>
</view>
......@@ -37,7 +37,7 @@
"list": []
},
"miniprogram": {
"current": 6,
"current": 9,
"list": [
{
"id": -1,
......@@ -92,6 +92,12 @@
"name": "我的卡券",
"pathName": "pages/coupons/coupons",
"query": ""
},
{
"id": -1,
"name": "我的消费",
"pathName": "pages/mySpend/mySpend",
"query": ""
}
]
}
......
......@@ -86,7 +86,7 @@ class Http {
header: {
// 'buyer-token': this.getToken()
// 'buyer-token': '187ef4436122d1cc2f40dc2b92f0eba0'
'seller-token': '2e72711cc202bb9c5dd7c277ee4f2b59'
'seller-token': 'f80d09122733517ea4a0c2628c4eb0e9'
},
data: parmas
})
......@@ -99,7 +99,7 @@ class Http {
header: {
// 'buyer-token': wx.getStorageSync('token')
// 'buyer-token':'187ef4436122d1cc2f40dc2b92f0eba0'
'seller-token': '2e72711cc202bb9c5dd7c277ee4f2b59'
'seller-token': 'f80d09122733517ea4a0c2628c4eb0e9'
},
data: parmas,
channel: channel
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment