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