修复管理师端预约与登录体验
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
const planningApi = require('../../api/planning')
|
||||
const mock = require('../../utils/mock')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
id: '',
|
||||
appointment: {},
|
||||
avatarText: '',
|
||||
timeText: ''
|
||||
timeText: '',
|
||||
loadError: ''
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
@@ -19,8 +19,12 @@ Page({
|
||||
const appointment = await planningApi.appointment(this.data.id)
|
||||
this.applyAppointment(appointment)
|
||||
} catch (error) {
|
||||
const demo = mock.buildCalendar(new Date()).appointments[0]
|
||||
this.applyAppointment(demo)
|
||||
this.setData({
|
||||
appointment: {},
|
||||
avatarText: '',
|
||||
timeText: '',
|
||||
loadError: error.message || '预约详情加载失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -28,7 +32,8 @@ Page({
|
||||
this.setData({
|
||||
appointment,
|
||||
avatarText: String(appointment.customerName || '客').slice(0, 1),
|
||||
timeText: `${(appointment.startTime || '').slice(0, 16)} - ${(appointment.endTime || '').slice(11, 16)}`
|
||||
timeText: `${(appointment.startTime || '').slice(0, 16)} - ${(appointment.endTime || '').slice(11, 16)}`,
|
||||
loadError: ''
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card detail-card">
|
||||
<view wx:if="{{loadError}}" class="empty card detail-error">
|
||||
<text>{{loadError}}</text>
|
||||
<button class="secondary-btn retry-btn" bindtap="loadDetail">重试</button>
|
||||
</view>
|
||||
|
||||
<view wx:else class="card detail-card">
|
||||
<view class="detail-head">
|
||||
<view class="detail-person">
|
||||
<view class="avatar">{{avatarText}}</view>
|
||||
@@ -33,12 +38,12 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section">
|
||||
<view wx:if="{{!loadError}}" class="section">
|
||||
<view class="section-title">备注</view>
|
||||
<view class="card note-card">{{appointment.remark || '暂无备注'}}</view>
|
||||
</view>
|
||||
|
||||
<view class="fixed-bottom action-row">
|
||||
<view wx:if="{{!loadError}}" class="fixed-bottom action-row">
|
||||
<button class="secondary-btn" bindtap="confirm">确认</button>
|
||||
<button class="primary-btn" bindtap="complete">完成</button>
|
||||
<button class="danger-btn" bindtap="cancel">取消</button>
|
||||
|
||||
@@ -2,6 +2,17 @@
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.detail-error {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
width: 180rpx;
|
||||
min-width: 180rpx;
|
||||
max-width: 180rpx;
|
||||
margin: 24rpx auto 0;
|
||||
}
|
||||
|
||||
.detail-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user