init project
This commit is contained in:
227
pages/gymnasium/index.js
Normal file
227
pages/gymnasium/index.js
Normal file
@@ -0,0 +1,227 @@
|
||||
// pages/gymnasium/index.js
|
||||
const app = getApp();
|
||||
import {
|
||||
getCurrentPageUrl
|
||||
} from './../../utils/util.js'
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
isShowBuyVip: false,
|
||||
venues: {},
|
||||
buyVipObj: {},
|
||||
showUnclickMask: false,
|
||||
showCardMask: false,
|
||||
isWxLogin: false,
|
||||
isGoHome: false,
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
app.$api.venueDetail({
|
||||
venueId: options.id
|
||||
}).then(res => {
|
||||
this.setData({
|
||||
venues: res.venues
|
||||
})
|
||||
}, err => {
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function() {
|
||||
let pages = getCurrentPages();
|
||||
this.setData({
|
||||
isGoHome: pages.length == 1
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
this.setData({
|
||||
showUnclickMask: false
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: this.data.venues.name,
|
||||
imageUrl: this.data.venues.images[0].url
|
||||
}
|
||||
},
|
||||
|
||||
// 打开导航,
|
||||
opnGPS() {
|
||||
wx.openLocation({
|
||||
latitude: Number(this.data.venues.latitude),
|
||||
longitude: Number(this.data.venues.longitude),
|
||||
name: this.data.venues.name,
|
||||
address: this.data.venues.address,
|
||||
})
|
||||
},
|
||||
|
||||
// 打电话
|
||||
callPhone() {
|
||||
wx.makePhoneCall({
|
||||
phoneNumber: this.data.venues.phone,
|
||||
success: function(res) {},
|
||||
fail: function(res) {},
|
||||
complete: function(res) {},
|
||||
})
|
||||
},
|
||||
|
||||
// 购买套餐
|
||||
nowBuy(e) {
|
||||
let index = e.currentTarget.dataset.index;
|
||||
if (!wx.getStorageSync('accessToken')) {
|
||||
wx.setStorageSync('history', getCurrentPageUrl());
|
||||
wx.redirectTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
isShowBuyVip: true,
|
||||
buyVipObj: this.data.venues.cards[index]
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
// 跳转预约课程
|
||||
pushBookClasses() {
|
||||
wx.navigateTo({
|
||||
url: `/pages/bookClasses/index?type=${this.data.venues.type}&venueId=${this.data.venues.id}`,
|
||||
})
|
||||
},
|
||||
|
||||
// 弹框背景禁止滑动
|
||||
unMove() {
|
||||
return;
|
||||
},
|
||||
|
||||
// 关闭购买vip弹框
|
||||
closeBuyVipPopup() {
|
||||
this.setData({
|
||||
isShowBuyVip: false
|
||||
})
|
||||
},
|
||||
|
||||
// 购买Vip
|
||||
buyVip() {
|
||||
this.setData({
|
||||
showUnclickMask: true
|
||||
})
|
||||
app.$api.memberCardOrderCreate({
|
||||
cardType: this.data.buyVipObj.cardType,
|
||||
num: 1,
|
||||
type: this.data.venues.type,
|
||||
venueId: this.data.venues.id
|
||||
}).then(res => {
|
||||
app.$pay.wxPay(res.pay).then(res => {
|
||||
this.setData({
|
||||
isShowBuyVip: false,
|
||||
showUnclickMask: false
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
showUnclickMask: false,
|
||||
isShowBuyVip: false
|
||||
})
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
showUnclickMask: false,
|
||||
isShowBuyVip: false
|
||||
})
|
||||
if (err.data.err_code == 30022) {
|
||||
this.setData({
|
||||
isWxLogin: true,
|
||||
isShowBuyVip: false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 关闭
|
||||
cancelCardMask() {
|
||||
this.setData({
|
||||
showCardMask: false
|
||||
})
|
||||
},
|
||||
|
||||
// 开启会员卡提示
|
||||
showCardContent() {
|
||||
this.setData({
|
||||
showCardMask: true
|
||||
})
|
||||
},
|
||||
|
||||
// 取消授权登录
|
||||
cancelDeleteDialog() {
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
},
|
||||
|
||||
// 授权微信
|
||||
getUserInfo(e) {
|
||||
app.$pay.payWxLoing(e.detail).then(res => {
|
||||
wx.showToast({
|
||||
title: '绑定成功',
|
||||
duration: 2000,
|
||||
|
||||
})
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
}, err => {
|
||||
this.setData({
|
||||
isWxLogin: false
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
7
pages/gymnasium/index.json
Normal file
7
pages/gymnasium/index.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "健身",
|
||||
"usingComponents": {
|
||||
"confirm-dialog": "/component/confirmDialog/confirmDialog",
|
||||
"header": "/component/header/header"
|
||||
}
|
||||
}
|
||||
96
pages/gymnasium/index.wxml
Normal file
96
pages/gymnasium/index.wxml
Normal file
@@ -0,0 +1,96 @@
|
||||
<!--pages/gymnasium/index.wxml-->
|
||||
<header title="{{venues.name}}" isGoHome="{{isGoHome}}"></header>
|
||||
<view class='container' wx:if="{{venues.name}}">
|
||||
<swiper class='header' indicator-dots="{{venues.images.length > 1}}" autoplay="{{true}}" circular="{{true}}">
|
||||
<block wx:for="{{venues.images}}" wx:key="{{index}}">
|
||||
<swiper-item>
|
||||
<image src="{{item.url}}" mode='aspectFill'></image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<view class='cell-box'>
|
||||
<view class='cell'>
|
||||
<image src='../../images/42@3x.png' mode='aspectFit'></image>
|
||||
<text>{{venues.businessTime}}</text>
|
||||
</view>
|
||||
<view class='cell' bindtap='opnGPS'>
|
||||
<image src='../../images/41@3x.png' mode='aspectFit'></image>
|
||||
<text>{{venues.address}}</text>
|
||||
<view class='cell-right'>
|
||||
<image src='../../images/34@3x.png' class='gps-img'></image>
|
||||
<text>导航</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class='cell unline'>
|
||||
<image src='../../images/36@3x.png' mode='aspectFit'></image>
|
||||
<text>{{venues.contact}}</text>
|
||||
<view class='phone-number' bindtap='callPhone'>{{venues.phone}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='cell-box' wx:if="{{venues.cards.length > 0}}">
|
||||
<view class='cell'>
|
||||
<image src='../../images/40@3x.png' mode='aspectFit'></image>
|
||||
<view class='title'>
|
||||
<text>VIP会员享受专属特权</text>
|
||||
<image src='../../images/5@3x.png' wx:if="{{venues.cardContent}}" bindtap='showCardContent'></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class='cell unline' wx:for="{{venues.cards}}" wx:key="{{index}}">
|
||||
<view class='tip'>{{item.cardName}}</view>
|
||||
<text>¥{{item.price}}</text>
|
||||
<view class='buy-btn' bindtap='nowBuy' data-index='{{index}}'>立即购买</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='cell-box'>
|
||||
<view class='cell'>
|
||||
<image src='../../images/35@3x.png' mode='aspectFit'></image>
|
||||
<view class='title'>
|
||||
<text>项目介绍</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class='rich-box'>
|
||||
<rich-text nodes="{{venues.description}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='footer-btn' bindtap='pushBookClasses'>预约</view>
|
||||
</view>
|
||||
|
||||
<view class='buyVIPPopup' catchtouchmove='unMove' wx:if="{{isShowBuyVip}}">
|
||||
<view class='popup-body'>
|
||||
<view class='popup-header'>
|
||||
<text>会员卡购买</text>
|
||||
<image src='../../images/23@3x.png' catchtap='closeBuyVipPopup'></image>
|
||||
</view>
|
||||
<view class='popup-center'>
|
||||
<view class='popup-cell'>
|
||||
<text>会员卡类型</text>
|
||||
<text>{{buyVipObj.cardName}}</text>
|
||||
</view>
|
||||
<view class='popup-cell'>
|
||||
<text>价格</text>
|
||||
<text>¥{{buyVipObj.price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class='popup-btn' catchtap='buyVip'>确认支付</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='unclick-mask' wx:if="{{showUnclickMask}}"></view>
|
||||
|
||||
<view class='card-mask' catchtouchmove='unMove' wx:if="{{showCardMask}}" bindtap='cancelCardMask'>
|
||||
<view class='card-box' catchtap='unMove'>
|
||||
<view class='close' catchtap='cancelCardMask'>
|
||||
<image src='../../images/23@3x.png'></image>
|
||||
</view>
|
||||
<view class='title'>VIP会员享受专属特权</view>
|
||||
<rich-text class='info-rich' nodes="{{venues.cardContent}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<confirm-dialog title="提示" message="请先绑定微信" confirmBtnTitle="绑定" isUserInfo="{{true}}" bindcancelselect="cancelDeleteDialog" bindgetuserinfo="getUserInfo" wx:if="{{isWxLogin}}"></confirm-dialog>
|
||||
|
||||
<view class='share-btn-box'>
|
||||
<button open-type='share'></button>
|
||||
<image src='https://yingdd.oss-cn-hangzhou.aliyuncs.com/9bc27242fd0c9f9f08d867dc027cc82b.png' style='width:100%; height: 100%'></image>
|
||||
</view>
|
||||
290
pages/gymnasium/index.wxss
Normal file
290
pages/gymnasium/index.wxss
Normal file
@@ -0,0 +1,290 @@
|
||||
/* pages/gymnasium/index.wxss */
|
||||
|
||||
.container {
|
||||
padding-bottom: 130rpx;
|
||||
min-height: calc(100vh - 330rpx);
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
height: 350rpx;
|
||||
}
|
||||
|
||||
.header image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.cell-box {
|
||||
margin: 30rpx 30rpx 0 30rpx;
|
||||
background: #1a191e;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 90rpx;
|
||||
padding: 0 20rpx;
|
||||
border-bottom: 2rpx solid #212025;
|
||||
}
|
||||
|
||||
.cell-box .cell.unline {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.cell-box .cell>image {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell>text {
|
||||
flex: 1;
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
.cell-box .cell .cell-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell .cell-right .gps-img {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.cell-box .cell .cell-right>text {
|
||||
height: 20rpx;
|
||||
margin-top: 6rpx;
|
||||
line-height: 20rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell .phone-number {
|
||||
color: #ffda2e;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell .title {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell .title>image {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
margin-left: 14rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell .tip {
|
||||
min-width: 70rpx;
|
||||
height: 30rpx;
|
||||
padding: 0 4rpx;
|
||||
margin-right: 22rpx;
|
||||
font-size: 20rpx;
|
||||
line-height: 30rpx;
|
||||
border: 2rpx solid #ffda2e;
|
||||
color: #ffda2e;
|
||||
border-radius: 6rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cell-box .cell .buy-btn {
|
||||
font-size: 26rpx;
|
||||
color: #ffda2e;
|
||||
}
|
||||
|
||||
.cell-box .rich-box {
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 24rpx;
|
||||
padding: 30rpx 20rpx;
|
||||
}
|
||||
|
||||
.cell-box .rich-box .wscnph {
|
||||
width: calc(100% - 10rpx);
|
||||
margin-left: 5rpx;
|
||||
}
|
||||
|
||||
.footer-btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
background: #ffda2e;
|
||||
color: #1a191e;
|
||||
font-size: 32rpx;
|
||||
text-align: center;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
|
||||
.buyVIPPopup {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
.buyVIPPopup .popup-body {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
width: 540rpx;
|
||||
height: 350rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #252330;
|
||||
}
|
||||
|
||||
.buyVIPPopup .popup-body .popup-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 80rpx;
|
||||
padding: 0 36rpx 0 26rpx;
|
||||
}
|
||||
|
||||
.buyVIPPopup .popup-body .popup-header>text {
|
||||
font-size: 26rpx;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.buyVIPPopup .popup-body .popup-header>image {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
|
||||
.buyVIPPopup .popup-body .popup-center {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 0 36rpx 0 26rpx;
|
||||
font-size: 26rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
line-height: 26rpx;
|
||||
}
|
||||
|
||||
.buyVIPPopup .popup-body .popup-center .popup-cell {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.buyVIPPopup .popup-body .popup-btn {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
color: #252330;
|
||||
background: #ffda2e;
|
||||
font-size: 26rpx;
|
||||
border-radius: 0 0 20rpx 20rpx;
|
||||
}
|
||||
|
||||
.unclick-mask{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.card-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
.card-mask .card-box {
|
||||
position: relative;
|
||||
width: 70%;
|
||||
/* min-height: 300rpx; */
|
||||
border-radius: 20rpx;
|
||||
background: #1a191e;
|
||||
font-size: 24rpx;
|
||||
line-height: 30rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.card-mask .card-box .close {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
.card-mask .card-box .close>image {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
|
||||
.card-mask .card-box .info-rich {
|
||||
padding: 30rpx;
|
||||
font-size: 26rpx;
|
||||
line-height: 36rpx;
|
||||
color: rgba(255, 255, 255, 0.6)
|
||||
}
|
||||
|
||||
.card-mask .card-box .title {
|
||||
text-align: center;
|
||||
color: #ffda2e;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.share-btn-box {
|
||||
position: fixed;
|
||||
right: 30rpx;
|
||||
bottom: 130rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
color: #1a191e;
|
||||
font-size: 24rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.share-btn-box>button {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0);
|
||||
font-size: 24rpx;
|
||||
color: #1a191e;
|
||||
}
|
||||
.share-btn-box>button::after {
|
||||
border: none;
|
||||
}
|
||||
Reference in New Issue
Block a user