You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
3.2 KiB
98 lines
3.2 KiB
import {Cell} from '@nutui/nutui-react-taro'
|
|
import navTo from "@/utils/common";
|
|
import {View, Text} from '@tarojs/components'
|
|
import {ArrowRight, Reward, Setting} from '@nutui/icons-react-taro'
|
|
import {useUser} from '@/hooks/useUser'
|
|
import {useEffect, useState} from "react";
|
|
import {useDealerUser} from "@/hooks/useDealerUser";
|
|
import {useThemeStyles} from "@/hooks/useTheme";
|
|
import {configWebsiteField} from "@/api/cms/cmsWebsiteField";
|
|
import {Config} from "@/api/cms/cmsWebsiteField/model";
|
|
|
|
const IsDealer = () => {
|
|
const themeStyles = useThemeStyles();
|
|
const [config, setConfig] = useState<Config>()
|
|
const {isSuperAdmin} = useUser();
|
|
const {dealerUser} = useDealerUser()
|
|
|
|
useEffect(() => {
|
|
configWebsiteField().then(data => {
|
|
console.log(data)
|
|
setConfig(data)
|
|
})
|
|
}, [])
|
|
|
|
/**
|
|
* 管理中心
|
|
*/
|
|
if (isSuperAdmin()) {
|
|
return (
|
|
<>
|
|
<View className={'px-4'} style={{ marginTop: '8px', position: 'relative', zIndex: 25 }}>
|
|
<Cell
|
|
className="nutui-cell-clickable"
|
|
style={themeStyles.primaryBackground}
|
|
title={
|
|
<View style={{display: 'inline-flex', alignItems: 'center'}}>
|
|
<Setting className={'text-white '} size={16}/>
|
|
<Text style={{fontSize: '16px'}} className={'pl-3 text-white font-medium'}>管理中心</Text>
|
|
</View>
|
|
}
|
|
extra={<ArrowRight color="#ffffff" size={18}/>}
|
|
onClick={() => navTo('/admin/index', true)}
|
|
/>
|
|
</View>
|
|
</>
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 分销中心
|
|
*/
|
|
if (dealerUser) {
|
|
return (
|
|
<>
|
|
<View className={'px-4'} style={{ marginTop: '8px', position: 'relative', zIndex: 25 }}>
|
|
<Cell
|
|
className="nutui-cell-clickable"
|
|
style={themeStyles.primaryBackground}
|
|
title={
|
|
<View style={{display: 'inline-flex', alignItems: 'center'}}>
|
|
<Reward className={'text-orange-100 '} size={16}/>
|
|
<Text style={{fontSize: '16px'}}
|
|
className={'pl-3 text-orange-100 font-medium'}>{config?.vipText || '入驻申请'}</Text>
|
|
{/*<Text className={'text-white opacity-80 pl-3'}>门店核销</Text>*/}
|
|
</View>
|
|
}
|
|
extra={<ArrowRight color="#cccccc" size={18}/>}
|
|
onClick={() => navTo('/dealer/index', true)}
|
|
/>
|
|
</View>
|
|
</>
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 普通用户
|
|
*/
|
|
return (
|
|
<>
|
|
<View className={'px-4'} style={{ marginTop: '8px', position: 'relative', zIndex: 25 }}>
|
|
<Cell
|
|
className="nutui-cell-clickable"
|
|
style={themeStyles.primaryBackground}
|
|
title={
|
|
<View style={{display: 'inline-flex', alignItems: 'center'}}>
|
|
<Reward className={'text-orange-100 '} size={16}/>
|
|
<Text style={{fontSize: '16px'}} className={'pl-3 text-orange-100 font-medium'}>{config?.vipText || '开通VIP'}</Text>
|
|
<Text className={'text-white opacity-80 pl-3'}>{config?.vipComments || '享优惠'}</Text>
|
|
</View>
|
|
}
|
|
extra={<ArrowRight color="#cccccc" size={18}/>}
|
|
onClick={() => navTo('/dealer/apply/add', true)}
|
|
/>
|
|
</View>
|
|
</>
|
|
)
|
|
}
|
|
export default IsDealer
|