统一甲屿云命名体系
@@ -0,0 +1,14 @@
|
||||
# Windows
|
||||
[Dd]esktop.ini
|
||||
Thumbs.db
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
|
||||
# Node.js
|
||||
node_modules/
|
||||
@@ -0,0 +1,103 @@
|
||||
const request = require('../utils/request')
|
||||
const { API_DOMAIN } = require('../utils/config')
|
||||
|
||||
module.exports = {
|
||||
login(data) {
|
||||
return request({
|
||||
url: '/auth/login',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
getLoginShops(account) {
|
||||
return request({
|
||||
url: `/auth/login-shops/${encodeURIComponent(account)}`,
|
||||
method: 'GET'
|
||||
})
|
||||
},
|
||||
|
||||
register(data) {
|
||||
return request({
|
||||
url: '/auth/register',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
sendCode(phone) {
|
||||
return request({
|
||||
url: '/user/send-verification-code',
|
||||
method: 'POST',
|
||||
params: {
|
||||
__baseUrl: API_DOMAIN
|
||||
},
|
||||
data: {
|
||||
phone,
|
||||
sceneCode: 'PLANNING_MANAGER_REGISTER'
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
sendLoginCode(phone) {
|
||||
return request({
|
||||
url: '/user/send-verification-code',
|
||||
method: 'POST',
|
||||
params: {
|
||||
__baseUrl: API_DOMAIN
|
||||
},
|
||||
data: {
|
||||
phone,
|
||||
sceneCode: 'USER_LOGIN_SMS_CODE'
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
phoneLogin(data) {
|
||||
return request({
|
||||
url: '/user/phone-login',
|
||||
method: 'POST',
|
||||
params: {
|
||||
__baseUrl: API_DOMAIN
|
||||
},
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
getPhoneLoginShops(phone) {
|
||||
return request({
|
||||
url: `/user/check/login-shops/phone/${encodeURIComponent(phone)}`,
|
||||
method: 'GET',
|
||||
params: {
|
||||
__baseUrl: API_DOMAIN
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getCurrentAgreements() {
|
||||
return request({
|
||||
url: '/legal-agreement/current',
|
||||
method: 'GET',
|
||||
params: {
|
||||
__baseUrl: API_DOMAIN
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
switchShop(shopId) {
|
||||
return request({
|
||||
url: '/auth/switch-shop',
|
||||
method: 'POST',
|
||||
data: {
|
||||
shopId
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
logout() {
|
||||
return request({
|
||||
url: '/auth/logout',
|
||||
method: 'POST'
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
const request = require('../utils/request')
|
||||
|
||||
module.exports = {
|
||||
list(params) {
|
||||
return request({
|
||||
url: '/manager/customers',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
detail(id) {
|
||||
return request({
|
||||
url: `/manager/customers/${id}`
|
||||
})
|
||||
},
|
||||
|
||||
create(data) {
|
||||
return request({
|
||||
url: '/manager/customers',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
const request = require('../utils/request')
|
||||
|
||||
module.exports = {
|
||||
list(params) {
|
||||
return request({
|
||||
url: '/manager/employees',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
detail(userId) {
|
||||
return request({
|
||||
url: `/manager/employees/${userId}`
|
||||
})
|
||||
},
|
||||
|
||||
save(data) {
|
||||
return request({
|
||||
url: '/manager/employees',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
createUser(data) {
|
||||
return request({
|
||||
url: '/manager/employees/users',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
schedules(params) {
|
||||
return request({
|
||||
url: '/manager/employees/schedules',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
saveSchedule(data) {
|
||||
return request({
|
||||
url: '/manager/employees/schedules',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
scheduleRule(params) {
|
||||
return request({
|
||||
url: '/manager/employees/schedule-rule',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
saveScheduleRule(data) {
|
||||
return request({
|
||||
url: '/manager/employees/schedule-rule',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
saveScheduleException(data) {
|
||||
return request({
|
||||
url: '/manager/employees/schedule-exceptions',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
const request = require('../utils/request')
|
||||
|
||||
module.exports = {
|
||||
calendar(params) {
|
||||
return request({
|
||||
url: '/manager/planning/calendar',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
createAppointment(data) {
|
||||
return request({
|
||||
url: '/manager/planning/appointments',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
appointment(orderItemId) {
|
||||
return request({
|
||||
url: `/manager/planning/appointments/${orderItemId}`
|
||||
})
|
||||
},
|
||||
|
||||
moveAppointment(orderItemId, data) {
|
||||
return request({
|
||||
url: `/manager/planning/appointments/${orderItemId}/time-artist`,
|
||||
method: 'PUT',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
updateStatus(orderId, status) {
|
||||
return request({
|
||||
url: `/manager/planning/appointments/${orderId}/status`,
|
||||
method: 'PUT',
|
||||
data: { status }
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
const request = require('../utils/request')
|
||||
|
||||
module.exports = {
|
||||
list(params) {
|
||||
return request({
|
||||
url: '/manager/products',
|
||||
params
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
const request = require('../utils/request')
|
||||
|
||||
module.exports = {
|
||||
settings() {
|
||||
return request({
|
||||
url: '/manager/shop'
|
||||
})
|
||||
},
|
||||
|
||||
saveSettings(data) {
|
||||
return request({
|
||||
url: '/manager/shop',
|
||||
method: 'PUT',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
exportData(params) {
|
||||
return request({
|
||||
url: '/export',
|
||||
params
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
const request = require('../utils/request')
|
||||
const { API_DOMAIN } = require('../utils/config')
|
||||
|
||||
module.exports = {
|
||||
info() {
|
||||
return request({
|
||||
url: '/user/info',
|
||||
params: {
|
||||
__baseUrl: API_DOMAIN
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
updateInfo(data) {
|
||||
return request({
|
||||
url: '/user/info',
|
||||
method: 'PUT',
|
||||
params: {
|
||||
__baseUrl: API_DOMAIN
|
||||
},
|
||||
data
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
const auth = require('./utils/auth')
|
||||
const { BRAND_CONFIG } = require('./utils/config')
|
||||
|
||||
App({
|
||||
globalData: {
|
||||
appName: BRAND_CONFIG.appName,
|
||||
shopName: BRAND_CONFIG.defaultShopName,
|
||||
userInfo: null,
|
||||
planningNeedRefresh: false
|
||||
},
|
||||
|
||||
onLaunch() {
|
||||
this.bootstrapSession()
|
||||
},
|
||||
|
||||
bootstrapSession() {
|
||||
const session = auth.getSession()
|
||||
this.globalData.userInfo = session.userInfo || null
|
||||
if (session.shopName) {
|
||||
this.globalData.shopName = session.shopName
|
||||
}
|
||||
},
|
||||
|
||||
setSession(session) {
|
||||
auth.setSession(session)
|
||||
this.bootstrapSession()
|
||||
},
|
||||
|
||||
clearSession() {
|
||||
auth.clearSession()
|
||||
this.globalData.userInfo = null
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/login/index",
|
||||
"pages/register/index",
|
||||
"pages/planning/index",
|
||||
"pages/appointment-form/index",
|
||||
"pages/appointment-detail/index",
|
||||
"pages/artist-transfer/index",
|
||||
"pages/customers/index",
|
||||
"pages/customer-detail/index",
|
||||
"pages/employees/index",
|
||||
"pages/employee-detail/index",
|
||||
"pages/schedule-setting/index",
|
||||
"pages/leave-management/index",
|
||||
"pages/color-setting/index",
|
||||
"pages/employee-orders/index",
|
||||
"pages/profile/index",
|
||||
"pages/shop-settings/index",
|
||||
"pages/export/index",
|
||||
"pages/password/index",
|
||||
"pages/about/index"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTitleText": "Jayu Salon",
|
||||
"navigationBarBackgroundColor": "#F8F5EF",
|
||||
"navigationBarTextStyle": "black",
|
||||
"backgroundColor": "#F8F5EF",
|
||||
"backgroundTextStyle": "dark"
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#8B8680",
|
||||
"selectedColor": "#2F6F62",
|
||||
"backgroundColor": "#FFFDF8",
|
||||
"borderStyle": "white",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/planning/index",
|
||||
"text": "规划",
|
||||
"iconPath": "assets/tabbar/planning.png",
|
||||
"selectedIconPath": "assets/tabbar/planning-active.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/customers/index",
|
||||
"text": "客户",
|
||||
"iconPath": "assets/tabbar/customers.png",
|
||||
"selectedIconPath": "assets/tabbar/customers-active.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/employees/index",
|
||||
"text": "员工",
|
||||
"iconPath": "assets/tabbar/employees.png",
|
||||
"selectedIconPath": "assets/tabbar/employees-active.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/profile/index",
|
||||
"text": "我的",
|
||||
"iconPath": "assets/tabbar/profile.png",
|
||||
"selectedIconPath": "assets/tabbar/profile-active.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
"style": "v2",
|
||||
"sitemapLocation": "sitemap.json"
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
page {
|
||||
min-height: 100%;
|
||||
background: #f8f5ef;
|
||||
color: #26231f;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
view,
|
||||
text,
|
||||
button,
|
||||
input,
|
||||
textarea,
|
||||
picker,
|
||||
scroll-view {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
button {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-width: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
button::after {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding: 22rpx 24rpx 140rpx;
|
||||
background: #f8f5ef;
|
||||
}
|
||||
|
||||
.page.no-tab {
|
||||
padding-bottom: 196rpx;
|
||||
}
|
||||
|
||||
.card {
|
||||
border: 1rpx solid rgba(50, 43, 34, 0.06);
|
||||
border-radius: 12px;
|
||||
background: #fffdf8;
|
||||
box-shadow: 0 10rpx 28rpx rgba(58, 48, 34, 0.06);
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
margin: 4rpx 4rpx 16rpx;
|
||||
color: #4c4740;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.muted {
|
||||
color: #9d968e;
|
||||
}
|
||||
|
||||
.tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 40rpx;
|
||||
padding: 0 16rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f0ece5;
|
||||
color: #6d675f;
|
||||
font-size: 22rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.primary-btn,
|
||||
.secondary-btn,
|
||||
.text-btn,
|
||||
.danger-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
min-height: 76rpx;
|
||||
border-radius: 12px;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.primary-btn,
|
||||
.secondary-btn,
|
||||
.danger-btn {
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
background: #6f8f83;
|
||||
color: #fffdf8;
|
||||
box-shadow: 0 12rpx 24rpx rgba(111, 143, 131, 0.22);
|
||||
}
|
||||
|
||||
.secondary-btn {
|
||||
border: 1rpx solid #d8d1c8;
|
||||
background: #fffdf8;
|
||||
color: #514b44;
|
||||
}
|
||||
|
||||
.danger-btn {
|
||||
background: #d98d8d;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.text-btn {
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
min-height: 56rpx;
|
||||
color: #6f8f83;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.compact-btn,
|
||||
.small-action {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 112rpx;
|
||||
min-width: 112rpx;
|
||||
max-width: 112rpx;
|
||||
height: 56rpx;
|
||||
padding: 0 20rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #e5eee9;
|
||||
color: #55786d;
|
||||
font-size: 24rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.small-action {
|
||||
width: 112rpx;
|
||||
min-width: 104rpx;
|
||||
max-width: 112rpx;
|
||||
height: 52rpx;
|
||||
background: #f0ece5;
|
||||
color: #5f5951;
|
||||
}
|
||||
|
||||
.icon-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 64rpx;
|
||||
min-width: 64rpx;
|
||||
max-width: 64rpx;
|
||||
height: 64rpx;
|
||||
min-height: 64rpx;
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
background: #fffdf8;
|
||||
color: #4e4942;
|
||||
box-shadow: 0 6rpx 14rpx rgba(58, 48, 34, 0.05);
|
||||
}
|
||||
|
||||
.form-card {
|
||||
padding: 8rpx 24rpx;
|
||||
}
|
||||
|
||||
.field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 108rpx;
|
||||
border-bottom: 1rpx solid #eee8df;
|
||||
}
|
||||
|
||||
.field:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
width: 180rpx;
|
||||
color: #625c55;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.field-label.required::after,
|
||||
.required-label::after {
|
||||
content: " *";
|
||||
color: #c56f36;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.field input,
|
||||
.field textarea,
|
||||
.field-value {
|
||||
flex: 1;
|
||||
color: #27231f;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.field textarea {
|
||||
min-height: 140rpx;
|
||||
padding: 34rpx 0;
|
||||
}
|
||||
|
||||
.fixed-bottom {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 20;
|
||||
padding: 14rpx 24rpx calc(14rpx + env(safe-area-inset-bottom));
|
||||
background: rgba(248, 245, 239, 0.94);
|
||||
backdrop-filter: blur(18rpx);
|
||||
}
|
||||
|
||||
.fab {
|
||||
position: fixed;
|
||||
right: 28rpx;
|
||||
bottom: calc(100rpx + env(safe-area-inset-bottom));
|
||||
z-index: 18;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 84rpx;
|
||||
min-width: 84rpx;
|
||||
max-width: 84rpx;
|
||||
height: 84rpx;
|
||||
min-height: 84rpx;
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
background: #6f8f83;
|
||||
color: #fff;
|
||||
font-size: 46rpx;
|
||||
font-weight: 300;
|
||||
line-height: 84rpx;
|
||||
box-shadow: 0 12rpx 26rpx rgba(111, 143, 131, 0.24);
|
||||
}
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.list-card {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.empty {
|
||||
padding: 56rpx 24rpx;
|
||||
color: #a39b91;
|
||||
text-align: center;
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 448 B |
|
After Width: | Height: | Size: 306 B |
|
After Width: | Height: | Size: 453 B |
|
After Width: | Height: | Size: 290 B |
|
After Width: | Height: | Size: 397 B |
|
After Width: | Height: | Size: 240 B |
|
After Width: | Height: | Size: 434 B |
|
After Width: | Height: | Size: 285 B |
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"treeData": []
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
const { BRAND_CONFIG } = require('../../utils/config')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
appName: BRAND_CONFIG.appName
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "关于系统"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<view class="page no-tab about-page">
|
||||
<view class="brand-card card">
|
||||
<image class="logo" src="/assets/images/app-icon.png" mode="aspectFill"></image>
|
||||
<text class="name">{{appName}}</text>
|
||||
<text class="desc">专为美甲店店长设计的预约排班日历子系统</text>
|
||||
</view>
|
||||
<view class="card about-list">
|
||||
<view class="row between"><text>版本</text><text class="muted">0.0.1</text></view>
|
||||
<view class="row between"><text>定位</text><text class="muted">规划 / 客户 / 员工 / 我的</text></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,35 @@
|
||||
.about-page {
|
||||
padding-top: 80rpx;
|
||||
}
|
||||
|
||||
.brand-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 52rpx 28rpx;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
border-radius: 30rpx;
|
||||
background: #e5eee9;
|
||||
box-shadow: 0 16rpx 34rpx rgba(111, 143, 131, 0.24);
|
||||
}
|
||||
|
||||
.name {
|
||||
margin-top: 22rpx;
|
||||
font-size: 38rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.desc {
|
||||
margin-top: 12rpx;
|
||||
color: #90887e;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.about-list {
|
||||
margin-top: 20rpx;
|
||||
padding: 24rpx;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
const planningApi = require('../../api/planning')
|
||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
id: '',
|
||||
appointment: {},
|
||||
avatarText: '',
|
||||
timeText: '',
|
||||
loadError: ''
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({ id: options.id || '' })
|
||||
this.loadDetail()
|
||||
},
|
||||
|
||||
async loadDetail() {
|
||||
try {
|
||||
const appointment = await planningApi.appointment(this.data.id)
|
||||
this.applyAppointment(appointment)
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
appointment: {},
|
||||
avatarText: '',
|
||||
timeText: '',
|
||||
loadError: error.message || '预约详情加载失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
applyAppointment(appointment) {
|
||||
this.setData({
|
||||
appointment,
|
||||
avatarText: String(appointment.customerName || '客').slice(0, 1),
|
||||
timeText: `${(appointment.startTime || '').slice(0, 16)} - ${(appointment.endTime || '').slice(11, 16)}`,
|
||||
loadError: ''
|
||||
})
|
||||
},
|
||||
|
||||
async updateStatus(status) {
|
||||
try {
|
||||
await planningApi.updateStatus(this.data.appointment.orderId, status)
|
||||
markPlanningRefresh()
|
||||
wx.showToast({ title: '已更新' })
|
||||
this.loadDetail()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '操作失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
confirm() {
|
||||
this.updateStatus(1)
|
||||
},
|
||||
|
||||
complete() {
|
||||
this.updateStatus(2)
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.updateStatus(3)
|
||||
},
|
||||
|
||||
goTransfer() {
|
||||
wx.navigateTo({ url: `/pages/artist-transfer/index?id=${this.data.id}` })
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "预约详情"
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<view class="page no-tab">
|
||||
<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>
|
||||
<view>
|
||||
<text class="customer">{{appointment.customerName}}</text>
|
||||
<text class="phone">{{appointment.customerPhone}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-actions">
|
||||
<text class="tag">{{appointment.statusText}}</text>
|
||||
<button class="small-action" bindtap="goTransfer">改派</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-grid">
|
||||
<view>
|
||||
<text class="label">项目</text>
|
||||
<text class="value">{{appointment.productTitle}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">美甲师</text>
|
||||
<text class="value">{{appointment.artistName}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">时间</text>
|
||||
<text class="value">{{timeText}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">时长</text>
|
||||
<text class="value">{{appointment.durationMinutes}}分钟</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loadError}}" class="section">
|
||||
<view class="section-title">备注</view>
|
||||
<view class="card note-card">{{appointment.remark || '暂无备注'}}</view>
|
||||
</view>
|
||||
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,110 @@
|
||||
.detail-card {
|
||||
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;
|
||||
justify-content: space-between;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.detail-person {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
width: 82rpx;
|
||||
height: 82rpx;
|
||||
border-radius: 50%;
|
||||
background: #e5eee9;
|
||||
color: #5d8175;
|
||||
font-size: 32rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.customer,
|
||||
.phone {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.customer {
|
||||
color: #24211d;
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.phone {
|
||||
margin-top: 6rpx;
|
||||
color: #928a81;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.detail-actions {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.detail-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 22rpx;
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.label,
|
||||
.value {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: #9a9288;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.value {
|
||||
margin-top: 8rpx;
|
||||
color: #2d2924;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.note-card {
|
||||
padding: 24rpx;
|
||||
color: #6d655d;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.action-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.action-row .primary-btn,
|
||||
.action-row .secondary-btn,
|
||||
.action-row .danger-btn {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
@@ -0,0 +1,762 @@
|
||||
const planningApi = require('../../api/planning')
|
||||
const productsApi = require('../../api/products')
|
||||
const customersApi = require('../../api/customers')
|
||||
const dateUtil = require('../../utils/date')
|
||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||
const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload')
|
||||
|
||||
const DRAFT_STORAGE_PREFIX = 'managerAppointmentDraft'
|
||||
const TIME_SLOT_MINUTES = 15
|
||||
|
||||
function buildClientRequestId(prefix) {
|
||||
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`
|
||||
}
|
||||
|
||||
function getCalendarArtists(calendar) {
|
||||
return calendar && Array.isArray(calendar.artists) ? calendar.artists : []
|
||||
}
|
||||
|
||||
function findArtist(artists, artistId) {
|
||||
return artists.find(item => String(item.id) === String(artistId)) || {}
|
||||
}
|
||||
|
||||
function canCreateAppointment() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
return Number(userInfo.type) !== 3
|
||||
}
|
||||
|
||||
function buildDraftKey() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
return `${DRAFT_STORAGE_PREFIX}:${userInfo.id || 'guest'}:${userInfo.shopId || 'default'}`
|
||||
}
|
||||
|
||||
function hasPresetOptions(options) {
|
||||
return Boolean(options.customerName || options.phone || options.date || options.artistId)
|
||||
}
|
||||
|
||||
function readDraftForm() {
|
||||
try {
|
||||
const draft = wx.getStorageSync(buildDraftKey())
|
||||
return draft && draft.form ? draft.form : null
|
||||
} catch (error) {
|
||||
throw new Error(`读取预约草稿失败:${error.message || error}`)
|
||||
}
|
||||
}
|
||||
|
||||
function writeDraftForm(form) {
|
||||
try {
|
||||
wx.setStorageSync(buildDraftKey(), {
|
||||
form,
|
||||
savedAt: Date.now()
|
||||
})
|
||||
} catch (error) {
|
||||
throw new Error(`保存预约草稿失败:${error.message || error}`)
|
||||
}
|
||||
}
|
||||
|
||||
function removeDraftForm() {
|
||||
try {
|
||||
wx.removeStorageSync(buildDraftKey())
|
||||
} catch (error) {
|
||||
throw new Error(`清空预约草稿失败:${error.message || error}`)
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeDuration(value) {
|
||||
const duration = Number(value)
|
||||
return Number.isFinite(duration) && duration > 0 ? Math.floor(duration) : 0
|
||||
}
|
||||
|
||||
function buildTimeRangeLabel(startMinute, durationMinutes) {
|
||||
return `${dateUtil.timeFromMinutes(startMinute)}-${dateUtil.timeFromMinutes(startMinute + durationMinutes)}`
|
||||
}
|
||||
|
||||
function getTimePeriod(minute) {
|
||||
if (minute < 12 * 60) {
|
||||
return { key: 'morning', title: '上午' }
|
||||
}
|
||||
if (minute < 18 * 60) {
|
||||
return { key: 'afternoon', title: '下午' }
|
||||
}
|
||||
return { key: 'evening', title: '晚上' }
|
||||
}
|
||||
|
||||
function normalizeAppointmentDate(item) {
|
||||
return item.date || String(item.startTime || '').slice(0, 10)
|
||||
}
|
||||
|
||||
function extractTimeText(value) {
|
||||
const target = String(value || '')
|
||||
if (target.includes('T')) {
|
||||
return target.slice(11, 16)
|
||||
}
|
||||
if (target.includes(' ')) {
|
||||
return target.slice(11, 16)
|
||||
}
|
||||
return target.slice(0, 5)
|
||||
}
|
||||
|
||||
function resolveAppointmentStartMinute(item) {
|
||||
if (item.startMinute !== undefined && item.startMinute !== null) {
|
||||
return Number(item.startMinute)
|
||||
}
|
||||
return dateUtil.minutesOfDay(extractTimeText(item.startTime))
|
||||
}
|
||||
|
||||
function resolveAppointmentEndMinute(item, startMinute) {
|
||||
if (item.endMinute !== undefined && item.endMinute !== null) {
|
||||
return Number(item.endMinute)
|
||||
}
|
||||
if (item.endTime) {
|
||||
return dateUtil.minutesOfDay(extractTimeText(item.endTime))
|
||||
}
|
||||
return startMinute + Number(item.durationMinutes || 60)
|
||||
}
|
||||
|
||||
function isCancelledAppointment(item) {
|
||||
return item.status === 3 || item.statusText === '已取消'
|
||||
}
|
||||
|
||||
function buildBusyRanges(appointments, form) {
|
||||
return (appointments || [])
|
||||
.filter(item => String(item.artistId) === String(form.artistId))
|
||||
.filter(item => normalizeAppointmentDate(item) === form.appointmentDate)
|
||||
.filter(item => !isCancelledAppointment(item))
|
||||
.map(item => {
|
||||
const startMinute = resolveAppointmentStartMinute(item)
|
||||
return {
|
||||
startMinute,
|
||||
endMinute: resolveAppointmentEndMinute(item, startMinute)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function hasBusyConflict(startMinute, endMinute, ranges) {
|
||||
return ranges.some(range => startMinute < range.endMinute && endMinute > range.startMinute)
|
||||
}
|
||||
|
||||
function buildAvailableTimeGroups(calendar, form, durationMinutes) {
|
||||
const schedules = (calendar.schedules || [])
|
||||
.filter(item => String(item.artistId) === String(form.artistId))
|
||||
.filter(item => item.date === form.appointmentDate)
|
||||
.filter(item => item.status === 1 && Number(item.capacity === undefined ? 1 : item.capacity) >= 1)
|
||||
const busyRanges = buildBusyRanges(calendar.appointments || [], form)
|
||||
const groupMap = {
|
||||
morning: { key: 'morning', title: '上午', times: [] },
|
||||
afternoon: { key: 'afternoon', title: '下午', times: [] },
|
||||
evening: { key: 'evening', title: '晚上', times: [] }
|
||||
}
|
||||
schedules.forEach(schedule => {
|
||||
const scheduleStart = dateUtil.minutesOfDay(extractTimeText(schedule.startTime))
|
||||
const scheduleEnd = dateUtil.minutesOfDay(extractTimeText(schedule.endTime))
|
||||
for (let minute = scheduleStart; minute + durationMinutes <= scheduleEnd; minute += TIME_SLOT_MINUTES) {
|
||||
const endMinute = minute + durationMinutes
|
||||
if (!hasBusyConflict(minute, endMinute, busyRanges)) {
|
||||
const period = getTimePeriod(minute)
|
||||
groupMap[period.key].times.push({
|
||||
value: dateUtil.timeFromMinutes(minute),
|
||||
rangeText: buildTimeRangeLabel(minute, durationMinutes)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
return Object.keys(groupMap)
|
||||
.map(key => ({
|
||||
...groupMap[key],
|
||||
times: groupMap[key].times.filter((item, index, array) => array.findIndex(candidate => candidate.value === item.value) === index)
|
||||
}))
|
||||
.filter(group => group.times.length > 0)
|
||||
}
|
||||
|
||||
function flattenTimeGroups(groups) {
|
||||
return (groups || []).reduce((list, group) => list.concat(group.times || []), [])
|
||||
}
|
||||
|
||||
function parseProductTags(product) {
|
||||
if (Array.isArray(product.tagList) && product.tagList.length > 0) {
|
||||
return product.tagList
|
||||
}
|
||||
if (Array.isArray(product.tagInfos) && product.tagInfos.length > 0) {
|
||||
return product.tagInfos.map(item => item.tagName).filter(Boolean)
|
||||
}
|
||||
return String(product.tags || '')
|
||||
.split(/[;,,、]/)
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function normalizeProduct(product, artists) {
|
||||
const imageUrls = Array.isArray(product.imageUrls) ? product.imageUrls : []
|
||||
const bookableArtists = String(product.bookableArtists || '')
|
||||
.split(',')
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean)
|
||||
const artistNames = bookableArtists
|
||||
.map(id => findArtist(artists, id).name)
|
||||
.filter(Boolean)
|
||||
const durationText = product.approximateDuration || (product.serviceDurationMinutes ? `${product.serviceDurationMinutes}分钟` : '')
|
||||
return {
|
||||
...product,
|
||||
coverImage: imageUrls[0] || '',
|
||||
tagList: parseProductTags(product).slice(0, 4),
|
||||
artistText: artistNames.length > 0 ? artistNames.join('、') : '全部美甲师',
|
||||
priceText: product.price || product.price === 0 ? `¥${product.price}` : '价格待定',
|
||||
durationText
|
||||
}
|
||||
}
|
||||
|
||||
function isScheduleCoveringTime(schedule, form, startMinute, endMinute) {
|
||||
if (!schedule || String(schedule.artistId) !== String(form.artistId) || schedule.date !== form.appointmentDate) {
|
||||
return false
|
||||
}
|
||||
if (schedule.status !== 1 || Number(schedule.capacity === undefined ? 1 : schedule.capacity) < 1) {
|
||||
return false
|
||||
}
|
||||
const scheduleStartMinute = dateUtil.minutesOfDay(extractTimeText(schedule.startTime))
|
||||
const scheduleEndMinute = dateUtil.minutesOfDay(extractTimeText(schedule.endTime))
|
||||
return scheduleStartMinute <= startMinute && scheduleEndMinute >= endMinute
|
||||
}
|
||||
|
||||
function normalizeCustomer(customer) {
|
||||
const name = customer.nickname || customer.name || customer.account || ''
|
||||
const phone = customer.contactPhone || customer.phone || ''
|
||||
return {
|
||||
id: customer.id,
|
||||
name,
|
||||
phone,
|
||||
displayName: name || phone || '客户',
|
||||
displayPhone: phone || '未填写手机号'
|
||||
}
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
form: {
|
||||
customerUserId: '',
|
||||
customerName: '',
|
||||
phone: '',
|
||||
appointmentDate: dateUtil.formatDate(new Date()),
|
||||
appointmentTime: '',
|
||||
productId: '',
|
||||
manualProductTitle: '',
|
||||
manualProductPrice: '',
|
||||
manualProductDescription: '',
|
||||
manualProductTags: '',
|
||||
manualProductTargetAudience: '',
|
||||
manualProductPrecautions: '',
|
||||
manualProductImageFileIds: '',
|
||||
manualProductImageUrl: '',
|
||||
durationMinutes: '',
|
||||
artistId: '',
|
||||
remark: ''
|
||||
},
|
||||
customerOptions: [],
|
||||
customerDropdownVisible: false,
|
||||
customerLoading: false,
|
||||
customerError: '',
|
||||
products: [],
|
||||
filteredProducts: [],
|
||||
artists: [],
|
||||
selectedProduct: {},
|
||||
selectedArtist: {},
|
||||
productModalVisible: false,
|
||||
productKeyword: '',
|
||||
productError: '',
|
||||
conflictTip: '',
|
||||
conflictLevel: 'free',
|
||||
canCreateAppointment: true,
|
||||
draftSavedAtText: '',
|
||||
manualImageUploading: false,
|
||||
timeSheetVisible: false,
|
||||
timeLoading: false,
|
||||
timeError: '',
|
||||
timeSelectTip: '请先选择美甲师并填写时长',
|
||||
availableTimeGroups: [],
|
||||
loading: false
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const creatable = canCreateAppointment()
|
||||
const draftForm = creatable && !hasPresetOptions(options) ? readDraftForm() : null
|
||||
const baseForm = draftForm || {}
|
||||
this.setData({
|
||||
canCreateAppointment: creatable,
|
||||
form: {
|
||||
...this.data.form,
|
||||
...baseForm,
|
||||
customerName: options.customerName ? decodeURIComponent(options.customerName) : (baseForm.customerName || ''),
|
||||
phone: options.phone ? decodeURIComponent(options.phone) : (baseForm.phone || ''),
|
||||
appointmentDate: options.date || baseForm.appointmentDate || dateUtil.formatDate(new Date()),
|
||||
artistId: options.artistId || baseForm.artistId || ''
|
||||
},
|
||||
draftSavedAtText: draftForm ? '已恢复本机草稿' : ''
|
||||
})
|
||||
if (!creatable) {
|
||||
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.loadOptions()
|
||||
this.searchCustomers()
|
||||
},
|
||||
|
||||
async loadOptions() {
|
||||
try {
|
||||
const productsData = await productsApi.list({ page: 1, size: 100 })
|
||||
const products = productsData.list || productsData || []
|
||||
this.setData({ products, productError: '' })
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
products: [],
|
||||
filteredProducts: [],
|
||||
productError: error.message || '作品列表加载失败'
|
||||
})
|
||||
}
|
||||
await this.loadArtists()
|
||||
this.refreshProductCards()
|
||||
await this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
async loadArtists() {
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: this.data.form.appointmentDate,
|
||||
endDate: this.data.form.appointmentDate
|
||||
})
|
||||
const artists = getCalendarArtists(calendar)
|
||||
const selectedArtist = this.data.form.artistId ? findArtist(artists, this.data.form.artistId) : {}
|
||||
this.setData({ artists, selectedArtist })
|
||||
this.refreshProductCards()
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
artists: [],
|
||||
selectedArtist: {},
|
||||
'form.artistId': '',
|
||||
conflictTip: error.message || '美甲师列表加载失败',
|
||||
conflictLevel: 'danger'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onInput(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
const patch = {
|
||||
[`form.${field}`]: event.detail.value
|
||||
}
|
||||
if (field === 'customerName' || field === 'phone') {
|
||||
patch['form.customerUserId'] = ''
|
||||
patch.customerDropdownVisible = true
|
||||
}
|
||||
this.setData(patch)
|
||||
if (field === 'customerName' || field === 'phone') {
|
||||
this.scheduleCustomerSearch(field)
|
||||
}
|
||||
if (field === 'durationMinutes') {
|
||||
this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
}
|
||||
},
|
||||
|
||||
onCustomerFocus(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
this.setData({ customerDropdownVisible: true })
|
||||
this.searchCustomers(field)
|
||||
},
|
||||
|
||||
scheduleCustomerSearch(field) {
|
||||
clearTimeout(this._customerTimer)
|
||||
this._customerTimer = setTimeout(() => this.searchCustomers(field), 250)
|
||||
},
|
||||
|
||||
async searchCustomers(preferredField) {
|
||||
if (!this.data.canCreateAppointment) {
|
||||
return
|
||||
}
|
||||
const form = this.data.form
|
||||
const sourceValue = preferredField === 'phone' ? form.phone : form.customerName || form.phone
|
||||
const keyword = String(sourceValue || '').trim()
|
||||
this.setData({ customerLoading: true })
|
||||
try {
|
||||
const data = await customersApi.list({ keyword, page: 1, size: 20 })
|
||||
const list = data.list || data || []
|
||||
this.setData({
|
||||
customerOptions: list.map(normalizeCustomer),
|
||||
customerError: ''
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
customerOptions: [],
|
||||
customerError: error.message || '客户列表加载失败'
|
||||
})
|
||||
} finally {
|
||||
this.setData({ customerLoading: false })
|
||||
}
|
||||
},
|
||||
|
||||
selectCustomer(event) {
|
||||
const customer = this.data.customerOptions.find(item => String(item.id) === String(event.currentTarget.dataset.id))
|
||||
if (!customer) {
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
'form.customerUserId': customer.id,
|
||||
'form.customerName': customer.name,
|
||||
'form.phone': customer.phone,
|
||||
customerDropdownVisible: false
|
||||
})
|
||||
},
|
||||
|
||||
hideCustomerDropdown() {
|
||||
setTimeout(() => {
|
||||
this.setData({ customerDropdownVisible: false })
|
||||
}, 180)
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
if (this._customerTimer) {
|
||||
clearTimeout(this._customerTimer)
|
||||
}
|
||||
},
|
||||
|
||||
async onDateChange(event) {
|
||||
this.setData({
|
||||
'form.appointmentDate': event.detail.value,
|
||||
'form.appointmentTime': ''
|
||||
})
|
||||
await this.loadArtists()
|
||||
await this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
refreshProductCards() {
|
||||
const keyword = this.data.productKeyword.trim().toLowerCase()
|
||||
const products = this.data.products
|
||||
.map(product => normalizeProduct(product, this.data.artists))
|
||||
.filter(product => {
|
||||
if (!keyword) return true
|
||||
return [product.title, product.artistText, product.priceText, product.durationText, ...(product.tagList || [])]
|
||||
.some(value => String(value || '').toLowerCase().includes(keyword))
|
||||
})
|
||||
this.setData({ filteredProducts: products })
|
||||
},
|
||||
|
||||
openProductModal() {
|
||||
this.refreshProductCards()
|
||||
this.setData({ productModalVisible: true })
|
||||
},
|
||||
|
||||
closeProductModal() {
|
||||
this.setData({ productModalVisible: false })
|
||||
},
|
||||
|
||||
stopTap() {
|
||||
},
|
||||
|
||||
onProductSearch(event) {
|
||||
this.setData({ productKeyword: event.detail.value })
|
||||
this.refreshProductCards()
|
||||
},
|
||||
|
||||
selectProduct(event) {
|
||||
const selectedProduct = this.data.filteredProducts.find(item => String(item.id) === String(event.currentTarget.dataset.id)) || {}
|
||||
this.setData({
|
||||
selectedProduct,
|
||||
'form.productId': selectedProduct.id,
|
||||
'form.manualProductTitle': '',
|
||||
'form.manualProductPrice': '',
|
||||
'form.manualProductDescription': '',
|
||||
'form.manualProductTags': '',
|
||||
'form.manualProductTargetAudience': '',
|
||||
'form.manualProductPrecautions': '',
|
||||
'form.manualProductImageFileIds': '',
|
||||
'form.manualProductImageUrl': '',
|
||||
'form.durationMinutes': String(parseInt(selectedProduct.approximateDuration, 10) || this.data.form.durationMinutes || '')
|
||||
})
|
||||
this.closeProductModal()
|
||||
this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
useManualProduct() {
|
||||
const title = String(this.data.form.manualProductTitle || '').trim()
|
||||
const price = Number(this.data.form.manualProductPrice)
|
||||
if (!title || Number.isNaN(price) || price < 0) {
|
||||
wx.showToast({ title: '请填写手动预约作品名称和价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
selectedProduct: {},
|
||||
'form.productId': '',
|
||||
'form.manualProductTitle': title,
|
||||
'form.manualProductPrice': String(price)
|
||||
})
|
||||
this.closeProductModal()
|
||||
this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
async chooseManualProductImage() {
|
||||
if (this.data.manualImageUploading) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const filePath = await chooseImageFilePath()
|
||||
if (!filePath) {
|
||||
return
|
||||
}
|
||||
this.setData({ manualImageUploading: true })
|
||||
const uploadResult = await uploadObjectFile(filePath)
|
||||
const fileId = uploadResult.id || uploadResult.fileId
|
||||
const fileUrl = uploadResult.fileUrl || uploadResult.primaryUrl || filePath
|
||||
if (!fileId) {
|
||||
throw new Error('作品图片上传成功但未返回文件ID')
|
||||
}
|
||||
this.setData({
|
||||
'form.manualProductImageFileIds': String(fileId),
|
||||
'form.manualProductImageUrl': fileUrl
|
||||
})
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '图片上传失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ manualImageUploading: false })
|
||||
}
|
||||
},
|
||||
|
||||
removeManualProductImage() {
|
||||
this.setData({
|
||||
'form.manualProductImageFileIds': '',
|
||||
'form.manualProductImageUrl': ''
|
||||
})
|
||||
},
|
||||
|
||||
onArtistChange(event) {
|
||||
const selectedArtist = this.data.artists[Number(event.detail.value)] || {}
|
||||
this.setData({
|
||||
selectedArtist,
|
||||
'form.artistId': selectedArtist.id,
|
||||
'form.appointmentTime': ''
|
||||
})
|
||||
this.refreshAvailableTimes()
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
canOpenTimeSheet() {
|
||||
const form = this.data.form
|
||||
return Boolean(form.appointmentDate && form.artistId && normalizeDuration(form.durationMinutes))
|
||||
},
|
||||
|
||||
async refreshAvailableTimes() {
|
||||
const form = this.data.form
|
||||
const durationMinutes = normalizeDuration(form.durationMinutes)
|
||||
const requestSeq = (this._availableTimeRequestSeq || 0) + 1
|
||||
this._availableTimeRequestSeq = requestSeq
|
||||
if (!form.appointmentDate || !form.artistId || !durationMinutes) {
|
||||
const patch = {
|
||||
availableTimeGroups: [],
|
||||
timeError: '',
|
||||
timeSelectTip: '请先选择美甲师并填写时长'
|
||||
}
|
||||
if (form.appointmentTime) {
|
||||
patch['form.appointmentTime'] = ''
|
||||
}
|
||||
this.setData(patch)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
timeLoading: true,
|
||||
timeError: '',
|
||||
timeSelectTip: '正在计算可约时间...'
|
||||
})
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: form.appointmentDate,
|
||||
endDate: form.appointmentDate,
|
||||
artistId: form.artistId
|
||||
})
|
||||
if (requestSeq !== this._availableTimeRequestSeq) {
|
||||
return
|
||||
}
|
||||
const availableTimeGroups = buildAvailableTimeGroups(calendar, form, durationMinutes)
|
||||
const availableTimes = flattenTimeGroups(availableTimeGroups).map(item => item.value)
|
||||
const patch = {
|
||||
availableTimeGroups,
|
||||
timeSelectTip: availableTimes.length > 0 ? '请选择预约时间' : '当前美甲师当天暂无可约时间'
|
||||
}
|
||||
if (form.appointmentTime && !availableTimes.includes(form.appointmentTime)) {
|
||||
patch['form.appointmentTime'] = ''
|
||||
}
|
||||
this.setData(patch)
|
||||
} catch (error) {
|
||||
if (requestSeq !== this._availableTimeRequestSeq) {
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
availableTimeGroups: [],
|
||||
timeError: error.message || '可约时间加载失败',
|
||||
timeSelectTip: '可约时间加载失败'
|
||||
})
|
||||
} finally {
|
||||
if (requestSeq === this._availableTimeRequestSeq) {
|
||||
this.setData({ timeLoading: false })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async openTimeSheet() {
|
||||
if (!this.canOpenTimeSheet()) {
|
||||
wx.showToast({ title: '请先选择美甲师并填写时长', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ timeSheetVisible: true })
|
||||
await this.refreshAvailableTimes()
|
||||
},
|
||||
|
||||
closeTimeSheet() {
|
||||
this.setData({ timeSheetVisible: false })
|
||||
},
|
||||
|
||||
selectAvailableTime(event) {
|
||||
const value = event.currentTarget.dataset.value
|
||||
this.setData({
|
||||
'form.appointmentTime': value,
|
||||
timeSheetVisible: false
|
||||
})
|
||||
this.checkAvailability()
|
||||
},
|
||||
|
||||
async checkAvailability() {
|
||||
const form = this.data.form
|
||||
if (!form.appointmentDate || !form.appointmentTime || !form.artistId) {
|
||||
this.setData({ conflictTip: '', conflictLevel: 'free' })
|
||||
return { ok: true }
|
||||
}
|
||||
const durationMinutes = normalizeDuration(form.durationMinutes)
|
||||
if (!durationMinutes) {
|
||||
this.setData({ conflictTip: '', conflictLevel: 'free' })
|
||||
return { ok: true }
|
||||
}
|
||||
const startMinute = dateUtil.minutesOfDay(form.appointmentTime)
|
||||
const endMinute = startMinute + durationMinutes
|
||||
if (startMinute < dateUtil.minutesOfDay('10:00') || endMinute > dateUtil.minutesOfDay('22:00')) {
|
||||
const tip = '该时间超出营业时间 10:00-22:00'
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
}
|
||||
try {
|
||||
const calendar = await planningApi.calendar({
|
||||
startDate: form.appointmentDate,
|
||||
endDate: form.appointmentDate,
|
||||
artistId: form.artistId
|
||||
})
|
||||
const schedule = (calendar.schedules || []).find(item => isScheduleCoveringTime(item, form, startMinute, endMinute))
|
||||
if (!schedule) {
|
||||
const tip = `${this.data.selectedArtist.name || '该美甲师'} 当前时段无可预约排班`
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
}
|
||||
const conflicts = (calendar.appointments || []).filter(item => {
|
||||
if (String(item.artistId) !== String(form.artistId) || normalizeAppointmentDate(item) !== form.appointmentDate) return false
|
||||
if (isCancelledAppointment(item)) return false
|
||||
const itemStart = resolveAppointmentStartMinute(item)
|
||||
const itemEnd = resolveAppointmentEndMinute(item, itemStart)
|
||||
return startMinute < itemEnd && endMinute > itemStart
|
||||
})
|
||||
if (conflicts.length > 0) {
|
||||
const first = conflicts[0]
|
||||
const itemStart = resolveAppointmentStartMinute(first)
|
||||
const itemEnd = resolveAppointmentEndMinute(first, itemStart)
|
||||
const tip = `${this.data.selectedArtist.name || '该美甲师'} ${dateUtil.timeFromMinutes(itemStart)}-${dateUtil.timeFromMinutes(itemEnd)} 已有预约`
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
}
|
||||
const tip = `${this.data.selectedArtist.name || '该美甲师'} ${form.appointmentTime}-${dateUtil.timeFromMinutes(endMinute)} 可预约`
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'free' })
|
||||
return { ok: true, tip }
|
||||
} catch (error) {
|
||||
const tip = error.message || '排班校验失败,请稍后重试'
|
||||
this.setData({ conflictTip: tip, conflictLevel: 'danger' })
|
||||
return { ok: false, tip }
|
||||
}
|
||||
},
|
||||
|
||||
async submit() {
|
||||
if (!this.data.canCreateAppointment) {
|
||||
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const form = this.data.form
|
||||
const hasManualProduct = String(form.manualProductTitle || '').trim() && String(form.manualProductPrice || '').trim()
|
||||
const durationMinutes = normalizeDuration(form.durationMinutes)
|
||||
if (!form.customerName || !form.phone || (!form.productId && !hasManualProduct) || !form.artistId) {
|
||||
wx.showToast({ title: '请补全预约信息', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!durationMinutes) {
|
||||
wx.showToast({ title: '请填写预约时长', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const availability = await this.checkAvailability()
|
||||
if (!availability.ok) {
|
||||
wx.showToast({ title: availability.tip || '该时段已被预约', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
const payload = {
|
||||
...form,
|
||||
customerUserId: form.customerUserId ? String(form.customerUserId) : undefined,
|
||||
artistId: String(form.artistId),
|
||||
durationMinutes,
|
||||
clientRequestId: buildClientRequestId('manager-appointment')
|
||||
}
|
||||
if (form.productId) {
|
||||
payload.productId = String(form.productId)
|
||||
payload.manualProductTitle = undefined
|
||||
payload.manualProductPrice = undefined
|
||||
} else {
|
||||
payload.productId = undefined
|
||||
payload.manualProductTitle = String(form.manualProductTitle || '').trim()
|
||||
payload.manualProductPrice = Number(form.manualProductPrice)
|
||||
payload.manualProductDescription = String(form.manualProductDescription || '').trim() || undefined
|
||||
payload.manualProductTags = String(form.manualProductTags || '').trim() || undefined
|
||||
payload.manualProductTargetAudience = String(form.manualProductTargetAudience || '').trim() || undefined
|
||||
payload.manualProductPrecautions = String(form.manualProductPrecautions || '').trim() || undefined
|
||||
payload.manualProductImageFileIds = String(form.manualProductImageFileIds || '').trim() || undefined
|
||||
}
|
||||
const result = await planningApi.createAppointment(payload)
|
||||
removeDraftForm()
|
||||
markPlanningRefresh()
|
||||
wx.redirectTo({ url: `/pages/appointment-detail/index?id=${result.orderItemId}` })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '提交失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
saveDraft() {
|
||||
try {
|
||||
writeDraftForm(this.data.form)
|
||||
this.setData({ draftSavedAtText: '草稿已保存到本机' })
|
||||
wx.showToast({ title: '草稿已保存', icon: 'success' })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '草稿保存失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
clearDraft() {
|
||||
try {
|
||||
removeDraftForm()
|
||||
this.setData({ draftSavedAtText: '' })
|
||||
wx.showToast({ title: '草稿已清空', icon: 'success' })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '草稿清空失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "新建预约"
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card form-card">
|
||||
<view class="customer-select">
|
||||
<view class="field">
|
||||
<text class="field-label required">客户姓名</text>
|
||||
<input value="{{form.customerName}}" data-field="customerName" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="搜索或输入客户姓名" />
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">手机号</text>
|
||||
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="搜索或输入手机号" />
|
||||
</view>
|
||||
<view wx:if="{{customerDropdownVisible}}" class="customer-dropdown">
|
||||
<view wx:if="{{customerLoading}}" class="customer-option muted-option">正在搜索客户...</view>
|
||||
<view wx:elif="{{customerError}}" class="customer-option muted-option">{{customerError}},可继续手动输入</view>
|
||||
<view wx:else>
|
||||
<view wx:for="{{customerOptions}}" wx:key="id" class="customer-option" data-id="{{item.id}}" bindtap="selectCustomer">
|
||||
<view class="customer-copy">
|
||||
<text class="customer-name">{{item.displayName}}</text>
|
||||
<text class="customer-phone">{{item.displayPhone}}</text>
|
||||
</view>
|
||||
<text class="customer-select-tag">选择</text>
|
||||
</view>
|
||||
<view wx:if="{{customerOptions.length === 0}}" class="customer-option muted-option">暂无匹配客户,可继续手动输入</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">预约日期</text>
|
||||
<picker mode="date" value="{{form.appointmentDate}}" bindchange="onDateChange">
|
||||
<view class="field-value">{{form.appointmentDate}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">预约作品</text>
|
||||
<view class="field-value product-value" bindtap="openProductModal">
|
||||
<text>{{selectedProduct.title || form.manualProductTitle || '请选择预约作品'}}</text>
|
||||
<text wx:if="{{form.manualProductTitle && !form.productId}}" class="manual-badge">手动</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">预计时长</text>
|
||||
<input value="{{form.durationMinutes}}" data-field="durationMinutes" bindinput="onInput" type="number" placeholder="请输入预约时长" />
|
||||
<text class="unit">分钟</text>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">指定员工</text>
|
||||
<picker range="{{artists}}" range-key="name" bindchange="onArtistChange">
|
||||
<view class="field-value">{{selectedArtist.name || '请选择美甲师'}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">预约时间</text>
|
||||
<view class="field-value time-value {{form.appointmentTime ? '' : 'placeholder'}}" bindtap="openTimeSheet">
|
||||
<view>
|
||||
<text>{{form.appointmentTime || timeSelectTip}}</text>
|
||||
<text wx:if="{{form.appointmentTime}}" class="time-range">{{form.appointmentDate}} · {{selectedArtist.name}} · {{form.durationMinutes}}分钟</text>
|
||||
</view>
|
||||
<text class="time-arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field textarea-field">
|
||||
<text class="field-label">备注</text>
|
||||
<textarea value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="客户偏好、款式说明" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="capacity-tip card">
|
||||
<text class="tip-title">容量校验</text>
|
||||
<text class="tip-text">提交预约时会校验营业时间、美甲师休息和同时间段容量,冲突会直接拦截。</text>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{draftSavedAtText}}" class="draft-tip card">
|
||||
<text>{{draftSavedAtText}}</text>
|
||||
<button class="text-btn draft-clear" bindtap="clearDraft">清空</button>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{conflictTip}}" class="availability-tip card {{conflictLevel}}">
|
||||
<text class="tip-title">时段检查</text>
|
||||
<text class="tip-text">{{conflictTip}}</text>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{productModalVisible}}" class="modal-mask" bindtap="closeProductModal">
|
||||
<view class="product-modal" catchtap="stopTap">
|
||||
<view class="modal-head">
|
||||
<view>
|
||||
<text class="modal-title">选择预约作品</text>
|
||||
</view>
|
||||
<view class="modal-close" bindtap="closeProductModal">×</view>
|
||||
</view>
|
||||
<input class="product-search" value="{{productKeyword}}" bindinput="onProductSearch" placeholder="搜索作品、标签、美甲师" />
|
||||
<scroll-view class="product-list" scroll-y>
|
||||
<view wx:if="{{productError}}" class="product-empty">{{productError}}</view>
|
||||
<view wx:for="{{filteredProducts}}" wx:key="id" class="product-option {{form.productId == item.id ? 'active' : ''}}" data-id="{{item.id}}" bindtap="selectProduct">
|
||||
<image wx:if="{{item.coverImage}}" class="product-cover" src="{{item.coverImage}}" mode="aspectFill"></image>
|
||||
<view wx:else class="product-cover placeholder">图</view>
|
||||
<view class="product-info">
|
||||
<view class="product-title-row">
|
||||
<text class="product-title">{{item.title}}</text>
|
||||
<text class="product-price">{{item.priceText}}</text>
|
||||
</view>
|
||||
<text class="product-meta">{{item.artistText}} · {{item.durationText || '时长待定'}}</text>
|
||||
<view class="tag-row">
|
||||
<text wx:for="{{item.tagList}}" wx:for-item="tag" wx:key="*this" class="tag-pill">{{tag}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{!productError && filteredProducts.length === 0}}" class="product-empty">暂无匹配作品</view>
|
||||
</scroll-view>
|
||||
<view class="manual-panel">
|
||||
<text class="manual-title required-label">手动新增预约作品</text>
|
||||
<view class="manual-grid">
|
||||
<input value="{{form.manualProductTitle}}" data-field="manualProductTitle" bindinput="onInput" placeholder="作品名称" />
|
||||
<input value="{{form.manualProductPrice}}" data-field="manualProductPrice" bindinput="onInput" type="digit" placeholder="价格" />
|
||||
</view>
|
||||
<textarea class="manual-textarea" value="{{form.manualProductDescription}}" data-field="manualProductDescription" bindinput="onInput" placeholder="作品描述(选填)" />
|
||||
<view class="manual-grid single">
|
||||
<input value="{{form.manualProductTags}}" data-field="manualProductTags" bindinput="onInput" placeholder="标签,多个用逗号分隔(选填)" />
|
||||
<input value="{{form.manualProductTargetAudience}}" data-field="manualProductTargetAudience" bindinput="onInput" placeholder="适合人群(选填)" />
|
||||
<input value="{{form.manualProductPrecautions}}" data-field="manualProductPrecautions" bindinput="onInput" placeholder="注意事项(选填)" />
|
||||
</view>
|
||||
<view class="manual-image-row">
|
||||
<image wx:if="{{form.manualProductImageUrl}}" class="manual-image" src="{{form.manualProductImageUrl}}" mode="aspectFill"></image>
|
||||
<view wx:else class="manual-image placeholder">图</view>
|
||||
<button class="secondary-btn image-btn" loading="{{manualImageUploading}}" bindtap="chooseManualProductImage">上传图片</button>
|
||||
<button wx:if="{{form.manualProductImageUrl}}" class="text-btn image-remove" bindtap="removeManualProductImage">移除</button>
|
||||
</view>
|
||||
<button class="secondary-btn manual-btn" bindtap="useManualProduct">使用手动预约作品</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{timeSheetVisible}}" class="modal-mask" bindtap="closeTimeSheet">
|
||||
<view class="time-modal" catchtap="stopTap">
|
||||
<view class="modal-head">
|
||||
<view>
|
||||
<text class="modal-title">选择预约时间</text>
|
||||
<text class="modal-subtitle">{{form.appointmentDate}} · {{selectedArtist.name}} · {{form.durationMinutes}}分钟</text>
|
||||
</view>
|
||||
<view class="modal-close" bindtap="closeTimeSheet">×</view>
|
||||
</view>
|
||||
<view wx:if="{{timeLoading}}" class="time-empty">正在计算可约时间...</view>
|
||||
<view wx:elif="{{timeError}}" class="time-empty">{{timeError}}</view>
|
||||
<view wx:elif="{{availableTimeGroups.length === 0}}" class="time-empty">当前美甲师当天暂无可约时间</view>
|
||||
<scroll-view wx:else class="time-list" scroll-y>
|
||||
<view wx:for="{{availableTimeGroups}}" wx:key="key" class="time-group">
|
||||
<text class="time-group-title">{{item.title}}</text>
|
||||
<view class="time-grid">
|
||||
<view wx:for="{{item.times}}" wx:for-item="time" wx:key="value" class="time-chip {{form.appointmentTime === time.value ? 'active' : ''}}" data-value="{{time.value}}" bindtap="selectAvailableTime">
|
||||
<text>{{time.value}}</text>
|
||||
<text>{{time.rangeText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="fixed-bottom">
|
||||
<view wx:if="{{canCreateAppointment}}" class="action-row">
|
||||
<button class="secondary-btn draft-btn" bindtap="saveDraft">保存草稿</button>
|
||||
<button class="primary-btn submit-btn" loading="{{loading}}" bindtap="submit">提交预约</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,577 @@
|
||||
.unit {
|
||||
color: #9a9288;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.customer-select {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.customer-dropdown {
|
||||
position: absolute;
|
||||
top: 214rpx;
|
||||
right: 0;
|
||||
left: 180rpx;
|
||||
z-index: 30;
|
||||
max-height: 360rpx;
|
||||
overflow-y: auto;
|
||||
border: 1rpx solid #e5ded4;
|
||||
border-radius: 18rpx;
|
||||
background: #fffdf8;
|
||||
box-shadow: 0 18rpx 40rpx rgba(58, 48, 34, 0.14);
|
||||
}
|
||||
|
||||
.customer-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
min-height: 76rpx;
|
||||
padding: 0 20rpx;
|
||||
border-bottom: 1rpx solid #f0e9df;
|
||||
}
|
||||
|
||||
.customer-option:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.customer-copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.customer-name {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
color: #2a2521;
|
||||
font-size: 26rpx;
|
||||
font-weight: 800;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.customer-phone {
|
||||
color: #8c8177;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.customer-select-tag {
|
||||
flex: 0 0 auto;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #e5eee9;
|
||||
color: #55786d;
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.muted-option {
|
||||
justify-content: center;
|
||||
color: #9a9288;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.product-value {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.time-value {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.time-value > view {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.time-value.placeholder {
|
||||
color: #aaa096;
|
||||
}
|
||||
|
||||
.time-range {
|
||||
overflow: hidden;
|
||||
color: #9a9288;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.35;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.time-arrow {
|
||||
flex: 0 0 auto;
|
||||
color: #b78b63;
|
||||
font-size: 38rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.manual-badge {
|
||||
flex: 0 0 auto;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #fff2df;
|
||||
color: #a26428;
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.textarea-field {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.capacity-tip {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
margin-top: 20rpx;
|
||||
padding: 22rpx;
|
||||
}
|
||||
|
||||
.tip-title {
|
||||
color: #4e4942;
|
||||
font-size: 26rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.tip-text {
|
||||
color: #90877e;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.availability-tip {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
margin-top: 16rpx;
|
||||
padding: 22rpx;
|
||||
}
|
||||
|
||||
.availability-tip.free {
|
||||
background: #f3faf5;
|
||||
}
|
||||
|
||||
.availability-tip.warn {
|
||||
background: #fff8e8;
|
||||
}
|
||||
|
||||
.availability-tip.danger {
|
||||
background: #fff2f2;
|
||||
}
|
||||
|
||||
.availability-tip.free .tip-title {
|
||||
color: #4f7d62;
|
||||
}
|
||||
|
||||
.availability-tip.warn .tip-title {
|
||||
color: #a2763d;
|
||||
}
|
||||
|
||||
.availability-tip.danger .tip-title {
|
||||
color: #c36a6a;
|
||||
}
|
||||
|
||||
.draft-tip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
margin-top: 16rpx;
|
||||
padding: 18rpx 22rpx;
|
||||
color: #6f655b;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.draft-clear {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.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);
|
||||
}
|
||||
|
||||
.product-modal {
|
||||
width: 100%;
|
||||
max-height: 88vh;
|
||||
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);
|
||||
}
|
||||
|
||||
.time-modal {
|
||||
width: 100%;
|
||||
max-height: 82vh;
|
||||
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: center;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
color: #27211d;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.modal-subtitle {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
color: #8d8278;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 48rpx;
|
||||
min-width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
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);
|
||||
}
|
||||
|
||||
.product-search {
|
||||
height: 74rpx;
|
||||
padding: 0 24rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #f5eee6;
|
||||
color: #2a2521;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.product-list {
|
||||
max-height: 440rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.product-option {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 18rpx;
|
||||
min-height: 156rpx;
|
||||
margin-bottom: 16rpx;
|
||||
padding: 14rpx;
|
||||
border: 2rpx solid transparent;
|
||||
border-radius: 18rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 10rpx 24rpx rgba(92, 66, 43, 0.08);
|
||||
}
|
||||
|
||||
.product-option.active {
|
||||
border-color: #c9874d;
|
||||
background: #fff8ef;
|
||||
}
|
||||
|
||||
.product-cover {
|
||||
flex: 0 0 auto;
|
||||
width: 132rpx;
|
||||
height: 132rpx;
|
||||
border-radius: 14rpx;
|
||||
background: #efe5da;
|
||||
}
|
||||
|
||||
.product-cover.placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #b79b82;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.product-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.product-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.product-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
color: #2a2521;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
flex: 0 0 auto;
|
||||
color: #c56f36;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.product-meta {
|
||||
overflow: hidden;
|
||||
color: #8c8177;
|
||||
font-size: 24rpx;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tag-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8rpx;
|
||||
min-height: 34rpx;
|
||||
}
|
||||
|
||||
.tag-pill {
|
||||
max-width: 160rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 999rpx;
|
||||
background: #f3e9df;
|
||||
color: #826c5b;
|
||||
font-size: 22rpx;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.product-empty {
|
||||
padding: 44rpx 0;
|
||||
color: #9a9288;
|
||||
font-size: 26rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.time-list {
|
||||
max-height: 620rpx;
|
||||
padding-right: 2rpx;
|
||||
}
|
||||
|
||||
.time-group {
|
||||
margin-bottom: 28rpx;
|
||||
}
|
||||
|
||||
.time-group:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.time-group-title {
|
||||
display: block;
|
||||
margin-bottom: 14rpx;
|
||||
color: #4d453e;
|
||||
font-size: 26rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.time-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.time-chip {
|
||||
display: flex;
|
||||
min-height: 88rpx;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4rpx;
|
||||
border: 2rpx solid #eadfd2;
|
||||
border-radius: 18rpx;
|
||||
background: #fff;
|
||||
color: #302923;
|
||||
box-shadow: 0 8rpx 18rpx rgba(92, 66, 43, 0.06);
|
||||
transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
|
||||
}
|
||||
|
||||
.time-chip:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.time-chip.active {
|
||||
border-color: #c9874d;
|
||||
background: #fff2df;
|
||||
color: #9f5f2d;
|
||||
}
|
||||
|
||||
.time-chip text:first-child {
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.time-chip text:last-child {
|
||||
color: #8c8177;
|
||||
font-size: 20rpx;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.time-chip.active text:last-child {
|
||||
color: #a26428;
|
||||
}
|
||||
|
||||
.time-empty {
|
||||
min-height: 220rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40rpx 20rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #f7efe7;
|
||||
color: #8c8177;
|
||||
font-size: 26rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.manual-panel {
|
||||
margin-top: 12rpx;
|
||||
padding: 20rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #f7efe7;
|
||||
}
|
||||
|
||||
.manual-title {
|
||||
display: block;
|
||||
margin-bottom: 14rpx;
|
||||
color: #4e4740;
|
||||
font-size: 26rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.manual-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 180rpx;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.manual-grid.single {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
|
||||
.manual-grid input {
|
||||
height: 70rpx;
|
||||
padding: 0 18rpx;
|
||||
border-radius: 14rpx;
|
||||
background: #fffaf4;
|
||||
color: #302923;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.manual-textarea {
|
||||
width: 100%;
|
||||
min-height: 120rpx;
|
||||
margin-top: 14rpx;
|
||||
padding: 18rpx;
|
||||
border-radius: 14rpx;
|
||||
background: #fffaf4;
|
||||
color: #302923;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.manual-image-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14rpx;
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
|
||||
.manual-image {
|
||||
flex: 0 0 auto;
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 14rpx;
|
||||
background: #efe5da;
|
||||
}
|
||||
|
||||
.manual-image.placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #b79b82;
|
||||
font-size: 26rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.image-btn {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.image-remove {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.manual-btn {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.action-row {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.draft-btn,
|
||||
.submit-btn {
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
const planningApi = require('../../api/planning')
|
||||
const dateUtil = require('../../utils/date')
|
||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
id: '',
|
||||
artists: [],
|
||||
selectedArtistId: '',
|
||||
date: dateUtil.formatDate(new Date()),
|
||||
time: '13:00',
|
||||
loadError: '',
|
||||
loading: false
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
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 })
|
||||
},
|
||||
|
||||
async onDateChange(event) {
|
||||
this.setData({ date: event.detail.value })
|
||||
await this.loadArtists()
|
||||
},
|
||||
|
||||
onTimeChange(event) {
|
||||
this.setData({ time: event.detail.value })
|
||||
},
|
||||
|
||||
async submit() {
|
||||
if (!this.data.selectedArtistId) {
|
||||
wx.showToast({ title: '请选择美甲师', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
await planningApi.moveAppointment(this.data.id, {
|
||||
artistId: Number(this.data.selectedArtistId),
|
||||
appointmentDate: this.data.date,
|
||||
appointmentTime: this.data.time
|
||||
})
|
||||
markPlanningRefresh()
|
||||
wx.showToast({ title: '已改派' })
|
||||
setTimeout(() => wx.navigateBack(), 500)
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '改派失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "改派员工"
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<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">
|
||||
<view class="chip-dot large" style="background: {{item.color}};"></view>
|
||||
<view>
|
||||
<text class="artist-name">{{item.name}}</text>
|
||||
<text class="artist-status">{{item.statusText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="tag {{item.availableStatus}}">{{item.availableText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loadError}}" class="card form-card section">
|
||||
<view class="field">
|
||||
<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 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 wx:if="{{!loadError}}" class="fixed-bottom">
|
||||
<button class="primary-btn" loading="{{loading}}" bindtap="submit">确认改派</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,52 @@
|
||||
.transfer-card {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
width: 180rpx;
|
||||
min-width: 180rpx;
|
||||
max-width: 180rpx;
|
||||
margin: 24rpx auto 0;
|
||||
}
|
||||
|
||||
.transfer-card.active {
|
||||
outline: 3rpx solid #8fb89a;
|
||||
}
|
||||
|
||||
.chip-dot.large {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.artist-name,
|
||||
.artist-status {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.artist-name {
|
||||
color: #25211d;
|
||||
font-size: 30rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.artist-status {
|
||||
margin-top: 6rpx;
|
||||
color: #948c83;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.tag.free {
|
||||
background: #e5eee9;
|
||||
color: #55786d;
|
||||
}
|
||||
|
||||
.tag.busy {
|
||||
background: #fbedd7;
|
||||
color: #a5722a;
|
||||
}
|
||||
|
||||
.tag.full {
|
||||
background: #f8e2e6;
|
||||
color: #b06070;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
Page({
|
||||
data: {
|
||||
selected: '#7BA7C7',
|
||||
customColor: '#7BA7C7',
|
||||
wheelColors: [
|
||||
'#E0627A', '#E7785B', '#E2A64B', '#D8C85C', '#9EBB63', '#63B77B',
|
||||
'#4CB7A6', '#56A7D6', '#5F82D7', '#7C70D4', '#A66BC8', '#CF72A8'
|
||||
],
|
||||
recommendedColors: ['#7BA7C7', '#8FB89A', '#A894C7', '#D7A86E', '#D98DA5', '#79A6A3', '#B9A16B', '#9BA9C8'],
|
||||
paletteColors: [
|
||||
'#6F8F83', '#7BA7C7', '#8AAECA', '#9BA9C8', '#A894C7', '#C19AB7',
|
||||
'#D98DA5', '#D9958D', '#D7A86E', '#C8B47E', '#B9A16B', '#9FAD7B',
|
||||
'#8FB89A', '#79A6A3', '#6E9E92', '#A6B7A4', '#B8B0A6', '#C7B7A3',
|
||||
'#8E8A7D', '#A4A097', '#B6A6A0', '#C9A2A2', '#B58A8A', '#8C7C92',
|
||||
'#6D8491', '#829A9A', '#A9B3A2', '#C6B7D1', '#E0C2B6', '#F0D6A8'
|
||||
]
|
||||
},
|
||||
select(event) {
|
||||
const color = event.currentTarget.dataset.color
|
||||
this.setData({ selected: color, customColor: color })
|
||||
},
|
||||
selectWheelColor(event) {
|
||||
const color = event.currentTarget.dataset.color
|
||||
this.setData({ selected: color, customColor: color })
|
||||
},
|
||||
onCustomInput(event) {
|
||||
this.setData({ customColor: event.detail.value })
|
||||
},
|
||||
applyCustomColor() {
|
||||
let color = (this.data.customColor || '').trim()
|
||||
if (color && color[0] !== '#') color = `#${color}`
|
||||
if (!/^#[0-9a-fA-F]{6}$/.test(color)) {
|
||||
wx.showToast({ title: '请输入6位色值', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ selected: color.toUpperCase(), customColor: color.toUpperCase() })
|
||||
},
|
||||
save() { wx.showToast({ title: '已保存到本地' }) },
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "颜色设置"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card color-preview" style="background: {{selected}};">{{selected}}</view>
|
||||
<view class="section-title">推荐色</view>
|
||||
<view class="palette recommended-palette">
|
||||
<view wx:for="{{recommendedColors}}" wx:key="*this" class="color-swatch recommended {{selected === item ? 'active' : ''}}" style="background: {{item}};" data-color="{{item}}" bindtap="select"></view>
|
||||
</view>
|
||||
<view class="section-title">色盘选择</view>
|
||||
<view class="card color-wheel-card">
|
||||
<view class="color-wheel-wrap">
|
||||
<view class="color-wheel">
|
||||
<view wx:for="{{wheelColors}}" wx:key="*this" class="wheel-hit hit-{{index}}" data-color="{{item}}" bindtap="selectWheelColor"></view>
|
||||
<view class="wheel-center" style="background: {{selected}};">
|
||||
<text>{{selected}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="palette-grid compact">
|
||||
<view wx:for="{{paletteColors}}" wx:key="*this" class="palette-dot {{selected === item ? 'active' : ''}}" style="background: {{item}};" data-color="{{item}}" bindtap="select"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card custom-color-card">
|
||||
<view class="custom-color-preview" style="background: {{customColor}};"></view>
|
||||
<input class="custom-color-input" value="{{customColor}}" maxlength="7" placeholder="#7BA7C7" bindinput="onCustomInput" />
|
||||
<button class="small-action" bindtap="applyCustomColor">应用</button>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" bindtap="save">保存颜色</button></view>
|
||||
</view>
|
||||
@@ -0,0 +1,148 @@
|
||||
.color-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 168rpx;
|
||||
color: #fff;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.palette {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 14rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.color-swatch {
|
||||
height: 92rpx;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 8rpx 18rpx rgba(58, 48, 34, 0.08);
|
||||
}
|
||||
|
||||
.color-swatch.active {
|
||||
outline: 6rpx solid rgba(47, 111, 98, 0.22);
|
||||
}
|
||||
|
||||
.color-wheel-card {
|
||||
padding: 22rpx 18rpx 18rpx;
|
||||
}
|
||||
|
||||
.color-wheel-wrap {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.color-wheel {
|
||||
position: relative;
|
||||
width: 308rpx;
|
||||
height: 308rpx;
|
||||
border-radius: 50%;
|
||||
background: conic-gradient(#e0627a, #e7785b, #e2a64b, #d8c85c, #9ebb63, #63b77b, #4cb7a6, #56a7d6, #5f82d7, #7c70d4, #a66bc8, #cf72a8, #e0627a);
|
||||
box-shadow: inset 0 0 0 2rpx rgba(255, 255, 255, 0.45), 0 12rpx 28rpx rgba(58, 48, 34, 0.12);
|
||||
}
|
||||
|
||||
.color-wheel::after {
|
||||
position: absolute;
|
||||
top: 42rpx;
|
||||
right: 42rpx;
|
||||
bottom: 42rpx;
|
||||
left: 42rpx;
|
||||
border-radius: 50%;
|
||||
background: radial-gradient(circle at 34% 30%, rgba(255,255,255,0.78), rgba(255,255,255,0.18) 38%, rgba(38,35,31,0.12) 100%);
|
||||
content: "";
|
||||
}
|
||||
|
||||
.wheel-center {
|
||||
position: absolute;
|
||||
top: 94rpx;
|
||||
left: 94rpx;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border: 8rpx solid #fffdf8;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
font-weight: 900;
|
||||
text-shadow: 0 2rpx 6rpx rgba(31, 25, 20, 0.22);
|
||||
box-shadow: 0 10rpx 24rpx rgba(58, 48, 34, 0.16);
|
||||
}
|
||||
|
||||
.wheel-hit {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
z-index: 3;
|
||||
width: 70rpx;
|
||||
height: 154rpx;
|
||||
margin-left: -35rpx;
|
||||
transform-origin: 50% 154rpx;
|
||||
}
|
||||
|
||||
.hit-0 { transform: rotate(0deg); }
|
||||
.hit-1 { transform: rotate(30deg); }
|
||||
.hit-2 { transform: rotate(60deg); }
|
||||
.hit-3 { transform: rotate(90deg); }
|
||||
.hit-4 { transform: rotate(120deg); }
|
||||
.hit-5 { transform: rotate(150deg); }
|
||||
.hit-6 { transform: rotate(180deg); }
|
||||
.hit-7 { transform: rotate(210deg); }
|
||||
.hit-8 { transform: rotate(240deg); }
|
||||
.hit-9 { transform: rotate(270deg); }
|
||||
.hit-10 { transform: rotate(300deg); }
|
||||
.hit-11 { transform: rotate(330deg); }
|
||||
|
||||
.palette-grid.compact {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
.palette-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.palette-dot {
|
||||
width: 68rpx;
|
||||
height: 68rpx;
|
||||
border-radius: 50%;
|
||||
box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.42), 0 6rpx 14rpx rgba(58, 48, 34, 0.08);
|
||||
}
|
||||
|
||||
.palette-dot.active {
|
||||
outline: 6rpx solid rgba(47, 111, 98, 0.24);
|
||||
outline-offset: 3rpx;
|
||||
}
|
||||
|
||||
.custom-color-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-top: 18rpx;
|
||||
padding: 18rpx;
|
||||
}
|
||||
|
||||
.custom-color-preview {
|
||||
width: 58rpx;
|
||||
height: 58rpx;
|
||||
flex-shrink: 0;
|
||||
border-radius: 50%;
|
||||
box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.45);
|
||||
}
|
||||
|
||||
.custom-color-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 58rpx;
|
||||
padding: 0 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f4f0ea;
|
||||
color: #2f2a25;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
const customersApi = require('../../api/customers')
|
||||
|
||||
function canCreateAppointment() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
return Number(userInfo.type) !== 3
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
id: '',
|
||||
canCreateAppointment: true,
|
||||
avatarText: '客',
|
||||
customer: {},
|
||||
stats: { orderCount: 0, amount: 0, lastTime: '-' },
|
||||
orders: [],
|
||||
loadError: ''
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
id: options.id || '',
|
||||
canCreateAppointment: canCreateAppointment()
|
||||
})
|
||||
this.loadCustomer()
|
||||
},
|
||||
|
||||
async loadCustomer() {
|
||||
if (!this.data.id) {
|
||||
this.setData({
|
||||
customer: {},
|
||||
stats: { orderCount: 0, amount: 0, lastTime: '-' },
|
||||
orders: [],
|
||||
loadError: '缺少客户 ID'
|
||||
})
|
||||
return
|
||||
}
|
||||
try {
|
||||
const detail = await customersApi.detail(this.data.id)
|
||||
if (!detail) {
|
||||
throw new Error('客户详情不存在')
|
||||
}
|
||||
const customer = {
|
||||
id: detail.id,
|
||||
name: detail.nickname || detail.name || detail.account || '客户',
|
||||
phone: detail.contactPhone || detail.phone || '未填写'
|
||||
}
|
||||
this.setData({
|
||||
customer,
|
||||
avatarText: String(customer.name || '客').slice(-1),
|
||||
stats: {
|
||||
orderCount: detail.orderCount || detail.totalOrderCount || 0,
|
||||
amount: detail.totalAmount || detail.consumeAmount || 0,
|
||||
lastTime: detail.lastOrderTime || detail.lastConsumeTime || '-'
|
||||
},
|
||||
orders: Array.isArray(detail.orders) ? detail.orders : [],
|
||||
loadError: ''
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
customer: {},
|
||||
stats: { orderCount: 0, amount: 0, lastTime: '-' },
|
||||
orders: [],
|
||||
loadError: error.message || '客户详情加载失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
createAppointment() {
|
||||
if (!this.data.canCreateAppointment) {
|
||||
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const customer = this.data.customer || {}
|
||||
wx.navigateTo({
|
||||
url: `/pages/appointment-form/index?customerName=${encodeURIComponent(customer.name || '')}&phone=${encodeURIComponent(customer.phone || '')}`
|
||||
})
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "客户详情"
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<view class="page no-tab">
|
||||
<view wx:if="{{loadError}}" class="empty card">
|
||||
<text>{{loadError}}</text>
|
||||
<button class="secondary-btn retry-btn" bindtap="loadCustomer">重试</button>
|
||||
</view>
|
||||
|
||||
<block wx:else>
|
||||
<view class="card customer-head">
|
||||
<view class="customer-identity">
|
||||
<view class="avatar">{{avatarText}}</view>
|
||||
<view>
|
||||
<text class="customer-name">{{customer.name}}</text>
|
||||
<text class="customer-phone">{{customer.phone}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<button wx:if="{{canCreateAppointment}}" class="small-action" bindtap="createAppointment">新预约</button>
|
||||
</view>
|
||||
|
||||
<view class="stats">
|
||||
<view class="card stat">
|
||||
<text class="stat-value">{{stats.orderCount}}</text>
|
||||
<text class="stat-label">累计订单</text>
|
||||
</view>
|
||||
<view class="card stat">
|
||||
<text class="stat-value">¥{{stats.amount}}</text>
|
||||
<text class="stat-label">累计消费</text>
|
||||
</view>
|
||||
<view class="card stat">
|
||||
<text class="stat-value">{{stats.lastTime}}</text>
|
||||
<text class="stat-label">最近消费</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section">
|
||||
<view class="section-title">历史订单</view>
|
||||
<view class="list">
|
||||
<view wx:if="{{orders.length === 0}}" class="empty card">暂无历史订单</view>
|
||||
<view wx:for="{{orders}}" wx:key="id" class="card list-card order-card">
|
||||
<view>
|
||||
<text class="order-title">{{item.project || item.productTitle || '预约作品'}}</text>
|
||||
<text class="meta">{{item.date || item.appointmentDate || '-'}} · {{item.artist || item.artistName || '-'}}</text>
|
||||
</view>
|
||||
<text class="amount">¥{{item.amount || item.payAmount || 0}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
@@ -0,0 +1,96 @@
|
||||
.customer-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18rpx;
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.customer-identity {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
border-radius: 50%;
|
||||
background: #e5eee9;
|
||||
color: #5b7f73;
|
||||
font-size: 32rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.customer-name,
|
||||
.customer-phone {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.customer-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.customer-phone {
|
||||
margin-top: 8rpx;
|
||||
color: #928a81;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 14rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.stat {
|
||||
padding: 16rpx 12rpx;
|
||||
}
|
||||
|
||||
.stat-value,
|
||||
.stat-label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
color: #26231f;
|
||||
font-size: 28rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
margin-top: 8rpx;
|
||||
color: #91897f;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.order-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.order-title {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.amount {
|
||||
color: #6f8f83;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
width: 180rpx;
|
||||
min-width: 180rpx;
|
||||
max-width: 180rpx;
|
||||
margin: 24rpx auto 0;
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
const customersApi = require('../../api/customers')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
keyword: '',
|
||||
customers: [],
|
||||
loadError: '',
|
||||
createModalVisible: false,
|
||||
creating: false,
|
||||
createForm: {
|
||||
nickname: '',
|
||||
phone: ''
|
||||
}
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.loadCustomers()
|
||||
},
|
||||
|
||||
onSearchInput(event) {
|
||||
this.setData({ keyword: event.detail.value })
|
||||
clearTimeout(this._timer)
|
||||
this._timer = setTimeout(() => this.loadCustomers(), 300)
|
||||
},
|
||||
|
||||
async loadCustomers() {
|
||||
try {
|
||||
const data = await customersApi.list({ keyword: this.data.keyword, page: 1, size: 30 })
|
||||
const list = data.list || data || []
|
||||
this.setData({
|
||||
loadError: '',
|
||||
customers: list.map(item => ({
|
||||
id: item.id,
|
||||
name: item.nickname || item.name || item.account || '客户',
|
||||
phone: item.contactPhone || item.phone || '未填写',
|
||||
lastTime: item.lastOrderTime || item.lastConsumeTime || '-'
|
||||
}))
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
customers: [],
|
||||
loadError: error.message || '客户列表加载失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
openDetail(event) {
|
||||
wx.navigateTo({ url: `/pages/customer-detail/index?id=${event.currentTarget.dataset.id}` })
|
||||
},
|
||||
|
||||
addCustomer() {
|
||||
this.setData({ createModalVisible: true })
|
||||
},
|
||||
|
||||
closeCreateModal() {
|
||||
if (this.data.creating) {
|
||||
return
|
||||
}
|
||||
this.setData({ createModalVisible: false })
|
||||
},
|
||||
|
||||
stopTap() {
|
||||
},
|
||||
|
||||
onCreateInput(event) {
|
||||
this.setData({
|
||||
[`createForm.${event.currentTarget.dataset.field}`]: event.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
resetCreateForm() {
|
||||
this.setData({
|
||||
createForm: {
|
||||
nickname: '',
|
||||
phone: ''
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async submitCustomer() {
|
||||
const form = this.data.createForm
|
||||
const nickname = String(form.nickname || '').trim()
|
||||
const phone = String(form.phone || '').trim()
|
||||
if (!nickname || !phone) {
|
||||
wx.showToast({ title: '请填写客户姓名和手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ creating: true })
|
||||
try {
|
||||
await customersApi.create({ nickname, phone })
|
||||
wx.showToast({ title: '客户已新增', icon: 'success' })
|
||||
this.resetCreateForm()
|
||||
this.setData({ createModalVisible: false })
|
||||
await this.loadCustomers()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '新增失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ creating: false })
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "客户"
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<view class="page">
|
||||
<view class="customer-toolbar">
|
||||
<view class="search-card card">
|
||||
<input value="{{keyword}}" bindinput="onSearchInput" placeholder="搜索客户姓名或手机号" />
|
||||
</view>
|
||||
<button class="compact-btn" bindtap="addCustomer">新增</button>
|
||||
</view>
|
||||
|
||||
<view class="list section">
|
||||
<view wx:if="{{loadError}}" class="empty card">
|
||||
<text>{{loadError}}</text>
|
||||
<button class="secondary-btn retry-btn" bindtap="loadCustomers">重试</button>
|
||||
</view>
|
||||
<view wx:elif="{{customers.length === 0}}" class="empty card">暂无客户</view>
|
||||
<view wx:for="{{customers}}" wx:key="id" class="card list-card customer-card" data-id="{{item.id}}" bindtap="openDetail">
|
||||
<view>
|
||||
<text class="name">{{item.name}}</text>
|
||||
<text class="meta">{{item.phone}}</text>
|
||||
<text class="meta">最近消费 {{item.lastTime}}</text>
|
||||
</view>
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{createModalVisible}}" class="modal-mask" bindtap="closeCreateModal">
|
||||
<view class="customer-modal" catchtap="stopTap">
|
||||
<view class="modal-head">
|
||||
<text class="modal-title">新增客户</text>
|
||||
<view class="modal-close" bindtap="closeCreateModal">×</view>
|
||||
</view>
|
||||
<view class="form-grid">
|
||||
<view class="modal-field">
|
||||
<text class="required-label">客户姓名</text>
|
||||
<input value="{{createForm.nickname}}" data-field="nickname" bindinput="onCreateInput" placeholder="请输入客户姓名" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text class="required-label">手机号</text>
|
||||
<input value="{{createForm.phone}}" data-field="phone" bindinput="onCreateInput" type="number" placeholder="请输入手机号" />
|
||||
</view>
|
||||
</view>
|
||||
<button class="primary-btn modal-submit" loading="{{creating}}" bindtap="submitCustomer">保存客户</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,149 @@
|
||||
.customer-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.search-card {
|
||||
flex: 1;
|
||||
padding: 0 24rpx;
|
||||
height: 84rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.search-card input {
|
||||
width: 100%;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.customer-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.name,
|
||||
.meta {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.name {
|
||||
color: #292520;
|
||||
font-size: 30rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.meta {
|
||||
margin-top: 8rpx;
|
||||
color: #928a81;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
color: #b0a79e;
|
||||
font-size: 48rpx;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
width: 180rpx;
|
||||
min-width: 180rpx;
|
||||
max-width: 180rpx;
|
||||
margin: 24rpx auto 0;
|
||||
}
|
||||
|
||||
.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);
|
||||
}
|
||||
|
||||
.customer-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: center;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
color: #27211d;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 48rpx;
|
||||
min-width: 48rpx;
|
||||
height: 48rpx;
|
||||
border: 1rpx solid #e4d8ca;
|
||||
border-radius: 50%;
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
const employeesApi = require('../../api/employees')
|
||||
|
||||
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
|
||||
|
||||
Page({
|
||||
data: {
|
||||
id: '',
|
||||
employee: {},
|
||||
loadError: ''
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({ id: options.id || '' })
|
||||
this.loadDetail()
|
||||
},
|
||||
|
||||
async loadDetail() {
|
||||
try {
|
||||
const data = await employeesApi.detail(this.data.id)
|
||||
const name = data.nickname || data.name || data.artistName || '美甲师'
|
||||
const monthOrders = data.monthOrders || data.orderCount || 0
|
||||
const monthAmount = data.monthAmount || data.turnover || 0
|
||||
this.setData({
|
||||
loadError: '',
|
||||
employee: {
|
||||
...data,
|
||||
name,
|
||||
shortName: name.slice(-1),
|
||||
color: data.color || EMPLOYEE_COLORS[0],
|
||||
monthOrders,
|
||||
monthAmount,
|
||||
avgAmount: monthOrders > 0 ? Math.round(monthAmount / monthOrders) : 0
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
employee: {},
|
||||
loadError: error.message || '美甲师详情加载失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
go(event) {
|
||||
wx.navigateTo({ url: `${event.currentTarget.dataset.url}?id=${this.data.id}` })
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "员工详情"
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<view class="page no-tab">
|
||||
<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 employee-head">
|
||||
<view class="avatar" style="background: {{employee.color}};">{{employee.shortName}}</view>
|
||||
<view>
|
||||
<text class="employee-name">{{employee.name}}</text>
|
||||
<text class="tag" style="background: {{employee.color}}; color: #fff;">员工色</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loadError}}" class="stats">
|
||||
<view class="card stat">
|
||||
<text class="stat-value">{{employee.monthOrders}}</text>
|
||||
<text class="stat-label">本月订单</text>
|
||||
</view>
|
||||
<view class="card stat">
|
||||
<text class="stat-value">¥{{employee.monthAmount}}</text>
|
||||
<text class="stat-label">本月营业额</text>
|
||||
</view>
|
||||
<view class="card stat">
|
||||
<text class="stat-value">¥{{employee.avgAmount}}</text>
|
||||
<text class="stat-label">平均客单价</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{!loadError}}" class="section">
|
||||
<view class="menu-grid">
|
||||
<view class="card menu-card" data-url="/pages/schedule-setting/index" bindtap="go">排班设置</view>
|
||||
<view class="card menu-card" data-url="/pages/leave-management/index" bindtap="go">请假管理</view>
|
||||
<view class="card menu-card" data-url="/pages/color-setting/index" bindtap="go">颜色设置</view>
|
||||
<view class="card menu-card" data-url="/pages/employee-orders/index" bindtap="go">订单记录</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,79 @@
|
||||
.employee-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
.detail-error {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
width: 180rpx;
|
||||
min-width: 180rpx;
|
||||
max-width: 180rpx;
|
||||
margin: 24rpx auto 0;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 94rpx;
|
||||
height: 94rpx;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.employee-name {
|
||||
display: block;
|
||||
margin-bottom: 12rpx;
|
||||
font-size: 34rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 14rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.stat {
|
||||
padding: 18rpx 12rpx;
|
||||
}
|
||||
|
||||
.stat-value,
|
||||
.stat-label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
margin-top: 8rpx;
|
||||
color: #91897f;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.menu-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.menu-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 148rpx;
|
||||
padding: 24rpx;
|
||||
color: #302c27;
|
||||
font-size: 30rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
Page({
|
||||
data: {
|
||||
orders: [
|
||||
{ id: 1, date: '2026-06-01', project: '纯色美甲', customer: '王女士', amount: 168 },
|
||||
{ id: 2, date: '2026-05-31', project: '猫眼延长', customer: '陈女士', amount: 268 },
|
||||
{ id: 3, date: '2026-05-30', project: '手部护理', customer: '林女士', amount: 98 }
|
||||
]
|
||||
},
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "订单记录"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<view class="page no-tab">
|
||||
<view class="list">
|
||||
<view wx:for="{{orders}}" wx:key="id" class="card list-card order-row">
|
||||
<view>
|
||||
<text class="order-title">{{item.project}}</text>
|
||||
<text class="muted">{{item.date}} · {{item.customer}}</text>
|
||||
</view>
|
||||
<text class="amount">¥{{item.amount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,17 @@
|
||||
.order-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.order-title {
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.amount {
|
||||
color: #6f8f83;
|
||||
font-weight: 900;
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
const employeesApi = require('../../api/employees')
|
||||
const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload')
|
||||
|
||||
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
|
||||
const DEFAULT_EMPLOYEE_PASSWORD = 'JayuCloud@123'
|
||||
|
||||
function buildScheduleSummary(item) {
|
||||
const mode = item.scheduleModeSummary || item.scheduleMode || '未设置'
|
||||
const time = item.scheduleTimeSummary || item.ruleTimeSummary || ''
|
||||
return time ? `${mode} ${time}` : mode
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
employees: [],
|
||||
loadError: '',
|
||||
createModalVisible: false,
|
||||
creating: false,
|
||||
createForm: {
|
||||
nickname: '',
|
||||
phone: '',
|
||||
account: '',
|
||||
password: DEFAULT_EMPLOYEE_PASSWORD,
|
||||
wechatId: '',
|
||||
avatar: '',
|
||||
avatarUrl: ''
|
||||
},
|
||||
avatarUploading: false
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.loadEmployees()
|
||||
},
|
||||
|
||||
async loadEmployees() {
|
||||
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),
|
||||
avatar: item.avatar || item.avatarUrl || '',
|
||||
color: EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
|
||||
monthOrders: item.monthOrders || item.orderCount || 0,
|
||||
monthAmount: item.monthAmount || item.turnover || 0,
|
||||
scheduleSummary: buildScheduleSummary(item)
|
||||
}))
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
employees: [],
|
||||
loadError: error.message || '美甲师列表加载失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
openDetail(event) {
|
||||
wx.navigateTo({ url: `/pages/employee-detail/index?id=${event.currentTarget.dataset.id}` })
|
||||
},
|
||||
|
||||
addEmployee() {
|
||||
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: DEFAULT_EMPLOYEE_PASSWORD,
|
||||
wechatId: '',
|
||||
avatar: '',
|
||||
avatarUrl: ''
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async chooseEmployeeAvatar() {
|
||||
if (this.data.avatarUploading || this.data.creating) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const filePath = await chooseImageFilePath()
|
||||
if (!filePath) {
|
||||
return
|
||||
}
|
||||
this.setData({ avatarUploading: true })
|
||||
const uploadResult = await uploadObjectFile(filePath)
|
||||
const avatarUrl = uploadResult.fileUrl || uploadResult.primaryUrl || filePath
|
||||
this.setData({
|
||||
'createForm.avatar': avatarUrl,
|
||||
'createForm.avatarUrl': avatarUrl
|
||||
})
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ avatarUploading: false })
|
||||
}
|
||||
},
|
||||
|
||||
removeEmployeeAvatar() {
|
||||
this.setData({
|
||||
'createForm.avatar': '',
|
||||
'createForm.avatarUrl': ''
|
||||
})
|
||||
},
|
||||
|
||||
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,
|
||||
avatar: form.avatar || undefined,
|
||||
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 })
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "员工"
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<view class="page">
|
||||
<view class="list-heading">
|
||||
<text>美甲师</text>
|
||||
<button class="compact-btn" bindtap="addEmployee">新增</button>
|
||||
</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 wx:if="{{item.avatar}}" class="avatar image-avatar">
|
||||
<image src="{{item.avatar}}" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view wx:else class="avatar" style="background: {{item.color}};">{{item.shortName}}</view>
|
||||
<view>
|
||||
<text class="employee-name">{{item.name}}</text>
|
||||
<text class="employee-schedule">{{item.scheduleSummary}}</text>
|
||||
<text class="employee-meta">本月 {{item.monthOrders}} 单 · ¥{{item.monthAmount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<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>
|
||||
<view class="modal-close" bindtap="closeCreateModal">×</view>
|
||||
</view>
|
||||
<view class="avatar-upload">
|
||||
<view wx:if="{{createForm.avatarUrl}}" class="avatar-preview image-avatar">
|
||||
<image src="{{createForm.avatarUrl}}" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view wx:else class="avatar-preview">头像</view>
|
||||
<button class="secondary-btn avatar-btn" loading="{{avatarUploading}}" bindtap="chooseEmployeeAvatar">上传头像</button>
|
||||
<button wx:if="{{createForm.avatarUrl}}" class="text-btn avatar-remove" bindtap="removeEmployeeAvatar">移除</button>
|
||||
</view>
|
||||
<view class="form-grid">
|
||||
<view class="modal-field">
|
||||
<text class="required-label">姓名</text>
|
||||
<input value="{{createForm.nickname}}" data-field="nickname" bindinput="onCreateInput" placeholder="请输入姓名" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text class="required-label">手机号</text>
|
||||
<input value="{{createForm.phone}}" data-field="phone" bindinput="onCreateInput" type="number" placeholder="请输入手机号" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text class="required-label">登录账号</text>
|
||||
<input value="{{createForm.account}}" data-field="account" bindinput="onCreateInput" placeholder="请输入账号" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text class="required-label">初始密码</text>
|
||||
<input value="{{createForm.password}}" data-field="password" bindinput="onCreateInput" password placeholder="请输入密码" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text class="required-label">微信号</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>
|
||||
@@ -0,0 +1,269 @@
|
||||
.list-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
width: 100%;
|
||||
margin-bottom: 16rpx;
|
||||
color: #4c4740;
|
||||
font-size: 28rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.list-heading text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.list-heading .compact-btn {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.employee-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 22rpx;
|
||||
animation: cardIn 180ms ease both;
|
||||
transition: transform 160ms ease, box-shadow 160ms ease;
|
||||
}
|
||||
|
||||
.employee-card:active {
|
||||
transform: scale(0.99);
|
||||
box-shadow: 0 6rpx 18rpx rgba(58, 48, 34, 0.08);
|
||||
}
|
||||
|
||||
.employee-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 78rpx;
|
||||
height: 78rpx;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image-avatar {
|
||||
background: #f0ece5;
|
||||
}
|
||||
|
||||
.image-avatar image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.employee-name,
|
||||
.employee-schedule,
|
||||
.employee-meta {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.employee-name {
|
||||
color: #25211d;
|
||||
font-size: 28rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.employee-meta {
|
||||
margin-top: 8rpx;
|
||||
color: #91897f;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.employee-schedule {
|
||||
margin-top: 6rpx;
|
||||
color: #55786d;
|
||||
font-size: 23rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.color-pill {
|
||||
width: 44rpx;
|
||||
height: 18rpx;
|
||||
border-radius: 999rpx;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
width: 180rpx;
|
||||
min-width: 180rpx;
|
||||
max-width: 180rpx;
|
||||
margin: 24rpx auto 0;
|
||||
}
|
||||
|
||||
.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);
|
||||
animation: maskIn 180ms ease both;
|
||||
}
|
||||
|
||||
.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);
|
||||
animation: modalUp 220ms ease both;
|
||||
}
|
||||
|
||||
.modal-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
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 {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 48rpx;
|
||||
min-width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
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);
|
||||
}
|
||||
|
||||
.avatar-upload {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 18rpx;
|
||||
padding: 18rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #f7efe7;
|
||||
}
|
||||
|
||||
.avatar-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 auto;
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 50%;
|
||||
background: #6f8f83;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.avatar-preview image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.avatar-btn {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.avatar-remove {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
@keyframes cardIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8rpx);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes maskIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes modalUp {
|
||||
from {
|
||||
transform: translateY(40rpx);
|
||||
}
|
||||
to {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
const dateUtil = require('../../utils/date')
|
||||
const planningApi = require('../../api/planning')
|
||||
const customersApi = require('../../api/customers')
|
||||
const employeesApi = require('../../api/employees')
|
||||
|
||||
const PREVIEW_SIZE = 10
|
||||
|
||||
function shortDateTime(value) {
|
||||
const text = String(value || '')
|
||||
return text.length > 16 ? text.slice(0, 16) : text || '-'
|
||||
}
|
||||
|
||||
function timeRange(item) {
|
||||
const start = String(item.startTime || '').slice(11, 16)
|
||||
const end = String(item.endTime || '').slice(11, 16)
|
||||
if (!start && !end) return '-'
|
||||
return `${start || '-'}-${end || '-'}`
|
||||
}
|
||||
|
||||
function scheduleSummary(item) {
|
||||
const mode = item.scheduleModeSummary || item.scheduleMode || ''
|
||||
const time = item.scheduleTimeSummary || item.ruleTimeSummary || ''
|
||||
return [mode, time].filter(Boolean).join(' ') || '未设置'
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
types: ['订单数据', '客户数据', '员工数据'],
|
||||
type: '订单数据',
|
||||
startDate: dateUtil.formatDate(dateUtil.startOfMonth(new Date())),
|
||||
endDate: dateUtil.formatDate(new Date()),
|
||||
previewColumns: [],
|
||||
previewRows: [],
|
||||
previewLoading: false,
|
||||
previewError: ''
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.loadPreview()
|
||||
},
|
||||
|
||||
onTypeChange(event) {
|
||||
this.setData({ type: this.data.types[Number(event.detail.value)] }, () => this.loadPreview())
|
||||
},
|
||||
|
||||
onStartDate(event) {
|
||||
this.setData({ startDate: event.detail.value }, () => this.loadPreview())
|
||||
},
|
||||
|
||||
onEndDate(event) {
|
||||
this.setData({ endDate: event.detail.value }, () => this.loadPreview())
|
||||
},
|
||||
|
||||
async loadPreview() {
|
||||
this.setData({ previewLoading: true, previewError: '' })
|
||||
try {
|
||||
if (this.data.type === '客户数据') {
|
||||
await this.loadCustomerPreview()
|
||||
} else if (this.data.type === '员工数据') {
|
||||
await this.loadEmployeePreview()
|
||||
} else {
|
||||
await this.loadOrderPreview()
|
||||
}
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
previewRows: [],
|
||||
previewError: error.message || '预览数据加载失败'
|
||||
})
|
||||
} finally {
|
||||
this.setData({ previewLoading: false })
|
||||
}
|
||||
},
|
||||
|
||||
async loadOrderPreview() {
|
||||
const data = await planningApi.calendar({
|
||||
startDate: this.data.startDate,
|
||||
endDate: this.data.endDate
|
||||
})
|
||||
const rows = (data.appointments || []).slice(0, PREVIEW_SIZE).map((item, index) => ({
|
||||
key: `order-${item.orderItemId || index}`,
|
||||
date: item.date || String(item.startTime || '').slice(0, 10) || '-',
|
||||
customer: item.customerName || '到店客户',
|
||||
product: item.productTitle || '预约作品',
|
||||
artist: item.artistName || '未分配',
|
||||
time: timeRange(item),
|
||||
status: item.statusText || '-'
|
||||
}))
|
||||
this.setData({
|
||||
previewColumns: ['日期', '客户', '项目', '美甲师', '时间', '状态'],
|
||||
previewRows: rows
|
||||
})
|
||||
},
|
||||
|
||||
async loadCustomerPreview() {
|
||||
const data = await customersApi.list({ page: 1, size: PREVIEW_SIZE })
|
||||
const list = data.list || data || []
|
||||
const rows = list.slice(0, PREVIEW_SIZE).map((item, index) => ({
|
||||
key: `customer-${item.id || index}`,
|
||||
name: item.nickname || item.name || item.account || '客户',
|
||||
phone: item.contactPhone || item.phone || '-',
|
||||
lastTime: shortDateTime(item.lastOrderTime || item.lastConsumeTime)
|
||||
}))
|
||||
this.setData({
|
||||
previewColumns: ['客户', '手机号', '最近时间'],
|
||||
previewRows: rows
|
||||
})
|
||||
},
|
||||
|
||||
async loadEmployeePreview() {
|
||||
const data = await employeesApi.list()
|
||||
const list = data.list || data || []
|
||||
const rows = list.slice(0, PREVIEW_SIZE).map((item, index) => ({
|
||||
key: `employee-${item.id || item.userId || index}`,
|
||||
name: item.nickname || item.name || item.artistName || '美甲师',
|
||||
phone: item.phone || item.contactPhone || '-',
|
||||
schedule: scheduleSummary(item),
|
||||
status: Number(item.status) === 0 ? '停用' : '启用'
|
||||
}))
|
||||
this.setData({
|
||||
previewColumns: ['员工', '手机号', '排班', '状态'],
|
||||
previewRows: rows
|
||||
})
|
||||
},
|
||||
|
||||
exportExcel() { wx.showToast({ title: '导出任务已创建', icon: 'none' }) },
|
||||
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "数据导出"
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card form-card">
|
||||
<view class="field"><text class="field-label">导出类型</text><picker range="{{types}}" bindchange="onTypeChange"><view class="field-value">{{type}}</view></picker></view>
|
||||
<view class="field"><text class="field-label">开始日期</text><picker mode="date" value="{{startDate}}" bindchange="onStartDate"><view class="field-value">{{startDate}}</view></picker></view>
|
||||
<view class="field"><text class="field-label">结束日期</text><picker mode="date" value="{{endDate}}" bindchange="onEndDate"><view class="field-value">{{endDate}}</view></picker></view>
|
||||
</view>
|
||||
<view class="card preview-card">
|
||||
<view class="preview-head">
|
||||
<text class="preview-title">数据预览</text>
|
||||
<text class="preview-sub">最多展示 10 条</text>
|
||||
</view>
|
||||
<view wx:if="{{previewLoading}}" class="preview-empty">预览加载中...</view>
|
||||
<view wx:elif="{{previewError}}" class="preview-empty error">{{previewError}}</view>
|
||||
<view wx:elif="{{previewRows.length === 0}}" class="preview-empty">暂无可预览数据</view>
|
||||
<scroll-view wx:else class="preview-scroll" scroll-x>
|
||||
<view class="preview-table">
|
||||
<view class="preview-row preview-row-head">
|
||||
<text wx:for="{{previewColumns}}" wx:key="*this" class="preview-cell">{{item}}</text>
|
||||
</view>
|
||||
<view wx:for="{{previewRows}}" wx:key="key" class="preview-row">
|
||||
<block wx:if="{{type === '订单数据'}}">
|
||||
<text class="preview-cell">{{item.date}}</text>
|
||||
<text class="preview-cell">{{item.customer}}</text>
|
||||
<text class="preview-cell">{{item.product}}</text>
|
||||
<text class="preview-cell">{{item.artist}}</text>
|
||||
<text class="preview-cell">{{item.time}}</text>
|
||||
<text class="preview-cell">{{item.status}}</text>
|
||||
</block>
|
||||
<block wx:elif="{{type === '客户数据'}}">
|
||||
<text class="preview-cell">{{item.name}}</text>
|
||||
<text class="preview-cell">{{item.phone}}</text>
|
||||
<text class="preview-cell">{{item.lastTime}}</text>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<text class="preview-cell">{{item.name}}</text>
|
||||
<text class="preview-cell">{{item.phone}}</text>
|
||||
<text class="preview-cell">{{item.schedule}}</text>
|
||||
<text class="preview-cell">{{item.status}}</text>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" bindtap="exportExcel">导出 Excel</button></view>
|
||||
</view>
|
||||
@@ -0,0 +1,76 @@
|
||||
|
||||
.preview-card {
|
||||
margin-top: 18rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.preview-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.preview-title {
|
||||
color: #302c27;
|
||||
font-size: 28rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.preview-sub {
|
||||
color: #9a9288;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.preview-empty {
|
||||
padding: 36rpx 0;
|
||||
color: #9a9288;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.preview-empty.error {
|
||||
color: #b25a43;
|
||||
}
|
||||
|
||||
.preview-scroll {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.preview-table {
|
||||
min-width: 920rpx;
|
||||
}
|
||||
|
||||
.preview-row {
|
||||
display: flex;
|
||||
min-height: 58rpx;
|
||||
border-bottom: 1rpx solid #eee8df;
|
||||
}
|
||||
|
||||
.preview-row:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.preview-row-head {
|
||||
border-radius: 8rpx;
|
||||
background: #f4f0ea;
|
||||
}
|
||||
|
||||
.preview-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 150rpx;
|
||||
min-width: 150rpx;
|
||||
padding: 0 12rpx;
|
||||
overflow: hidden;
|
||||
color: #5e564d;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.35;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.preview-row-head .preview-cell {
|
||||
color: #302c27;
|
||||
font-weight: 800;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
Page({
|
||||
data: {
|
||||
days: Array.from({ length: 31 }).map((_, index) => ({ day: index + 1, rest: [12, 25].includes(index + 1) })),
|
||||
records: [
|
||||
{ date: '2026-06-12', text: '全天请假' },
|
||||
{ date: '2026-06-25', text: '下午请假' }
|
||||
]
|
||||
},
|
||||
add() { wx.showToast({ title: '请选择日期后保存', icon: 'none' }) },
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "请假管理"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card mini-calendar">
|
||||
<view wx:for="{{days}}" wx:key="date" class="mini-day {{item.rest ? 'rest' : ''}}">{{item.day}}</view>
|
||||
</view>
|
||||
<view class="section">
|
||||
<view class="section-title">请假记录</view>
|
||||
<view class="list">
|
||||
<view wx:for="{{records}}" wx:key="date" class="card list-card">{{item.date}} {{item.text}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" bindtap="add">新增请假</button></view>
|
||||
</view>
|
||||
@@ -0,0 +1,22 @@
|
||||
.mini-calendar {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
gap: 10rpx;
|
||||
padding: 18rpx;
|
||||
}
|
||||
|
||||
.mini-day {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 64rpx;
|
||||
border-radius: 10rpx;
|
||||
background: #f2ede7;
|
||||
color: #5d564e;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.mini-day.rest {
|
||||
background: #e7f0f6;
|
||||
color: #6e9fbd;
|
||||
}
|
||||
@@ -0,0 +1,462 @@
|
||||
const authApi = require('../../api/auth')
|
||||
const { BRAND_CONFIG } = require('../../utils/config')
|
||||
|
||||
const PHONE_REGEX = /^1[3-9]\d{9}$/
|
||||
const LOGIN_PREFERENCE_KEY = 'jayu_salon_login_preference'
|
||||
|
||||
function buildSession(data) {
|
||||
const userInfo = data.userInfo || data.user || {}
|
||||
return {
|
||||
...data,
|
||||
accessToken: data.accessToken || data.token,
|
||||
userInfo,
|
||||
shopName: data.shopName || userInfo.shopName || (data.shop && data.shop.shopName)
|
||||
}
|
||||
}
|
||||
|
||||
function getSelectableShopIds(session) {
|
||||
const userInfo = session.userInfo || {}
|
||||
if (Array.isArray(userInfo.shopIds)) {
|
||||
return userInfo.shopIds
|
||||
}
|
||||
return Array.isArray(session.shopIds) ? session.shopIds : []
|
||||
}
|
||||
|
||||
function getSelectableShopNames(session) {
|
||||
const userInfo = session.userInfo || {}
|
||||
if (Array.isArray(userInfo.shopNames)) {
|
||||
return userInfo.shopNames
|
||||
}
|
||||
return Array.isArray(session.shopNames) ? session.shopNames : []
|
||||
}
|
||||
|
||||
function buildShopOptions(session) {
|
||||
const shopIds = getSelectableShopIds(session)
|
||||
const shopNames = getSelectableShopNames(session)
|
||||
return shopIds.map((shopId, index) => ({
|
||||
id: shopId,
|
||||
name: shopNames[index] || `店铺 ${shopId}`
|
||||
}))
|
||||
}
|
||||
|
||||
function buildShopOptionsFromSelection(selection) {
|
||||
const shops = selection && Array.isArray(selection.shops) ? selection.shops : []
|
||||
return shops.map(shop => ({
|
||||
id: shop.id,
|
||||
name: shop.shopName || shop.name || `店铺 ${shop.id}`,
|
||||
description: selection && selection.message ? selection.message : ''
|
||||
}))
|
||||
}
|
||||
|
||||
function isShopSelectionRequiredError(error) {
|
||||
const message = error && error.message ? error.message : ''
|
||||
return message.indexOf('选择店铺') !== -1 || message.indexOf('请选择店铺') !== -1 || message.indexOf('请选择登录店铺') !== -1
|
||||
}
|
||||
|
||||
function assertShopSession(session) {
|
||||
const userInfo = session.userInfo || {}
|
||||
if (!userInfo.shopId) {
|
||||
throw new Error('请选择店铺后再进入店务端')
|
||||
}
|
||||
return session
|
||||
}
|
||||
|
||||
function getLoginPreference() {
|
||||
try {
|
||||
return wx.getStorageSync(LOGIN_PREFERENCE_KEY) || {}
|
||||
} catch (error) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
function setLoginPreference(preference) {
|
||||
wx.setStorageSync(LOGIN_PREFERENCE_KEY, preference || {})
|
||||
}
|
||||
|
||||
function clearLoginPreference() {
|
||||
wx.removeStorageSync(LOGIN_PREFERENCE_KEY)
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
loginMode: 'phone',
|
||||
form: {
|
||||
account: '',
|
||||
password: '',
|
||||
phone: '',
|
||||
code: ''
|
||||
},
|
||||
loading: false,
|
||||
codeLoading: false,
|
||||
countdown: 0,
|
||||
countdownTimer: null,
|
||||
agreementAccepted: false,
|
||||
agreementLoading: false,
|
||||
agreementError: '',
|
||||
agreementModalVisible: false,
|
||||
selectedAgreement: null,
|
||||
rememberMe: false,
|
||||
agreements: [],
|
||||
appName: BRAND_CONFIG.appName,
|
||||
shopSelectVisible: false,
|
||||
shopSelectMode: '',
|
||||
shopOptions: [],
|
||||
switchingShop: false
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
const preference = getLoginPreference()
|
||||
if (preference.rememberMe) {
|
||||
this.setData({
|
||||
loginMode: preference.loginMode === 'password' ? 'password' : 'phone',
|
||||
rememberMe: true,
|
||||
'form.account': preference.account || '',
|
||||
'form.phone': preference.phone || ''
|
||||
})
|
||||
}
|
||||
this.loadAgreements()
|
||||
},
|
||||
|
||||
onInput(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
this.setData({
|
||||
[`form.${field}`]: event.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
switchLoginMode(event) {
|
||||
const loginMode = event.currentTarget.dataset.mode
|
||||
if (loginMode === this.data.loginMode) {
|
||||
return
|
||||
}
|
||||
this.setData({ loginMode })
|
||||
},
|
||||
|
||||
async sendLoginCode() {
|
||||
const phone = String(this.data.form.phone || '').trim()
|
||||
if (!PHONE_REGEX.test(phone)) {
|
||||
wx.showToast({ title: '请输入正确手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (this.data.codeLoading || this.data.countdown > 0) {
|
||||
return
|
||||
}
|
||||
this.setData({ codeLoading: true })
|
||||
try {
|
||||
await authApi.sendLoginCode(phone)
|
||||
wx.showToast({ title: '验证码已发送' })
|
||||
this.startCountdown()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '验证码发送失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ codeLoading: false })
|
||||
}
|
||||
},
|
||||
|
||||
async loadAgreements() {
|
||||
if (this.data.agreements.length) {
|
||||
return this.data.agreements
|
||||
}
|
||||
if (this.data.agreementLoading) {
|
||||
return this.data.agreements
|
||||
}
|
||||
this.setData({ agreementLoading: true, agreementError: '' })
|
||||
try {
|
||||
const agreements = await authApi.getCurrentAgreements()
|
||||
const normalizedAgreements = Array.isArray(agreements) ? agreements : []
|
||||
this.setData({ agreements: normalizedAgreements })
|
||||
return normalizedAgreements
|
||||
} catch (error) {
|
||||
const agreementError = error.message || '协议内容加载失败,请稍后重试'
|
||||
this.setData({ agreementError })
|
||||
return []
|
||||
} finally {
|
||||
this.setData({ agreementLoading: false })
|
||||
}
|
||||
},
|
||||
|
||||
toggleAgreement() {
|
||||
this.setData({
|
||||
agreementAccepted: !this.data.agreementAccepted
|
||||
})
|
||||
},
|
||||
|
||||
async openAgreement(event) {
|
||||
const type = event.currentTarget.dataset.type
|
||||
const agreements = await this.loadAgreements()
|
||||
const selectedAgreement = agreements.find(item => item.agreementType === type)
|
||||
if (!selectedAgreement) {
|
||||
wx.showToast({ title: this.data.agreementError || '协议内容暂不可用', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
selectedAgreement,
|
||||
agreementModalVisible: true
|
||||
})
|
||||
},
|
||||
|
||||
closeAgreementModal() {
|
||||
this.setData({
|
||||
agreementModalVisible: false,
|
||||
selectedAgreement: null
|
||||
})
|
||||
},
|
||||
|
||||
stopTap() {
|
||||
},
|
||||
|
||||
toggleRememberMe() {
|
||||
const rememberMe = !this.data.rememberMe
|
||||
this.setData({ rememberMe })
|
||||
if (!rememberMe) {
|
||||
clearLoginPreference()
|
||||
}
|
||||
},
|
||||
|
||||
saveLoginPreference() {
|
||||
if (!this.data.rememberMe) {
|
||||
clearLoginPreference()
|
||||
return
|
||||
}
|
||||
const form = this.data.form
|
||||
setLoginPreference({
|
||||
rememberMe: true,
|
||||
loginMode: this.data.loginMode,
|
||||
account: String(form.account || '').trim(),
|
||||
phone: String(form.phone || '').trim()
|
||||
})
|
||||
},
|
||||
|
||||
buildAgreementPayload() {
|
||||
const agreementVersions = {}
|
||||
;(this.data.agreements || []).forEach(item => {
|
||||
if (item && item.agreementType && item.version) {
|
||||
agreementVersions[item.agreementType] = item.version
|
||||
}
|
||||
})
|
||||
return {
|
||||
agreementAccepted: !!this.data.agreementAccepted,
|
||||
agreementVersions,
|
||||
clientType: 'WECHAT_MINI'
|
||||
}
|
||||
},
|
||||
|
||||
ensureAgreementAccepted() {
|
||||
if (!this.data.agreementAccepted) {
|
||||
wx.showToast({ title: '请先阅读并同意用户协议和隐私政策', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
const versions = this.buildAgreementPayload().agreementVersions
|
||||
if (!versions.USER_TERMS || !versions.PRIVACY_POLICY) {
|
||||
wx.showToast({ title: this.data.agreementError || '协议版本加载中,请稍后再试', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
|
||||
async resolveLoginSession(data) {
|
||||
const session = buildSession(data)
|
||||
const userInfo = session.userInfo || {}
|
||||
if (userInfo.shopId) {
|
||||
return session
|
||||
}
|
||||
const shopOptions = buildShopOptions(session)
|
||||
if (!shopOptions.length) {
|
||||
throw new Error('当前账号没有可用店铺,无法进入店务端')
|
||||
}
|
||||
if (shopOptions.length === 1) {
|
||||
return this.loginForShop(shopOptions[0].id)
|
||||
}
|
||||
this.setData({
|
||||
shopOptions,
|
||||
shopSelectVisible: true,
|
||||
shopSelectMode: 'login'
|
||||
})
|
||||
return null
|
||||
},
|
||||
|
||||
buildLoginRequestData(shopId) {
|
||||
const form = this.data.form
|
||||
if (this.data.loginMode === 'phone') {
|
||||
return {
|
||||
phone: String(form.phone || '').trim(),
|
||||
verificationCode: String(form.code || '').trim(),
|
||||
rememberMe: !!this.data.rememberMe,
|
||||
...this.buildAgreementPayload(),
|
||||
...(shopId ? { shopId } : {})
|
||||
}
|
||||
}
|
||||
return {
|
||||
account: form.account,
|
||||
password: form.password,
|
||||
rememberMe: !!this.data.rememberMe,
|
||||
...this.buildAgreementPayload(),
|
||||
...(shopId ? { shopId } : {})
|
||||
}
|
||||
},
|
||||
|
||||
requestLogin(shopId) {
|
||||
const data = this.buildLoginRequestData(shopId)
|
||||
return this.data.loginMode === 'phone'
|
||||
? authApi.phoneLogin(data)
|
||||
: authApi.login(data)
|
||||
},
|
||||
|
||||
async loginForShop(shopId) {
|
||||
return assertShopSession(buildSession(await this.requestLogin(shopId)))
|
||||
},
|
||||
|
||||
async loadLoginShopOptions() {
|
||||
const form = this.data.form
|
||||
const selection = this.data.loginMode === 'phone'
|
||||
? await authApi.getPhoneLoginShops(String(form.phone || '').trim())
|
||||
: await authApi.getLoginShops(String(form.account || '').trim())
|
||||
const shopOptions = buildShopOptionsFromSelection(selection)
|
||||
if (!shopOptions.length) {
|
||||
throw new Error((selection && selection.message) || '当前账号没有可用店铺,无法进入店务端')
|
||||
}
|
||||
return shopOptions
|
||||
},
|
||||
|
||||
async openLoginShopSelector() {
|
||||
const shopOptions = await this.loadLoginShopOptions()
|
||||
this.setData({
|
||||
shopOptions,
|
||||
shopSelectVisible: true,
|
||||
shopSelectMode: 'login'
|
||||
})
|
||||
},
|
||||
|
||||
closeShopSelector() {
|
||||
this.setData({
|
||||
shopOptions: [],
|
||||
shopSelectMode: '',
|
||||
shopSelectVisible: false
|
||||
})
|
||||
},
|
||||
|
||||
async tryOpenLoginShopSelector() {
|
||||
try {
|
||||
await this.openLoginShopSelector()
|
||||
return true
|
||||
} catch (error) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
async selectLoginShop(event) {
|
||||
if (this.data.switchingShop) {
|
||||
return
|
||||
}
|
||||
const shopId = event.currentTarget.dataset.id
|
||||
if (!shopId) {
|
||||
wx.showToast({ title: '请选择店铺', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ switchingShop: true })
|
||||
try {
|
||||
if (this.data.shopSelectMode === 'login') {
|
||||
await this.loginWithSelectedShop(shopId)
|
||||
} else {
|
||||
await this.switchSelectedShop(shopId)
|
||||
}
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '进入店铺失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ switchingShop: false })
|
||||
}
|
||||
},
|
||||
|
||||
async loginWithSelectedShop(shopId) {
|
||||
const session = await this.loginForShop(shopId)
|
||||
const app = getApp()
|
||||
app.setSession(session)
|
||||
this.saveLoginPreference()
|
||||
this.closeShopSelector()
|
||||
wx.reLaunch({ url: '/pages/planning/index' })
|
||||
},
|
||||
|
||||
async switchSelectedShop(shopId) {
|
||||
const session = buildSession(await authApi.switchShop(shopId))
|
||||
const app = getApp()
|
||||
app.setSession(session)
|
||||
this.closeShopSelector()
|
||||
wx.reLaunch({ url: '/pages/planning/index' })
|
||||
},
|
||||
|
||||
startCountdown() {
|
||||
if (this.data.countdownTimer) {
|
||||
clearInterval(this.data.countdownTimer)
|
||||
}
|
||||
this.setData({ countdown: 60 })
|
||||
const timer = setInterval(() => {
|
||||
const next = this.data.countdown - 1
|
||||
if (next <= 0) {
|
||||
clearInterval(timer)
|
||||
this.setData({ countdown: 0, countdownTimer: null })
|
||||
return
|
||||
}
|
||||
this.setData({ countdown: next })
|
||||
}, 1000)
|
||||
this.setData({ countdownTimer: timer })
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
if (this.data.countdownTimer) {
|
||||
clearInterval(this.data.countdownTimer)
|
||||
}
|
||||
},
|
||||
|
||||
async submit() {
|
||||
if (this.data.loading) {
|
||||
return
|
||||
}
|
||||
const form = this.data.form
|
||||
if (this.data.loginMode === 'password' && (!form.account || !form.password)) {
|
||||
wx.showToast({ title: '请填写账号和密码', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (this.data.loginMode === 'phone' && (!PHONE_REGEX.test(String(form.phone || '').trim()) || !String(form.code || '').trim())) {
|
||||
wx.showToast({ title: '请输入正确手机号和验证码', icon: 'none' })
|
||||
return
|
||||
}
|
||||
await this.loadAgreements()
|
||||
if (!this.ensureAgreementAccepted()) {
|
||||
return
|
||||
}
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
const app = getApp()
|
||||
const data = await this.requestLogin('')
|
||||
const session = await this.resolveLoginSession(data)
|
||||
if (!session) {
|
||||
return
|
||||
}
|
||||
app.setSession(assertShopSession(session))
|
||||
this.saveLoginPreference()
|
||||
wx.reLaunch({ url: '/pages/planning/index' })
|
||||
} catch (error) {
|
||||
if (isShopSelectionRequiredError(error) || await this.tryOpenLoginShopSelector()) {
|
||||
try {
|
||||
if (!this.data.shopSelectVisible) {
|
||||
await this.openLoginShopSelector()
|
||||
}
|
||||
} catch (shopError) {
|
||||
wx.showToast({ title: shopError.message || '店铺列表加载失败', icon: 'none' })
|
||||
}
|
||||
return
|
||||
}
|
||||
wx.showToast({ title: error.message || '登录失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
goRegister() {
|
||||
wx.navigateTo({ url: '/pages/register/index' })
|
||||
},
|
||||
|
||||
wechatLogin() {
|
||||
wx.showToast({ title: '请先使用账号登录', icon: 'none' })
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "登录"
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<view class="page no-tab auth-page">
|
||||
<view class="brand">
|
||||
<image class="logo" src="/assets/images/app-icon.png" mode="aspectFill"></image>
|
||||
<text class="brand-name">{{appName}}</text>
|
||||
<text class="brand-sub">美甲店预约排班管理</text>
|
||||
</view>
|
||||
|
||||
<view class="card auth-card">
|
||||
<view class="mode-tabs">
|
||||
<view class="mode-tab {{loginMode === 'password' ? 'active' : ''}}" data-mode="password" bindtap="switchLoginMode">密码登录</view>
|
||||
<view class="mode-tab {{loginMode === 'phone' ? 'active' : ''}}" data-mode="phone" bindtap="switchLoginMode">验证码登录</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{loginMode === 'password'}}" class="field">
|
||||
<text class="field-label">账号</text>
|
||||
<input value="{{form.account}}" data-field="account" bindinput="onInput" placeholder="请输入账号" />
|
||||
</view>
|
||||
<view wx:if="{{loginMode === 'password'}}" class="field">
|
||||
<text class="field-label">密码</text>
|
||||
<input value="{{form.password}}" data-field="password" bindinput="onInput" password placeholder="请输入密码" />
|
||||
</view>
|
||||
<view wx:if="{{loginMode === 'phone'}}" class="field">
|
||||
<text class="field-label">手机号</text>
|
||||
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" type="number" placeholder="请输入手机号" />
|
||||
</view>
|
||||
<view wx:if="{{loginMode === 'phone'}}" class="field">
|
||||
<text class="field-label">验证码</text>
|
||||
<view class="code-row">
|
||||
<input class="code-input" value="{{form.code}}" data-field="code" bindinput="onInput" type="number" placeholder="请输入验证码" />
|
||||
<button class="code-btn" loading="{{codeLoading}}" disabled="{{codeLoading || countdown > 0}}" bindtap="sendLoginCode">
|
||||
{{countdown > 0 ? countdown + 's' : '获取验证码'}}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="agreement-row" bindtap="toggleAgreement">
|
||||
<view class="agreement-check {{agreementAccepted ? 'checked' : ''}}">{{agreementAccepted ? '✓' : ''}}</view>
|
||||
<view class="agreement-copy">
|
||||
<text>我已阅读并同意</text>
|
||||
<text class="agreement-link" data-type="USER_TERMS" catchtap="openAgreement">《用户协议》</text>
|
||||
<text>和</text>
|
||||
<text class="agreement-link" data-type="PRIVACY_POLICY" catchtap="openAgreement">《隐私政策》</text>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{agreementError}}" class="agreement-error" bindtap="loadAgreements">{{agreementError}},点此重试</view>
|
||||
<view class="remember-row" bindtap="toggleRememberMe">
|
||||
<view class="agreement-check {{rememberMe ? 'checked' : ''}}">{{rememberMe ? '✓' : ''}}</view>
|
||||
<view class="agreement-copy">记住我,保持登录更久</view>
|
||||
</view>
|
||||
<button class="primary-btn login-btn {{agreementAccepted ? '' : 'disabled'}}" loading="{{loading}}" disabled="{{loading || agreementLoading}}" bindtap="submit">{{agreementLoading ? '协议加载中...' : '登录'}}</button>
|
||||
<view class="auth-links">
|
||||
<button class="text-btn">忘记密码</button>
|
||||
<button class="text-btn" bindtap="goRegister">注册账号</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button class="secondary-btn wechat-btn" bindtap="wechatLogin">微信快捷登录</button>
|
||||
|
||||
<view wx:if="{{shopSelectVisible}}" class="shop-select-mask">
|
||||
<view class="shop-select-dialog">
|
||||
<view class="shop-select-header">
|
||||
<text class="shop-select-title">选择店铺</text>
|
||||
<text class="shop-select-subtitle">请选择本次登录的店铺</text>
|
||||
</view>
|
||||
<scroll-view class="shop-option-list" scroll-y>
|
||||
<view
|
||||
wx:for="{{shopOptions}}"
|
||||
wx:key="id"
|
||||
class="shop-option {{switchingShop ? 'disabled' : ''}}"
|
||||
data-id="{{item.id}}"
|
||||
bindtap="selectLoginShop"
|
||||
>
|
||||
<view class="shop-option-icon">店</view>
|
||||
<view class="shop-option-copy">
|
||||
<text class="shop-option-name">{{item.name}}</text>
|
||||
<text class="shop-option-id">{{item.description || ('ID ' + item.id)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view wx:if="{{switchingShop}}" class="shop-switching">正在进入店铺...</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{agreementModalVisible}}" class="agreement-mask" catchtouchmove="stopTap">
|
||||
<view class="agreement-modal">
|
||||
<view class="agreement-modal-title">{{selectedAgreement.title || '协议详情'}}</view>
|
||||
<view class="agreement-modal-meta">版本:{{selectedAgreement.version || '-'}}</view>
|
||||
<scroll-view class="agreement-modal-body" scroll-y>
|
||||
<text>{{selectedAgreement.content || '暂无协议内容'}}</text>
|
||||
</scroll-view>
|
||||
<button class="primary-btn agreement-modal-close" bindtap="closeAgreementModal">我知道了</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,307 @@
|
||||
.auth-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
padding-top: 12rpx;
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
border-radius: 30rpx;
|
||||
background: #e5eee9;
|
||||
box-shadow: 0 16rpx 34rpx rgba(111, 143, 131, 0.24);
|
||||
}
|
||||
|
||||
.brand-name {
|
||||
margin-top: 24rpx;
|
||||
color: #24211d;
|
||||
font-size: 42rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.brand-sub {
|
||||
margin-top: 8rpx;
|
||||
color: #938c83;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.auth-card {
|
||||
padding: 12rpx 24rpx 26rpx;
|
||||
}
|
||||
|
||||
.mode-tabs {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12rpx;
|
||||
margin: 12rpx 0 10rpx;
|
||||
padding: 8rpx;
|
||||
border-radius: 12px;
|
||||
background: #f3eee7;
|
||||
}
|
||||
|
||||
.mode-tab {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 64rpx;
|
||||
border-radius: 10px;
|
||||
color: #766f66;
|
||||
font-size: 24rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.mode-tab.active {
|
||||
background: #fffdf8;
|
||||
color: #55786d;
|
||||
box-shadow: 0 8rpx 18rpx rgba(58, 48, 34, 0.08);
|
||||
}
|
||||
|
||||
.code-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.code-input {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.code-btn {
|
||||
width: 160rpx;
|
||||
min-width: 160rpx;
|
||||
max-width: 160rpx;
|
||||
height: 56rpx;
|
||||
padding: 0;
|
||||
color: #6f8f83;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.agreement-row,
|
||||
.remember-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14rpx;
|
||||
margin-top: 22rpx;
|
||||
color: #736c63;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.remember-row {
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.agreement-check {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 34rpx;
|
||||
min-width: 34rpx;
|
||||
height: 34rpx;
|
||||
border: 1rpx solid #bfb7ad;
|
||||
border-radius: 8rpx;
|
||||
color: #fffdf8;
|
||||
font-size: 22rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.agreement-check.checked {
|
||||
border-color: #6f8f83;
|
||||
background: #6f8f83;
|
||||
}
|
||||
|
||||
.agreement-copy {
|
||||
flex: 1;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.agreement-link {
|
||||
color: #55786d;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.agreement-error {
|
||||
margin-top: 16rpx;
|
||||
color: #c36a6a;
|
||||
font-size: 23rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.login-btn.disabled {
|
||||
opacity: 0.56;
|
||||
}
|
||||
|
||||
.auth-links {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.wechat-btn {
|
||||
margin-top: 34rpx;
|
||||
}
|
||||
|
||||
.shop-select-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 48rpx;
|
||||
background: rgba(36, 33, 29, 0.38);
|
||||
}
|
||||
|
||||
.shop-select-dialog {
|
||||
width: 100%;
|
||||
max-height: 76vh;
|
||||
padding: 28rpx;
|
||||
border-radius: 8px;
|
||||
background: #fffdf8;
|
||||
box-shadow: 0 24rpx 64rpx rgba(58, 48, 34, 0.18);
|
||||
}
|
||||
|
||||
.shop-select-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
margin-bottom: 22rpx;
|
||||
}
|
||||
|
||||
.shop-select-title {
|
||||
color: #24211d;
|
||||
font-size: 32rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.shop-select-subtitle {
|
||||
color: #928a80;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.shop-option-list {
|
||||
max-height: 520rpx;
|
||||
}
|
||||
|
||||
.shop-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18rpx;
|
||||
min-height: 112rpx;
|
||||
margin-bottom: 14rpx;
|
||||
padding: 18rpx;
|
||||
border: 1rpx solid #ece3d7;
|
||||
border-radius: 8px;
|
||||
background: #fbf7f0;
|
||||
}
|
||||
|
||||
.shop-option.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.shop-option-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 72rpx;
|
||||
min-width: 72rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 8px;
|
||||
background: #e5eee9;
|
||||
color: #55786d;
|
||||
font-size: 26rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.shop-option-copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.shop-option-name {
|
||||
color: #2f2a25;
|
||||
font-size: 28rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.shop-option-id {
|
||||
color: #9a9288;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.shop-switching {
|
||||
margin-top: 12rpx;
|
||||
color: #6f8f83;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.agreement-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 90;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 28rpx;
|
||||
background: rgba(36, 33, 29, 0.42);
|
||||
}
|
||||
|
||||
.agreement-modal {
|
||||
width: 100%;
|
||||
max-height: 82vh;
|
||||
padding: 30rpx 28rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #fffdf8;
|
||||
box-shadow: 0 24rpx 64rpx rgba(58, 48, 34, 0.18);
|
||||
}
|
||||
|
||||
.agreement-modal-title {
|
||||
color: #24211d;
|
||||
font-size: 32rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.agreement-modal-meta {
|
||||
margin-top: 10rpx;
|
||||
color: #928a80;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.agreement-modal-body {
|
||||
height: 640rpx;
|
||||
max-height: 56vh;
|
||||
margin-top: 22rpx;
|
||||
padding: 20rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #f3eee7;
|
||||
color: #2f2a25;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.85;
|
||||
}
|
||||
|
||||
.agreement-modal-close {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
Page({
|
||||
data: { form: { oldPassword: '', newPassword: '', confirmPassword: '' } },
|
||||
onInput(event) { this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) },
|
||||
save() {
|
||||
if (this.data.form.newPassword !== this.data.form.confirmPassword) {
|
||||
wx.showToast({ title: '两次密码不一致', icon: 'none' })
|
||||
return
|
||||
}
|
||||
wx.showToast({ title: '已提交' })
|
||||
},
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "修改密码"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card form-card">
|
||||
<view class="field"><text class="field-label">原密码</text><input password value="{{form.oldPassword}}" data-field="oldPassword" bindinput="onInput" /></view>
|
||||
<view class="field"><text class="field-label">新密码</text><input password value="{{form.newPassword}}" data-field="newPassword" bindinput="onInput" /></view>
|
||||
<view class="field"><text class="field-label">确认密码</text><input password value="{{form.confirmPassword}}" data-field="confirmPassword" bindinput="onInput" /></view>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" bindtap="save">保存密码</button></view>
|
||||
</view>
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,422 @@
|
||||
const planningApi = require('../../api/planning')
|
||||
const dateUtil = require('../../utils/date')
|
||||
|
||||
function canCreateAppointment() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
return Number(userInfo.type) !== 3
|
||||
}
|
||||
|
||||
function resolveCalendarErrorMessage(error) {
|
||||
return error && error.message ? error.message : '规划数据加载失败'
|
||||
}
|
||||
|
||||
function toLocalDate(value) {
|
||||
return value instanceof Date ? new Date(value.getTime()) : new Date(String(value).replace(/-/g, '/'))
|
||||
}
|
||||
|
||||
function formatMonthDay(value) {
|
||||
const target = toLocalDate(value)
|
||||
return `${target.getMonth() + 1}月${target.getDate()}日`
|
||||
}
|
||||
|
||||
function resolveAppointmentDate(item) {
|
||||
if (item.date) return item.date
|
||||
return String(item.startTime || '').slice(0, 10)
|
||||
}
|
||||
|
||||
function resolveAppointmentStartMinute(item) {
|
||||
if (item.startMinute !== undefined && item.startMinute !== null) {
|
||||
return Number(item.startMinute)
|
||||
}
|
||||
const timeText = String(item.startTime || '').slice(11, 16)
|
||||
return dateUtil.minutesOfDay(timeText)
|
||||
}
|
||||
|
||||
function resolveAppointmentTimeText(item) {
|
||||
const startMinute = resolveAppointmentStartMinute(item)
|
||||
const duration = Number(item.durationMinutes || 60)
|
||||
const startText = String(item.startTime || '').slice(11, 16) || dateUtil.timeFromMinutes(startMinute)
|
||||
const endText = String(item.endTime || '').slice(11, 16) || dateUtil.timeFromMinutes(startMinute + duration)
|
||||
return `${startText}-${endText}`
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
viewMode: 'month',
|
||||
viewModes: [
|
||||
{ value: 'day', label: '日' },
|
||||
{ value: 'week', label: '周' },
|
||||
{ value: 'month', label: '月' }
|
||||
],
|
||||
monthDisplayMode: 'count',
|
||||
monthDisplayModes: [
|
||||
{ value: 'count', label: '单量' },
|
||||
{ value: 'blocks', label: '点阵' },
|
||||
{ value: 'rows', label: '横条' }
|
||||
],
|
||||
monthRowLabelVisible: false,
|
||||
weekLabels: ['一', '二', '三', '四', '五', '六', '日'],
|
||||
currentDate: new Date(),
|
||||
currentDateText: dateUtil.formatDate(new Date()),
|
||||
selectedArtistId: '',
|
||||
selectedArtistName: '全部员工',
|
||||
dateTitle: '',
|
||||
rangeText: '',
|
||||
weekRange: '',
|
||||
businessStartTime: '10:00',
|
||||
businessEndTime: '22:00',
|
||||
artists: [],
|
||||
appointments: [],
|
||||
daySummaries: [],
|
||||
monthDays: [],
|
||||
weekDays: [],
|
||||
dayLanes: [],
|
||||
hours: [],
|
||||
timelineHeight: 720,
|
||||
laneWidth: 720,
|
||||
laneItemWidth: 240,
|
||||
laneHeaderHeight: 54,
|
||||
dayTotal: 0,
|
||||
freeArtistCount: 0,
|
||||
pendingCount: 0,
|
||||
canCreateAppointment: true,
|
||||
loading: false,
|
||||
calendarError: ''
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.setData({ canCreateAppointment: canCreateAppointment() })
|
||||
this.loadCalendar()
|
||||
},
|
||||
|
||||
onShow() {
|
||||
const app = getApp()
|
||||
const storageRefresh = wx.getStorageSync('planningNeedRefresh') === '1'
|
||||
if (this._needRefresh || app.globalData.planningNeedRefresh || storageRefresh) {
|
||||
this._needRefresh = false
|
||||
app.globalData.planningNeedRefresh = false
|
||||
wx.removeStorageSync('planningNeedRefresh')
|
||||
this.loadCalendar()
|
||||
}
|
||||
},
|
||||
|
||||
switchView(event) {
|
||||
this.setData({ viewMode: event.currentTarget.dataset.mode })
|
||||
this.prepareView()
|
||||
this.loadCalendar()
|
||||
},
|
||||
|
||||
switchMonthDisplay(event) {
|
||||
this.setData({ monthDisplayMode: event.currentTarget.dataset.mode })
|
||||
},
|
||||
|
||||
toggleMonthRowLabel() {
|
||||
this.setData({ monthRowLabelVisible: !this.data.monthRowLabelVisible })
|
||||
},
|
||||
|
||||
selectArtist(event) {
|
||||
const id = event.currentTarget.dataset.id || ''
|
||||
const artist = this.data.artists.find(item => String(item.id) === String(id))
|
||||
this.setData({
|
||||
selectedArtistId: id,
|
||||
selectedArtistName: artist ? artist.name : '全部员工'
|
||||
})
|
||||
this.prepareView()
|
||||
},
|
||||
|
||||
selectDate(event) {
|
||||
const currentDate = dateUtil.formatDate(event.currentTarget.dataset.date)
|
||||
this.setData({
|
||||
currentDate,
|
||||
currentDateText: currentDate,
|
||||
viewMode: this.data.viewMode === 'month' ? 'day' : this.data.viewMode
|
||||
})
|
||||
this.prepareView()
|
||||
},
|
||||
|
||||
prevRange() {
|
||||
this.shiftRange(-1)
|
||||
},
|
||||
|
||||
nextRange() {
|
||||
this.shiftRange(1)
|
||||
},
|
||||
|
||||
goToday() {
|
||||
const today = new Date()
|
||||
this.setData({
|
||||
currentDate: today,
|
||||
currentDateText: dateUtil.formatDate(today)
|
||||
})
|
||||
this.loadCalendar()
|
||||
},
|
||||
|
||||
shiftRange(direction) {
|
||||
let next
|
||||
if (this.data.viewMode === 'month') {
|
||||
next = dateUtil.addMonths(this.data.currentDateText, direction)
|
||||
} else if (this.data.viewMode === 'week') {
|
||||
next = dateUtil.addDays(this.data.currentDateText, direction * 7)
|
||||
} else {
|
||||
next = dateUtil.addDays(this.data.currentDateText, direction)
|
||||
}
|
||||
this.setData({
|
||||
currentDate: next,
|
||||
currentDateText: dateUtil.formatDate(next)
|
||||
})
|
||||
this.loadCalendar()
|
||||
},
|
||||
|
||||
async loadCalendar() {
|
||||
const range = this.resolveRange()
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
const data = await planningApi.calendar({
|
||||
startDate: range.start,
|
||||
endDate: range.end,
|
||||
artistId: this.data.selectedArtistId || undefined
|
||||
})
|
||||
this.applyCalendar(data)
|
||||
this.setData({ calendarError: '' })
|
||||
} catch (error) {
|
||||
this.clearCalendarView()
|
||||
this.setData({
|
||||
calendarError: resolveCalendarErrorMessage(error),
|
||||
selectedArtistId: '',
|
||||
selectedArtistName: '全部员工'
|
||||
})
|
||||
wx.showToast({
|
||||
title: '规划数据加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
clearCalendarView() {
|
||||
this.setData({
|
||||
businessStartTime: '10:00',
|
||||
businessEndTime: '22:00',
|
||||
artists: [],
|
||||
appointments: [],
|
||||
daySummaries: [],
|
||||
monthDays: [],
|
||||
weekDays: [],
|
||||
dayLanes: [],
|
||||
hours: [],
|
||||
dayTotal: 0,
|
||||
freeArtistCount: 0,
|
||||
pendingCount: 0
|
||||
})
|
||||
},
|
||||
|
||||
resolveRange() {
|
||||
const current = this.data.currentDateText
|
||||
if (this.data.viewMode === 'week') {
|
||||
return {
|
||||
start: dateUtil.formatDate(dateUtil.startOfWeek(current)),
|
||||
end: dateUtil.formatDate(dateUtil.endOfWeek(current))
|
||||
}
|
||||
}
|
||||
if (this.data.viewMode === 'month') {
|
||||
return {
|
||||
start: dateUtil.formatDate(dateUtil.startOfMonth(current)),
|
||||
end: dateUtil.formatDate(dateUtil.endOfMonth(current))
|
||||
}
|
||||
}
|
||||
return { start: current, end: current }
|
||||
},
|
||||
|
||||
applyCalendar(calendar) {
|
||||
const artists = calendar.artists || []
|
||||
this.setData({
|
||||
businessStartTime: (calendar.businessStartTime || '10:00').slice(0, 5),
|
||||
businessEndTime: (calendar.businessEndTime || '22:00').slice(0, 5),
|
||||
artists,
|
||||
appointments: calendar.appointments || [],
|
||||
daySummaries: calendar.daySummaries || []
|
||||
})
|
||||
this.prepareView()
|
||||
},
|
||||
|
||||
prepareView() {
|
||||
const current = this.data.currentDateText
|
||||
const range = this.resolveRange()
|
||||
const title = this.data.viewMode === 'month'
|
||||
? dateUtil.formatMonth(current)
|
||||
: this.data.viewMode === 'week'
|
||||
? `${formatMonthDay(range.start)} - ${formatMonthDay(range.end)}`
|
||||
: dateUtil.formatCnDate(current)
|
||||
this.setData({
|
||||
dateTitle: title,
|
||||
rangeText: this.data.viewMode === 'month' ? '月视图' : this.data.viewMode === 'week' ? '周视图' : '日视图',
|
||||
weekRange: `${formatMonthDay(range.start)} - ${formatMonthDay(range.end)}`,
|
||||
monthDays: this.buildMonthDays(),
|
||||
weekDays: this.buildWeekDays(),
|
||||
...this.buildDayView()
|
||||
})
|
||||
},
|
||||
|
||||
buildMonthDays() {
|
||||
const summaryMap = this.summaryMap()
|
||||
const todayText = dateUtil.formatDate(new Date())
|
||||
const artistTemplate = this.data.artists.map(artist => ({
|
||||
artistId: artist.id,
|
||||
artistName: artist.name,
|
||||
shortName: artist.shortName,
|
||||
color: artist.color,
|
||||
count: 0,
|
||||
status: 'free'
|
||||
}))
|
||||
return dateUtil.monthGrid(this.data.currentDateText).map(day => {
|
||||
const summary = summaryMap[day.date] || {}
|
||||
const artistCounts = this.normalizeArtistCounts(summary.artistCounts || artistTemplate)
|
||||
return {
|
||||
...day,
|
||||
isPast: day.date < todayText,
|
||||
totalCount: summary.totalCount || 0,
|
||||
dayStatus: summary.dayStatus || 'free',
|
||||
artistCounts,
|
||||
expandedBlocks: this.buildExpandedBlocks(artistCounts),
|
||||
rowBlocks: this.buildRowBlocks(artistCounts)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
buildWeekDays() {
|
||||
const start = dateUtil.startOfWeek(this.data.currentDateText)
|
||||
const summaryMap = this.summaryMap()
|
||||
return this.data.weekLabels.map((label, index) => {
|
||||
const target = dateUtil.addDays(start, index)
|
||||
const date = dateUtil.formatDate(target)
|
||||
const summary = summaryMap[date] || { artistCounts: [], totalCount: 0 }
|
||||
const artistCounts = this.normalizeArtistCounts(summary.artistCounts || []).filter(count => count.count > 0)
|
||||
return {
|
||||
date,
|
||||
weekName: `周${label}`,
|
||||
day: target.getDate(),
|
||||
totalCount: summary.totalCount || 0,
|
||||
artistCounts: artistCounts.map(count => ({
|
||||
...count,
|
||||
width: Math.max(12, Math.min(100, count.count * 22)),
|
||||
barWidth: Math.max(14, Math.min(100, count.count * 18))
|
||||
}))
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
buildDayView() {
|
||||
const startMinute = dateUtil.minutesOfDay(this.data.businessStartTime)
|
||||
const endMinute = dateUtil.minutesOfDay(this.data.businessEndTime)
|
||||
const timelineHeight = Math.max(560, endMinute - startMinute)
|
||||
const laneHeaderHeight = 54
|
||||
const hours = []
|
||||
for (let cursor = startMinute; cursor <= endMinute; cursor += 60) {
|
||||
hours.push({
|
||||
value: cursor,
|
||||
label: dateUtil.timeFromMinutes(cursor),
|
||||
top: cursor - startMinute + laneHeaderHeight
|
||||
})
|
||||
}
|
||||
const filteredArtists = this.data.selectedArtistId
|
||||
? this.data.artists.filter(item => String(item.id) === String(this.data.selectedArtistId))
|
||||
: this.data.artists
|
||||
const dayAppointments = this.data.appointments.filter(item => resolveAppointmentDate(item) === this.data.currentDateText)
|
||||
const lanes = filteredArtists.map(artist => {
|
||||
const blocks = dayAppointments
|
||||
.filter(item => String(item.artistId) === String(artist.id))
|
||||
.map(item => {
|
||||
const itemStart = resolveAppointmentStartMinute(item)
|
||||
return {
|
||||
...item,
|
||||
top: Math.max(0, itemStart - startMinute) + laneHeaderHeight,
|
||||
height: Math.max(64, item.durationMinutes || 60),
|
||||
timeText: resolveAppointmentTimeText(item)
|
||||
}
|
||||
})
|
||||
return { ...artist, blocks }
|
||||
})
|
||||
const pendingCount = dayAppointments.filter(item => item.status === 0).length
|
||||
return {
|
||||
dayLanes: lanes,
|
||||
hours,
|
||||
timelineHeight: timelineHeight + laneHeaderHeight,
|
||||
laneHeaderHeight,
|
||||
laneItemWidth: 248,
|
||||
laneWidth: Math.max(720, lanes.length * 248),
|
||||
dayTotal: dayAppointments.length,
|
||||
freeArtistCount: lanes.filter(item => item.blocks.length === 0).length,
|
||||
pendingCount
|
||||
}
|
||||
},
|
||||
|
||||
summaryMap() {
|
||||
return (this.data.daySummaries || []).reduce((map, item) => {
|
||||
map[item.date] = item
|
||||
return map
|
||||
}, {})
|
||||
},
|
||||
|
||||
normalizeArtistCounts(counts) {
|
||||
const colorMap = this.data.artists.reduce((map, artist) => {
|
||||
map[artist.id] = artist
|
||||
return map
|
||||
}, {})
|
||||
return (counts || []).map(count => {
|
||||
const artist = colorMap[count.artistId] || {}
|
||||
return {
|
||||
...count,
|
||||
color: count.color || artist.color || '#B8B0A6',
|
||||
shortName: count.shortName || artist.shortName || '?',
|
||||
count: Number(count.count || 0)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
buildExpandedBlocks(artistCounts) {
|
||||
return (artistCounts || []).reduce((blocks, count) => {
|
||||
for (let index = 0; index < Number(count.count || 0); index += 1) {
|
||||
blocks.push({
|
||||
key: `${count.artistId || count.shortName}-${index}`,
|
||||
artistId: count.artistId,
|
||||
color: count.color,
|
||||
shortName: count.shortName
|
||||
})
|
||||
}
|
||||
return blocks
|
||||
}, [])
|
||||
},
|
||||
|
||||
buildRowBlocks(artistCounts) {
|
||||
return (artistCounts || []).reduce((rows, count) => {
|
||||
for (let index = 0; index < Number(count.count || 0); index += 1) {
|
||||
rows.push({
|
||||
key: `${count.artistId || count.shortName}-row-${index}`,
|
||||
artistId: count.artistId,
|
||||
color: count.color,
|
||||
shortName: count.shortName,
|
||||
artistName: count.artistName || count.shortName
|
||||
})
|
||||
}
|
||||
return rows
|
||||
}, [])
|
||||
},
|
||||
|
||||
createAppointment() {
|
||||
if (!this.data.canCreateAppointment) {
|
||||
wx.showToast({ title: '美甲师账号只能查看预约', icon: 'none' })
|
||||
return
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: `/pages/appointment-form/index?date=${this.data.currentDateText}&artistId=${this.data.selectedArtistId || ''}`
|
||||
})
|
||||
},
|
||||
|
||||
openAppointment(event) {
|
||||
wx.navigateTo({
|
||||
url: `/pages/appointment-detail/index?id=${event.currentTarget.dataset.id}`
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "规划"
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
<view class="page planning-page">
|
||||
<view class="card control-card">
|
||||
<view class="date-row">
|
||||
<view class="date-side">
|
||||
<button class="icon-btn small" bindtap="prevRange">‹</button>
|
||||
</view>
|
||||
<view class="date-center">
|
||||
<text class="date-main">{{dateTitle}}</text>
|
||||
<text class="date-sub">{{businessStartTime}}-{{businessEndTime}}</text>
|
||||
</view>
|
||||
<view class="date-side date-tools">
|
||||
<button class="today-btn" bindtap="goToday">今</button>
|
||||
<button class="icon-btn small" bindtap="nextRange">›</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="segmented">
|
||||
<view wx:for="{{viewModes}}" wx:key="value" class="segment {{viewMode === item.value ? 'active' : ''}}" data-mode="{{item.value}}" bindtap="switchView">{{item.label}}</view>
|
||||
</view>
|
||||
<scroll-view class="artist-filter" scroll-x enable-flex>
|
||||
<view class="artist-chip {{!selectedArtistId ? 'active' : ''}}" data-id="" bindtap="selectArtist">全部员工</view>
|
||||
<view wx:for="{{artists}}" wx:key="id" class="artist-chip {{selectedArtistId == item.id ? 'active' : ''}}" data-id="{{item.id}}" bindtap="selectArtist">
|
||||
<view class="chip-dot" style="background: {{item.color}};"></view>
|
||||
<text>{{item.name}}</text>
|
||||
<text class="chip-count">{{item.rangeCount || 0}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{calendarError}}" class="calendar-error-card">
|
||||
<view class="calendar-error-copy">
|
||||
<text class="calendar-error-title">规划数据加载失败</text>
|
||||
<text class="calendar-error-message">{{calendarError}}</text>
|
||||
</view>
|
||||
<button class="calendar-error-action" bindtap="loadCalendar">重试</button>
|
||||
</view>
|
||||
|
||||
<block wx:if="{{!calendarError}}">
|
||||
<view wx:if="{{viewMode === 'day'}}" class="section">
|
||||
<view class="day-summary">
|
||||
<view class="summary-item card">
|
||||
<text class="summary-value">{{dayTotal}}</text>
|
||||
<text class="summary-label">今日预约</text>
|
||||
</view>
|
||||
<view class="summary-item card">
|
||||
<text class="summary-value">{{freeArtistCount}}</text>
|
||||
<text class="summary-label">可插单员工</text>
|
||||
</view>
|
||||
<view class="summary-item card">
|
||||
<text class="summary-value">{{pendingCount}}</text>
|
||||
<text class="summary-label">待确认</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view class="day-board card" scroll-y>
|
||||
<view class="timeline-wrap" style="height: {{timelineHeight}}rpx;">
|
||||
<view class="time-axis">
|
||||
<view wx:for="{{hours}}" wx:key="value" class="time-label" style="top: {{item.top}}rpx;">{{item.label}}</view>
|
||||
</view>
|
||||
<scroll-view class="lane-scroll" scroll-x enable-flex>
|
||||
<view class="lanes" style="height: {{timelineHeight}}rpx; width: {{laneWidth}}rpx;">
|
||||
<view wx:for="{{dayLanes}}" wx:key="artistId" class="artist-lane" style="height: {{timelineHeight}}rpx; width: {{laneItemWidth}}rpx;">
|
||||
<view class="lane-head">
|
||||
<view class="chip-dot" style="background: {{item.color}};"></view>
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
<view wx:for="{{item.blocks}}" wx:for-item="block" wx:key="orderItemId" class="appointment-block {{block.status === 0 ? 'pending' : ''}}" style="top: {{block.top}}rpx; height: {{block.height}}rpx; border-left-color: {{item.color}};" data-id="{{block.orderItemId}}" bindtap="openAppointment">
|
||||
<text class="block-title">{{block.customerName}}</text>
|
||||
<text class="block-meta">{{block.timeText}} · {{block.productTitle}}</text>
|
||||
<text class="block-status">{{block.statusText}}</text>
|
||||
</view>
|
||||
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">全天可约</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{viewMode === 'week'}}" class="section">
|
||||
<scroll-view class="week-strip" scroll-x enable-flex>
|
||||
<view wx:for="{{weekDays}}" wx:key="date" class="week-day-card card {{item.date === currentDateText ? 'active' : ''}}" data-date="{{item.date}}" bindtap="selectDate">
|
||||
<text class="week-name">{{item.weekName}}</text>
|
||||
<text class="week-date">{{item.day}}</text>
|
||||
<text class="week-total">{{item.totalCount}}单</text>
|
||||
<view class="week-bars {{item.totalCount === 0 ? 'empty' : ''}}">
|
||||
<view wx:for="{{item.artistCounts}}" wx:for-item="count" wx:key="artistId" class="week-bar" style="background: {{count.color}}; width: {{count.width}}%;"></view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="card week-grid">
|
||||
<view class="week-grid-head">
|
||||
<text>本周排班密度</text>
|
||||
<text class="muted">{{weekRange}}</text>
|
||||
</view>
|
||||
<view wx:for="{{weekDays}}" wx:key="date" class="week-line">
|
||||
<view class="week-line-date">{{item.weekName}} {{item.day}}</view>
|
||||
<view class="week-line-bars {{item.totalCount === 0 ? 'empty' : ''}}">
|
||||
<view wx:for="{{item.artistCounts}}" wx:for-item="count" wx:key="artistId" class="week-count-bar" style="background: {{count.color}}; width: {{count.barWidth}}%;">
|
||||
<text>{{count.shortName}}{{count.count}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{viewMode === 'month'}}" class="section">
|
||||
<view class="month-toolbar">
|
||||
<text class="month-toolbar-title">月历显示</text>
|
||||
<view class="month-mode-switch">
|
||||
<view wx:for="{{monthDisplayModes}}" wx:key="value" class="month-mode {{monthDisplayMode === item.value ? 'active' : ''}}" data-mode="{{item.value}}" bindtap="switchMonthDisplay">{{item.label}}</view>
|
||||
</view>
|
||||
<view wx:if="{{monthDisplayMode === 'rows'}}" class="row-name-switch {{monthRowLabelVisible ? 'active' : ''}}" bindtap="toggleMonthRowLabel">
|
||||
<text>姓名</text>
|
||||
<view class="switch-track"><view class="switch-thumb"></view></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="month-card card">
|
||||
<view class="month-week-head">
|
||||
<text wx:for="{{weekLabels}}" wx:key="*this">{{item}}</text>
|
||||
</view>
|
||||
<view class="month-grid">
|
||||
<view wx:for="{{monthDays}}" wx:key="date" class="month-cell {{item.isCurrentMonth ? '' : 'out-month'}} {{item.date === currentDateText ? 'selected' : ''}}" data-date="{{item.date}}" bindtap="selectDate">
|
||||
<view class="month-cell-head">
|
||||
<text class="month-day">{{item.day}}</text>
|
||||
<text wx:if="{{!item.isPast && item.dayStatus === 'full'}}" class="day-mark full">满</text>
|
||||
<text wx:elif="{{!item.isPast && item.dayStatus === 'rest'}}" class="day-mark rest">休</text>
|
||||
</view>
|
||||
<view wx:if="{{monthDisplayMode === 'count'}}" class="month-bars">
|
||||
<view wx:for="{{item.artistCounts}}" wx:for-item="count" wx:key="artistId" wx:if="{{count.count > 0}}" class="month-artist-bar" style="background: {{count.color}};">
|
||||
<text>{{count.shortName}}{{count.count}}</text>
|
||||
</view>
|
||||
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
|
||||
</view>
|
||||
<view wx:else class="month-blocks">
|
||||
<block wx:if="{{monthDisplayMode === 'blocks'}}">
|
||||
<view wx:for="{{item.expandedBlocks}}" wx:for-item="block" wx:key="key" class="month-order-block" style="background: {{block.color}};"></view>
|
||||
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view wx:for="{{item.rowBlocks}}" wx:for-item="block" wx:key="key" class="month-row-block {{monthRowLabelVisible ? 'named' : ''}}" style="background: {{block.color}};">
|
||||
<text wx:if="{{monthRowLabelVisible}}">{{block.artistName}}</text>
|
||||
</view>
|
||||
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<button wx:if="{{canCreateAppointment && !calendarError}}" class="fab" bindtap="createAppointment">+</button>
|
||||
</view>
|
||||
@@ -0,0 +1,681 @@
|
||||
.planning-page {
|
||||
padding-top: 18rpx;
|
||||
}
|
||||
|
||||
.today-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 58rpx;
|
||||
min-width: 58rpx;
|
||||
max-width: 58rpx;
|
||||
height: 52rpx;
|
||||
min-height: 52rpx;
|
||||
padding: 0;
|
||||
border-radius: 999rpx;
|
||||
background: #e5eee9;
|
||||
color: #6f8f83;
|
||||
font-size: 24rpx;
|
||||
font-weight: 800;
|
||||
line-height: 52rpx;
|
||||
}
|
||||
|
||||
.control-card {
|
||||
padding: 18rpx;
|
||||
animation: pageFadeIn 180ms ease both;
|
||||
}
|
||||
|
||||
.calendar-error-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
margin-top: 18rpx;
|
||||
padding: 18rpx;
|
||||
border: 1rpx solid #f1d4c4;
|
||||
border-radius: 8px;
|
||||
background: #fff8f3;
|
||||
}
|
||||
|
||||
.calendar-error-copy {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.calendar-error-title {
|
||||
color: #9b3d22;
|
||||
font-size: 26rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.calendar-error-message {
|
||||
color: #b06a52;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.calendar-error-action {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 96rpx;
|
||||
min-width: 96rpx;
|
||||
height: 52rpx;
|
||||
padding: 0;
|
||||
border-radius: 999rpx;
|
||||
background: #fffdf8;
|
||||
color: #8b4b35;
|
||||
font-size: 24rpx;
|
||||
font-weight: 800;
|
||||
line-height: 52rpx;
|
||||
}
|
||||
|
||||
.date-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.date-side {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 128rpx;
|
||||
}
|
||||
|
||||
.date-tools {
|
||||
justify-content: flex-end;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.icon-btn.small {
|
||||
width: 52rpx;
|
||||
min-width: 52rpx;
|
||||
max-width: 52rpx;
|
||||
height: 52rpx;
|
||||
min-height: 52rpx;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.date-center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
}
|
||||
|
||||
.date-main {
|
||||
color: #25211d;
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.date-sub {
|
||||
color: #9a9288;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.segmented {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 8rpx;
|
||||
margin-top: 18rpx;
|
||||
padding: 8rpx;
|
||||
border-radius: 12px;
|
||||
background: #f1ece4;
|
||||
}
|
||||
|
||||
.segment {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 58rpx;
|
||||
border-radius: 10px;
|
||||
color: #7d756c;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
|
||||
}
|
||||
|
||||
.segment.active {
|
||||
background: #fffdf8;
|
||||
color: #2f2a25;
|
||||
box-shadow: 0 6rpx 14rpx rgba(58, 48, 34, 0.07);
|
||||
transform: translateY(-1rpx);
|
||||
}
|
||||
|
||||
.artist-filter {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
margin-top: 16rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.artist-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 52rpx;
|
||||
margin-right: 10rpx;
|
||||
padding: 0 16rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f4f0ea;
|
||||
color: #625b52;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
|
||||
}
|
||||
|
||||
.artist-chip.active {
|
||||
background: #e5eee9;
|
||||
color: #4e7165;
|
||||
transform: translateY(-1rpx);
|
||||
}
|
||||
|
||||
.chip-dot {
|
||||
width: 14rpx;
|
||||
height: 14rpx;
|
||||
margin-right: 8rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.chip-count {
|
||||
margin-left: 8rpx;
|
||||
color: #9a9288;
|
||||
}
|
||||
|
||||
.day-summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.summary-value {
|
||||
display: block;
|
||||
color: #26231f;
|
||||
font-size: 34rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
color: #938c82;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.day-board {
|
||||
height: 820rpx;
|
||||
margin-top: 18rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.timeline-wrap {
|
||||
position: relative;
|
||||
min-height: 720rpx;
|
||||
}
|
||||
|
||||
.time-axis {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 4;
|
||||
width: 92rpx;
|
||||
height: 100%;
|
||||
border-right: 1rpx solid #eee8df;
|
||||
background: #fffdf8;
|
||||
}
|
||||
|
||||
.time-axis::before {
|
||||
display: block;
|
||||
height: 54rpx;
|
||||
content: '';
|
||||
}
|
||||
|
||||
.time-label {
|
||||
position: absolute;
|
||||
right: 12rpx;
|
||||
color: #9a9288;
|
||||
font-size: 20rpx;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.lane-scroll {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 104rpx;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.lanes {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.artist-lane {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
border-right: 1rpx solid #eee8df;
|
||||
background-image: linear-gradient(to bottom, rgba(214, 207, 197, 0.35) 1rpx, transparent 1rpx);
|
||||
background-size: 100% 60rpx;
|
||||
}
|
||||
|
||||
.lane-head {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 54rpx;
|
||||
padding: 0 14rpx;
|
||||
background: rgba(255, 253, 248, 0.92);
|
||||
color: #4d473f;
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.appointment-block {
|
||||
position: absolute;
|
||||
right: 12rpx;
|
||||
left: 12rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4rpx;
|
||||
overflow: hidden;
|
||||
padding: 12rpx 12rpx;
|
||||
border-left: 8rpx solid #7ba7c7;
|
||||
border-radius: 10px;
|
||||
background: #fff7ee;
|
||||
box-shadow: 0 8rpx 16rpx rgba(58, 48, 34, 0.08);
|
||||
transition: transform 160ms ease, box-shadow 160ms ease;
|
||||
}
|
||||
|
||||
.appointment-block:active {
|
||||
transform: scale(0.98);
|
||||
box-shadow: 0 4rpx 10rpx rgba(58, 48, 34, 0.08);
|
||||
}
|
||||
|
||||
.appointment-block.pending {
|
||||
background: #fff3f6;
|
||||
}
|
||||
|
||||
.block-title {
|
||||
color: #2c2823;
|
||||
font-size: 24rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.block-meta,
|
||||
.block-status {
|
||||
color: #7e756b;
|
||||
font-size: 20rpx;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.lane-empty {
|
||||
position: absolute;
|
||||
top: 76rpx;
|
||||
right: 18rpx;
|
||||
left: 18rpx;
|
||||
padding: 16rpx 0;
|
||||
border: 1rpx dashed #d8d1c8;
|
||||
border-radius: 10px;
|
||||
color: #aaa198;
|
||||
text-align: center;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.week-strip {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.week-day-card {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
width: 148rpx;
|
||||
min-height: 164rpx;
|
||||
margin-right: 12rpx;
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.week-day-card.active {
|
||||
outline: 3rpx solid #8fb89a;
|
||||
}
|
||||
|
||||
.week-name,
|
||||
.week-total {
|
||||
color: #8f877e;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.week-date {
|
||||
margin: 8rpx 0;
|
||||
color: #211e1a;
|
||||
font-size: 38rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.week-bars {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
margin-top: 12rpx;
|
||||
min-height: 22rpx;
|
||||
}
|
||||
|
||||
.week-bars.empty {
|
||||
min-height: 22rpx;
|
||||
}
|
||||
|
||||
.week-bar {
|
||||
height: 8rpx;
|
||||
border-radius: 999rpx;
|
||||
}
|
||||
|
||||
.week-grid {
|
||||
margin-top: 18rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.week-grid-head,
|
||||
.week-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.week-grid-head {
|
||||
margin-bottom: 14rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.week-line {
|
||||
min-height: 70rpx;
|
||||
border-top: 1rpx solid #eee8df;
|
||||
}
|
||||
|
||||
.week-line-date {
|
||||
width: 132rpx;
|
||||
color: #6f675f;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.week-line-bars {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
min-height: 28rpx;
|
||||
}
|
||||
|
||||
.week-line-bars.empty {
|
||||
min-height: 28rpx;
|
||||
}
|
||||
|
||||
.week-count-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 58rpx;
|
||||
height: 28rpx;
|
||||
padding-left: 10rpx;
|
||||
border-radius: 7rpx;
|
||||
color: #fff;
|
||||
font-size: 18rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.month-card {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.month-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8rpx;
|
||||
margin-bottom: 14rpx;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
|
||||
.month-toolbar-title {
|
||||
color: #615a51;
|
||||
font-size: 24rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.month-mode-switch {
|
||||
display: inline-flex;
|
||||
gap: 6rpx;
|
||||
padding: 6rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #eee8df;
|
||||
}
|
||||
|
||||
.month-mode {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 68rpx;
|
||||
height: 44rpx;
|
||||
padding: 0 12rpx;
|
||||
border-radius: 999rpx;
|
||||
color: #766e65;
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
|
||||
}
|
||||
|
||||
.month-mode.active {
|
||||
background: #fffdf8;
|
||||
color: #2f6f62;
|
||||
box-shadow: 0 4rpx 12rpx rgba(58, 48, 34, 0.07);
|
||||
transform: translateY(-1rpx);
|
||||
}
|
||||
|
||||
.row-name-switch {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
height: 44rpx;
|
||||
padding: 0 10rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f0ece5;
|
||||
color: #766e65;
|
||||
font-size: 21rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.row-name-switch.active {
|
||||
color: #2f6f62;
|
||||
background: #e5eee9;
|
||||
}
|
||||
|
||||
.switch-track {
|
||||
position: relative;
|
||||
width: 44rpx;
|
||||
height: 24rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #d6d0c7;
|
||||
}
|
||||
|
||||
.switch-thumb {
|
||||
position: absolute;
|
||||
top: 3rpx;
|
||||
left: 3rpx;
|
||||
width: 18rpx;
|
||||
height: 18rpx;
|
||||
border-radius: 50%;
|
||||
background: #fffdf8;
|
||||
box-shadow: 0 2rpx 6rpx rgba(58, 48, 34, 0.16);
|
||||
transition: transform 180ms ease;
|
||||
}
|
||||
|
||||
.row-name-switch.active .switch-track {
|
||||
background: #6f8f83;
|
||||
}
|
||||
|
||||
.row-name-switch.active .switch-thumb {
|
||||
transform: translateX(20rpx);
|
||||
}
|
||||
|
||||
.month-week-head {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
height: 58rpx;
|
||||
align-items: center;
|
||||
border-bottom: 1rpx solid #ebe5dc;
|
||||
color: #726b62;
|
||||
font-size: 24rpx;
|
||||
font-weight: 800;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.month-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
}
|
||||
|
||||
.month-cell {
|
||||
min-height: 168rpx;
|
||||
padding: 8rpx 5rpx;
|
||||
border-right: 1rpx solid #eee8df;
|
||||
border-bottom: 1rpx solid #eee8df;
|
||||
background: #fffdf8;
|
||||
transition: background-color 180ms ease, transform 160ms ease;
|
||||
}
|
||||
|
||||
.month-cell:active {
|
||||
transform: scale(0.985);
|
||||
}
|
||||
|
||||
.month-cell:nth-child(7n) {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
.month-cell.out-month {
|
||||
background: #f7f3ed;
|
||||
}
|
||||
|
||||
.month-cell.selected {
|
||||
background: #eef5f1;
|
||||
}
|
||||
|
||||
.month-cell-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 32rpx;
|
||||
}
|
||||
|
||||
.month-day {
|
||||
color: #2c2824;
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.out-month .month-day {
|
||||
color: #aba39a;
|
||||
}
|
||||
|
||||
.day-mark {
|
||||
font-size: 17rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.day-mark.full {
|
||||
color: #d98d8d;
|
||||
}
|
||||
|
||||
.day-mark.rest {
|
||||
color: #8aaeca;
|
||||
}
|
||||
|
||||
.month-bars {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5rpx;
|
||||
margin-top: 7rpx;
|
||||
}
|
||||
|
||||
.month-artist-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 24rpx;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
border-radius: 6rpx;
|
||||
color: #fff;
|
||||
font-size: 17rpx;
|
||||
font-weight: 800;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
transition: transform 160ms ease;
|
||||
}
|
||||
|
||||
.month-blocks {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
gap: 5rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.month-order-block {
|
||||
width: 22rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 999rpx;
|
||||
box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.24);
|
||||
}
|
||||
|
||||
.month-row-block {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 12rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 999rpx;
|
||||
color: #fff;
|
||||
font-size: 13rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
text-shadow: 0 1rpx 3rpx rgba(37, 31, 24, 0.22);
|
||||
box-shadow: inset 0 0 0 1rpx rgba(255, 255, 255, 0.24);
|
||||
}
|
||||
|
||||
.month-row-block.named {
|
||||
height: 20rpx;
|
||||
}
|
||||
|
||||
.month-blocks .month-empty {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.month-empty {
|
||||
margin-top: 10rpx;
|
||||
color: #b5ada4;
|
||||
font-size: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@keyframes pageFadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8rpx);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
const { BRAND_CONFIG } = require('../../utils/config')
|
||||
const userApi = require('../../api/user')
|
||||
const auth = require('../../utils/auth')
|
||||
const { chooseImageFilePath, uploadProfileImage } = require('../../utils/upload')
|
||||
|
||||
function resolveRoleText(type) {
|
||||
const role = Number(type)
|
||||
if (role === 2) return '店长'
|
||||
if (role === 3) return '美甲师'
|
||||
if (role === 4) return '管理员'
|
||||
return '管理端'
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
shopName: BRAND_CONFIG.defaultShopName,
|
||||
phone: '店长端',
|
||||
roleText: '管理端',
|
||||
userInfo: {},
|
||||
editModalVisible: false,
|
||||
profileSaving: false,
|
||||
avatarUploading: false,
|
||||
profileForm: {
|
||||
nickname: '',
|
||||
avatar: '',
|
||||
contactPhone: '',
|
||||
wechatId: '',
|
||||
signature: ''
|
||||
},
|
||||
menus: [
|
||||
{ title: '个人信息', action: 'editProfile' },
|
||||
{ title: '店铺设置', url: '/pages/shop-settings/index' },
|
||||
{ title: '数据导出', url: '/pages/export/index' },
|
||||
{ title: '修改密码', url: '/pages/password/index' },
|
||||
{ title: '关于系统', url: '/pages/about/index' }
|
||||
]
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.refreshFromSession()
|
||||
this.loadProfile()
|
||||
},
|
||||
|
||||
refreshFromSession() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
this.setData({
|
||||
shopName: app.globalData.shopName || BRAND_CONFIG.appName,
|
||||
phone: userInfo.contactPhone || userInfo.phone || userInfo.account || '店长端',
|
||||
roleText: resolveRoleText(userInfo.type),
|
||||
userInfo
|
||||
})
|
||||
},
|
||||
|
||||
go(event) {
|
||||
const action = event.currentTarget.dataset.action
|
||||
if (action === 'editProfile') {
|
||||
this.openEditProfile()
|
||||
return
|
||||
}
|
||||
wx.navigateTo({ url: event.currentTarget.dataset.url })
|
||||
},
|
||||
|
||||
async loadProfile() {
|
||||
try {
|
||||
const profile = await userApi.info()
|
||||
this.syncProfileToSession(profile)
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '个人信息加载失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
|
||||
syncProfileToSession(profile) {
|
||||
const app = getApp()
|
||||
const session = auth.getSession()
|
||||
const currentUserInfo = session.userInfo || app.globalData.userInfo || {}
|
||||
const nextUserInfo = {
|
||||
...currentUserInfo,
|
||||
id: profile.id || currentUserInfo.id,
|
||||
account: profile.account || currentUserInfo.account,
|
||||
nickname: profile.nickname || '',
|
||||
avatar: profile.avatar || '',
|
||||
phone: profile.phone || currentUserInfo.phone || '',
|
||||
contactPhone: profile.contactPhone || '',
|
||||
wechatId: profile.wechatId || '',
|
||||
signature: profile.signature || '',
|
||||
type: profile.type || currentUserInfo.type,
|
||||
shopId: profile.shopId || currentUserInfo.shopId
|
||||
}
|
||||
app.setSession({
|
||||
...session,
|
||||
userInfo: nextUserInfo
|
||||
})
|
||||
this.setData({
|
||||
userInfo: nextUserInfo,
|
||||
phone: nextUserInfo.contactPhone || nextUserInfo.phone || nextUserInfo.account || '店长端',
|
||||
roleText: resolveRoleText(nextUserInfo.type)
|
||||
})
|
||||
},
|
||||
|
||||
openEditProfile() {
|
||||
const userInfo = this.data.userInfo || {}
|
||||
this.setData({
|
||||
editModalVisible: true,
|
||||
profileForm: {
|
||||
nickname: userInfo.nickname || '',
|
||||
avatar: userInfo.avatar || '',
|
||||
contactPhone: userInfo.contactPhone || '',
|
||||
wechatId: userInfo.wechatId || '',
|
||||
signature: userInfo.signature || ''
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
closeEditProfile() {
|
||||
if (this.data.profileSaving || this.data.avatarUploading) {
|
||||
return
|
||||
}
|
||||
this.setData({ editModalVisible: false })
|
||||
},
|
||||
|
||||
stopTap() {
|
||||
},
|
||||
|
||||
onProfileInput(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
this.setData({
|
||||
[`profileForm.${field}`]: event.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
async chooseProfileAvatar() {
|
||||
if (this.data.avatarUploading || this.data.profileSaving) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const filePath = await chooseImageFilePath()
|
||||
if (!filePath) {
|
||||
return
|
||||
}
|
||||
this.setData({ avatarUploading: true })
|
||||
const avatar = await uploadProfileImage(filePath)
|
||||
this.setData({ 'profileForm.avatar': avatar })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ avatarUploading: false })
|
||||
}
|
||||
},
|
||||
|
||||
removeProfileAvatar() {
|
||||
this.setData({ 'profileForm.avatar': '' })
|
||||
},
|
||||
|
||||
async saveProfile() {
|
||||
const form = this.data.profileForm
|
||||
const nickname = String(form.nickname || '').trim()
|
||||
if (!nickname) {
|
||||
wx.showToast({ title: '请填写昵称', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ profileSaving: true })
|
||||
try {
|
||||
await userApi.updateInfo({
|
||||
nickname,
|
||||
avatar: form.avatar || '',
|
||||
contactPhone: String(form.contactPhone || '').trim(),
|
||||
wechatId: String(form.wechatId || '').trim(),
|
||||
signature: String(form.signature || '').trim()
|
||||
})
|
||||
const profile = await userApi.info()
|
||||
this.syncProfileToSession(profile)
|
||||
this.setData({ editModalVisible: false })
|
||||
wx.showToast({ title: '已保存', icon: 'success' })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '保存失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ profileSaving: false })
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "我的"
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<view class="page">
|
||||
<view class="card profile-card">
|
||||
<view class="profile-main">
|
||||
<view class="shop-logo">指</view>
|
||||
<view class="profile-copy">
|
||||
<text class="shop-name">{{shopName}}</text>
|
||||
<text class="phone">{{phone}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="role-badge">{{roleText}}</text>
|
||||
</view>
|
||||
|
||||
<view class="section menu-list card">
|
||||
<view wx:for="{{menus}}" wx:key="title" class="menu-row" data-url="{{item.url}}" data-action="{{item.action}}" bindtap="go">
|
||||
<text>{{item.title}}</text>
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{editModalVisible}}" class="modal-mask" bindtap="closeEditProfile">
|
||||
<view class="profile-modal" catchtap="stopTap">
|
||||
<view class="modal-head">
|
||||
<text class="modal-title">个人信息</text>
|
||||
<view class="modal-close" bindtap="closeEditProfile">×</view>
|
||||
</view>
|
||||
<view class="profile-avatar-row">
|
||||
<view wx:if="{{profileForm.avatar}}" class="profile-avatar image-avatar">
|
||||
<image src="{{profileForm.avatar}}" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view wx:else class="profile-avatar">头像</view>
|
||||
<button class="secondary-btn avatar-btn" loading="{{avatarUploading}}" bindtap="chooseProfileAvatar">上传头像</button>
|
||||
<button wx:if="{{profileForm.avatar}}" class="text-btn avatar-remove" bindtap="removeProfileAvatar">移除</button>
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text class="required-label">昵称</text>
|
||||
<input value="{{profileForm.nickname}}" data-field="nickname" bindinput="onProfileInput" placeholder="请输入昵称" />
|
||||
</view>
|
||||
<view class="modal-field readonly-field">
|
||||
<text>登录账号</text>
|
||||
<view>{{userInfo.account || '未设置'}}</view>
|
||||
</view>
|
||||
<view class="modal-field readonly-field">
|
||||
<text>身份</text>
|
||||
<view>{{roleText}}</view>
|
||||
</view>
|
||||
<view class="modal-field readonly-field">
|
||||
<text>登录手机号</text>
|
||||
<view>{{userInfo.phone || '未绑定'}}</view>
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text>联系电话</text>
|
||||
<input value="{{profileForm.contactPhone}}" data-field="contactPhone" bindinput="onProfileInput" type="number" placeholder="请输入联系电话" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text>微信号</text>
|
||||
<input value="{{profileForm.wechatId}}" data-field="wechatId" bindinput="onProfileInput" placeholder="请输入微信号" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text>签名</text>
|
||||
<textarea value="{{profileForm.signature}}" data-field="signature" bindinput="onProfileInput" placeholder="请输入个人签名" />
|
||||
</view>
|
||||
<button class="primary-btn modal-submit" loading="{{profileSaving}}" bindtap="saveProfile">保存个人信息</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,256 @@
|
||||
.profile-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
.profile-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.profile-copy {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.shop-logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #6f8f83;
|
||||
color: #fff;
|
||||
font-size: 40rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.shop-name,
|
||||
.phone {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.shop-name {
|
||||
font-size: 34rpx;
|
||||
font-weight: 800;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.phone {
|
||||
margin-top: 8rpx;
|
||||
color: #91897f;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.role-badge {
|
||||
flex-shrink: 0;
|
||||
padding: 8rpx 18rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #e5eee9;
|
||||
color: #4e7165;
|
||||
font-size: 23rpx;
|
||||
font-weight: 800;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.menu-list {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.menu-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 104rpx;
|
||||
padding: 0 26rpx;
|
||||
border-bottom: 1rpx solid #eee8df;
|
||||
color: #302c27;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.menu-row:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
color: #b0a79e;
|
||||
font-size: 44rpx;
|
||||
}
|
||||
|
||||
.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);
|
||||
animation: maskIn 180ms ease both;
|
||||
}
|
||||
|
||||
.profile-modal {
|
||||
width: 100%;
|
||||
max-height: 88vh;
|
||||
overflow-y: auto;
|
||||
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);
|
||||
animation: modalUp 220ms ease both;
|
||||
}
|
||||
|
||||
.modal-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
color: #27211d;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 48rpx;
|
||||
min-width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
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);
|
||||
}
|
||||
|
||||
.profile-avatar-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 18rpx;
|
||||
padding: 18rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #f7efe7;
|
||||
}
|
||||
|
||||
.profile-avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 auto;
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 50%;
|
||||
background: #6f8f83;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.profile-avatar image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.avatar-btn {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.avatar-remove {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.modal-field {
|
||||
margin-bottom: 16rpx;
|
||||
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,
|
||||
.modal-field textarea,
|
||||
.readonly-field view {
|
||||
width: 100%;
|
||||
color: #2c2722;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.modal-field input,
|
||||
.readonly-field view {
|
||||
min-height: 58rpx;
|
||||
line-height: 58rpx;
|
||||
}
|
||||
|
||||
.modal-field textarea {
|
||||
min-height: 120rpx;
|
||||
}
|
||||
|
||||
.readonly-field view {
|
||||
color: #7f756b;
|
||||
}
|
||||
|
||||
.modal-submit {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
@keyframes maskIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes modalUp {
|
||||
from {
|
||||
transform: translateY(40rpx);
|
||||
}
|
||||
to {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
const authApi = require('../../api/auth')
|
||||
const { BRAND_CONFIG } = require('../../utils/config')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
form: {
|
||||
phone: '',
|
||||
code: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
shopName: ''
|
||||
},
|
||||
registerShopPlaceholder: BRAND_CONFIG.registerShopPlaceholder,
|
||||
loading: false,
|
||||
codeLoading: false,
|
||||
countdown: 0,
|
||||
countdownTimer: null
|
||||
},
|
||||
|
||||
onInput(event) {
|
||||
this.setData({
|
||||
[`form.${event.currentTarget.dataset.field}`]: event.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
},
|
||||
|
||||
async sendCode() {
|
||||
const phone = this.data.form.phone
|
||||
if (!phone) {
|
||||
wx.showToast({ title: '请输入手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (this.data.codeLoading || this.data.countdown > 0) {
|
||||
return
|
||||
}
|
||||
this.setData({ codeLoading: true })
|
||||
try {
|
||||
await authApi.sendCode(phone)
|
||||
wx.showToast({ title: '验证码已发送' })
|
||||
this.startCountdown()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '发送失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ codeLoading: false })
|
||||
}
|
||||
},
|
||||
|
||||
startCountdown() {
|
||||
if (this.data.countdownTimer) {
|
||||
clearInterval(this.data.countdownTimer)
|
||||
}
|
||||
this.setData({ countdown: 60 })
|
||||
const timer = setInterval(() => {
|
||||
const next = this.data.countdown - 1
|
||||
if (next <= 0) {
|
||||
clearInterval(timer)
|
||||
this.setData({ countdown: 0, countdownTimer: null })
|
||||
return
|
||||
}
|
||||
this.setData({ countdown: next })
|
||||
}, 1000)
|
||||
this.setData({ countdownTimer: timer })
|
||||
},
|
||||
|
||||
onUnload() {
|
||||
if (this.data.countdownTimer) {
|
||||
clearInterval(this.data.countdownTimer)
|
||||
}
|
||||
},
|
||||
|
||||
async submit() {
|
||||
const form = this.data.form
|
||||
if (!form.phone || !form.code || !form.password || !form.shopName) {
|
||||
wx.showToast({ title: '请补全注册信息', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (form.password !== form.confirmPassword) {
|
||||
wx.showToast({ title: '两次密码不一致', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
await authApi.register(form)
|
||||
wx.showToast({ title: '注册成功' })
|
||||
setTimeout(() => wx.navigateBack(), 500)
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '注册失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "注册"
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card form-card">
|
||||
<view class="field">
|
||||
<text class="field-label">手机号</text>
|
||||
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" placeholder="请输入手机号" />
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">验证码</text>
|
||||
<input value="{{form.code}}" data-field="code" bindinput="onInput" placeholder="请输入验证码" />
|
||||
<button class="code-btn" loading="{{codeLoading}}" disabled="{{codeLoading || countdown > 0}}" bindtap="sendCode">
|
||||
{{countdown > 0 ? countdown + 's' : '获取验证码'}}
|
||||
</button>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">密码</text>
|
||||
<input value="{{form.password}}" data-field="password" bindinput="onInput" password placeholder="设置登录密码" />
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">确认密码</text>
|
||||
<input value="{{form.confirmPassword}}" data-field="confirmPassword" bindinput="onInput" password placeholder="再次输入密码" />
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">店铺名称</text>
|
||||
<input value="{{form.shopName}}" data-field="shopName" bindinput="onInput" placeholder="{{registerShopPlaceholder}}" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="fixed-bottom">
|
||||
<button class="primary-btn" loading="{{loading}}" bindtap="submit">注册</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,11 @@
|
||||
.code-btn {
|
||||
width: 148rpx;
|
||||
min-width: 148rpx;
|
||||
max-width: 148rpx;
|
||||
height: 56rpx;
|
||||
padding: 0;
|
||||
color: #6f8f83;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
text-align: right;
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
const employeesApi = require('../../api/employees')
|
||||
const dateUtil = require('../../utils/date')
|
||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||
|
||||
const PRESETS = [
|
||||
{ value: 'DOUBLE_REST', label: '双休', workDays: [1, 2, 3, 4, 5], startTime: '09:00', endTime: '17:00' },
|
||||
{ value: 'SINGLE_REST', label: '单休', workDays: [1, 2, 3, 4, 5, 6], startTime: '10:00', endTime: '22:00' },
|
||||
{ value: 'NINE_TO_FIVE', label: '朝九晚五', workDays: [1, 2, 3, 4, 5], startTime: '09:00', endTime: '17:00' },
|
||||
{ value: 'LATE_SHIFT', label: '晚班', workDays: [1, 2, 3, 4, 5, 6], startTime: '10:00', endTime: '22:00' },
|
||||
{ value: 'CUSTOM', label: '自定义', workDays: [1, 2, 3, 4, 5], startTime: '10:00', endTime: '22:00' }
|
||||
]
|
||||
|
||||
const WEEKDAYS = [
|
||||
{ value: 1, label: '周一' },
|
||||
{ value: 2, label: '周二' },
|
||||
{ value: 3, label: '周三' },
|
||||
{ value: 4, label: '周四' },
|
||||
{ value: 5, label: '周五' },
|
||||
{ value: 6, label: '周六' },
|
||||
{ value: 7, label: '周日' }
|
||||
]
|
||||
|
||||
const EXCEPTION_TYPES = [
|
||||
{ value: 'REST', label: '休假' },
|
||||
{ value: 'EXTRA_WORK', label: '临时上班' },
|
||||
{ value: 'CHANGE_SHIFT', label: '临时改班' }
|
||||
]
|
||||
|
||||
function copyWorkDays(days) {
|
||||
return (days || []).map(day => Number(day)).filter(day => day >= 1 && day <= 7)
|
||||
}
|
||||
|
||||
function buildPreset(value) {
|
||||
return PRESETS.find(item => item.value === value) || PRESETS[0]
|
||||
}
|
||||
|
||||
function buildPresetOptions(presetType) {
|
||||
return PRESETS.map(item => ({
|
||||
...item,
|
||||
active: item.value === presetType
|
||||
}))
|
||||
}
|
||||
|
||||
function buildWeekdayOptions(workDays) {
|
||||
const selected = copyWorkDays(workDays)
|
||||
return WEEKDAYS.map(item => ({
|
||||
...item,
|
||||
active: selected.includes(item.value)
|
||||
}))
|
||||
}
|
||||
|
||||
function buildExceptionTypeLabel(exceptionType) {
|
||||
const option = EXCEPTION_TYPES.find(item => item.value === exceptionType) || EXCEPTION_TYPES[0]
|
||||
return option.label
|
||||
}
|
||||
|
||||
function buildExceptionSummary(item) {
|
||||
const type = EXCEPTION_TYPES.find(option => option.value === item.exceptionType)
|
||||
if (!item) {
|
||||
return ''
|
||||
}
|
||||
if (item.exceptionType === 'REST') {
|
||||
return `${item.workDate} ${type ? type.label : '休假'}`
|
||||
}
|
||||
return `${item.workDate} ${type ? type.label : '例外'} ${String(item.startTime || '').slice(0, 5)}-${String(item.endTime || '').slice(0, 5)}`
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
artistId: '',
|
||||
presets: PRESETS,
|
||||
presetOptions: buildPresetOptions('DOUBLE_REST'),
|
||||
weekdays: WEEKDAYS,
|
||||
weekdayOptions: buildWeekdayOptions([1, 2, 3, 4, 5]),
|
||||
exceptionTypes: EXCEPTION_TYPES,
|
||||
exceptionTypeIndex: 0,
|
||||
exceptionTypeLabel: '休假',
|
||||
exceptions: [],
|
||||
loading: false,
|
||||
saving: false,
|
||||
form: {
|
||||
presetType: 'DOUBLE_REST',
|
||||
workDays: [1, 2, 3, 4, 5],
|
||||
startTime: '09:00',
|
||||
endTime: '17:00',
|
||||
remark: ''
|
||||
},
|
||||
exceptionForm: {
|
||||
workDate: dateUtil.formatDate(new Date()),
|
||||
exceptionType: 'REST',
|
||||
startTime: '10:00',
|
||||
endTime: '18:00',
|
||||
remark: ''
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({ artistId: options.id || '' })
|
||||
this.loadRule()
|
||||
},
|
||||
|
||||
async loadRule() {
|
||||
if (!this.data.artistId) {
|
||||
wx.showToast({ title: '缺少美甲师ID', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ loading: true })
|
||||
try {
|
||||
const setting = await employeesApi.scheduleRule({ artistId: this.data.artistId })
|
||||
const rule = setting.rule || {}
|
||||
const preset = buildPreset(rule.presetType)
|
||||
const form = {
|
||||
presetType: rule.presetType || preset.value,
|
||||
workDays: copyWorkDays(rule.workDays || preset.workDays),
|
||||
startTime: String(rule.startTime || preset.startTime).slice(0, 5),
|
||||
endTime: String(rule.endTime || preset.endTime).slice(0, 5),
|
||||
remark: rule.remark || ''
|
||||
}
|
||||
this.setData({
|
||||
form,
|
||||
presetOptions: buildPresetOptions(form.presetType),
|
||||
weekdayOptions: buildWeekdayOptions(form.workDays),
|
||||
exceptions: (setting.exceptions || []).map(item => ({
|
||||
...item,
|
||||
startTime: item.startTime ? String(item.startTime).slice(0, 5) : '',
|
||||
endTime: item.endTime ? String(item.endTime).slice(0, 5) : '',
|
||||
summary: buildExceptionSummary(item)
|
||||
}))
|
||||
})
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '排班规则加载失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
selectPreset(event) {
|
||||
const preset = buildPreset(event.currentTarget.dataset.value)
|
||||
const form = {
|
||||
...this.data.form,
|
||||
presetType: preset.value,
|
||||
workDays: copyWorkDays(preset.workDays),
|
||||
startTime: preset.startTime,
|
||||
endTime: preset.endTime
|
||||
}
|
||||
this.setData({
|
||||
form,
|
||||
presetOptions: buildPresetOptions(form.presetType),
|
||||
weekdayOptions: buildWeekdayOptions(form.workDays)
|
||||
})
|
||||
},
|
||||
|
||||
toggleWeekday(event) {
|
||||
const day = Number(event.currentTarget.dataset.value)
|
||||
const workDays = copyWorkDays(this.data.form.workDays)
|
||||
const exists = workDays.includes(day)
|
||||
const nextDays = exists ? workDays.filter(item => item !== day) : [...workDays, day].sort()
|
||||
this.setData({
|
||||
'form.presetType': 'CUSTOM',
|
||||
'form.workDays': nextDays,
|
||||
presetOptions: buildPresetOptions('CUSTOM'),
|
||||
weekdayOptions: buildWeekdayOptions(nextDays)
|
||||
})
|
||||
},
|
||||
|
||||
onStartChange(event) {
|
||||
this.setData({
|
||||
'form.startTime': event.detail.value,
|
||||
'form.presetType': 'CUSTOM',
|
||||
presetOptions: buildPresetOptions('CUSTOM')
|
||||
})
|
||||
},
|
||||
|
||||
onEndChange(event) {
|
||||
this.setData({
|
||||
'form.endTime': event.detail.value,
|
||||
'form.presetType': 'CUSTOM',
|
||||
presetOptions: buildPresetOptions('CUSTOM')
|
||||
})
|
||||
},
|
||||
|
||||
onInput(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
this.setData({ [`form.${field}`]: event.detail.value })
|
||||
},
|
||||
|
||||
onExceptionInput(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
this.setData({ [`exceptionForm.${field}`]: event.detail.value })
|
||||
},
|
||||
|
||||
onExceptionDateChange(event) {
|
||||
this.setData({ 'exceptionForm.workDate': event.detail.value })
|
||||
},
|
||||
|
||||
onExceptionStartChange(event) {
|
||||
this.setData({ 'exceptionForm.startTime': event.detail.value })
|
||||
},
|
||||
|
||||
onExceptionEndChange(event) {
|
||||
this.setData({ 'exceptionForm.endTime': event.detail.value })
|
||||
},
|
||||
|
||||
onExceptionTypeChange(event) {
|
||||
const index = Number(event.detail.value)
|
||||
const option = this.data.exceptionTypes[index] || this.data.exceptionTypes[0]
|
||||
this.setData({
|
||||
exceptionTypeIndex: index,
|
||||
exceptionTypeLabel: buildExceptionTypeLabel(option.value),
|
||||
'exceptionForm.exceptionType': option.value
|
||||
})
|
||||
},
|
||||
|
||||
async save() {
|
||||
const form = this.data.form
|
||||
const workDays = copyWorkDays(form.workDays)
|
||||
if (!workDays.length) {
|
||||
wx.showToast({ title: '请选择工作日', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.startTime || !form.endTime || form.startTime >= form.endTime) {
|
||||
wx.showToast({ title: '请填写正确的排班时间', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ saving: true })
|
||||
try {
|
||||
await employeesApi.saveScheduleRule({
|
||||
artistId: this.data.artistId,
|
||||
presetType: form.presetType,
|
||||
workDays,
|
||||
startTime: form.startTime,
|
||||
endTime: form.endTime,
|
||||
status: 1,
|
||||
remark: String(form.remark || '').trim()
|
||||
})
|
||||
markPlanningRefresh()
|
||||
wx.showToast({ title: '排班规则已保存', icon: 'success' })
|
||||
await this.loadRule()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '保存失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ saving: false })
|
||||
}
|
||||
},
|
||||
|
||||
async saveException() {
|
||||
const form = this.data.exceptionForm
|
||||
if (!form.workDate || !form.exceptionType) {
|
||||
wx.showToast({ title: '请补全例外日期', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (form.exceptionType !== 'REST' && (!form.startTime || !form.endTime || form.startTime >= form.endTime)) {
|
||||
wx.showToast({ title: '请填写正确的例外时间', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ saving: true })
|
||||
try {
|
||||
await employeesApi.saveScheduleException({
|
||||
artistId: this.data.artistId,
|
||||
workDate: form.workDate,
|
||||
exceptionType: form.exceptionType,
|
||||
startTime: form.exceptionType === 'REST' ? null : form.startTime,
|
||||
endTime: form.exceptionType === 'REST' ? null : form.endTime,
|
||||
remark: String(form.remark || '').trim()
|
||||
})
|
||||
markPlanningRefresh()
|
||||
wx.showToast({ title: '例外已保存', icon: 'success' })
|
||||
await this.loadRule()
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '例外保存失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ saving: false })
|
||||
}
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "排班设置"
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<view class="page no-tab">
|
||||
<view class="section">
|
||||
<view class="section-title">常规排班</view>
|
||||
<view class="card rule-card">
|
||||
<view class="preset-grid">
|
||||
<view wx:for="{{presetOptions}}" wx:key="value" class="preset-chip {{item.active ? 'active' : ''}}" data-value="{{item.value}}" bindtap="selectPreset">{{item.label}}</view>
|
||||
</view>
|
||||
|
||||
<view class="field-block">
|
||||
<view class="field-title">工作日</view>
|
||||
<view class="weekday-grid">
|
||||
<view wx:for="{{weekdayOptions}}" wx:key="value" class="weekday-chip {{item.active ? 'active' : ''}}" data-value="{{item.value}}" bindtap="toggleWeekday">{{item.label}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="field">
|
||||
<text class="field-label">开始时间</text>
|
||||
<picker mode="time" value="{{form.startTime}}" bindchange="onStartChange"><view class="field-value">{{form.startTime}}</view></picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">结束时间</text>
|
||||
<picker mode="time" value="{{form.endTime}}" bindchange="onEndChange"><view class="field-value">{{form.endTime}}</view></picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">备注</text>
|
||||
<input value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="可选" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section">
|
||||
<view class="section-title">特殊日期</view>
|
||||
<view class="card rule-card">
|
||||
<view class="field">
|
||||
<text class="field-label">日期</text>
|
||||
<picker mode="date" value="{{exceptionForm.workDate}}" bindchange="onExceptionDateChange"><view class="field-value">{{exceptionForm.workDate}}</view></picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">类型</text>
|
||||
<picker range="{{exceptionTypes}}" range-key="label" value="{{exceptionTypeIndex}}" bindchange="onExceptionTypeChange"><view class="field-value">{{exceptionTypeLabel}}</view></picker>
|
||||
</view>
|
||||
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field">
|
||||
<text class="field-label">开始时间</text>
|
||||
<picker mode="time" value="{{exceptionForm.startTime}}" bindchange="onExceptionStartChange"><view class="field-value">{{exceptionForm.startTime}}</view></picker>
|
||||
</view>
|
||||
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field">
|
||||
<text class="field-label">结束时间</text>
|
||||
<picker mode="time" value="{{exceptionForm.endTime}}" bindchange="onExceptionEndChange"><view class="field-value">{{exceptionForm.endTime}}</view></picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">备注</text>
|
||||
<input value="{{exceptionForm.remark}}" data-field="remark" bindinput="onExceptionInput" placeholder="可选" />
|
||||
</view>
|
||||
<button class="secondary-btn exception-btn" loading="{{saving}}" bindtap="saveException">保存特殊日期</button>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{exceptions.length}}" class="exception-list">
|
||||
<view wx:for="{{exceptions}}" wx:key="id" class="card exception-card">
|
||||
<text>{{item.summary}}</text>
|
||||
<text wx:if="{{item.remark}}" class="exception-remark">{{item.remark}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="fixed-bottom">
|
||||
<button class="primary-btn" loading="{{saving}}" bindtap="save">保存排班规则</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,94 @@
|
||||
.rule-card {
|
||||
padding: 20rpx 24rpx;
|
||||
}
|
||||
|
||||
.preset-grid,
|
||||
.weekday-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.preset-chip,
|
||||
.weekday-chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 128rpx;
|
||||
height: 60rpx;
|
||||
padding: 0 22rpx;
|
||||
border: 1rpx solid #e3ddd4;
|
||||
border-radius: 999rpx;
|
||||
background: #fbf7f0;
|
||||
color: #5f5951;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
|
||||
}
|
||||
|
||||
.preset-chip.active,
|
||||
.weekday-chip.active {
|
||||
border-color: #6f8f83;
|
||||
background: #e5eee9;
|
||||
color: #55786d;
|
||||
transform: translateY(-2rpx);
|
||||
}
|
||||
|
||||
.field-block {
|
||||
padding: 26rpx 0 12rpx;
|
||||
border-bottom: 1rpx solid #eee8df;
|
||||
}
|
||||
|
||||
.field-title {
|
||||
margin-bottom: 16rpx;
|
||||
color: #625c55;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.field input,
|
||||
.field-value {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.field-value {
|
||||
min-height: 58rpx;
|
||||
padding: 14rpx 20rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f4f0ea;
|
||||
color: #4d473f;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.exception-btn {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
.exception-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.exception-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
color: #4c4740;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
transition: transform 180ms ease, box-shadow 180ms ease;
|
||||
}
|
||||
|
||||
.exception-card:active {
|
||||
transform: scale(0.99);
|
||||
}
|
||||
|
||||
.exception-remark {
|
||||
color: #8d857b;
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
const { BRAND_CONFIG } = require('../../utils/config')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
form: { shopName: BRAND_CONFIG.defaultShopName, startTime: '10:00', endTime: '22:00', defaultDuration: 60, rule: '必须选择已有作品作为项目来源' }
|
||||
},
|
||||
onInput(event) { this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) },
|
||||
onStartChange(event) { this.setData({ 'form.startTime': event.detail.value }) },
|
||||
onEndChange(event) { this.setData({ 'form.endTime': event.detail.value }) },
|
||||
explainDefaultDuration() {
|
||||
wx.showModal({
|
||||
title: '默认时长',
|
||||
content: '用于手动创建预约或未选择作品时的默认服务时长,会影响可约时间校验和预约结束时间估算。',
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
})
|
||||
},
|
||||
explainBookingRule() {
|
||||
wx.showModal({
|
||||
title: '预约规则',
|
||||
content: '这是店铺给员工看的预约备注或说明文案,不参与自动排班、容量或冲突校验。',
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
})
|
||||
},
|
||||
save() { wx.showToast({ title: '已保存' }) },
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "店铺设置"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<view class="page no-tab">
|
||||
<view class="card form-card">
|
||||
<view class="field"><text class="field-label">店铺名称</text><input value="{{form.shopName}}" data-field="shopName" bindinput="onInput" /></view>
|
||||
<view class="field"><text class="field-label">营业开始</text><picker mode="time" value="{{form.startTime}}" bindchange="onStartChange"><view class="field-value">{{form.startTime}}</view></picker></view>
|
||||
<view class="field"><text class="field-label">营业结束</text><picker mode="time" value="{{form.endTime}}" bindchange="onEndChange"><view class="field-value">{{form.endTime}}</view></picker></view>
|
||||
<view class="field">
|
||||
<view class="label-with-help">
|
||||
<text class="field-label">默认时长</text>
|
||||
<text class="help-badge" catchtap="explainDefaultDuration">?</text>
|
||||
</view>
|
||||
<input type="number" value="{{form.defaultDuration}}" data-field="defaultDuration" bindinput="onInput" />
|
||||
<text class="muted">分钟</text>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="label-with-help">
|
||||
<text class="field-label">预约规则</text>
|
||||
<text class="help-badge" catchtap="explainBookingRule">?</text>
|
||||
</view>
|
||||
<input value="{{form.rule}}" data-field="rule" bindinput="onInput" placeholder="例如:必须选择已有作品作为项目来源" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="fixed-bottom"><button class="primary-btn" bindtap="save">保存设置</button></view>
|
||||
</view>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
.label-with-help {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 144rpx;
|
||||
}
|
||||
|
||||
.label-with-help .field-label {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.help-badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
margin-left: 8rpx;
|
||||
border-radius: 50%;
|
||||
background: #e5eee9;
|
||||
color: #4e7165;
|
||||
font-size: 20rpx;
|
||||
font-weight: 800;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"appid": "wxb6d77f7c07020d51",
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "3.15.2",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": true,
|
||||
"enhance": true,
|
||||
"postcss": true,
|
||||
"minified": true,
|
||||
"packNpmRelationList": [],
|
||||
"compileHotReLoad": true,
|
||||
"skylineRenderEnable": false,
|
||||
"compileWorklet": false,
|
||||
"uglifyFileName": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"packNpmManually": false,
|
||||
"minifyWXSS": true,
|
||||
"minifyWXML": true,
|
||||
"localPlugins": false,
|
||||
"disableUseStrict": false,
|
||||
"useCompilerPlugins": false,
|
||||
"condition": false,
|
||||
"swc": false,
|
||||
"disableSWC": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"condition": {},
|
||||
"projectname": "Jayu Salon",
|
||||
"simulatorType": "wechat",
|
||||
"simulatorPluginLibVersion": {},
|
||||
"editorSetting": {},
|
||||
"testRoot": "minitest/"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"libVersion": "3.15.2",
|
||||
"condition": {},
|
||||
"projectname": "JY-Salon-WeChat",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"coverView": false,
|
||||
"lazyloadPlaceholderEnable": false,
|
||||
"skylineRenderEnable": false,
|
||||
"preloadBackgroundData": false,
|
||||
"autoAudits": false,
|
||||
"useApiHook": true,
|
||||
"showShadowRootInWxmlPanel": false,
|
||||
"useStaticServer": false,
|
||||
"useLanDebug": false,
|
||||
"showES6CompileOption": false,
|
||||
"compileHotReLoad": true,
|
||||
"checkInvalidKey": true,
|
||||
"ignoreDevUnusedFiles": true,
|
||||
"bigPackageSizeSupport": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"rules": [
|
||||
{
|
||||
"action": "allow",
|
||||
"page": "*"
|
||||
}
|
||||
]
|
||||
}
|
||||