init project
This commit is contained in:
131
pages/myBookingsList/index.js
Normal file
131
pages/myBookingsList/index.js
Normal file
@@ -0,0 +1,131 @@
|
||||
// pages/myBookingsList/index.js
|
||||
const app = getApp();
|
||||
let page = 1;
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
state: 0,
|
||||
list: [],
|
||||
isShowNewplot: false,
|
||||
gohome: true
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
this.getData();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function() {
|
||||
page = 1;
|
||||
this.getData();
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {
|
||||
page++;
|
||||
this.getData();
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: '智慧云馆'
|
||||
}
|
||||
},
|
||||
|
||||
// 切换标签
|
||||
changeTab(e) {
|
||||
let state = e.currentTarget.dataset.state;
|
||||
this.setData({
|
||||
state: state
|
||||
})
|
||||
page = 1;
|
||||
this.getData();
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
getData() {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
app.$api.memberLessonTicketsReserve({
|
||||
page: page,
|
||||
pageSize: 10,
|
||||
status: this.data.state
|
||||
}).then(res => {
|
||||
let list = [];
|
||||
if (page == 1) {
|
||||
this.setData({
|
||||
list: []
|
||||
})
|
||||
} else {
|
||||
list = this.data.list;
|
||||
}
|
||||
for (let i = 0; i < res.page.data.length; i++) {
|
||||
let currentDate = new Date().getTime();
|
||||
let endDate = 0;
|
||||
if (res.page.data[i].date) {
|
||||
endDate = new Date(res.page.data[i].date.replace(/-/g, "/") + ' ' + res.page.data[i].endTime).getTime();
|
||||
}
|
||||
res.page.data[i].isEnd = currentDate > endDate;
|
||||
list.push(res.page.data[i]);
|
||||
}
|
||||
this.setData({
|
||||
list: list,
|
||||
isShowNewplot: true
|
||||
})
|
||||
wx.stopPullDownRefresh()
|
||||
}, err => {
|
||||
wx.stopPullDownRefresh()
|
||||
})
|
||||
},
|
||||
|
||||
// 点击CEll
|
||||
clickCell(e) {
|
||||
let orderSn = e.currentTarget.dataset.ordersn;
|
||||
wx.navigateTo({
|
||||
url: `/pages/myBookings/index?orderSn=${orderSn}`,
|
||||
})
|
||||
}
|
||||
})
|
||||
7
pages/myBookingsList/index.json
Normal file
7
pages/myBookingsList/index.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "我的预约",
|
||||
"enablePullDownRefresh": true,
|
||||
"usingComponents": {
|
||||
"header": "/component/header/header"
|
||||
}
|
||||
}
|
||||
44
pages/myBookingsList/index.wxml
Normal file
44
pages/myBookingsList/index.wxml
Normal file
@@ -0,0 +1,44 @@
|
||||
<!--pages/myBookingsList/index.wxml-->
|
||||
<header title="我的预约"></header>
|
||||
|
||||
<view class='container'>
|
||||
<view class='header'>
|
||||
<view class='btn-box' data-state='0' bindtap='changeTab'>
|
||||
<view class='item-btn {{state == 0 ? "isActive" : ""}}'>已预约</view>
|
||||
</view>
|
||||
<view class='btn-box' data-state='1' bindtap='changeTab'>
|
||||
<view class='item-btn {{state == 1 ? "isActive" : ""}}'>已完成</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='cell' wx:for="{{list}}" wx:key="{{index}}" bindtap='clickCell' data-ordersn='{{item.orderSn}}'>
|
||||
<view class='top'>
|
||||
<text>预约单号: {{item.orderSn}}</text>
|
||||
<text class='isActive' wx:if="{{item.status == 0}}">已预约</text>
|
||||
<text wx:if="{{item.status == 3}}">未签到</text>
|
||||
<text wx:if="{{item.status == 1}}">已完成</text>
|
||||
<text wx:if="{{item.status == 2}}">已取消</text>
|
||||
</view>
|
||||
<view class='bottom'>
|
||||
<image src='{{item.lessonImage}}' mode='aspectFill'></image>
|
||||
<view class='goods-box'>
|
||||
<view class='title-box'>
|
||||
<view class='title-left'>
|
||||
<text>{{item.lessonName}}</text>
|
||||
<text>({{item.lessonCount}}人)</text>
|
||||
</view>
|
||||
<view class='title-right' wx:if="{{item.payType == 1}}">¥{{item.order.price}}</view>
|
||||
</view>
|
||||
<view class='message'>
|
||||
{{item.date}} {{item.startTime}} ~ {{item.endTime}}
|
||||
</view>
|
||||
<view class='message'>{{item.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='newplot' wx:if="{{list.length == 0 && isShowNewplot}}">
|
||||
<image src='../../images/noContent.png'></image>
|
||||
<text>暂无预约 ~</text>
|
||||
</view>
|
||||
134
pages/myBookingsList/index.wxss
Normal file
134
pages/myBookingsList/index.wxss
Normal file
@@ -0,0 +1,134 @@
|
||||
/* pages/myBookingsList/index.wxss */
|
||||
|
||||
.container {
|
||||
min-height: calc(100vh - 260rpx);
|
||||
padding: 250rpx 30rpx 30rpx 30rpx;
|
||||
}
|
||||
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 120rpx;
|
||||
left: 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
background: #1a191e;
|
||||
}
|
||||
|
||||
.header .btn-box {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header .btn-box .item-btn {
|
||||
width: 90rpx;
|
||||
height: 84rpx;
|
||||
margin: 0 auto;
|
||||
font-size: 28rpx;
|
||||
line-height: 90rpx;
|
||||
border-bottom: 6rpx solid #1a191e;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
.header .btn-box .item-btn.isActive {
|
||||
color: #ffda2e;
|
||||
border-bottom: 6rpx solid #ffda2e;
|
||||
}
|
||||
|
||||
.cell {
|
||||
margin-bottom: 30rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #1a191e;
|
||||
}
|
||||
|
||||
.cell .top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 80rpx;
|
||||
padding: 0 26rpx;
|
||||
border: 2rpx solid #212025;
|
||||
}
|
||||
|
||||
.cell .top>text:first-child {
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.cell .top>text:last-child {
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.cell .top>text:last-child.isActive {
|
||||
color: #ffda2e;
|
||||
}
|
||||
|
||||
.cell .bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx 24rpx;
|
||||
}
|
||||
|
||||
.cell .bottom>image {
|
||||
width: 130rpx;
|
||||
height: 110rpx;
|
||||
}
|
||||
|
||||
.cell .bottom .goods-box {
|
||||
flex: 1;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.cell .bottom .goods-box .title-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cell .bottom .goods-box .title-box .title-left {
|
||||
flex: 1;
|
||||
height: 26rpx;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
|
||||
.cell .bottom .goods-box .title-box .title-left>text:first-child {
|
||||
font-size: 26rpx;
|
||||
color: #ffda2e;
|
||||
}
|
||||
|
||||
.cell .bottom .goods-box .title-box .title-right {
|
||||
font-size: 24rpx;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.cell .bottom .goods-box .message {
|
||||
font-size: 22rpx;
|
||||
color: #FFF;
|
||||
line-height: 22rpx;
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.newplot {
|
||||
position: fixed;
|
||||
top: 260rpx;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #FFF;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.newplot>image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin-top: -200rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user