241101
This commit is contained in:
@@ -33,16 +33,16 @@
|
||||
<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 item.fieldList" :key="index2">-->
|
||||
<!-- <view class="field"-->
|
||||
<!-- :class="isActive(field)"-->
|
||||
<!-- @click="onField(field,item)">-->
|
||||
<!-- <text class="field-name">{{ field.fieldName }}</text>-->
|
||||
<!-- <text class="price">{{ item.price }}元</text>-->
|
||||
<!-- </view>-->
|
||||
<!-- </template>-->
|
||||
<!-- </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>
|
||||
<!-- 排版样式备份 -->
|
||||
@@ -78,7 +78,7 @@
|
||||
:endVal="totalPrice"></uv-count-to>
|
||||
</view>
|
||||
<uv-button class="save-btn"
|
||||
:disabled="orderInfo.length == 0"
|
||||
:disabled="!selection.length"
|
||||
:customStyle="{background: 'linear-gradient(to right, #70b915, #008e04)',borderRadius: '0 30px 30px 0',color: '#ffffff', border: 'none', padding: '22px 30px'}"
|
||||
text="下一步" @click="save"></uv-button>
|
||||
</view>
|
||||
@@ -291,11 +291,11 @@ export default {
|
||||
onType(e) {
|
||||
const index = e.currentIndex
|
||||
if (index === 0) {
|
||||
this.type = 0;
|
||||
this.type = 1;
|
||||
this.isHalf = 0;
|
||||
}
|
||||
if (index === 1) {
|
||||
this.type = 1;
|
||||
this.type = 2;
|
||||
this.isHalf = 1;
|
||||
}
|
||||
this.reload()
|
||||
@@ -303,9 +303,9 @@ export default {
|
||||
async getMerchant() {
|
||||
this.merchant = await getThinkSite(this.merchantId)
|
||||
},
|
||||
async getFieldList(){
|
||||
async getFieldList() {
|
||||
if (!this.periodList.length) {
|
||||
uni.showToast({
|
||||
return uni.showToast({
|
||||
title: '暂无可预订场地',
|
||||
icon: 'none'
|
||||
})
|
||||
@@ -315,14 +315,14 @@ export default {
|
||||
const timestamp = dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]).unix()
|
||||
periodVoList.push({
|
||||
timestamp,
|
||||
period: item.timePeriod
|
||||
period: item.timePeriod,
|
||||
id: item.id
|
||||
})
|
||||
})
|
||||
const res = await listThinkFieldWithTimeList({
|
||||
this.fieldList = await listThinkFieldWithTimeList({
|
||||
sid: this.merchantId,
|
||||
periodVoList
|
||||
})
|
||||
console.log(res)
|
||||
},
|
||||
getBookingPeriod() {
|
||||
const {
|
||||
@@ -379,9 +379,9 @@ export default {
|
||||
closeCarInfo() {
|
||||
this.$refs.popup.close()
|
||||
},
|
||||
onField(item, period) {
|
||||
onField(field, item) {
|
||||
// 已被预定
|
||||
if (item.sold) {
|
||||
if (field.sold) {
|
||||
return
|
||||
}
|
||||
const app = this
|
||||
@@ -390,7 +390,7 @@ export default {
|
||||
// const p = this.periodList[i]
|
||||
// 场地
|
||||
// const f = this.fieldList[i2]
|
||||
const key = getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${item.fieldId}`)
|
||||
const key = getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${field.id}`)
|
||||
const index = app.selection.findIndex(d => d.key === key)
|
||||
if (index >= 0) {
|
||||
app.selection.splice(index, 1)
|
||||
@@ -402,80 +402,52 @@ export default {
|
||||
})
|
||||
return false
|
||||
}
|
||||
// 计算订单总金额
|
||||
// let totalPrice = 0
|
||||
// app.selection.map(d => {
|
||||
// console.log(d);
|
||||
// totalPrice = totalPrice + d.totalPrice
|
||||
// })
|
||||
const split = item.timePeriod.split('-')
|
||||
// console.log('aaaaaaaaa',{
|
||||
// key,
|
||||
// merchantId: this.merchantId,
|
||||
// merchantCode: this.merchantCode,
|
||||
// fieldId: item.fieldId,
|
||||
// fieldName: item.fieldName,
|
||||
// price: item.price,
|
||||
// merchantName: this.merchantName,
|
||||
// isChildren: item.isChildren,
|
||||
// isHalf: this.type,
|
||||
// timePeriod: item.timePeriod,
|
||||
// periodId: item.periodId,
|
||||
// startTime: `${split[0].trim()}:00`,
|
||||
// endTime: `${split[1].trim()}:00`,
|
||||
// orderCode: key,
|
||||
// dateTime: `${this.dateTime}`,
|
||||
// comments: `${this.dateTime} (${getWeek(this.week)}) ${item.timePeriod}`,
|
||||
// });
|
||||
const split = item.timePeriod.split(' - ')
|
||||
const siteTime = field.periodVoList.find(d => d.period === item.timePeriod)
|
||||
// 添加到购物车
|
||||
const week = parseInt(this.week) === 7 ? 0 : this.week
|
||||
app.selection.push({
|
||||
key,
|
||||
merchantId: this.merchantId,
|
||||
merchantCode: merchant.merchantCode,
|
||||
fieldId: item.fieldId,
|
||||
fieldName: item.fieldName,
|
||||
sid: this.merchantId,
|
||||
fieldId: field.id,
|
||||
fieldName: field.name,
|
||||
price: item.price,
|
||||
childrenPrice: period.childrenPrice,
|
||||
childrenPrice: item.childrenPrice,
|
||||
adultNum: 1,
|
||||
childrenNum: 0,
|
||||
merchantName: merchant.merchantName,
|
||||
siteName: merchant.name,
|
||||
isChildren: item.isChildren,
|
||||
isHalf: this.type,
|
||||
isHalf: this.isHalf,
|
||||
type: this.type,
|
||||
timePeriod: item.timePeriod,
|
||||
periodId: item.periodId,
|
||||
startTime: `${split[0].trim()}:00`,
|
||||
startTime: dayjs(`${this.dateTime} ${split[0].trim()}`).unix(),
|
||||
endTime: `${split[1].trim()}:00`,
|
||||
orderCode: key,
|
||||
siteTimeId: siteTime.id,
|
||||
dateTime: `${this.dateTime}`,
|
||||
comments: `${this.dateTime} (${getWeek(this.week)}) ${item.timePeriod}`,
|
||||
comments: `${this.dateTime}(${getWeek(week)})${item.timePeriod}`,
|
||||
})
|
||||
console.log(app.selection);
|
||||
console.log('period: ', period);
|
||||
// console.log('period: ', period);
|
||||
// 是否支持儿童票
|
||||
console.log('item.isChildren: ', item.isChildren);
|
||||
if (item.isChildren === 1) {
|
||||
console.log('item.isChildren2: ', item.isChildren);
|
||||
carStore.childrenPrice = period.childrenPrice
|
||||
} else {
|
||||
carStore.childrenPrice = 0
|
||||
}
|
||||
carStore.orderInfo = app.selection
|
||||
carStore.carNum = app.selection.length
|
||||
carStore.totalPrice = totalPrice
|
||||
carStore.payPrice = totalPrice
|
||||
carStore.setPeriod(period)
|
||||
// console.log('item.isChildren: ', item.isChildren);
|
||||
// if (item.isChildren === 1) {
|
||||
// console.log('item.isChildren2: ', item.isChildren);
|
||||
// carStore.childrenPrice = period.childrenPrice
|
||||
// } else {
|
||||
// carStore.childrenPrice = 0
|
||||
// }
|
||||
// carStore.orderInfo = app.selection
|
||||
// carStore.carNum = app.selection.length
|
||||
// carStore.totalPrice = totalPrice
|
||||
// carStore.payPrice = totalPrice
|
||||
// carStore.setPeriod(period)
|
||||
|
||||
}
|
||||
},
|
||||
getStratTime(value) {
|
||||
const split = value.split('-')
|
||||
const timeText = split[0].replace(' ', '')
|
||||
const startTime = new Date(`${this.dateTime} ${timeText}:00`).getTime()
|
||||
return startTime / 1000 || 0;
|
||||
},
|
||||
|
||||
isActive(item) {
|
||||
const index = this.selection.find(d => d.key === getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${item.fieldId}`))
|
||||
isActive(field, item) {
|
||||
const index = this.selection.find(d => d.key === getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${field.id}`))
|
||||
if (item.sold) {
|
||||
if (item.isHalf === 1) {
|
||||
return 'web-bg-warning'
|
||||
@@ -486,30 +458,17 @@ export default {
|
||||
return 'active web-bg-success'
|
||||
}
|
||||
},
|
||||
|
||||
// isActive(text,item) {
|
||||
// const index = this.selection.find(d => d.key == getKey(text))
|
||||
// if(item.sold){
|
||||
// if(item.isHalf == 1){
|
||||
// return 'web-bg-warning'
|
||||
// }
|
||||
// return 'web-bg-info'
|
||||
// }
|
||||
// if (index) {
|
||||
// return 'active web-bg-success'
|
||||
// }
|
||||
// },
|
||||
remove(item) {
|
||||
const index = this.selection.findIndex(d => d.key === item.key)
|
||||
this.selection.splice(index, 1)
|
||||
carStore.orderInfo = this.selection
|
||||
},
|
||||
save() {
|
||||
const {
|
||||
selection
|
||||
} = this
|
||||
uni.$uv.route({
|
||||
url: '/package/booking/confirm'
|
||||
uni.navigateTo({
|
||||
url: '/package/booking/confirm',
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('data', this.selection)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user