优化员工头像和导出金额展示
This commit is contained in:
@@ -93,6 +93,18 @@ const timeRange = (item: Appointment): string => {
|
||||
return `${start || '-'}-${end || '-'}`
|
||||
}
|
||||
|
||||
const orderAmount = (item: Appointment): string => {
|
||||
const value = item.amount ?? item.manualProductPrice
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return '-'
|
||||
}
|
||||
const amount = Number(value)
|
||||
if (Number.isNaN(amount)) {
|
||||
return String(value)
|
||||
}
|
||||
return `¥${amount.toFixed(2).replace(/\.00$/, '')}`
|
||||
}
|
||||
|
||||
const scheduleSummary = (item: Artist): string => {
|
||||
const source = item as Artist & { scheduleModeSummary?: string; scheduleMode?: string; scheduleTimeSummary?: string; ruleTimeSummary?: string }
|
||||
const mode = source.scheduleModeSummary || source.scheduleMode || ''
|
||||
@@ -102,12 +114,13 @@ const scheduleSummary = (item: Artist): string => {
|
||||
|
||||
const loadOrderPreview = async (): Promise<void> => {
|
||||
const data = await managerPlanningApi.calendar({ startDate: startDate.value, endDate: endDate.value })
|
||||
previewColumns.value = ['日期', '客户', '项目', '美甲师', '时间', '状态']
|
||||
previewColumns.value = ['日期', '客户', '项目', '金额', '美甲师', '时间', '状态']
|
||||
previewRows.value = (data.appointments || []).slice(0, PREVIEW_SIZE).map((item, index) => ({
|
||||
key: `order-${item.orderItemId || index}`,
|
||||
日期: item.date || String(item.startTime || '').slice(0, 10) || '-',
|
||||
客户: item.customerName || '到店客户',
|
||||
项目: item.productTitle || '预约作品',
|
||||
金额: orderAmount(item),
|
||||
美甲师: item.artistName || '未分配',
|
||||
时间: timeRange(item),
|
||||
状态: item.statusText || '-'
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
</view>
|
||||
|
||||
<view wx:else class="card employee-head">
|
||||
<view class="avatar" style="background: {{employee.color}};">{{employee.shortName}}</view>
|
||||
<view wx:if="{{employee.avatar}}" class="avatar image-avatar">
|
||||
<image src="{{employee.avatar}}" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view wx:else 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>
|
||||
|
||||
@@ -23,11 +23,17 @@
|
||||
width: 94rpx;
|
||||
height: 94rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
color: #fff;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.image-avatar image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.employee-name {
|
||||
display: block;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
@@ -50,10 +50,6 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image-avatar {
|
||||
background: #f0ece5;
|
||||
}
|
||||
|
||||
.image-avatar image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@@ -17,6 +17,14 @@ function timeRange(item) {
|
||||
return `${start || '-'}-${end || '-'}`
|
||||
}
|
||||
|
||||
function orderAmount(item) {
|
||||
const value = item.amount !== undefined && item.amount !== null ? item.amount : item.manualProductPrice
|
||||
if (value === undefined || value === null || value === '') return '-'
|
||||
const amount = Number(value)
|
||||
if (Number.isNaN(amount)) return String(value)
|
||||
return `¥${amount.toFixed(2).replace(/\.00$/, '')}`
|
||||
}
|
||||
|
||||
function scheduleSummary(item) {
|
||||
const mode = item.scheduleModeSummary || item.scheduleMode || ''
|
||||
const time = item.scheduleTimeSummary || item.ruleTimeSummary || ''
|
||||
@@ -81,12 +89,13 @@ Page({
|
||||
date: item.date || String(item.startTime || '').slice(0, 10) || '-',
|
||||
customer: item.customerName || '到店客户',
|
||||
product: item.productTitle || '预约作品',
|
||||
amount: orderAmount(item),
|
||||
artist: item.artistName || '未分配',
|
||||
time: timeRange(item),
|
||||
status: item.statusText || '-'
|
||||
}))
|
||||
this.setData({
|
||||
previewColumns: ['日期', '客户', '项目', '美甲师', '时间', '状态'],
|
||||
previewColumns: ['日期', '客户', '项目', '金额', '美甲师', '时间', '状态'],
|
||||
previewRows: rows
|
||||
})
|
||||
},
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<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.amount}}</text>
|
||||
<text class="preview-cell">{{item.artist}}</text>
|
||||
<text class="preview-cell">{{item.time}}</text>
|
||||
<text class="preview-cell">{{item.status}}</text>
|
||||
|
||||
Reference in New Issue
Block a user