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