完善下单逻辑及其ui展示,修复支付倒计时显示错误bug
This commit is contained in:
@@ -149,6 +149,13 @@ async function loadData() {
|
||||
bookingDays.value = getBookingDayOptions()
|
||||
bookingSlots.value = getBookingTimeSlots()
|
||||
services.value = await fetchHomeServiceCatalog()
|
||||
if (services.value.length > 0) {
|
||||
selectService(services.value[0].id, services.value[0].name)
|
||||
return
|
||||
}
|
||||
selectedServiceId.value = ''
|
||||
form.serviceId = ''
|
||||
form.serviceName = ''
|
||||
}
|
||||
|
||||
function selectService(serviceId: string, serviceName: string) {
|
||||
@@ -192,6 +199,10 @@ function selectSlot(slotId: string, available: boolean) {
|
||||
}
|
||||
|
||||
async function submitApplication() {
|
||||
if (form.serviceId == '' || form.serviceName == '') {
|
||||
uni.showToast({ title: '当前没有可预约的服务项目', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (form.applicantName == '' || form.elderName == '' || form.phone == '' || form.address == '' || form.preferredTime == '') {
|
||||
uni.showToast({ title: '请补全申请信息', icon: 'none' })
|
||||
return
|
||||
@@ -200,6 +211,10 @@ async function submitApplication() {
|
||||
const parsedAge = parseInt(ageText.value)
|
||||
form.age = isNaN(parsedAge) ? 0 : parsedAge
|
||||
const created = await createHomeServiceApplication(form)
|
||||
if (created == null) {
|
||||
uni.showToast({ title: '申请提交失败,请检查登录和预约信息', icon: 'none' })
|
||||
return
|
||||
}
|
||||
uni.showToast({ title: '申请已提交', icon: 'success' })
|
||||
uni.navigateTo({ url: '/pages/mall/consumer/home-service/order-detail?id=' + created.id })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user