feat(VIP客户搜索): 优化手机号匹配逻辑并添加调试日志

添加调试日志以帮助排查VIP客户搜索问题,同时改进手机号匹配逻辑以支持更多匹配场景(包括精确匹配、部分匹配及去除空格后的匹配)
This commit is contained in:
2025-11-19 16:30:54 +08:00
parent 92175f66a6
commit ac95137e67
+14 -2
View File
@@ -1022,8 +1022,20 @@ $packages_json = json_encode(array_map(function($package) {
return;
}
// 在VIP客户中搜索匹配的手机号
const matchedVIP = window.allVIPCustomers.find(vip => vip.phone.includes(phone));
// 添加调试日志
console.log('搜索手机号:', phone);
console.log('VIP客户总数:', window.allVIPCustomers.length);
console.log('VIP客户部分数据示例:', window.allVIPCustomers.slice(0, 5));
// 在VIP客户中搜索匹配的手机号(优化:同时支持精确匹配和部分匹配)
const matchedVIP = window.allVIPCustomers.find(vip =>
vip.phone.includes(phone) ||
phone.includes(vip.phone) ||
vip.phone.replace(/\s/g, '').includes(phone.replace(/\s/g, '')) ||
phone.replace(/\s/g, '').includes(vip.phone.replace(/\s/g, ''))
);
console.log('匹配结果:', matchedVIP);
if (matchedVIP) {
// 显示VIP客户提示