修复管理师端预约与登录体验
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
const planningApi = require('../../api/planning')
|
||||
const mock = require('../../utils/mock')
|
||||
const dateUtil = require('../../utils/date')
|
||||
|
||||
Page({
|
||||
@@ -9,26 +8,49 @@ Page({
|
||||
selectedArtistId: '',
|
||||
date: dateUtil.formatDate(new Date()),
|
||||
time: '13:00',
|
||||
loadError: '',
|
||||
loading: false
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
id: options.id || '',
|
||||
artists: mock.artists.map((item, index) => ({
|
||||
...item,
|
||||
availableStatus: index === 1 ? 'busy' : index === 2 ? 'full' : 'free',
|
||||
availableText: index === 1 ? '有冲突' : index === 2 ? '已满' : '可接'
|
||||
}))
|
||||
id: options.id || ''
|
||||
})
|
||||
this.loadArtists()
|
||||
},
|
||||
|
||||
async loadArtists() {
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: this.data.date,
|
||||
endDate: this.data.date
|
||||
})
|
||||
const artists = Array.isArray(calendar.artists) ? calendar.artists : []
|
||||
this.setData({
|
||||
artists: artists.map(item => ({
|
||||
...item,
|
||||
availableStatus: 'free',
|
||||
availableText: '可选择'
|
||||
})),
|
||||
selectedArtistId: '',
|
||||
loadError: ''
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
artists: [],
|
||||
selectedArtistId: '',
|
||||
loadError: error.message || '美甲师列表加载失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
selectArtist(event) {
|
||||
this.setData({ selectedArtistId: event.currentTarget.dataset.id })
|
||||
},
|
||||
|
||||
onDateChange(event) {
|
||||
async onDateChange(event) {
|
||||
this.setData({ date: event.detail.value })
|
||||
await this.loadArtists()
|
||||
},
|
||||
|
||||
onTimeChange(event) {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<view class="page no-tab">
|
||||
<view class="list">
|
||||
<view wx:if="{{loadError}}" class="empty card">
|
||||
<text>{{loadError}}</text>
|
||||
<button class="secondary-btn retry-btn" bindtap="loadArtists">重试</button>
|
||||
</view>
|
||||
<view wx:elif="{{artists.length === 0}}" class="empty card">暂无可选美甲师</view>
|
||||
<view wx:for="{{artists}}" wx:key="id" class="card transfer-card {{selectedArtistId == item.id ? 'active' : ''}}" data-id="{{item.id}}" bindtap="selectArtist">
|
||||
<view class="row between">
|
||||
<view class="row">
|
||||
@@ -14,22 +19,22 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card form-card section">
|
||||
<view wx:if="{{!loadError}}" class="card form-card section">
|
||||
<view class="field">
|
||||
<text class="field-label">新日期</text>
|
||||
<text class="field-label required">新日期</text>
|
||||
<picker mode="date" value="{{date}}" bindchange="onDateChange">
|
||||
<view class="field-value">{{date}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">新时间</text>
|
||||
<text class="field-label required">新时间</text>
|
||||
<picker mode="time" value="{{time}}" start="10:00" end="22:00" bindchange="onTimeChange">
|
||||
<view class="field-value">{{time}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="fixed-bottom">
|
||||
<view wx:if="{{!loadError}}" class="fixed-bottom">
|
||||
<button class="primary-btn" loading="{{loading}}" bindtap="submit">确认改派</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
width: 180rpx;
|
||||
min-width: 180rpx;
|
||||
max-width: 180rpx;
|
||||
margin: 24rpx auto 0;
|
||||
}
|
||||
|
||||
.transfer-card.active {
|
||||
outline: 3rpx solid #8fb89a;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user