From 9294c7b049f5bdf0aae32b7e81a9d5686a8d4551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Thu, 22 Jan 2026 17:03:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(dealer):=20=E8=B0=83=E6=95=B4=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E6=8A=A5=E5=A4=87=E4=BF=9D=E6=8A=A4=E6=9C=9F=E4=B8=BA?= =?UTF-8?q?15=E5=A4=A9=E5=B9=B6=E4=BC=98=E5=8C=96=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将保护期从7天调整为15天,并使用常量PROTECTION_DAYS统一管理 - 更新已报备提示信息,显示当前状态及本次报备未生效 - 修改确认模态框内容,显示正确的保护期天数 - 优化输入框占位符提示,提供具体的输入示例 - 注释掉页面加载失败时的错误提示,避免影响用户体验 --- src/dealer/customer/add.tsx | 43 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) 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 && ( <>