Files
xinlong-shop-taro/src/pages/reschedule.tsx
赵忠林 f3886664f7 fix(api): 替换所有接口请求的域名为 guilixu-api.websoft.top
- 将获取 STS Token 的接口地址由 paopao-api 改为 guilixu-api
- 更新图片上传接口地址为新的 guilixu-api 域名
- 修改用户推广页面中邀请码链接和二维码接口的域名
- 更改注册页微信登录接口请求的域名为 guilixu-api
2026-06-16 17:15:59 +08:00

159 lines
5.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { useState } from 'react'
import { View, Text, ScrollView, Picker } from '@tarojs/components'
import Taro from '@tarojs/taro'
definePageConfig({
navigationBarTitleText: '改签预约',
})
const BookingReschedulePage: React.FC = () => {
const [orderId, setOrderId] = useState('BK202605120001')
const [oldDate, setOldDate] = useState('2026-05-15')
const [oldTime, setOldTime] = useState('14:00-16:00')
const [newDate, setNewDate] = useState('')
const [newTime, setNewTime] = useState('')
// 可选日期未来7天
const availableDates = []
for (let i = 1; i <= 7; i++) {
const date = new Date()
date.setDate(date.getDate() + i)
const year = date.getFullYear()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
availableDates.push(`${year}-${month}-${day}`)
}
// 可选时段
const availableTimes = ['09:00-11:00', '10:00-12:00', '14:00-16:00', '15:00-17:00']
// 提交改签
const handleSubmit = () => {
if (!newDate) {
Taro.showToast({ title: '请选择新日期', icon: 'none' })
return
}
if (!newTime) {
Taro.showToast({ title: '请选择新时段', icon: 'none' })
return
}
Taro.showModal({
title: '确认改签',
content: `确定将预约从\n${oldDate} ${oldTime}\n改签至\n${newDate} ${newTime}吗?`,
confirmText: '确认改签',
confirmColor: '#0e932e',
success: (res) => {
if (res.confirm) {
Taro.showLoading({ title: '改签中...' })
// 这里应该调用改签API
setTimeout(() => {
Taro.hideLoading()
Taro.showToast({ title: '改签成功', icon: 'success' })
setTimeout(() => {
Taro.navigateBack()
}, 1500)
}, 2000)
}
}
})
}
return (
<View className='min-h-screen bg-gray-50 flex flex-col'>
<ScrollView scrollY className='flex-1'>
{/* 原预约信息 */}
<View className='bg-white mx-3 mt-3 rounded-xl p-4'>
<Text className='text-base font-medium text-gray-800 mb-3 block'></Text>
<View className='bg-gray-50 rounded-lg p-3'>
<View className='flex justify-between items-center mb-2'>
<Text className='text-sm text-gray-500'></Text>
<Text className='text-sm text-gray-800'>{orderId}</Text>
</View>
<View className='flex justify-between items-center mb-2'>
<Text className='text-sm text-gray-500'></Text>
<Text className='text-sm text-gray-800'>{oldDate}</Text>
</View>
<View className='flex justify-between items-center'>
<Text className='text-sm text-gray-500'></Text>
<Text className='text-sm text-gray-800'>{oldTime}</Text>
</View>
</View>
</View>
{/* 选择新日期 */}
<View className='bg-white mx-3 mt-3 rounded-xl p-4'>
<Text className='text-base font-medium text-gray-800 mb-3 block'></Text>
<Picker
mode='selector'
range={availableDates}
onChange={(e) => setNewDate(availableDates[e.detail.value])}
>
<View className='bg-gray-50 rounded-lg p-3 flex justify-between items-center'>
<Text className={`text-sm ${newDate ? 'text-gray-800' : 'text-gray-400'}`}>
{newDate || '请选择日期'}
</Text>
<Text className='text-gray-400'></Text>
</View>
</Picker>
</View>
{/* 选择新时段 */}
<View className='bg-white mx-3 mt-3 rounded-xl p-4'>
<Text className='text-base font-medium text-gray-800 mb-3 block'></Text>
<View className='flex flex-wrap gap-2'>
{availableTimes.map(time => (
<View
key={time}
className={`px-4 py-2 rounded-full border ${
newTime === time
? 'border-orange-500 bg-orange-50'
: 'border-gray-200'
}`}
onClick={() => setNewTime(time)}
>
<Text
className={`text-sm ${
newTime === time ? 'text-orange-500' : 'text-gray-700'
}`}
>
{time}
</Text>
</View>
))}
</View>
</View>
{/* 改签说明 */}
<View className='bg-white mx-3 mt-3 rounded-xl p-4'>
<Text className='text-base font-medium text-gray-800 mb-3 block'></Text>
<View className='text-xs text-gray-500 leading-6'>
<Text className='block'>1. </Text>
<Text className='block'>2. 2</Text>
<Text className='block'>3. </Text>
<Text className='block'>4. </Text>
</View>
</View>
</ScrollView>
{/* 提交按钮 */}
<View className='bg-white p-3 shadow-lg' style={{ paddingBottom: '20px' }}>
<View
className={`text-center py-3 rounded-full ${
newDate && newTime ? 'bg-orange-500' : 'bg-gray-300'
}`}
onClick={newDate && newTime ? handleSubmit : undefined}
>
<Text className='text-white font-bold'></Text>
</View>
</View>
</View>
)
}
export default BookingReschedulePage