Commit 3257c0b0 authored by beisir's avatar beisir

feat: 商户管理后台完结

parent a49db38b
import React, { useState, forwardRef, useImperativeHandle } from 'react';
import { Form } from '@ant-design/compatible';
import { Modal, Button } from 'antd';
// 0: 待财务审核
// 1: 审核通过
// 2: 审核拒绝,
const ExamineFormModal = forwardRef((props, ref) => {
const { form, claimVisible, closeClaimDescription, refresh } = props;
const [detailData, setDetailData] = useState({});
useImperativeHandle(ref, () => ({
setDetailData,
...form,
}));
const onCancelEvent = () => {
closeClaimDescription();
};
const footerButton = [
<Button type="primary" key="cancel" onClick={onCancelEvent}>
关闭
</Button>,
];
return (
<Modal
title="赔款说明"
centered
visible={claimVisible}
footer={detailData.audit ? footerButton : null}
bodyStyle={{ padding: '12px 0' }}
onCancel={onCancelEvent}
></Modal>
);
});
export default Form.create()(ExamineFormModal);
// import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
// import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
// import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
// import { columns, auditStatusValueEnum } from './staticdata'; import { Button, Image } from 'antd';
// import { accountApplyList, accountApplyDetail } from './service'; import { saveAs } from 'file-saver';
// import ExamineFormModal from './ExamineFormModal'; import { columnsConfig, getLastItem, checkImage } from './staticdata';
// import styled from './index.less'; import { getQueryClamsList } from './service';
// import { getAppChannelAllList } from '@/services/common'; import ClaimDescription from './ClaimDescription';
// /** /**
// * 渠道管理-审批记录 和 财务管理-资金审核 * 售后赔款单
// * 共用一个页面 * 售后赔款单
// * @param {*} router options * @param {*} router options
// * @returns ReactDOM * @returns ReactDOM
// */ */
// const CapitalExamine = ({ route }) => { const AfterSalesClaimForm = ({ route }) => {
// const isAudit = route.name === 'capitalExamine'; // 是否时资金审核页面 const ref = useRef();
// const ref = useRef(); const actionRef = useRef();
// const actionRef = useRef(); const [claimVisible, setclaimVisible] = useState(false);
// const [examVisible, setExamVisible] = useState(false); const [claimLoading, setclaimLoading] = useState(false);
// const [examLoading, setExamLoading] = useState(false); const [imagePreView, setImagePreView] = useState({
// const [channelAllList, setChannelAllList] = useState({}); src: '',
// const search = { visible: false,
// collapsed: false, });
// collapseRender: () => null, const search = {
// }; collapsed: false,
collapseRender: () => null,
};
// const query = async param => { const query = async params => {
// const timeArray = param?.createdAt; const { createdAt, singleType, singleNumber, current: pageNo, ...other } = params;
// if (timeArray?.length) { const queryParams = { ...other, pageNo };
// const [createdStartAt, createdEndAt] = timeArray; if (singleType && singleNumber) {
// param.createdStartAt = createdStartAt; if (+singleType === 0) queryParams.id = singleNumber;
// param.createdEndAt = createdEndAt; if (+singleType === 1) queryParams.orderNo = singleNumber;
// delete param.createdAt; }
// } if (createdAt?.length) {
// const [data] = await accountApplyList(param); const [startTime, endTime] = createdAt;
// return { queryParams.startTime = startTime;
// total: data.total, queryParams.endTime = endTime;
// data: data?.records, }
// }; const { data } = await getQueryClamsList(queryParams);
// }; return {
total: data.total,
data: data?.records,
};
};
// const openExamineFormModal = async (row, audit) => { const openSetclaimModal = async (row, audit) => {
// setExamLoading(true); setclaimLoading(true);
// const [data, error] = await accountApplyDetail(row.id); setclaimVisible(true);
// if (!error) { setclaimLoading(false);
// data.audit = !!audit; };
// data.auditStatusName = auditStatusValueEnum[data.auditStatus].text;
// actionRef.current.setDetailData(data);
// setExamVisible(true);
// }
// setExamLoading(false);
// };
// const closeExamineFormModal = () => { const closeClaimDescription = () => {
// setExamVisible(false); setclaimVisible(false);
// }; };
// const columsOptions = { const refreshTable = () => {
// isAudit, ref.current.reload();
// openExamineFormModal, };
// channelAllList, // eslint-disable-next-line consistent-return
// }; const downLoadFile = async url => {
// // 获取所有渠道 if (await checkImage(url)) {
// const getChannelAllList = async () => { setImagePreView({ src: url, visible: true });
// const [data] = (await getAppChannelAllList()) || []; return null;
// const list = {}; }
// if (data) { saveAs(url, getLastItem(url));
// data.forEach(item => { };
// list[item.id] = item.name;
// });
// setChannelAllList(list);
// }
// };
// const refreshTable = () => { const toolBarRender = () => [
// ref.current.reload(); <Button type="link" onClick={openSetclaimModal}>
// }; 赔款说明
</Button>,
];
// useEffect(() => { const onReset = () => {};
// getChannelAllList();
// }, []);
// const onReset = () => {};
// return ( return (
// <PageHeaderWrapper> <PageHeaderWrapper>
// <ProTable <ProTable
// bordered bordered
// loading={examLoading} loading={claimLoading}
// type="cardList" type="cardList"
// request={query} request={query}
// className={styled.tableProName} tableClassName="capital"
// tableClassName="capital" columns={columnsConfig({ downLoadFile })}
// columns={columns(columsOptions, 'parent')} rowKey={row => row.id}
// rowKey={(_, index) => index} search={search}
// search={search} options={false}
// options={false} actionRef={ref}
// actionRef={ref} toolBarRender={toolBarRender}
// toolBarRender={false} pagination={{ pageSize: 10 }}
// pagination={{ onReset={onReset}
// pageSize: 10, scroll={{ x: '100%', y: 430 }}
// }} />
// onReset={onReset} <ClaimDescription
// // toolBarRender={[]} refresh={refreshTable}
// scroll={{ x: '100%', y: 430 }} claimVisible={claimVisible}
// ></ProTable> wrappedComponentRef={actionRef}
// <ExamineFormModal closeClaimDescription={closeClaimDescription}
// refresh={refreshTable} />
// examVisible={examVisible} <Image
// wrappedComponentRef={actionRef} width={200}
// closeExamineFormModal={closeExamineFormModal} style={{ display: 'none' }}
// /> src={imagePreView.src}
// </PageHeaderWrapper> preview={{
// ); visible: imagePreView.visible,
// }; scaleStep: '1',
src: imagePreView.src,
onVisibleChange: value => {
setImagePreView({
src: '',
visible: false,
});
},
}}
/>
</PageHeaderWrapper>
);
};
// export default CapitalExamine; export default AfterSalesClaimForm;
import request from '@/utils/request';
import config from '@/../config/env.config';
export const getQueryClamsList = params =>
request.post('/api/kdsp/queryClams', {
prefix: config.goodsApi,
data: params || {},
});
import React from 'react';
import { Image as ImageComponent, Button } from 'antd';
export const getLastItem = thePath => thePath.substring(thePath.lastIndexOf('/') + 1);
export const isImageType = url => {
const index = url.lastIndexOf('.');
const ext = url.substr(index + 1);
return ['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].includes(
ext.toLowerCase(),
);
};
export const checkImage = url =>
new Promise(resolve => {
const image = new Image();
image.onload = () => {
resolve(true);
};
image.onerror = () => {
resolve(false);
};
image.src = url;
});
const csListStyle = {
color: '#1890FF',
textAlign: 'left',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
overflow: 'hidden',
cursor: 'pointer',
};
export const typeConfig = {
1: {
text: '退运费',
},
2: {
text: '商品破损',
},
};
const singleNumberSearch = {
0: {
text: '赔款单号',
},
1: {
text: '订单编号',
},
};
export const columnsConfig = props => [
{
title: '单号搜索',
key: 'singleType',
dataIndex: 'singleType',
hideInTable: true,
valueEnum: singleNumberSearch,
},
{
key: 'singleNumber',
dataIndex: 'singleNumber',
hideInTable: true,
},
{
title: '赔款单号',
key: 'id',
dataIndex: 'id',
align: 'center',
hideInSearch: true,
},
{
title: '订单号',
key: 'orderNo',
dataIndex: 'orderNo',
align: 'center',
hideInSearch: true,
},
{
title: '赔款金额',
key: 'amount',
dataIndex: 'amount',
align: 'center',
width: 100,
hideInSearch: true,
},
{
title: '赔款类型',
key: 'type',
dataIndex: 'type',
align: 'center',
valueEnum: typeConfig,
},
{
title: '索赔原因',
key: 'reason',
dataIndex: 'reason',
align: 'center',
hideInSearch: true,
},
{
title: '退款说明',
key: 'remark',
dataIndex: 'remark',
align: 'center',
ellipsis: true,
hideInSearch: true,
},
{
title: '创建时间',
key: 'createdAt',
dataIndex: 'createdAt',
align: 'center',
valueType: 'dateRange',
},
{
title: '用户凭证',
key: 'proof',
dataIndex: 'proof',
align: 'center',
width: 190,
hideInSearch: true,
render: value =>
(value.userList || []).map(item => (
<ImageComponent style={{ paddingLeft: 5, marginTop: 5 }} key={item} width={50} src={item} />
)),
},
{
title: '审核意见',
key: 'proof',
dataIndex: 'proof',
align: 'center',
width: 190,
hideInSearch: true,
render: value =>
(value.csList || []).map(item => (
<div style={csListStyle} onClick={() => props.downLoadFile(item)}>
{item}
</div>
)),
},
];
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