diff --git a/src/dealer/customer/add.tsx b/src/dealer/customer/add.tsx index 746337f..7a1c9ab 100644 --- a/src/dealer/customer/add.tsx +++ b/src/dealer/customer/add.tsx @@ -25,6 +25,7 @@ const AddShopDealerApply = () => { const [isEditMode, setIsEditMode] = useState(false) const [existingApply, setExistingApply] = useState(null) const [referee, setReferee] = useState() + const PROTECTION_DAYS = 15; // 房号信息:用 dealerCode 存储唯一键,dealerName 存储展示文案 const buildHouseKey = (community: string, buildingNo: string, unitNo: string | undefined, roomNo: string) => { @@ -141,11 +142,11 @@ const AddShopDealerApply = () => { } // 提交表单 - // 计算保护期过期时间(7天后) + // 计算保护期过期时间(15天后) const calculateExpirationTime = (): string => { const now = new Date(); const expirationDate = new Date(now); - expirationDate.setDate(now.getDate() + 7); // 7天后 + expirationDate.setDate(now.getDate() + PROTECTION_DAYS); // 15天后 // 格式化为数据库需要的格式:YYYY-MM-DD HH:mm:ss const year = expirationDate.getFullYear(); @@ -223,23 +224,23 @@ const AddShopDealerApply = () => { // 已签约/已取消:直接提示已报备 if (existingCustomer.applyStatus && existingCustomer.applyStatus !== 10) { Taro.showToast({ - title: `该房号信息已报备(${getApplyStatusText(existingCustomer.applyStatus)})`, + title: `该房号信息已报备(${getApplyStatusText(existingCustomer.applyStatus)}),本次报备未生效`, icon: 'none', duration: 2500 }); return false; } - // 跟进中:保留 7 天保护期逻辑 + // 跟进中:保护期逻辑 if (existingCustomer.applyTime) { const applyTimeStamp = new Date(existingCustomer.applyTime).getTime(); const currentTimeStamp = new Date().getTime(); - const sevenDaysInMs = 7 * 24 * 60 * 60 * 1000; + const protectionMs = PROTECTION_DAYS * 24 * 60 * 60 * 1000; - if (currentTimeStamp - applyTimeStamp < sevenDaysInMs) { - const remainingDays = Math.ceil((sevenDaysInMs - (currentTimeStamp - applyTimeStamp)) / (24 * 60 * 60 * 1000)); + if (currentTimeStamp - applyTimeStamp < protectionMs) { + const remainingDays = Math.ceil((protectionMs - (currentTimeStamp - applyTimeStamp)) / (24 * 60 * 60 * 1000)); Taro.showToast({ - title: `该房号信息已报备,保护期剩余${remainingDays}天`, + title: `该房号信息已报备(${getApplyStatusText(existingCustomer.applyStatus)}),保护期剩余${remainingDays}天,本次报备未生效`, icon: 'none', duration: 3000 }); @@ -250,7 +251,7 @@ const AddShopDealerApply = () => { const modalResult = await new Promise((resolve) => { Taro.showModal({ title: '提示', - content: '该房号已超过7天保护期,是否重新报备跟进?', + content: `该房号已超过${PROTECTION_DAYS}天保护期,是否重新报备跟进?`, showCancel: true, cancelText: '取消', confirmText: '确定', @@ -262,7 +263,7 @@ const AddShopDealerApply = () => { if (!modalResult) return false; } else { Taro.showToast({ - title: '该房号信息已报备', + title: `该房号信息已报备(${getApplyStatusText(existingCustomer.applyStatus)}),本次报备未生效`, icon: 'none', duration: 2500 }); @@ -291,7 +292,7 @@ const AddShopDealerApply = () => { refereeId: referee?.refereeId, applyStatus: isEditMode ? 20 : 10, auditTime: undefined, - // 设置保护期过期时间(7天后) + // 设置保护期过期时间(15天后) expirationTime: expirationTime, // 确保日期数据正确提交(使用数据库格式) applyTime: values.applyTime || (applyTime ? formatDateForDatabase(applyTime) : ''), @@ -351,10 +352,10 @@ const AddShopDealerApply = () => { }).catch((error) => { console.error('页面加载失败:', error); setLoading(false); - Taro.showToast({ - title: '页面加载失败', - icon: 'error' - }); + // Taro.showToast({ + // title: '页面加载失败', + // icon: 'error' + // }); }) }, []); // 依赖用户ID,当用户变化时重新加载 @@ -390,22 +391,22 @@ const AddShopDealerApply = () => { - + - + - + - + - + - + {isEditMode && ( <>