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