修复客户默认头像入库与回填SQL
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user