完善店员申请关联与预约页面
This commit is contained in:
+1
@@ -647,6 +647,7 @@ public class PlanningServiceImpl implements PlanningService {
|
|||||||
vo.setConflictReason(resolveAppointmentConflictReason(occupancyStatus));
|
vo.setConflictReason(resolveAppointmentConflictReason(occupancyStatus));
|
||||||
vo.setAmount(order == null ? null : order.getActualAmount());
|
vo.setAmount(order == null ? null : order.getActualAmount());
|
||||||
vo.setRemark(order == null ? null : order.getCustomerRemark());
|
vo.setRemark(order == null ? null : order.getCustomerRemark());
|
||||||
|
vo.setCancelReason(order == null ? null : order.getCancelReason());
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
@@ -32,4 +32,5 @@ public class PlanningAppointmentVO {
|
|||||||
private String conflictReason;
|
private String conflictReason;
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
private String remark;
|
private String remark;
|
||||||
|
private String cancelReason;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -504,6 +504,7 @@ class PlanningServiceImplTest {
|
|||||||
OrderDO order = order(54L, OrderStatus.PENDING_SERVICE.getCode());
|
OrderDO order = order(54L, OrderStatus.PENDING_SERVICE.getCode());
|
||||||
order.setCustomerNameSnapshot("散客预约");
|
order.setCustomerNameSnapshot("散客预约");
|
||||||
order.setCustomerPhoneSnapshot("13800138000");
|
order.setCustomerPhoneSnapshot("13800138000");
|
||||||
|
order.setCancelReason("门店临时闭店");
|
||||||
OrderItemDO item = new OrderItemDO();
|
OrderItemDO item = new OrderItemDO();
|
||||||
item.setId(64L);
|
item.setId(64L);
|
||||||
item.setOrderId(54L);
|
item.setOrderId(54L);
|
||||||
@@ -520,6 +521,7 @@ class PlanningServiceImplTest {
|
|||||||
assertNull(result.getCustomerId());
|
assertNull(result.getCustomerId());
|
||||||
assertEquals("散客预约", result.getCustomerName());
|
assertEquals("散客预约", result.getCustomerName());
|
||||||
assertEquals("13800138000", result.getCustomerPhone());
|
assertEquals("13800138000", result.getCustomerPhone());
|
||||||
|
assertEquals("门店临时闭店", result.getCancelReason());
|
||||||
verify(userMapper, never()).selectById(org.mockito.ArgumentMatchers.isNull());
|
verify(userMapper, never()).selectById(org.mockito.ArgumentMatchers.isNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,17 @@
|
|||||||
const planningApi = require('../../api/planning')
|
const planningApi = require('../../api/planning')
|
||||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||||
|
|
||||||
|
function displayValue(value, fallback) {
|
||||||
|
if (value === null || value === undefined) return fallback
|
||||||
|
const text = String(value).trim()
|
||||||
|
return !text || text === 'null' || text === 'undefined' ? fallback : text
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatAmount(value) {
|
||||||
|
const amount = displayValue(value, '')
|
||||||
|
return amount ? `¥${amount}` : '未记录'
|
||||||
|
}
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
id: '',
|
id: '',
|
||||||
@@ -8,6 +19,11 @@ Page({
|
|||||||
avatarText: '',
|
avatarText: '',
|
||||||
timeText: '',
|
timeText: '',
|
||||||
isUnassigned: false,
|
isUnassigned: false,
|
||||||
|
showTransfer: false,
|
||||||
|
showConfirm: false,
|
||||||
|
showComplete: false,
|
||||||
|
showCancel: false,
|
||||||
|
updating: false,
|
||||||
loadError: ''
|
loadError: ''
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -31,20 +47,50 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
applyAppointment(appointment) {
|
applyAppointment(appointment) {
|
||||||
|
const safeAppointment = appointment || {}
|
||||||
|
const status = Number(safeAppointment.status)
|
||||||
|
const historicalBackfill = Boolean(safeAppointment.historicalBackfill)
|
||||||
|
const isUnassigned = safeAppointment.assignmentStatus === 'UNASSIGNED' || !safeAppointment.artistId
|
||||||
|
const startTime = displayValue(safeAppointment.startTime, '')
|
||||||
|
const endTime = displayValue(safeAppointment.endTime, '')
|
||||||
|
const timeText = historicalBackfill && !startTime
|
||||||
|
? '时间未记录'
|
||||||
|
: startTime
|
||||||
|
? `${startTime.slice(0, 16)}${endTime ? ` - ${endTime.slice(11, 16)}` : ''}`
|
||||||
|
: displayValue(safeAppointment.date, '时间未记录')
|
||||||
|
const normalizedAppointment = {
|
||||||
|
...safeAppointment,
|
||||||
|
customerNameText: displayValue(safeAppointment.customerName, '散客'),
|
||||||
|
customerPhoneText: displayValue(safeAppointment.customerPhone, '未留手机号'),
|
||||||
|
orderNoText: displayValue(safeAppointment.orderNo, '未记录'),
|
||||||
|
productTitleText: displayValue(safeAppointment.productTitle, '未记录'),
|
||||||
|
artistNameText: isUnassigned ? '待分配' : displayValue(safeAppointment.artistName, '未记录'),
|
||||||
|
durationText: Number(safeAppointment.durationMinutes) > 0 ? `${safeAppointment.durationMinutes} 分钟` : '未记录',
|
||||||
|
amountText: formatAmount(safeAppointment.amount),
|
||||||
|
statusText: displayValue(safeAppointment.statusText, '状态未知'),
|
||||||
|
remarkText: displayValue(safeAppointment.remark, '暂无备注'),
|
||||||
|
cancelReasonText: displayValue(safeAppointment.cancelReason, '')
|
||||||
|
}
|
||||||
this.setData({
|
this.setData({
|
||||||
appointment,
|
appointment: normalizedAppointment,
|
||||||
isUnassigned: appointment.assignmentStatus === 'UNASSIGNED' || !appointment.artistId,
|
isUnassigned,
|
||||||
avatarText: String(appointment.customerName || '客').slice(0, 1),
|
avatarText: normalizedAppointment.customerNameText.slice(0, 1),
|
||||||
timeText: appointment.historicalBackfill && !appointment.startTime ? '时间未记录' : `${(appointment.startTime || '').slice(0, 16)} - ${(appointment.endTime || '').slice(11, 16)}`,
|
timeText,
|
||||||
|
showTransfer: Boolean(safeAppointment.canEdit) && !historicalBackfill,
|
||||||
|
showConfirm: Boolean(safeAppointment.canEdit) && !historicalBackfill && !isUnassigned && status === 0,
|
||||||
|
showComplete: !isUnassigned && (status === 1 || status === 4),
|
||||||
|
showCancel: Boolean(safeAppointment.canCancel),
|
||||||
loadError: ''
|
loadError: ''
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateStatus(status) {
|
async updateStatus(status) {
|
||||||
|
if (this.data.updating || !this.data.appointment.orderId) return
|
||||||
if (status !== 3 && this.data.isUnassigned) {
|
if (status !== 3 && this.data.isUnassigned) {
|
||||||
wx.showToast({ title: '请先分配美甲师', icon: 'none' })
|
wx.showToast({ title: '请先分配美甲师', icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.setData({ updating: true })
|
||||||
try {
|
try {
|
||||||
await planningApi.updateStatus(this.data.appointment.orderId, status, this._cancelReason || '')
|
await planningApi.updateStatus(this.data.appointment.orderId, status, this._cancelReason || '')
|
||||||
markPlanningRefresh()
|
markPlanningRefresh()
|
||||||
@@ -52,19 +98,24 @@ Page({
|
|||||||
this.loadDetail()
|
this.loadDetail()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
wx.showToast({ title: error.message || '操作失败', icon: 'none' })
|
wx.showToast({ title: error.message || '操作失败', icon: 'none' })
|
||||||
|
} finally {
|
||||||
|
this.setData({ updating: false })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
if (this.data.appointment.historicalBackfill) return
|
if (!this.data.showConfirm || this.data.updating) return
|
||||||
this.updateStatus(1)
|
this.updateStatus(1)
|
||||||
},
|
},
|
||||||
|
|
||||||
complete() {
|
complete() {
|
||||||
|
if (!this.data.showComplete || this.data.updating) return
|
||||||
this.updateStatus(2)
|
this.updateStatus(2)
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
|
if (!this.data.showCancel || this.data.updating) return
|
||||||
|
this._cancelReason = ''
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: '取消预约',
|
title: '取消预约',
|
||||||
editable: true,
|
editable: true,
|
||||||
@@ -80,7 +131,7 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
goTransfer() {
|
goTransfer() {
|
||||||
if (this.data.appointment.historicalBackfill) return
|
if (!this.data.showTransfer) return
|
||||||
wx.navigateTo({ url: `/pages/artist-transfer/index?id=${this.data.id}` })
|
wx.navigateTo({ url: `/pages/artist-transfer/index?id=${this.data.id}` })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
const assert = require('assert')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
global.wx = {
|
||||||
|
showToast: () => {},
|
||||||
|
showModal: options => options.success({ confirm: false }),
|
||||||
|
navigateTo: () => {},
|
||||||
|
navigateBack: () => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
let definition
|
||||||
|
global.Page = value => { definition = value }
|
||||||
|
require('./index')
|
||||||
|
|
||||||
|
function createPage() {
|
||||||
|
return {
|
||||||
|
...definition,
|
||||||
|
data: { ...definition.data },
|
||||||
|
setData(values) { Object.assign(this.data, values) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const page = createPage()
|
||||||
|
page.applyAppointment({
|
||||||
|
orderId: 1,
|
||||||
|
orderNo: 'SALON-001',
|
||||||
|
customerName: '到店客户',
|
||||||
|
customerPhone: null,
|
||||||
|
productTitle: null,
|
||||||
|
artistName: null,
|
||||||
|
artistId: null,
|
||||||
|
assignmentStatus: 'UNASSIGNED',
|
||||||
|
startTime: null,
|
||||||
|
endTime: null,
|
||||||
|
durationMinutes: null,
|
||||||
|
amount: null,
|
||||||
|
remark: null,
|
||||||
|
status: 0,
|
||||||
|
statusText: '待确认',
|
||||||
|
canEdit: true,
|
||||||
|
canCancel: true
|
||||||
|
})
|
||||||
|
assert.strictEqual(page.data.appointment.customerPhoneText, '未留手机号')
|
||||||
|
assert.strictEqual(page.data.appointment.productTitleText, '未记录')
|
||||||
|
assert.strictEqual(page.data.appointment.artistNameText, '待分配')
|
||||||
|
assert.strictEqual(page.data.appointment.amountText, '未记录')
|
||||||
|
assert.strictEqual(page.data.appointment.remarkText, '暂无备注')
|
||||||
|
assert.strictEqual(page.data.appointment.orderNoText, 'SALON-001')
|
||||||
|
assert.strictEqual(page.data.showTransfer, true)
|
||||||
|
assert.strictEqual(page.data.showConfirm, false)
|
||||||
|
assert.strictEqual(page.data.showComplete, false)
|
||||||
|
assert.strictEqual(page.data.showCancel, true)
|
||||||
|
assert.strictEqual([
|
||||||
|
page.data.appointment.customerNameText,
|
||||||
|
page.data.appointment.customerPhoneText,
|
||||||
|
page.data.appointment.orderNoText,
|
||||||
|
page.data.appointment.productTitleText,
|
||||||
|
page.data.appointment.artistNameText,
|
||||||
|
page.data.appointment.durationText,
|
||||||
|
page.data.appointment.amountText,
|
||||||
|
page.data.appointment.remarkText
|
||||||
|
].some(value => String(value).includes('null')), false)
|
||||||
|
|
||||||
|
page.applyAppointment({
|
||||||
|
artistId: 9,
|
||||||
|
assignmentStatus: 'ASSIGNED',
|
||||||
|
status: 3,
|
||||||
|
statusText: '已取消',
|
||||||
|
canEdit: false,
|
||||||
|
canCancel: false,
|
||||||
|
cancelReason: '客户临时调整时间'
|
||||||
|
})
|
||||||
|
assert.strictEqual(page.data.appointment.cancelReasonText, '客户临时调整时间')
|
||||||
|
assert.strictEqual(page.data.showTransfer, false)
|
||||||
|
assert.strictEqual(page.data.showConfirm, false)
|
||||||
|
assert.strictEqual(page.data.showComplete, false)
|
||||||
|
assert.strictEqual(page.data.showCancel, false)
|
||||||
|
|
||||||
|
page.applyAppointment({
|
||||||
|
artistId: 9,
|
||||||
|
assignmentStatus: 'ASSIGNED',
|
||||||
|
status: 4,
|
||||||
|
statusText: '服务中',
|
||||||
|
historicalBackfill: true,
|
||||||
|
canEdit: false,
|
||||||
|
canCancel: true
|
||||||
|
})
|
||||||
|
assert.strictEqual(page.data.showTransfer, false)
|
||||||
|
assert.strictEqual(page.data.showComplete, true)
|
||||||
|
assert.strictEqual(page.data.showCancel, true)
|
||||||
|
|
||||||
|
const markup = fs.readFileSync(path.join(__dirname, 'index.wxml'), 'utf8')
|
||||||
|
const styles = fs.readFileSync(path.join(__dirname, 'index.wxss'), 'utf8')
|
||||||
|
;['订单编号', '服务项目', '美甲师', '时长', '成交金额', '取消原因', 'remarkText', 'customerPhoneText'].forEach(text => assert(markup.includes(text)))
|
||||||
|
assert.match(markup, /class="primary-btn transfer-action"/)
|
||||||
|
assert.match(markup, /class="danger-btn"/)
|
||||||
|
assert.match(styles, /\.transfer-action\s*\{[^}]*box-shadow/)
|
||||||
@@ -9,44 +9,53 @@
|
|||||||
<view class="detail-person">
|
<view class="detail-person">
|
||||||
<view class="avatar">{{avatarText}}</view>
|
<view class="avatar">{{avatarText}}</view>
|
||||||
<view>
|
<view>
|
||||||
<text class="customer">{{appointment.customerName}}</text>
|
<text class="customer">{{appointment.customerNameText}}</text>
|
||||||
<text class="phone">{{appointment.customerPhone}}</text>
|
<text class="phone">{{appointment.customerPhoneText}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="detail-actions">
|
<text class="status-tag {{appointment.status === 2 ? 'completed' : appointment.status === 3 ? 'cancelled' : ''}}">{{appointment.historicalBackfill ? '历史补单 · ' : ''}}{{appointment.statusText}}</text>
|
||||||
<text wx:if="{{appointment.historicalBackfill}}" class="tag">历史补单 · {{appointment.statusText}}</text>
|
|
||||||
<text wx:else class="tag">{{appointment.statusText}}</text>
|
|
||||||
<button wx:if="{{!appointment.historicalBackfill}}" class="small-action" bindtap="goTransfer">{{isUnassigned ? '分配美甲师' : '改派'}}</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="detail-grid">
|
<view class="detail-grid">
|
||||||
<view>
|
<view class="detail-field">
|
||||||
<text class="label">项目</text>
|
<text class="label">订单编号</text>
|
||||||
<text class="value">{{appointment.productTitle}}</text>
|
<text class="value">{{appointment.orderNoText}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view class="detail-field">
|
||||||
|
<text class="label">服务项目</text>
|
||||||
|
<text class="value">{{appointment.productTitleText}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="detail-field">
|
||||||
<text class="label">美甲师</text>
|
<text class="label">美甲师</text>
|
||||||
<text class="value">{{isUnassigned ? '待分配' : appointment.artistName}}</text>
|
<text class="value">{{appointment.artistNameText}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view class="detail-field">
|
||||||
<text class="label">时间</text>
|
<text class="label">时间</text>
|
||||||
<text class="value">{{timeText}}</text>
|
<text class="value">{{timeText}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view class="detail-field">
|
||||||
<text class="label">时长</text>
|
<text class="label">时长</text>
|
||||||
<text class="value">{{appointment.durationMinutes}}分钟</text>
|
<text class="value">{{appointment.durationText}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="detail-field amount-field">
|
||||||
|
<text class="label">成交金额</text>
|
||||||
|
<text class="value">{{appointment.amountText}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{appointment.cancelReasonText}}" class="cancel-reason">
|
||||||
|
<text class="label">取消原因</text>
|
||||||
|
<text class="cancel-reason-text">{{appointment.cancelReasonText}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view wx:if="{{!loadError}}" class="section">
|
<view wx:if="{{!loadError}}" class="section">
|
||||||
<view class="section-title">备注</view>
|
<view class="section-title">备注</view>
|
||||||
<view class="card note-card">{{appointment.remark || '暂无备注'}}</view>
|
<view class="card note-card">{{appointment.remarkText}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view wx:if="{{!loadError}}" class="fixed-bottom action-row">
|
<view wx:if="{{!loadError && (showTransfer || showConfirm || showComplete || showCancel)}}" class="fixed-bottom action-row">
|
||||||
<button wx:if="{{!appointment.historicalBackfill}}" class="secondary-btn" disabled="{{isUnassigned}}" bindtap="confirm">{{isUnassigned ? '待分配' : '确认'}}</button>
|
<button wx:if="{{showTransfer}}" class="primary-btn transfer-action" loading="{{updating}}" disabled="{{updating}}" bindtap="goTransfer">{{isUnassigned ? '分配美甲师' : '改派美甲师'}}</button>
|
||||||
<button class="primary-btn" disabled="{{isUnassigned}}" bindtap="complete">{{appointment.historicalBackfill ? '完成补单' : '完成'}}</button>
|
<button wx:if="{{showConfirm}}" class="secondary-btn" loading="{{updating}}" disabled="{{updating}}" bindtap="confirm">确认预约</button>
|
||||||
<button class="danger-btn" bindtap="cancel">取消</button>
|
<button wx:if="{{showComplete}}" class="secondary-btn" loading="{{updating}}" disabled="{{updating}}" bindtap="complete">{{appointment.historicalBackfill ? '完成补单' : '完成服务'}}</button>
|
||||||
|
<button wx:if="{{showCancel}}" class="danger-btn" loading="{{updating}}" disabled="{{updating}}" bindtap="cancel">取消预约</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.detail-card {
|
.detail-card {
|
||||||
padding: 24rpx;
|
padding: 28rpx 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-error {
|
.detail-error {
|
||||||
@@ -23,10 +23,16 @@
|
|||||||
.detail-person {
|
.detail-person {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
gap: 18rpx;
|
gap: 18rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.detail-person > view:last-child {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -47,9 +53,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.customer {
|
.customer {
|
||||||
|
overflow: hidden;
|
||||||
color: #17211f;
|
color: #17211f;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phone {
|
.phone {
|
||||||
@@ -58,20 +67,40 @@
|
|||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-actions {
|
.status-tag {
|
||||||
display: flex;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
align-items: center;
|
padding: 8rpx 14rpx;
|
||||||
gap: 10rpx;
|
border-radius: 999rpx;
|
||||||
|
background: #edf6ef;
|
||||||
|
color: #247b63;
|
||||||
|
font-size: 21rpx;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-tag.completed {
|
||||||
|
background: #eef2f1;
|
||||||
|
color: #67766f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-tag.cancelled {
|
||||||
|
background: #fff0ed;
|
||||||
|
color: #ad5148;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-grid {
|
.detail-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
gap: 22rpx;
|
gap: 12rpx;
|
||||||
margin-top: 28rpx;
|
margin-top: 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.detail-field {
|
||||||
|
min-width: 0;
|
||||||
|
padding: 16rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
background: #f6f9f7;
|
||||||
|
}
|
||||||
|
|
||||||
.label,
|
.label,
|
||||||
.value {
|
.value {
|
||||||
display: block;
|
display: block;
|
||||||
@@ -84,9 +113,36 @@
|
|||||||
|
|
||||||
.value {
|
.value {
|
||||||
margin-top: 8rpx;
|
margin-top: 8rpx;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
color: #17211f;
|
color: #17211f;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.amount-field .value {
|
||||||
|
color: #b36f3e;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancel-reason {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 18rpx;
|
||||||
|
margin-top: 18rpx;
|
||||||
|
padding: 18rpx;
|
||||||
|
border-left: 6rpx solid #cc7568;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
background: #fff5f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancel-reason-text {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
color: #8f4d46;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 1.5;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
.note-card {
|
.note-card {
|
||||||
@@ -96,9 +152,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.action-row {
|
.action-row {
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: 1fr 1fr 1fr;
|
align-items: center;
|
||||||
gap: 14rpx;
|
gap: 14rpx;
|
||||||
|
padding: 18rpx 20rpx calc(18rpx + env(safe-area-inset-bottom));
|
||||||
|
background: rgba(255, 255, 255, 0.96);
|
||||||
|
box-shadow: 0 -8rpx 24rpx rgba(31, 55, 44, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-row .primary-btn,
|
.action-row .primary-btn,
|
||||||
@@ -107,4 +166,28 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
flex: 1;
|
||||||
|
padding: 0 12rpx;
|
||||||
|
font-size: 23rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-row .transfer-action {
|
||||||
|
flex: 1.25;
|
||||||
|
box-shadow: 0 8rpx 18rpx rgba(36, 123, 99, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 360px) {
|
||||||
|
.action-row {
|
||||||
|
gap: 8rpx;
|
||||||
|
padding-right: 12rpx;
|
||||||
|
padding-left: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-row .primary-btn,
|
||||||
|
.action-row .secondary-btn,
|
||||||
|
.action-row .danger-btn {
|
||||||
|
padding: 0 6rpx;
|
||||||
|
font-size: 20rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
pickerMode: false,
|
pickerMode: false,
|
||||||
appointmentContext: { date: '', time: '', durationMinutes: '' },
|
appointmentContext: { date: '', time: '', durationMinutes: '' },
|
||||||
|
applicationId: '',
|
||||||
employeeColors: EMPLOYEE_COLORS,
|
employeeColors: EMPLOYEE_COLORS,
|
||||||
onboardingVisible: false,
|
onboardingVisible: false,
|
||||||
createdEmployee: null,
|
createdEmployee: null,
|
||||||
@@ -35,7 +36,9 @@ Page({
|
|||||||
date: options.date || '',
|
date: options.date || '',
|
||||||
time: options.time || '',
|
time: options.time || '',
|
||||||
durationMinutes: options.durationMinutes || ''
|
durationMinutes: options.durationMinutes || ''
|
||||||
}
|
},
|
||||||
|
applicationId: options.applicationId || '',
|
||||||
|
applicationNo: options.applicationNo || ''
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -81,6 +84,12 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
|
if (this.data.creating || this.data.avatarUploading) return
|
||||||
|
if (this.data.createdEmployee) {
|
||||||
|
if (this.data.applicationId && !this.data.applicationApproved) return this.associateCreatedEmployee()
|
||||||
|
this.setData({ onboardingVisible: true })
|
||||||
|
return
|
||||||
|
}
|
||||||
const form = this.data.form
|
const form = this.data.form
|
||||||
const nickname = String(form.nickname || '').trim()
|
const nickname = String(form.nickname || '').trim()
|
||||||
const phone = String(form.phone || '').trim()
|
const phone = String(form.phone || '').trim()
|
||||||
@@ -106,7 +115,11 @@ Page({
|
|||||||
})
|
})
|
||||||
const id = result && typeof result === 'object' ? (result.id || result.userId) : result
|
const id = result && typeof result === 'object' ? (result.id || result.userId) : result
|
||||||
const employee = { id, name: nickname, title: nickname, avatar: form.avatar || '' }
|
const employee = { id, name: nickname, title: nickname, avatar: form.avatar || '' }
|
||||||
this.setData({ createdEmployee: employee })
|
this.setData({ createdEmployee: employee, applicationApproved: false })
|
||||||
|
if (this.data.applicationId) {
|
||||||
|
await this.associateCreatedEmployee()
|
||||||
|
return
|
||||||
|
}
|
||||||
await this.offerPendingAssociation()
|
await this.offerPendingAssociation()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
wx.showToast({ title: error.message || '新增失败', icon: 'none' })
|
wx.showToast({ title: error.message || '新增失败', icon: 'none' })
|
||||||
@@ -115,6 +128,33 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async associateCreatedEmployee() {
|
||||||
|
const employee = this.data.createdEmployee
|
||||||
|
if (!employee || !employee.id || !this.data.applicationId || this.data.associatingApplication) return
|
||||||
|
this.setData({ associatingApplication: true })
|
||||||
|
try {
|
||||||
|
await employeesApi.approveApplication(this.data.applicationId, {
|
||||||
|
targetArtistUserId: employee.id,
|
||||||
|
useApplicantNickname: false,
|
||||||
|
useApplicantAvatar: false
|
||||||
|
})
|
||||||
|
this.setData({ applicationApproved: true, associatingApplication: false, onboardingVisible: true })
|
||||||
|
wx.showToast({ title: '已关联并通过审核', icon: 'success' })
|
||||||
|
} catch (error) {
|
||||||
|
this.setData({ associatingApplication: false })
|
||||||
|
wx.showModal({
|
||||||
|
title: '关联审核未完成',
|
||||||
|
content: error.message || '美甲师档案已创建,可重试关联申请。',
|
||||||
|
confirmText: '重试',
|
||||||
|
cancelText: '稍后处理',
|
||||||
|
success: result => {
|
||||||
|
if (result.confirm) this.associateCreatedEmployee()
|
||||||
|
else this.setData({ onboardingVisible: true })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async offerPendingAssociation() {
|
async offerPendingAssociation() {
|
||||||
try {
|
try {
|
||||||
const data = await employeesApi.unassociatedApplications()
|
const data = await employeesApi.unassociatedApplications()
|
||||||
@@ -180,6 +220,7 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setupFirstSchedule() {
|
setupFirstSchedule() {
|
||||||
|
if (this.data.applicationId && !this.data.applicationApproved) return
|
||||||
const employee = this.data.createdEmployee
|
const employee = this.data.createdEmployee
|
||||||
if (!employee || !employee.id) return
|
if (!employee || !employee.id) return
|
||||||
const context = this.data.appointmentContext
|
const context = this.data.appointmentContext
|
||||||
@@ -202,7 +243,7 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
skipFirstSchedule() {
|
skipFirstSchedule() {
|
||||||
if (this.data.savingDefaultSchedule || !this.data.createdEmployee) return
|
if (this.data.savingDefaultSchedule || !this.data.createdEmployee || (this.data.applicationId && !this.data.applicationApproved)) return
|
||||||
this.setData({ savingDefaultSchedule: true })
|
this.setData({ savingDefaultSchedule: true })
|
||||||
employeesApi.saveScheduleRule({
|
employeesApi.saveScheduleRule({
|
||||||
artistId: this.data.createdEmployee.id,
|
artistId: this.data.createdEmployee.id,
|
||||||
@@ -231,6 +272,10 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
finishCreated(autoSelect, scheduleSaved) {
|
finishCreated(autoSelect, scheduleSaved) {
|
||||||
|
if (this.data.applicationId && !this.data.applicationApproved) {
|
||||||
|
this.setData({ onboardingVisible: true })
|
||||||
|
return
|
||||||
|
}
|
||||||
const employee = this.data.createdEmployee
|
const employee = this.data.createdEmployee
|
||||||
const eventChannel = this.getOpenerEventChannel && this.getOpenerEventChannel()
|
const eventChannel = this.getOpenerEventChannel && this.getOpenerEventChannel()
|
||||||
if (eventChannel && eventChannel.emit) {
|
if (eventChannel && eventChannel.emit) {
|
||||||
@@ -239,5 +284,14 @@ Page({
|
|||||||
this.setData({ onboardingVisible: false })
|
this.setData({ onboardingVisible: false })
|
||||||
wx.showToast({ title: scheduleSaved ? '排班已保存' : '美甲师已新增', icon: 'success' })
|
wx.showToast({ title: scheduleSaved ? '排班已保存' : '美甲师已新增', icon: 'success' })
|
||||||
setTimeout(() => wx.navigateBack(), 300)
|
setTimeout(() => wx.navigateBack(), 300)
|
||||||
|
},
|
||||||
|
|
||||||
|
leaveAssociationForLater() {
|
||||||
|
const employee = this.data.createdEmployee
|
||||||
|
const eventChannel = this.getOpenerEventChannel && this.getOpenerEventChannel()
|
||||||
|
if (eventChannel && eventChannel.emit && employee) {
|
||||||
|
eventChannel.emit('employeeCreated', { ...employee, autoSelect: this.data.pickerMode, scheduleSaved: false })
|
||||||
|
}
|
||||||
|
wx.navigateBack()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ const employeesApi = require('../../api/employees')
|
|||||||
|
|
||||||
let navigatedBack = false
|
let navigatedBack = false
|
||||||
let navigatedTo = ''
|
let navigatedTo = ''
|
||||||
|
let modalConfirm = false
|
||||||
global.wx = {
|
global.wx = {
|
||||||
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
|
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
|
||||||
getDeviceInfo: () => ({ platform: 'devtools' }),
|
getDeviceInfo: () => ({ platform: 'devtools' }),
|
||||||
showToast: () => {},
|
showToast: () => {},
|
||||||
|
showModal: options => options.success({ confirm: modalConfirm }),
|
||||||
navigateBack: () => { navigatedBack = true },
|
navigateBack: () => { navigatedBack = true },
|
||||||
navigateTo: options => { navigatedTo = options.url }
|
navigateTo: options => { navigatedTo = options.url }
|
||||||
}
|
}
|
||||||
@@ -102,6 +104,35 @@ async function run() {
|
|||||||
page.data.appointmentContext = { date: '2026-10-12', time: '14:00', durationMinutes: '60' }
|
page.data.appointmentContext = { date: '2026-10-12', time: '14:00', durationMinutes: '60' }
|
||||||
page.setupFirstSchedule()
|
page.setupFirstSchedule()
|
||||||
assert.strictEqual(navigatedTo.includes('/pages/schedule-setting/index?id=88&onboarding=1&source=appointment'), true)
|
assert.strictEqual(navigatedTo.includes('/pages/schedule-setting/index?id=88&onboarding=1&source=appointment'), true)
|
||||||
|
|
||||||
|
let employeeCreateCount = 0
|
||||||
|
let approvalAttempts = 0
|
||||||
|
let approvalPayload
|
||||||
|
page.data.form = { nickname: '申请档案员工', phone: '13800138001', wechatId: '', color: '#8FB89A', avatar: '', avatarUrl: '' }
|
||||||
|
page.data.createdEmployee = null
|
||||||
|
page.data.applicationId = '42'
|
||||||
|
page.data.applicationApproved = false
|
||||||
|
page.data.onboardingVisible = false
|
||||||
|
employeesApi.createUser = async () => { employeeCreateCount += 1; return { userId: 90 } }
|
||||||
|
employeesApi.approveApplication = async (applicationId, payload) => {
|
||||||
|
approvalAttempts += 1
|
||||||
|
approvalPayload = { applicationId, ...payload }
|
||||||
|
if (approvalAttempts === 1) throw new Error('暂时无法审核')
|
||||||
|
}
|
||||||
|
await page.submit()
|
||||||
|
assert.strictEqual(employeeCreateCount, 1)
|
||||||
|
assert.deepStrictEqual(approvalPayload, {
|
||||||
|
applicationId: '42',
|
||||||
|
targetArtistUserId: 90,
|
||||||
|
useApplicantNickname: false,
|
||||||
|
useApplicantAvatar: false
|
||||||
|
})
|
||||||
|
assert.strictEqual(page.data.createdEmployee.id, 90)
|
||||||
|
assert.strictEqual(page.data.onboardingVisible, true)
|
||||||
|
await page.associateCreatedEmployee()
|
||||||
|
assert.strictEqual(employeeCreateCount, 1)
|
||||||
|
assert.strictEqual(approvalAttempts, 2)
|
||||||
|
assert.strictEqual(page.data.applicationApproved, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
run().catch(error => {
|
run().catch(error => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<view class="page no-tab employee-create-page">
|
<view class="page no-tab employee-create-page">
|
||||||
<view class="create-intro">
|
<view class="create-intro">
|
||||||
<text class="create-title">新增美甲师档案</text>
|
<text class="create-title">新增美甲师档案</text>
|
||||||
<text class="create-subtitle">{{pickerMode ? '保存后自动选择该美甲师' : '保存后即可用于预约指定和美甲师管理'}}</text>
|
<text class="create-subtitle">{{applicationId ? '保存后将自动关联当前申请并通过审核' : (pickerMode ? '保存后自动选择该美甲师' : '保存后即可用于预约指定和美甲师管理')}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="card avatar-card" bindtap="chooseAvatar">
|
<view class="card avatar-card" bindtap="chooseAvatar">
|
||||||
@@ -42,17 +42,24 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="fixed-bottom">
|
<view class="fixed-bottom">
|
||||||
<button class="primary-btn" loading="{{creating}}" disabled="{{avatarUploading || creating}}" bindtap="submit">保存美甲师</button>
|
<button class="primary-btn" loading="{{creating || associatingApplication}}" disabled="{{avatarUploading || creating || associatingApplication || (applicationId && applicationApproved)}}" bindtap="submit">{{applicationId && !createdEmployee ? '创建并通过审核' : (applicationId && createdEmployee && !applicationApproved ? '重试关联并通过' : '保存美甲师')}}</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view wx:if="{{onboardingVisible}}" class="onboarding-mask" catchtouchmove="stopTouchMove">
|
<view wx:if="{{onboardingVisible}}" class="onboarding-mask" catchtouchmove="stopTouchMove">
|
||||||
<view class="onboarding-card">
|
<view class="onboarding-card">
|
||||||
<view class="onboarding-icon">✓</view>
|
<view class="onboarding-icon {{applicationId && !applicationApproved ? 'association-failed' : ''}}">{{applicationId && !applicationApproved ? '!' : '✓'}}</view>
|
||||||
<text class="onboarding-title">美甲师已创建</text>
|
<text class="onboarding-title">{{applicationId && !applicationApproved ? '美甲师档案已创建' : (applicationId ? '申请已关联并通过' : '美甲师已创建')}}</text>
|
||||||
<text class="onboarding-desc">{{pickerMode ? '设置常规排班后,可继续把当前预约分配给该美甲师。' : '为新美甲师设置首个常规排班,之后即可正常承接预约。'}}</text>
|
<text class="onboarding-desc">{{applicationId && !applicationApproved ? '员工档案已保留,申请仍待处理。关联失败不会重复创建员工,可直接重试。' : (pickerMode ? '设置常规排班后,可继续把当前预约分配给该美甲师。' : '为新美甲师设置首个常规排班,之后即可正常承接预约。')}}</text>
|
||||||
|
<view wx:if="{{applicationId && !applicationApproved}}" class="association-retry-box">
|
||||||
|
<text>申请编号 {{applicationNo || applicationId}}</text>
|
||||||
|
<button class="primary-btn onboarding-primary" loading="{{associatingApplication}}" disabled="{{associatingApplication}}" bindtap="associateCreatedEmployee">重试关联并通过审核</button>
|
||||||
|
<button class="onboarding-skip" disabled="{{associatingApplication}}" bindtap="leaveAssociationForLater">稍后处理</button>
|
||||||
|
</view>
|
||||||
|
<block wx:else>
|
||||||
<text class="onboarding-default-note">不立即设置时,将默认全年无休、全天排班(00:00-23:59);实际预约仍受门店营业时间限制,之后可在排班设置中调整。</text>
|
<text class="onboarding-default-note">不立即设置时,将默认全年无休、全天排班(00:00-23:59);实际预约仍受门店营业时间限制,之后可在排班设置中调整。</text>
|
||||||
<button class="primary-btn onboarding-primary" loading="{{savingDefaultSchedule}}" disabled="{{savingDefaultSchedule}}" bindtap="setupFirstSchedule">{{pickerMode ? '设置排班并分配' : '立即设置排班'}}</button>
|
<button class="primary-btn onboarding-primary" loading="{{savingDefaultSchedule}}" disabled="{{savingDefaultSchedule}}" bindtap="setupFirstSchedule">{{pickerMode ? '设置排班并分配' : '立即设置排班'}}</button>
|
||||||
<button class="onboarding-skip" loading="{{savingDefaultSchedule}}" disabled="{{savingDefaultSchedule}}" bindtap="skipFirstSchedule">{{pickerMode ? '暂不设置(使用全天排班)' : '不设置,保留全天排班'}}</button>
|
<button class="onboarding-skip" loading="{{savingDefaultSchedule}}" disabled="{{savingDefaultSchedule}}" bindtap="skipFirstSchedule">{{pickerMode ? '暂不设置(使用全天排班)' : '不设置,保留全天排班'}}</button>
|
||||||
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<entity-selector-sheet visible="{{associationSheetVisible}}" title="关联待审核申请" keyword="{{associationKeyword}}" placeholder="搜索申请昵称、手机号或编号" items="{{associationItems}}" selected-id="{{associationSelectedId}}" loading="{{associationLoading}}" empty-text="暂无可关联申请" action-text="暂不关联,继续" bind:search="onAssociationSearch" bind:select="selectAssociation" bind:action="skipAssociation" bind:close="skipAssociation" />
|
<entity-selector-sheet visible="{{associationSheetVisible}}" title="关联待审核申请" keyword="{{associationKeyword}}" placeholder="搜索申请昵称、手机号或编号" items="{{associationItems}}" selected-id="{{associationSelectedId}}" loading="{{associationLoading}}" empty-text="暂无可关联申请" action-text="暂不关联,继续" bind:search="onAssociationSearch" bind:select="selectAssociation" bind:action="skipAssociation" bind:close="skipAssociation" />
|
||||||
|
|||||||
@@ -148,8 +148,15 @@
|
|||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.onboarding-icon.association-failed {
|
||||||
|
background: #fff0ed;
|
||||||
|
color: #ad5148;
|
||||||
|
}
|
||||||
|
|
||||||
.onboarding-title { margin-top: 22rpx; color: #17211f; font-size: 32rpx; font-weight: 900; }
|
.onboarding-title { margin-top: 22rpx; color: #17211f; font-size: 32rpx; font-weight: 900; }
|
||||||
.onboarding-desc { margin-top: 12rpx; color: #837b72; font-size: 23rpx; line-height: 1.7; text-align: center; }
|
.onboarding-desc { margin-top: 12rpx; color: #837b72; font-size: 23rpx; line-height: 1.7; text-align: center; }
|
||||||
.onboarding-default-note { margin-top: 14rpx; padding: 14rpx 16rpx; border-radius: 12rpx; background: #eff7f2; color: #39705d; font-size: 21rpx; line-height: 1.55; text-align: left; }
|
.onboarding-default-note { margin-top: 14rpx; padding: 14rpx 16rpx; border-radius: 12rpx; background: #eff7f2; color: #39705d; font-size: 21rpx; line-height: 1.55; text-align: left; }
|
||||||
.onboarding-primary { width: 100%; margin-top: 30rpx; }
|
.onboarding-primary { width: 100%; margin-top: 30rpx; }
|
||||||
.onboarding-skip { margin-top: 12rpx; background: transparent; color: #7e776f; font-size: 23rpx; }
|
.onboarding-skip { margin-top: 12rpx; background: transparent; color: #7e776f; font-size: 23rpx; }
|
||||||
|
.association-retry-box { width: 100%; margin-top: 20rpx; padding: 18rpx; box-sizing: border-box; border-radius: 12rpx; background: #fff5f3; color: #8f4d46; font-size: 22rpx; text-align: center; }
|
||||||
|
.association-retry-box .onboarding-primary { margin-top: 18rpx; }
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
|
if (this._waitingForEmployeeCreate) {
|
||||||
|
this._waitingForEmployeeCreate = false
|
||||||
|
this.loadEmployees()
|
||||||
|
if (this.data.reviewExpanded) this.loadReviewApplications()
|
||||||
|
}
|
||||||
const app = getApp()
|
const app = getApp()
|
||||||
if (!this.data.isManager || !app.globalData.openEmployeeReview) return
|
if (!this.data.isManager || !app.globalData.openEmployeeReview) return
|
||||||
app.globalData.openEmployeeReview = false
|
app.globalData.openEmployeeReview = false
|
||||||
@@ -128,12 +133,13 @@ Page({
|
|||||||
})
|
})
|
||||||
if (!artists.length) {
|
if (!artists.length) {
|
||||||
this.setData({ associationSheetVisible: false })
|
this.setData({ associationSheetVisible: false })
|
||||||
await confirmModal({
|
const result = await confirmModal({
|
||||||
title: '暂时无法通过',
|
title: '需要先新建美甲师',
|
||||||
content: '当前门店没有未关联微信的美甲师档案,请先新增美甲师,再审核这条申请。',
|
content: '当前门店没有未关联微信的美甲师档案。新建后将自动关联这条申请并通过审核。',
|
||||||
confirmText: '知道了',
|
confirmText: '去新建',
|
||||||
showCancel: false
|
cancelText: '稍后处理'
|
||||||
})
|
})
|
||||||
|
if (result.confirm) this.createEmployeeForApplication(applicationId, application && application.applicationNo)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.setData({ associationError: error.message || '未关联美甲师加载失败' })
|
this.setData({ associationError: error.message || '未关联美甲师加载失败' })
|
||||||
@@ -291,6 +297,15 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createEmployeeForApplication(applicationId, applicationNo) {
|
||||||
|
if (!applicationId) return
|
||||||
|
this._waitingForEmployeeCreate = true
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `/pages/employee-create/index?applicationId=${encodeURIComponent(applicationId)}&applicationNo=${encodeURIComponent(applicationNo || '')}`,
|
||||||
|
fail: () => { this._waitingForEmployeeCreate = false }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
onEmployeeAvatarError(event) {
|
onEmployeeAvatarError(event) {
|
||||||
const index = Number(event.currentTarget.dataset.index)
|
const index = Number(event.currentTarget.dataset.index)
|
||||||
if (!Number.isInteger(index) || !this.data.employees[index]) return
|
if (!Number.isInteger(index) || !this.data.employees[index]) return
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const path = require('path')
|
|||||||
const modalChoices = []
|
const modalChoices = []
|
||||||
const toasts = []
|
const toasts = []
|
||||||
const modals = []
|
const modals = []
|
||||||
|
const navigations = []
|
||||||
global.wx = {
|
global.wx = {
|
||||||
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
|
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
|
||||||
getDeviceInfo: () => ({ platform: 'devtools' }),
|
getDeviceInfo: () => ({ platform: 'devtools' }),
|
||||||
@@ -12,7 +13,8 @@ global.wx = {
|
|||||||
showModal: options => {
|
showModal: options => {
|
||||||
modals.push(options)
|
modals.push(options)
|
||||||
options.success({ confirm: modalChoices.shift() !== false })
|
options.success({ confirm: modalChoices.shift() !== false })
|
||||||
}
|
},
|
||||||
|
navigateTo: options => navigations.push(options.url)
|
||||||
}
|
}
|
||||||
global.getApp = () => ({ globalData: { userInfo: { type: 2 }, openEmployeeReview: false } })
|
global.getApp = () => ({ globalData: { userInfo: { type: 2 }, openEmployeeReview: false } })
|
||||||
|
|
||||||
@@ -83,7 +85,8 @@ async function run() {
|
|||||||
page.data.reviewApplications = [application]
|
page.data.reviewApplications = [application]
|
||||||
await page.approveApplication({ currentTarget: { dataset: { id: 12 } } })
|
await page.approveApplication({ currentTarget: { dataset: { id: 12 } } })
|
||||||
assert.strictEqual(page.data.associationSheetVisible, false)
|
assert.strictEqual(page.data.associationSheetVisible, false)
|
||||||
assert(modals.some(item => String(item.content || '').includes('当前门店没有未关联微信的美甲师档案')))
|
assert(modals.some(item => item.confirmText === '去新建'))
|
||||||
|
assert.strictEqual(navigations.pop(), '/pages/employee-create/index?applicationId=12&applicationNo=')
|
||||||
}
|
}
|
||||||
|
|
||||||
run().catch(error => {
|
run().catch(error => {
|
||||||
|
|||||||
@@ -97,6 +97,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.review-item {
|
.review-item {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
gap: 14rpx;
|
gap: 14rpx;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -115,7 +117,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.review-info {
|
.review-info {
|
||||||
|
box-sizing: border-box;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
width: 0;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@@ -142,7 +146,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.review-actions {
|
.review-actions {
|
||||||
|
box-sizing: border-box;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
|
max-width: 100%;
|
||||||
gap: 8rpx;
|
gap: 8rpx;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
@@ -199,6 +205,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 391px) {
|
||||||
|
.review-actions {
|
||||||
|
max-width: 230rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.review-retry {
|
.review-retry {
|
||||||
width: 150rpx;
|
width: 150rpx;
|
||||||
min-width: 150rpx;
|
min-width: 150rpx;
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ function layoutAppointmentBlocks(items, startMinute, minuteScale, laneHeaderHeig
|
|||||||
return {
|
return {
|
||||||
...entry,
|
...entry,
|
||||||
top: Math.max(0, entry.itemStart - startMinute) * minuteScale + laneHeaderHeight,
|
top: Math.max(0, entry.itemStart - startMinute) * minuteScale + laneHeaderHeight,
|
||||||
height: entry.durationMinutes * minuteScale,
|
height: Math.max(40, entry.durationMinutes * minuteScale),
|
||||||
left: Math.round(entry.columnIndex * slotWidth + 12),
|
left: Math.round(entry.columnIndex * slotWidth + 12),
|
||||||
width: Math.round(slotWidth - 24),
|
width: Math.round(slotWidth - 24),
|
||||||
compact: entry.durationMinutes <= 15,
|
compact: entry.durationMinutes <= 15,
|
||||||
@@ -167,6 +167,7 @@ Page({
|
|||||||
hours: [],
|
hours: [],
|
||||||
hasTimedAppointments: false,
|
hasTimedAppointments: false,
|
||||||
timelineHeight: 720,
|
timelineHeight: 720,
|
||||||
|
timelineViewportHeight: 720,
|
||||||
laneWidth: 720,
|
laneWidth: 720,
|
||||||
laneItemWidth: 240,
|
laneItemWidth: 240,
|
||||||
laneHeaderHeight: 54,
|
laneHeaderHeight: 54,
|
||||||
@@ -601,7 +602,7 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
buildDayView(calendar) {
|
buildDayView(calendar) {
|
||||||
const minuteScale = 4
|
const minuteScale = 2.5
|
||||||
const daySummary = this.summaryMap(calendar)[this.data.currentDateText] || null
|
const daySummary = this.summaryMap(calendar)[this.data.currentDateText] || null
|
||||||
const businessHours = resolveBusinessHours(calendar, this.data.currentDateText)
|
const businessHours = resolveBusinessHours(calendar, this.data.currentDateText)
|
||||||
const filteredArtists = this.data.selectedArtistId
|
const filteredArtists = this.data.selectedArtistId
|
||||||
@@ -622,6 +623,7 @@ Page({
|
|||||||
hours: [],
|
hours: [],
|
||||||
hasTimedAppointments: false,
|
hasTimedAppointments: false,
|
||||||
timelineHeight: 0,
|
timelineHeight: 0,
|
||||||
|
timelineViewportHeight: 320,
|
||||||
laneHeaderHeight: 54,
|
laneHeaderHeight: 54,
|
||||||
laneItemWidth: 248,
|
laneItemWidth: 248,
|
||||||
laneWidth: 720,
|
laneWidth: 720,
|
||||||
@@ -644,7 +646,7 @@ Page({
|
|||||||
const endMinute = businessHours
|
const endMinute = businessHours
|
||||||
? dateUtil.minutesOfDay(businessHours.end)
|
? dateUtil.minutesOfDay(businessHours.end)
|
||||||
: Math.min(1440, Math.max(startMinute + 60, Math.ceil(latestAppointmentEnd / 60) * 60))
|
: Math.min(1440, Math.max(startMinute + 60, Math.ceil(latestAppointmentEnd / 60) * 60))
|
||||||
const timelineHeight = Math.max(560, (endMinute - startMinute) * minuteScale)
|
const timelineHeight = (endMinute - startMinute) * minuteScale
|
||||||
const laneHeaderHeight = 54
|
const laneHeaderHeight = 54
|
||||||
const hours = []
|
const hours = []
|
||||||
for (let cursor = startMinute; cursor <= endMinute; cursor += 60) {
|
for (let cursor = startMinute; cursor <= endMinute; cursor += 60) {
|
||||||
@@ -663,7 +665,7 @@ Page({
|
|||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
top: Math.max(0, itemStart - startMinute) * minuteScale + laneHeaderHeight,
|
top: Math.max(0, itemStart - startMinute) * minuteScale + laneHeaderHeight,
|
||||||
height: Math.max(60, (item.durationMinutes || 60) * minuteScale),
|
height: Math.max(40, (item.durationMinutes || 60) * minuteScale),
|
||||||
left: 12,
|
left: 12,
|
||||||
width: 224,
|
width: 224,
|
||||||
compact: Number(item.durationMinutes || 60) <= 15,
|
compact: Number(item.durationMinutes || 60) <= 15,
|
||||||
@@ -696,6 +698,7 @@ Page({
|
|||||||
hours,
|
hours,
|
||||||
hasTimedAppointments: timedAppointments.length > 0,
|
hasTimedAppointments: timedAppointments.length > 0,
|
||||||
timelineHeight: timelineHeight + laneHeaderHeight,
|
timelineHeight: timelineHeight + laneHeaderHeight,
|
||||||
|
timelineViewportHeight: Math.min(820, timelineHeight + laneHeaderHeight),
|
||||||
laneHeaderHeight,
|
laneHeaderHeight,
|
||||||
laneItemWidth: 248,
|
laneItemWidth: 248,
|
||||||
laneWidth: Math.max(720, lanes.reduce((width, lane) => width + (lane.width || 248), 0)),
|
laneWidth: Math.max(720, lanes.reduce((width, lane) => width + (lane.width || 248), 0)),
|
||||||
|
|||||||
@@ -123,9 +123,10 @@ async function run() {
|
|||||||
assert.strictEqual(dayState.dayLanes[0].artistId, '__unassigned__')
|
assert.strictEqual(dayState.dayLanes[0].artistId, '__unassigned__')
|
||||||
assert.strictEqual(dayState.dayLanes[0].blocks.length, 1)
|
assert.strictEqual(dayState.dayLanes[0].blocks.length, 1)
|
||||||
assert.strictEqual(dayState.unassignedCount, 1)
|
assert.strictEqual(dayState.unassignedCount, 1)
|
||||||
assert.strictEqual(dayState.timelineHeight, 2934)
|
assert.strictEqual(dayState.timelineHeight, 1854)
|
||||||
assert.strictEqual(dayState.hours.find(item => item.label === '14:00').top, 1014)
|
assert.strictEqual(dayState.timelineViewportHeight, 820)
|
||||||
assert.strictEqual(dayState.dayLanes[0].blocks[0].height, 240)
|
assert.strictEqual(dayState.hours.find(item => item.label === '14:00').top, 654)
|
||||||
|
assert.strictEqual(dayState.dayLanes[0].blocks[0].height, 150)
|
||||||
const shortAppointmentState = dayPage.buildDayView({
|
const shortAppointmentState = dayPage.buildDayView({
|
||||||
businessStartTime: '10:30',
|
businessStartTime: '10:30',
|
||||||
businessEndTime: '11:30',
|
businessEndTime: '11:30',
|
||||||
@@ -133,9 +134,10 @@ async function run() {
|
|||||||
appointments: [{ orderItemId: 9, date: '2026-10-12', startTime: '2026-10-12 10:45:00', durationMinutes: 15, artistId: 1 }]
|
appointments: [{ orderItemId: 9, date: '2026-10-12', startTime: '2026-10-12 10:45:00', durationMinutes: 15, artistId: 1 }]
|
||||||
})
|
})
|
||||||
assert.strictEqual(shortAppointmentState.hours[0].top, 54)
|
assert.strictEqual(shortAppointmentState.hours[0].top, 54)
|
||||||
assert.strictEqual(shortAppointmentState.hours[1].top, 294)
|
assert.strictEqual(shortAppointmentState.hours[1].top, 204)
|
||||||
|
assert.strictEqual(shortAppointmentState.timelineViewportHeight, 204)
|
||||||
const shortAppointmentLane = shortAppointmentState.dayLanes.find(lane => lane.artistId === 1)
|
const shortAppointmentLane = shortAppointmentState.dayLanes.find(lane => lane.artistId === 1)
|
||||||
assert.strictEqual(shortAppointmentLane.blocks[0].height, 60)
|
assert.strictEqual(shortAppointmentLane.blocks[0].height, 40)
|
||||||
assert.strictEqual(shortAppointmentLane.blocks[0].compact, true)
|
assert.strictEqual(shortAppointmentLane.blocks[0].compact, true)
|
||||||
const missingHoursPage = createPage({ viewMode: 'day', currentDateText: '2026-10-12' })
|
const missingHoursPage = createPage({ viewMode: 'day', currentDateText: '2026-10-12' })
|
||||||
const missingHoursEmptyState = missingHoursPage.buildDayView({
|
const missingHoursEmptyState = missingHoursPage.buildDayView({
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
<text class="business-hours-empty-title">预约时间轴暂不可用</text>
|
<text class="business-hours-empty-title">预约时间轴暂不可用</text>
|
||||||
<text class="business-hours-empty-desc">请先设置门店营业时间,再安排普通预约。</text>
|
<text class="business-hours-empty-desc">请先设置门店营业时间,再安排普通预约。</text>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view wx:else class="day-board card" scroll-y>
|
<scroll-view wx:else class="day-board card" style="height: {{timelineViewportHeight}}rpx;" scroll-y>
|
||||||
<view class="timeline-wrap" style="height: {{timelineHeight}}rpx;">
|
<view class="timeline-wrap" style="height: {{timelineHeight}}rpx;">
|
||||||
<view class="time-axis">
|
<view class="time-axis">
|
||||||
<view wx:for="{{hours}}" wx:key="value" class="time-label" style="top: {{item.top}}rpx;">{{item.label}}</view>
|
<view wx:for="{{hours}}" wx:key="value" class="time-label" style="top: {{item.top}}rpx;">{{item.label}}</view>
|
||||||
|
|||||||
@@ -359,14 +359,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.day-board {
|
.day-board {
|
||||||
height: 820rpx;
|
max-height: 820rpx;
|
||||||
margin-top: 12rpx;
|
margin-top: 12rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeline-wrap {
|
.timeline-wrap {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 774rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-axis {
|
.time-axis {
|
||||||
|
|||||||
Reference in New Issue
Block a user