修复客户默认头像入库与回填SQL

This commit is contained in:
2026-07-25 22:05:31 +08:00
parent 8117437fa1
commit f7ad1de2de
12 changed files with 126 additions and 9 deletions
+3 -8
View File
@@ -1,11 +1,6 @@
const customersApi = require('../../api/customers')
const DEFAULT_CUSTOMER_AVATARS = [
'/assets/images/default-avatar-1.png',
'/assets/images/default-avatar-2.png',
'/assets/images/default-avatar-3.png',
'/assets/images/default-avatar-4.png'
]
const DEFAULT_CUSTOMER_AVATAR = '/assets/images/default-avatar-1.png'
function formatCustomerAmount(value) {
const amount = Number(value || 0)
@@ -49,12 +44,12 @@ function isToday(value) {
return formatCustomerDate(value) === new Date().toISOString().slice(0, 10)
}
function mapCustomer(item, index) {
function mapCustomer(item) {
const name = item.nickname || item.name || item.account || '客户'
return {
id: item.id,
name,
avatar: item.avatar || item.avatarUrl || item.customerAvatar || DEFAULT_CUSTOMER_AVATARS[index % DEFAULT_CUSTOMER_AVATARS.length],
avatar: item.avatar || item.avatarUrl || item.customerAvatar || DEFAULT_CUSTOMER_AVATAR,
tagText: resolveCustomerTag(item),
amountText: formatCustomerAmount(resolveCustomerAmount(item)),
lastDateText: formatCustomerDate(item.lastOrderTime || item.lastConsumeTime),