import './head.css' // import { NodeJS } from 'types/node'; 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'; interface DataType { usericId: string; icPriceMaterial: number; icPriceAll: number; 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; }; // const data: DataType[] = [ // { // key: '1', // code: 'xixi112', // price: 32, // }, // { // key: '2', // code: 'xixi22', // price: 42, // }, // { // key: '3', // code: 'hehe23', // price: 32, // }, // { // key: '4', // code: 'hehe1232', // price: 32, // }, // { // key: '4', // code: 'hehe123', // price: 32, // }, // { // key: '5', // code: 'hehe1235', // price: 32, // }, // { // key: '6', // code: 'hehe1236', // price: 32, // }, // { // key: '7', // code: 'hehe1237', // price: 32, // }, // { // key: '8', // code: 'hehe1238', // price: 32, // }, // { // key: '9', // code: 'hehe1239', // price: 32, // }, // ]; import { DownOutlined, UserOutlined, QuestionCircleOutlined, BellOutlined, KeyOutlined, LogoutOutlined, GiftOutlined, AccountBookOutlined, ContainerOutlined, MenuFoldOutlined, UsergroupAddOutlined, TableOutlined } from "@ant-design/icons"; import { useContext, useEffect, useState } from "react"; import { put, get, post, getUseUrl } from "../../util/AjaxUtils.ts"; import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts"; import UserEdit from "../../components/user/UserEdit.tsx"; import PasswordChange from "../../components/password/PasswordChange.tsx"; // import headRightBg from '../../assets/head-right-bg.png'; import InvoiceList from "../../components/invoice/InvoiceList.tsx"; import logoImg from '../../static/head/logo.png' import userImg from '../../static/homeimg/userimg.png' import kf from '../../static/head/kf.png' import kfImg from '../../static/head/kfImg.png' import { reMenuActive } from '../../util/cache'; // import BelongPeople from '../../components/BelongPeople/BelongPeople.tsx' import BelongPeople from '../../components/BelongPeople/BelongPeople.tsx' import ContactPeople from '../../components/ContactPeople/ContactPeople.tsx' import inv from '../../static/inv.png' import MyOrder from '../../components/myOrder/MyOrder.tsx' import NoticeModal from '../../components/NoticeModal/NoticeModal.tsx'; import type { TableColumnsType, } from 'antd'; // import HeadCouponModal from '../../components/CouponModal/HeadCouponModal.tsx' export default function Head() { const [packList, setPackList] = useState([]) //服务包列表 const [packPage, setPackPage] = useState(1) //服务包分页 const [packTotal, setPackTotal] = useState(0) //服务包总数 // 获取我得服务包信息 const getPickList = (page: number) => { get({ messageApi, url: `/api/proj/servicepkg/packageorder/listpage/self`, config: { params: { page: page, rows: 10, } }, onBefore() { }, onSuccess({ data }) { setPackList(data.rows) setPackTotal(data.total) }, onFinally() { } }) } // 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 redxuState: any = useSelector(state => state) // const couponModal = redxuState.couponModal // 消息通知弹窗 const [noticeModal, setNoticeModal] = useState(false) // 客服弹窗 const [kfModal, setkfModal] = useState(false) // 未读消息数 const [unRead, setUnRead] = useState(0) // 获取未读消息总数 const getUnRead = () => { get({ messageApi, url: '/api/user-msg/count-un-read/self', onSuccess({ data }) { // console.log(data); setUnRead(data.data) } }) } // 邀请码弹窗 const [invitationModal, setinvitationModal] = useState(false) // 邀请码弹窗加载 const [isLoading, setisLoading] = useState(false) // 解除绑定邀请码弹窗 // const [relieveModal, setRelieveModal] = useState(false) // 申请的邀请码 // const [invNum, setInvNum] = useState('') // 输入的邀请码 const [inInvNum, setInInvNum] = useState('') // 已绑定的邀请码 const [bindingInvNum, setBindingInvNum] = useState('') // 邀请码申请状态 // const [icStatus, setIcStatus] = useState('') // 邀请码返利比例 const [icRebateRatio, seticRebateRatio] = useState('') // 全托管分账 // const [icPriceAll, seticPriceAll] = useState(0) // 写材料分账 // const [icPriceMaterial, seticPriceMaterial] = useState(0) // 获取邀请码申请状态 // const getIcStatus = () => { // get({ // messageApi, // url: '/api/ic/apply/get/self', // onSuccess({ data }) { // // console.log(data); // if (data) { // setIcStatus(data.applyStatus) // } // } // }) // } // 获取邀请码信息 const getIc = () => { get({ messageApi, url: '/api/ic/get/self', onBefore() { setisLoading(true) }, onSuccess({ data }) { // console.log(data); // setInvNum(data.ic) setBindingInvNum(data.relationIc) seticRebateRatio(data.icRebateRatio) // seticPriceAll(Number(data.icPriceAll) / 100 * Number(data.icRebateRatio) / 100) // seticPriceMaterial(Number(data.icPriceMaterial) / 100 * Number(data.icRebateRatio) / 100) if (data.ic == '') { // getIcStatus() } }, onFinally() { setisLoading(false) } }) } // 绑定邀请码 const putIc = () => { put({ messageApi, url: `/api/ic/update-relation-ic`, body: { value: inInvNum }, onBefore() { }, onSuccess() { // messageApi.success('保存成功,点击编辑按钮可继续修改项目简介'); // console.log(data); getIc() }, onFinally() { } }) } // 确定输入的邀请码事件 const postInvNum = () => { if (!inInvNum) { messageApi.open({ type: 'error', content: '请输入邀请码' }) } else { // setBindingInvNum(inInvNum) // messageApi.open({ // type: 'success', // content: '已绑定邀请码' // }) putIc() } } // 我的邀请码列表 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 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); setMinAllPrice((data.projTypes.find((item: any) => item.type === 'ALL')).price / 100) setMinMaterialPrice((data.projTypes.find((item: any) => item.type === 'MATERIAL')).price / 100) }, onFinally() { } }) } // 查看我的邀请码是否超出限制 const getIcLimit = () => { get({ messageApi, url: '/api/ic/v2/list/self', onBefore() { }, onSuccess({ data }) { // console.log(data); // console.log(data.length); if (data.length >= 10) { messageApi.open({ type: 'error', content: '您的邀请码已达上限' }) } else { setCreateInvModal(true) getMyIcMinPrice() } } }) } // 点击获取邀请码 // const getInvNum = () => { // post({ // messageApi, // url: `/api/ic/apply/apply`, // onBefore() { // }, // onSuccess() { // messageApi.success('已申请') // getIcStatus() // }, // onFinally() { // } // }) // // setInvNum('RSDNQ5H7') // } // 表单事件 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) } }) }; // const onFinishFailed: FormProps['onFinishFailed'] = (errorInfo) => { // console.log('Failed:', errorInfo); // }; // 使用的邀请码的人的信息列表 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) }, onFinally() { setIcListLoading(false) } }) } // 复制邀请码 const copyInvNum = (code: any) => { // 创建一个临时的 input 元素 const tempInput = document.createElement('input'); document.body.appendChild(tempInput); tempInput.value = code; // 选中 input 中的内容 tempInput.select(); tempInput.setSelectionRange(0, 99999); // 对于移动设备的支持 // 执行复制操作 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', // }, { title: '操作', align: 'center', key: 'usericId', render: (_, record) => ( { 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 dispath = useDispatch() // 更新所属者表格储存至redux const upBelongArray = () => { get({ messageApi, url: `/api/proj-owner/list/self`, onBefore() { }, onSuccess(data: any) { // console.log('所属者表格', data.data); // setBelongPeopleArray(data.data) // 存redux的belongArray dispath({ type: 'uparray', val: data.data }) }, onFinally() { } }) } const globalContext = useContext(GlobalContext); const globalDispatchContext = useContext(GlobalDispatchContext); const [messageApi, contextHolder] = message.useMessage(); const [modal, modalHolder] = Modal.useModal(); const [loading, setLoading] = useState(false); const [isSelfModalOpen, setIsSelfModalOpen] = useState(false); const [isPasswordModalOpen, setIsPasswordModalOpen] = useState(false); const [isInvoiceModalOpen, setIsInvoiceModalOpen] = useState(false); // 我的订单弹窗 const [myorderModal, setMyorderModal] = useState(false) // 所属者弹窗 const [belongModal, setBelongModal] = useState(false) const [belongPeopleInfo, setBelongPeopleInfo] = useState({ authorName: '', authorType: '', authorIdCardType: '', authorIdCard: '', authorCrcAccount: '', authorId: '', authorProvinceCity: '' }) const setValue = () => { // console.log(value); } const setConcatValue = () => { } // 联系人弹窗 const [contactModal, setContactModal] = useState(false) // 套餐包弹窗 const [packageModal, setPackageModal] = useState(false) const [concatPeopleInfo, setConcatPeopleInfo] = useState({ applyConcatId: '', applyContactCsaNo: '', applyContactEmail: '', applyContactName: '', applyContactPhone: '', applyContactCompany: '' }) const packColumns: TableColumnsType = [ { title: '序号', dataIndex: 'index', key: 'packageOrderId', align: 'center', render: (_text, _record, index) => (packPage - 1) * 10 + index + 1, // 显示序号,从1开始 }, { title: '套餐名称', dataIndex: 'packageName', key: 'packageOrderId', // 居中显示 align: 'center', }, // packageType { title: '套餐类型', dataIndex: 'packageInfoAppDTO', key: 'packageOrderId', // 居中显示 align: 'center', render: (text) => { return
{text.packageType == "ALL" ? '全托管' : '写材料'}
} }, // { // title: '套餐类型', // dataIndex: 'packageInfoAppDTO', // key: 'packageOrderId', // // 居中显示 // align: 'center', // render: (text) => { // return
{text}
// } // }, { title: '价格', dataIndex: 'packageTotalMoney', key: 'packageOrderId', // 居中显示 align: 'center', render: (text) => { return
{text / 100}元
} }, { title: '剩余次数', dataIndex: 'packageTotalSurplusCount', align: 'center', key: 'packageOrderId', render: (text: number) => { return
{text}
} }, { title: '总次数', dataIndex: 'packageTotalCount', align: 'center', key: 'packageOrderId', render: (text: any) => { return
{text}
} }, { title: '下单时间', align: 'center', dataIndex: 'gmtCreate', key: 'packageOrderId', // render: (text: string) => { // return
{text}
// } }, ]; // 优惠券弹窗 // const [couponModal, setCouponModal] = useState(false) // const [belongArray,setBelongArray] = useState([]) // // 获取初始所属者数组 // const getLength = () => { // get({ // messageApi, // url: `/api/proj-owner/list/self`, // onBefore() { // }, // onSuccess(data: any) { // // console.log('所属者表格', data.data); // // setBelongPeopleArray(data.data) // setBelongArray(data.data ) // }, // onFinally() { // } // }) // } // // 获取更新的所属者数组并且做对比查看是否刷新网页 // const getNewLength = () => { // get({ // messageApi, // url: `/api/proj-owner/list/self`, // onBefore() { // }, // onSuccess(data: any) { // // console.log('所属者表格', data.data); // // setBelongPeopleArray(data.data) // console.log('查看结果',data.data != belongArray); // // if (data.data == belongArray) { // // window.location.reload(); // // } // }, // onFinally() { // } // }) // } useEffect(() => { // getLength() reloadUser(messageApi, globalDispatchContext).then((data) => { if (!data.hasUserInfo) { setIsSelfModalOpen(true); } }); }, [globalContext.user]); // 刷新用户信息 const reloadUserInterval = async () => { await reloadUser(messageApi, globalDispatchContext); }; useEffect(() => { getUnRead() setInterval(reloadUserInterval, 5 * 60 * 1000); }, []) const items: MenuProps['items'] = [ { key: 'userinfo', label: (
个人信息
), onClick: () => { setIsSelfModalOpen(true); } }, { key: 'changePass', label: (
修改密码
), onClick: () => { setIsPasswordModalOpen(true); } }, { key: 'invoice', label: (
发票管理
), onClick: () => { setIsInvoiceModalOpen(true); } }, { key: 'myorder', label: (
{/* */} 我的订单
), onClick: () => { setMyorderModal(true) } }, { key: 'belong', label: (
产权所属者
), onClick: () => { setBelongModal(true) } }, { key: 'contact', label: (
产权联系人
), onClick: () => { setContactModal(true) } }, { key: 'coupon', label: (
优惠券
), onClick: () => { // setCouponModal(true) dispath({ type: 'changeCouponModal', val: true }) } }, { key: 'package', label: (
套餐包
), onClick: () => { // setCouponModal(true) setPackageModal(true) setPackPage(1); getPickList(1) } }, { key: 'logout', label: (
退出系统
), onClick: () => { reMenuActive() window.location.href = '/copyright/logout' } }, ] return ( <>
{/* AI引擎软著 软件著作权一站式服务平台 */}
{/*
*/}
{/*
{ setPackageModal(true) setPackPage(1); getPickList(1) }} >
套餐包
全托管:100件 写材料:100件
*/} {/*
*/}
{ setkfModal(true) }}>
在线客服
{/*
{ window.open('https://www.aimzhu.com/operator/route/agreementportal/view?agreementId=c0c5683a-bef3-40c3-8395-900a362ea234&title=系统操作流程') }}>
*/} {/*
*/} {/*
*/}
{ setinvitationModal(true) getIc() }}> 邀请码
{ // window.open('https://www.aimzhu.com/operator/route/agreementportal/view?agreementId=c0c5683a-bef3-40c3-8395-900a362ea234&title=系统操作流程') getUseUrl() }}>
{ setNoticeModal(true) }}>
{unRead}
{/**/}
{/* 您好:{globalContext.user.nickname} */} 个人中心
{ if (!globalContext.user.hasUserInfo) { messageApi.info('请完善个人信息'); return; } setIsSelfModalOpen(false) // console.log('用户信息',globalContext.user.hasUserInfo); }}> { modal.confirm({ title: '提示', content: '确定保存吗?', okText: '确认', cancelText: '取消', okButtonProps: { style: { backgroundColor: 'var(--color-primary)' } }, onOk: () => { setIsSelfModalOpen(false); put({ messageApi, url: '/api/user-info/update-self', body: data, onBefore() { setLoading(true); }, onSuccess() { messageApi.success('修改成功'); }, onFinally() { setLoading(false); } }) } }); }} /> { setIsPasswordModalOpen(false) }}> { modal.confirm({ title: '提示', content: '确定修改吗?', okText: '确认', cancelText: '取消', okButtonProps: { style: { backgroundColor: 'var(--color-primary)' } }, onOk: () => { put({ messageApi, url: '/api/user/update-password', body: data, onBefore() { setLoading(true); }, onSuccess() { setIsPasswordModalOpen(false); messageApi.success('修改成功,重新登录生效'); }, onFinally() { setLoading(false); } }) } }); }} /> setIsInvoiceModalOpen(false)} > { upBelongArray() // getNewLength() setBelongModal(false) }}> { setBelongModal(false) }} setBelongPeopleInfo={setBelongPeopleInfo} belongPeopleInfo={belongPeopleInfo} setValue={setValue} isShow={false} > { setContactModal(false) }}> { setContactModal(false) }} setConcatPeopleInfo={setConcatPeopleInfo} concatPeopleInfo={concatPeopleInfo} setConcatValue={setConcatValue}> { setPackageModal(false) setPackPage(1); }}> { setPackPage(page); getPickList(page) // console.log(page); } }} rowKey="packageOrderId" /> { // getNewLength() setinvitationModal(false) // setInvNum('') setInInvNum('') }}>
{/*
我的邀请码
{ getInvNum() }} style={{ display: invNum || icStatus ? 'none' : 'block' }}> 点击申请
正在申请中
申请失败!
{ getInvNum() }}>重新申请
{invNum}
{ copyInvNum() }}> 复制
*/}
{ getMyIcList() setMyInvModal(true) }} style={{ cursor: 'pointer' }}>查看我的邀请码
{ // setCreateInvModal(true) getIcLimit() }} style={{ cursor: 'pointer' }}>创建邀请码
{/*
*/}
{/* {icRebateRatio ? `邀请码分享给他人,即可获得${icRebateRatio}%佣金` : '邀请码分享给他人,即可获得佣金'} */} {icRebateRatio ? (
邀请码分享给他人,即可获得{icRebateRatio}%佣金
{/*
全托管佣金:{icPriceAll}元,写材料佣金:{icPriceMaterial}元
*/}
) : (<>邀请码分享给他人,即可获得佣金)} {/* */}
{/*
失败的原因可能是XXXXXX导致,如有疑问请您咨询客服人员
*/}
{/*
*/}
他人邀请码
{ setInInvNum(e.target.value) }} />
{ postInvNum() }}>
{bindingInvNum}
{/*
{ setRelieveModal(true) }}> 解绑
*/}
{bindingInvNum ? '已绑定邀请码' : '输入他人的邀请码,即可获得相应优惠'}
{/* { setBindingInvNum('') setInInvNum('') setRelieveModal(false) }} onCancel={() => { setRelieveModal(false) }}>
确定解绑当前邀请码吗?
*/} { // setBindingInvNum('') // setInInvNum('') // setRelieveModal(false) // }} width={1500} onCancel={() => { setMyorderModal(false) }}> { setNoticeModal(false) getUnRead() // setUnRead(0) }}> { setkfModal(false) }}>
微信扫码咨询客服
若已登录电脑端, { window.open('https://work.weixin.qq.com/kfid/kfc599f9d40b65ac392') } }>点击联系客服
{/* { // setCouponModal(false) // setUnRead(0) }}> { // setCouponModal(false) }}> */} { setMyInvModal(false) }}>
{ return (
) }, }} /> { setCreateInvModal(false) }}>
* 全托管价格
// label={ //
全托管价格
// } name="icPriceAll" rules={[ { required: true, message: '请输入写全托管价格' }, { validator: (_, value) => { if (value && Number(value) < minAllPrice) { return Promise.reject(new Error(`全托管价格不能小于${minAllPrice}`)); } return Promise.resolve(); }, }, ]} >
* 写材料价格
// label={ //
写材料价格
// } name="icPriceMaterial" rules={[ { required: true, message: '请输入写材料价格' }, { validator: (_, value) => { if (value && Number(value) < minMaterialPrice) { return Promise.reject(new Error(`写材料价格不能小于${minMaterialPrice}`)); } return Promise.resolve(); }, }, ]} >
{ setIcModal(false) }}>
{ setPage(currentPage); getIcUserInfo(selectIc, currentPage) }, showSizeChanger: false, current: page } } bordered key="userInfoId" rowKey="userInfoId" locale={{ emptyText: () => { return (
) }, }} /> {contextHolder} {modalHolder} ) }