Commit 747bbc4c by 高淑倩

add: 优惠券列表

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