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

fix: e账户认证对接初步个人认证

parent d327f78d
......@@ -3,7 +3,7 @@
* @Date: 2020-07-22 09:54:50
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-28 18:33:56
*/
*/
/**
* 正则表达式集合
*/
......@@ -14,10 +14,10 @@ export const PATTERN_MAPS = {
email: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/,
phone: /^1[3|4|5|6|7|8|9][0-9]{9}$/,
phoneAndEmail: /^(1[3|4|5|6|7|8|9][0-9]{9})|([\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+)$/,
tel: /^((0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/,//座机
tel: /^((0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/,//座机
smsCode: /^\d{6}$/,
money:/^\d*(?:\.\d{0,2})?$/,
weight:/^\d*(?:\.\d{0,3})?$/,
weight:/^\d*(?:\.\d{0,3})?$/,
quantity: /^[1-9]+[0-9]*$/, // 数量,大于等于1的正整数
identity: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, // 数量,大于等于1的正整数
}
\ No newline at end of file
identity: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, // 身份证
}
......@@ -21,7 +21,7 @@ import Submit from '@/components/NiceForm/components/Submit'
import { ISchema } from '@formily/antd';
import { clearModalParams } from '@/utils';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { getProductCustomerGetCustomerAttributeTree, getProductCustomerGetCustomerAttributeValueList, getProductPlatformGetSyncAttributeValueList, postProductCustomerDeleteCustomerAttributeValue, postProductCustomerUpdateCustomerAttributeValueStatus } from '@/services/ProductV2Api';
import { getProductCustomerGetCustomerAttributeTree, getProductCustomerGetCustomerAttributeValueList, getProductPlatformGetSyncAttributeValueList, postProductCustomerDeleteCustomerAttributeValue, postProductCustomerSyncAttributeValue, postProductCustomerUpdateCustomerAttributeValueStatus } from '@/services/ProductV2Api';
const treeActions = createTreeActions()
......@@ -296,7 +296,6 @@ const PropertyValue: React.FC<{}> = () => {
const handleAsyncOk = () => {
setSyncLoading(true)
if (rowSelectionCtl.selectedRowKeys.length) {
// @ts-ignore
postProductCustomerSyncAttributeValue({ idList: rowSelectionCtl.selectedRowKeys }).then(res => {
if (res.code === 1000) {
if (ref?.current?.reload) {
......
......@@ -15,7 +15,7 @@ import { memberStatusMap, moveStatusMap, operationMap, statusMap } from '../../c
import { StandardTable } from 'god'
import QRCode from 'qrcode';
import { ScanOutlined } from '@ant-design/icons'
import { getPayAssetAccountGetAccountStatusRecord, getPayAssetAccountGetAccountTradeRecord, getPayAssetAccountGetAssetAccount, getPayAssetAccountGetRechargeResult, postPayAssetAccountRecharge } from '@/services/PayV2Api'
import { getPayAssetAccountGetRechargeResult, getPayEAccountAllInPayGetAccountDetail, getPayEAccountAllInPayGetEAccountStatusRecord, getPayEAccountAllInPayGetEAccountTradeRecord, postPayAssetAccountRecharge } from '@/services/PayV2Api'
interface rechargeItem {
codeUrl: string;
......@@ -63,10 +63,11 @@ const EAccountDetail: React.FC<{}> = () => {
const getAccountInfo = async () => {
const { id = 161 } = history.location.query
setPageId(id)
let res = await getPayAssetAccountGetAssetAccount({id: id+''})
const { code, data } = res
let res = await getPayEAccountAllInPayGetAccountDetail({id: id+''})
const { code, data, message: msg } = res
if(code !== 1000) { return message.error(msg) }
setDetails(data)
getPayAssetAccountGetAccountStatusRecord({memberAssetAccountId: id + ''}).then(res => {
getPayEAccountAllInPayGetEAccountStatusRecord({id: id + ''}).then(res => {
const { data } = res
setMoveData(data)
})
......@@ -76,7 +77,7 @@ const EAccountDetail: React.FC<{}> = () => {
// 获取交易记录
const fetchTradeData = (params) => {
return new Promise((resolve, reject) => {
getPayAssetAccountGetAccountTradeRecord({memberAssetAccountId: history.location.query.id + '', ...params}).then(res => {
getPayEAccountAllInPayGetEAccountTradeRecord({...params}).then(res => {
const { data } = res
resolve(data)
})
......
......@@ -8,7 +8,7 @@ import { EDetailContext } from '../../constant'
const CompanyFinish: React.FC<{}> = () => {
const [form] = Form.useForm();
const eDetailContext = useContext(EDetailContext)
const { ctl, finish, perfection, approved } = eDetailContext
const { ctl, finish, perfection } = eDetailContext
return (<div>
<MellowCard headStyle={{borderBottom:'none'}} title="企业信息" id="companyInfo">
......
import React, { useContext } from 'react'
import { Button, Col, Form, Input, Row, Select } from 'antd'
import MellowCard from '@/components/MellowCard';
import { EDetailContext, formItemLayout, prefixSelector, tailFormItemLayout } from '../../constant';
import { BIND_PHONE, EDetailContext, formItemLayout, prefixSelector, tailFormItemLayout } from '../../constant';
import useCountDown from '@/utils/hooks';
import { PATTERN_MAPS } from '@/constants/regExp';
import { postPayAllInPayPersonalCrate, postPayAllInPaySendVerificationCode } from '@/services/PayV2Api';
/** 个人 初始认证 */
const Personal: React.FC<{}> = () => {
const { Option } = Select;
const [form] = Form.useForm();
const eDetailContext = useContext(EDetailContext)
const { ctl } = eDetailContext
const { ctl, reloadFormData } = eDetailContext
const onFinish = (values: any) => {
ctl.setApproved(true)
const onFinish = async (values: any) => {
const { code } = await postPayAllInPayPersonalCrate({...values})
if(code === 1000) {
reloadFormData()
}
console.log('Received values of form: ', values);
};
const { text, isActive, start } = useCountDown({
maxTime: 60,
minTime: 0,
initText: '获取验证码',
onEnd: () => { console.log("end") },
decayRate: 1,
delay: 1 * 1000
})
const handleSendSMS = () => {
form.validateFields(['phone']).then(result => {
console.log(result)
// 发送验证码
postPayAllInPaySendVerificationCode({...result, verificationCodeType: BIND_PHONE}).then(res => {
res.code === 1000 && start()
})
})
}
return (
<MellowCard headStyle={{borderBottom:'none'}} title="个人认证">
<Form
......@@ -43,7 +68,7 @@ const Personal: React.FC<{}> = () => {
</Form.Item>
<Form.Item
name="type"
name="cardType"
label="证件类型"
rules={[
{
......@@ -58,13 +83,17 @@ const Personal: React.FC<{}> = () => {
</Form.Item>
<Form.Item
name="idcard"
name="cardNo"
label="证件号码"
rules={[
{
required: true,
message: '请输入证件号码',
},
{
pattern: PATTERN_MAPS.identity,
message: '请输入证件号码'
}
]}
>
<Input placeholder="请输入证件号码" />
......@@ -73,7 +102,16 @@ const Personal: React.FC<{}> = () => {
<Form.Item
name="phone"
label="手机号码"
rules={[{ required: true, message: '请输入手机号码' }]}
rules={[
{
required: true,
message: '请输入手机号码'
},
{
pattern: PATTERN_MAPS.phone,
message: '请输入手机号码'
}
]}
>
<Input addonBefore={prefixSelector} style={{ width: '100%' }} placeholder="请输入手机号码" />
</Form.Item>
......@@ -84,13 +122,22 @@ const Personal: React.FC<{}> = () => {
<Form.Item
name="captcha"
noStyle
rules={[{ required: true, message: '请输入验证码' }]}
rules={[
{
required: true,
message: '请输入验证码'
},
{
pattern: /^\d{5}$/,
message: '请输入验证码'
}
]}
>
<Input placeholder="请输入验证码" />
</Form.Item>
</Col>
<Col span={4}>
<Button>获取验证码</Button>
<Button disabled={isActive} onClick={handleSendSMS}>{text}</Button>
</Col>
</Row>
</Form.Item>
......
......@@ -9,7 +9,7 @@ import { EDetailContext, formItemLayout, tailFormItemLayout } from '../../consta
const PersonalFinish: React.FC<{}> = () => {
const [form] = Form.useForm();
const eDetailContext = useContext(EDetailContext)
const { ctl, finish, perfection, approved } = eDetailContext
const { ctl, finish, perfection } = eDetailContext
const onFinish = (values: any) => {
ctl.setFinish(true) // 已经完善
......
......@@ -2,6 +2,15 @@ import { createContext } from 'react';
import { Form, Select } from 'antd';
const { Option } = Select;
/**
* 绑定手机
*/
export const BIND_PHONE = 9;
/**
* 解绑手机
*/
export const UNBIND_PHONE = 6;
// e账户认证 组件切换控制 Context
export const EDetailContext = createContext<any>({})
......
import { getPayAllInPayGetAuthMemberInfo, postPayAllInPayCreateMember, postPayAllInPayGetMemberInfo } from '@/services/PayV2Api';
import { getAuth } from '@/utils/auth';
import { message } from 'antd';
import { useCallback, useState, useEffect } from 'react'
import { message } from 'antd'
/**
* 企业会员
*/
export const MEMBER_TYPE_CORPORATE = 1;
/**
* 个人会员
*/
export const MEMBER_TYPE_INDIVIDUAL = 2;
export const MEMBER_TYPE = {
[MEMBER_TYPE_CORPORATE]: 'company',
[MEMBER_TYPE_INDIVIDUAL]: 'personal',
};
export const useEDetail = () => {
/** 详情数据 */
const { memberRoleType } = getAuth() || {}
/** 详情数据 null从未认证*/
const [formData, setFormData] = useState<any>(null)
/** 企业/个人 */
const [type, setType] = useState<'company'|'personal'>('company')
/** 是否认证过 */
const [approved, setApproved] = useState<boolean>(false)
const [type, setType] = useState<'company'|'personal'>(MEMBER_TYPE[memberRoleType])
/** 是否需要完善 */
const [perfection, setPerfection] = useState<boolean>(false)
/** 是否完善过 */
......@@ -21,32 +36,28 @@ export const useEDetail = () => {
reloadFormData()
}, [])
const reloadFormData = useCallback(async () => {
// const fn = switchApi(type);
// let params: any = {};
// params[switchParamField(type)] = id
// const { code, data, message: msg } = await fn(params, { ctlType: "none" })
// if (code === 1000) {
setFormData({})
// } else {
// message.error(msg)
// }
const { code, data, message: msg } = await postPayAllInPayGetMemberInfo({}, {ctlType: 'none'})
if (code === 1000) {
!data && await postPayAllInPayCreateMember({}, {ctlType: 'none'})
setFormData(data)
} else {
message.error(msg)
}
}, [])
// 需共享的状态
const formContext = {
data: formData,
type,
approved,
// approved,
finish,
perfection,
backed,
showAnchor,
ctl: {
setFormData,
setApproved,
// setApproved,
setPerfection,
setBacked,
setShowAnchor,
......
......@@ -14,11 +14,11 @@ const EAccountApprove: React.FC<{}> = () => {
const {
type,
approved,
perfection,
finish,
backed,
showAnchor } = formContext
showAnchor,
data } = formContext
const personalLinkList = [
{ title: '个人信息', id: 'personalInfo' },
......@@ -40,7 +40,7 @@ const EAccountApprove: React.FC<{}> = () => {
/>
<div className={styles.wrapper}>
{
type === 'personal' ? (approved ? <PersonalFinish /> : <Personal />) : (approved ? <CompanyFinish /> : <Company />)
type === 'personal' ? (data?.name ? <PersonalFinish /> : <Personal />) : (data ? <CompanyFinish /> : <Company />)
}
</div>
</EDetailContext.Provider>
......
......@@ -548,6 +548,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
const handleSubmitModifyPrice = () => {
modifyPriceActions.submit().then(async ({values}: any) => {
values.orderId = data.orderId
values.prices = [{ orderProductId: values.orderProductId, price: values.price, reason: values.reason }]
console.log(values)
const result = await runPrice(values)
if (result.code === 1000) {
......
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