head显示套餐包

This commit is contained in:
lyp 2025-03-11 14:06:21 +08:00
parent 45fd7c0e5d
commit 535c7264b3
3 changed files with 200 additions and 123 deletions

View File

@ -5,43 +5,43 @@ import { useEffect, useState, useContext } from "react";
import { Axios, DevUserId } from "../../util/AjaxUtils.ts";
import { EventSourcePolyfill } from 'event-source-polyfill';
import { GlobalContext, GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
// import {
// get,
import {
get,
// } from "../../util/AjaxUtils.ts";
// import { useDispatch } from 'react-redux'
} from "../../util/AjaxUtils.ts";
import { useDispatch } from 'react-redux'
type SseMsg = {
msg: string;
type: string;
}
export default function RechargeHead() {
// const dispath = useDispatch()
const dispath = useDispatch()
const [isPaymentModalOpen, setIsPaymentModalOpen] = useState(false);
const globalContext = useContext(GlobalContext);
const globalDispatchContext = useContext(GlobalDispatchContext);
const [messageApi] = message.useMessage();
// const getMyPackNum = () => {
// get<any>({
// messageApi,
// url: `/api/proj/servicepkg/packageorder/count/self`,
// onBefore() {
const getMyPackNum = () => {
get<any>({
messageApi,
url: `/api/proj/servicepkg/packageorder/count/self`,
onBefore() {
// },
// onSuccess({ data }) {
// dispath({
// type: 'upPackNum',
// val: {
// ALL: data.ALL,
// MATERIAL: data.MATERIAL,
// }
// })
// },
// onFinally() {
},
onSuccess({ data }) {
dispath({
type: 'upPackNum',
val: {
ALL: data.ALL,
MATERIAL: data.MATERIAL,
}
})
},
onFinally() {
// }
// })
// }
}
})
}
// sse
const initSse = () => {
let evtSource;
@ -60,7 +60,7 @@ export default function RechargeHead() {
reloadUser(messageApi, globalDispatchContext).then(() => {
setIsPaymentModalOpen(false);
});
// getMyPackNum()
getMyPackNum()
}
};

View File

@ -1,15 +1,16 @@
import './head.css'
// import { NodeJS } from 'types/node';
import { useDispatch,
// useSelector
} from 'react-redux'
import {
useDispatch,
useSelector
} 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";
} from "antd";
// import type { TableProps, FormProps } from 'antd';
interface DataType {
usericId: string;
@ -112,7 +113,7 @@ 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 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';
@ -127,11 +128,13 @@ import type {
} from 'antd';
// import HeadCouponModal from '../../components/CouponModal/HeadCouponModal.tsx'
export default function Head() {
const [packloading, setPackloading] = useState(false)
const [packList, setPackList] = useState<any[]>([]) //服务包列表
const [packPage, setPackPage] = useState(1) //服务包分页
const [packTotal, setPackTotal] = useState(0) //服务包总数
const [packageType, setPackageType] = useState('')
// 获取我得服务包信息
const getPickList = (page: number) => {
const getPickList = (page: number, packageType: string) => {
get<any>({
messageApi,
@ -140,10 +143,11 @@ export default function Head() {
params: {
page: page,
rows: 10,
packageType: packageType
}
},
onBefore() {
setPackloading(true)
},
onSuccess({ data }) {
@ -152,7 +156,7 @@ export default function Head() {
},
onFinally() {
setPackloading(false)
}
})
}
@ -171,8 +175,51 @@ export default function Head() {
// const [selectIc, setSelectIc] = useState('') //选中的邀请码
// const redxuState: any = useSelector(state => state)
// const packNum = redxuState.packNum
const redxuState: any = useSelector(state => state)
// const [packageType, setPackageType] = useState('')
const packNum = redxuState.packNum
const packItems: MenuProps['items'] = [
{
key: '1',
label: (
<div
onClick={() => {
setPackageModal(true)
setPackPage(1);
getPickList(1, 'ALL')
setPackageType('ALL')
}}
>
<span style={{
fontWeight: 'bold'
}}> : {packNum.ALL}</span>
</div>
),
},
{
key: '2',
label: (
<div
onClick={() => {
setPackageModal(true)
setPackPage(1);
getPickList(1, 'MATERIAL')
setPackageType('MATERIAL')
}}
>
<span style={{
fontWeight: 'bold'
}}> : {packNum.MATERIAL}</span>
</div>
),
},
]
// 消息通知弹窗
const [noticeModal, setNoticeModal] = useState(false)
// 客服弹窗
@ -774,32 +821,32 @@ export default function Head() {
await reloadUser(messageApi, globalDispatchContext);
};
// 我的套餐包统计
// const getMyPackNum = () => {
// get<any>({
// messageApi,
// url: `/api/proj/servicepkg/packageorder/count/self`,
// onBefore() {
const getMyPackNum = () => {
get<any>({
messageApi,
url: `/api/proj/servicepkg/packageorder/count/self`,
onBefore() {
// },
// onSuccess({ data }) {
// // console.log(data);
// dispath({
// type: 'upPackNum',
// val: {
// ALL:data.ALL,
// MATERIAL:data.MATERIAL,
// }
// })
// },
// onFinally() {
},
onSuccess({ data }) {
// console.log(data);
dispath({
type: 'upPackNum',
val: {
ALL: data.ALL,
MATERIAL: data.MATERIAL,
}
})
},
onFinally() {
// }
// })
// }
}
})
}
useEffect(() => {
getUnRead()
setInterval(reloadUserInterval, 5 * 60 * 1000);
// getMyPackNum()
getMyPackNum()
}, [])
@ -905,7 +952,8 @@ export default function Head() {
// setCouponModal(true)
setPackageModal(true)
setPackPage(1);
getPickList(1)
getPickList(1, '')
setPackageType('')
}
},
@ -940,6 +988,32 @@ export default function Head() {
{/* <div className="right" style={{backgroundImage: `url(${headRightBg})`}}> */}
<div className="right">
<div className='kf' onClick={() => {
setkfModal(true)
}}>
<div className='kfIcon'>
<img src={kf} width={20} alt="" />
</div>
<div className='kfText'>
线
</div>
</div>
<div className='headLine'></div>
{/* <div className='head-nav' onClick={() => {
window.open('https://www.aimzhu.com/operator/route/agreementportal/view?agreementId=c0c5683a-bef3-40c3-8395-900a362ea234&title=系统操作流程')
}}>
<QuestionCircleOutlined />
</div> */}
{/* <div className='headLine'></div> */}
<BalanceHead />
{/* <div className='headLine'></div> */}
<RechargeHead />
<div className='headLine'></div>
{/* <div className='kf' onClick={() => {
setPackageModal(true)
setPackPage(1);
@ -964,28 +1038,29 @@ export default function Head() {
</div>
</div>
</div> */}
{/* <div className='headLine'></div> */}
<div className='kf' onClick={() => {
setkfModal(true)
}}>
<div className='kfIcon'>
<img src={kf} width={20} alt="" />
</div>
<div className='kfText'>
线
</div>
</div>
<div className='headLine'></div>
{/* <div className='head-nav' onClick={() => {
window.open('https://www.aimzhu.com/operator/route/agreementportal/view?agreementId=c0c5683a-bef3-40c3-8395-900a362ea234&title=系统操作流程')
}}>
<QuestionCircleOutlined />
</div> */}
{/* <div className='headLine'></div> */}
<BalanceHead />
{/* <div className='headLine'></div> */}
<RechargeHead />
<Dropdown
menu={{ items: packItems }}
>
<div className='kfText' style={{
fontSize: 16,
color: '#FF9F08',
fontWeight: 700,
cursor: 'pointer'
}}
// onClick={() => {
// setPackageModal(true)
// setPackPage(1);
// getPickList(1,packageType)
// }}
></div>
</Dropdown>
<div className='headLine'></div>
<div className='invitationButton' onClick={() => {
setinvitationModal(true)
@ -1013,9 +1088,9 @@ export default function Head() {
{/*<MessageHead/>*/}
<div style={{ display: 'flex', alignContent: 'center', padding: '0', cursor: 'pointer' }}>
<div style={{ width: '50px', height: '50px', borderRadius: '25px', marginLeft: '', marginRight: '10px' }} >
{/* <div style={{ width: '50px', height: '50px', borderRadius: '25px', marginLeft: '', marginRight: '10px' }} >
<img src={userImg} alt="" width={50} height={50} />
</div>
</div> */}
<Dropdown menu={{
items: items
}}>
@ -1161,6 +1236,7 @@ export default function Head() {
setPackageModal(false)
setPackPage(1);
}}>
<Spin tip="加载中..." spinning={packloading} >
<Table
columns={packColumns}
dataSource={packList}
@ -1170,7 +1246,7 @@ export default function Head() {
total: packTotal,
onChange: (page: number) => {
setPackPage(page);
getPickList(page)
getPickList(page, packageType)
// console.log(page);
@ -1178,6 +1254,7 @@ export default function Head() {
}}
rowKey="packageOrderId"
/>
</Spin>
</Modal>
<Modal title="邀请码"
destroyOnClose

View File

@ -44,31 +44,31 @@ interface DataType {
packageOrderId: string;
}
// import { useDispatch } from 'react-redux'
import { useDispatch } from 'react-redux'
export default function ProjNew() {
// const dispath = useDispatch()
const dispath = useDispatch()
// 更新redux的套餐包信息
// const getMyPackNum = () => {
// get<any>({
// messageApi,
// url: `/api/proj/servicepkg/packageorder/count/self`,
// onBefore() {
const getMyPackNum = () => {
get<any>({
messageApi,
url: `/api/proj/servicepkg/packageorder/count/self`,
onBefore() {
// },
// onSuccess({ data }) {
// dispath({
// type: 'upPackNum',
// val: {
// ALL: data.ALL,
// MATERIAL: data.MATERIAL,
// }
// })
// },
// onFinally() {
},
onSuccess({ data }) {
dispath({
type: 'upPackNum',
val: {
ALL: data.ALL,
MATERIAL: data.MATERIAL,
}
})
},
onFinally() {
// }
// })
// }
}
})
}
const [debounceTimer, setDebounceTimer] = useState<any>(null);
// 创建一个 ref 来引用推荐列表容器
const recommendListRef = useRef<HTMLDivElement>(null);
@ -1094,7 +1094,7 @@ export default function ProjNew() {
reloadUser(messageApi, globalDispatchContext).then(() => {
messageApi.success('扣款成功');
});
// getMyPackNum()
getMyPackNum()
},
onFinally() {
setLoading(false);