Commit f427a5b5 authored by Bill's avatar Bill

Merge branch 'dev' of 10.0.0.22:lingxi/lingxi-business-paltform into dev

parents ea77b83b 76227308
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-25 11:22:40
* @LastEditTime: 2020-12-10 17:56:20
* @Description: 维修商品抽屉组件
*/
import React, { useState, useEffect } from 'react';
......@@ -392,6 +392,13 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
}) :
[]
,
// 计算已支付金额,采购单价 * 支付比例 累加
payAmount:
item.payInfoList ?
item.payInfoList.reduce((prev, now) => {
return +((product.price * product.purchaseCount * (now.payRatio / 100)).toFixed(2)) + prev;
}, 0) :
0
});
}
});
......
import React, { useState } from 'react';
import { Descriptions, Space, Button } from 'antd';
interface bankAccount {
id: number,
name: string,
bankAccount: string,
bankDeposit: string,
memberId: number,
};
interface BalanceProps {
/**
* 弹窗需要的数据值
*/
value: {[key: string]: any};
/**
* 关闭事件
*/
handleModalVisible: () => void;
/**
* 弹窗内确认事件
*/
handleConfirm: (values: {[key: string]: any}, modalName: string) => void;
/**
* 弹窗提交 loading
*/
submitLoading: boolean;
};
const Balance: React.FC<BalanceProps> = ({
handleModalVisible,
handleConfirm,
value,
submitLoading,
}) => {
const [bankAccount, setBankAccount] = useState<bankAccount>({
id: 0,
name: '',
bankAccount: '',
bankDeposit: '',
memberId: 0,
});
return (
<>
<Descriptions title="账户余额信息" column={1}>
<Descriptions.Item label="账户可用余额">¥500000.00</Descriptions.Item>
<Descriptions.Item label="当前退款金额">
<span style={{ color: '#EF6260' }}>¥6000.00</span>
</Descriptions.Item>
</Descriptions>
<div style={{ marginTop: 20, textAlign: 'center' }}>
<Space>
<Button onClick={handleModalVisible}>
取消
</Button>
<Button
type="primary"
onClick={() => handleConfirm(value, 'balance')}
loading={submitLoading}
>
退款
</Button>
</Space>
</div>
</>
)
};
export default Balance;
\ No newline at end of file
import React, { useState } from 'react';
import { Descriptions, Space, Button } from 'antd';
interface bankAccount {
id: number,
name: string,
bankAccount: string,
bankDeposit: string,
memberId: number,
};
interface BalanceProps {
/**
* 弹窗需要的数据值
*/
value: {[key: string]: any};
/**
* 关闭事件
*/
handleModalVisible: () => void;
/**
* 弹窗内确认事件
*/
handleConfirm: (values: {[key: string]: any}, modalName: string) => void;
/**
* 弹窗提交 loading
*/
submitLoading: boolean;
};
const COD: React.FC<BalanceProps> = ({
handleModalVisible,
handleConfirm,
value,
submitLoading,
}) => {
const [bankAccount, setBankAccount] = useState<bankAccount>({
id: 0,
name: '',
bankAccount: '',
bankDeposit: '',
memberId: 0,
});
return (
<>
<p>
支付方式为货到付款的订单,用户确认退款方式与退款金额后,
系统会按照退款流程来完成退款动作,实际资金的退款结算由
交易双方线下处理。
</p>
<Descriptions column={1}>
<Descriptions.Item label="支付方式">货到付款</Descriptions.Item>
<Descriptions.Item label="退款金额">
<span style={{ color: '#EF6260' }}>¥6000.00</span>
</Descriptions.Item>
</Descriptions>
<div style={{ marginTop: 20, textAlign: 'center' }}>
<Space>
<Button onClick={handleModalVisible}>
取消
</Button>
<Button
type="primary"
onClick={() => handleConfirm(value, 'COD')}
loading={submitLoading}
>
确认
</Button>
</Space>
</div>
</>
)
};
export default COD;
\ No newline at end of file
import React, { useState } from 'react';
import { Descriptions, Space, Button } from 'antd';
interface bankAccount {
id: number,
name: string,
bankAccount: string,
bankDeposit: string,
memberId: number,
};
interface BalanceProps {
/**
* 弹窗需要的数据值
*/
value: {[key: string]: any};
/**
* 关闭事件
*/
handleModalVisible: () => void;
/**
* 弹窗内确认事件
*/
handleConfirm: (values: {[key: string]: any}, modalName: string) => void;
/**
* 弹窗提交 loading
*/
submitLoading: boolean;
};
const Credit: React.FC<BalanceProps> = ({
handleModalVisible,
handleConfirm,
value,
submitLoading,
}) => {
const [bankAccount, setBankAccount] = useState<bankAccount>({
id: 0,
name: '',
bankAccount: '',
bankDeposit: '',
memberId: 0,
});
return (
<>
<Descriptions title="授信额度信息" column={1}>
<Descriptions.Item label="总授信额度">¥500000.00</Descriptions.Item>
<Descriptions.Item label="已用授信额度">¥500000.00</Descriptions.Item>
<Descriptions.Item label="可用授信额度">¥500000.00</Descriptions.Item>
<Descriptions.Item label="当前退款金额">
<span style={{ color: '#EF6260' }}>¥6000.00</span>
</Descriptions.Item>
</Descriptions>
<div style={{ marginTop: 20, textAlign: 'center' }}>
<Space>
<Button onClick={handleModalVisible}>
取消
</Button>
<Button
type="primary"
onClick={() => handleConfirm(value, 'credit')}
loading={submitLoading}
>
退款
</Button>
</Space>
</div>
</>
)
};
export default Credit;
\ No newline at end of file
import React, { useState } from 'react';
import { message } from 'antd';
import { Button, Space, message } from 'antd';
import { createFormActions } from '@formily/antd';
import NiceForm from '@/components/NiceForm';
import { uploadVoucherModalSchema } from './schema';
......@@ -7,18 +7,16 @@ import { uploadVoucherModalSchema } from './schema';
const uploadVoucherFormActions = createFormActions();
interface bankAccount {
id: number,
name: string,
bankAccount: string,
bankDeposit: string,
memberId: number,
};
interface UploadVoucherProps {
/**
* 弹窗需要的数据值
*/
values: {[key: string]: any};
value: {[key: string]: any};
/**
* 关闭事件
*/
......@@ -27,15 +25,22 @@ interface UploadVoucherProps {
* 弹窗内确认事件
*/
handleConfirm: (values: {[key: string]: any}, modalName: string) => void;
/**
* 弹窗提交 loading
*/
submitLoading: boolean;
};
const UploadVoucher: React.FC<UploadVoucherProps> = () => {
const UploadVoucher: React.FC<UploadVoucherProps> = ({
handleConfirm,
handleModalVisible,
value,
submitLoading,
}) => {
const [bankAccount, setBankAccount] = useState<bankAccount>({
id: 0,
name: '',
bankAccount: '',
bankDeposit: '',
memberId: 0,
});
const beforeUploadVoucher = file => {
......@@ -47,24 +52,57 @@ const UploadVoucher: React.FC<UploadVoucherProps> = () => {
};
const handleUploadVoucherSubmit = values => {
const { payProveList } = values;
const { fileList = [] } = values;
if (handleConfirm) {
if (!bankAccount || !bankAccount.name) {
message.error('没有收款账户相关信息,无法退款');
return;
}
handleConfirm({
...value,
payProve: {
...values,
fileList: fileList.map(item => item.status === 'done' && ({
name: item.name,
proveUrl: item.data.url,
})).filter(Boolean),
},
}, 'uploadVoucher');
}
};
return (
<NiceForm
previewPlaceholder=""
initialValues={bankAccount}
effects={($, { setFieldState }) => {
}}
expressionScope={{
beforeUpload: beforeUploadVoucher,
}}
actions={uploadVoucherFormActions}
schema={uploadVoucherModalSchema}
onSubmit={handleUploadVoucherSubmit}
/>
<>
<NiceForm
previewPlaceholder=""
initialValues={bankAccount}
effects={($, { setFieldState }) => {
}}
expressionScope={{
beforeUpload: beforeUploadVoucher,
}}
actions={uploadVoucherFormActions}
schema={uploadVoucherModalSchema}
onSubmit={handleUploadVoucherSubmit}
/>
<div style={{ marginTop: 20, textAlign: 'center' }}>
<Space>
<Button onClick={handleModalVisible}>
取消
</Button>
<Button
type="primary"
onClick={() => uploadVoucherFormActions.submit()}
loading={submitLoading}
>
退款
</Button>
</Space>
</div>
</>
)
};
......
......@@ -16,7 +16,7 @@ export const uploadVoucherModalSchema: ISchema = {
properties: {
name: {
type: 'string',
title: '还款账户名称',
title: '账户名称',
'x-component': 'Text',
},
bankAccount: {
......@@ -29,9 +29,9 @@ export const uploadVoucherModalSchema: ISchema = {
title: '开户行',
'x-component': 'Text',
},
payProveList: {
fileList: {
type: 'string',
title: '上传支付凭证',
title: '上传退款凭证',
'x-component': 'Upload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
......
......@@ -2,6 +2,9 @@ import React, { Suspense } from 'react';
import { Modal } from 'antd';
const UploadVoucher = React.lazy(() => import('./UploadVoucher'));
const Balance = React.lazy(() => import('./Balance'));
const Credit = React.lazy(() => import('./Credit'));
const COD = React.lazy(() => import('./COD'));
export interface RefundModalProps {
/**
......@@ -23,7 +26,11 @@ export interface RefundModalProps {
/**
* 弹窗需要的数据值
*/
values: {[key: string]: any};
value: {[key: string]: any};
/**
* 弹窗提交 loading
*/
submitLoading: boolean;
};
const RefundModal: React.FC<RefundModalProps> = ({
......@@ -31,35 +38,78 @@ const RefundModal: React.FC<RefundModalProps> = ({
modalName = 'uploadVoucher',
handleModalVisible,
handleConfirm,
values,
value,
submitLoading,
}) => {
const tempMap = {
uploadVoucher: {
width: 840,
width: 600,
title: '上传退款凭证',
render: () => (
<Suspense fallback={null}>
<UploadVoucher
values={values}
value={value}
handleConfirm={handleConfirm}
handleModalVisible={handleModalVisible}
submitLoading={submitLoading}
/>
</Suspense>
),
},
balance: {
width: 600,
title: '退款处理',
render: () => (
<Suspense fallback={null}>
<Balance
value={value}
handleConfirm={handleConfirm}
handleModalVisible={handleModalVisible}
submitLoading={submitLoading}
/>
</Suspense>
),
},
credit: {
width: 600,
title: '退款处理',
render: () => (
<Suspense fallback={null}>
<Credit
value={value}
handleConfirm={handleConfirm}
handleModalVisible={handleModalVisible}
submitLoading={submitLoading}
/>
</Suspense>
),
},
COD: {
width: 500,
title: '货到付款退款确认',
render: () => (
<Suspense fallback={null}>
<COD
value={value}
handleConfirm={handleConfirm}
handleModalVisible={handleModalVisible}
submitLoading={submitLoading}
/>
</Suspense>
),
},
};
const template = tempMap[modalName];
const template = tempMap[modalName] || {
width: 640,
title: '标题',
render: () => ('没有找到 modal 模板'),
};
return (
<Modal
width={template.width}
// bodyStyle={{
// padding: '32px 40px',
// height: 550,
// overflowY: 'auto',
// }}
title={template.title}
visible={visible}
footer={null}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 18:02:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-10 13:46:31
* @LastEditTime: 2020-12-10 16:40:48
* @Description: 退款明细
*/
import React, { useState } from 'react';
......@@ -23,8 +23,11 @@ import {
REFUND_OUTER_STATUS_UNCONFIRMED_REFUND,
REFUND_OUTER_STATUS_NOT_RECEIVED,
REFUND_OUTER_STATUS_RECEIVED,
PAY_CHANNEL_OFFLINE,
REFUND_OUTER_STATUS_TAG_MAP,
PAY_CHANNEL_OFFLINE,
PAY_CHANNEL_BALANCE,
PAY_CHANNEL_CREDIT,
PAY_CHANNEL_COD,
} from '../../constants';
import styles from './index.less';
......@@ -60,6 +63,8 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
const [voucherVisible, setVoucherVisible] = useState(false);
const [refundModalVisible, setRefundModalVisible] = useState(false);
const [modalName, setModalName] = useState('uploadVoucher');
const [refundModalValue, setRefundModalValue] = useState({});
const [submitLoading, setSubmitLoading] = useState(false);
const columns: EditableColumns[] = [
{
......@@ -124,16 +129,49 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
},
];
const handleRefund = id => {
if (onRefund) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否确认退款?`,
onOk() {
return onRefund(id);
},
});
const handleRefund = (id, channel) => {
switch(channel) {
// 余额支付
case PAY_CHANNEL_BALANCE: {
setModalName('balance');
setRefundModalVisible(true);
setRefundModalValue({ id });
break;
};
// 线下支付
case PAY_CHANNEL_OFFLINE: {
setModalName('uploadVoucher');
setRefundModalVisible(true);
setRefundModalValue({ id });
break;
};
// 授信支付
case PAY_CHANNEL_CREDIT: {
setModalName('credit');
setRefundModalVisible(true);
setRefundModalValue({ id });
break;
};
// 货到付款
case PAY_CHANNEL_COD: {
setModalName('COD');
setRefundModalVisible(true);
setRefundModalValue({ id });
break;
};
default: {
if (onRefund) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否确认退款?`,
onOk() {
return onRefund(id);
},
});
}
break;
}
}
};
......@@ -162,8 +200,10 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
};
const handleRefundConfirm = (values, modalName) => {
console.log('values', values)
console.log('modalName', modalName)
setSubmitLoading(true);
onRefund(values).finally(() => {
setSubmitLoading(false);
});
};
return (
......@@ -216,7 +256,7 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
) && (
<div
className={styles['deliver-item-return']}
onClick={() => handleRefund(item.refundId)}
onClick={() => handleRefund(item.refundId, item.channel)}
>
退款
</div>
......@@ -301,17 +341,18 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
destroyOnClose
>
<Upload
defaultFileList={[]}
defaultFileList={currentDetailItem.fileList}
disabled
/>
</Modal>
<RefundModal
values={{}}
value={refundModalValue}
visible={refundModalVisible}
modalName={modalName}
handleModalVisible={() => setRefundModalVisible(false)}
handleConfirm={handleRefundConfirm}
submitLoading={submitLoading}
/>
</MellowCard>
);
......
......@@ -277,7 +277,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
<AvatarWrap
info={{
aloneTxt: '单',
name: `申请单号:${detailInfo?.applyNo}`,
name: `申请单号:${detailInfo && detailInfo.applyNo ? detailInfo.applyNo : ''}`,
}}
/>
}
......
......@@ -456,10 +456,10 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
backIcon={<ReutrnEle description="返回" />}
title={
!id ?
'新建退货申请单' :
'新建货申请单' :
isEdit ?
'编辑退货申请单' :
'查看退货申请单'
'编辑货申请单' :
'查看货申请单'
}
extra={
(isEdit || !id)
......
......@@ -320,7 +320,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
<AvatarWrap
info={{
aloneTxt: '单',
name: `申请单号:${detailInfo?.applyNo}`,
name: `申请单号:${detailInfo && detailInfo.applyNo ? detailInfo.applyNo : ''}`,
}}
/>
}
......
......@@ -186,7 +186,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
<AvatarWrap
info={{
aloneTxt: '单',
name: `申请单号:${detailInfo?.applyNo}`,
name: `申请单号:${detailInfo && detailInfo.applyNo ? detailInfo.applyNo : ''}`,
}}
/>
}
......
......@@ -179,7 +179,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
const handleSubmit = values => {
const {
supplierMember,
faultFileList,
faultFileList = [],
repairGoodsList,
repairAddress,
...rest
......
......@@ -184,7 +184,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
<AvatarWrap
info={{
aloneTxt: '单',
name: `申请单号:${detailInfo?.applyNo}`,
name: `申请单号:${detailInfo && detailInfo.applyNo ? detailInfo.applyNo : ''}`,
}}
/>
}
......
......@@ -317,7 +317,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
<AvatarWrap
info={{
aloneTxt: '单',
name: `申请单号:${detailInfo?.applyNo}`,
name: `申请单号:${detailInfo && detailInfo.applyNo ? detailInfo.applyNo : ''}`,
}}
/>
}
......
......@@ -473,6 +473,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
purchaseCount: item.purchaseCount,
purchaseAmount: +(item.price * item.purchaseCount).toFixed(2),
returnedCount: item.returnCount || item.purchaseCount || 0, // 已退货数量
payAmount: item.payAmount,
returnCount: '',
returnAmount: '',
extraData: {
......
......@@ -270,7 +270,7 @@ export const addBillSchema: ISchema = {
title: '采购金额',
'x-component': 'Text',
},
costPrice4: {
payAmount: {
type: 'string',
title: '已支付金额',
'x-component': 'Text',
......
......@@ -272,9 +272,11 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
};
// 退款
const handleRefund = (id): Promise<any> => {
const handleRefund = (values): Promise<any> => {
const { id, ...rest } = values;
return PublicApi.postAsReturnGoodsRefund({
dataId: id,
...rest,
}).then(res => {
if (res.code === 1000) {
getDetailInfo();
......@@ -297,7 +299,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
<AvatarWrap
info={{
aloneTxt: '单',
name: `申请单号:${detailInfo?.applyNo}`,
name: `申请单号:${detailInfo && detailInfo.applyNo ? detailInfo.applyNo : ''}`,
}}
/>
}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 17:22:07
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-09 15:30:56
* @LastEditTime: 2020-12-10 18:28:29
* @Description:
*/
import React, { useState } from 'react';
......@@ -14,24 +14,24 @@ import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from '../components/DetailInfo';
const ReturnPrReturnVerify: React.FC = () => {
const { id, creditId } = usePageStatus();
const { id } = usePageStatus();
const [visible, setVisible] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const handleSubmit = values => {
const handleSubmit = () => {
if (!id) {
return;
}
// setSubmitLoading(true);
// PublicApi.postAsReturnGoodsConfirmAllRefund({
// dataId: id,
// }).then(res => {
// if (res.code === 1000) {
// history.goBack();
// }
// }).finally(() => {
// setSubmitLoading(false);
// });
setSubmitLoading(true);
PublicApi.postAsReturnGoodsCompleteRefund({
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
}).finally(() => {
setSubmitLoading(false);
});
};
return (
......@@ -44,6 +44,7 @@ const ReturnPrReturnVerify: React.FC = () => {
type="primary"
icon={<FormOutlined />}
loading={submitLoading}
onClick={handleSubmit}
>
确认本单已完成所有退款
</Button>
......
......@@ -272,10 +272,10 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState>
PublicApi.postPayCreditApplyCreditRepay({
billId,
...repaymentValues,
payProveList: payProveList.map(item => ({
payProveList: payProveList.map(item => item.status === 'done' && ({
name: item.name,
proveUrl: item.data.url,
})),
})).filter(Boolean),
}).then(res => {
if (res.code === 1000) {
this.setState({ visibleRepayment: false });
......
......@@ -748,6 +748,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
orderNo,
deliveryType,
goodsCount,
price,
totalPrice,
...extraRest
},
itemName,
......@@ -794,6 +796,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
orderNo,
deliveryType,
goodsCount,
price,
totalPrice,
...extraRest
},
itemName,
......@@ -843,6 +847,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
orderNo,
deliveryType,
goodsCount,
price,
totalPrice,
...extraRest
},
itemName,
......@@ -889,6 +895,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
orderNo,
deliveryType,
goodsCount,
price,
totalPrice,
...extraRest
},
itemName,
......
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