隐藏创建邀请码

This commit is contained in:
lyp 2025-03-07 10:58:17 +08:00
parent 890ef56f53
commit 45fd7c0e5d

View File

@ -5,8 +5,12 @@ import { useDispatch,
} from 'react-redux' } from 'react-redux'
import BalanceHead from '../../components/balance/BalanceHead.tsx'; import BalanceHead from '../../components/balance/BalanceHead.tsx';
import RechargeHead from '../../components/recharge/RechargeHead.tsx'; import RechargeHead from '../../components/recharge/RechargeHead.tsx';
import { Empty, Dropdown, MenuProps, message, Modal, Space, Spin, Input, Table, Form, Button, InputNumber } from "antd"; import {
import type { TableProps, FormProps } from 'antd'; // Empty,
Dropdown, MenuProps, message, Modal, Space, Spin, Input, Table,
// Form, Button, InputNumber
} from "antd";
// import type { TableProps, FormProps } from 'antd';
interface DataType { interface DataType {
usericId: string; usericId: string;
icPriceMaterial: number; icPriceMaterial: number;
@ -14,23 +18,23 @@ interface DataType {
createTime: string; createTime: string;
} }
interface icDataType { // interface icDataType {
contactName: string;//联系人姓名 // contactName: string;//联系人姓名
contactPhone: string;//联系人电话 // contactPhone: string;//联系人电话
idCardNumber: string;//证件号 // idCardNumber: string;//证件号
idCardType: string;//证件类型 // idCardType: string;//证件类型
lastLoginTime: string;//最后登录时间 // lastLoginTime: string;//最后登录时间
userId: string;//用户id // userId: string;//用户id
userInfoId: string;//主键 // userInfoId: string;//主键
userInfoName: string;//用户名称 // userInfoName: string;//用户名称
userInfoNameEn: string;//用户英文名称 // userInfoNameEn: string;//用户英文名称
userInfoType: string;//用户类型 // userInfoType: string;//用户类型
userUsername: string;//用户名 // userUsername: string;//用户名
} // }
type FieldType = { // type FieldType = {
icPriceMaterial: string; // icPriceMaterial: string;
icPriceAll: string; // icPriceAll: string;
}; // };
// const data: DataType[] = [ // const data: DataType[] = [
// { // {
@ -99,7 +103,7 @@ import { DownOutlined, UserOutlined, QuestionCircleOutlined, BellOutlined, KeyOu
import { useContext, useEffect, useState } from "react"; import { useContext, useEffect, useState } from "react";
import { import {
put, get, put, get,
post, // post,
getUseUrl getUseUrl
} from "../../util/AjaxUtils.ts"; } from "../../util/AjaxUtils.ts";
import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts"; import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
@ -155,14 +159,18 @@ export default function Head() {
// useEffect(() => { // useEffect(() => {
// getPickList(); // getPickList();
// }, [packPage]); // }, [packPage]);
const [page, setPage] = useState(1) //邀请码使用人数分页
const [total, setTotal] = useState(0) //邀请码使用人数总量
const [icListLoading, setIcListLoading] = useState(false)
const [myInvModal, setMyInvModal] = useState(false) //我的邀请码弹窗
const [createInvModal, setCreateInvModal] = useState(false) //创建邀请码弹窗 // const [page, setPage] = useState(1) //邀请码使用人数分页
const [icModal, setIcModal] = useState(false) //查看邀请码详情弹窗 // const [total, setTotal] = useState(0) //邀请码使用人数总量
const [selectIc, setSelectIc] = useState('') //选中的邀请码 // const [icListLoading, setIcListLoading] = useState(false)
// const [myInvModal, setMyInvModal] = useState(false) //我的邀请码弹窗
// const [createInvModal, setCreateInvModal] = useState(false) //创建邀请码弹窗
// const [icModal, setIcModal] = useState(false) //查看邀请码详情弹窗
// const [selectIc, setSelectIc] = useState('') //选中的邀请码
// const redxuState: any = useSelector(state => state) // const redxuState: any = useSelector(state => state)
// const packNum = redxuState.packNum // const packNum = redxuState.packNum
// 消息通知弹窗 // 消息通知弹窗
@ -198,7 +206,7 @@ export default function Head() {
// 邀请码申请状态 // 邀请码申请状态
// const [icStatus, setIcStatus] = useState('') // const [icStatus, setIcStatus] = useState('')
// 邀请码返利比例 // 邀请码返利比例
const [icRebateRatio, seticRebateRatio] = useState('') // const [icRebateRatio, seticRebateRatio] = useState('')
// 全托管分账 // 全托管分账
// const [icPriceAll, seticPriceAll] = useState(0) // const [icPriceAll, seticPriceAll] = useState(0)
// 写材料分账 // 写材料分账
@ -228,7 +236,7 @@ export default function Head() {
// console.log(data); // console.log(data);
// setInvNum(data.ic) // setInvNum(data.ic)
setBindingInvNum(data.relationIc) setBindingInvNum(data.relationIc)
seticRebateRatio(data.icRebateRatio) // seticRebateRatio(data.icRebateRatio)
// seticPriceAll(Number(data.icPriceAll) / 100 * Number(data.icRebateRatio) / 100) // seticPriceAll(Number(data.icPriceAll) / 100 * Number(data.icRebateRatio) / 100)
// seticPriceMaterial(Number(data.icPriceMaterial) / 100 * Number(data.icRebateRatio) / 100) // seticPriceMaterial(Number(data.icPriceMaterial) / 100 * Number(data.icRebateRatio) / 100)
if (data.ic == '') { if (data.ic == '') {
@ -278,75 +286,75 @@ export default function Head() {
} }
} }
// 我的邀请码列表 // 我的邀请码列表
const [myIcList, setMyIcList] = useState([]) // const [myIcList, setMyIcList] = useState([])
// 获取我得邀请码列表 // 获取我得邀请码列表
const getMyIcList = () => { // const getMyIcList = () => {
get<any>({ // get<any>({
messageApi, // messageApi,
url: '/api/ic/v2/list/self', // url: '/api/ic/v2/list/self',
// body: { // // body: {
// value: inInvNum // // value: inInvNum
// }, // // },
onBefore() { // onBefore() {
setIcListLoading(true) // setIcListLoading(true)
}, // },
onSuccess({ data }) { // onSuccess({ data }) {
// console.log(data); // // console.log(data);
setMyIcList(data) // setMyIcList(data)
// setMyIcList([]) // // setMyIcList([])
}, // },
onFinally() { // onFinally() {
setIcListLoading(false) // setIcListLoading(false)
} // }
}) // })
} // }
const [minAllPrice, setMinAllPrice] = useState(0) //最低全托管折扣价 // const [minAllPrice, setMinAllPrice] = useState(0) //最低全托管折扣价
const [minMaterialPrice, setMinMaterialPrice] = useState(0) //最低写材料折扣价 // const [minMaterialPrice, setMinMaterialPrice] = useState(0) //最低写材料折扣价
// 查看我得最低定价 // 查看我得最低定价
const getMyIcMinPrice = () => { // const getMyIcMinPrice = () => {
get<any>({ // get<any>({
messageApi, // messageApi,
url: '/api/proj/charge/get', // url: '/api/proj/charge/get',
onBefore() { // onBefore() {
}, // },
onSuccess({ data }) { // onSuccess({ data }) {
// console.log(data.projTypes); // // console.log(data.projTypes);
// console.log((data.projTypes.find((item:any) => item.type === 'MATERIAL')).price/100); // // console.log((data.projTypes.find((item:any) => item.type === 'MATERIAL')).price/100);
setMinAllPrice((data.projTypes.find((item: any) => item.type === 'ALL')).price / 100) // setMinAllPrice((data.projTypes.find((item: any) => item.type === 'ALL')).price / 100)
setMinMaterialPrice((data.projTypes.find((item: any) => item.type === 'MATERIAL')).price / 100) // setMinMaterialPrice((data.projTypes.find((item: any) => item.type === 'MATERIAL')).price / 100)
}, // },
onFinally() { // onFinally() {
} // }
}) // })
} // }
// 查看我的邀请码是否超出限制 // 查看我的邀请码是否超出限制
const getIcLimit = () => { // const getIcLimit = () => {
get<any>({ // get<any>({
messageApi, // messageApi,
url: '/api/ic/v2/list/self', // url: '/api/ic/v2/list/self',
onBefore() { // onBefore() {
}, // },
onSuccess({ data }) { // onSuccess({ data }) {
// console.log(data); // // console.log(data);
// console.log(data.length); // // console.log(data.length);
if (data.length >= 10) { // if (data.length >= 10) {
messageApi.open({ // messageApi.open({
type: 'error', // type: 'error',
content: '您的邀请码已达上限' // content: '您的邀请码已达上限'
}) // })
} else { // } else {
setCreateInvModal(true) // setCreateInvModal(true)
getMyIcMinPrice() // getMyIcMinPrice()
} // }
} // }
}) // })
} // }
// 点击获取邀请码 // 点击获取邀请码
// const getInvNum = () => { // const getInvNum = () => {
// post<any>({ // post<any>({
@ -367,207 +375,207 @@ export default function Head() {
// } // }
// 表单事件 // 表单事件
const onFinish: FormProps<FieldType>['onFinish'] = (values: any) => { // const onFinish: FormProps<FieldType>['onFinish'] = (values: any) => {
// console.log('Success:', values.icPriceAll); // // console.log('Success:', values.icPriceAll);
// console.log('Success:', values.icPriceMaterial); // // console.log('Success:', values.icPriceMaterial);
post<any>({ // post<any>({
messageApi, // messageApi,
url: `/api/ic/v2/save`, // url: `/api/ic/v2/save`,
body: { // body: {
icPriceAll: values.icPriceAll * 100, // icPriceAll: values.icPriceAll * 100,
icPriceMaterial: values.icPriceMaterial * 100 // icPriceMaterial: values.icPriceMaterial * 100
}, // },
onBefore() { // onBefore() {
setIcListLoading(true) // setIcListLoading(true)
}, // },
onSuccess() { // onSuccess() {
// console.log(data); // // console.log(data);
messageApi.success('创建成功') // messageApi.success('创建成功')
// 关闭弹窗 // // 关闭弹窗
setCreateInvModal(false) // setCreateInvModal(false)
}, // },
onFinally() { // onFinally() {
setIcListLoading(false) // setIcListLoading(false)
} // }
}) // })
}; // };
// const onFinishFailed: FormProps<FieldType>['onFinishFailed'] = (errorInfo) => { // const onFinishFailed: FormProps<FieldType>['onFinishFailed'] = (errorInfo) => {
// console.log('Failed:', errorInfo); // console.log('Failed:', errorInfo);
// }; // };
// 使用的邀请码的人的信息列表 // 使用的邀请码的人的信息列表
const [icList, setIcList] = useState<icDataType[]>([]); // const [icList, setIcList] = useState<icDataType[]>([]);
// 获取使用的邀请码的人的信息 // 获取使用的邀请码的人的信息
const getIcUserInfo = (id: string, page: number) => { // const getIcUserInfo = (id: string, page: number) => {
get<any>({ // get<any>({
messageApi, // messageApi,
url: `/api/ic/v2/user-list/${id}`, // url: `/api/ic/v2/user-list/${id}`,
config: { // config: {
params: { // params: {
page: page, // page: page,
rows: 10 // rows: 10
} // }
}, // },
onBefore() { // onBefore() {
setIcListLoading(true) // setIcListLoading(true)
}, // },
onSuccess({ data }) { // onSuccess({ data }) {
setIcList(data.rows) // setIcList(data.rows)
setTotal(data.total) // setTotal(data.total)
}, // },
onFinally() { // onFinally() {
setIcListLoading(false) // setIcListLoading(false)
} // }
}) // })
} // }
// 复制邀请码 // 复制邀请码
const copyInvNum = (code: any) => { // const copyInvNum = (code: any) => {
// 创建一个临时的 input 元素 // // 创建一个临时的 input 元素
const tempInput = document.createElement('input'); // const tempInput = document.createElement('input');
document.body.appendChild(tempInput); // document.body.appendChild(tempInput);
tempInput.value = code; // tempInput.value = code;
// 选中 input 中的内容 // // 选中 input 中的内容
tempInput.select(); // tempInput.select();
tempInput.setSelectionRange(0, 99999); // 对于移动设备的支持 // tempInput.setSelectionRange(0, 99999); // 对于移动设备的支持
// 执行复制操作 // // 执行复制操作
try { // try {
document.execCommand('copy'); // document.execCommand('copy');
messageApi.open({ // messageApi.open({
type: 'success', // type: 'success',
content: '已复制到剪切板' // content: '已复制到剪切板'
}) // })
} catch (err) { // } catch (err) {
messageApi.open({ // messageApi.open({
type: 'error', // type: 'error',
content: '复制失败,请手动复制' // content: '复制失败,请手动复制'
}) // })
} // }
// 移除临时的 input 元素 // // 移除临时的 input 元素
document.body.removeChild(tempInput); // document.body.removeChild(tempInput);
} // }
const columns: TableProps<DataType>['columns'] = [ // const columns: TableProps<DataType>['columns'] = [
{ // {
title: '序号', // title: '序号',
align: 'center', // align: 'center',
dataIndex: 'usericId', // dataIndex: 'usericId',
key: 'usericId', // key: 'usericId',
render: (_text, _record, index) => <div> // render: (_text, _record, index) => <div>
{index + 1} // {index + 1}
</div>, // </div>,
}, // },
{ // {
title: '邀请码', // title: '邀请码',
align: 'center', // align: 'center',
dataIndex: 'usericId', // dataIndex: 'usericId',
key: 'usericId', // key: 'usericId',
// render: (text) => <a>{text}</a>, // // render: (text) => <a>{text}</a>,
}, // },
{ // {
title: '创建时间', // title: '创建时间',
align: 'center', // align: 'center',
dataIndex: 'createTime', // dataIndex: 'createTime',
key: 'usericId', // key: 'usericId',
// render: (text) => <a>{text}</a>, // // render: (text) => <a>{text}</a>,
}, // },
{ // {
title: '写材料价格', // title: '写材料价格',
align: 'center', // align: 'center',
dataIndex: 'icPriceMaterial', // dataIndex: 'icPriceMaterial',
key: 'usericId', // key: 'usericId',
render: (text) => <>{text / 100}</> // render: (text) => <>{text / 100}元</>
}, // },
{ // {
title: '全托管价格', // title: '全托管价格',
align: 'center', // align: 'center',
dataIndex: 'icPriceAll', // dataIndex: 'icPriceAll',
key: 'usericId', // key: 'usericId',
render: (text) => <>{text / 100}</> // render: (text) => <>{text / 100}元</>
}, // },
// { // // {
// title: '返利比例', // // title: '返利比例',
// align: 'center', // // align: 'center',
// dataIndex: 'icRebateTatio', // // dataIndex: 'icRebateTatio',
// key: 'usericId', // // key: 'usericId',
// render: (text) => <>{text}%</>, // // render: (text) => <>{text}%</>,
// }, // // },
// { // // {
// title: '产生的成交金额', // // title: '产生的成交金额',
// align: 'center', // // align: 'center',
// dataIndex: 'totalMoney', // // dataIndex: 'totalMoney',
// key: 'usericId', // // key: 'usericId',
// }, // // },
{ // {
title: '操作', // title: '操作',
align: 'center', // align: 'center',
key: 'usericId', // key: 'usericId',
render: (_, record) => ( // render: (_, record) => (
<Space size="middle"> // <Space size="middle">
<a style={{ // <a style={{
textDecoration: 'underline', // textDecoration: 'underline',
}} onClick={() => { // }} onClick={() => {
copyInvNum(record.usericId) // copyInvNum(record.usericId)
}}></a> // }}>复制</a>
<a style={{ // <a style={{
textDecoration: 'underline', // textDecoration: 'underline',
}} onClick={() => { // }} onClick={() => {
setIcModal(true) // setIcModal(true)
setSelectIc(record.usericId) // setSelectIc(record.usericId)
getIcUserInfo(record.usericId, page) // getIcUserInfo(record.usericId, page)
}}>使</a> // }}>查看使用用户</a>
</Space> // </Space>
), // ),
}, // },
]; // ];
const icColumns: TableProps<icDataType>['columns'] = [ // const icColumns: TableProps<icDataType>['columns'] = [
{ // {
title: '序号', // title: '序号',
align: 'center', // align: 'center',
dataIndex: 'index', // dataIndex: 'index',
key: 'userInfoId', // key: 'userInfoId',
render: (_text, _record, index) => <div> // render: (_text, _record, index) => <div>
{index + 1} // {index + 1}
</div>, // </div>,
}, // },
// { // // {
// title: '用户ID', // // title: '用户ID',
// align: 'center', // // align: 'center',
// dataIndex: 'userId', // // dataIndex: 'userId',
// key: 'userInfoId', // // key: 'userInfoId',
// // render: (text) => <a>{text}</a>, // // // render: (text) => <a>{text}</a>,
// }, // // },
{ // {
title: '账号', // title: '账号',
align: 'center', // align: 'center',
dataIndex: 'userUsername', // dataIndex: 'userUsername',
key: 'userInfoId', // key: 'userInfoId',
// render: (text) => <a>{text}</a>, // // render: (text) => <a>{text}</a>,
}, // },
{ // {
title: '昵称', // title: '昵称',
align: 'center', // align: 'center',
dataIndex: 'userInfoName', // dataIndex: 'userInfoName',
key: 'userInfoId', // key: 'userInfoId',
// render: (text) => <a>{text}</a>, // // render: (text) => <a>{text}</a>,
}, // },
{ // {
title: '最近登录时间', // title: '最近登录时间',
align: 'center', // align: 'center',
dataIndex: 'lastLoginTime', // dataIndex: 'lastLoginTime',
key: 'userInfoId', // key: 'userInfoId',
// render: (text) => <a>{text}</a>, // // render: (text) => <a>{text}</a>,
}, // },
] // ]
const dispath = useDispatch() const dispath = useDispatch()
// 更新所属者表格储存至redux // 更新所属者表格储存至redux
const upBelongArray = () => { const upBelongArray = () => {
@ -1185,7 +1193,7 @@ export default function Head() {
setInInvNum('') setInInvNum('')
}}> }}>
<Spin tip="加载中..." spinning={isLoading}> <Spin tip="加载中..." spinning={isLoading}>
<div className='invitation-box'> {/* <div className='invitation-box'> */}
{/* <div className='invBox-top'> {/* <div className='invBox-top'>
<div className='invBox-title'> <div className='invBox-title'>
@ -1221,7 +1229,7 @@ export default function Head() {
</div> </div>
</div> </div>
</div> */} </div> */}
<div className='invBox-top'> {/* <div className='invBox-top'>
<div className='invBox-titleTop' <div className='invBox-titleTop'
> >
@ -1238,7 +1246,7 @@ export default function Head() {
<div className='createInv'> <div className='createInv'>
<span <span
onClick={() => { onClick={() => {
// setCreateInvModal(true)
getIcLimit() getIcLimit()
}} }}
@ -1246,29 +1254,27 @@ export default function Head() {
cursor: 'pointer' cursor: 'pointer'
}}></span> }}></span>
</div> </div>
</div> </div> */}
{/* <div style={{ display: icRebateRatio ? 'block' : 'none' }}> */}
<div className='invBox-bot'> {/* <div className='invBox-bot'>
<div className='invBox-tips' > <div className='invBox-tips' >
{/* {icRebateRatio ? `邀请码分享给他人,即可获得${icRebateRatio}%佣金` : '邀请码分享给他人,即可获得佣金'} */}
{icRebateRatio ? {icRebateRatio ?
(<div> (<div>
<div> {icRebateRatio}%</div> <div> {icRebateRatio}%</div>
{/* <div style={{ paddingBottom: 20 }}>全托管佣金:{icPriceAll}元,写材料佣金:{icPriceMaterial}元</div> */}
</div> </div>
) )
: (<></>)} : (<></>)}
{/* */}
</div> </div>
{/* <div className='invBox-tips'>
XXXXXX导致,
</div> */} </div> */}
</div>
{/* </div> */} {/* </div> */}
</div>
<div className='invitation-box'> <div className='invitation-box'>
<div className='invBox-top'> <div className='invBox-top'>
<div className='invBox-title' style={{ <div className='invBox-title' style={{
@ -1406,7 +1412,7 @@ export default function Head() {
// setCouponModal(false) // setCouponModal(false)
}}></HeadCouponModal> }}></HeadCouponModal>
</Modal> */} </Modal> */}
<Modal title="我的邀请码" {/* <Modal title=""
// footer={null} // footer={null}
centered centered
destroyOnClose destroyOnClose
@ -1443,8 +1449,8 @@ export default function Head() {
/> />
</div> </div>
</Spin> </Spin>
</Modal> </Modal> */}
<Modal title="创建邀请码" {/* <Modal title=""
// footer={null} // footer={null}
centered centered
destroyOnClose destroyOnClose
@ -1551,8 +1557,8 @@ export default function Head() {
</Form> </Form>
</Spin> </Spin>
</div> </div>
</Modal> </Modal> */}
<Modal title={`邀请码${selectIc}使用用户`} {/* <Modal title={`${selectIc}使`}
// footer={null} // footer={null}
centered centered
destroyOnClose destroyOnClose
@ -1601,7 +1607,7 @@ export default function Head() {
/> />
</Spin> </Spin>
</Modal> </Modal> */}
<Spin tip="正在提交..." spinning={loading} fullscreen /> <Spin tip="正在提交..." spinning={loading} fullscreen />
{contextHolder} {contextHolder}
{modalHolder} {modalHolder}