system-copyright-react/src/route/index/Index.tsx
2024-09-03 17:51:42 +08:00

1442 lines
72 KiB
TypeScript

import './index.css';
// import { MouseEvent, Reducer, useEffect, useReducer, useState, useContext } from "react";
import { MouseEvent, Reducer, useEffect, useReducer, useState } from "react";
import { useSelector, useDispatch } from 'react-redux'
import { useNavigate, useSearchParams, Outlet } from "react-router-dom";
import { Modal } from 'antd';
import { IMenuListItem, IMenuWithTopButton } from "../../interfaces/menu/IMenuWithTopButton.ts";
import MenuWithTopButton from "../../components/menu/MenuWithTopButton.tsx";
import RefunModal from '../../components/RefunModal/RefunModal.tsx'
import CorrectionModal from '../../components/CorrectionModal/CorrectionModal.tsx'
// import MenuWithBottomButtom from '../../components/menu/MenuWithBottomButton.tsx'
// import MenuTreeWithTopButton from "../../components/menu/MenuTreeWithTopButton.tsx";
// import ListProj from "../../components/list/ListProj.tsx";
// import ListProjAgent from "../../components/list/ListProjAgent.tsx";
// import { getMenuActive } from '../../util/cache.ts'
import {
MenuProps, Select,
Button,
Pagination,
Empty
} from 'antd';
import {
IndexListContext,
IndexListDataType,
IndexListDispatchContext,
ListAction,
ListData,
} from "../../context/IndexListContext.ts";
// import { getMenuActive } from '../../util/cache.ts'
import {
MenuFoldOutlined,
ClearOutlined,
CloseOutlined
} from '@ant-design/icons';
import { useLocation } from 'react-router-dom';
import { get } from '../../util/AjaxUtils.ts'
import { setMenuActive } from '../../util/cache.ts'
import gpsImg from '../../static/right/gps.png'
import backImg from '../../static/right/back.png'
// import { Link } from "react-router-dom";
import HeadCouponModal from '../../components/CouponModal/HeadCouponModal.tsx'
import {
Input,
// Breadcrumb,
message
} from 'antd';
const { Search } = Input;
export default function Index() {
// 是否可以点击所属者 (当点击了退款选项,所属者列表跟他不产生联系 不给他点)
// const [clickBelongpeople, setClickBelongpeople] = useState(true)
// 选项数组
const [tagArray, setTagArray] = useState([])
// 获取标签
const getTag = () => {
get({
messageApi,
url: `/api/proj/tag/list-tag`,
onBefore() {
},
onSuccess(data: any) {
// console.log('标签信息', data);
const newarrty: any = (data.data).map((item: any) => ({
value: item.key,
label: item.value
}));
setTagArray(newarrty)
},
onFinally() {
}
})
}
const dispath = useDispatch()
//redux的belongArray
const redxuState: any = useSelector(state => state)
const belongArray = redxuState.belongArray
// 优惠券弹窗
const couponModal = redxuState.couponModal
// 是否有优惠券
const [coupon, setCoupon] = useState(false)
// 编辑项目得项目名
const projName = redxuState.projName
// 项目状态 查看还是编辑
const projStatus = redxuState.projStatus
// 获取所属者表格储存至redux 更新表格
const getProjOwnerList = () => {
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 upBelongArray = () => {
// get({
// messageApi,
// url: `/api/proj-owner/list/self`,
// onBefore() {
// },
// onSuccess(data: any) {
// // console.log('所属者表格', data.data);
// setBelongPeopleArray(data.data)
// },
// onFinally() {
// }
// })
// }
// 监听redux的belongArray
// useEffect(()=>{
// },[belongArray])
const [messageApi, contextHolder] = message.useMessage();
// 临时关键字 (过度)
const [nowKeyword, setNowKeyWord] = useState('')
// 关键字
const [keywords, setKeywords] = useState('');
const [type, setType] = useState<string | null>(null)
const [chargeAdditionals, setchargeAdditionals] = useState<string | null>(null)
const [tagDataId, settagDataId] = useState<string | null>(null)
const [payStatus, setpayStatus] = useState<string | null>(null)
const [authorId, setauthorId] = useState('')
const [applyStatus, setapplyStatus] = useState<string | null>(null)
// 退款关键字
const [refunKeywords, setrefunKeywords] = useState('')
// 退款临时关键字
const [newRefunValue, setnewRefunValue] = useState('')
// const indexListContext = useContext(IndexListContext);
// 所属者信息
// const [belongPeopleArray, setBelongPeopleArray] = useState<any[]>([])
const [currentPage, setCurrentPage] = useState(1);
const itemsPerPage = 5;
// 计算总页数
const totalItems = belongArray.length;
const totalPages = Math.ceil(totalItems / itemsPerPage);
// 计算当前页数据的起始和结束索引
const startIndex = (currentPage - 1) * itemsPerPage;
const endIndex = Math.min(startIndex + itemsPerPage, totalItems);
// 提取当前页的数据
const currentPageData = belongArray.slice(startIndex, endIndex);
// 处理页码切换
const handlePageChange = (page: number) => {
if (page >= 1 && page <= totalPages) {
setCurrentPage(page);
}
};
// // home页初始化搜索条件
const init = () => {
setNowKeyWord('')
setKeywords('')
setType(null)
setchargeAdditionals(null)
settagDataId(null)
setpayStatus(null)
}
// refun页初始化
const refunInit = () => {
setnewRefunValue('')
setrefunKeywords('')
setapplyStatus(null)
}
const nav = useNavigate();
const [searchParams] = useSearchParams();
const listReducer = (state: ListData, action: ListAction) => {
if (action.type == IndexListDataType.PROJ) {
state.type = IndexListDataType.PROJ;
state.status = action.value as string;
} else if (action.type == IndexListDataType.AGENT) {
state.type = IndexListDataType.AGENT;
state.status = action.value as string;
} else if (action.type == IndexListDataType.CATEGORY) {
state.categorys = action.value as MenuProps['items'];
state.categoryChangeCount++;
} else if (action.type == IndexListDataType.CATEGORY_CHANGE) {
state.category = action.value as string;
state.categoryChangeCount++;
} else if (action.type == IndexListDataType.CATEGORY_DELETE) {
state.categorys = action.value as MenuProps['items'];
state.category = '';
state.categoryChangeCount++;
}
return {
...state
};
}
const [listData, dispatch] = useReducer<Reducer<ListData, ListAction>>(listReducer, {
type: IndexListDataType.PROJ,
categoryChangeCount: 0
});
const [projMenu, setProjMenu] = useState<IMenuWithTopButton>({
button: {
name: '项目',
handle() {
dispatch({
type: IndexListDataType.PROJ,
value: 'ALL',
})
init()
setauthorId('')
// nav('/home')
nav('/proj-create')
}
},
list: [
{ id: 'ALL', name: '全部项目', active: true },
{ id: 'PROCESSING', name: '进行中的' },
{ id: 'COMPLETE', name: '已完成的' },
{ id: 'REFUN', name: '退款项目' },
// correction
{ id: 'CORRECTION', name: '补正项目' },
],
handleListItem(_e, _index, item: IMenuListItem) {
projMenu.list.forEach(item => item.active = false);
sellMenu.list.forEach(item => item.active = false);
buyMenu.list.forEach(item => item.active = false);
refundMenu.list.forEach(item => item.active = false);
correctionMenu.list.forEach(item => item.active = false);
item.active = true;
setProjMenu({
...projMenu
})
dispatch({
type: IndexListDataType.PROJ,
value: item.id,
// keywords: ''
})
},
});
const [refunModal, setRefunModal] = useState(false) //退款弹窗
const [refundMenu, setRefundMenu] = useState<IMenuWithTopButton>({
button: {
name: '',
handle() {
// nav('/proj-create')
}
},
list: [
{ id: 'PENDING', name: '待审核', },
{ id: 'APPROVED', name: '已通过' },
{ id: 'REJECTED', name: '未通过' },
{ id: 'CANCELED', name: '已取消' }
],
handleListItem(_e, _index, item: IMenuListItem) {
projMenu.list.forEach(item => item.active = false);
sellMenu.list.forEach(item => item.active = false);
buyMenu.list.forEach(item => item.active = false);
refundMenu.list.forEach(item => item.active = false);
correctionMenu.list.forEach(item => item.active = false);
item.active = true;
setRefundMenu({
...refundMenu
})
dispatch({
type: IndexListDataType.PROJ,
value: item.id,
// keywords: ''
})
},
});
// 补正弹窗
const [correctionModal, setCorrectionModal] = useState(false)
const [correctionMenu, setCorrectionMenu] = useState<IMenuWithTopButton>({
button: {
name: '补正',
handle() {
// nav('/proj-create')
setCorrectionModal(true)
}
},
list: [
{ id: 'Correction-PENDING', name: '待审核', },
{ id: 'Correction-APPROVED', name: '已通过' },
{ id: 'Correction-REJECTED', name: '未通过' },
{ id: 'Correction-CANCELED', name: '已取消' }
],
handleListItem(_e, _index, item: IMenuListItem) {
projMenu.list.forEach(item => item.active = false);
sellMenu.list.forEach(item => item.active = false);
buyMenu.list.forEach(item => item.active = false);
refundMenu.list.forEach(item => item.active = false);
correctionMenu.list.forEach(item => item.active = false);
item.active = true;
setCorrectionMenu({
...correctionMenu
})
dispatch({
type: IndexListDataType.PROJ,
value: item.id,
// keywords: ''
})
},
})
// const [agentMenu, setAgentMenu] = useState<IMenuWithTopButton>({
// button: {
// name: '代理服务',
// handle() {
// dispatch({
// type: IndexListDataType.PROJ,
// value: 'COMPLETE',
// })
// }
// },
// list: [
// { id: 'ALL', name: '全部项目' },
// { id: 'PROCESSING', name: '进行中的' },
// { id: 'COMPLETE', name: '已完成的' },
// ],
// handleListItem(_e: MouseEvent<HTMLLIElement>, _index: number, item: IMenuListItem) {
// projMenu.list.forEach(item => item.active = false);
// agentMenu.list.forEach(item => item.active = false);
// item.active = true;
// setAgentMenu({
// ...agentMenu
// })
// dispatch({
// type: IndexListDataType.AGENT,
// value: item.id,
// })
// }
// })
const [sellMenu, setSellMenu] = useState<IMenuWithTopButton>({
button: {
name: '我要卖',
handle() {
// dispatch({
// type: IndexListDataType.PROJ,
// value: 'COMPLETE',
// })
}
},
list: [
{ id: '1', name: '商品发布', path: '/product-release' },
{ id: '2', name: '交易订单', path: '/transaction-order' },
// { id: 'COMPLETE', name: '已完成的' },
],
handleListItem(_e: MouseEvent<HTMLLIElement>, _index: number, item: IMenuListItem) {
projMenu.list.forEach(item => item.active = false);
sellMenu.list.forEach(item => item.active = false);
buyMenu.list.forEach(item => item.active = false);
refundMenu.list.forEach(item => item.active = false);
correctionMenu.list.forEach(item => item.active = false);
item.active = true;
setSellMenu({
...sellMenu
})
// dispatch({
// type: IndexListDataType.AGENT,
// value: item.id,
// })
}
})
const [buyMenu, setBuyMenu] = useState<IMenuWithTopButton>({
button: {
name: '我要买',
handle() {
// dispatch({
// type: IndexListDataType.PROJ,
// value: 'COMPLETE',
// })
}
},
list: [
{ id: '1', name: '著作权商品', path: '/copyright-goods' },
{ id: '2', name: '交易商品', path: '/trading-goods' },
// { id: 'COMPLETE', name: '已完成的' },
],
handleListItem(_e: MouseEvent<HTMLLIElement>, _index: number, item: IMenuListItem) {
projMenu.list.forEach(item => item.active = false);
sellMenu.list.forEach(item => item.active = false);
buyMenu.list.forEach(item => item.active = false);
refundMenu.list.forEach(item => item.active = false);
correctionMenu.list.forEach(item => item.active = false);
item.active = true;
setBuyMenu({
...buyMenu
})
// dispatch({
// type: IndexListDataType.AGENT,
// value: item.id,
// })
}
})
// const [refund, setRefund] = useState<IMenuWithTopButton>({
// button: {
// name: '退款',
// handle() {
// // dispatch({
// // type: IndexListDataType.PROJ,
// // value: 'COMPLETE',
// // })
// }
// },
// list: [
// { id: '1', name: '待审核', path: '/copyright-goods?item=1' },
// { id: '2', name: '已通过', path: '/copyright-goods?item=2' },
// { id: '3', name: '未通过', path: '/copyright-goods?item=3' },
// // { id: 'COMPLETE', name: '已完成的' },
// ],
// handleListItem(_e: MouseEvent<HTMLLIElement>, _index: number, item: IMenuListItem) {
// projMenu.list.forEach(item => item.active = false);
// // sellMenu.list.forEach(item => item.active = false);
// // buyMenu.list.forEach(item => item.active = false);
// item.active = true;
// setRefund({
// ...refund
// })
// // dispatch({
// // type: IndexListDataType.AGENT,
// // value: item.id,
// // })
// }
// })
const location = useLocation()
const [now, setNow] = useState<string>('首页-项目')
// 编辑项目路由名
// const [editname,setEditname] = useState('')
// 新建项目路由名字
// const [newname,setNewname] = useState('')
// const [pathArray, setPathArray] = useState<any>([])
const [showSearchBox, setShowSearchBox] = useState(true)
const [refunSearchBox, setRrefunSearchBox] = useState(false)
const [correctionSearchBox, setCorrectionSearchBox] = useState(false)
useEffect(() => {
// const nowname = sessionStorage.getItem('now')
if (location.pathname == '/') {
setCoupon(true)
}
if (location.pathname.includes('/home')) {
setCoupon(true)
setNow('首页-项目')
// setPathArray([{ title: '首页' }])
setShowSearchBox(true)
// setClickBelongpeople(true)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
} else if (location.pathname.includes('/proj-create')) {
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
setNow('创建项目')
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: '创建项目' }])
// /config-mod-list /config-menu-list /config-mod-show
} else if (location.pathname.includes('/proj-edit') && !location.pathname.includes('/config-mod-show') && !location.pathname.includes('/config-mod-edit') && !location.pathname.includes('/step') && !location.pathname.includes('/config-loginpage') && !location.pathname.includes('/config-mod-save') && !location.pathname.includes('/config-mod-list') && !location.pathname.includes('/config-menu-list')) {
setNow(`${projStatus}项目-${projName}`)
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setEditname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: '编辑项目' }])
} else if (location.pathname.includes('/proj-new')) {
setNow(`创建项目`)
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: '新建项目' }])
} else if (location.pathname.includes('/proj-efree')) {
setNow(`${projStatus}项目-${projName}`)
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: '编辑项目' }])
} else if (location.pathname.includes('/proj-eall')) {
setNow(`${projStatus}项目-${projName}`)
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页 </Link> }, { title: '编辑项目' }])
} else if (location.pathname.includes('/proj-edit/step1')) {
setNow('标题简介')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '标题简介' }])
} else if (location.pathname.includes('/proj-edit/step2')) {
setNow('标题简介')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '基本信息' }])
} else if (location.pathname.includes('/proj-edit/config-loginpage')) {
setNow('登录界面设置')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '登录界面设置' }])
} else if (location.pathname.includes('/proj-edit/config-mod-list')) {
setNow('系统菜单管理')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '系统菜单管理' }])
} else if (location.pathname.includes('/proj-edit/config-menu-list')) {
setNow('系统菜单顺序')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '系统菜单顺序' }])
} else if (location.pathname.includes('/step3')) {
setNow('软件功能特点')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '软件功能特点' }])
} else if (location.pathname.includes('/proj-edit/config-mod-save')) {
setNow('添加菜单')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '添加菜单' }])
} else if (location.pathname.includes('/proj-edit/config-mod-edit')) {
setNow('编辑菜单')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-2) }}>编辑项目</a> }, { title: <a onClick={() => { nav(-1) }}>系统菜单管理</a> }, { title: '编辑菜单' }])
// /config-mod-edit /config-mod-show
} else if (location.pathname.includes('/proj-edit/config-mod-show')) {
setNow('查看菜单')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-2) }}>编辑项目</a> }, { title: <a onClick={() => { nav(-1) }}>系统菜单管理</a> }, { title: '查看菜单' }])
// /config-mod-edit
} else if (location.pathname.includes('/product-release')) {
setNow('首页')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setPathArray([{ title: '首页' }])
// /config-mod-edit /product-release /transaction-order
} else if (location.pathname.includes(' /transaction-order')) {
setNow('首页')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setPathArray([{ title: '首页' }])
// /config-mod-edit /product-release /transaction-order
} else if (location.pathname.includes(' /copyright-goods')) {
setNow('首页')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setPathArray([{ title: '首页' }])
// /config-mod-edit /product-release /transaction-order
} else if (location.pathname.includes(' /trading-goods')) {
setNow('首页')
setShowSearchBox(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(false)
// setPathArray([{ title: '首页' }])
// /config-mod-edit /product-release /transaction-order
} else if (location.pathname.includes('/refun')) {
setShowSearchBox(false)
setNow('首页-退款')
// setClickBelongpeople(false)
setRrefunSearchBox(true)
setCorrectionSearchBox(false)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '软件功能特点' }])
} else if (location.pathname.includes('/correction')) {
setShowSearchBox(false)
setNow('首页-补正')
// setClickBelongpeople(false)
setRrefunSearchBox(false)
setCorrectionSearchBox(true)
// setNewname(location.pathname)
// setPathArray([{ title: <Link to={'/home'}>首页</Link> }, { title: <Link to={'/proj-create'}>创建项目</Link> }, { title: <a onClick={() => { nav(-1) }}>编辑项目</a> }, { title: '软件功能特点' }])
}
}, [location.pathname])
useEffect(() => {
// nav('/home')
// sessionStorage.setItem('pathArray', JSON.stringify([{ title: <Link to={'/home'}>首页</Link> }]));
// sessionStorage.setItem('now', '首页');
if (searchParams.get('type') == 'agent') {
dispatch({
type: IndexListDataType.AGENT,
value: 'ALL',
})
}
getProjOwnerList()
getTag()
}, []);
useEffect(() => {
if (location.pathname.includes('/home')) {
nav('/home', {
state: {
keyword: keywords,
type: type,
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId,
payStatus: payStatus
}
})
}
if (location.pathname.includes('/refun')) {
nav('/refun', {
state: {
keywords: refunKeywords,
applyStatus: applyStatus,
authorId: authorId
}
})
}
}, [type, chargeAdditionals, keywords, tagDataId,payStatus, authorId, refunKeywords, applyStatus]);
// const [menuName,setMenuName] = useState<string | null>('')
// useEffect(()=>{
// setMenuName( getMenuActive())
// },[getMenuActive()])
const handleSearch = (value: string) => {
// console.log(value);
setKeywords(value)
nav('/home', {
state: {
keyword: value,
type: type,
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId,
payStatus: payStatus
}
})
}
const handleChange = (e: any) => {
setNowKeyWord(e.target.value)
// console.log(e.target.value);
if (e.target.value == '') {
setKeywords('')
nav('/home', {
state: {
keyword: '',
type: type,
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId,
payStatus: payStatus
}
})
}
}
// 退款状态
// 退款关键字搜索
const refunhandleSearch = (value: string) => {
// console.log(value);
setrefunKeywords(value)
nav('/refun', {
state: {
keywords: value,
applyStatus: applyStatus,
authorId: authorId
}
})
}
const refunhandleChange = (e: any) => {
setnewRefunValue(e.target.value)
// console.log(e.target.value);
if (e.target.value == '') {
setrefunKeywords('')
nav('/refun', {
state: {
keywords: '',
applyStatus: applyStatus,
authorId: authorId
}
})
}
}
return (
<>
{/* <Breadcrumb
items={[
{title: <Link to={'/'}>首页</Link>}
]}
/> */}
{contextHolder}
<IndexListContext.Provider value={listData} >
<IndexListDispatchContext.Provider value={dispatch}>
<div className="index">
<div className='coupon-mask'></div>
<div className='leftbox'>
{/* <div style={{display:'flex'}}> */}
{/* <div style={{height:1000,width:6,background:'red',marginRight:-6,zIndex:99}}></div> */}
<div className="left" >
<div style={{ height: '15px', width: '230px', background: 'white' }}></div>
<MenuWithTopButton
button={projMenu.button}
list={projMenu.list}
handleListItem={projMenu.handleListItem}
keywords={keywords}
refunKeywords={refunKeywords}
applyStatus={applyStatus ? applyStatus : ''}
type={type ? type : ""}
chargeAdditionals={chargeAdditionals ? chargeAdditionals : ""}
tagDataId={tagDataId ? tagDataId : ""}
authorId={authorId ? authorId : ""}
payStatus={payStatus?payStatus:''}
// enableBelongpeople = {()=>{setClickBelongpeople(true)}}
/>
<div className='belongPeopleMenu'>
<div className='belongPeopleMenu-title'>
<MenuFoldOutlined style={{ marginLeft: 10, marginRight: 10 }} />
</div>
<div style={{ display: belongArray.length > 0 ? 'block' : 'none' }}>
<div className='belongPeopleMenu-box'>
{
currentPageData.map((item: any) => {
return (
<div className='belongpeopleName' key={item.projOwnerId} onClick={() => {
// const isHome = getMenuActive() == 'ALL' || getMenuActive() == 'PROCESSING' || getMenuActive() == 'COMPLETE'
if (authorId == item.projOwnerId) {
setauthorId('')
// if (isHome) {
// nav('/home', {
// state: {
// keyword: keywords,
// type: type,
// chargeAdditionals: chargeAdditionals,
// tagDataId: tagDataId,
// authorId: '',
// payStatus: payStatus
// }
// })
// }
// if (getMenuActive() == 'REFUN') {
// nav('/refun', {
// state: {
// state: {
// keywords: refunKeywords,
// applyStatus: applyStatus,
// authorId: '',
// }
// }
// })
// }
} else {
setauthorId(item.projOwnerId)
// if (isHome) {
// nav('/home', {
// state: {
// keyword: keywords,
// type: type,
// chargeAdditionals: chargeAdditionals,
// tagDataId: tagDataId,
// authorId: item.projOwnerId,
// payStatus: payStatus
// }
// })
// }
// if (getMenuActive() == 'REFUN') {
// nav('/refun', {
// state: {
// state: {
// keywords: refunKeywords,
// applyStatus: applyStatus,
// authorId: item.projOwnerId,
// }
// }
// })
// }
}
// alert(getMenuActive())
// const menuName = (getMenuActive())
// // const menuTrue = menuName == 'ALL' || 'PROCESSING' || 'COMPLETE'
// if(menuName == 'ALL' || 'PROCESSING' ||'COMPLETE' ){
// alert(1)
// }else{
// alert(2)
// }
}}
style={{ background: authorId == item.projOwnerId ? '#FF9F08' : '', color: authorId == item.projOwnerId ? '#FFF' : '' }}
title={item.name} // 添加 title 属性以显示完整文本
>
{item.name}
</div>
)
})
}
</div>
{/* 分页控件 */}
{/* <div className='pagination-controls'>
<Button
type="primary"
onClick={() => handlePageChange(currentPage - 1)}
disabled={currentPage === 1}
>
上一页
</Button>
<Button
type="primary"
onClick={() => handlePageChange(currentPage + 1)}
disabled={currentPage === totalPages}
style={{ marginLeft: 10 }}
>
下一页
</Button>
</div> */}
<div className='belong-pagination'>
<Pagination
showSizeChanger={false}
current={currentPage}
total={totalItems}
pageSize={itemsPerPage}
onChange={handlePageChange} // 页码改变时的回调
className="custom-pagination"
/>
</div>
</div>
<div style={{ display: belongArray.length > 0 ? 'none' : 'block', height: 230 }}>
<div style={{ width: 230, height: 230, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<Empty
description="暂无数据"
/>
</div>
</div>
</div>
{/* <MenuTreeWithTopButton /> */}
{/* <MenuWithBottomButtom
button={agentMenu.button}
list={agentMenu.list}
handleListItem={agentMenu.handleListItem}
/> */}
{/* <MenuWithBottomButtom
button={sellMenu.button}
list={sellMenu.list}
handleListItem={sellMenu.handleListItem}
/>
<MenuWithBottomButtom
button={buyMenu.button}
list={buyMenu.list}
handleListItem={buyMenu.handleListItem}
/> */}
{/* <MenuWithTopButton
button={refundMenu.button}
list={refundMenu.list}
handleListItem={refundMenu.handleListItem}
/> */}
{/* <MenuWithTopButton
button={correctionMenu.button}
list={correctionMenu.list}
handleListItem={correctionMenu.handleListItem}
/> */}
</div>
{/* </div> */}
</div>
<div className="right">
<div>
<div className="top">
{/* 标签 */}
{/* {renderStatus()} */}
<div className='gps'>
<img src={gpsImg} alt="" />
<div>:{now}</div>
</div>
<div style={{ display: showSearchBox ? 'block' : 'none' }}>
<div style={{
display: 'flex',
alignItems: 'center'
}}>
<div className='line' style={{
display: showSearchBox ? 'block' : 'none',
}} ></div>
<div
style={{
width: 1,
height: 23,
marginLeft: 33,
marginRight: 31,
display: showSearchBox ? 'none' : 'block'
}}
></div>
<Search placeholder="输入项目名称"
value={nowKeyword}
onSearch={handleSearch}
onChange={handleChange}
style={{
width: '200px',
height: '31px',
display: showSearchBox ? 'block' : 'none'
}}
allowClear
/>
<Select
value={type}
allowClear
style={{ height: '31px', width: '130px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }}
onChange={(value: string) => {
setType(value)
nav('/home', {
state: {
keyword: keywords,
type: value,
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId,
payStatus: payStatus
}
})
}}
options={[
{ value: 'FREE', label: '免费试用' },
{ value: 'MATERIAL', label: '写材料' },
{ value: 'ALL', label: '全托管' },
]}
placeholder='选择类型'
/>
<Select
allowClear
value={chargeAdditionals}
style={{ height: '31px', width: '130px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }}
onChange={(value: string) => {
// console.log(`selected ${value}`);
setchargeAdditionals(value)
// alert(`selected ${value}`)
// lyp
nav('/home', {
state: {
keyword: keywords,
type: type,
chargeAdditionals: value,
tagDataId: tagDataId,
authorId: authorId,
payStatus: payStatus
}
})
}}
options={[
// { value: '', label: '全部项目' },
{ value: 'PKG', label: '安装包' },
{ value: 'VIDEO_DEMO', label: '演示视频' },
{ value: 'URGENT', label: '加急' },
]}
// defaultValue=""
placeholder={'选择拓展收费'}
/>
<Select
allowClear
value={tagDataId}
style={{ height: '31px', width: '130px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }}
onChange={(value: string) => {
// console.log(`selected ${value}`);
settagDataId(value)
// alert(`selected ${value}`)
// lyp
nav('/home', {
state: {
keyword: keywords,
type: type,
chargeAdditionals: chargeAdditionals,
tagDataId: value,
authorId: authorId,
payStatus: payStatus
}
})
}}
options={
// [
// { value: 'PRODUCTION', label: '正在制作中' },
// { value: 'SUBMIT_FOR_REVIEW', label: '已提交版权中心' },
// { value: 'DONE', label: '已下证' },
// ]
tagArray
}
placeholder={'选择标签'}
/>
<Select
allowClear
value={payStatus}
style={{ height: '31px', width: '130px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }}
onChange={(value: string) => {
setpayStatus(value)
nav('/home', {
state: {
keyword: keywords,
type: type,
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId,
payStatus: value
}
})
}}
options={[
{ value: 'UNPAID', label: '未付款' },
{ value: 'PAID', label: '已付款' },
{ value: 'ARREARS', label: '欠费' },
{ value: 'FULL_REFUND', label: '全额退费' },
{ value: 'CORRECTION1_REFUND', label: '补正1次退款' },
{ value: 'CORRECTION2_REFUND', label: '补正2次退款' },
]}
placeholder={'选择付款类型'}
/>
<Button onClick={() => {
init()
}} style={{ marginLeft: 10, display: showSearchBox ? 'block' : 'none', height: 31 }}
// type="primary"
icon={<ClearOutlined />}>
</Button>
</div>
</div>
<div style={{ display: refunSearchBox ? 'block' : 'none' }}>
<div style={{
display: 'flex',
alignItems: 'center'
}}>
<div className='line' style={{
}} ></div>
<Button type="primary" onClick={() => {
setRefunModal(true)
}}>
退
</Button>
<Search placeholder="输入项目名称"
value={newRefunValue}
onSearch={refunhandleSearch}
onChange={refunhandleChange}
style={{
width: '200px',
height: '31px',
marginLeft: 10
}}
allowClear
/>
<Select
value={applyStatus}
style={{ height: '31px', width: '150px', marginLeft: 10 }}
onChange={(value: string) => {
setapplyStatus(value)
nav('/refun', {
state: {
keywords: refunKeywords,
applyStatus: value,
authorId: authorId
}
})
}}
options={[
// { value: '', label: '全部项目' },
{ value: 'PENDING', label: '待审核' },
{ value: 'APPROVED', label: '已通过' },
{ value: 'REJECTED', label: '未通过' },
{ value: 'CANCELED', label: '已取消' },
]}
// defaultValue=""
placeholder={'选择状态'}
allowClear
/>
<Button onClick={() => {
refunInit()
}} style={{ marginLeft: 10, height: 31 }}
// type="primary"
icon={<ClearOutlined />}>
</Button>
</div>
</div>
<div style={{ display: correctionSearchBox ? 'block' : 'none' }}>
<div style={{
display: 'flex',
alignItems: 'center'
}}>
<div className='line' style={{
}} ></div>
<Button type="primary" onClick={() => {
setCorrectionModal(true)
}}>
</Button>
<Search placeholder="输入项目名称"
value={newRefunValue}
onSearch={refunhandleSearch}
onChange={refunhandleChange}
style={{
width: '200px',
height: '31px',
marginLeft: 10
}}
allowClear
/>
<Select
// value={numtype}
style={{ height: '31px', width: '150px', marginLeft: 10 }}
onChange={(value: string) => {
// setnumtype(value)
}}
options={[
// { value: '', label: '全部项目' },
{ value: 'CORRECTION1', label: '一次补正' },
{ value: 'CORRECTION2', label: '二次补正' },
]}
// defaultValue=""
placeholder={'选择类型'}
allowClear
/>
<Select
style={{ height: '31px', width: '150px', marginLeft: 10 }}
// value={correctionType}
onChange={(value: string) => {
// setcorrectionType(value)
}}
allowClear
options={[
// { value: '', label: '全部项目' },
{ value: 'CODE', label: '代码' },
{ value: 'MANUAL', label: '操作手册' },
{ value: 'ALL', label: '全部补正' },
]}
// defaultValue=""
placeholder={'选择补正种类'}
/>
<Select
value={applyStatus}
style={{ height: '31px', width: '150px', marginLeft: 10 }}
onChange={(value: string) => {
setapplyStatus(value)
nav('/refun', {
state: {
keywords: refunKeywords,
applyStatus: value,
authorId: authorId
}
})
}}
options={[
// { value: '', label: '全部项目' },
{ value: 'PENDING', label: '待审核' },
{ value: 'APPROVED', label: '已通过' },
{ value: 'REJECTED', label: '未通过' },
{ value: 'CANCELED', label: '已取消' },
]}
// defaultValue=""
placeholder={'选择状态'}
allowClear
/>
<Button onClick={() => {
refunInit()
}} style={{ marginLeft: 10, height: 31 }}
// type="primary"
icon={<ClearOutlined />}>
</Button>
</div>
</div>
<div style={{
width: '253px',
height: '31px',
display: showSearchBox || refunSearchBox || correctionSearchBox ? 'none' : 'block'
}}></div>
<div className='nowPosition'>
<img src={backImg} alt="" />
<div style={{ display: now == '首页-项目' || now == '首页-退款' || now == '首页-补正' ? 'block' : 'none' }}>
{/* <Breadcrumb
separator="|"
// items={[
// { title: <Link to={'/home'}>首页</Link> },
// ]}
items={pathArray}
/> */}
<span></span>
</div>
<div style={{ display: now == '创建项目' ? 'block' : 'none' }}>
{/* <Breadcrumb
separator="|"
// items={[
// { title: <Link to={'/home'}>首页</Link> },
// ]}
items={pathArray}
/> */}
<span style={{ cursor: 'pointer' }}
onClick={() => {
nav('/home', {
state: {
keyword: keywords,
type: type,
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId,
payStatus: payStatus
}
})
}}
></span>
<span style={{ marginLeft: 10, marginRight: 10 }}>|</span>
<span></span>
</div>
<div style={{ display: now.includes('项目-') ? 'block' : 'none' }}>
{/* <Breadcrumb
separator="|"
// items={[
// { title: <Link to={'/home'}>首页</Link> },
// ]}
items={pathArray}
/> */}
<span style={{ cursor: 'pointer' }}
onClick={() => {
nav('/home', {
state: {
keyword: keywords,
type: type,
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId,
payStatus: payStatus
}
})
}}
></span>
<span style={{ marginLeft: 10, marginRight: 10 }}>|</span>
<span>{projStatus}</span>
</div>
<div style={{ display: now == '新建项目' ? 'block' : 'none' }}>
{/* <Breadcrumb
separator="|"
// items={[
// { title: <Link to={'/home'}>首页</Link> },
// ]}
items={pathArray}
/> */}
<span style={{ cursor: 'pointer' }}
onClick={() => {
nav('/home', {
state: {
keyword: keywords,
type: type,
chargeAdditionals: chargeAdditionals,
tagDataId: tagDataId,
authorId: authorId,
payStatus: payStatus
}
})
}}
></span>
<span style={{ marginLeft: 10, marginRight: 10 }}>|</span>
<span></span>
</div>
</div>
</div>
</div>
{/* {
listData.type === IndexListDataType.PROJ ? <ListProj/> : (
listData.type == IndexListDataType.AGENT ? <ListProjAgent/> : <></>
)
} */}
<div>
<Outlet></Outlet>
</div>
</div>
</div>
</IndexListDispatchContext.Provider>
</IndexListContext.Provider>
<Modal
title="申请退款"
destroyOnClose={true}
open={refunModal}
footer={null}
onCancel={() => {
setRefunModal(false)
}}
okButtonProps={{ style: { background: 'red', color: 'white' } }}
width={592}
>
<RefunModal closeModal={() => { setRefunModal(false) }}></RefunModal>
</Modal>
<Modal
title="申请补正"
destroyOnClose={true}
open={correctionModal}
footer={null}
onCancel={() => {
setCorrectionModal(false)
}}
okButtonProps={{ style: { background: 'red', color: 'white' } }}
width={592}
>
<CorrectionModal closeModal={() => { setCorrectionModal(false) }}></CorrectionModal>
</Modal>
<Modal title="优惠券"
footer={null}
destroyOnClose
open={couponModal}
width={809}
onCancel={() => {
// setCouponModal(false)
// setUnRead(0)
dispath({
type: 'changeCouponModal',
val: false
})
}}>
<HeadCouponModal closeModal={() => {
// setCouponModal(false)
dispath({
type: 'changeCouponModal',
val: false
})
nav('/proj-create')
setMenuActive('ALL')
}}></HeadCouponModal>
</Modal>
{/* <Modal title="优惠券"
footer={null}
destroyOnClose
open={true}
width={809}
onCancel={() => {
// setCouponModal(false)
// setUnRead(0)
}}>
嘻嘻嘻
</Modal> */}
<div className='couponMask-box' style={{ display: coupon && (location.pathname == '/' || location.pathname.includes('/home')) ? 'unset' : 'none' }}>
<div className='couponMask'>
<div className='couponMask-img'>
<img src={gpsImg} alt="" width={'100%'} height={'100%'} onClick={() => {
setCoupon(false)
setMenuActive('ALL')
nav('/proj-create')
}} />
</div>
<div className='couponMask-close' onClick={() => {
setCoupon(false)
}}>
<CloseOutlined />
</div>
</div>
</div>
</>
)
}