Commit 45f32bf9 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents 5a2043bf 92abd711
......@@ -17,17 +17,17 @@
"build:dev": "pm2 start scripts/devServer.js",
"build:analyze": "ANALYZE=1 umi build",
"build:clean": "umi build",
"build:scm": "cross-env SITE_ID=1 BACK_GATEWAY=http://lingxi-scm.wg.shushangyun.com yarn build",
"build:10": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.10:8100 yarn build",
"build:25": "cross-env SITE_ID=352 BACK_GATEWAY=http://10.0.0.25:8100 yarn build",
"build:scm": "cross-env SITE_ID=1 BACK_GATEWAY=http://lingxi-scm.wg.shushangyun.com SOCKET_URL=ws://lingxi-scm.wg.shushangyun.com yarn build",
"build:10": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.10:8100 SOCKET_URL=ws://10.0.0.10 yarn build",
"build:25": "cross-env SITE_ID=352 BACK_GATEWAY=http://10.0.0.25:8100 SOCKET_URL=ws://10.0.0.25 yarn build",
"postinstall": "umi generate tmp",
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
"test": "umi-test",
"test:coverage": "umi-test --coverage",
"start:cross": "cross-env SITE_ID=352 SOCKET_URL=ws://10.0.0.25:8100 yarn start",
"start:cross-dev": "cross-env SITE_ID=352 SOCKET_URL=ws://10.0.0.25:8100 yarn start",
"start:10": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.10:8100 yarn start",
"start:scm": "cross-env BACK_GATEWAY=http://lingxi-scm.wg.shushangyun.com SITE_ID=1 yarn start"
"start:cross": "cross-env SITE_ID=352 SOCKET_URL=ws://10.0.0.25 yarn start",
"start:cross-dev": "cross-env SITE_ID=352 SOCKET_URL=ws://10.0.0.25 yarn start:dev",
"start:10": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.10:8100 SOCKET_URL=ws://10.0.0.10 yarn start",
"start:scm": "cross-env BACK_GATEWAY=http://lingxi-scm.wg.shushangyun.com SOCKET_URL=ws://lingxi-scm.wg.shushangyun.com SITE_ID=1 yarn start"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
......
export const NOT_CHANGE_VALUE = 'hello, world'
// socket的链接地址, 默认会使用后端接口网关地址
export const SOCKET_URL = process.env.SOCKET_URL || process.env.BACK_GATEWAY?.replace('http', 'ws') || "ws://10.0.0.25:9400"
export const SOCKET_URL = process.env.SOCKET_URL?.replace('http|https', 'ws') || process.env.BACK_GATEWAY?.replace('http|https', 'ws')
// 会员角色类型
export const MEMBER_ROLE_LISTS = [
......@@ -615,7 +615,7 @@ export const SaleOrderInsideWorkStateTexts = {
8: '提交二级审核订单不通过',
9: '不接受订单',
10: '待确认支付结果',
16: '支付结果确认到账',
17: '支付结果没到账',
18: '发货单创建',
......@@ -651,4 +651,4 @@ export const InquiryStateTexts = {
2: '待确认',
3: '接受报价',
4: '不接受报价',
}
\ No newline at end of file
}
import React, { useState, useEffect, useRef, useCallback, useLayoutEffect } from 'react'
import { Link, history } from 'umi'
import { Menu, Dropdown, List, Avatar, Skeleton} from 'antd'
import { Menu, Dropdown, List, Avatar, Skeleton, Badge} from 'antd'
import { BellOutlined, CaretDownOutlined } from '@ant-design/icons'
import styles from './index.less'
import { removeAuth, getAuth } from '@/utils/auth'
......@@ -8,10 +8,12 @@ import { PublicApi } from '@/services/api';
import moment from 'moment';
import msg_system from '@/asserts/msg_system.png'
import msg_platform from '@/asserts/msg_platform.png'
import { SOCKET_URL } from '@/constants';
const RightContent: React.FC<{}> = (props) => {
const [visible, setVisible] = useState(false);
const [messageData, setMessageData] = useState<any[]>([]);
const [unreadMsg, setUnReadMsg] = useState<number>(0);
const [loading, setLoading] = useState(true);
const ws = useRef<WebSocket | null>(null);
......@@ -47,17 +49,22 @@ const RightContent: React.FC<{}> = (props) => {
const webSocketInit = useCallback(() => {
console.log(ws.current)
if (!ws.current || ws.current.readyState === 3) {
ws.current = new WebSocket(`ws://10.0.0.25:8100/report/websocket?memberId=${userInfo.memberId}&roleId=${userInfo.memberRoleId}`);
if (SOCKET_URL && /ws\:\/\//.test(SOCKET_URL) && (!ws.current || ws.current.readyState === 3) && userInfo) {
// ws://10.0.0.25:8100
const url = `${SOCKET_URL}/report/websocket?memberId=${userInfo.memberId}&roleId=${userInfo.roleId}&token=${userInfo.token}&source=${99}`
ws.current = new WebSocket(url);
ws.current.onopen = (e) => {
console.log(e)
}
ws.current.onmessage = (e) => {
console.log(e)
if(e.data.type === 1) {
setUnReadMsg(e.data.data)
}
};
ws.current.onclose = (e) => {
console.log("关闭连接")
}
}
ws.current.onerror = (e) => {
console.log("socket 出错")
}
......@@ -65,7 +72,7 @@ const RightContent: React.FC<{}> = (props) => {
}, [ws]);
useLayoutEffect(() => {
// webSocketInit();
webSocketInit();
return () => {
ws.current?.close();
};
......@@ -76,6 +83,7 @@ const RightContent: React.FC<{}> = (props) => {
<div className={styles.header}>消息列表</div>
<List
itemLayout="horizontal"
loading={loading}
dataSource={messageData}
footer={
<a className={styles.messageFooter} href="/message/messageList">
......@@ -85,17 +93,17 @@ const RightContent: React.FC<{}> = (props) => {
renderItem={(item:any) => {
return (
<List.Item>
<Skeleton paragraph={{ rows: 1 }} loading={loading} active avatar>
{/* <Skeleton paragraph={{ rows: 1 }} loading={loading} active avatar> */}
<div className={styles.msgContainer}>
<div className={styles.msgItemIcon}>
<Avatar src={item.type == 1 ? msg_system : msg_platform} />
</div>
<div>
<div className={styles.msgTitle}>{item.title}</div>
<div className={styles.msgTime}>{moment(item.sendTime).format('YYYY-MM-DD HH:mm:ss')}</div>
<div className={styles.msgTitle}>{item.title}</div>
<div className={styles.msgTime}>{moment(item.sendTime).format('YYYY-MM-DD HH:mm:ss')}</div>
</div>
</div>
</Skeleton>
{/* </Skeleton> */}
</List.Item>
)
}}
......@@ -103,28 +111,28 @@ const RightContent: React.FC<{}> = (props) => {
</div>
)
return <div className={styles.lxLayoutRight}>
<Link to="/home" className={styles.lxLink}>返回首页</Link>
<Dropdown overlay={menuMessage} trigger={['click']} visible={visible}>
<a
href=""
rel="noopener noreferrer"
className={styles.topMessage}
>
<BellOutlined onClick={() => setVisible(!visible)}/>
<span className="pulse"></span>
</a>
</Dropdown>
<Dropdown overlay={menu}>
<div className={styles.avatarWrap}>
<div className={styles.avatar}></div>
<div className="ant-dropdown-link" onClick={e => e.preventDefault()}>
<span>{userInfo?.name || '未知用户'}</span>
<CaretDownOutlined />
return (
<div className={styles.lxLayoutRight}>
<Link to="/home" className={styles.lxLink}>返回首页</Link>
<Dropdown overlay={menuMessage} trigger={['click']} visible={visible}>
<span className={styles.topMessage}>
<Badge count={unreadMsg} size={"small"}>
<BellOutlined onClick={() => setVisible(!visible)}/>
</Badge>
</span>
</Dropdown>
<Dropdown overlay={menu}>
<div className={styles.avatarWrap}>
<div className={styles.avatar}></div>
<div className="ant-dropdown-link" onClick={e => e.preventDefault()}>
<span>{userInfo?.name || '未知用户'}</span>
<CaretDownOutlined />
</div>
</div>
</div>
</Dropdown>
</div>
</Dropdown>
</div>
)
}
export default RightContent
\ No newline at end of file
export default RightContent
......@@ -138,7 +138,6 @@
.topMessage{
color: rgba(255,255,255,.6);
margin-right: 30px;
position: relative;
:global{
.anticon{
font-size: 18px;
......@@ -170,16 +169,16 @@
justify-content: center;
align-items: center;
margin: 0;
border-top: 1px solid #f0f0f0;
text-align: center;
border-top: 1px solid #f0f0f0;
text-align: center;
height: 46px;
line-height: 46px;
font-size: 14px;
span{
flex: 0 0 50%;
&:last-child{
border-left: 1px solid #f0f0f0;
border-left: 1px solid #f0f0f0;
}
cursor: pointer;
}
}
\ No newline at end of file
}
......@@ -44,6 +44,12 @@ const tableListSchema: ISchema = {
"supplyMembersName": {
type: 'string',
"x-component-props": {
placeholder: '请输入采购会员名称'
}
},
"memberName": {
type: 'string',
"x-component-props": {
placeholder: '请输入供应会员名称'
}
},
......
......@@ -4,9 +4,8 @@ import { usePageStatus } from '@/hooks/usePageStatus'
import { OrderDetailContext } from '../../context'
import { PayOutWorkState } from '@/constants'
import { PublicApi } from '@/services/api'
import { history, Link } from 'umi'
import { history } from 'umi'
import OverflowText from '@/components/OverflowText'
import { useHttpRequest } from '@/hooks/useHttpRequest'
export interface OrderPayResultModalProps {
type: 'default' | 'preview',
......@@ -17,9 +16,8 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
const { data } = useContext(OrderDetailContext)
const { id } = usePageStatus()
const [visible, setVisible] = useState(false)
const [isReady, setIsReady] = useState()
const [isReady, setIsReady] = useState<any>()
const canCtlData = data.paymentInformationResponses.find(v => v.externalState === PayOutWorkState.READY_CONFIRM_RESULT) || {}
const { run, loading } = useHttpRequest(PublicApi.postOrderPlatformConfirmedPaymentResultsOrder)
const transData = canCtlData.payOrderUrls?.split(',') || []
useEffect(() => {
......@@ -35,7 +33,7 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
setVisible(false)
}
const handleConfirm = async (isReady) => {
const handleConfirm = (isReady) => {
setIsReady(isReady)
const params = {
state: isReady,
......@@ -43,10 +41,15 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
paymentInformationId: canCtlData.id
}
const res = await run(params)
if (res && res.code === 1000) {
history.goBack()
}
PublicApi.postOrderPlatformConfirmedPaymentResultsOrder(params).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack()
}, 1000)
} else {
setIsReady(null)
}
})
}
return (
......@@ -56,8 +59,8 @@ const OrderPayResultModal:React.FC<OrderPayResultModalProps> = ({type, currentRe
onCancel={handleCancel}
footer={(type === 'default' && transData) ? <Space>
<Button onClick={handleCancel}>取消</Button>
<Button loading={isReady === 0 && loading} onClick={() => handleConfirm(0)} type='dashed'>确认未到账</Button>
<Button loading={isReady === 1 && loading} onClick={() => handleConfirm(1)} type='primary'>确认到账</Button>
<Button loading={isReady === 0} onClick={() => handleConfirm(0)} type='dashed'>确认未到账</Button>
<Button loading={isReady === 1} onClick={() => handleConfirm(1)} type='primary'>确认到账</Button>
</Space> : null}
>
<List
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment