完善管理师预约项目与美甲师创建

This commit is contained in:
2026-06-24 20:54:41 +08:00
parent 03c972d90c
commit eda109cb62
28 changed files with 911 additions and 32 deletions
+78 -2
View File
@@ -3,7 +3,16 @@ const mock = require('../../utils/mock')
Page({
data: {
employees: []
employees: [],
createModalVisible: false,
creating: false,
createForm: {
nickname: '',
phone: '',
account: '',
password: '888888',
wechatId: ''
}
},
onLoad() {
@@ -39,6 +48,73 @@ Page({
},
addEmployee() {
wx.showToast({ title: '员工创建沿用后台账号', icon: 'none' })
this.setData({ createModalVisible: true })
},
closeCreateModal() {
if (this.data.creating) {
return
}
this.setData({ createModalVisible: false })
},
stopTap() {
},
onCreateInput(event) {
const field = event.currentTarget.dataset.field
const value = event.detail.value
const updates = {
[`createForm.${field}`]: value
}
if (field === 'phone' && !this.data.createForm.account) {
updates['createForm.account'] = value
}
this.setData(updates)
},
resetCreateForm() {
this.setData({
createForm: {
nickname: '',
phone: '',
account: '',
password: '888888',
wechatId: ''
}
})
},
async submitEmployee() {
const form = this.data.createForm
const nickname = String(form.nickname || '').trim()
const phone = String(form.phone || '').trim()
const account = String(form.account || '').trim()
const password = String(form.password || '').trim()
const wechatId = String(form.wechatId || '').trim()
if (!nickname || !phone || !account || !password || !wechatId) {
wx.showToast({ title: '请补全美甲师信息', icon: 'none' })
return
}
this.setData({ creating: true })
try {
await employeesApi.createUser({
nickname,
phone,
contactPhone: phone,
account,
password,
wechatId,
type: 3
})
wx.showToast({ title: '美甲师已新增', icon: 'success' })
this.resetCreateForm()
this.setData({ createModalVisible: false })
await this.loadEmployees()
} catch (error) {
wx.showToast({ title: error.message || '新增失败', icon: 'none' })
} finally {
this.setData({ creating: false })
}
}
})
@@ -16,4 +16,38 @@
<view class="color-pill" style="background: {{item.color}};"></view>
</view>
</view>
<view wx:if="{{createModalVisible}}" class="modal-mask" bindtap="closeCreateModal">
<view class="employee-modal" catchtap="stopTap">
<view class="modal-head">
<view>
<text class="modal-title">新增美甲师</text>
</view>
<button class="modal-close" bindtap="closeCreateModal">×</button>
</view>
<view class="form-grid">
<view class="modal-field">
<text>姓名</text>
<input value="{{createForm.nickname}}" data-field="nickname" bindinput="onCreateInput" placeholder="请输入姓名" />
</view>
<view class="modal-field">
<text>手机号</text>
<input value="{{createForm.phone}}" data-field="phone" bindinput="onCreateInput" type="number" placeholder="请输入手机号" />
</view>
<view class="modal-field">
<text>登录账号</text>
<input value="{{createForm.account}}" data-field="account" bindinput="onCreateInput" placeholder="请输入账号" />
</view>
<view class="modal-field">
<text>初始密码</text>
<input value="{{createForm.password}}" data-field="password" bindinput="onCreateInput" password placeholder="请输入密码" />
</view>
<view class="modal-field">
<text>微信号</text>
<input value="{{createForm.wechatId}}" data-field="wechatId" bindinput="onCreateInput" placeholder="请输入微信号" />
</view>
</view>
<button class="primary-btn modal-submit" loading="{{creating}}" bindtap="submitEmployee">保存美甲师</button>
</view>
</view>
</view>
@@ -64,3 +64,81 @@
height: 18rpx;
border-radius: 999rpx;
}
.modal-mask {
position: fixed;
inset: 0;
z-index: 80;
display: flex;
align-items: flex-end;
justify-content: center;
background: rgba(18, 15, 12, 0.48);
}
.employee-modal {
width: 100%;
padding: 28rpx 28rpx calc(28rpx + env(safe-area-inset-bottom));
border-radius: 28rpx 28rpx 0 0;
background: #fffaf4;
box-shadow: 0 -18rpx 40rpx rgba(41, 31, 23, 0.16);
}
.modal-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 20rpx;
margin-bottom: 20rpx;
}
.modal-title {
display: block;
}
.modal-title {
color: #27211d;
font-size: 34rpx;
font-weight: 900;
}
.modal-close {
width: 58rpx;
height: 58rpx;
margin: 0;
padding: 0;
border-radius: 50%;
background: #f2e7da;
color: #61554c;
font-size: 40rpx;
line-height: 58rpx;
}
.form-grid {
display: grid;
grid-template-columns: 1fr;
gap: 16rpx;
}
.modal-field {
padding: 16rpx 18rpx;
border-radius: 18rpx;
background: #f7efe7;
}
.modal-field text {
display: block;
margin-bottom: 8rpx;
color: #6c5f54;
font-size: 24rpx;
font-weight: 800;
}
.modal-field input {
height: 58rpx;
color: #2c2722;
font-size: 28rpx;
}
.modal-submit {
margin-top: 22rpx;
}