修复店务预约与小程序生产问题
This commit is contained in:
@@ -269,6 +269,9 @@ Page({
|
||||
manualProductImageUrl: '',
|
||||
durationMinutes: '',
|
||||
artistId: '',
|
||||
depositPaid: false,
|
||||
needRemoval: false,
|
||||
fromMeituan: false,
|
||||
remark: ''
|
||||
},
|
||||
customerOptions: [],
|
||||
@@ -378,6 +381,13 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
onToggleChange(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
this.setData({
|
||||
[`form.${field}`]: !!event.detail.value
|
||||
})
|
||||
},
|
||||
|
||||
onCustomerFocus(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
this.setData({ customerDropdownVisible: true })
|
||||
@@ -715,8 +725,10 @@ Page({
|
||||
}
|
||||
const form = this.data.form
|
||||
const hasManualProduct = String(form.manualProductTitle || '').trim() && String(form.manualProductPrice || '').trim()
|
||||
const customerName = String(form.customerName || '').trim()
|
||||
const phone = String(form.phone || '').trim()
|
||||
const durationMinutes = normalizeDuration(form.durationMinutes)
|
||||
if (!form.customerName || !form.phone || (!form.productId && !hasManualProduct) || !form.artistId) {
|
||||
if (!customerName || (!form.productId && !hasManualProduct) || !form.artistId) {
|
||||
wx.showToast({ title: '请补全预约信息', icon: 'none' })
|
||||
return
|
||||
}
|
||||
@@ -733,8 +745,13 @@ Page({
|
||||
try {
|
||||
const payload = {
|
||||
...form,
|
||||
customerName,
|
||||
phone: phone || undefined,
|
||||
customerUserId: form.customerUserId ? String(form.customerUserId) : undefined,
|
||||
artistId: String(form.artistId),
|
||||
depositPaid: !!form.depositPaid,
|
||||
needRemoval: !!form.needRemoval,
|
||||
fromMeituan: !!form.fromMeituan,
|
||||
durationMinutes,
|
||||
clientRequestId: buildClientRequestId('manager-appointment')
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<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="搜索或输入手机号" />
|
||||
<text class="field-label">手机号</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>
|
||||
@@ -58,6 +58,26 @@
|
||||
<text class="time-arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="appointment-flags">
|
||||
<view class="field toggle-field">
|
||||
<view class="toggle-copy">
|
||||
<text class="field-label">是否交定金</text>
|
||||
</view>
|
||||
<switch checked="{{form.depositPaid}}" color="#6f8f83" data-field="depositPaid" bindchange="onToggleChange" />
|
||||
</view>
|
||||
<view class="field toggle-field">
|
||||
<view class="toggle-copy">
|
||||
<text class="field-label">是否需要卸甲</text>
|
||||
</view>
|
||||
<switch checked="{{form.needRemoval}}" color="#6f8f83" data-field="needRemoval" bindchange="onToggleChange" />
|
||||
</view>
|
||||
<view class="field toggle-field">
|
||||
<view class="toggle-copy">
|
||||
<text class="field-label">是否来自美团</text>
|
||||
</view>
|
||||
<switch checked="{{form.fromMeituan}}" color="#6f8f83" data-field="fromMeituan" bindchange="onToggleChange" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="field textarea-field">
|
||||
<text class="field-label">备注</text>
|
||||
<textarea value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="客户偏好、款式说明" />
|
||||
|
||||
@@ -130,6 +130,25 @@
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.appointment-flags {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14rpx;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
|
||||
.toggle-field {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.toggle-copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 4rpx;
|
||||
}
|
||||
|
||||
.capacity-tip {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -1,7 +1,28 @@
|
||||
const employeesApi = require('../../api/employees')
|
||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||
|
||||
function normalizeColor(value) {
|
||||
let color = String(value || '').trim()
|
||||
if (!color) {
|
||||
return ''
|
||||
}
|
||||
if (color[0] !== '#') {
|
||||
color = `#${color}`
|
||||
}
|
||||
if (!/^#[0-9a-fA-F]{6}$/.test(color)) {
|
||||
return ''
|
||||
}
|
||||
return color.toUpperCase()
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
id: '',
|
||||
employee: {},
|
||||
selected: '#7BA7C7',
|
||||
customColor: '#7BA7C7',
|
||||
saving: false,
|
||||
loadError: '',
|
||||
wheelColors: [
|
||||
'#E0627A', '#E7785B', '#E2A64B', '#D8C85C', '#9EBB63', '#63B77B',
|
||||
'#4CB7A6', '#56A7D6', '#5F82D7', '#7C70D4', '#A66BC8', '#CF72A8'
|
||||
@@ -15,26 +36,93 @@ Page({
|
||||
'#6D8491', '#829A9A', '#A9B3A2', '#C6B7D1', '#E0C2B6', '#F0D6A8'
|
||||
]
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({ id: options.id || '' })
|
||||
this.loadDetail()
|
||||
},
|
||||
|
||||
async loadDetail() {
|
||||
const userId = this.data.id
|
||||
if (!userId) {
|
||||
this.setData({ loadError: '员工ID不能为空' })
|
||||
return
|
||||
}
|
||||
try {
|
||||
const data = await employeesApi.detail(userId)
|
||||
const color = normalizeColor(data.color) || this.data.selected
|
||||
this.setData({
|
||||
loadError: '',
|
||||
employee: data,
|
||||
selected: color,
|
||||
customColor: color
|
||||
})
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
employee: {},
|
||||
loadError: error.message || '美甲师详情加载失败'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
select(event) {
|
||||
const color = event.currentTarget.dataset.color
|
||||
const color = normalizeColor(event.currentTarget.dataset.color)
|
||||
if (!color) {
|
||||
return
|
||||
}
|
||||
this.setData({ selected: color, customColor: color })
|
||||
},
|
||||
|
||||
selectWheelColor(event) {
|
||||
const color = event.currentTarget.dataset.color
|
||||
const color = normalizeColor(event.currentTarget.dataset.color)
|
||||
if (!color) {
|
||||
return
|
||||
}
|
||||
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)) {
|
||||
const color = normalizeColor(this.data.customColor)
|
||||
if (!color) {
|
||||
wx.showToast({ title: '请输入6位色值', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ selected: color.toUpperCase(), customColor: color.toUpperCase() })
|
||||
this.setData({ selected: color, customColor: color })
|
||||
},
|
||||
save() { wx.showToast({ title: '已保存到本地' }) },
|
||||
back() { wx.navigateBack() }
|
||||
|
||||
async save() {
|
||||
if (!this.data.id) {
|
||||
wx.showToast({ title: '员工ID不能为空', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const color = normalizeColor(this.data.selected)
|
||||
if (!color) {
|
||||
wx.showToast({ title: '请选择正确颜色', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ saving: true })
|
||||
try {
|
||||
await employeesApi.save({
|
||||
userId: this.data.id,
|
||||
color
|
||||
})
|
||||
markPlanningRefresh()
|
||||
wx.showToast({ title: '已保存', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
wx.navigateBack()
|
||||
}, 300)
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '保存失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ saving: false })
|
||||
}
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,27 +1,37 @@
|
||||
<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 wx:if="{{loadError}}" class="empty card">
|
||||
<text>{{loadError}}</text>
|
||||
<button class="secondary-btn retry-btn" bindtap="loadDetail">重试</button>
|
||||
</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>
|
||||
|
||||
<block wx:else>
|
||||
<view class="card color-preview" style="background: {{selected}};">
|
||||
<text class="color-preview-name">{{employee.nickname || employee.name || '员工颜色'}}</text>
|
||||
<text class="color-preview-value">{{selected}}</text>
|
||||
</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="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 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>
|
||||
<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 class="fixed-bottom"><button class="primary-btn" loading="{{saving}}" bindtap="save">保存颜色</button></view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
.color-preview {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10rpx;
|
||||
height: 168rpx;
|
||||
color: #fff;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.color-preview-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.color-preview-value {
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.palette {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
|
||||
@@ -12,7 +12,12 @@ Page({
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({ id: options.id || '' })
|
||||
this.loadDetail()
|
||||
},
|
||||
|
||||
onShow() {
|
||||
if (this.data.id) {
|
||||
this.loadDetail()
|
||||
}
|
||||
},
|
||||
|
||||
async loadDetail() {
|
||||
|
||||
@@ -28,7 +28,7 @@ Page({
|
||||
avatarUploading: false
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
onShow() {
|
||||
this.loadEmployees()
|
||||
},
|
||||
|
||||
@@ -43,7 +43,7 @@ Page({
|
||||
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],
|
||||
color: item.color || EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
|
||||
monthOrders: item.monthOrders || item.orderCount || 0,
|
||||
monthAmount: item.monthAmount || item.turnover || 0,
|
||||
scheduleSummary: buildScheduleSummary(item)
|
||||
|
||||
@@ -67,24 +67,31 @@
|
||||
.code-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.code-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.code-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 160rpx;
|
||||
min-width: 160rpx;
|
||||
max-width: 160rpx;
|
||||
height: 56rpx;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
color: #6f8f83;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
text-align: right;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.agreement-row,
|
||||
|
||||
@@ -41,6 +41,17 @@ function resolveAppointmentTimeText(item) {
|
||||
return `${startText}-${endText}`
|
||||
}
|
||||
|
||||
function buildAppointmentBadges(item) {
|
||||
const badges = []
|
||||
if (item.needRemoval) {
|
||||
badges.push({ key: 'needRemoval', text: '需卸甲', type: 'removal' })
|
||||
}
|
||||
if (item.fromMeituan) {
|
||||
badges.push({ key: 'fromMeituan', text: '美团', type: 'meituan' })
|
||||
}
|
||||
return badges
|
||||
}
|
||||
|
||||
function isCompletedStatus(status) {
|
||||
return Number(status) === 2
|
||||
}
|
||||
@@ -150,7 +161,7 @@ Page({
|
||||
selectedArtistId: id,
|
||||
selectedArtistName: artist ? artist.name : '全部员工'
|
||||
})
|
||||
this.prepareView()
|
||||
this.loadCalendar()
|
||||
},
|
||||
|
||||
selectDate(event) {
|
||||
@@ -366,8 +377,9 @@ Page({
|
||||
return {
|
||||
...item,
|
||||
top: Math.max(0, itemStart - startMinute) + laneHeaderHeight,
|
||||
height: Math.max(64, item.durationMinutes || 60),
|
||||
height: Math.max(82, item.durationMinutes || 60),
|
||||
timeText: resolveAppointmentTimeText(item),
|
||||
badges: buildAppointmentBadges(item),
|
||||
statusClass: appointmentStatusClass(item.status)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -66,6 +66,9 @@
|
||||
<view wx:for="{{item.blocks}}" wx:for-item="block" wx:key="orderItemId" class="appointment-block {{block.statusClass}}" 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>
|
||||
<view wx:if="{{block.badges.length}}" class="block-badges">
|
||||
<text wx:for="{{block.badges}}" wx:for-item="badge" wx:key="key" class="block-badge {{badge.type}}">{{badge.text}}</text>
|
||||
</view>
|
||||
<text class="block-status">{{block.statusText}}</text>
|
||||
</view>
|
||||
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">全天可约</view>
|
||||
|
||||
@@ -355,6 +355,35 @@
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.block-badges {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.block-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 24rpx;
|
||||
padding: 0 8rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(255, 255, 255, 0.82);
|
||||
color: #7b5b46;
|
||||
font-size: 18rpx;
|
||||
font-weight: 800;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.block-badge.removal {
|
||||
background: #fff0dc;
|
||||
color: #9a5f2d;
|
||||
}
|
||||
|
||||
.block-badge.meituan {
|
||||
background: #eaf4ff;
|
||||
color: #49729d;
|
||||
}
|
||||
|
||||
.lane-empty {
|
||||
position: absolute;
|
||||
top: 76rpx;
|
||||
|
||||
@@ -2,7 +2,7 @@ const { BRAND_CONFIG } = require('../../utils/config')
|
||||
const userApi = require('../../api/user')
|
||||
const authApi = require('../../api/auth')
|
||||
const auth = require('../../utils/auth')
|
||||
const { chooseImageFilePath, uploadProfileImage } = require('../../utils/upload')
|
||||
const { chooseImageFilePath, uploadAvatar } = require('../../utils/upload')
|
||||
|
||||
function resolveRoleText(type) {
|
||||
const role = Number(type)
|
||||
@@ -184,8 +184,13 @@ Page({
|
||||
return
|
||||
}
|
||||
this.setData({ avatarUploading: true })
|
||||
const avatar = await uploadProfileImage(filePath)
|
||||
this.setData({ 'profileForm.avatar': avatar })
|
||||
const avatar = await uploadAvatar(filePath)
|
||||
const profile = await userApi.info()
|
||||
this.syncProfileToSession({
|
||||
...profile,
|
||||
avatar: profile.avatar || avatar
|
||||
})
|
||||
this.setData({ 'profileForm.avatar': profile.avatar || avatar })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
|
||||
} finally {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<view class="page">
|
||||
<view class="card profile-card">
|
||||
<view class="profile-main">
|
||||
<view class="shop-logo">指</view>
|
||||
<view wx:if="{{userInfo.avatar}}" class="shop-logo image-avatar">
|
||||
<image src="{{userInfo.avatar}}" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view wx:else class="shop-logo">指</view>
|
||||
<view class="profile-copy">
|
||||
<text class="shop-name">{{shopName}}</text>
|
||||
<text class="phone">{{phone}}</text>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
flex-shrink: 0;
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 24rpx;
|
||||
background: #6f8f83;
|
||||
color: #fff;
|
||||
@@ -31,6 +32,11 @@
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.shop-logo image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.shop-name,
|
||||
.phone {
|
||||
display: block;
|
||||
|
||||
Reference in New Issue
Block a user