fix_customer
This commit is contained in:
parent
6da510f7ea
commit
21a2d41b10
@ -99,6 +99,15 @@ async function loadCustomersMap() {
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function to get customer name - returns friendly placeholder if not found
|
||||
function getCustomerName(customerId) {
|
||||
if (!customerId) return '未知客户';
|
||||
const name = customersMap[customerId];
|
||||
if (name) return name;
|
||||
// If ID not found in map, return shortened ID with indicator
|
||||
return '(已删除客户)';
|
||||
}
|
||||
|
||||
// Alias for loadCustomersMap - used by main.js when switching to trial periods section
|
||||
async function loadCustomersForDropdown() {
|
||||
return await loadCustomersMap();
|
||||
@ -173,7 +182,7 @@ function renderExpiryWarnings() {
|
||||
endTime.setHours(0, 0, 0, 0); // Set to start of day
|
||||
|
||||
const daysUntilExpiry = Math.ceil((endTime - now) / (1000 * 60 * 60 * 24));
|
||||
const customerName = customersMap[period.customerId] || period.customerId;
|
||||
const customerName = getCustomerName(period.customerId);
|
||||
|
||||
if (daysUntilExpiry >= 0 && daysUntilExpiry <= 3) {
|
||||
warnings.push({
|
||||
@ -264,7 +273,7 @@ function renderTrialPeriodsTable() {
|
||||
row.classList.add('trial-row');
|
||||
|
||||
// 显示客户名称,如果找不到则显示ID
|
||||
const customerName = customersMap[period.customerId] || period.customerId;
|
||||
const customerName = getCustomerName(period.customerId);
|
||||
|
||||
// 计算状态和到期天数
|
||||
const now = new Date();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user