Commit bd9c1eab authored by Bill's avatar Bill

对接开票管理等

parent 19de98ef
......@@ -6,111 +6,123 @@
import React, { useRef } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Card, Button } from 'antd';
import { Card, Button, DatePicker, Tag, Badge } from 'antd';
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 { schema } from './schema';
import ModalContainer from '../../components/ModalContainer'
import InvoiceCreate from '../../components/InvoiceCreate'
import { PublicApi } from '@/services/api'
import PayStatusTag from '@/components/StatusTag';
const RangePicker = DatePicker.RangePicker;
const formActions = createFormActions();
const schema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{exportBtn}}',
},
},
search: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
colStyle: {
marginLeft: 20,
},
},
properties: {
name: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '加工企业名称(全部)',
allowClear: true,
},
},
time: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '单据时间(全部)',
allowClear: true,
},
},
outerStatus: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '外部状态(全部)',
allowClear: true,
},
},
innerStatus: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '内部状态(全部)',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
const columns = [
{
title: '订单号/类型',
dataIndex: 'orderNo',
render: (text, record: any) => {
return (
<div>
<p>{record.orderNo}</p>
<Tag>{record.settlementOrderTypeName}</Tag>
</div>
)
}
},
{
title: '单据摘要/时间',
dataIndex: 'orderAbstract',
render: (text, record: any) => {
return (
<div>
<p>{record.orderAbstract}</p>
<p>{record.orderTime}</p>
</div>
)
}
},
{title: '订单类型',dataIndex: 'orderTypeName'},
{title: '单据总额', dataIndex: 'orderAmount'},
{
title: '支付批次/环节',
dataIndex: 'batch',
render: (text, record) => {
return (
<div>
<p>{record.batch}</p>
<p>{record.payNode }</p>
</div>
)
}
},
{title: '支付金额', dataIndex: 'payAmount'},
{title: '支付时间', dataIndex: 'payTime'},
{
title: '开票状态',
dataIndex: 'invoiceStatus',
render: (text, record) => {
const color = record.status ? 'green': 'blue'
return (
<div>
<Tag color={color}>{record.invoiceStatusName}</Tag>
</div>
)
}
},
};
{
title: '支付状态',
dataIndex: 'status',
render: (text, record) => {
const color = record.payStatusName == '已支付' ? 'green': '#C0C4CC';
return (
<Badge color={color} text={record.payStatusName} />
)
}
},
{
title: '操作',
render: (text, record) => {
return (
<>
<ModalContainer>
{
({visible, show, cancel}) => {
return (
<>
<InvoiceCreate id={record.id} title="开具发票" width={800} visible={visible} onCancel={cancel} />
<div onClick={show}>{record.invoiceStatus == 1 ? '查看' : '开票'}</div>
</>
)
}
}
</ModalContainer>
</>
)
}
}
]
const SettlementList = () => {
const ref = useRef<any>({})
const ref = useRef<any>({});
/**
* 获取开票管理列表
* @param params
*/
const fetchListData = async (params) => {
return {}
// /settle/accounts/member/settlement/pageReceiptInvoice
const searchParams = {
...params,
invoiceStatus: params.orderType || 2,
payStatus: params.status || 2,
}
const { data } = await PublicApi.getSettleAccountsMemberSettlementPageReceiptInvoice(searchParams);
return data
}
return (
<PageHeaderWrapper>
......@@ -119,11 +131,12 @@ const SettlementList = () => {
tableProps={{
rowKey: 'id',
}}
columns={[]}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchListData(params)}
controlRender={
<NiceForm
components={{RangePicker}}
actions={formActions}
expressionScope={{
exportBtn: (
......@@ -133,7 +146,7 @@ const SettlementList = () => {
)
}}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'megaLayout.topLayout.search', FORM_FILTER_PATH);
useStateFilterSearchLinkageEffect($, actions, 'megaLayout.topLayout.orderNo', FORM_FILTER_PATH);
// useAsyncInitSelect(
// ['innerStatus', 'outerStatus'],
// fetchSelectOptions,
......
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { ISchema, createFormActions } from '@formily/antd';
/**
* 开票管理列表页schema
*/
export const schema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
},
properties: {
ctl: {
type: 'object',
'x-component': 'Children',
'x-component-props': {
children: '{{exportBtn}}',
},
},
orderNo: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
colStyle: {
marginLeft: 20,
},
},
properties: {
desc: {
type: 'string',
default: undefined,
'x-component-props': {
placeholder: '单据摘要',
allowClear: true,
},
},
"[orderStartTime, orderEndTime]": {
type: 'object',
'x-component': 'RangePicker',
'x-component-props': {
placeholder: ["下单时间(开始时间)", "下单时间(结束时间)"],
allowClear: true,
},
},
"[payStartTime, payEndTime]": {
type: 'object',
'x-component': 'RangePicker',
'x-component-props': {
placeholder: ["支付时间(开始时间)", "支付时间(结束时间)"],
allowClear: true,
},
},
invoiceStatus: {
type: 'string',
default: 0,
enum: [
{label: '开票状态(全部)', value: 0}
],
'x-component-props': {
placeholder: '开票状态(全部)',
allowClear: true,
},
},
payStatus: {
type: 'string',
default: 0,
enum: [
{label: '支付状态(全部)', value: 0}
],
'x-component-props': {
placeholder: '支付状态(全部)',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
\ No newline at end of file
/*
* @Author: Bill
* @Date: 2020-10-28 13:46:19
* @Description: 开票管理, 发票自增
*/
import React from 'react';
import { toArr, isFn, FormPath } from '@formily/shared'
import { Button, Input } from 'antd'
import styled from 'styled-components'
import {
SchemaForm,
SchemaField,
SchemaMarkupField as Field
} from '@formily/antd'
import { ArrayList } from '@formily/react-shared-components';
import { PlusOutlined, MinusOutlined } from '@ant-design/icons'
const ArrayComponents = {
CircleButton: props => <Button {...props} />,
TextButton: props => <Button {...props} />,
AdditionIcon: () => <div>+</div>,
RemoveIcon: () => <div>-</div>,
MoveDownIcon: () => <div>Down</div>,
MoveUpIcon: () => <div>Up</div>
}
const RowStyleLayout = styled(props => <div {...props} />)`
.ant-btn {
margin-right: 16px;
}
.ant-form-item {
display: inline-flex;
margin-right: 16px;
margin-bottom: 10px;
}
> .ant-form-item {
margin-bottom: 0;
margin-right: 0;
}
`
const InvoiceArray = (props) => {
const { value, schema, className, editable, path, mutators } = props
const {
renderAddition,
renderRemove,
renderMoveDown,
renderMoveUp,
renderEmpty,
renderExtraOperations,
...componentProps
} = schema.getExtendsComponentProps() || {}
console.log(componentProps);
const onAdd = () => {
const items = Array.isArray(schema.items)
? schema.items[schema.items.length - 1]
: schema.items
mutators.push(items.getEmptyValue())
}
const length = toArr(value).length;
return (
<ArrayList
value={value}
minItems={schema.minItems}
maxItems={schema.maxItems}
editable={editable}
components={ArrayComponents}
renders={{
renderAddition,
renderRemove,
renderMoveDown,
renderMoveUp,
renderEmpty // 允许开发者覆盖默认
}}
>
{toArr(value).map((item, index) => {
return (
<RowStyleLayout {...componentProps} key={index}>
<div style={{display: 'flex'}}>
<SchemaField path={FormPath.parse(path).concat(index)} />
{
length - 1 === index
? <Button onClick={onAdd} style={{marginLeft: '-16px'}}><PlusOutlined width={44}/></Button>
: null
}
<Button
style={{marginLeft: length - 1 === index ? '0' : '-16px'}}
onClick={() => mutators.remove(index)}
>
<MinusOutlined width={44}/>
</Button>
</div>
</RowStyleLayout>
)
})}
<ArrayList.Empty>
{({ children }) => {
return (
<div className="array-cards-addition" onClick={onAdd}>
{/* {children} */}
<Button>添加</Button>
</div>
)
}}
</ArrayList.Empty>
<ArrayList.Addition>
{({ children, isEmpty }) => {
if (!isEmpty) {
return null
}
}}
</ArrayList.Addition>
</ArrayList>
)
}
InvoiceArray.isFieldComponent = true;
export default InvoiceArray
\ No newline at end of file
/*
* @Author: Bill
* @Date: 2020-10-28 14:11:55
* @Description: 开票详情 drawer
*/
import React, { useEffect, useState } from 'react';
import { Drawer, Input, DatePicker } from 'antd';
import InvoiceInfo from './InvoiceInfo';
import {
SchemaForm,
SchemaField,
SchemaMarkupField as Field
} from '@formily/antd'
import InvoiceArray from './InvoiceArray';
import moment from 'moment';
import { Button } from 'antd';
import { createFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
const formActions = createFormActions();
const InvoiceDrawer = (props) => {
const { visible, title, onCancel, width } = props;
const [invoiceInfo, setInvoiceInfo] = useState({})
const handleSubmit = () => {
formActions.submit()
}
const handleForm = (value) => {
console.log(value);
}
useEffect(() => {
if(props.visible) {
///settle/accounts/member/settlement/getInvoiceProveDetail
PublicApi.getSettleAccountsMemberSettlementGetInvoiceProveDetail({id: props.id})
.then((data) => {
if(data.code === 1000) {
setInvoiceInfo(data.data)
}
})
}
}, [props.id, props.visible])
return (
<Drawer visible={visible} title={title} width={width} onClose={onCancel} footer={
<div
style={{
textAlign: 'right',
}}
>
<Button onClick={onCancel} style={{ marginRight: 8 }}>
取消
</Button>
<Button onClick={handleSubmit} type="primary">
确认
</Button>
</div>
}>
<InvoiceInfo infos={invoiceInfo} />
<div style={{display: 'flex', margin: '50px 0 15px 0'}}>
<div style={{width: '170px', marginRight: '16px'}}>发票号码</div>
<div style={{width: '140px', marginRight: '16px'}}>开票日期</div>
<div>备注</div>
</div>
<SchemaForm onSubmit={handleForm} actions={formActions} components={{ InvoiceArray, Input, DatePicker }}>
<Field
name="userList"
type="array"
x-component="InvoiceArray"
>
<Field type="object">
<Field name="no" x-component="Input" x-rules={[{required: true, message: '请填写发票号'}]} />
<Field name="date" x-component="DatePicker" x-rules={[{required: true, message: '请选择发票日期'}]} />
<Field name="desc" x-component="Input" x-component-props={{style: {width: '240px'}}} />
</Field>
</Field>
</SchemaForm>
</Drawer>
)
}
export default InvoiceDrawer
\ No newline at end of file
/*
* @Author: Bill
* @Date: 2020-10-28 13:46:39
* @Description: 开票详情 内容
*/
import React from 'react';
import { Row, Col } from 'antd';
interface Iprops {
infos: any
}
const infoList = [
{ title: '开具类型', dataIndex: 'typeName' },
{ title: '发票种类', dataIndex: 'kindName'},
{ title: '发票抬头', dataIndex: 'invoiceTitle' },
{ title: '纳税号', dataIndex: 'taxNo' },
{ title: '开户行', dataIndex: 'bankOfDeposit'},
{ title: '账号', dataIndex: 'account' },
{ title: '地址', dataIndex: 'address' },
{ title: '电话', dataIndex: 'tel' }
]
const InvoiceInfo: React.FC<Iprops> = (props) => {
const { infos } = props;
return (
<>
{
infoList.map((item) => {
return (
<Row style={{marginBottom: '24px', fontSize: '13px'}} key={item.dataIndex}>
<Col span={3} style={{color: '#909399'}}>{item.title}</Col>
<Col span={16}>{infos && infos[item.dataIndex]}</Col>
</Row>
)
})
}
</>
)
}
export default InvoiceInfo
\ No newline at end of file
import InvoiceDrawer from './InvoiceDrawer';
import InvoiceDrawer1 from './InvoiceDrawer'
export default InvoiceDrawer1
\ No newline at end of file
......@@ -41,7 +41,7 @@ const priceTypeMaps = {
const all = [{
label: '所有',
value: '0'
value: 0
}];
const transferLabelToValue = (list: any[], label: string, value: string) => {
......@@ -248,7 +248,7 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
...params,
shopType: shopType,
memberIds: channelMemberIdList,
roleId: channelMemberRoleId
// roleId: channelMemberRoleId
}
const res = await PublicApi.postMemberManageAllPageByshoptype(data, {ctlType: 'none'});
return res.data
......
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