From 8128e2ffb2e8202d85a22b080ab88ab48fceee08 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, 16 Apr 2026 15:14:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(dealer):=20=E6=9B=B4=E6=96=B0=E8=A7=92?= =?UTF-8?q?=E8=89=B2ID=E5=8F=8A=E9=87=8D=E6=96=B0=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将用户角色ID从1848更新为1935 - 注册后延时1.5秒等待权限同步,无额外空行 feat(customer): 新增小区选择功能 - 添加小区选择状态管理及弹出层组件 - 实现小区列表加载与搜索过滤 - 支持小区的选择与清除操作,更新表单地址字段 - 表单回填时设置小区选中状态 - 用自定义Cell替代地址输入框,增加交互体验 fix(index): 修改邀请好友页面路径 - 将邀请好友页面路径由/dealer/qrcode/index更改为/dealer/team/index fix(qrcode): 更新伙伴计划名称 - 将“南南佐顿门窗伙伴计划”修改为“桂乐淘伙伴计划” fix(team): 隐藏手机号显示并简化成员信息 - 将手机号显示组件隐藏 - 移除显示UID的文本,仅保留加入时间显示 --- src/dealer/apply/add.tsx | 4 +- src/dealer/customer/add.tsx | 159 +++++++++++++++++++++++++++++++++++- src/dealer/qrcode/index.tsx | 2 +- src/dealer/team/index.tsx | 13 +-- src/pages/index/Grid.tsx | 2 +- 5 files changed, 163 insertions(+), 17 deletions(-) diff --git a/src/dealer/apply/add.tsx b/src/dealer/apply/add.tsx index 995b58c..6d3f981 100644 --- a/src/dealer/apply/add.tsx +++ b/src/dealer/apply/add.tsx @@ -207,7 +207,7 @@ const AddUserAddress = () => { if (roles.length > 0) { await updateUserRole({ ...roles[0], - roleId: 1848 + roleId: 1935 }) } @@ -233,7 +233,7 @@ const AddUserAddress = () => { // 注册成功后等待1.5秒,让权限同步生效 await new Promise(resolve => setTimeout(resolve, 1500)); - + // 重新登录刷新用户状态(包括最新权限) Taro.removeStorageSync('Token'); Taro.removeStorageSync('UserId'); diff --git a/src/dealer/customer/add.tsx b/src/dealer/customer/add.tsx index 45465ae..9e557e6 100644 --- a/src/dealer/customer/add.tsx +++ b/src/dealer/customer/add.tsx @@ -16,6 +16,8 @@ import { } from "@/utils/dateUtils"; import {ShopDealerUser} from "@/api/shop/shopDealerUser/model"; import {getShopDealerUser, pageShopDealerUser} from "@/api/shop/shopDealerUser"; +import {listDictData} from "@/api/system/dict-data"; +import type {DictData} from "@/api/system/dict-data/model"; const AddShopDealerApply = () => { const {params} = useRouter(); @@ -69,6 +71,13 @@ const AddShopDealerApply = () => { const [receptionistLoading, setReceptionistLoading] = useState(false) const [selectedReceptionist, setSelectedReceptionist] = useState(null) + // 小区选择状态 + const [showCommunityPicker, setShowCommunityPicker] = useState(false) + const [communitySearch, setCommunitySearch] = useState('') + const [communityList, setCommunityList] = useState([]) + const [communityLoading, setCommunityLoading] = useState(false) + const [selectedCommunity, setSelectedCommunity] = useState(null) + // 获取审核状态文字 const getApplyStatusText = (status?: number) => { switch (status) { @@ -196,6 +205,62 @@ const AddShopDealerApply = () => { setSelectedReceptionist(null) } + // 加载小区列表 + const loadCommunityList = async (keyword?: string) => { + setCommunityLoading(true) + try { + const list = await listDictData({ dictCode: 'xiaoqu' }) + // 过滤搜索关键词 + if (keyword) { + setCommunityList(list.filter((item: DictData) => + (item.dictDataName || '').includes(keyword) || + (item.label || '').includes(keyword) + )) + } else { + setCommunityList(list) + } + } catch (e) { + console.error('加载小区列表失败:', e) + } finally { + setCommunityLoading(false) + } + } + + // 打开小区选择 + const openCommunityPicker = () => { + setCommunitySearch('') + loadCommunityList() + setShowCommunityPicker(true) + } + + // 搜索小区 + const handleCommunitySearch = (val: string) => { + setCommunitySearch(val) + loadCommunityList(val) + } + + // 选择小区 + const handleSelectCommunity = (item: DictData) => { + setSelectedCommunity(item) + setShowCommunityPicker(false) + // 更新表单数据 + if (formRef.current) { + formRef.current.setFieldsValue({ + address: item.dictDataName || item.label || '' + }) + } + } + + // 清除小区 + const handleClearCommunity = () => { + setSelectedCommunity(null) + if (formRef.current) { + formRef.current.setFieldsValue({ + address: '' + }) + } + } + // 提交表单 // 计算保护期过期时间(15天后) const calculateExpirationTime = (): string => { @@ -578,14 +643,22 @@ const AddShopDealerApply = () => { useEffect(() => { if (!formRef.current || !FormData) return; const parsed = parseHouseKey(FormData.dealerCode); + const communityValue = parsed.community || FormData.address || ''; formRef.current.setFieldsValue({ - address: parsed.community || FormData.address, + address: communityValue, buildingNo: parsed.buildingNo, unitNo: parsed.unitNo, roomNo: parsed.roomNo, realName: FormData.realName, mobile: FormData.mobile }); + // 回填小区选中状态 + if (communityValue) { + setSelectedCommunity({ + dictDataName: communityValue, + label: communityValue + } as DictData) + } }, [FormData]); if (loading) { @@ -604,9 +677,34 @@ const AddShopDealerApply = () => { > - - - + + {selectedCommunity ? ( + + + {selectedCommunity.dictDataName || selectedCommunity.label} + + {!isEditMode && ( + { e.stopPropagation(); handleClearCommunity(); }} + className="flex items-center px-1" + > + + + )} + + ) : ( + 请选择小区 + )} + + + } + onClick={isEditMode ? undefined : openCommunityPicker} + /> + {/* 隐藏字段,用于表单提交 */} @@ -762,6 +860,59 @@ const AddShopDealerApply = () => { + {/* 小区选择弹出层 */} + setShowCommunityPicker(false)} + style={{height: '70%'}} + > + + {/* 标题栏 */} + + 选择小区 + setShowCommunityPicker(false)}> + 取消 + + + {/* 搜索框 */} + + + + {/* 列表 */} + + {communityLoading ? ( + + 加载中 + + ) : communityList.length === 0 ? ( + + 暂无小区数据 + + ) : ( + communityList.map((item, index) => ( + 已选 + ) : null + } + onClick={() => handleSelectCommunity(item)} + /> + )) + )} + + + + {/* 审核状态显示(仅在编辑模式下显示) */} {isEditMode && ( diff --git a/src/dealer/qrcode/index.tsx b/src/dealer/qrcode/index.tsx index 737ff1c..a721389 100644 --- a/src/dealer/qrcode/index.tsx +++ b/src/dealer/qrcode/index.tsx @@ -385,7 +385,7 @@ const DealerQrcode: React.FC = () => { )} - 南南佐顿门窗伙伴计划 + 桂乐淘伙伴计划 自购省 | 分享赚 | 好友惠 diff --git a/src/dealer/team/index.tsx b/src/dealer/team/index.tsx index 19222bc..cc22373 100644 --- a/src/dealer/team/index.tsx +++ b/src/dealer/team/index.tsx @@ -325,7 +325,7 @@ const DealerTeam: React.FC = () => { {/* 显示手机号(仅本级可见) */} {showPhone && member.phone && ( - { + { e.stopPropagation(); makePhoneCall(member.phone || ''); }}> @@ -334,14 +334,9 @@ const DealerTeam: React.FC = () => { )} - - - UID:{member.userId} - - - 加入时间:{member.joinTime} - - + + 加入时间:{member.joinTime} + diff --git a/src/pages/index/Grid.tsx b/src/pages/index/Grid.tsx index fdc2d23..305597f 100644 --- a/src/pages/index/Grid.tsx +++ b/src/pages/index/Grid.tsx @@ -28,7 +28,7 @@ const menuList: MenuItem[] = [ id: 3, title: '邀请好友', icon: 'https://oss.wsdns.cn/20260330/64cac0d5cbe645af8a574a257cd00302.png?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90', - path: '/dealer/qrcode/index' + path: '/dealer/team/index' }, { id: 4,