Commit 8c43537a authored by XieZhiXiong's avatar XieZhiXiong

完善

parent 6459d24c
import React from 'react';
import { FilePdfOutlined, FileWordOutlined, FileOutlined } from '@ant-design/icons';
import { FilePdfFilled, FileWordFilled, FileFilled } from '@ant-design/icons';
import { PublicApi } from '@/services/api'
import styles from './index.less';
......@@ -13,9 +13,9 @@ interface ContractList {
};
const IconMap = {
'.pdf': <FilePdfOutlined />,
'.doc': <FileWordOutlined />,
'.doxc': <FileWordOutlined />,
'.pdf': <FilePdfFilled />,
'.doc': <FileWordFilled />,
'.doxc': <FileWordFilled />,
};
const ContractItem: React.FC<ContractItem> = ({
......@@ -36,7 +36,7 @@ const ContractItem: React.FC<ContractItem> = ({
<li className={styles['contractList-item']} onClick={() => handleDownload(fileName, electronicContractUrl)}>
<a>
<div className={styles['contractList-item-icon']}>
{IconMap[suffix] || <FileOutlined />}
{IconMap[suffix] || <FileFilled />}
</div>
<div
className={styles['contractList-item-name']}
......
@import '../../../../../../global/styles/utils.less';
.contractList {
padding: 0;
margin: 0;
&-item {
padding: 6px 8px;
background: #F4F5F7;
border-radius: 4px;
list-style: none;
> a {
display: flex;
align-items: center;
}
&-icon {
flex-shrink: 0;
margin-right: 4px;
color: #7178EA;
}
&-name {
flex: 1;
.textOverflow();
}
&:not(:last-child) {
margin-bottom: 8px;
}
}
}
.noData {
color: #909399;
}
\ No newline at end of file
import React from 'react';
import { FilePdfFilled, FileWordFilled, FileFilled } from '@ant-design/icons';
import { PublicApi } from '@/services/api'
import styles from './index.less';
interface ContractItem {
electronicContractUrl?: string;
electronicContractName?: string;
};
interface ContractList {
dataSource: ContractItem[];
};
const IconMap = {
'.pdf': <FilePdfFilled />,
'.doc': <FileWordFilled />,
'.doxc': <FileWordFilled />,
};
const ContractItem: React.FC<ContractItem> = ({
electronicContractUrl,
electronicContractName,
}) => {
const index1 = electronicContractUrl.lastIndexOf('.');
const suffix = electronicContractUrl.slice(index1);
const index2 = electronicContractUrl.lastIndexOf('/');
// 如果没有文件名,但是有链接就从链接截取文件名
const fileName = electronicContractName ? electronicContractName : electronicContractUrl.slice(index2 + 1);
const handleDownload = (name, url) => {
window.location.href = `/api/order/contractTemplate/downloadContract?contractName=${name}&contractUrl=${url}`;
};
return (
<li className={styles['contractList-item']} onClick={() => handleDownload(fileName, electronicContractUrl)}>
<a>
<div className={styles['contractList-item-icon']}>
{IconMap[suffix] || <FileFilled />}
</div>
<div
className={styles['contractList-item-name']}
title={fileName}
>
{fileName}
</div>
</a>
</li>
);
};
const ContractList: React.FC<ContractList> = ({ dataSource }) => {
if (!Array.isArray(dataSource)) {
return <div className={styles.noData}>没有相关数据~</div>;
}
return (
<ul className={styles.contractList}>
{dataSource.map((item, index) => (
<ContractItem
key={index}
electronicContractUrl={item.electronicContractUrl}
electronicContractName={item.electronicContractName}
/>
))}
</ul>
);
};
export default ContractList;
\ No newline at end of file
......@@ -6,6 +6,7 @@ import { formatTimeString } from '@/utils'
import { DELIVERY_TYPE } from '@/constants'
import style from './index.less'
import { PublicApi } from '@/services/api'
import ContractList from '../ContractList'
export interface OrderMergeInfoProps { }
const payInfo = [
......@@ -64,20 +65,31 @@ const OrderMergeInfo: React.FC<OrderMergeInfoProps> = (props) => {
}
return (
<Row style={{ marginTop: 24 }}>
<Row style={{ marginTop: 24 }} gutter={24}>
<Col span={12}>
<MellowCard title='交易信息' blockClassName={style.fullHeight} className={style.fullHeight}>
<MellowCard title='交易信息' fullHeight>
<RenderCard infoList={payInfo} dataSource={data} />
</MellowCard>
</Col>
<Col span={6} push={1}>
<MellowCard title='其他信息' blockClassName={style.fullHeight} className={style.fullHeight}>
<Col span={6}>
<MellowCard title='其他信息' fullHeight>
<RenderCard infoList={otherInfo} dataSource={data} />
</MellowCard>
</Col>
<Col span={4} push={2}>
<MellowCard title='电子合同' blockClassName={style.fullHeight} className={style.fullHeight}>
<RenderCard infoList={electronInfo} dataSource={data} />
<Col span={6}>
<MellowCard title='电子合同' fullHeight>
<ContractList
dataSource={
data.electronicContractUrl ?
[
{
electronicContractUrl: data.electronicContractUrl,
electronicContractName: data.electronicContractName,
},
] :
null
}
/>
</MellowCard>
</Col>
</Row>
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-25 18:28:47
* @LastEditTime: 2020-09-28 20:19:46
* @Description: 联动逻辑相关
*/
import { FormEffectHooks, FormPath } from '@formily/antd';
......@@ -433,7 +433,7 @@ export const useBusinessEffects = (context, actions) => {
return `invoicesDetailsRequests.${$1}.amount`
}),
state => {
state.value = '';
state.value = `¥${(+value * current.price).toFixed(2)}`;
}
);
});
......
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