From 5ab8c34a787193917976f4e5d46f8ed16555b687 Mon Sep 17 00:00:00 2001 From: que01 Date: Sat, 19 Sep 2026 12:09:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E9=A1=B5=E8=84=9A=E6=9C=AC=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/miniapp/pages/booking/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/miniapp/pages/booking/index.js b/apps/miniapp/pages/booking/index.js index f0a7002..9d21314 100644 --- a/apps/miniapp/pages/booking/index.js +++ b/apps/miniapp/pages/booking/index.js @@ -12,7 +12,17 @@ Page({ if (!form.customerName || !form.wechatId) return wx.showToast({ title: '请填写称呼和联系方式', icon: 'none' }); if (this.data.fulfillment === 'delivery' && !form.deliveryAddress) return wx.showToast({ title: '请填写配送地址', icon: 'none' }); this.setData({ submitting: true }); - const send = () => customerRequest('/customer/bookings', { method: 'POST', data: { requestType: 'package', customerName: form.customerName, wechatId: form.wechatId, contactPreference: 'wechat', fulfillmentType: this.data.fulfillment, deliveryAddress: form.deliveryAddress, requestedTime: form.requestedTime, note: form.note, items: [{ serviceId: this.data.serviceId, quantity: this.data.quantity }] }).then(() => { this.setData({ submitting: false }); wx.showToast({ title: '预约已提交' }); setTimeout(() => wx.navigateTo({ url: '/pages/bookings/index' }), 500); }).catch((error) => { this.setData({ submitting: false }); wx.showToast({ title: error.message || '提交失败', icon: 'none' }); }); + const send = () => customerRequest('/customer/bookings', { + method: 'POST', + data: { requestType: 'package', customerName: form.customerName, wechatId: form.wechatId, contactPreference: 'wechat', fulfillmentType: this.data.fulfillment, deliveryAddress: form.deliveryAddress, requestedTime: form.requestedTime, note: form.note, items: [{ serviceId: this.data.serviceId, quantity: this.data.quantity }] }, + }).then(() => { + this.setData({ submitting: false }); + wx.showToast({ title: '预约已提交' }); + setTimeout(() => wx.navigateTo({ url: '/pages/bookings/index' }), 500); + }).catch((error) => { + this.setData({ submitting: false }); + wx.showToast({ title: error.message || '提交失败', icon: 'none' }); + }); const token = wx.getStorageSync('customerToken'); if (token) return send(); wx.login({ success: (login) => request('/customer/session/wechat', { method: 'POST', data: { code: login.code } }).then((result) => { wx.setStorageSync('customerToken', result.token); send(); }).catch((error) => { this.setData({ submitting: false }); wx.showToast({ title: error.message || '微信登录失败', icon: 'none' }); }), fail: (error) => { this.setData({ submitting: false }); wx.showToast({ title: error.errMsg || '微信登录失败', icon: 'none' }); } });