Commit 5ad8cbc2 authored by Bill's avatar Bill

feat: 添加加工税率字段以及添加结算单据类型跳转链接

parent 210bd253
......@@ -10,6 +10,12 @@ import moment from 'moment';
type BalanceInfoType = { id: number, settlementId: number, roleId: number }
const format = "YYYY-MM-DD HH:mm:ss"
const URL_MAP = {
1: "productNoticeSettlementDetail",
2: "logisticsDetail",
3: "orderDetail",
4: '',
}
function useFetchColumns(mode: 'payable' | 'receiveable') {
/**
......@@ -115,9 +121,13 @@ function useFetchColumns(mode: 'payable' | 'receiveable') {
dataIndex: 'settlementNo',
render: (text, record) => {
const prefix = mode === 'payable' ? `/memberCenter/balance/accountsPayable/settlementList/` : '/memberCenter/balance/accountsReceivable/settlementList/';
const url = record.orderType === 2 ? `logisticsDetail` : `productNoticeSettlementDetail`;
const url = URL_MAP[record.orderType];
let fullUrl = `${prefix}${url}?id=${record.id}`;
if(record.orderType === 4) {
fullUrl = `/memberCenter/contract/funds/bill/details?applyId=${record.id}`;
}
return (
<EyePreview url={`${prefix}${url}?id=${record.id}`} >
<EyePreview url={fullUrl} >
{record.settlementNo}
</EyePreview>
)
......
......@@ -62,7 +62,7 @@ const MemberSettleAdd: React.FC = () => {
{
isAdd || isEdit
? <Button
onClick={() => setVisible(true)}
onClick={handleVisible}
style={{marginBottom: 16}}
block
icon={<PlusOutlined/>}
......@@ -91,6 +91,10 @@ const MemberSettleAdd: React.FC = () => {
: []
);
const handleVisible = () => {
setVisible(true);
}
const handleCancelAddMember = () => {
setVisible(false);
}
......@@ -107,8 +111,11 @@ const MemberSettleAdd: React.FC = () => {
// 获取适用会员
const fetchMemberData = async (params: any) => {
//member/manage/lower/page/bynamerole
const { data } = await PublicApi.getMemberManageLowerPageBynamerole(params);
console.log(params);
// 如果单据类型是订单,获取当前会员的上级会员,如果是生产通知单和物流单那么获取他的下级
const isOrderType = formActions.getFieldValue('Tabs.basicTab.layout.settlementOrderType') === 3;
const service = isOrderType ? PublicApi.getMemberManageUpperPage : PublicApi.getMemberManageLowerPageBynamerole
const { data } = await service(params);
return {
...data,
data: data.data.map((v) => ({...v, uniqueId: v.memberId + "_" + v.roleId})),
......@@ -132,7 +139,16 @@ const MemberSettleAdd: React.FC = () => {
// 提交
const handleSubmit = (value) => {
const memberList = value.someLists.map((item) => ({ memberId: item.memberId, roleId: item.roleId }));
const memberList = value.someLists.map((item) => (
{
memberId: item.memberId,
roleId: item.roleId,
memberName: item.name,
memberTypeName: item.memberTypeName,
roleName: item.roleName,
levelName: item.levelTag,
}
));
const tempData = {
name: value.name,
settlementOrderType: value.settlementOrderType,
......@@ -145,8 +161,11 @@ const MemberSettleAdd: React.FC = () => {
? PublicApi.postSettleAccountsPlatformConfigAddMemberSettlementStrategy
: PublicApi.postSettleAccountsPlatformConfigUpdateMemberSettlementStrategy
const postData = {...tempData, id: id || 0 }
let postData: any = tempData;
if(!isAdd) {
postData = { ...postData, id: id };
}
// return;
setSubmitLoading(true);
setUnsaved(false);
serviceActions(postData).then((data) => {
......@@ -207,8 +226,6 @@ const MemberSettleAdd: React.FC = () => {
} else {
message.error({content: res.message})
}
}
getInfo();
}
......@@ -248,6 +265,7 @@ const MemberSettleAdd: React.FC = () => {
modalTitle='选择适用会员'
confirm={handleOkAddMember}
cancel={handleCancelAddMember}
forceRender
visible={visible}
columns={common_columns}
rowSelection={memberRowSelection}
......
......@@ -155,7 +155,7 @@ export const memberSchema = {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '商品名称',
placeholder: '会员名称',
align: 'flex-left',
},
},
......
......@@ -6,6 +6,17 @@ export const productColumns = [
{ title: '品类', dataIndex: 'customerCategoryName' },
{ title: '品牌', dataIndex: 'brandName' },
{ title: '单位', dataIndex: 'unitName' },
{
title: '是否含税',
dataIndex: 'isHasTax',
render: (text) => parseInt(text) === 1 ? '是' : '否',
},
{
title: '税率',
dataIndex: 'taxRate',
render: (text) => (text) > 0 ? `${text}%` : '0%'
},
// { title: '订单数量', dataIndex: 'orderTotal' },
// { title: '剩余加工数量', dataIndex: 'restTotal' },
{ title: '加工数量', dataIndex: 'processNum' },
......@@ -14,15 +25,25 @@ export const productColumns = [
]
export const orderColumns = [
{ title: '订单号', dataIndex: 'orderNo' },
{ title: '商品ID', dataIndex: 'commodityId' },
{ title: '商品名称', dataIndex: 'name' },
{ title: '品类', dataIndex: 'customerCategoryName' },
{ title: '品牌', dataIndex: 'brandName' },
{ title: '单位', dataIndex: 'unitName' },
{ title: '订单数量', dataIndex: 'orderTotal' },
{ title: '剩余加工数量', dataIndex: 'restTotal' },
{ title: '加工数量', dataIndex: 'processNum' },
{ title: '加工单价', dataIndex: 'processUnitPrice' },
{ title: '加工费', dataIndex: 'processTotalPrice'},
{ title: '订单号', dataIndex: 'orderNo' },
{ title: '商品ID', dataIndex: 'commodityId' },
{ title: '商品名称', dataIndex: 'name' },
{ title: '品类', dataIndex: 'customerCategoryName' },
{ title: '品牌', dataIndex: 'brandName' },
{ title: '单位', dataIndex: 'unitName' },
{ title: '订单数量', dataIndex: 'orderTotal' },
{ title: '剩余加工数量', dataIndex: 'restTotal' },
{
title: '是否含税',
dataIndex: 'isHasTax',
render: (text) => parseInt(text) === 1 ? '是' : '否',
},
{
title: '税率',
dataIndex: 'taxRate',
render: (text) => (text) > 0 ? `${text}%` : '0%'
},
{ title: '加工数量', dataIndex: 'processNum' },
{ title: '加工单价', dataIndex: 'processUnitPrice' },
{ title: '加工费', dataIndex: 'processTotalPrice'},
]
......@@ -127,6 +127,8 @@ const Add: React.FC<{}> = () => {
restTotal: item.surplusProcessNum,
files: item.property.annex,
productProps: item.property.specs,
isHasTax: item.isHasTax,
taxRate: item.taxRate,
...orderData
}
})
......@@ -192,6 +194,8 @@ const Add: React.FC<{}> = () => {
productId={record.commodityId}
brand={record.brandName}
category={record.customerCategoryName}
isHasTax={record.isHasTax}
taxRate={record.taxRate}
productName={record.name}
unitName={record.unitName}
files={files}
......@@ -211,7 +215,8 @@ const Add: React.FC<{}> = () => {
productName={record.name}
unitName={record.unitName}
files={files}
isHasTax={record.isHasTax}
taxRate={record.taxRate}
>
<a>编辑</a>
</ProcessDetail>
......@@ -360,6 +365,8 @@ const Add: React.FC<{}> = () => {
processPrice: item.processUnitPrice * 1 || 0,
processTotalPrice: item.processTotalPrice * 1,
deliveryDate: deliveryDateFormat,
isHasTax: item.isHasTax,
taxRate: item.taxRate,
property:{
specs: item.productProps || [],
annex: item.files && item.files.map((item) => ({name: item.name, value: item.url})) || []
......@@ -416,6 +423,8 @@ const Add: React.FC<{}> = () => {
processNum: values.process.quantity,
processUnitPrice: values.process.processUnitPrice,
processTotalPrice: values.process.quantity * values.process.processUnitPrice,
isHasTax: values.process.isHasTax,
taxRate: values.process.taxRate,
productProps: values.productProps,
files: values.files
}
......@@ -431,7 +440,6 @@ const Add: React.FC<{}> = () => {
formActions.setFieldValue(keyName, [...someList])
!!onOk && onOk();
}
}
}
......@@ -500,7 +508,7 @@ const Add: React.FC<{}> = () => {
visible={modalEnterPriseVisible}
cancel={() => setEnterPriseModalVisible(false)}
onOk={enterPriseOnOk}
></EnterPrise>
/>
{/* 加工商品Modal框 */}
<ProcessProducts
visible={modalProductVisible}
......@@ -508,7 +516,7 @@ const Add: React.FC<{}> = () => {
onOk={processProductSelected}
rowSelection={productTableRowSelection.rowSelection}
loading={productTableRowSelection.loading}
></ProcessProducts>
/>
<ProcessOrder
visible={modalOrderVisible}
......@@ -516,8 +524,8 @@ const Add: React.FC<{}> = () => {
onOk={processOrderOnok}
rowSelection={orderTableRowSelection.rowSelection}
loading={orderTableRowSelection.loading}
>
</ProcessOrder>
/>
</Card>
</PageHeaderWrapper>
)
......
......@@ -48,6 +48,17 @@ export const columns: ColumnsType<any> = [
dataIndex: 'processNum',
},
{
title: '含税',
dataIndex: 'isHasTax',
render: (text) => text === 1 ? '是' : '否'
},
{
title: '税率',
dataIndex: 'taxRate',
render: (text) => text + "%",
},
{
title: '加工单价',
dataIndex: 'processPrice',
},
......
......@@ -2,6 +2,7 @@ import React, { useState, useRef, useEffect, useImperativeHandle, useMemo, useCa
import styles from './content.less';
import { Row, Col } from 'antd';
import classnames from 'classnames';
import { Radio } from '@formily/antd-components'
import {FileList, UploadFile} from '../../components/UploadFile';
import NiceForm from '@/components/NiceForm';
import { createFormActions } from '@formily/antd'
......@@ -47,6 +48,41 @@ const schema = {
message: '请填写整数或保留三位小数'
}
]
},
isHasTax: {
title: '是否含税',
'x-component': 'RadioGroup',
enum: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
default: 1,
"x-linkages": [
{
"type": "value:visible",
"target": "*(layout.taxRate)",
"condition": "{{ $self.value === 1 }}",
},
],
'x-rules': [
{
required: true,
message: '请选择是否含税'
},
]
},
taxRate: {
type: 'string',
title: '税率',
'x-rules': [
{
required: true,
message: '请填写税率'
},
],
'x-component-props': {
addonAfter: "%"
}
}
}
}
......@@ -66,11 +102,13 @@ interface Iprops {
formSubmit?: (value: any) => void,
type: 'edit' | 'view',
fileOnChange?: (value: any) => void
ref?: any
ref?: any,
isHasTax: number,
taxRate: number,
}
const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
const { id, name, category, brand, unitName, files, productProps, quantity, processUnitPrice } = props;
const { id, name, category, brand, unitName, files, productProps, quantity, processUnitPrice, isHasTax, taxRate } = props;
const [menu, setMenu] = useState([])
// const ref = useRef(null);
const [scroll, ref] = useScroll<HTMLDivElement>();
......@@ -206,22 +244,33 @@ const Content: React.FC<Iprops> = React.forwardRef((props, conftentRef) => {
schema={schema}
actions={actions}
// onSubmit={props.formSubmit}
components={{
Radio,
RadioGroup: Radio.Group
}}
onSubmit={handleFormSubmit}
initialValues={{
quantity: quantity,
processUnitPrice: processUnitPrice
processUnitPrice: processUnitPrice,
isHasTax: isHasTax,
taxRate: taxRate,
}}
/>
: (
<>
<Row className={styles.infoRow}>
<Col className={styles.label} span={4}>加工数量</Col>
<Col span={12}>{quantity}</Col>
</Row>
<Row className={styles.infoRow}>
<Col className={styles.label} span={4}>加工单价</Col>
<Col span={12}>{processUnitPrice}</Col>
</Row>
<Row className={styles.infoRow}>
<Col className={styles.label} span={4}>加工数量</Col>
<Col span={12}>{quantity}</Col>
</Row>
<Row className={styles.infoRow}>
<Col className={styles.label} span={4}>加工单价</Col>
<Col span={12}>{processUnitPrice}</Col>
</Row>
<Row className={styles.infoRow}>
<Col className={styles.label} span={4}>是否含税/税率</Col>
<Col span={12}>{isHasTax ? `是/${taxRate}` : '否'}</Col>
</Row>
</>
)
}
......
......@@ -18,6 +18,8 @@ interface Iprops {
unitName: string,
uniqueID: string,
files: any[],
isHasTax: number,
taxRate: number,
}
interface IfileProps {
......@@ -78,12 +80,15 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
return {
...prevState,
quantity: props.quantity,
processUnitPrice: props.processUnitPrice
processUnitPrice: props.processUnitPrice,
isHasTax: props.isHasTax,
taxRate: props.taxRate,
}
})
}, [props.quantity, props.processUnitPrice])
}, [props.quantity, props.processUnitPrice, props.isHasTax, props.taxRate])
const formSubmit = (values) => {
console.log(values);
!!props.submit && props.submit(
{
files: files,
......@@ -131,25 +136,30 @@ const ProcessDetail: React.FC<Iprops> = (props) => {
>
{
visible
? <Content
name={info?.name}
id={info?.productId}
brand={info?.brand}
category={info?.category}
unitName={info?.unitName}
productProps={info?.attributes}
quantity={info?.quantity}
processUnitPrice={info?.processUnitPrice}
type={props.type}
files={files}
fileOnChange={fileOnChange}
formSubmit={formSubmit}
ref={contentRef}
// actions={actions}
/>
? (
<Content
name={info?.name}
id={info?.productId}
brand={info?.brand}
category={info?.category}
unitName={info?.unitName}
productProps={info?.attributes}
quantity={info?.quantity}
processUnitPrice={info?.processUnitPrice}
type={props.type}
files={files}
fileOnChange={fileOnChange}
formSubmit={formSubmit}
ref={contentRef}
taxRate={info.taxRate}
isHasTax={info.isHasTax}
// actions={actions}
/>
)
: null
}
</Drawer>
</>
)
......
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