fix(dealer): 更新角色ID及重新登录逻辑
- 将用户角色ID从1848更新为1935 - 注册后延时1.5秒等待权限同步,无额外空行 feat(customer): 新增小区选择功能 - 添加小区选择状态管理及弹出层组件 - 实现小区列表加载与搜索过滤 - 支持小区的选择与清除操作,更新表单地址字段 - 表单回填时设置小区选中状态 - 用自定义Cell替代地址输入框,增加交互体验 fix(index): 修改邀请好友页面路径 - 将邀请好友页面路径由/dealer/qrcode/index更改为/dealer/team/index fix(qrcode): 更新伙伴计划名称 - 将“南南佐顿门窗伙伴计划”修改为“桂乐淘伙伴计划” fix(team): 隐藏手机号显示并简化成员信息 - 将手机号显示组件隐藏 - 移除显示UID的文本,仅保留加入时间显示
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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<boolean>(false)
|
||||
const [selectedReceptionist, setSelectedReceptionist] = useState<ShopDealerUser | null>(null)
|
||||
|
||||
// 小区选择状态
|
||||
const [showCommunityPicker, setShowCommunityPicker] = useState<boolean>(false)
|
||||
const [communitySearch, setCommunitySearch] = useState<string>('')
|
||||
const [communityList, setCommunityList] = useState<DictData[]>([])
|
||||
const [communityLoading, setCommunityLoading] = useState<boolean>(false)
|
||||
const [selectedCommunity, setSelectedCommunity] = useState<DictData | null>(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 = () => {
|
||||
>
|
||||
<View className={'bg-gray-100 h-3'}></View>
|
||||
<CellGroup style={{padding: '4px 0'}}>
|
||||
<Form.Item name="address" label="小区" initialValue={FormData?.address} required>
|
||||
<Input placeholder="幸福里" disabled={isEditMode}/>
|
||||
</Form.Item>
|
||||
<Cell
|
||||
title="小区"
|
||||
required
|
||||
extra={
|
||||
<View className="flex items-center">
|
||||
{selectedCommunity ? (
|
||||
<View className="flex items-center">
|
||||
<Text className="text-sm text-gray-800 mr-2">
|
||||
{selectedCommunity.dictDataName || selectedCommunity.label}
|
||||
</Text>
|
||||
{!isEditMode && (
|
||||
<View
|
||||
onClick={(e) => { e.stopPropagation(); handleClearCommunity(); }}
|
||||
className="flex items-center px-1"
|
||||
>
|
||||
<Del size={14} color="#999"/>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
) : (
|
||||
<Text className="text-sm text-gray-400">请选择小区</Text>
|
||||
)}
|
||||
<ArrowRight size={14} color="#ccc"/>
|
||||
</View>
|
||||
}
|
||||
onClick={isEditMode ? undefined : openCommunityPicker}
|
||||
/>
|
||||
<Form.Item name="address" initialValue={FormData?.address} style={{display: 'none'}}/> {/* 隐藏字段,用于表单提交 */}
|
||||
<Form.Item name="buildingNo" label="楼栋号" required>
|
||||
<Input placeholder="3" disabled={isEditMode}/>
|
||||
</Form.Item>
|
||||
@@ -762,6 +860,59 @@ const AddShopDealerApply = () => {
|
||||
</View>
|
||||
</Popup>
|
||||
|
||||
{/* 小区选择弹出层 */}
|
||||
<Popup
|
||||
visible={showCommunityPicker}
|
||||
position="bottom"
|
||||
round
|
||||
onClose={() => setShowCommunityPicker(false)}
|
||||
style={{height: '70%'}}
|
||||
>
|
||||
<View className="flex flex-col h-full">
|
||||
{/* 标题栏 */}
|
||||
<View className="flex items-center justify-between px-4 py-3 border-b border-gray-100">
|
||||
<Text className="text-base font-semibold text-gray-800">选择小区</Text>
|
||||
<View onClick={() => setShowCommunityPicker(false)}>
|
||||
<Text className="text-sm text-blue-500">取消</Text>
|
||||
</View>
|
||||
</View>
|
||||
{/* 搜索框 */}
|
||||
<View className="px-3 py-2">
|
||||
<SearchBar
|
||||
value={communitySearch}
|
||||
placeholder="搜索小区名称"
|
||||
onChange={handleCommunitySearch}
|
||||
/>
|
||||
</View>
|
||||
{/* 列表 */}
|
||||
<View className="flex-1 overflow-y-auto">
|
||||
{communityLoading ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Loading>加载中</Loading>
|
||||
</View>
|
||||
) : communityList.length === 0 ? (
|
||||
<View className="flex justify-center items-center py-8">
|
||||
<Text className="text-sm text-gray-400">暂无小区数据</Text>
|
||||
</View>
|
||||
) : (
|
||||
communityList.map((item, index) => (
|
||||
<Cell
|
||||
key={item.dictDataId || index}
|
||||
title={item.dictDataName || item.label || ''}
|
||||
description={item.comments || ''}
|
||||
extra={
|
||||
selectedCommunity?.dictDataId === item.dictDataId ? (
|
||||
<Text className="text-sm text-blue-500">已选</Text>
|
||||
) : null
|
||||
}
|
||||
onClick={() => handleSelectCommunity(item)}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
|
||||
{/* 审核状态显示(仅在编辑模式下显示) */}
|
||||
{isEditMode && (
|
||||
<CellGroup>
|
||||
|
||||
@@ -385,7 +385,7 @@ const DealerQrcode: React.FC = () => {
|
||||
)}
|
||||
|
||||
<View className="text-lg font-semibold text-gray-800 mb-2">
|
||||
南南佐顿门窗伙伴计划
|
||||
桂乐淘伙伴计划
|
||||
</View>
|
||||
<View className="text-sm text-gray-500 mb-4">
|
||||
自购省 | 分享赚 | 好友惠
|
||||
|
||||
@@ -325,7 +325,7 @@ const DealerTeam: React.FC = () => {
|
||||
</View>
|
||||
{/* 显示手机号(仅本级可见) */}
|
||||
{showPhone && member.phone && (
|
||||
<Text className="text-sm text-gray-500" onClick={(e) => {
|
||||
<Text className="text-sm text-gray-500 hidden" onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
makePhoneCall(member.phone || '');
|
||||
}}>
|
||||
@@ -334,14 +334,9 @@ const DealerTeam: React.FC = () => {
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
<Space>
|
||||
<Text>
|
||||
<Text className="text-xs text-gray-500">UID:{member.userId}</Text>
|
||||
</Text>
|
||||
<Text className="text-xs text-gray-500">
|
||||
加入时间:{member.joinTime}
|
||||
</Text>
|
||||
</Space>
|
||||
<Text className="text-xs text-gray-500">
|
||||
加入时间:{member.joinTime}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user