Commit 84fbe800 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: e账户管理对接通联支付充值,订单支付对接通联微信/支付宝/余额支付

parent 17b43e4a
......@@ -56,8 +56,8 @@ export default {
'commodity.goods.addGoods.back' : '返回',
'commodity.goods.addGoods.form.code' : '货号',
'commodity.goods.addGoods.form.code.message.1' : '请输入货号',
'commodity.goods.addGoods.form.code.message.2' : '最长20个字符(由字母、数、特殊字符组成)',
'commodity.goods.addGoods.form.code.placeholder' : '最长20个字符(由字母、数、特殊字符组成)',
'commodity.goods.addGoods.form.code.message.2' : '最长20个字符(由字母、数、特殊字符组成)',
'commodity.goods.addGoods.form.code.placeholder' : '最长20个字符(由字母、数、特殊字符组成)',
'commodity.goods.addGoods.form.name' : '货品名称',
'commodity.goods.addGoods.form.name.message' : '请输入货品名称',
'commodity.goods.addGoods.form.name.placeholder' : '最长40个字符20个汉字',
......
......@@ -155,7 +155,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
const selectUuid = uploadFileSelectRef.current.uid
// 编辑图片会多占用一张
if(fileLen >= 6 && !selectUuid) {
message.error('最多上六张图片')
message.error('最多上六张图片')
return false
}
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
......@@ -169,28 +169,16 @@ const ProductImageForm: React.FC<{}> = (props) => {
return isJpgOrPng && isLimit
}
// 检测尺寸
// const isSize = (file, w, h) => {
// return new Promise((resolve, reject) => {
// let width = w;
// let height = h;
// let _URL = window.URL || window.webkitURL;
// let img = new Image();
// img.onload = function() {
// let valid = img.width <= width && img.height <= height;
// valid ? resolve() : reject();
// };
// img.src = _URL.createObjectURL(file);
// }).then(
// () => {
// return file;
// },
// () => {
// message.error(file.name + "图片尺寸不符合要求,请修改后重新上传!");
// return Promise.reject();
// }
// );
// };
/** 编辑的时候 监听mousemove判断是否有选文件上传 */
const monitor = (ele) => {
document.removeEventListener('mousemove', monitor);
if (ele.files && ele.files.length > 0) {
console.log('您选择中文件:', ele.files)
} else {
uploadFileSelectRef.current = {}
console.log('您没有选择文件')
}
}
const handlePreview = async file => {
if (!file.url && !file.preview) {
......@@ -202,6 +190,8 @@ const ProductImageForm: React.FC<{}> = (props) => {
}
const handleChange = ({ file, fileList }, index) => {
document.removeEventListener('mousemove', monitor);
let _priceAttributeParams = [...priceAttributeParamsByRender]
const selectUuid = uploadFileSelectRef.current.uid
......@@ -245,11 +235,13 @@ const ProductImageForm: React.FC<{}> = (props) => {
}
const handlefileEdit = (file, index) => {
console.log('edit')
const uploadEle = document.querySelector(`#uploadEle${index}`) as any
uploadFileSelectRef.current = (file)
editRowIndexRef.current = index
// 触发图片上传
uploadEle.click()
document.addEventListener('mousemove', () => monitor(uploadEle), false);
}
return (<div>
......
......@@ -15,17 +15,32 @@ import { memberStatusMap, moveStatusMap } from '../../constant'
import { StandardTable } from 'god'
import QRCode from 'qrcode';
import { ScanOutlined } from '@ant-design/icons'
import { getPayEAccountAllInPayGetAccountDetail, getPayEAccountAllInPayGetEAccountStatusRecord, getPayEAccountAllInPayGetEAccountTradeRecord, getPayEAccountAllInPayGetRechargeResult, getPayEAccountAllInPayGetRechargeType, postPayAssetAccountRecharge, postPayEAccountAllInPayCashOut, postPayEAccountAllInPayRecharge } from '@/services/PayV2Api'
import { getPayEAccountAllInPayGetAccountDetail, getPayEAccountAllInPayGetEAccountStatusRecord, getPayEAccountAllInPayGetEAccountTradeRecord, getPayEAccountAllInPayGetRechargeResult, getPayEAccountAllInPayGetRechargeType, getPayEAccountAllInPayReSendPayCode, postPayEAccountAllInPayCashOut, postPayEAccountAllInPayConfirmPay, postPayEAccountAllInPayRecharge } from '@/services/PayV2Api'
import NiceForm from '@/components/NiceForm'
import Submit from '@/components/NiceForm/components/Submit'
import alipay from '@/assets/imgs/alipay_icon.png';
import wxpay from '@/assets/imgs/wechat_icon.png';
import alipay from '@/assets/imgs/alipay_icon.png'
import wxpay from '@/assets/imgs/wechat_icon.png'
import bankpay from '@/assets/imgs/bank_icon.png'
import fastpay from '@/assets/imgs/fast_icon.png'
import { clearModalParams } from '@/utils'
import useCountDown from '@/utils/hooks'
interface rechargeItem {
codeUrl: string;
tradeCode: number;
}
/** 充值方式和icon */
const chargeIconMap = {
// 微信
'SCAN_WEIXIN': wxpay,
// 支付宝
'SCAN_ALIPAY': alipay,
// 快捷
'QUICKPAY_VSP': fastpay,
// 网银
'GATEWAY_VSP': bankpay,
}
const schemaActions = createFormActions()
const formActions = createFormActions();
......@@ -37,6 +52,7 @@ let timeChange; // Tiemr
const EAccountDetail: React.FC<{}> = () => {
const intl = useIntl()
const [withdrawForm] = Form.useForm()
const [formCode] = Form.useForm();
const modalRef = useRef<any>()
const refTrade = useRef<any>({})
const datesRef = useRef<any>([])
......@@ -49,6 +65,9 @@ const EAccountDetail: React.FC<{}> = () => {
const [renderCodeCharacter, setRenderCodeCharacter] = useState<rechargeItem>()
const [rechargeType, setRechargeType] = useState<string>('')
const [loading, setLoading] = useState<boolean>(false)
const [sendCodeVisible, setSendCodeVisible] = useState<boolean>(false)
const [tradeCode, setTradeCode] = useState<string>('')
const [extra, setExtra] = useState<string>('')
useEffect(() => {
getAccountInfo()
......@@ -80,6 +99,7 @@ const EAccountDetail: React.FC<{}> = () => {
const { code, data, message: msg } = res
if(code !== 1000) { return message.error(msg) }
setDetails(data)
setExtra(`已将验证码发送至您尾号为${data.phone.substr(7, 4)}的手机号`)
getPayEAccountAllInPayGetEAccountStatusRecord({id: data.id + ''}).then(res => {
const { data } = res
setMoveData(data)
......@@ -229,7 +249,7 @@ const EAccountDetail: React.FC<{}> = () => {
}
const handleSubmit = (value) => {
// 提交重置
// 提交充值
setIsBtnLoading(true)
setRechargeType(value['type'][0])
let parasm = {
......@@ -238,10 +258,18 @@ const EAccountDetail: React.FC<{}> = () => {
}
postPayEAccountAllInPayRecharge(parasm, { ctlType: "none" }).then(res => {
const { code, data } = res
if(code === 1000){
if(code === 1000 && parasm.type.indexOf('SCAN') !== -1){
modalRef.current.setVisible(false)
setScanVisible(true)
setRenderCodeCharacter(data)
} else if(code === 1000 && parasm.type === 'QUICKPAY_VSP') {
// 快捷
modalRef.current.setVisible(false)
setSendCodeVisible(true)
setTradeCode(data.tradeCode)
} else if(code === 1000 && parasm.type === 'GATEWAY_VSP') {
// 网银
window.open(data.codeUrl, '_blank')
}
// else{
// message.error(res.message)
......@@ -256,7 +284,7 @@ const EAccountDetail: React.FC<{}> = () => {
const applyWithdraw = () => {
setWithdrawVisible(true)
withdrawForm.setFieldsValue({ name: details.memberName, accountNo: details.accountNo, branchName: details.branchName })
withdrawForm.setFieldsValue({ name: details.memberName, accountNo: details.bankNo, branchName: details.bankName })
}
const handleWithdraw = () => {
......@@ -310,6 +338,37 @@ const EAccountDetail: React.FC<{}> = () => {
return tooEarly || tooLate;
}
const handleSendCode = () => {
formCode.submit()
}
const { text, isActive, start } = useCountDown({
maxTime: 60,
minTime: 0,
initText: intl.formatMessage({ id: 'payandSettle.eAccountApprove.components.personal.initText' }),
onEnd: () => { console.log("end") },
decayRate: 1,
delay: 1 * 1000
})
const onFinishCode = async (values) => {
// 验证码 确定支付
setLoading(true)
const { code } = await postPayEAccountAllInPayConfirmPay({...values, tradeCode})
if(code === 1000) {
setSendCodeVisible(false)
getAccountInfo()
}
setLoading(false)
}
const handleSendSMS = () => {
// 发送验证码
getPayEAccountAllInPayReSendPayCode({ tradeCode }).then(res => {
res.code === 1000 && start()
})
}
return (
<PageHeaderWrapper
title={intl.formatMessage({id: 'payandSettle.capitalAccounts.eAccount.title'})}
......@@ -507,7 +566,7 @@ const EAccountDetail: React.FC<{}> = () => {
state.props["x-component-props"].dataSource = data.map(item => ({
id: item['key'],
name: item['value'],
logoUrl: item['key'].indexOf('WEIXIN') !== -1 ? wxpay : alipay
logoUrl: chargeIconMap[item['key']]
}))
});
})
......@@ -549,10 +608,10 @@ const EAccountDetail: React.FC<{}> = () => {
<span>{details?.memberName}</span>
</Form.Item>
<Form.Item label={intl.formatMessage({id: 'payandSettle.capitalAccounts.eAccount.modal.2.account'})} name="accountNo">
<span>{details?.accountNo}</span>
<span>{details?.bankNo}</span>
</Form.Item>
<Form.Item label={intl.formatMessage({id: 'payandSettle.capitalAccounts.eAccount.modal.2.apart'})} name="branchName">
<span>{details?.branchName}</span>
<span>{details?.bankName}</span>
</Form.Item>
<Form.Item
label={intl.formatMessage({id: 'payandSettle.capitalAccounts.eAccount.modal.2.amount'})}
......@@ -585,6 +644,48 @@ const EAccountDetail: React.FC<{}> = () => {
</Form>
</div>
</Modal>
{/* 网银/快捷验证码 */}
<Modal
title='验证码'
visible={sendCodeVisible}
onOk={handleSendCode}
onCancel={() => setSendCodeVisible(false)}
confirmLoading={loading}
>
<Form
form={formCode}
name="approve-form-Code"
onFinish={onFinishCode}
initialValues={{
prefix: '86',
}}
scrollToFirstError
colon={false}
labelAlign='left'
labelCol={{span: 24}}
wrapperCol={{ span: 24 }}
>
<Form.Item
label={intl.formatMessage({ id: 'payandSettle.eAccountApprove.components.company.mellowCard.2.captcha' })}
extra={extra}
>
<Row gutter={8}>
<Col span={19}>
<Form.Item
name="verificationCode"
noStyle
rules={[{ required: true, message: intl.formatMessage({ id: 'payandSettle.eAccountApprove.components.company.mellowCard.2.captcha.message' }) }]}
>
<Input placeholder={intl.formatMessage({ id: 'payandSettle.eAccountApprove.components.company.mellowCard.2.captcha.placeholder' })} />
</Form.Item>
</Col>
<Col span={5}>
<Button disabled={isActive} onClick={handleSendSMS}>{text}</Button>
</Col>
</Row>
</Form.Item>
</Form>
</Modal>
</PageHeaderWrapper>
)
}
......
import { getIntl } from 'umi';
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import alipay from '@/assets/imgs/alipay_icon.png';
import wxpay from '@/assets/imgs/wechat_icon.png';
const intl = getIntl();
......@@ -142,8 +140,6 @@ export const rechargeSchema: ISchema = {
"x-component": 'CardCheckBox',
"x-component-props": {
dataSource: [],
// {id: 1, name: '支付宝', logoUrl: alipay},
// { id: 2, name: intl.formatMessage({ id: 'payandSettle.capitalAccounts.eAccount.schema.rechargeSchema.type.dataSource.2' }), logoUrl: wxpay }
type: 'radio' // CardCheckBox 单选模式
},
"title": intl.formatMessage({ id: 'payandSettle.capitalAccounts.eAccount.schema.rechargeSchema.type' }),
......
......@@ -97,8 +97,10 @@ const Company: React.FC<{}> = () => {
Promise.all(fns).then(res => {
console.log(res)
}).finally(() => {
setLoading(false)
reloadFormData()
setTimeout(() => {
setLoading(false)
reloadFormData()
}, 2000)
})
}
......
import React, { useEffect, useRef, useState } from 'react'
import { Card, Button, Space, message, Modal, Form, Row, Col, Input, Spin } from 'antd'
import { Card, Button, Space, message, Modal, Form, Row, Col, Input, Spin, Radio } from 'antd'
import { StandardTable } from 'god'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { baseOrderListColumns, useTransformOrderTable } from './constant'
......@@ -59,8 +59,8 @@ const SaleOrder: React.FC<SaleOrderProps> = () => {
const orderIds = useRef<number[]>([])
const [payChartVisible, setPayChartVisible] = useState<boolean>(false)
const [payForm] = Form.useForm();
const [payModel, setPayModel] = useState<'web'|'app'|'miniapp'|null>('app')
const currentPayRef = useRef<GetOrderVendorGeneratePayLinkResponse>({})
const [payModel, setPayModel] = useState<'web'|'app'|'miniapp'|null>('web')
const currentPayRef = useRef<any>({})
const [qrCode, setQrCode] = useState('')
const { run, loading } = useHttpRequest(postOrderVendorCancel)
......@@ -150,7 +150,7 @@ const SaleOrder: React.FC<SaleOrderProps> = () => {
const generatePayChart = (record) => {
getOrderVendorGeneratePayLink({orderId: record.orderId}).then(({ data }) => {
currentPayRef.current = data
setPayModel(ORDER_SHOP_ORIGIN_MAP[data['shopEnvironment']])
// setPayModel(ORDER_SHOP_ORIGIN_MAP[data['shopEnvironment']])
setPayChartVisible(true)
})
}
......@@ -333,6 +333,11 @@ const SaleOrder: React.FC<SaleOrderProps> = () => {
window.open(`${process.env.BACK_GATEWAY}/order/vendor/export?token=${token}${exportParams}`, '_blank')
}
const onChangePayModel = (e) => {
setPayModel(e.target.value)
setQrCode('')
}
const controllerBtns = <Space>
<Button style={{width: 140}} onClick={handleExport} type='default'>{intl.formatMessage({ id: 'saleOrder.daochu', defaultMessage: '导出' })}</Button>
<Button type="primary" onClick={() => batchTransform()}>{intl.formatMessage({ id: 'saleOrder.zhuandan', defaultMessage: '转单' })}</Button>
......@@ -551,6 +556,15 @@ const SaleOrder: React.FC<SaleOrderProps> = () => {
afterClose={()=>setQrCode('')}
>
<div>
<div style={{marginBottom: 10}}>
<p>选择类型:</p>
<Radio.Group onChange={onChangePayModel} value={payModel}>
<Radio value='web'>WEB</Radio>
<Radio value='app'>APP</Radio>
<Radio value='miniapp'>小程序</Radio>
<Radio value='H5'>H5</Radio>
</Radio.Group>
</div>
{
payModel === 'web' && <Form form={payForm} name="pay-form" labelCol={{ span: 24 }} wrapperCol={{ span: 24 }}>
<Form.Item label={intl.formatMessage({ id: 'saleOrder.dangqiandingdan', defaultMessage: '当前订单' })} name="order">
......
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