Commit f79db54e authored by Bill's avatar Bill

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

parents 4d1bd2c4 5b69310e
...@@ -35,17 +35,50 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => { ...@@ -35,17 +35,50 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
const handleReduce = (e) => { const handleReduce = (e) => {
e.stopPropagation() e.stopPropagation()
if (value > minCount) { if (value > minCount) {
onChange(Number(value) - 1, 'click') onChange(accSub(value, 1), 'click')
} }
} }
const handleAdd = (e) => { const handleAdd = (e) => {
e.stopPropagation() e.stopPropagation()
if (value < maxCount) { if (value < maxCount) {
onChange(Number(value) + 1, 'click') onChange(accAdd(value, 1), 'click')
} }
} }
const accAdd = (num1,num2) => {
let r1, r2
try{
r1 = num1.toString().split('.')[1].length;
}catch(e){
r1 = 0;
}
try{
r2 = num2.toString().split(".")[1].length;
}catch(e){
r2 = 0;
}
const m = Math.pow(10, Math.max(r1,r2));
return Math.round(num1 * m + num2 * m)/m;
}
const accSub = (num1, num2) => {
let r1, r2;
try{
r1 = num1.toString().split('.')[1].length;
}catch(e){
r1 = 0;
}
try{
r2 = num2.toString().split(".")[1].length;
}catch(e){
r2 = 0;
}
const m = Math.pow(10,Math.max(r1,r2));
const n = (r1 >= r2) ? r1 : r2;
return (Math.round(num1 * m-num2 * m) / m).toFixed(n);
}
const handleChange = (e) => { const handleChange = (e) => {
const { value } = e.target; const { value } = e.target;
const reg = /^\d*([.]?\d{0,3})$/ const reg = /^\d*([.]?\d{0,3})$/
......
...@@ -24,11 +24,11 @@ const Address: React.FC<AddressPropsType> = (props) => { ...@@ -24,11 +24,11 @@ const Address: React.FC<AddressPropsType> = (props) => {
}, []) }, [])
const fetchAddressList = (init = false) => { const fetchAddressList = (init = false) => {
let param = { const param: any = {
current: 1, current: 1,
pageSize: 50 pageSize: 50
} }
//@ts-ignore
PublicApi.getLogisticsReceiverAddressPage(param).then(res => { PublicApi.getLogisticsReceiverAddressPage(param).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
setAddressList(res.data?.data) setAddressList(res.data?.data)
...@@ -41,14 +41,14 @@ const Address: React.FC<AddressPropsType> = (props) => { ...@@ -41,14 +41,14 @@ const Address: React.FC<AddressPropsType> = (props) => {
const initDefaultAddress = async (addressList: GetLogisticsReceiverAddressPageResponseDetail[]) => { const initDefaultAddress = async (addressList: GetLogisticsReceiverAddressPageResponseDetail[]) => {
let selectItem let selectItem
for (let item of addressList) { for (const item of addressList) {
if (item.isDefault === 1) { if (item.isDefault === 1) {
selectItem = item selectItem = item
} }
} }
if (selectItem) { if (selectItem) {
setSelectKey(selectItem.id) setSelectKey(selectItem.id)
let res = await PublicApi.getLogisticsReceiverAddressGet({ id: selectItem.id }) const res = await PublicApi.getLogisticsReceiverAddressGet({ id: selectItem.id })
onChange(Object.assign(selectItem, res.data)) onChange(Object.assign(selectItem, res.data))
} }
} }
...@@ -56,13 +56,13 @@ const Address: React.FC<AddressPropsType> = (props) => { ...@@ -56,13 +56,13 @@ const Address: React.FC<AddressPropsType> = (props) => {
const handleSelect = async (e: any) => { const handleSelect = async (e: any) => {
setSelectKey(e.target.value) setSelectKey(e.target.value)
let selectItem let selectItem
for (let item of addressList) { for (const item of addressList) {
if (item.id === e.target.value) { if (item.id === e.target.value) {
selectItem = item selectItem = item
} }
} }
if (selectItem) { if (selectItem) {
let res = await PublicApi.getLogisticsReceiverAddressGet({ id: selectItem.id }) const res = await PublicApi.getLogisticsReceiverAddressGet({ id: selectItem.id })
onChange(Object.assign(selectItem, res.data)) onChange(Object.assign(selectItem, res.data))
} }
} }
...@@ -91,11 +91,11 @@ const Address: React.FC<AddressPropsType> = (props) => { ...@@ -91,11 +91,11 @@ const Address: React.FC<AddressPropsType> = (props) => {
} }
const handleSetDefaultAddress = async (addressItem: GetLogisticsReceiverAddressPageResponseDetail) => { const handleSetDefaultAddress = async (addressItem: GetLogisticsReceiverAddressPageResponseDetail) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
//@ts-ignore //@ts-ignore
let addressDetailRes = await PublicApi.getLogisticsReceiverAddressGet({ id: addressItem.id }) const addressDetailRes = await PublicApi.getLogisticsReceiverAddressGet({ id: addressItem.id })
let param: GetLogisticsReceiverAddressGetResponse = addressDetailRes.data const param: GetLogisticsReceiverAddressGetResponse = addressDetailRes.data
param.isDefault = 1 param.isDefault = 1
//@ts-ignore
PublicApi.postLogisticsReceiverAddressUpdate(param).then(res => { PublicApi.postLogisticsReceiverAddressUpdate(param).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
fetchAddressList() fetchAddressList()
......
...@@ -26,7 +26,7 @@ const Contract: React.FC<ContractPropsType> = (props) => { ...@@ -26,7 +26,7 @@ const Contract: React.FC<ContractPropsType> = (props) => {
<span>我同意签订:</span> <span>我同意签订:</span>
</Checkbox> </Checkbox>
{ {
contractInfo && <a href={contractInfo?.contractUrl} download target="_blank" className={styles.checkbox_contract_text}>{contractInfo?.contractName}</a> contractInfo && <a href={contractInfo?.contractUrl} download rel="noreferrer" target="_blank" className={styles.checkbox_contract_text}>{contractInfo?.contractName}</a>
} }
</div> </div>
</div> </div>
......
...@@ -85,13 +85,15 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -85,13 +85,15 @@ const Order: React.FC<OrderPropsType> = (props) => {
message.error("订单不存在") message.error("订单不存在")
history.goBack() history.goBack()
} }
initOrderInfo() if(storeId) {
initOrderInfo()
}
return () => { return () => {
if (sessionStorage.getItem("contractInfo")) { if (sessionStorage.getItem("contractInfo")) {
sessionStorage.removeItem("contractInfo") sessionStorage.removeItem("contractInfo")
} }
} }
}, []) }, [storeId])
const initOrderInfo = async () => { const initOrderInfo = async () => {
const result = [] const result = []
...@@ -120,9 +122,9 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -120,9 +122,9 @@ const Order: React.FC<OrderPropsType> = (props) => {
try { try {
const param: any = { const param: any = {
productId, productId,
shopId, storeId, shopId: storeId,
memberId: orderInfo.supplyMembersId, memberId: sessionOrderInfo.supplyMembersId,
memberRoleId: orderInfo.supplyMembersRoleId, memberRoleId: sessionOrderInfo.supplyMembersRoleId,
} }
const rulesRes = await PublicApi.getOrderTradingRulesByProductId(param) const rulesRes = await PublicApi.getOrderTradingRulesByProductId(param)
const { data } = rulesRes const { data } = rulesRes
......
...@@ -33,8 +33,10 @@ const PayWay: React.FC<PayWayProps> = (props) => { ...@@ -33,8 +33,10 @@ const PayWay: React.FC<PayWayProps> = (props) => {
} }
useEffect(() => { useEffect(() => {
fetchCreditInfo() if(expand) {
}, []) fetchCreditInfo()
}
}, [expand])
useEffect(() => { useEffect(() => {
if (payWayList && payWayList.length === 1) { if (payWayList && payWayList.length === 1) {
...@@ -49,9 +51,10 @@ const PayWay: React.FC<PayWayProps> = (props) => { ...@@ -49,9 +51,10 @@ const PayWay: React.FC<PayWayProps> = (props) => {
} }
PublicApi.getPayCreditGetCredit(param).then(res => { PublicApi.getPayCreditGetCredit(param).then(res => {
message.destroy()
if(res.code === 1000) { if(res.code === 1000) {
setCreditInfo(res.data) setCreditInfo(res.data)
} else {
message.destroy()
} }
}) })
} }
......
/* /*
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-29 15:51:31 * @Date: 2020-09-29 15:51:31
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-04 10:02:55 * @LastEditTime: 2020-11-04 10:02:55
* @Description: * @Description:
*/ */
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { UPLOAD_TYPE } from '@/constants'; import { UPLOAD_TYPE } from '@/constants';
import { PATTERN_MAPS } from '@/constants/regExp'; import { PATTERN_MAPS } from '@/constants/regExp';
export const editModalSchema: ISchema = { export const editModalSchema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
MEGA_LAYOUT: { MEGA_LAYOUT: {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'mega-layout',
'x-component-props': { 'x-component-props': {
labelAlign: 'top', labelAlign: 'top',
full: true, full: true,
}, },
properties: { properties: {
applyQuota: { applyQuota: {
type: 'string', type: 'string',
title: '申请调整额度', title: '申请调整额度',
'x-component-props': { 'x-component-props': {
placeholder: '', placeholder: '',
addonBefore: '¥', addonBefore: '¥',
}, },
'x-rules': [ 'x-rules': [
{ {
required: true, required: true,
message: '请填写申请调整额度', message: '请填写申请调整额度',
}, },
{ {
pattern: PATTERN_MAPS.money, pattern: PATTERN_MAPS.money,
message: '请填写正数', message: '请填写正数',
}, },
], ],
}, },
quotaSlide: { quotaSlide: {
type: 'number', type: 'number',
title: '', title: '',
'x-component': 'range', 'x-component': 'range',
'x-component-props': { 'x-component-props': {
min: 0, min: 0,
// max: 1024, // max: 1024,
// marks: { // marks: {
// 0: { // 0: {
// label: '{{MinMarks}}', // label: '{{MinMarks}}',
// }, // },
// 1024: { // 1024: {
// label: '{{MaxMarks}}', // label: '{{MaxMarks}}',
// }, // },
// }, // },
style: { style: {
margin: '0 20px 28px' margin: '0 20px 28px'
}, },
}, },
}, },
billDay: { billDay: {
type: 'string', type: 'string',
title: '申请调整账单日期', title: '申请调整账单日期',
'x-component-props': { 'x-component-props': {
placeholder: '', placeholder: '',
addonAfter: '日', addonAfter: '日',
}, },
'x-rules': [ 'x-rules': [
{ {
required: true, required: true,
message: '请填写申请调整账单日期', message: '请填写申请调整账单日期',
}, },
{ {
pattern: PATTERN_MAPS.quantity, pattern: PATTERN_MAPS.quantity,
message: '请填写大于等于1的正整数', message: '请填写大于等于1的正整数',
}, },
{ {
validator(value) { validator(value) {
const intVal = +value; const intVal = +value;
return intVal > 28 || intVal < 0 ? '请输入大于0 小于等于 28的数值' : ''; return intVal > 28 || intVal < 0 ? '请输入大于0 小于等于 28的数值' : '';
} }
}, },
], ],
}, },
repayPeriod: { repayPeriod: {
type: 'string', type: 'string',
title: '申请还款周期', title: '申请还款周期',
'x-component-props': { 'x-component-props': {
placeholder: '', placeholder: '',
addonAfter: '天', addonAfter: '天',
}, },
'x-rules': [ 'x-rules': [
{ {
required: true, required: true,
message: '请填写申请还款周期', message: '请填写申请还款周期',
}, },
{ {
pattern: PATTERN_MAPS.quantity, pattern: PATTERN_MAPS.quantity,
message: '请填写大于等于1的正整数', message: '请填写大于等于1的正整数',
}, },
], ],
}, },
fileList: { fileList: {
type: 'string', type: 'string',
title: '申请附件', title: '申请附件',
'x-component': 'AntUpload', 'x-component': 'AntUpload',
'x-component-props': { 'x-component-props': {
action: '/api/file/file/upload/prefix', action: '/api/file/file/upload/prefix',
data: { data: {
fileType: UPLOAD_TYPE, fileType: UPLOAD_TYPE,
prefix: '/creditApplication/applicationAttachment/', prefix: '/creditApplication/applicationAttachment/',
}, },
beforeUpload: '{{beforeUpload}}', beforeUpload: '{{beforeUpload}}',
accept: '.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg', accept: '.xls, .xlsx, .doc, .docx, .wps, .pdf, .jpg, .png, .jpeg',
}, },
'x-rules': [ 'x-rules': [
{ {
required: false, required: true,
message: '请上传申请附件', message: '请上传申请附件',
}, },
], ],
description: '一次只能上传一个附件,每个附件大小不能超过20M', description: '一次只能上传一个附件,每个附件大小不能超过20M',
}, },
}, },
}, },
}, },
}; };
\ No newline at end of file
...@@ -10,7 +10,6 @@ const QuotaFormQueryDetail: React.FC = () => { ...@@ -10,7 +10,6 @@ const QuotaFormQueryDetail: React.FC = () => {
id={id} id={id}
creditId={creditId} creditId={creditId}
target="/memberCenter/payandSettle/creditApplication/quotaFormQuery/detail" target="/memberCenter/payandSettle/creditApplication/quotaFormQuery/detail"
isEdit
/> />
); );
}; };
......
...@@ -14,21 +14,19 @@ import { ...@@ -14,21 +14,19 @@ import {
import { createFormActions, FormEffectHooks } from '@formily/antd'; import { createFormActions, FormEffectHooks } from '@formily/antd';
import lodash from 'lodash'; import lodash from 'lodash';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { PAY_CHANNEL_WECHAT } from '@/constants';
import MellowCard from '@/components/MellowCard'; import MellowCard from '@/components/MellowCard';
import { Pie } from '@/components/Charts'; import { Pie } from '@/components/Charts';
import StatusTag from '@/components/StatusTag'; import StatusTag from '@/components/StatusTag';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import { repaymentModalSchema, uploadVoucherModalSchema } from './schema'; import { uploadVoucherModalSchema } from './schema';
import { createEffects } from './effects/repayment';
import TradeRecord, { RecordParams, RecordRes } from '../TradeRecord'; import TradeRecord, { RecordParams, RecordRes } from '../TradeRecord';
import WxPayModal from '../WxPayModal'; import WxPayModal from '../WxPayModal';
import RefundModal from '../RefundModal';
import styles from './index.less'; import styles from './index.less';
const repaymentFormActions = createFormActions();
const uploadVoucherFormActions = createFormActions(); const uploadVoucherFormActions = createFormActions();
const { onFormInit$ } = FormEffectHooks;
const { Option } = Select; const { Option } = Select;
export interface BillDetailParams { export interface BillDetailParams {
...@@ -72,6 +70,10 @@ export interface BillDetailData { ...@@ -72,6 +70,10 @@ export interface BillDetailData {
* 收款人Id * 收款人Id
*/ */
memberId: number memberId: number
/**
* 收款人角色Id
*/
memberRoleId: number
}; };
export interface BillRecordParams extends RecordParams { export interface BillRecordParams extends RecordParams {
...@@ -113,7 +115,6 @@ interface IntroduceRowState { ...@@ -113,7 +115,6 @@ interface IntroduceRowState {
name: string, name: string,
bankAccount: string, bankAccount: string,
bankDeposit: string, bankDeposit: string,
memberId: number,
}, },
visibleRecord: boolean; visibleRecord: boolean;
visibleRepayment: boolean; visibleRepayment: boolean;
...@@ -144,7 +145,6 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState> ...@@ -144,7 +145,6 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState>
name: '', name: '',
bankAccount: '', bankAccount: '',
bankDeposit: '', bankDeposit: '',
memberId: 0,
}, },
visibleRecord: false, visibleRecord: false,
visibleRepayment: false, visibleRepayment: false,
...@@ -180,7 +180,7 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState> ...@@ -180,7 +180,7 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState>
id: `${id}`, id: `${id}`,
}).then(res => { }).then(res => {
this.setState({ billInfo: res }); this.setState({ billInfo: res });
this.getSettleAccountsCorporateAccountConfig(res.memberId, res.memberRoleId); this.getSettleAccountsGetMemberAccountConfig(res.memberId, res.memberRoleId);
}).finally(() => { }).finally(() => {
this.setState({ billInfoLoading: false }); this.setState({ billInfoLoading: false });
}); });
...@@ -188,13 +188,13 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState> ...@@ -188,13 +188,13 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState>
}; };
// 获取对公账户信息 // 获取对公账户信息
getSettleAccountsCorporateAccountConfig = (memberId: number, memberRoleId: number) => { getSettleAccountsGetMemberAccountConfig = (memberId: number, memberRoleId: number) => {
if (!memberId || !memberRoleId) { if (!memberId || !memberRoleId) {
return; return;
} }
PublicApi.getSettleAccountsCorporateAccountConfig({ PublicApi.getSettleAccountsGetMemberAccountConfig({
memberId: `${memberId}`, memberId: `${memberId}`,
memberRoleId: `${memberRoleId}`, roleId: `${memberRoleId}`,
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
this.setState({ this.setState({
...@@ -257,7 +257,7 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState> ...@@ -257,7 +257,7 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState>
switch (tradeChannel) { switch (tradeChannel) {
// 微信支付 // 微信支付
case 1: { case PAY_CHANNEL_WECHAT: {
this.setState({ this.setState({
wxPayPrice: values.repayQuota, wxPayPrice: values.repayQuota,
wxPayUrl: res.data.payQRCode, wxPayUrl: res.data.payQRCode,
...@@ -289,10 +289,10 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState> ...@@ -289,10 +289,10 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState>
}; };
handleUploadVoucherSubmit = values => { handleUploadVoucherSubmit = values => {
const { payProveList } = values; const { payProveList = [] } = values;
const { repaymentValues, billId, bankAccount } = this.state; const { repaymentValues, billId, bankAccount } = this.state;
if (!bankAccount || !bankAccount.id || !bankAccount.memberId) { if (!bankAccount || !bankAccount.id) {
message.error('没有还款账户相关信息,无法还款'); message.error('没有还款账户相关信息,无法还款');
return; return;
} }
...@@ -317,7 +317,6 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState> ...@@ -317,7 +317,6 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState>
}; };
beforeUploadVoucher = file => { beforeUploadVoucher = file => {
console.log(file.size)
if (file.size / 1024 > 200) { if (file.size / 1024 > 200) {
message.warning('图片大小超过200K'); message.warning('图片大小超过200K');
return Promise.reject(); return Promise.reject();
...@@ -563,57 +562,14 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState> ...@@ -563,57 +562,14 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState>
</MellowCard> </MellowCard>
</Col> </Col>
</Row> </Row>
<Modal <RefundModal
title="还款"
width={576}
visible={visibleRepayment} visible={visibleRepayment}
confirmLoading={repaymentSubmitLoading} billInfo={billInfo}
onOk={() => repaymentFormActions.submit()}
onCancel={() => this.setState({ visibleRepayment: false })} onCancel={() => this.setState({ visibleRepayment: false })}
destroyOnClose onSubmit={this.handleRepaymentSubmit}
> confirmLoading={repaymentSubmitLoading}
<NiceForm />
previewPlaceholder=""
effects={($, actions) => {
const { setFieldState, setFieldValue } = actions;
onFormInit$().subscribe(() => {
// 初始化数据
setFieldState('repayQuota', fileState => {
fileState.value = billInfo.residueRepayQuota;
fileState.rules = fileState.rules.concat({
validator(value) {
return +value > billInfo.residueRepayQuota ? '输入值已超出还款金额' : '';
}
});
});
setFieldState('amountSlide', fileState => {
fileState.value = billInfo.residueRepayQuota;
fileState.props['x-component-props'].max = billInfo.residueRepayQuota;
fileState.props['x-component-props'].marks = {
0: {
label: 0,
},
[billInfo.residueRepayQuota]: {
label: billInfo.residueRepayQuota,
},
};
});
});
createEffects($, actions);
}}
expressionScope={{
}}
actions={repaymentFormActions}
schema={repaymentModalSchema}
onSubmit={this.handleRepaymentSubmit}
/>
</Modal>
<Modal <Modal
title="上传支付凭证" title="上传支付凭证"
......
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { UPLOAD_TYPE } from '@/constants'; import { UPLOAD_TYPE } from '@/constants';
export const repaymentModalSchema: ISchema = { export const uploadVoucherModalSchema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
MEGA_LAYOUT: { MEGA_LAYOUT: {
type: 'object', type: 'object',
'x-component': 'mega-layout', 'x-component': 'mega-layout',
'x-component-props': { 'x-component-props': {
labelAlign: 'top', labelCol: 6,
full: true, wrapperCol: 18,
}, labelAlign: 'left',
properties: { full: true,
repayQuota: { },
type: 'string', properties: {
title: '还款金额', name: {
'x-component-props': { type: 'string',
placeholder: '', title: '还款账户名称',
addonBefore: '¥', 'x-component': 'Text',
}, },
'x-rules': [ bankAccount: {
{ type: 'string',
required: true, title: '银行账号',
message: '请填写还款金额', 'x-component': 'Text',
}, },
], bankDeposit: {
}, type: 'string',
amountSlide: { title: '开户行',
type: 'number', 'x-component': 'Text',
title: '', },
'x-component': 'range', payProveList: {
'x-component-props': { type: 'string',
min: 0, title: '上传支付凭证',
// max: 20000, 'x-component': 'AntUpload',
}, 'x-component-props': {
}, action: '/api/file/file/upload/prefix',
tradeType: { data: {
type: 'number', fileType: UPLOAD_TYPE,
enum: [ prefix: '/creditApplication/paymentVoucher/',
{ },
label: '线上支付方式', beforeUpload: '{{beforeUpload}}',
value: 1, accept: '.png, .jpg, .jpeg',
}, },
{ 'x-mega-props': {
label: '线下支付方式', labelAlign: 'top',
value: 2, full: true,
}, },
], 'x-rules': [
default: 1, {
title: '选择支付方式', required: true,
'x-component-props': { message: '请上传支付凭证',
placeholder: '请选择', },
}, ],
'x-rules': [ description: '单个凭证文件大小不能超过 200K',
{ },
required: true, },
message: '请选择支付方式', },
}, },
],
},
tradeChannel: {
type: 'string',
title: '选择支付渠道',
enum: [
{
label: '微信',
value: 1,
},
{
label: '支付宝',
value: 2,
},
{
label: '银联',
value: 3,
},
],
default: 1,
'x-component-props': {
placeholder: '请选择',
},
'x-rules': [
{
required: true,
message: '请选择支付渠道',
},
],
},
},
},
},
};
export const uploadVoucherModalSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelCol: 6,
wrapperCol: 18,
labelAlign: 'left',
full: true,
},
properties: {
name: {
type: 'string',
title: '还款账户名称',
'x-component': 'Text',
},
bankAccount: {
type: 'string',
title: '银行账号',
'x-component': 'Text',
},
bankDeposit: {
type: 'string',
title: '开户行',
'x-component': 'Text',
},
payProveList: {
type: 'string',
title: '上传支付凭证',
'x-component': 'AntUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: '/creditApplication/paymentVoucher/',
},
beforeUpload: '{{beforeUpload}}',
accept: '.png, .jpg, .jpeg',
},
'x-mega-props': {
labelAlign: 'top',
full: true,
},
'x-rules': [
{
required: false,
message: '请上传支付凭证',
},
],
description: '单个凭证文件大小不能超过 200K',
},
},
},
},
}; };
\ No newline at end of file
/* /*
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-10-22 17:31:08 * @Date: 2020-10-22 17:31:08
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-24 10:40:03 * @LastEditTime: 2020-11-24 10:40:03
* @Description: 联动逻辑相关 * @Description: 联动逻辑相关
*/ */
import { FormEffectHooks, FormPath } from '@formily/antd'; import { FormEffectHooks, FormPath } from '@formily/antd';
import { useLinkageUtils } from '@/utils/formEffectUtils'; import { useLinkageUtils } from '@/utils/formEffectUtils';
const { const {
onFieldInputChange$, onFieldInputChange$,
onFieldValueChange$, onFieldValueChange$,
} = FormEffectHooks; } = FormEffectHooks;
export const useBusinessEffects = (context, actions) => { export const useBusinessEffects = (context, actions) => {
const { const {
getFieldValue, getFieldValue,
setFieldValue, setFieldValue,
getFieldState, getFieldState,
setFieldState, setFieldState,
} = actions; } = actions;
const linkage = useLinkageUtils(); const linkage = useLinkageUtils();
// 还款金额 联动 滑块条 // 还款金额 联动 滑块条
onFieldInputChange$('repayQuota').subscribe(fieldState => { onFieldInputChange$('repayQuota').subscribe(fieldState => {
linkage.value('amountSlide', +fieldState.value); linkage.value('amountSlide', +fieldState.value);
}); });
// 滑块条 联动 还款金额 // 滑块条 联动 还款金额
onFieldInputChange$('amountSlide').subscribe(fieldState => { onFieldInputChange$('amountSlide').subscribe(fieldState => {
linkage.value('repayQuota', `${fieldState.value}`); linkage.value('repayQuota', `${fieldState.value}`);
}); });
// 支付方式 联动 支付渠道 // 支付方式 联动 支付渠道
onFieldValueChange$('tradeType').subscribe(fieldState => { onFieldValueChange$('tradeType').subscribe(fieldState => {
const { value } = fieldState; const { value } = fieldState;
if (value === 2) { if (value === 2) {
linkage.hide('tradeChannel'); linkage.hide('tradeChannel');
} else { } else {
linkage.show('tradeChannel'); linkage.show('tradeChannel');
} }
}); });
} }
\ No newline at end of file
import React from 'react';
import { Modal } from 'antd';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PublicApi } from '@/services/api';
import NiceForm from '@/components/NiceForm';
import { BillDetailData } from '../IntroduceRow';
import { repaymentModalSchema } from './schema';
import { createEffects } from './effects';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
const { onFormInit$ } = FormEffectHooks;
const repaymentFormActions = createFormActions();
interface RefundModalProps {
/**
* 是否可见
*/
visible: boolean,
/**
* 隐藏事件
*/
onCancel: () => void,
/**
* 确认按钮 loading
*/
confirmLoading?: boolean,
/**
* 账单信息
*/
billInfo: BillDetailData | null,
/**
* 提交事件
*/
onSubmit: (values: any) => void,
};
const RefundModal: React.FC<RefundModalProps> = (props) => {
const {
visible,
onCancel,
confirmLoading,
billInfo,
onSubmit,
} = props;
// 获取供应商支付渠道
const getPayChannels = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
PublicApi.getPayCreditRepaymentList({
payType: `${1}`, // 支付方式:1 线上支付
memberId: `${billInfo.memberId}`,
memberRoleId: `${billInfo.memberRoleId}`,
}).then(res => {
if (res.code === 1000) {
const options =
res.data ?
res.data.map(item => ({
label: item.way,
value: item.wayId,
})) :
[];
resolve(options);
}
reject();
}).catch(() => {
reject();
});
});
};
const handleRepaymentSubmit = (values) => {
if (onSubmit) {
onSubmit(values);
}
};
return (
<Modal
title="还款"
width={576}
visible={visible}
confirmLoading={confirmLoading}
onOk={() => repaymentFormActions.submit()}
onCancel={onCancel}
destroyOnClose
>
<NiceForm
previewPlaceholder=""
effects={($, actions) => {
const { setFieldState, setFieldValue } = actions;
onFormInit$().subscribe(() => {
// 初始化数据
setFieldState('repayQuota', fileState => {
fileState.value = billInfo.residueRepayQuota;
fileState.rules = fileState.rules.concat({
validator(value) {
return +value > billInfo.residueRepayQuota ? '输入值已超出还款金额' : '';
}
});
});
setFieldState('amountSlide', fileState => {
fileState.value = billInfo.residueRepayQuota;
fileState.props['x-component-props'].max = billInfo.residueRepayQuota;
fileState.props['x-component-props'].marks = {
0: {
label: 0,
},
[billInfo.residueRepayQuota]: {
label: billInfo.residueRepayQuota,
},
};
});
});
createEffects($, actions);
console.log('123')
useAsyncSelect('tradeChannel', getPayChannels, ['label', 'value']);
}}
expressionScope={{
}}
actions={repaymentFormActions}
schema={repaymentModalSchema}
onSubmit={handleRepaymentSubmit}
/>
</Modal>
);
};
export default RefundModal;
\ No newline at end of file
import { ISchema } from '@formily/antd';
import { UPLOAD_TYPE } from '@/constants';
export const repaymentModalSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
full: true,
},
properties: {
repayQuota: {
type: 'string',
title: '还款金额',
'x-component-props': {
placeholder: '',
addonBefore: '¥',
},
'x-rules': [
{
required: true,
message: '请填写还款金额',
},
],
},
amountSlide: {
type: 'number',
title: '',
'x-component': 'range',
'x-component-props': {
min: 0,
// max: 20000,
},
},
tradeType: {
type: 'number',
enum: [
{
label: '线上支付方式',
value: 1,
},
{
label: '线下支付方式',
value: 2,
},
],
default: 1,
title: '选择支付方式',
'x-component-props': {
placeholder: '请选择',
},
'x-rules': [
{
required: true,
message: '请选择支付方式',
},
],
},
tradeChannel: {
type: 'string',
title: '选择支付渠道',
enum: [
{
label: '微信',
value: 1,
},
{
label: '支付宝',
value: 2,
},
{
label: '银联',
value: 3,
},
],
default: 1,
'x-component-props': {
placeholder: '请选择',
},
'x-rules': [
{
required: true,
message: '请选择支付渠道',
},
],
},
},
},
},
};
\ No newline at end of file
/* /*
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-12-16 11:07:13 * @Date: 2020-12-16 11:07:13
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-16 15:09:21 * @LastEditTime: 2020-12-30 13:50:05
* @Description: 微信支付弹窗 * @Description: 微信支付弹窗
*/ */
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Modal, Upload } from 'antd'; import { Modal, Upload } from 'antd';
import QRCode from 'qrcode'; import QRCode from 'qrcode';
import { priceFormat } from '@/utils/numberFomat'; import { priceFormat } from '@/utils/numberFomat';
import WechatIcon from '@/assets/imgs/wechat_icon.png'; import WechatIcon from '@/assets/imgs/wechat_icon.png';
import styles from './index.less'; import styles from './index.less';
interface WxPayModalProps { interface WxPayModalProps {
/** /**
* 需要生成 二维码的 地址 * 需要生成 二维码的 地址
*/ */
url: string; url: string;
/** /**
* 支付金额 * 支付金额
*/ */
price: number; price: number;
/** /**
* 是否可见 * 是否可见
*/ */
visible: boolean; visible: boolean;
/** /**
* 弹窗取消事件 * 弹窗取消事件
*/ */
onCancel: () => void; onCancel: () => void;
/** /**
* 轮训查询支付结果事件 * 轮训查询支付结果事件
*/ */
onCheckResult: () => Promise<{ success: Boolean }>; onCheckResult: () => Promise<{ success: Boolean }>;
/** /**
* 轮训查询支付结果成功 * 轮训查询支付结果成功
*/ */
onSuccess?: () => void; onSuccess?: () => void;
/** /**
* 轮训查询支付结果失败 * 轮训查询支付结果失败
*/ */
onFail?: () => void; onFail?: () => void;
}; };
const WxPayModal: React.FC<WxPayModalProps> = ({ const WxPayModal: React.FC<WxPayModalProps> = ({
url, url,
price, price,
visible, visible,
onCancel, onCancel,
onCheckResult, onCheckResult,
onSuccess, onSuccess,
onFail, onFail,
}) => { }) => {
const [qrCode, setQrCode] = useState<string>(''); const [qrCode, setQrCode] = useState<string>('');
const getQRCode = async params => { const getQRCode = async params => {
if (!params) { if (!params) {
return; return;
} }
// 生成二维码 // 生成二维码
const res = await QRCode.toDataURL(params); const res = await QRCode.toDataURL(params);
setQrCode(res); setQrCode(res);
}; };
let timer = useRef(null); let timer = useRef(null);
// 最多请求3600次,2000毫秒一次,二维码过期两小时 // 最多请求3600次,2000毫秒一次,二维码过期两小时
let count = 0; let count = 0;
const handleCheckResult = () => { const handleCheckResult = () => {
if (!onCheckResult) { if (!onCheckResult) {
return; return;
} }
count++; count++;
if (count > 3600) { if (count > 3600) {
return; return;
} }
onCheckResult().then(res => { onCheckResult().then(res => {
if (!res.success) { if (!res.success) {
timer.current = setTimeout(() => { timer.current = setTimeout(() => {
handleCheckResult(); handleCheckResult();
}, 2000); }, 2000);
console.log('timer', timer) } else {
} else { clearTimeout(timer.current);
clearTimeout(timer.current); timer = null;
timer = null; if (onSuccess) {
if (onSuccess) { onSuccess();
onSuccess(); }
} }
} });
}); };
};
useEffect(() => {
useEffect(() => { getQRCode(url);
getQRCode(url); if (url) {
if (url) { handleCheckResult();
handleCheckResult(); }
}
return () => {
return () => { if (timer.current) {
if (timer.current) { clearTimeout(timer.current);
clearTimeout(timer.current); timer.current = null;
timer.current = null; }
} };
}; }, [url]);
}, [url]);
useEffect(() => {
useEffect(() => { if (!visible) {
if (!visible) { if (timer.current) {
console.log('隐藏咯') clearTimeout(timer.current);
console.log('timer', timer.current) timer.current = null;
if (timer.current) { }
clearTimeout(timer.current); }
timer.current = null; }, [visible]);
}
} const handleCancel = () => {
}, [visible]); if (onCancel) {
onCancel();
const handleCancel = () => { }
if (onCancel) { };
onCancel();
} return (
}; <Modal
title={(
return ( <div className={styles.common_title}>
<Modal <div className={styles.common_title_icon}><img src={WechatIcon} /></div>
title={( <span>微信支付</span>
<div className={styles.common_title}> </div>
<div className={styles.common_title_icon}><img src={WechatIcon} /></div> )}
<span>微信支付</span> width={576}
</div> visible={visible}
)} onCancel={handleCancel}
width={576} footer={null}
visible={visible} maskClosable={false}
onCancel={handleCancel} destroyOnClose
footer={null} >
maskClosable={false} <div className={styles.wechat_payway}>
destroyOnClose <p className={styles.wechat_payway_title}>使用微信扫一扫下方二维码</p>
> <div className={styles.wechat_payway_imgbox}>
<div className={styles.wechat_payway}> {qrCode && <img src={qrCode} />}
<p className={styles.wechat_payway_title}>使用微信扫一扫下方二维码</p> </div>
<div className={styles.wechat_payway_imgbox}> <div className={styles.wechat_payway_needpay}>
{qrCode && <img src={qrCode} />} <label>当前需支付:</label>
</div> <span>{priceFormat(price)}</span>
<div className={styles.wechat_payway_needpay}> <label>RMB</label>
<label>当前需支付:</label> </div>
<span>{priceFormat(price)}</span> </div>
<label>RMB</label> </Modal>
</div> );
</div> };
</Modal>
);
};
export default WxPayModal; export default WxPayModal;
\ No newline at end of file
...@@ -79,7 +79,7 @@ const BillInfo: React.FC<BillInfoProps> = ({ ...@@ -79,7 +79,7 @@ const BillInfo: React.FC<BillInfoProps> = ({
> >
<Descriptions column={1}> <Descriptions column={1}>
<Descriptions.Item label="交易流水号"> <Descriptions.Item label="交易流水号">
<Row justify="space-between"> <Row justify="space-between" style={{ width: '100%' }}>
<Col span={12}> <Col span={12}>
<a onClick={() => handleCheckVoucher(trade.payProveList)}>{trade.tradeCode}</a> <a onClick={() => handleCheckVoucher(trade.payProveList)}>{trade.tradeCode}</a>
</Col> </Col>
...@@ -94,7 +94,7 @@ const BillInfo: React.FC<BillInfoProps> = ({ ...@@ -94,7 +94,7 @@ const BillInfo: React.FC<BillInfoProps> = ({
</Row> </Row>
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="交易项目"> <Descriptions.Item label="交易项目">
<Row justify="space-between"> <Row justify="space-between" style={{ width: '100%' }}>
<Col span={12}> <Col span={12}>
{BILL_TRADE_OPERATION[trade.operation]} {BILL_TRADE_OPERATION[trade.operation]}
</Col> </Col>
......
...@@ -240,7 +240,7 @@ class TradeRecord extends React.Component<TradeRecordProps, TradeRecordState> { ...@@ -240,7 +240,7 @@ class TradeRecord extends React.Component<TradeRecordProps, TradeRecordState> {
<TradeWrap.TradeItem key={item.tradeCode}> <TradeWrap.TradeItem key={item.tradeCode}>
<Descriptions column={1}> <Descriptions column={1}>
<Descriptions.Item label="交易流水号"> <Descriptions.Item label="交易流水号">
<Row justify="space-between"> <Row justify="space-between" style={{ width: '100%' }}>
<Col span={10}> <Col span={10}>
<a onClick={() => this.handleCheckVoucher(item.payProveList)}>{item.tradeCode}</a> <a onClick={() => this.handleCheckVoucher(item.payProveList)}>{item.tradeCode}</a>
</Col> </Col>
...@@ -255,7 +255,7 @@ class TradeRecord extends React.Component<TradeRecordProps, TradeRecordState> { ...@@ -255,7 +255,7 @@ class TradeRecord extends React.Component<TradeRecordProps, TradeRecordState> {
</Row> </Row>
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="交易项目"> <Descriptions.Item label="交易项目">
<Row justify="space-between"> <Row justify="space-between" style={{ width: '100%' }}>
<Col span={12}> <Col span={12}>
{item.operationName} {item.operationName}
</Col> </Col>
......
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