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

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

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