first commit
This commit is contained in:
1
衣莎项目/源码/YiShaXiYi/user/couponList/.pydio
Normal file
1
衣莎项目/源码/YiShaXiYi/user/couponList/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
264d5db4-afad-4c84-864f-49bd8cfa69be
|
||||
121
衣莎项目/源码/YiShaXiYi/user/couponList/couponList.js
Normal file
121
衣莎项目/源码/YiShaXiYi/user/couponList/couponList.js
Normal file
@@ -0,0 +1,121 @@
|
||||
// user/couponList/couponList.js
|
||||
const app = getApp();
|
||||
const regeneratorRuntime = app.loadAsync()
|
||||
const model = app.loadModel("index")
|
||||
const http = app.loadHttp()
|
||||
const util = app.loadUtils("util")
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
system: app.globalData.system, //设备相关信息
|
||||
pageTitle: "优惠券", //头部标题
|
||||
isBack: true,//显示返回
|
||||
isLoading: true,//加载显示关闭
|
||||
current: '1',//当前所在的标签的 key 值
|
||||
couponList: [],//数据列表
|
||||
},
|
||||
|
||||
// tab选中事件
|
||||
handleChange({ detail }) {
|
||||
this.setData({
|
||||
current: detail.key,
|
||||
couponList: []
|
||||
});
|
||||
this.getCouponList()
|
||||
},
|
||||
// 显示隐藏内容
|
||||
isShow(e) {
|
||||
let index = e.currentTarget.dataset.index
|
||||
let list = this.data.couponList
|
||||
list[index].show = !list[index].show
|
||||
this.setData({
|
||||
couponList: list
|
||||
})
|
||||
},
|
||||
// 获取优惠券列表
|
||||
async getCouponList() {
|
||||
let res = await http.http.request2({ url: `${http.api.userCoupon}`, method: "POST", data: { status: this.data.current } })
|
||||
let rel = res.data.data
|
||||
if (rel.length > 0) {
|
||||
rel.map((v, i) => {
|
||||
rel[i].end_time = util.formatTime(v.end_time, 'Y-M-D h:m:s')
|
||||
})
|
||||
this.setData({
|
||||
couponList: rel,
|
||||
isLoading: false
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
couponList: [],
|
||||
isLoading: false
|
||||
})
|
||||
}
|
||||
},
|
||||
// 跳转
|
||||
goUrl(e) {
|
||||
// let url = e.currentTarget.dataset.url
|
||||
if (app.globalData.userInfo.group_type == 0) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/laundry/laundry'
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.getCouponList()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
7
衣莎项目/源码/YiShaXiYi/user/couponList/couponList.json
Normal file
7
衣莎项目/源码/YiShaXiYi/user/couponList/couponList.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"i-tabs": "../../extend/iview/dist/tabs/index",
|
||||
"i-tab": "../../extend/iview/dist/tab/index"
|
||||
}
|
||||
}
|
||||
48
衣莎项目/源码/YiShaXiYi/user/couponList/couponList.wxml
Normal file
48
衣莎项目/源码/YiShaXiYi/user/couponList/couponList.wxml
Normal file
@@ -0,0 +1,48 @@
|
||||
<!-- 头部 -->
|
||||
<nav-bar isBack="{{isBack}}" pageTitle="{{pageTitle}}" system="{{system}}"></nav-bar>
|
||||
<!-- user/couponList/couponList.wxml -->
|
||||
<view class="couponList">
|
||||
<view class="order_tab" style="top:{{system.statusHeight+system.titleHeight+'px'}}">
|
||||
<i-tabs current="{{ current }}" color="#1dbf45" bindchange="handleChange">
|
||||
<i-tab key="1" title="未使用"></i-tab>
|
||||
<i-tab key="2" title="已使用"></i-tab>
|
||||
<i-tab key="3" title="已过期"></i-tab>
|
||||
</i-tabs>
|
||||
</view>
|
||||
<view class="coupon_con">
|
||||
<view class="coupon" wx:if="{{couponList.length > 0}}">
|
||||
<view wx:for="{{couponList}}" wx:key="{{index}}" class="coupon_list mt30 {{ item.status != 1 ? 'coupon_list2' : '' }}" bind:tap="goUrl">
|
||||
<view class="coupon_list_l">
|
||||
<view>
|
||||
¥
|
||||
<span>{{item.coupon_price}}</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coupon_list_r">
|
||||
<view>
|
||||
<view class="coupon_list_r_top">
|
||||
{{item.coupon_title}}
|
||||
<!-- <span class="ml40">即将过期</span> -->
|
||||
</view>
|
||||
<view class="coupon_list_r_p mt10">满{{item.use_min_price}}元可用</view>
|
||||
<view class="coupon_list_r_p">有效期至:{{item.end_time}}</view>
|
||||
<view class="coupon_list_r_p mt10">{{item.des}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{item.status == 2}}" class="gqimg">
|
||||
<image src="/static/img/yhjysy.png" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="empty flex-con3" wx:elif="{{ couponList.length <= 0 }}">
|
||||
<view>
|
||||
<image class="empty_img" src="/static/img/icon/yhjk.png" />
|
||||
<view>还没有优惠券哦</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 加载动画 -->
|
||||
<loading-prog isLoading="{{isLoading}}"></loading-prog>
|
||||
<!-- toasta提示 -->
|
||||
<i-toast id="toast" />
|
||||
127
衣莎项目/源码/YiShaXiYi/user/couponList/couponList.wxss
Normal file
127
衣莎项目/源码/YiShaXiYi/user/couponList/couponList.wxss
Normal file
@@ -0,0 +1,127 @@
|
||||
/* user/couponList/couponList.wxss */
|
||||
|
||||
.order_tab {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
top: 0;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.coupon_con {
|
||||
margin-top: 54px;
|
||||
}
|
||||
|
||||
.coupon {
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.coupon_list {
|
||||
background: #fff;
|
||||
padding: 50rpx 0;
|
||||
border-left: 8rpx solid #1dbf53;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.coupon_list_l {
|
||||
display: inline-block;
|
||||
padding: 0 34rpx;
|
||||
font-size: 32rpx;
|
||||
color: #1dbf53;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.coupon_list2 {
|
||||
border-left: 4rpx solid #999;
|
||||
}
|
||||
|
||||
.coupon_list2 span, .coupon_list2 view {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.coupon_list2 .gqimg {
|
||||
position: absolute;
|
||||
right: -30rpx;
|
||||
top: -30rpx;
|
||||
width: 159rpx;
|
||||
height: 159rpx;
|
||||
}
|
||||
|
||||
.gqimg image {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.coupon_list_l span {
|
||||
font-size: 60rpx;
|
||||
}
|
||||
|
||||
.coupon_list_r {
|
||||
display: inline-block;
|
||||
flex: 1;
|
||||
/* padding-right: 55rpx; */
|
||||
}
|
||||
|
||||
.coupon_list_b {
|
||||
height: 100%;
|
||||
width: 80rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.coupon_list_b span {
|
||||
position: absolute;
|
||||
top: 173rpx;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.coupon_list_b span image {
|
||||
width: 21rpx;
|
||||
height: 11rpx;
|
||||
}
|
||||
|
||||
.coupon_list_r_top {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.coupon_list_r_top span {
|
||||
width: 105rpx;
|
||||
height: 32rpx;
|
||||
background-color: #fff1f0;
|
||||
border-radius: 5rpx;
|
||||
font-size: 20rpx;
|
||||
color: #ff4026;
|
||||
text-align: center;
|
||||
line-height: 32rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.coupon_list_r_p {
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.rotate {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.empty {
|
||||
height: 600rpx;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-family: PingFang-SC-Medium;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.empty_img {
|
||||
width: 116rpx;
|
||||
height: 83rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user