Commit b503c2db authored by Bill's avatar Bill

结算能力,完善代码

parent 6506c4f6
......@@ -12,7 +12,7 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { createFormActions } from '@formily/antd';
import { StandardTable } from 'god';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { schema } from './schema';
import StatusTag from '../../components/StatusTag';
import StatusActions from '../../components/StatusActions';
......@@ -20,6 +20,7 @@ import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview';
import { Moment } from 'moment';
import { payStatus } from '../../common';
import { fetchOptions } from '../../common'
const formActions = createFormActions();
// 应付账款 - 付款方查看凭证, 能力中心
......@@ -146,10 +147,15 @@ const SettlementList = () => {
expressionScope={{}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'megaLayout.settlementName', FORM_FILTER_PATH);
// useAsyncInitSelect(
// ['innerStatus', 'outerStatus'],
// fetchSelectOptions,
// );
useAsyncSelect(
'status',
fetchOptions(PublicApi.getSettleAccountsCommonGetSettlementStatus),
);
// 单据类型
useAsyncSelect(
'orderType',
fetchOptions(PublicApi.getSettleAccountsCommonGetSettlementOrderType),
);
}}
schema={schema}
onSubmit={handleSearch}
......
......@@ -12,13 +12,14 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { createFormActions } from '@formily/antd';
import { StandardTable } from 'god';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { schema } from './schema';
import ModalContainer from '../../components/ModalContainer'
import InvoiceCreate from '../../components/InvoiceCreate'
import { PublicApi } from '@/services/api'
import StatusTag from '../../components/StatusTag';
import styles from './index.less'
import { fetchOptions } from '../../common';
const RangePicker = DatePicker.RangePicker;
const formActions = createFormActions();
......@@ -170,10 +171,15 @@ const SettlementList = () => {
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'megaLayout.topLayout.orderNo', FORM_FILTER_PATH);
// useAsyncInitSelect(
// ['innerStatus', 'outerStatus'],
// fetchSelectOptions,
// );
useAsyncSelect(
'invoiceStatus',
fetchOptions(PublicApi.getSettleAccountsCommonGetReceiptInvoiceStatus),
);
// 单据类型
useAsyncSelect(
'payStatus',
fetchOptions(PublicApi.getSettleAccountsCommonGetPayStatus),
);
}}
schema={schema}
onSubmit={reload}
......
......@@ -12,13 +12,14 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { createFormActions } from '@formily/antd';
import { StandardTable } from 'god';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { schema } from './schema';
import { PublicApi } from '@/services/api';
import StatusActions from '../../components/StatusActions';
import StatusTag from '../../components/StatusTag';
import EyePreview from '@/components/EyePreview';
import { payStatus } from '../../common';
import { fetchOptions } from '../../common';
const formActions = createFormActions();
// 应收账款管理-收款方查看凭证, 能力中心
......@@ -157,10 +158,15 @@ const SettlementList = () => {
expressionScope={{}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'megaLayout.payName', FORM_FILTER_PATH);
// useAsyncInitSelect(
// ['innerStatus', 'outerStatus'],
// fetchSelectOptions,
// );
useAsyncSelect(
'status',
fetchOptions(PublicApi.getSettleAccountsCommonGetSettlementStatus),
);
// 单据类型
useAsyncSelect(
'orderType',
fetchOptions(PublicApi.getSettleAccountsCommonGetSettlementOrderType),
);
}}
schema={schema}
onSubmit={handleSearch}
......
......@@ -7,4 +7,43 @@ export const payStatus = [
{ text: '待付款', value: 2 },
{ text: '待收款', value: 3 },
{ text: '以完成', value: 4 },
];
\ No newline at end of file
];
/**
* 下单时间与支付时间,用于平台积分计算详情,与平台代收账款借算
*/
export const commonTimeList = [
{ label: '今天', value: 1},
{ label: '一周内', value: 2},
{ label: '一个月内', value: 3},
{ label: '三个月内', value: 4},
{ label: '六个月内', value: 5},
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7}
];
/**
* 下单时间
*/
export const orderTime = [{label: '下单时间(所有)', value: 0}].concat(commonTimeList);
/**
* 支付时间
*/
export const payTime = [{label: '支付时间(所有)', value: 0}].concat(commonTimeList);
/**
* 获取结算状态
*/
export const fetchOptions = (service) => {
return async function() {
const res = await service();
if(res.code === 1000) {
return res.data.map((item) => {return { label: item.text, value: item.id }})
}
return [];
}
}
\ No newline at end of file
......@@ -86,3 +86,41 @@ export interface InvoiceInfoProps {
*/
proveList: ProveListProps[]
}
enum Kind {
/**
* 增值税普通发票(默认)
*/
common = 1,
/**
* 增值税专用发票
*/
special = 2 //
}
enum ItemIpropType {
/**
* 企业
*/
business = 1,
/**
* 个人
*/
person = 2
}
/**
* 发票内容,用于发票列表
*/
export interface IReceiptProps {
id: number,
kind: Kind,
type: ItemIpropType,
invoiceTitle: string,
taxNo: string,
bankOfDeposit: string,
account: string,
addres: string,
tel: string
isDefault: number
}
......@@ -50,17 +50,17 @@ const InvoiceDrawer: React.FC<Iprops> = (props) => {
const [invoiceInfo, setInvoiceInfo] = useState<InvoiceInfoProps>(null);
const [submitLoading, setSubmitLoading] = useState<boolean>(false)
const handleSubmit = () => {
// // 如果当前type==0为开票, 1为查看,那么直接关闭
if(type == 0) {
formActions.submit()
} else {
// 查看类型的话,按确认直接关掉窗口
onCancel();
}
}
const handleForm = (value: SubmitProps) => {
// 如果当前type 为查看,那么直接关闭
if(type == 1) {
onCancel();
return;
}
if(typeof value.list === 'undefined' || value.list.length == 0) {
message.error({
content: '请添加发票信息'
......
......@@ -12,14 +12,14 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { createFormActions } from '@formily/antd';
import { StandardTable } from 'god';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { schema } from './schema';
import StatusTag from '../../components/StatusTag';
import StatusActions from '../../components/StatusActions';
import { payStatus } from '../../common';
import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
import { text } from 'express';
import { fetchOptions } from '../../common';
const formActions = createFormActions();
......@@ -160,10 +160,10 @@ const AccountReceivable = () => {
components={{DatePicker}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'megaLayout.settlementName', FORM_FILTER_PATH);
// useAsyncInitSelect(
// ['innerStatus', 'outerStatus'],
// fetchSelectOptions,
// );
useAsyncSelect(
['status'],
fetchOptions(PublicApi.getSettleAccountsCommonGetSettlementStatus),
);
}}
schema={schema}
onSubmit={handleSearch}
......
......@@ -11,10 +11,9 @@ import { history } from 'umi';
import AvatarWrap from '@/components/AvatarWrap';
import NiceForm from '@/components/NiceForm';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ISchema, createFormActions } from '@formily/antd';
import { createFormActions } from '@formily/antd';
import { StandardTable } from 'god';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { detailSchema } from './schema';
import { PublicApi } from '@/services/api';
import { usePageStatus } from '@/hooks/usePageStatus';
......@@ -117,7 +116,7 @@ const Info: React.FC = () => {
<Descriptions.Item label="结算单数:">{infoDetail?.totalCount }</Descriptions.Item>
<Descriptions.Item label="结算金额:">{infoDetail?.amount}</Descriptions.Item>
<Descriptions.Item label="结算方式:">{infoDetail?.settlementWayName}</Descriptions.Item>
<Descriptions.Item label="外部状态:">
<Descriptions.Item label="结算状态:">
<StatusTag text={infoDetail?.statusName} />
</Descriptions.Item>
</Descriptions>
......@@ -145,10 +144,6 @@ const Info: React.FC = () => {
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'megaLayout.topLayout.orderNo', FORM_FILTER_PATH);
// useAsyncInitSelect(
// ['innerStatus', 'outerStatus'],
// fetchSelectOptions,
// );
}}
schema={detailSchema}
onSubmit={handleSearch}
......
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ISchema, createFormActions } from '@formily/antd';
import { orderTime, payTime } from '../../../common';
/**
* index.tsx 列表页搜索schema
......@@ -49,10 +50,6 @@ export const schema: ISchema = {
type: 'string',
enum: [
{label: '结算状态(全部)', value: 0},
{label: '待对账', value: 1},
{label: '待付款', value: 2},
{label: '待收款', value: 3},
{label: '待完成', value: 4},
],
default: 0,
'x-component-props': {
......@@ -80,19 +77,6 @@ export const schema: ISchema = {
* 平台代收账款结算--详情
*/
export const commonTimeList = [
{ label: '今天', value: 1},
{ label: '一周内', value: 2},
{ label: '一个月内', value: 3},
{ label: '三个月内', value: 4},
{ label: '六个月内', value: 5},
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7}
];
const orderTime = [{label: '下单时间(所有)', value: 0}].concat(commonTimeList);
const payTime = [{label: '支付时间(所有)', value: 0}].concat(commonTimeList);
export const detailSchema: ISchema = {
type: 'object',
properties: {
......
......@@ -12,13 +12,14 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { createFormActions } from '@formily/antd';
import { StandardTable } from 'god';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { schema } from './schema/index';
import StatusActions from '../../components/StatusActions';
import StatusTag from '../../components/StatusTag';
import { payStatus } from '../../common';
import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview';
import { fetchOptions } from '../../common';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
// 平台积分结算-收款方查看凭证, 能力中心
const SCORE_BENEFINCIARY = 5;
......@@ -97,8 +98,6 @@ const Integral: React.FC = () => {
* @param {cancel: function, id: number} cancel 为关闭回调函数
*/
const handleConfirm = (params: any) => {
///settle/accounts/platform/settlement/confirmAccountComplete
// /settle/accounts/platform/score/settlement/confirmAccountComplete
PublicApi.postSettleAccountsPlatformScoreSettlementConfirmAccountComplete({settlementId: params.id})
.then((data) => {
if(data.code === 1000) {
......@@ -113,7 +112,6 @@ const Integral: React.FC = () => {
* @param {onCancel:function, id: number, status: number}
*/
const handleComfirmInCompletePayment = (params: any) => {
// /settle/accounts/platform/score/settlement/confirmPayProve
PublicApi.postSettleAccountsPlatformScoreSettlementConfirmPayProve({id: params.id, status: params.status})
.then((data) => {
if(data.code === 1000) {
......@@ -163,6 +161,10 @@ const Integral: React.FC = () => {
expressionScope={{}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'megaLayout.name', FORM_FILTER_PATH);
useAsyncSelect(
['status'],
fetchOptions(PublicApi.getSettleAccountsCommonGetSettlementStatus),
);
}}
schema={schema}
onSubmit={handleSearch}
......
......@@ -11,10 +11,9 @@ import { history } from 'umi';
import AvatarWrap from '@/components/AvatarWrap';
import NiceForm from '@/components/NiceForm';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ISchema, createFormActions } from '@formily/antd';
import { createFormActions } from '@formily/antd';
import { StandardTable } from 'god';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { detailSchema } from './schema';
import { timeRange } from '@/utils/index';
import moment from 'moment';
......@@ -76,9 +75,11 @@ const Info: React.FC = () => {
console.log(values);
const format = 'YYYY-MM-DD'
const { payTime, orderTime, ...rest } = values;
// 支付时间
const payTimeRange = payTime ? timeRange(values.payTime): null;
const payStartTime = payTimeRange ? moment(payTimeRange.st).format(format) : null;
const payEndTime = payTimeRange ? moment(payTimeRange.et).format(format) : null;
// 订单时间
const orderTimeRange = orderTime ? timeRange(values.orderTime) : null;
const orderStartTime = orderTimeRange ? moment(orderTimeRange.st).format(format) : null;
const orderEndTime = orderTimeRange ? moment(orderTimeRange.et).format(format) : null;
......@@ -101,7 +102,7 @@ const Info: React.FC = () => {
name: "结算单号:"
}}
extra={(
<span style={{ fontSize: 12, fontWeight: 'normal' }}>{"TPTY12"}</span>
<span style={{ fontSize: 12, fontWeight: 'normal' }}>{infoDetail?.settlementNo}</span>
)}
/>
}
......@@ -116,7 +117,7 @@ const Info: React.FC = () => {
<Descriptions.Item label="结算单数:">{infoDetail?.totalCount }</Descriptions.Item>
<Descriptions.Item label="结算金额:">{infoDetail?.amount}</Descriptions.Item>
<Descriptions.Item label="结算方式:">{infoDetail?.settlementWayName}</Descriptions.Item>
<Descriptions.Item label="外部状态:">
<Descriptions.Item label="结算状态:">
<StatusTag text={infoDetail?.statusName} />
</Descriptions.Item>
</Descriptions>
......@@ -125,7 +126,7 @@ const Info: React.FC = () => {
}
>
<Card>
<StandardTable
<StandardTable
tableProps={{
rowKey: record => (`${record.orderNo}-${record.payTime}`),
}}
......@@ -144,10 +145,6 @@ const Info: React.FC = () => {
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'megaLayout.topLayout.orderNo', FORM_FILTER_PATH);
// useAsyncInitSelect(
// ['innerStatus', 'outerStatus'],
// fetchSelectOptions,
// );
}}
schema={detailSchema}
onSubmit={handleSearch}
......
......@@ -6,6 +6,7 @@
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ISchema } from '@formily/antd';
import { orderTime, payTime } from '../../../common';
/**
* 平台积分管理 列表页
......@@ -84,17 +85,6 @@ export const schema: ISchema = {
/**
* 平台积分结算- 平台积分结算明细
*/
export const commonTimeList = [
{ label: '今天', value: 1},
{ label: '一周内', value: 2},
{ label: '一个月内', value: 3},
{ label: '三个月内', value: 4},
{ label: '六个月内', value: 5},
{ label: '一年内', value: 6 },
{ label: '一年前', value: 7}
];
const orderTime = [{label: '下单时间(所有)', value: 0}].concat(commonTimeList);
const payTime = [{label: '支付时间(所有)', value: 0}].concat(commonTimeList);
export const detailSchema: ISchema = {
type: 'object',
......
......@@ -23,14 +23,17 @@ import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { PublicApi } from '@/services/api';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history, Prompt } from 'umi'
import { getSettleAccountsPlatformConfigGetMemberSettlementStrategyDetail } from '@/services/SettleApi';
import { fetchOptions } from '../../common';
const formActions = createFormActions();
const { getSettleAccountsPlatformConfigGetMemberSettlementStrategyDetail } = PublicApi
const common_columns: any = [
{ title: 'ID', dataIndex: 'memberId' },
{ title: '会员名称', dataIndex: 'name',
render: (text, record) => {
{
title: '会员名称',
dataIndex: 'name',
render: (text: string, record: any) => {
return record.name || record.memberName
}
},
......@@ -39,7 +42,7 @@ const common_columns: any = [
{
title: '会员等级',
dataIndex: 'levelTag',
render: (text, record) => {
render: (text: string, record: any) => {
return record.levelTag || record.levelName
}
},
......@@ -51,7 +54,6 @@ const MemberSettleAdd: React.FC = () => {
const { id, preview } = usePageStatus();
const [submitLoading, setSubmitLoading ] = useState(false);
const [unsaved, setUnsaved] = useState(true);
const isEdit = id && !preview;
const isAdd = !id && !preview;
const tableAddButton = () => {
return (
......@@ -128,14 +130,11 @@ const MemberSettleAdd: React.FC = () => {
settlementDays: value.settlementWay.otherValues[0],
settlementDate: value.settlementWay.otherValues[1],
}
console.log("tempData", tempData)
// /settle/accounts/platform/config/addMemberSettlementStrategy
const serviceActions = isAdd
? PublicApi.postSettleAccountsPlatformConfigAddMemberSettlementStrategy
: PublicApi.postSettleAccountsPlatformConfigUpdateMemberSettlementStrategy
const postData = {...tempData, id: id || 0 }
console.log("postData", postData)
setSubmitLoading(true);
setUnsaved(false);
......@@ -172,6 +171,9 @@ const MemberSettleAdd: React.FC = () => {
})
}, [])
/**
* 进入详情页之后,初始化数据
*/
useEffect(() => {
if(id) {
async function getInfo() {
......@@ -179,7 +181,7 @@ const MemberSettleAdd: React.FC = () => {
if(res.code === 1000) {
setInitialValue({
name: res.data.name,
settlementOrderType: res.data.settlementOrderType.toString(),
settlementOrderType: res.data.settlementOrderType,
memberList: res.data.memberList,
settlementWay: {
active: res.data.settlementWay,
......@@ -219,6 +221,12 @@ const MemberSettleAdd: React.FC = () => {
components={{SettleMethod}}
onSubmit={values => handleSubmit(values)}
schema={addSchema}
effects={() => {
useAsyncSelect(
"settlementOrderType",
fetchOptions(PublicApi.getSettleAccountsCommonGetStrategySettlementOrderType)
)
}}
/>
<ModalTable
......
......@@ -105,10 +105,7 @@ export const addSchema = {
},
settlementOrderType: {
type: 'string',
enum: [
{label: '生产通知单', value: '1'},
{label: '物流通知单', value: '2'}
],
enum: [],
title: '结算单据',
'x-rules': [
{required: true, message: '请填写策略名称'},
......
......@@ -9,37 +9,17 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Row, Col, Switch, Popconfirm } from 'antd';
import { FormOutlined, DeleteOutlined, PlusOutlined } from '@ant-design/icons'
import styles from './index.less';
import { history, Link } from 'umi';
import { history } from 'umi';
import { PublicApi } from '@/services/api'
import { IReceiptProps } from '../../common/type';
interface iProps {
interface iProps {}
}
enum Kind {
common = 1, // 增值税普通发票(默认
special = 2 // 增值税专用发票
}
enum ItemIpropType {
business = 1, //企业
person = 2 // 个人
}
interface ItemIprops {
interface ItemIprops extends IReceiptProps {
onRemove: (id: number | string) => void,
id: number,
kind: Kind,
type: ItemIpropType,
invoiceTitle: string,
taxNo: string,
bankOfDeposit: string,
account: string,
addres: string,
tel: string
isDefault: number
}
const ReceiptItem: React.FC<ItemIprops> = (props) => {
const { id, kind, type, invoiceTitle, taxNo, bankOfDeposit, account, addres, tel, isDefault } = props;
const handleRouterPush = () => {
......@@ -104,14 +84,16 @@ const ReceiptItem: React.FC<ItemIprops> = (props) => {
}
const Receipt: React.FC<iProps> = () => {
const [list, setList] = useState([]);
const [list, setList] = useState<IReceiptProps[]>([]);
const fetchData = async () => {
const { data } = await PublicApi.getSettleAccountsInvoiceMessageList();
return data;
const { data, code } = await PublicApi.getSettleAccountsInvoiceMessageList();
if(code === 1000) {
return data;
}
return [];
}
useEffect(() => {
fetchData().then((data) => {
fetchData().then((data: IReceiptProps[]) => {
setList(data);
})
}, [])
......@@ -122,7 +104,6 @@ const Receipt: React.FC<iProps> = () => {
// 删除发票
const remove = async (id: number) => {
console.log(id);
const res = await PublicApi.postSettleAccountsInvoiceMessageDelete({id});
if(res.code == 1000) {
const newList = list.filter((item) => item.id !== id);
......
......@@ -6,14 +6,15 @@
import React, { useState, useEffect } from 'react';
import NiceForm from '@/components/NiceForm';
import { createFormActions, FormButtonGroup, Submit, Reset } from '@formily/antd';
import { createFormActions, FormButtonGroup, Submit } from '@formily/antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card, Switch, Button } from 'antd';
import { Card, Button } from 'antd';
import SchemaSwitch from '../../components/SchemaSwitch';
import SchemaRadio from '../../components/SchemaRadio';
import { PublicApi } from '@/services/api';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history, Prompt } from 'umi';
import { IReceiptProps } from '../../common/type'
const formActions = createFormActions();
......@@ -119,17 +120,14 @@ const schema = {
}
const Info: React.FC = () => {
const [initialValue, setInitialValue] = useState({});
const [initialValue, setInitialValue] = useState<IReceiptProps>(null);
const { id, preview } = usePageStatus();
const [submitLoading, setSubmitLoading ] = useState(false);
const [unsaved, setUnsaved] = useState(true);
const isEdit = id && !preview;
const [submitLoading, setSubmitLoading ] = useState<boolean>(false);
const [unsaved, setUnsaved] = useState<boolean>(true);
const isAdd = !id && !preview;
const isView = id && preview;
const handleSubmit = (value) => {
const handleSubmit = (value: IReceiptProps) => {
console.log(value);
// return value;
const serviceActions = isAdd
? PublicApi.postSettleAccountsInvoiceMessageAdd
: PublicApi.postSettleAccountsInvoiceMessageUpdate
......
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