Commit 90e2f9eb authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

Merge branch 'dev' into test

parents e6ec9c32 a127e538
......@@ -46,7 +46,14 @@ const HandlingRoute = {
component: '@/pages/handling/assign/add',
hideInMenu: true
},
// 指派生产通知单 -> 待新增生产通知单详情
{
path: '/memberCenter/handling/assign/tobeAddQuery/detail',
name: 'assignProductionDetail',
icon: 'smile',
component: '@/pages/handling/assign/detail',
hideInMenu: true
},
// 指派生产通知单 -> 待审核通知单(一级)
{
path: '/memberCenter/handling/assign/pendingFirst',
......@@ -54,6 +61,13 @@ const HandlingRoute = {
icon: 'smile',
component: '@/pages/handling/components/Query'
},
{
path: '/memberCenter/handling/assign/pendingFirst/detail',
name: 'examineFirstDetail',
icon: 'smile',
component: '@/pages/handling/assign/detail',
hideInMenu: true,
},
// 指派生产通知单 -> 待审核通知单(二级)
{
path: '/memberCenter/handling/assign/pendingSecond',
......@@ -61,6 +75,13 @@ const HandlingRoute = {
icon: 'smile',
component: '@/pages/handling/components/Query'
},
{
path: '/memberCenter/handling/assign/pendingSecond/detail',
name: 'examineSecondDetail',
icon: 'smile',
component: '@/pages/handling/assign/detail',
hideInMenu: true,
},
// 指派生产通知单 -> 待提交生产通知单
{
path: '/memberCenter/handling/assign/pendingSubmit',
......@@ -68,6 +89,14 @@ const HandlingRoute = {
icon: 'smile',
component: '@/pages/handling/components/Query'
},
// 指派生产通知单 -> 待提交生产通知单 详情
{
path: '/memberCenter/handling/assign/pendingSubmit/detail',
name: 'pendingSubmitDetail',
icon: 'smile',
component: '@/pages/handling/assign/detail',
hideInMenu: true,
},
// 指派生产通知单 -> 待新增加工入库单
{
path: '/memberCenter/handling/assign/pendingAddProcessing',
......@@ -81,7 +110,15 @@ const HandlingRoute = {
path: '/memberCenter/handling/assign/pendingReceive',
name: 'toBeRecieve',
icon: 'smile',
component: '@/pages/handling//components/Query'
component: '@/pages/handling/components/Query'
},
// 指派生产通知单 -> 待收货生产通知单
{
path: '/memberCenter/handling/assign/pendingReceive/detail',
name: 'toBeRecieveDetail',
icon: 'smile',
component: '@/pages/handling/assign/detail',
hideInMenu: true,
},
// 指派生产通知单 -> 新建加工入库单
{
......
......@@ -18,7 +18,7 @@
"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 USE_ROUTE_CONFIG=false SOCKET_URL=ws://10.0.0.25:8100 yarn start",
"start:cross": "cross-env SITE_ID=352 USE_ROUTE_CONFIG=false SOCKET_URL=ws://10.0.0.25:9400 yarn start",
"start:scm": "cross-env SITE_ID=1 BACK_GATEWAY=http://lingxi-scm.wg.shushangyun.com USE_ROUTE_CONFIG=false SOCKET_URL=ws://lingxi-scm.wg.shushangyun.com yarn start",
"start:url": "cross-env SITE_ID=1 BACK_GATEWAY=http://lingxi-all.wg.shushangyun.com USE_ROUTE_CONFIG=true SOCKET_URL=ws://lingxi-all.wg.shushangyun.com yarn start",
"start:10": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.10:8100 USE_ROUTE_CONFIG=true SOCKET_URL=ws://10.0.0.10:8100 yarn start"
......
......@@ -462,11 +462,15 @@ export default {
'menu.handling.assign.assignProductionAdd': '新建生产通知单',
'menu.handling.assign.assignProductionDetail': '生产通知单详情',
'menu.handling.assign.examineFirst': '待审核生产通知单(一级)',
'menu.handling.assign.examineFirstDetail': '待审核生产通知单(一级)详情',
'menu.handling.assign.examineSecond': '待审核生产通知单(二级)',
'menu.handling.assign.examineSecondDetail': '待审核生产通知单(二级)详情',
'menu.handling.assign.toBeSubmit': '待提交生产通知单',
'menu.handling.assign.processStock': '待新增加工入库单',
'menu.handling.assign.toBeRecieve': '待收货生产通知单',
'menu.handling.assign.createProcessStock': '新建加工入库单',
'menu.handling.assign.pendingSubmitDetail': '待提交生产通知单详情',
'menu.handling.assign.toBeRecieveDetail': '待收货生产通知单详情',
'menu.handling.confirm': '确认生产通知单',
'menu.handling.confirm.confirmProductionQuery': '生产通知单查询',
'menu.handling.confirm.pendingSubmit': '待提交生产通知单',
......
......@@ -46,8 +46,8 @@ const Add: React.FC<{}> = () => {
const noticesDetailColumn = () => {
return [
{ title: '订单号', dataIndex: 'orderId' },
{ title: '商品ID', dataIndex: 'id' },
{ title: '订单号', dataIndex: 'orderNo' },
{ title: '商品ID', dataIndex: 'commodityId' },
{ title: '商品名称', dataIndex: 'name' },
{ title: '品类', dataIndex: 'customerCategoryName' },
{ title: '品牌', dataIndex: 'brandName' },
......
......@@ -2,7 +2,7 @@ import React, {useState, useEffect} from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi';
import AvatarWrap from '@/components/AvatarWrap';
import { PageHeader, Descriptions, Card, Tabs, Space, Row, Col } from 'antd';
import { PageHeader, Descriptions, Card, Tabs, Space, Row, Col, Button } from 'antd';
import Circulation from '../../components/Circulation';
import WrapTable from '../../components/WrapTable';
import OtherRequirement from '../../components/OtherRequirement';
......@@ -13,22 +13,56 @@ import StatusTag from '@/components/StatusTag';
import DeliveryInfomation from '../../components/DeliveryInformation';
import moment from 'moment';
import { columns, innerWorkFlowRecordColumn, outerWorkflowRecordsColumn } from './columns';
import ExamineModal from '../../components/ExamineModal';
const SERVICE_MAP = {
'/memberCenter/handling/assign/query/detail': PublicApi.getEnhanceSupplierAllDetails,
'/memberCenter/handling/assign/tobeAddQuery/detail': PublicApi.getEnhanceSupplierToBeAddDetails,
'/memberCenter/handling/assign/pendingFirst/detail': PublicApi.getEnhanceSupplierToBeFirstExamDetails,
'/memberCenter/handling/assign/pendingSecond/detail': PublicApi.getEnhanceSupplierToBeSecondExamDetails,
'/memberCenter/handling/assign/pendingSubmit/detail': PublicApi.getEnhanceSupplierToBeSubmitDetails,
'/memberCenter/handling/assign/pendingReceive/detail': PublicApi.getEnhanceSupplierToBeReceiveDetails,
}
/**
* 审核链接
*/
const EXAM_SERVICE = {
'/memberCenter/handling/assign/pendingFirst/detail': PublicApi.postEnhanceSupplierToBeFirstExamExam,
'/memberCenter/handling/assign/pendingSecond/detail': PublicApi.postEnhanceSupplierToBeSecondExamExam
}
const { TabPane } = Tabs;
const Detail: React.FC<{}> = () => {
const [info, setInfo] = useState<any>({})
const { id } = usePageStatus();
const pathname = history.location.pathname;
useEffect(() => {
if(id) {
PublicApi.getEnhanceSupplierAllDetails({id: id})
SERVICE_MAP[pathname]({id: id})
.then(({data, code}) => {
if(code === 1000) {
setInfo(data);
}
})
}
}, [id])
}, [id]);
// 审核
const examOnOk = ({text, status}) => {
const postData = {
id: id,
status: status,
cause: text
}
EXAM_SERVICE[pathname](postData)
.then(({code, data}) => {
if(code == 1000) {
history.go(-1)
}
})
}
return (
<PageHeaderWrapper
......@@ -48,6 +82,8 @@ const Detail: React.FC<{}> = () => {
/>
}
>
<Row>
<Col span={22}>
<Descriptions
column={3}
style={{padding: '0 32px', fontWeight: 400}}
......@@ -62,6 +98,12 @@ const Detail: React.FC<{}> = () => {
</Descriptions.Item>
<Descriptions.Item label="内部状态:">{info.innerStatusName}</Descriptions.Item>
</Descriptions>
</Col>
<Col span={2}>
<ExamineModal onOk={examOnOk}/>
</Col>
</Row>
</PageHeader>
</>
}
......@@ -96,6 +138,9 @@ const Detail: React.FC<{}> = () => {
receiveAddress={info.receiveAddress}
receiveUserName={info.receiveUserName}
receiveUserTel={info.receiveUserTel}
deliveryAddress={info.deliveryAddress}
deliveryUserName={info.deliveryUserName}
deliveryUserTel={info.deliveryUserTel}
/>
</div>
<div style={{marginTop: '20px'}}>
......
......@@ -15,3 +15,8 @@ export const commonTimeList = [
* 单据时间
*/
export const docTime = [{label: '单据时间(全部)', value: 0}].concat(commonTimeList);
/**
* 下单时间
*/
export const orderTime = [{label: '单据时间(全部)', value: 0}].concat(commonTimeList);
......@@ -12,6 +12,9 @@ interface Iprops {
receiveAddress: string,
receiveUserName: string,
receiveUserTel: string
deliveryAddress: string,
deliveryUserName: string,
deliveryUserTel: string
}
const DeliveryInfomation: React.FC<Iprops> = (props) => {
......@@ -38,13 +41,14 @@ const DeliveryInfomation: React.FC<Iprops> = (props) => {
<Col offset={5}>{props.receiveAddress}</Col>
</Row>
</Col>
<Col span={9}>
<Col span={9} style={!props.deliveryUserName ? {display: 'none'} : {}}>
<Row style={{marginBottom: '20px'}}>
<Col span={5}>发货地址</Col>
<Col>张三 / 136,7627,2729</Col>
<Col>{props.deliveryUserTel} / {props.deliveryUserName}</Col>
</Row>
<Row>
<Col offset={5}>广东省广州市海珠区新港东路1068号中州中心北塔6楼</Col>
<Col offset={5}>{props.deliveryAddress}</Col>
</Row>
</Col>
</Row>
......
import React, { useState } from 'react';
import { Modal, Radio, Input, Button, message } from 'antd';
const { TextArea } = Input;
interface Iparams {
status: number,
text: string,
}
interface Iprops {
onOk: (params: Iparams) => void
}
const ExamineModal: React.FC<Iprops> = (props) => {
const [visible, setVisible] = useState<boolean>(false);
const [status, setStatus] = useState<number>(1);
const [text, setText] = useState("")
const handleOnOk = () => {
if(text == '') {
message.error("不通过原因不能为空");
return ;
}
!!props.onOk && props.onOk({status: status, text: text})
setVisible(false)
}
const onChange = (e) => {
setStatus(e.target.value)
}
const handleTextChange = (e) => {
setText(e.target.value)
}
return (
<div>
<Button onClick={() => setVisible(true)}>单据审核</Button>
<Modal
visible={visible}
title="单据审核"
onOk={handleOnOk}
>
<div>
<Radio.Group onChange={onChange} value={status}>
<Radio value={1}>审核通过</Radio>
<Radio value={0}>审核不通过</Radio>
</Radio.Group>
<div style={status === 1 ? {display: 'none'} : {}}>
<p style={{margin: '15px 0'}}>审核不通过的原因</p>
<div>
<TextArea rows={5} value={text} onChange={handleTextChange}></TextArea>
</div>
</div>
</div>
</Modal>
</div>
)
}
export default ExamineModal
\ No newline at end of file
import React, { Component } from 'react';
class ModalContainer extends Component {
state = {
visible: false
}
handleCancel = () => {
this.setState({
visible: false
})
}
show = () => {
this.setState({
visible: true
})
}
render() {
const { visible } = this.state;
const { children } = this.props;
return (
children({
visible: visible,
show: this.show,
cancel: this.handleCancel
})
)
}
}
export default ModalContainer;
\ No newline at end of file
......@@ -40,13 +40,12 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
.then((data) => {
if(data.code == 1000) {
const target = data.data.unitPriceAndPicList.filter((item) => item.id.toString() == props.primaryKey.toString());
console.log(props.primaryKey, target)
console.log(data.data.unitPriceAndPicList);
setInfo({
...data.data,
quantity: quantity,
processUnitPrice: processUnitPrice,
attributes: target[0].attributeAndValueList
attributes: target[0] && target[0].attributeAndValueList || []
});
}
})
......
......@@ -4,107 +4,104 @@ import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview';
import { BasicForm, TablePagination, SearchForm } from '../ModalForTable'
import { createFormActions } from '@formily/antd';
import processProductSchema from '../../schema/processProductSchema';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { schema } from './schema';
import { timeRange } from '@/utils'
const actions = createFormActions();
const columns = [
{
title: '订单号',
dataIndex: 'orderNo'
},
{
title: '订单摘要',
dataIndex: 'orderThe'
},
{
title: '采购会员',
dataIndex: 'supplyMembersName'
},
{
title: '下单时间',
dataIndex: 'createTime'
},
const expandRowColumn = [
{ title: '商品id', dataIndex: 'commodityId' },
{ title: '商品名称', dataIndex: 'name'},
{ title: '品类', dataIndex: 'customerCategoryName'},
{ title: '品牌', dataIndex: 'brandName'},
{ title: '单价', dataIndex: 'price'},
{ title: '订单数量', dataIndex: 'orderTotal' },
{
title: '订单状态',
dataIndex: 'externalState'
title: '剩余加工数量',
dataIndex: 'restTotal',
render: (text, record) => {
return record.purchaseCount - (record.hasProcessNum || 0)
}
},
{
title: '订单类型',
dataIndex: 'type'
title: '已加工数量',
dataIndex: 'hasProcessNum',
render: (text) => {
return text || 0;
}
}
]
const expandRowColumn = [
{ title: '商品id', dataIndex: 'id' },
{ title: '商品名称', dataIndex: 'name'},
{ title: '品类', dataIndex: 'type'},
{ title: '品牌', dataIndex: 'brand'},
{ title: '单位', dataIndex: 'unit'},
{ title: '订单数量', dataIndex: 'total' },
{ title: '剩余加工数量', dataIndex: 'rest' },
{ title: '已加工数量', dataIndex: 'hasProcess'}
];
const data = [];
for (let i = 0; i < 3; ++i) {
data.push({
id: i,
name: '进口头层黄牛皮荔枝纹/红色/XL',
type: '牛皮',
brand: 'PELLE',
unit: '尺',
total: '2000',
rest: '1000',
hasProcess: '1000'
});
}
const tableSchema = {
table: {
type: "object",
name: "table",
"x-component": "Table",
"x-component-props": {
"columns": columns,
"rowKey": "id",
"expandable": "{{expandable}}",
"pagination":false,
// "rowSelection": "{{rowSelection}}",
// dataSource: [{id: 1}]
}
},
}
const schema = processProductSchema(tableSchema);
const ProcessProducts = ({visible, cancel, ...restProps}) => {
// const [selectRow, setSelectRow] = useState({});
const [selectRow, memberRowCtl] = useRowSelectionTable({ customKey: 'id' });
const [orderData, setOrderData] = useState<any>([])
// const [mainTableSelectRow, mainTableSelectRowCtl] = useRowSelectionTable({customKey: 'id'});
const [selectRow, selectRowCtl] = useRowSelectionTable({
customKey: 'id',
extendsSelection: {
getCheckboxProps: record => ({
disabled: record.purchaseCount - (record.processNum || 0) <= 0,
}),
}
});
const fetchData = useCallback(async (params: any) => {
let res = await PublicApi.getOrderProcessingOrderList(params);
const {orderTime, ...rest} = params
const {st, et} = timeRange(orderTime);
let postData = {
startCreateTime: st,
endCreateTime: et,
...rest
}
let res = await PublicApi.getOrderProcessingOrderList(postData);
return res;
}, [])
const expandable = {
expandedRowRender: record => (
expandedRowRender: record => {
const renderData = record.productDateilss.map(
(item) => {
return {
orderNo: record.orderNo,
commodityId: item.productId, // 商品id
id: item.id,
name: item.productName,
customerCategoryName: item.category,
brandName: item.brand,
unitName: item.unit,
orderTotal: item.purchaseCount,
restTotal: item.purchaseCount - (item.processNum || 0),
processNum: '',
processUnitPrice: '',
processTotalPrice: '',
price: item.price, //单价,
hasProcessNum: item.processNum
}
}
)
return (
<Table
columns={expandRowColumn}
rowKey={"id"}
// rowSelection={rowSelection}
dataSource={record.productDateilss}
rowSelection={selectRow}
dataSource={renderData}
pagination={false}
/>
),
)
},
// defaultExpandAllRows: true
}
const handleSubmit = () => {
restProps.onOk(memberRowCtl)
// console.log(selectRowCtl, mainTableSelectRowCtl);
console.log(selectRowCtl)
restProps.onOk(selectRowCtl)
cancel();
}
return (
<Drawer
title="选择加工订单"
......@@ -132,7 +129,7 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
schema={schema}
actions={actions}
expressionScope={{
rowSelection: selectRow,
// rowSelection: tableSelectRow(),
expandable: expandable
}}
></SearchForm>
......
import { ORDER_TYPE, PurchaseOrderOutWorkStateTexts } from '@/constants';
import { orderTime } from '../../common';
const columns = [
{ title: '订单号', dataIndex: 'orderNo'},
{ title: '订单摘要', dataIndex: 'orderThe'},
{ title: '采购会员', dataIndex: 'supplyMembersName'},
{ title: '下单时间', dataIndex: 'createTime'},
{
title: '订单状态',
dataIndex: 'externalState',
render: (text, record) => {
return PurchaseOrderOutWorkStateTexts[text]
},
filters: Object.entries(PurchaseOrderOutWorkStateTexts).map(([key, value]) => ({ text: value, value: Number(key) })),
onFilter: (value, record) => value === record.externalState,
},
{
title: '订单类型',
dataIndex: 'type',
render: (text, recode) => {
return ORDER_TYPE[text];
}
}
]
export const schema = {
type: 'object',
properties: {
layout: {
type: 'object',
'x-component': 'CustomFlexRowLayout',
'x-component-props': {
justify: 'space-between',
align: 'center'
},
properties: {
'flex-layout': {
type: 'object',
name: 'rigth-layout',
"x-component": 'CustomFlexColumnLayout',
properties: {
controllers: {
type: 'object',
name: 'controllers',
'x-component': 'CustomFlexRowLayout',
'x-component-props': {
justify: 'start',
},
properties: {
orderNo: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: "请填写订单号",
"onSearch": "{{search}}",
}
},
'HIGHT_FILTER_BTN': {
type: 'string',
'x-component': 'button',
'x-component-props': {
"children": "{{HIGHT_FILTER_BTN}}",
"onClick": "{{toggleFilters}}",
style: {
margin: '0 15px'
}
}
},
reset: {
type: 'string',
name: 'reset',
"x-component": "button",
"x-component-props": {
"onClick": "{{reset}}",
"children": "重置",
}
},
}
},
'FILTERS': {
type: 'object',
name: 'FILTERS',
'x-component': 'CustomFlexRowLayout',
'x-component-props': {
justify: 'start'
},
properties: {
orderThe: {
type: 'string',
'x-component': 'Input',
'x-component-props': {
placeholder: '请填写订单摘要',
style: {
width: '150px',
margin: '0 20px 0 0'
}
}
},
supplyMembersId: {
type: 'string',
'x-component': 'Select',
'x-component-props': {
placeholder: '请选择采购会员',
allowClear:true,
style: {
width: '150px',
margin: '0 20px 0 0'
}
}
},
orderTime: {
type: 'string',
'x-component': 'Select',
'x-component-props': {
options: orderTime,
allowClear:true,
style: {
width: '150px',
margin: '0 20px 0 0'
},
default: 0,
}
},
type: {
type: 'string',
'x-component': 'Select',
'x-component-props': {
options: [],
style: {
width: '150px',
margin: '0 20px 0 0'
}
}
},
queryBtn: {
type: 'string',
'x-component': 'Submit',
"x-component-props": {
"children": "查询",
}
}
}
}
}
},
pagination: {
type: 'object',
'x-component': "TablePagination",
'x-style': {
display: 'flex',
flexDirection: 'row',
justifyContent: 'flex-end'
},
'x-component-props': {
showQuickJumper: true,
pageSize: 10,
simple: true
}
}
}
},
table: {
type: "object",
name: "table",
"x-component": "Table",
"x-component-props": {
"columns": columns,
"rowKey": "id",
"pagination":false,
// "rowSelection": "{{rowSelection}}",
"expandable": "{{expandable}}",
}
},
}
}
\ No newline at end of file
......@@ -107,8 +107,8 @@ export const FILTER_NAMES = {
export const DETAIL_PATH = {
[QUERY_PATH]: '/memberCenter/handling/assign/query/detail',
[TO_BE_ADD_QUERY_PATH]: '/memberCenter/handling/assign/query/detail',
[PENDING_FIRST]: '/memberCenter/handling/assign/query/detail',
[PENDING_SECOND]: '/memberCenter/handling/assign/query/detail',
[PENDING_SUBMIT]: '/memberCenter/handling/assign/query/detail',
[PENDING_RECEIVE]: '/memberCenter/handling/assign/query/detail',
[PENDING_FIRST]: '/memberCenter/handling/assign/pendingFirst/detail',
[PENDING_SECOND]: '/memberCenter/handling/assign/pendingSecond/detail',
[PENDING_SUBMIT]: '/memberCenter/handling/assign/pendingSubmit/detail',
[PENDING_RECEIVE]: '/memberCenter/handling/assign/pendingReceive/detail',
}
\ No newline at end of file
import React, { ReactNode } from 'react';
import React, { ReactNode, useEffect, useState } from 'react';
import styles from './Container.less';
import {useInViewport} from '@umijs/hooks';
import { Skeleton } from 'antd';
interface Iprops {
/**
......@@ -13,13 +15,36 @@ interface Iprops {
/**
* 主要用在header 右边连接ReactNode
*/
extra?: ReactNode
extra?: ReactNode,
/**
* request
*/
request?: () => Promise<any>
};
const AbilityContainer: React.FC<Iprops> = (props) => {
const { title = '', tips = '' } = props;
const [inViewPort, ref] = useInViewport<HTMLDivElement>();
const [loading, setLoading] = useState<boolean>(false);
const [flag, setFlag] = useState<boolean>(false);
const [data, setData] = useState<any>({});
useEffect(() => {
if(inViewPort && !flag) {
setLoading(true);
props.request &&
props.request()
.then(({code, data}) => {
if(code === 1000) {
setData(data)
}
setFlag(true)
setLoading(false)
})
}
}, [inViewPort])
return (
<div className={styles.container}>
<div className={styles.container} ref={ref}>
<div className={styles.header}>
<div className={styles.left}>
<div className={styles.title}>{title}</div>
......@@ -30,7 +55,17 @@ const AbilityContainer: React.FC<Iprops> = (props) => {
</div>
</div>
<div className={styles.body}>
{props.children}
{
!!props.request
? <>
{props.children({
loading: loading,
requestData: data,
})}
</>
: props.children
}
</div>
</div>
)
......
import React, { useEffect, useState } from 'react';
import React, { useCallback} from 'react';
import AbilityContainer from './Container';
import styles from './center.less'
import logistics from '@/assets/imgs/logistics.png';
......@@ -6,7 +6,6 @@ import logistics_form from '@/assets/imgs/logistics_form.png';
import logistics_address from '@/assets/imgs/logistics_address.png';
import logistics_cost from '@/assets/imgs/logistics_cost.png';
import { Row, Col, Skeleton } from 'antd';
import {useInViewport} from '@umijs/hooks';
import { PublicApi } from '@/services/api';
import { Link } from 'umi'
......@@ -18,83 +17,35 @@ const KEY_TO_TITLE = {
}
const FundCenter: React.FC<Iprops> = () => {
const [inViewPort, ref] = useInViewport<HTMLDivElement>();
const [data, setData] = useState<any>({});
const [flag, setFlag] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
const request = useCallback(async () => {
const res = await PublicApi.getReportMemberHomeGetAccount();
return res;
}, [])
const tagsList = [
{
icon: logistics,
text: '物流派单'
},
{
icon: logistics_form,
text: '接单报价'
},
{
icon: logistics_address,
text: '收货地址管理'
},
{
icon: logistics_address,
text: '发货地址管理'
},
{
icon: logistics_cost,
text: '运费模板'
}
]
useEffect(() => {
if(inViewPort && !flag) {
setLoading(true);
PublicApi.getReportMemberHomeGetAccount()
.then(({code, data}) => {
if(code === 1000) {
console.log(data);
setData(data)
setFlag(true)
setLoading(false)
}
})
}
}, [inViewPort])
return (
<AbilityContainer
title="资金账户管理"
tips={"提供资金账户管理、授信额度管理等功能。"}
request={request}
>
<div ref={ref}>
{
({loading, requestData}) => {
return (
<div>
{
loading
? <Skeleton active />
: (
<>
{/* <div className={styles.tags}>
{
tagsList.map((item) => {
return (
<div className={styles.tagsItem} key={item.text}>
<div className={styles.icon}>
<img src={item.icon} />
</div>
<div className={styles.text}>{item.text}</div>
</div>
)
})
}
</div> */}
<div>
{
Object.keys(data).map((item) => {
Object.keys(requestData).map((item) => {
return (
<Row key={item} className={styles.row}>
<Col span={4} className={styles.rowTitle}>{KEY_TO_TITLE[item]}</Col>
<Col span={20} className={styles.colRow}>
{
data[item].map((record) => {
requestData[item].map((record) => {
return (
<Col span={4} key={record.name} className={styles.col}>
<div className={styles.colTitle}>{record.name}</div>
......@@ -117,8 +68,11 @@ const FundCenter: React.FC<Iprops> = () => {
</>
)
}
</div>
)
}
}
</AbilityContainer>
)
}
......
import React from 'react';
import React, { useCallback } from 'react';
import AbilityContainer from './Container';
import { Row, Col, Space } from 'antd';
import styles from './center.less'
import { Row, Col, Space, Skeleton } from 'antd';
import styles from './center.less';
import { PublicApi } from '@/services/api';
import { Link } from 'umi';
interface Iprops {};
const ProductCenter: React.FC<Iprops> = () => {
const data = [
{
id: 1,
list: [1,2,3,4]
},
]
const request = useCallback(async () => {
const res = await PublicApi.getReportMemberHomeGetCommodityTally();
return res;
}, [])
return (
<AbilityContainer
tips="快速完成品牌、商品创建、发布、提供灵活的商品库存管理"
......@@ -23,29 +23,42 @@ const ProductCenter: React.FC<Iprops> = () => {
<a>创建商品</a>
</Space>
}
request={request}
>
{
data.map((record) => {
({loading, requestData}) => {
const isArray = Array.isArray(requestData);
return (
<Row key={record.id} className={styles.row}>
<Col span={4} className={styles.rowTitle}>平台代收账款结算</Col>
<>
{
loading
? <Skeleton active />
: <>
<Row className={styles.row}>
<Col span={4} className={styles.rowTitle}>商品</Col>
<Col span={20} className={styles.colRow}>
{
record.list.map((item) => {
isArray && requestData.map((item) => {
return (
<Col span={4} key={item} className={styles.col}>
<div className={styles.colTitle}>待提交审核咨询单</div>
<div className={styles.colValue}>5</div>
<Col span={4} key={item.name} className={styles.col}>
<div className={styles.colTitle}>{item.name}</div>
{
item.link
? <Link to={item.Link} className={styles.colValue}>{item.count}</Link>
: <div className={styles.colValue}>{item.count}</div>
}
</Col>
)
})
}
</Col>
</Row>
</>
}
</>
)
})
}
}
</AbilityContainer>
)
}
......
import React from 'react';
import React, {useCallback} from 'react';
import AbilityContainer from './Container';
import { Row, Col } from 'antd';
import { Row, Col, Skeleton } from 'antd';
import styles from './center.less'
import { PublicApi } from '@/services/api';
interface Iprops {};
const KEY_TITLE = {
'commodityInquiryList': '商品询价',
'inquiryQuotationList': '询价报价',
'confirmInquiryQuotationList': '确认询价报价',
'demandPublishList': '需求发布',
'demandQuotationList': '需求报价',
'confirmDemandQuotationList': '确认需求报价',
'saleOrderList': '销售订单',
'purchaseOrderList': '采购订单'
}
const TradeCenter: React.FC<Iprops> = () => {
const data = [
{
id: 1,
list: [1,2,3,4]
},
{
id: 2,
list: [1,2,3,4]
},
{
id: 3,
list: [1,2,3,4,5]
},
{
id: 4,
list: [1,2,3,4,5,6,7,8,9,10]
},
{
id: 5,
list: [1,2,3,4,5,6]
},
{
id: 6,
list: [1]
}
]
const request = useCallback(async () => {
const res = await PublicApi.getReportMemberHomeGetTradeReport();
return res;
}, [])
return (
<AbilityContainer
title="交易中心"
......@@ -41,19 +30,28 @@ const TradeCenter: React.FC<Iprops> = () => {
<a>进入交易中心</a>
</div>
}
request={request}
>
{
data.map((record) => {
({loading, requestData}) => {
return (
<Row key={record.id} className={styles.row}>
<Col span={4} className={styles.rowTitle}>平台代收账款结算</Col>
<>
{
loading
? [1,2,3].map((item) => (
<Skeleton active key={item} />
))
: Object.keys(requestData).map((record) => {
return (
<Row key={record} className={styles.row}>
<Col span={4} className={styles.rowTitle}>{KEY_TITLE[record]}</Col>
<Col span={20} className={styles.colRow}>
{
record.list.map((item) => {
requestData[record].map((item, key) => {
return (
<Col span={4} key={item} className={styles.col}>
<div className={styles.colTitle}>待提交审核咨询单</div>
<div className={styles.colValue}>5</div>
<Col span={4} key={key} className={styles.col}>
<div className={styles.colTitle}>{item.name}</div>
<div className={styles.colValue}>{item.count}</div>
</Col>
)
})
......@@ -62,6 +60,12 @@ const TradeCenter: React.FC<Iprops> = () => {
</Row>
)
})
}
</>
)
}
}
</AbilityContainer>
......
......@@ -38,7 +38,7 @@ export const useOrderDetail = (options: OrderDetailHookProps) => {
useEffect(() => {
reloadFormData()
reloadPayList()
// reloadPayList()
}, [])
const reloadFormData = useCallback(() => {
......@@ -51,6 +51,7 @@ export const useOrderDetail = (options: OrderDetailHookProps) => {
if(data.paymentInformationResponses.length > 0){
setCurrentPayInfoId(data.paymentInformationResponses[0].id)
}
reloadPayList(data.supplyMembersId)
} else {
message.error(msg)
}
......@@ -58,14 +59,23 @@ export const useOrderDetail = (options: OrderDetailHookProps) => {
}
}, [id])
const reloadPayList = useCallback(() => {
PublicApi.getPayPayWayList().then(res => {
const reloadPayList = (memberId) => {
PublicApi.getPayPayWayList({memberId}).then(res => {
const { code, data } = res
if (code === 1000) {
setPaylist(data)
}
})
}, [id])
}
// const reloadPayList = useCallback(() => {
// PublicApi.getPayPayWayList().then(res => {
// const { code, data } = res
// if (code === 1000) {
// setPaylist(data)
// }
// })
// }, [id])
......
......@@ -127,7 +127,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}
return resultState
})
const [paymentColumns, paymentComponents, paymentSave] = usePaymentInfo(addSchemaAction)
const [paymentColumns, paymentComponents, paymentSave] = usePaymentInfo(addSchemaAction, addSchemaAction.getFieldValue('supplyMembersId'))
const { productAddButton, productRef, productColumns, productComponents, ...sectionProps } = useProductTable(addSchemaAction)
// 页面进入时, 当前所处的下单模式
......
......@@ -5,7 +5,7 @@ import { useEffect, useState, useRef, useContext } from 'react'
import { PublicApi } from '@/services/api'
import { ReadyAddOrderDetailContext } from '../../context'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions): any => {
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any): any => {
const paywayData = useRef<any>({})
const [columns, setColumns] = useState<any[]>(paymentInformationColumns)
const { productSumPrice } = useContext(ReadyAddOrderDetailContext)
......@@ -54,8 +54,29 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
return result
}
// useEffect(() => {
// PublicApi.getPayPayWayList().then(res => {
// const { code, data } = res
// if (code === 1000) {
// const newColumns = [...columns]
// newColumns[5].formItemProps.options = initPayWayList(data)
// paywayData.current = data
// setColumns(newColumns)
// }
// })
// }, [])
useEffect(() => {
PublicApi.getPayPayWayList().then(res => {
console.log(memberId, 'memberId')
// 当选择报价单/会员/商品时有memberId传入时 调用支付方式api
if(memberId) {
getPayLists(memberId)
}
}, [memberId])
const getPayLists = (memberId) => {
PublicApi.getPayPayWayList({memberId}).then(res => {
const { code, data } = res
if (code === 1000) {
const newColumns = [...columns]
......@@ -65,7 +86,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
setColumns(newColumns)
}
})
}, [])
}
const handleSave = row => {
return new Promise((resolve, reject) => {
......
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