Initial Commit
This commit is contained in:
120
pages/my/coupon/coupon.js
Normal file
120
pages/my/coupon/coupon.js
Normal file
@ -0,0 +1,120 @@
|
||||
// pages/coupon/coupon.js
|
||||
const app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
bgImg: app.globalData.bgImg,
|
||||
img: app.globalData.img,
|
||||
thisid: 0,
|
||||
titleList: [{
|
||||
id: 0,
|
||||
title: "待使用"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "已使用"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "已过期"
|
||||
},
|
||||
],
|
||||
},
|
||||
//状态切换
|
||||
tabSelect(e) {
|
||||
this.setData({
|
||||
thisid: e.currentTarget.dataset.id,
|
||||
})
|
||||
this.orderListInit()
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
this.orderListInit()
|
||||
},
|
||||
|
||||
orderListInit() {
|
||||
wx.showLoading({
|
||||
title: '加载中..',
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/user/getUserPackage',
|
||||
method: 'GET',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
userId:app.globalData.userId,
|
||||
type: this.data.thisid
|
||||
},
|
||||
success: res => {
|
||||
console.log(res.data)
|
||||
wx.hideLoading()
|
||||
if (res.data.code == 1) {
|
||||
this.setData({
|
||||
dataList:res.data.value
|
||||
})
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '提示!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//立即使用
|
||||
ljsy(e){
|
||||
wx.navigateTo({
|
||||
url: '/pages/welfare/welfare?id='+e.currentTarget.dataset.id,
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function() {
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {
|
||||
|
||||
},
|
||||
})
|
4
pages/my/coupon/coupon.json
Normal file
4
pages/my/coupon/coupon.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "套餐券"
|
||||
}
|
31
pages/my/coupon/coupon.wxml
Normal file
31
pages/my/coupon/coupon.wxml
Normal file
@ -0,0 +1,31 @@
|
||||
<!--pages/coupon/coupon.wxml-->
|
||||
<view class="top display_J_A">
|
||||
<view wx:for="{{ titleList }}" wx:key="index" bindtap="tabSelect" data-id="{{item.id}}">
|
||||
<view class="tui-tabbar-cel {{item.id==thisid?'tui-active':''}}">{{item.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="heights"></view>
|
||||
<view class="block">
|
||||
<view class="block-title">{{thisid==0?'待使用套餐券':thisid==1?'已使用套餐券':thisid==2?'已过期套餐券':''}}</view>
|
||||
<view class="line"></view>
|
||||
<view class="block-main" wx:for="{{dataList}}" wx:key="index">
|
||||
<view class="block-main-mk display_J_B" style="background: url({{bgImg}}{{thisid==0?'yhq-xz':thisid==1?'yhq-gq':thisid==2?'yhq-gq':''}}.png) no-repeat;background-size: 100%;">
|
||||
<image src="/icon/ysy.png" wx:if='{{thisid==1}}' class="ysy"></image>
|
||||
<image src="/icon/ygq.png" wx:if='{{thisid==2}}' class="ysy"></image>
|
||||
<view class="block-main-left ">
|
||||
<view class="GStitleOne" style="width: 160rpx">{{item.packageName}}</view>
|
||||
<view class="block-main-leftbtn" wx:if='{{thisid==0}}' bindtap="ljsy" data-id='{{item.id}}'>立即使用</view>
|
||||
<view class="block-main-rightbtn" wx:if='{{thisid==1}}'>已使用</view>
|
||||
<view class="block-main-rightbtn" wx:if='{{thisid==2}}'>已过期</view>
|
||||
</view>
|
||||
<view class="block-main-right">
|
||||
<view>仅支持兑换套餐商品</view>
|
||||
<view style="margin-top:15rpx;">有效期至:{{item.packageEndTime}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="block-main-no" wx:if='{{dataList.length==0}}'>
|
||||
<image src="/icon/yhq-no.png"></image>
|
||||
<view>暂无套餐券~</view>
|
||||
</view>
|
120
pages/my/coupon/coupon.wxss
Normal file
120
pages/my/coupon/coupon.wxss
Normal file
@ -0,0 +1,120 @@
|
||||
/* pages/coupon/coupon.wxss */
|
||||
|
||||
page {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.top {
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
background-color: #fff;
|
||||
line-height: 100rpx;
|
||||
font-size: 32rpx;
|
||||
color: #999;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
z-index: 111;
|
||||
border-bottom: 20rpx solid #f9f9f9;
|
||||
}
|
||||
|
||||
.heights {
|
||||
width: 750rpx;
|
||||
height: 110rpx;
|
||||
}
|
||||
|
||||
.tui-active {
|
||||
font-size: 32rpx;
|
||||
color: #ee7b1e;
|
||||
}
|
||||
|
||||
.tui-active::after {
|
||||
content: "";
|
||||
width: 92rpx;
|
||||
height: 6rpx;
|
||||
background-color: #ee7b1e;
|
||||
border-radius: 3rpx;
|
||||
display: block;
|
||||
margin: -6rpx auto 0rpx auto;
|
||||
}
|
||||
|
||||
.block-title {
|
||||
font-size: 32rpx;
|
||||
color: #3f4967;
|
||||
text-align: center;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 617rpx;
|
||||
height: 2rpx;
|
||||
border-bottom: dashed 5rpx #a0a0a0;
|
||||
margin: 20rpx 67rpx 90rpx 67rpx;
|
||||
}
|
||||
|
||||
.block-main {
|
||||
width: 682rpx;
|
||||
margin: 0rpx auto;
|
||||
}
|
||||
|
||||
.block-main-mk {
|
||||
width: 682rpx;
|
||||
height: 202rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.block-main-left {
|
||||
margin: 30rpx 0rpx 0rpx 48rpx;
|
||||
color: #fff;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.block-main-leftbtn {
|
||||
width: 140rpx;
|
||||
height: 40rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
line-height: 40rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #f41439;
|
||||
margin: 25rpx 0rpx 0rpx -8rpx;
|
||||
}
|
||||
|
||||
.block-main-right {
|
||||
width: 360rpx;
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
margin: 48rpx 0rpx;
|
||||
}
|
||||
|
||||
.block-main-no {
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.block-main-no image {
|
||||
width: 292rpx;
|
||||
height: 259rpx;
|
||||
margin: 130rpx 0rpx 50rpx 0rpx;
|
||||
}
|
||||
|
||||
.block-main-rightbtn {
|
||||
width: 140rpx;
|
||||
height: 40rpx;
|
||||
background-color: #d2d2d2;
|
||||
border-radius: 20rpx;
|
||||
line-height: 40rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
margin: 25rpx 0rpx 0rpx -8rpx;
|
||||
}
|
||||
|
||||
.ysy {
|
||||
width: 131rpx;
|
||||
height: 131rpx;
|
||||
position: absolute;
|
||||
left: 532rpx;
|
||||
top:11rpx;
|
||||
}
|
Reference in New Issue
Block a user