From cd242767a64fcb886f4998ebd7abead45045f610 Mon Sep 17 00:00:00 2001 From: que01 Date: Sat, 19 Sep 2026 11:42:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=8F=96=E6=B6=88=E9=A2=84=E7=BA=A6=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/miniapp/pages/bookings/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/miniapp/pages/bookings/index.js b/apps/miniapp/pages/bookings/index.js index e28b286..7727b9e 100644 --- a/apps/miniapp/pages/bookings/index.js +++ b/apps/miniapp/pages/bookings/index.js @@ -1,2 +1,2 @@ const API=getApp().globalData.apiBaseUrl; -Page({data:{loading:true,bookings:[]},onLoad(){this.load()},onShow(){this.load()},load(){const token=wx.getStorageSync('customerToken');if(!token){this.setData({loading:false});return}wx.request({url:API+'/customer/bookings',header:{Authorization:'Bearer '+token},success:r=>this.setData({bookings:r.data,loading:false}),fail:()=>this.setData({loading:false})})},cancel(e){const id=e.currentTarget.dataset.id;wx.showModal({title:'取消预约',content:'确定取消这笔预约吗?',success:r=>{if(!r.confirm)return;wx.request({url:API+'/customer/bookings/'+id+'/cancel',method:'POST',header:{Authorization:'Bearer '+wx.getStorageSync('customerToken')},success:()=>this.load()})}})}}); +Page({data:{loading:true,bookings:[]},onLoad(){this.load()},onShow(){this.load()},load(){const token=wx.getStorageSync('customerToken');if(!token){this.setData({loading:false});return}wx.request({url:API+'/customer/bookings',header:{Authorization:'Bearer '+token},success:r=>this.setData({bookings:r.data,loading:false}),fail:()=>this.setData({loading:false})})},cancel(e){const id=e.currentTarget.dataset.id;wx.showModal({title:'取消预约',content:'确定取消这笔预约吗?',success:r=>{if(!r.confirm)return;wx.request({url:API+'/customer/bookings/'+id+'/cancel',method:'POST',header:{Authorization:'Bearer '+wx.getStorageSync('customerToken'),'content-type':'application/json'},data:{},success:res=>{if(res.statusCode<300)this.load();else wx.showToast({title:res.data?.error?.message||'取消失败',icon:'none'})},fail:err=>wx.showToast({title:err.errMsg||'网络请求失败',icon:'none'})})}})}});