250108
This commit is contained in:
@@ -5,62 +5,64 @@
|
||||
<uv-tabs :list="next7day" :itemStyle="{height: '58px'}" :activeStyle="{ color: '#2ba91c'}" lineColor="#2ba91c"
|
||||
:inactiveStyle="{ color: '#808080' }" @change="onDateTime"></uv-tabs>
|
||||
</uv-sticky>
|
||||
<view class="uni-padding-wrap uni-common-mt">
|
||||
<uni-segmented-control :current="current" :values="items" activeColor="#2ba91c" inActiveColor="#ff0000"
|
||||
@clickItem="onType"/>
|
||||
<template v-if="merchantId !== 37">
|
||||
<view class="uni-padding-wrap uni-common-mt" v-if="fieldList && fieldList.length && fieldList[0].isHalf === 1">
|
||||
<uni-segmented-control :current="current" :values="items" activeColor="#2ba91c" inActiveColor="#ff0000"
|
||||
@clickItem="onType"/>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<!-- 状态说明 -->
|
||||
<view class="uni-badge-wrap">
|
||||
<view class="badge-item">
|
||||
<uv-badge :isDot="true" type="blank"></uv-badge>
|
||||
<text class="web-text-secondary">可预约</text>
|
||||
</view>
|
||||
<!-- 状态说明 -->
|
||||
<view class="uni-badge-wrap">
|
||||
<view class="badge-item">
|
||||
<uv-badge :isDot="true" type="blank"></uv-badge>
|
||||
<text class="web-text-secondary">可预约</text>
|
||||
</view>
|
||||
<view class="badge-item">
|
||||
<uv-badge :isDot="true" type="info"></uv-badge>
|
||||
<text class="web-text-secondary">已出售</text>
|
||||
</view>
|
||||
<view class="badge-item">
|
||||
<uv-badge :isDot="true" type="success"></uv-badge>
|
||||
<text class="web-text-secondary">我的选择</text>
|
||||
</view>
|
||||
<view class="badge-item">
|
||||
<uv-badge :isDot="true" type="warning"></uv-badge>
|
||||
<text class="web-text-secondary">已预定半场</text>
|
||||
</view>
|
||||
<view class="badge-item">
|
||||
<uv-badge :isDot="true" type="info"></uv-badge>
|
||||
<text class="web-text-secondary">已出售</text>
|
||||
</view>
|
||||
<!-- 场地列表 -->
|
||||
<view class="checkout-body web-text-primary" v-if="periodList.length > 0">
|
||||
<template v-for="(item,index) in periodList" :key="index">
|
||||
<view class="period-item">
|
||||
<view class="period">{{ item.timePeriod }}</view>
|
||||
<view class="field-list">
|
||||
<template v-for="(field,index2) in fieldList" :key="index2">
|
||||
<view class="field"
|
||||
:class="isActive(field, item)"
|
||||
@click="onField(field, item)">
|
||||
<text class="field-name">{{ field.name }}</text>
|
||||
<text class="price">{{ item.price }}元</text>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 排版样式备份 -->
|
||||
<view class="period-item" style="display: none;">
|
||||
<view class="period">18:00 - 20:00</view>
|
||||
<view class="badge-item">
|
||||
<uv-badge :isDot="true" type="success"></uv-badge>
|
||||
<text class="web-text-secondary">我的选择</text>
|
||||
</view>
|
||||
<view class="badge-item">
|
||||
<uv-badge :isDot="true" type="warning"></uv-badge>
|
||||
<text class="web-text-secondary">已预定半场</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 场地列表 -->
|
||||
<view class="checkout-body web-text-primary" v-if="periodList.length > 0">
|
||||
<template v-for="(item, index) in periodList" :key="index">
|
||||
<view class="period-item">
|
||||
<view class="period">{{ item.timePeriod }}</view>
|
||||
<view class="field-list">
|
||||
<view class="field web-bg-info">
|
||||
<text class="field-name">1号场地</text>
|
||||
<text class="price">580元</text>
|
||||
</view>
|
||||
<view class="field web-bg-success active">
|
||||
<text class="field-name">2号场地</text>
|
||||
<text class="price">580元</text>
|
||||
</view>
|
||||
<view class="field web-bg-warning">
|
||||
<text class="field-name">3号场地</text>
|
||||
<text class="price">580元</text>
|
||||
</view>
|
||||
<template v-for="(field, index2) in fieldList" :key="index2">
|
||||
<view class="field"
|
||||
:class="isActive(field, item)"
|
||||
@click="onField(field, item)">
|
||||
<text class="field-name">{{ field.name }}</text>
|
||||
<text class="price">{{ isHalf !== 1 ? item.price : item.halfPrice }}元</text>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 排版样式备份 -->
|
||||
<view class="period-item" style="display: none;">
|
||||
<view class="period">18:00 - 20:00</view>
|
||||
<view class="field-list">
|
||||
<view class="field web-bg-info">
|
||||
<text class="field-name">1号场地</text>
|
||||
<text class="price">580元</text>
|
||||
</view>
|
||||
<view class="field web-bg-success active">
|
||||
<text class="field-name">2号场地</text>
|
||||
<text class="price">580元</text>
|
||||
</view>
|
||||
<view class="field web-bg-warning">
|
||||
<text class="field-name">3号场地</text>
|
||||
<text class="price">580元</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -180,7 +182,7 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.merchantId = option.id
|
||||
this.merchantId = parseInt(option.id)
|
||||
this.reload();
|
||||
},
|
||||
onShow() {
|
||||
@@ -194,7 +196,8 @@ export default {
|
||||
const app = this
|
||||
let totalPrice = 0;
|
||||
app.selection.map(d => {
|
||||
totalPrice = totalPrice + d.price
|
||||
if (app.isHalf === 1) totalPrice += d.halfPrice
|
||||
else totalPrice += d.price
|
||||
})
|
||||
carStore.totalPrice = totalPrice
|
||||
console.log('totalPrice: ', totalPrice);
|
||||
@@ -256,7 +259,9 @@ export default {
|
||||
},
|
||||
setDateList() {
|
||||
this.next7day = []
|
||||
for (let i = 0; i < 7; i++) {
|
||||
let day = 7
|
||||
if (this.merchantId === 37) day = 7
|
||||
for (let i = 0; i < day; i++) {
|
||||
const day = dayjs().add(i, 'day')
|
||||
this.next7day.push({
|
||||
week: day.format('d') === '0' ? '7' : day.format('d'),
|
||||
@@ -276,8 +281,14 @@ export default {
|
||||
this.periodList = []
|
||||
this.timeList.forEach(item => {
|
||||
const weekList = JSON.parse(item.week)
|
||||
if (weekList.includes(this.week) && dayjs().isBefore(dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]))) this.periodList.push(item)
|
||||
if (parseInt(this.merchantId) === 37) {
|
||||
const today = dayjs().format('YYYY-MM-DD')
|
||||
if (dayjs().isBefore(dayjs(today + ' 21:00:00')) || dayjs(this.dateTime).isAfter(dayjs())) this.periodList.push(item)
|
||||
} else {
|
||||
if (weekList.includes(this.week) && dayjs().isBefore(dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]))) this.periodList.push(item)
|
||||
}
|
||||
})
|
||||
// console.log(this.periodList)
|
||||
},
|
||||
onDisabled() {
|
||||
this.disabled = !this.disabled;
|
||||
@@ -305,7 +316,7 @@ export default {
|
||||
},
|
||||
async getFieldList() {
|
||||
if (!this.periodList.length) {
|
||||
return uni.showToast({
|
||||
return uni.showToast({
|
||||
title: '暂无可预订场地',
|
||||
icon: 'none'
|
||||
})
|
||||
@@ -324,53 +335,6 @@ export default {
|
||||
periodVoList
|
||||
})
|
||||
},
|
||||
getBookingPeriod() {
|
||||
const {
|
||||
serverTime,
|
||||
merchantId
|
||||
} = this
|
||||
const now = new Date();
|
||||
const hours = now.getHours();
|
||||
const minutes = now.getMinutes()
|
||||
const week = this.week == 0 ? 7 : this.week
|
||||
let startTime;
|
||||
startTime = serverTime.today == this.dateTime ? String(hours) + String(minutes) : undefined
|
||||
// 游泳馆当前21:30前都可以预定
|
||||
if (merchantId === '3028' && Number(startTime) < 2130) {
|
||||
startTime = undefined
|
||||
}
|
||||
|
||||
PeriodApi.listPeriod({
|
||||
merchantId: this.merchantId,
|
||||
isStatus: 0,
|
||||
week,
|
||||
dateTime: `${this.dateTime}`,
|
||||
startTime,
|
||||
half: this.isHalf
|
||||
}).then(list => {
|
||||
this.periodList = list;
|
||||
uni.hideLoading()
|
||||
}).catch(err => {
|
||||
this.periodList = [];
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
})
|
||||
uni.hideLoading()
|
||||
if (err.message === '您还有未支付订单,请先支付') {
|
||||
setTimeout(() => {
|
||||
return uni.switchTab({
|
||||
url: '/pages/order/order'
|
||||
});
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
},
|
||||
callPhone(phone) {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phone
|
||||
});
|
||||
},
|
||||
openCarInfo() {
|
||||
// this.showCarInfo = !this.showCarInfo;
|
||||
// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
|
||||
@@ -380,8 +344,11 @@ export default {
|
||||
this.$refs.popup.close()
|
||||
},
|
||||
onField(field, item) {
|
||||
const timePeriod = item.timePeriod
|
||||
const checkTimePeriod = field.periodVoList.find(d => (d.period === timePeriod && d.id === item.id))
|
||||
// console.log('here', field, item)
|
||||
// 已被预定
|
||||
if (field.sold) {
|
||||
if (checkTimePeriod.sold) {
|
||||
return
|
||||
}
|
||||
const app = this
|
||||
@@ -402,6 +369,7 @@ export default {
|
||||
})
|
||||
return false
|
||||
}
|
||||
// console.log(field)
|
||||
const split = item.timePeriod.split(' - ')
|
||||
const siteTime = field.periodVoList.find(d => d.period === item.timePeriod)
|
||||
// 添加到购物车
|
||||
@@ -412,11 +380,12 @@ export default {
|
||||
fieldId: field.id,
|
||||
fieldName: field.name,
|
||||
price: item.price,
|
||||
halfPrice: item.halfPrice,
|
||||
childrenPrice: item.childrenPrice,
|
||||
adultNum: 1,
|
||||
childrenNum: 0,
|
||||
siteName: merchant.name,
|
||||
isChildren: item.isChildren,
|
||||
isChildren: 2,
|
||||
isHalf: this.isHalf,
|
||||
type: this.type,
|
||||
timePeriod: item.timePeriod,
|
||||
@@ -428,7 +397,7 @@ export default {
|
||||
dateTime: `${this.dateTime}`,
|
||||
comments: `${this.dateTime}(${getWeek(week)})${item.timePeriod}`,
|
||||
})
|
||||
console.log(app.selection);
|
||||
// console.log(app.selection);
|
||||
// console.log('period: ', period);
|
||||
// 是否支持儿童票
|
||||
// console.log('item.isChildren: ', item.isChildren);
|
||||
@@ -448,7 +417,10 @@ export default {
|
||||
},
|
||||
isActive(field, item) {
|
||||
const index = this.selection.find(d => d.key === getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${field.id}`))
|
||||
if (item.sold) {
|
||||
const timePeriod = item.timePeriod
|
||||
const checkTimePeriod = field.periodVoList.find(d => (d.period === timePeriod && d.id === item.id))
|
||||
// console.log('checkTimePeriod', checkTimePeriod, timePeriod)
|
||||
if (checkTimePeriod && checkTimePeriod.sold) {
|
||||
if (item.isHalf === 1) {
|
||||
return 'web-bg-warning'
|
||||
}
|
||||
@@ -467,6 +439,7 @@ export default {
|
||||
uni.navigateTo({
|
||||
url: '/package/booking/confirm',
|
||||
success: (res) => {
|
||||
console.log(this.selection)
|
||||
res.eventChannel.emit('data', this.selection)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user