Commit f421c7cb authored by 华国豪's avatar 华国豪 🙄

1

parent 06f383ae
let app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
active: 0,
dropdownActive: 0,
tagBoxShow: false,
dropdown: [
{
id: 1,
name: '通用'
},
{
id: 2,
name: '跟团游'
},
{
id: 3,
name: '签证'
},
{
id: 4,
name: '机票'
},
// {
// id: 0,
// name: '当地游'
// },
// {
// id: 0,
// name: '定制游'
// },
// {
// id: 0,
// name: '酒店'
// },
],
TitList: [
{
id: 0,
Status: 1,
name: '全部优惠券'
},
{
id: 2,
Status: 1,
name: '折扣券'
},
{
id: 1,
Status: 1,
name: '抵扣券'
},
{
id: 0,
Status: 3,
name: '已过期'
},
],
msg: {
pageIndex: 1,
pageSize: 8,
useState: 1,
lineId: 0,
lineteamId: 0,
couponsName: "",
couponsType: "",
couponStatus: 1,
couponEffectStatus: 1,
couponsUseScope: 1
},
dataList: [],
pageIndex: 1,
totalPage: 1,
count: 0,
},
// 加载更多
scrollGetMore: function () {
this.setData({
'getOrderMsg.pageIndex': this.data.pageIndex + 1,
})
this.getList(1)
},
// 获取数据
getList: function (type) {
if (this.data.pageIndex >= this.data.totalPage && type) {
return
}
app.$apiJavaNew('api/b2b/user/getUserCouponAllotList', this.data.msg).then(res => {
let arr = this.data.dataList;
console.log(res)
return
if (type) {
console.log(type, '组装数据')
for (let i = 0; i < arr2.length; i++) {
arr.push(arr2[i])
}
} else {
arr = arr2
}
this.setData({
dataList: arr,
totalPage: res.pageCount ? res.pageCount : 1,
pageIndex: res.pageIndex ? res.pageIndex : 1,
count: res.count ? res.count : 1
})
}).catch(err => { })
},
//切换类型
setActiveTag: function (e) {
let index = e.target.id.split('active')[1]
console.log(index)
this.setData({
dropdownActive: Number(index),
tagBoxShow: false,
'msg.couponsUseScope': this.data.dropdown[Number(index)].id
})
this.getList()
},
// 切换状态
setActive: function (e) {
let index = e.target.id.split('active')[1]
this.setData({
active: Number(index),
tagBoxShow: false,
'msg.couponsType': this.data.TitList[Number(index)].id,
'msg.couponEffectStatus': Number(index) == 3 ? 3 : 1,
})
this.getList()
},
// 切换类型显示?
setShow: function () {
this.setData({
tagBoxShow: !this.data.tagBoxShow
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getList()
wx.setNavigationBarTitle({
title: '我的优惠券'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class='list-box'>
<view class='top-nav'>
<view class='left-btn'>
<text bindtap='setShow'>{{dropdown[dropdownActive].name}}</text>
<image mode='widthFix' src='../../../images/group/bx.png'></image>
</view>
<view class='right-nav'>
<scroll-view scroll-x style="width: 100%;white-space: nowrap;padding-right: 80rpx;padding-left: 147rpx;">
<view class='bottom-nav'>
<view wx:for="{{TitList}}" class='{{active == index ? "active" : ""}}' wx:for-item="item" wx:for-index="index" wx:key="index" id="active{{index}}" bindtap='setActive'>
{{item.name}}
</view>
</view>
</scroll-view>
</view>
<view wx:if="{{tagBoxShow}}" class='tab-box'>
<text wx:for="{{dropdown}}" bindtap='setActiveTag' class='tag{{index}} {{dropdownActive == index ? "active" : ""}}' wx:for-item="item" wx:for-index="index" wx:key="index" id="active{{index}}">{{item.name}}</text>
</view>
</view>
<scroll-view class='data_body' scroll-y bindscrolltolower="scrollGetMore">
<view class='item'>
<view class='left' style="background: url('../../../images/menber/g_dangdi.png') no-repeat; background-size: 100% 100%;">
</view>
<view class='right'>
<view>
<text class='tit'>全线通用20元现金</text>
<text class='tag'>跟团游</text>
</view>
<view>
<text class='line'>适用XXXXX线路、xxxxxxxx系列x</text>
</view>
<view class='last_row'>
<text class='time'>2019.06.14 - 2019.06.16</text>
<text class='shiyong'>去使用</text>
</view>
</view>
</view>
<view class='item'>
<view class='left' style="background: url('../../../images/menber/g_dangdi.png') no-repeat; background-size: 100% 100%;">
</view>
<view class='right'>
<view>
<text class='tit'>全线通用20元现金</text>
<text class='tag'>跟团游</text>
</view>
<view>
<text class='line'>适用XXXXX线路、xxxxxxxx系列x</text>
</view>
<view class='last_row'>
<text class='time'>2019.06.14 - 2019.06.16</text>
<text class='shiyong'>去使用</text>
</view>
</view>
</view>
</scroll-view>
<view class='body_footer'>{{pageIndex >= totalPage ? '没有更多了...' : '上拉获取更多数据'}}</view>
</view>
\ No newline at end of file
page{background-color: #F8F5F5}
.data_body{
padding: 0 30rpx;
width: 100%;
height: 100VH;
padding-top: 130rpx;
}
.data_body .item{
display: flex;
padding: 24rpx;
align-items: center;
background:rgba(255,255,255,1);
border-radius:20rpx;
margin-bottom: 30rpx;
}
.data_body .item .left{
width: 146rpx;
height: 143rpx;
margin-right: 31rpx;
}
.data_body .item .right{
flex: 1;
line-height: 1rem;
}
.data_body .item .right .tit{
font-size: 28rpx;
color: #000;
padding-right: 10rpx;
}
.data_body .item .right .tag{
font-size: 24rpx;
padding: 5rpx 11rpx;
background:rgba(97,220,212,.5);
border-radius: 0 0 4rpx 4rpx;
color: #1D9890;
}
.data_body .item .right .line{
font-size: 22rpx;
color: #666;
}
.data_body .item .right .time{
font-size: 22rpx;
color: #C2C2C2;
padding-right: 80rpx;
}
.data_body .item .right .shiyong{
font-size: 22rpx;
color: white;
padding: 11rpx 25rpx;
background:linear-gradient(133deg,rgba(38,198,165,1),rgba(97,220,212,1));
border-radius:12rpx;
}
.last_row{
display: flex;
align-items: flex-end;
}
.top-nav{
position: fixed;
z-index: 10;
top: 0repx;
left: 0rpx;
width: 100%;
padding: 27rpx 0 10rpx 54rpx;
font-size: 28rpx;
color: #000000;
box-shadow:0px 2px 18px 0px rgba(177,177,177,1);
background-color: white;
}
.left-btn{
position: absolute;
padding-right: 10rpx;
border-right: 1px solid #CFCFCF;
display: flex;
align-items: center;
width: 140rpx;
}
.bottom-nav{
display: flex;
padding-left: 34rpx;
}
.bottom-nav>view{
margin-right: 43rpx;
padding-bottom: 15rpx;
border-bottom: 4rpx solid transparent;
}
.bottom-nav>view.active{
color: #EE4454;
border-bottom: 4rpx solid #EE4454;
}
.left-btn image{
width: 13rpx;
}
.left-btn text{
padding-right: 20rpx;
}
.tab-box{
display: flex;
flex-wrap:wrap;
position: relative;
left: -18rpx;
padding: 25rpx 0;
}
.tab-box text{
width: 142rpx;
height: 60rpx;
color: #000000;
background:#EEEEEE;
line-height: 60rpx;
text-align: center;
font-size: 28rpx;
display: inline-block;
border-radius: 10rpx;
margin: 10rpx 0 20rpx 38rpx;
}
.tab-box text.active{
color: #EE4454;
background:rgba(238,68,84,.2);
}
.tab-box text.tag0,.tab-box text.tag4{
margin-left: 0;
}
.body_footer{
display: flex;
justify-content: center;
align-items: center;
height: 30px;
font-size: 12px;
color: #666666;
background-color:#F5F5F5;
}
\ No newline at end of file
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