This commit is contained in:
2025-03-20 10:58:18 +08:00
parent 4d21314fc6
commit ce0ab24c57
24 changed files with 791 additions and 138 deletions
+80 -10
View File
@@ -2,7 +2,8 @@
<view class="container">
<uv-sticky bg-color="white">
<view class="merchant-name">{{ merchant.name }}</view>
<uv-tabs :list="next7day" :itemStyle="{height: '58px'}" :activeStyle="{ color: '#2ba91c'}" lineColor="#2ba91c"
<uv-tabs :current="activeIndex" :list="next7day" :itemStyle="{height: '58px'}" :activeStyle="{ color: '#2ba91c'}"
lineColor="#2ba91c"
:inactiveStyle="{ color: '#808080' }" @change="onDateTime"></uv-tabs>
</uv-sticky>
<template v-if="merchantId !== 37">
@@ -178,7 +179,9 @@ export default {
disabled: false,
// 购物车信息
showCarInfo: false,
timeList: []
timeList: [],
timeListOrigin: [],
activeIndex: 0
}
},
onLoad(option) {
@@ -200,7 +203,7 @@ export default {
else totalPrice += d.price
})
carStore.totalPrice = totalPrice
console.log('totalPrice: ', totalPrice);
// console.log('totalPrice: ', totalPrice);
return totalPrice;
},
carNum() {
@@ -260,7 +263,7 @@ export default {
setDateList() {
this.next7day = []
let day = 7
if (this.merchantId === 37) day = 7
if (this.merchantId === 37) day = 1
for (let i = 0; i < day; i++) {
const day = dayjs().add(i, 'day')
this.next7day.push({
@@ -275,25 +278,92 @@ export default {
},
async getTimeList() {
this.timeList = await listThinkSiteTime({sid: this.merchantId})
// console.log(this.week)
// console.log(this.dateTime)
this.timeListOrigin = JSON.parse(JSON.stringify(this.timeList))
this.timeList = this.timeList.filter(item => {
return JSON.parse(item.week).map(Number).includes(parseInt(this.week))
})
console.log(this.timeList)
this.makeTimeList()
},
makeTimeList() {
this.periodList = []
this.timeList.forEach(item => {
this.timeListOrigin.forEach(item => {
const weekList = JSON.parse(item.week)
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)
if ((dayjs().isBefore(dayjs(today + ' 21:00:00')) || dayjs(this.dateTime).isAfter(dayjs())) && weekList.includes(this.week)) this.periodList.push(item)
} else {
// console.log(this.dateTime + ' ' + item.timePeriod.split(' - ')[0])
// console.log(dayjs().isBefore(dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0])))
if (weekList.includes(this.week) && dayjs().isBefore(dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]))) this.periodList.push(item)
}
})
// console.log(this.periodList)
const month = dayjs().format('YYYY-MM')
this.periodList.map(item => {
if (item.prices && item.prices.includes('{')) {
const dataList = JSON.parse(item.prices)[month]
if (dataList) {
const price = dataList[dayjs(this.dateTime).format('D') - 1]
if (price && price !== '') {
item.price = price
}
}
}
if (item.halfPrices && item.halfPrices.includes('{')) {
const dataList = JSON.parse(item.halfPrices)[month]
if (dataList) {
const price = dataList[dayjs(this.dateTime).format('D') - 1]
if (price && price !== '') {
item.halfPrices = price
}
}
}
return item
})
},
onDisabled() {
this.disabled = !this.disabled;
},
onDateTime(e) {
this.periodList = []
if (![37, 44, 32].includes(this.merchantId)) {
const date = dayjs().format('d')
const hour = dayjs().format('H')
const clickedDate = dayjs(e.dateTime).format('d')
if ([0, 5, 6].includes(parseInt(clickedDate))) {
if ([1, 2, 3].includes(parseInt(date))) {
return uni.showModal({
showCancel: false,
title: '周末场地需要周四17点后才能预定。',
})
} else if (parseInt(date) === 4) {
if (parseInt(hour) < 17) {
return uni.showModal({
showCancel: false,
title: '周末场地需要周四17点后才能预定。',
})
}
} else if ([0, 5, 6].includes(parseInt(date))) {
const diff = dayjs(e.dateTime).diff(dayjs(), 'day')
if (diff > 2) {
return uni.showModal({
showCancel: false,
title: '周末场地需要周四17点后才能预定。',
})
}
}
}
if (hour < 8 || hour === 23) {
return uni.showModal({
showCancel: false,
title: '场地预定时间为:8:00-23:00。',
})
}
}
this.activeIndex = e.index
this.week = e.week
this.dateTime = e.dateTime
this.makeTimeList()
@@ -348,7 +418,7 @@ export default {
const checkTimePeriod = field.periodVoList.find(d => (d.period === timePeriod && d.id === item.id))
// console.log('here', field, item)
// 已被预定
if (checkTimePeriod.sold) {
if (checkTimePeriod.sold || checkTimePeriod.took) {
return
}
const app = this
@@ -420,7 +490,7 @@ export default {
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 (checkTimePeriod && (checkTimePeriod.sold || checkTimePeriod.took)) {
if (item.isHalf === 1) {
return 'web-bg-warning'
}
@@ -439,7 +509,7 @@ export default {
uni.navigateTo({
url: '/package/booking/confirm',
success: (res) => {
console.log(this.selection)
// console.log(this.selection)
res.eventChannel.emit('data', this.selection)
}
})
+5 -2
View File
@@ -262,8 +262,8 @@ export default {
this.userInfo = await userStore.fetchUserInfo();
eventChannel.on('data', async (data) => {
_this.list = data
if (data[0].isHalf === 1) _this.payPrice = data.reduce((a, b) => a + b.halfPrice, 0)
else _this.payPrice = data.reduce((a, b) => a + b.price, 0)
if (data[0].isHalf === 1) _this.payPrice = data.reduce((a, b) => a + parseFloat(b.halfPrice), 0)
else _this.payPrice = data.reduce((a, b) => a + parseFloat(b.price), 0)
_this.originPrice = JSON.parse(JSON.stringify(_this.payPrice))
const thinkOrderInfos = []
@@ -294,6 +294,7 @@ export default {
code: null,
payType: 1,
thinkOrderInfos,
day: dayjs(item.dateTime).format('D') - 1,
startTime: thinkOrderInfos.map(item => item.startTime).join()
}
})
@@ -558,10 +559,12 @@ export default {
async onPayType(index) {
// app.payType = index;
this.form.payType = index;
console.log(this.form.payType)
this.form.vid = null
this.form.code = null
this.reducePrice = 0
if (this.form.sid !== 37) this.payPrice = this.originPrice
else this.reCalSwimAmount({value: this.peopleNum})
if (this.form.payType === 2) this.makeUserVipCardList()
if (this.form.payType === 5) this.makeUserCardList()
},
+9 -1
View File
@@ -85,7 +85,7 @@
<uv-popup ref="protocolPopup" mode="center" round="15" :closeOnClickOverlay="true" :safe-area-inset-bottom="false">
<view v-if="protocol">
<view class="p-30" style="width: 80vw; max-height: 80vh; overflow-y: scroll">
<uv-parse :content="protocol.content"></uv-parse>
<uv-parse :content="protocol.content" :preview-img="false"></uv-parse>
</view>
<view class="p-30">
<uv-button type="primary" shape="circle" :disabled="countDown > 0" @click="save">{{
@@ -107,6 +107,7 @@ import request from "@/utils/request";
import X2js from 'x2js';
import {getArticle, pageArticle} from "@/api/cms/article";
import coordtransform from "coordtransform";
import dayjs from "dayjs";
const carStore = useCarStore();
@@ -151,6 +152,13 @@ export default {
}
},
openProtocol() {
const hour = dayjs().format('H')
if (hour < 8 || hour === 23) {
return uni.showModal({
showCancel: false,
title: '场地预定时间为:8:00-23:00。',
})
}
if (this.timer) {
clearInterval(this.timer)
this.timer = null
+9 -2
View File
@@ -305,14 +305,21 @@ export default {
});
setTimeout(function () {
app.disabled = false;
uni.redirectTo({
url: '/package/user/card'
uni.setStorageSync('orderType', JSON.stringify({
label: '会员卡订单',
value: 1
}))
uni.switchTab({
url: '/pages/order'
});
}, 500);
},
fail: function (err) {
console.log('支付失败', err);
app.disabled = false;
uni.switchTab({
url: '/pages/order'
});
}
});
uni.hideLoading();
+45 -16
View File
@@ -1,5 +1,30 @@
<template>
<view class="container">
<uni-card :border="false" :is-shadow="false" v-if="needExpress">
<uv-cell v-if="address && address.name"
:title="`${address.name} &nbsp; ${address.phone}`"
:label="`${address.address}`"
icon="map"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="openAddressList"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
<uv-cell v-else
title="点击添加地址"
icon="map"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="openAddressList"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
</uni-card>
<uni-card :border="false" :padding="10">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff', marginBottom: '20px'}" :border="false">
<uv-cell v-for="(cart, index) in carts" :cellStyle="{padding: '12px 0'}" :border="false" :index="index">
@@ -216,6 +241,7 @@ import UniCard from "@/uni_modules/uni-card/components/uni-card/uni-card.vue";
import UvGap from "@/uni_modules/uv-gap/components/uv-gap/uv-gap.vue";
import {addThinkGoodsOrder} from "@/api/think/thinkGoodsOrder";
import {getThinkUsers, thinkUserInfo} from "@/api/think/thinkUsers";
import {pageThinkUsersAddress} from "@/api/think/thinkUsersAddress";
const mpStore = useMpStore();
const userStore = useUserStore();
@@ -263,6 +289,7 @@ export default {
payPassword: '',
canPointPay: false,
thinkUserInfo: {},
needExpress: false
};
},
onLoad(where) {
@@ -299,18 +326,21 @@ export default {
this.canPointPay = true
this.totalPoint += parseInt(item.goods.maxIntegral) * item.cartNum
}
if (item.goods.isFh === 1) this.needExpress = true
return item
})
this.totalPrice = app.carts.reduce((a, b) => a + b.price * b.cartNum, 0)
}
})
UserAddressApi.pageUserAddress({
userId: uni.getStorageSync('user_id')
this.getUserAddress()
},
getUserAddress(){
pageThinkUsersAddress({
uid: uni.getStorageSync('uid')
}).then((res) => {
app.addressList = res.list;
this.addressList = res.list;
const arr = res.list.filter((d) => d.isDefault === true);
app.address = arr[0];
this.address = arr[0];
});
},
onDisabled() {
@@ -347,13 +377,9 @@ export default {
})
this.payType = index;
},
openAddressList() {
if (this.deliveryType === 0) {
this.$refs.userAddressForm.open('center');
}
if (this.deliveryType === 1) {
this.$refs.shopAddressForm.open('center');
}
async openAddressList() {
this.getUserAddress()
this.$refs.userAddressForm.open('center');
},
// 弹出登录提示框
openLogin() {
@@ -397,7 +423,10 @@ export default {
},
save() {
const app = this;
if (this.needExpress && !this.address.id) return uni.showToast({
title: '请选择收货地址',
icon: 'none'
})
if (!this.disabled) {
uni.showToast({
title: '请先阅读并同意服务协议',
@@ -421,9 +450,9 @@ export default {
})
})
addThinkGoodsOrder({
name: '',
phone: '',
address: '',
name: this.address ? this.address.name : '' ,
phone: this.address ? this.address.phone : '',
address: this.address ? `${this.address.region}${this.address.address}` : '',
totalPrice: this.totalPrice,
num: 1,
payPrice: this.totalPrice,
+8 -2
View File
@@ -36,7 +36,14 @@ const info = ref({})
const expired = ref(false)
const getInfo = async (id) => {
info.value = await getThinkOrder(id)
if (dayjs().isAfter(dayjs(info.value.startTime * 1000))) expired.value = true
const date = dayjs(info.value.startTime * 1000).format('YYYY-MM-DD')
console.log(dayjs().isAfter(dayjs(`${date} 21:30:00`)))
if (info.value.sid === 37) {
if (dayjs().isAfter(dayjs(`${date} 21:30:00`))) expired.value = true
} else {
if (dayjs().isAfter(dayjs(info.value.startTime * 1000))) expired.value = true
}
console.log(expired.value)
}
const userStore = useUserStore();
@@ -63,7 +70,6 @@ const checkAuth = async () => {
checkAuth()
const disabled = ref(false)
const doCheck = async () => {
+14 -8
View File
@@ -4,7 +4,7 @@
<!-- <uv-image :src="`${IMG_URL}${form.qrcode}`" width="200" height="200"/>-->
<text class="text-25 mb-20 text-gray">{{ countDown }}秒后自动刷新</text>
<uv-qrcode size="300px" :value="form.qrcode" v-if="form.qrcode" @click="getOrder"/>
<text class="web-text-secondary">核销码(每120秒刷新,点击二维码手动刷新)</text>
<text class="web-text-secondary">核销码(每30秒刷新,点击二维码手动刷新)</text>
</view>
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
@@ -39,9 +39,8 @@
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<uv-cell :title="`姓名`" :value="`${form.name}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`手机号码`" :value="`${form.phone}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`订单号`" :value="`${form.id}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`订单编号`" :value="`${form.orderNum}`" :cellStyle="{ padding: '8px' }"
" />
<!-- <uv-cell :title="`订单号`" :value="`${form.id}`" :cellStyle="{ padding: '8px' }"/>-->
<uv-cell :title="`订单编号`" :value="`${form.orderNum}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<view v-if="form.payStatus === 2">
@@ -143,7 +142,7 @@ export default {
colorIndex: 0,
activeColor: '#108001',
styleType: 'text',
countDown: 120,
countDown: 30,
interval: null
};
},
@@ -151,8 +150,7 @@ export default {
this.orderId = option.id;
// 判断是否登录
this.openLogin();
// 加载数据
this.reload();
},
onShow() {
// 判断是否登录
@@ -202,11 +200,13 @@ export default {
this.$refs.login.open('bottom');
return false;
}
// 加载数据
this.reload();
},
async getOrder() {
const app = this
if (this.interval) clearInterval(this.interval);
this.countDown = 120
this.countDown = 30
OrderApi.getThinkOrder(this.orderId).then((data) => {
app.form = data;
// 页面标题
@@ -257,6 +257,12 @@ export default {
})
}
},
onHide() {
if (this.interval) clearInterval(this.interval);
},
onUnload() {
if (this.interval) clearInterval(this.interval);
}
};
</script>
-32
View File
@@ -135,38 +135,6 @@ export default {
}
],
regions,
dataTree: [{
text: "一年级",
value: "1-0",
children: [{
text: "1.1班",
value: "1-1"
},
{
text: "1.2班",
value: "1-2"
}
]
},
{
text: "二年级",
value: "2-0",
children: [{
text: "2.1班",
value: "2-1"
},
{
text: "2.2班",
value: "2-2"
}
]
},
{
text: "三年级",
value: "3-0",
disable: true
}
],
rules: {
// 对name字段进行必填验证
name: {
+46 -6
View File
@@ -7,10 +7,13 @@
:style="{ background: `url(https://oss.wsdns.cn/20240920/5e3327e1ad97472e942c824ab1776f52.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90) no-repeat center center`, backgroundSize: '100%', opacity: '0.85' }">
<view class="content web-cell web-cell-align-top">
<view class="card-info web-cell-content">
<view class="title-bar">
<view class="web-text-heading" style="color: #ffffff; font-size: 17px; font-weight: 600">{{
form.name
}}
<view class="title-bar w-100p">
<view class="flex justify-between items-center w-90p">
<view class="web-text-heading" style="color: #ffffff; font-size: 17px; font-weight: 600">{{
form.name
}}
</view>
<uv-icon v-if="(form.type === 1 || form.type === 3) && form.sid.includes('37')" @click="doShowCode" size="60rpx" name="https://oss.wsdns.cn/20250108/80f2256ffd2a4b0ca09d18c44ab37a41.png"/>
</view>
<view class="desc" style="font-size: 14px">{{ cardType[form.type] }}</view>
<view class="mt-20" v-if="form.expireTime">
@@ -30,6 +33,14 @@
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
<view class="card m-20" v-if="showCode && (form.type === 1 || form.type === 3) && form.sid.includes('37')">
<view class="qrcode">
<text class="text-25 mb-20 text-gray">{{ countDown }}秒后自动刷新</text>
<uv-qrcode size="300px" :value="code" v-if="code" @click="getCode"/>
<text class="web-text-secondary">会员码(每30秒刷新,点击二维码手动刷新)</text>
</view>
</view>
<uni-card :border="false" :is-shadow="false" :padding="'12px 0'">
<view class="money-bar web-cell">
<view class="money-item web-cell-content">
@@ -112,7 +123,7 @@
</template>
<script>
import {getThinkUsersVip} from "@/api/think/thinkUsersVip";
import {getThinkUsersVip, thinkUsersVipCode} from "@/api/think/thinkUsersVip";
import dayjs from "dayjs";
const cardType = ['', '年卡', '次卡', '月卡', '会员VIP卡', '充值卡'];
@@ -129,7 +140,11 @@ export default {
cardType,
payType: 1,
isLogin: false,
disabled: false
disabled: false,
code: '',
countDown: 30,
interval: null,
showCode: false,
};
},
onLoad(option) {
@@ -145,6 +160,25 @@ export default {
},
methods: {
dayjs,
doShowCode() {
this.showCode = true
this.getCode()
},
setCountDown() {
this.interval = setInterval(() => {
if (this.countDown > 0) {
this.countDown--
} else {
clearInterval(this.interval)
this.getCode()
}
}, 1000)
},
async getCode() {
this.code = await thinkUsersVipCode(this.id)
this.countDown = 30
this.setCountDown()
},
async getInfo() {
this.form = await getThinkUsersVip(this.id)
},
@@ -176,6 +210,12 @@ export default {
return false;
}
},
},
onHide() {
if (this.interval) clearInterval(this.interval);
},
onUnload() {
if (this.interval) clearInterval(this.interval);
}
};
</script>
+1 -3
View File
@@ -1,8 +1,6 @@
<template>
<view>
<!-- <view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor" inActiveColor="#808080" @clickItem="onClickItem" />
</view> -->
<view class="card-list">
<block v-if="!hideTools || cardList.length > 0">
<view
+3 -7
View File
@@ -94,7 +94,6 @@
fields: {},
logo: '',
bookingUser: {},
server: [],
order: [],
}
},
@@ -120,12 +119,6 @@
app.isLogin = false
app.form = {}
}
// 菜单数据
MpMenuApi.listMpMenu({}).then(res => {
app.server = res.filter(d => d.type == 0)
app.order = res.filter(d => d.type == 1)
})
},
navTo(item) {
if (!this.isLogin) {
@@ -171,6 +164,9 @@
title: '保存成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
})
}
}