修复管理师端预约与登录体验
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
const employeesApi = require('../../api/employees')
|
||||
const mock = require('../../utils/mock')
|
||||
|
||||
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
|
||||
const DEFAULT_EMPLOYEE_PASSWORD = 'Fingertip@123'
|
||||
|
||||
Page({
|
||||
data: {
|
||||
employees: [],
|
||||
loadError: '',
|
||||
createModalVisible: false,
|
||||
creating: false,
|
||||
createForm: {
|
||||
nickname: '',
|
||||
phone: '',
|
||||
account: '',
|
||||
password: '888888',
|
||||
password: DEFAULT_EMPLOYEE_PASSWORD,
|
||||
wechatId: ''
|
||||
}
|
||||
},
|
||||
@@ -20,26 +23,25 @@ Page({
|
||||
},
|
||||
|
||||
async loadEmployees() {
|
||||
const fallback = mock.artists.map((item, index) => ({
|
||||
...item,
|
||||
monthOrders: 32 - index * 5,
|
||||
monthAmount: 5800 - index * 760
|
||||
}))
|
||||
try {
|
||||
const data = await employeesApi.list({ page: 1, size: 50 })
|
||||
const list = data.list || data || []
|
||||
this.setData({
|
||||
loadError: '',
|
||||
employees: list.map((item, index) => ({
|
||||
id: item.userId || item.id,
|
||||
name: item.nickname || item.name || item.artistName || `美甲师${index + 1}`,
|
||||
shortName: (item.nickname || item.name || '师').slice(-1),
|
||||
color: mock.artists[index % mock.artists.length].color,
|
||||
color: EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
|
||||
monthOrders: item.monthOrders || item.orderCount || 0,
|
||||
monthAmount: item.monthAmount || item.turnover || 0
|
||||
}))
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({ employees: fallback })
|
||||
this.setData({
|
||||
employees: [],
|
||||
loadError: error.message || '美甲师列表加载失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -79,7 +81,7 @@ Page({
|
||||
nickname: '',
|
||||
phone: '',
|
||||
account: '',
|
||||
password: '888888',
|
||||
password: DEFAULT_EMPLOYEE_PASSWORD,
|
||||
wechatId: ''
|
||||
}
|
||||
})
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
</view>
|
||||
|
||||
<view class="list">
|
||||
<view wx:if="{{loadError}}" class="empty card">
|
||||
<text>{{loadError}}</text>
|
||||
<button class="secondary-btn retry-btn" bindtap="loadEmployees">重试</button>
|
||||
</view>
|
||||
<view wx:elif="{{employees.length === 0}}" class="empty card">暂无美甲师</view>
|
||||
<view wx:for="{{employees}}" wx:key="id" class="card employee-card" data-id="{{item.id}}" bindtap="openDetail">
|
||||
<view class="employee-left">
|
||||
<view class="avatar" style="background: {{item.color}};">{{item.shortName}}</view>
|
||||
@@ -27,23 +32,23 @@
|
||||
</view>
|
||||
<view class="form-grid">
|
||||
<view class="modal-field">
|
||||
<text>姓名</text>
|
||||
<text class="required-label">姓名</text>
|
||||
<input value="{{createForm.nickname}}" data-field="nickname" bindinput="onCreateInput" placeholder="请输入姓名" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text>手机号</text>
|
||||
<text class="required-label">手机号</text>
|
||||
<input value="{{createForm.phone}}" data-field="phone" bindinput="onCreateInput" type="number" placeholder="请输入手机号" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text>登录账号</text>
|
||||
<text class="required-label">登录账号</text>
|
||||
<input value="{{createForm.account}}" data-field="account" bindinput="onCreateInput" placeholder="请输入账号" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text>初始密码</text>
|
||||
<text class="required-label">初始密码</text>
|
||||
<input value="{{createForm.password}}" data-field="password" bindinput="onCreateInput" password placeholder="请输入密码" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text>微信号</text>
|
||||
<text class="required-label">微信号</text>
|
||||
<input value="{{createForm.wechatId}}" data-field="wechatId" bindinput="onCreateInput" placeholder="请输入微信号" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -65,6 +65,13 @@
|
||||
border-radius: 999rpx;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
width: 180rpx;
|
||||
min-width: 180rpx;
|
||||
max-width: 180rpx;
|
||||
margin: 24rpx auto 0;
|
||||
}
|
||||
|
||||
.modal-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
@@ -102,18 +109,37 @@
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 56rpx;
|
||||
min-width: 56rpx;
|
||||
height: 56rpx;
|
||||
width: 48rpx;
|
||||
min-width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
background: #f2e7da;
|
||||
color: #61554c;
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
line-height: 1;
|
||||
border: 1rpx solid #e4d8ca;
|
||||
background: #fffaf4;
|
||||
color: transparent;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.modal-close::before,
|
||||
.modal-close::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 22rpx;
|
||||
height: 3rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #61554c;
|
||||
}
|
||||
|
||||
.modal-close::before {
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.modal-close::after {
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
|
||||
Reference in New Issue
Block a user