Commit bcb8151b authored by 前端-许佳敏's avatar 前端-许佳敏

优化注册校验

parent 75e473aa
...@@ -48,7 +48,7 @@ const serviceConfig = { ...@@ -48,7 +48,7 @@ const serviceConfig = {
shopInfo: { shopInfo: {
url: '/manage/shop/findShopsBySiteId', url: '/manage/shop/findShopsBySiteId',
params: { params: {
siteId: SITE_ID siteId: SITE_ID,
}, },
method: 'get' method: 'get'
}, },
......
...@@ -245,7 +245,7 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => { ...@@ -245,7 +245,7 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
columns={outOrderCols} columns={outOrderCols}
dataSource={orderReceivingStatisticsResponses} dataSource={orderReceivingStatisticsResponses}
pagination={false} pagination={false}
rowKey="id" rowKey="productId"
/> />
</Tabs.TabPane> </Tabs.TabPane>
<Tabs.TabPane tab='订单收货明细' key="2"> <Tabs.TabPane tab='订单收货明细' key="2">
......
...@@ -6,4 +6,96 @@ ...@@ -6,4 +6,96 @@
.card-list_title { .card-list_title {
font-size: 14px; font-size: 14px;
color: #909399; color: #909399;
} }
\ No newline at end of file
.list_radio {
border: 1px solid #fff;
}
.invoice_list_item {
display: flex;
align-items: center;
background: #F4F5F7;
font-size: 12px;
flex: 1;
margin-top: 12px;
padding: 6px 0;
&_content {
padding-left: 10px;
&_tag {
display: inline-block;
background-color: #909399;
padding: 0 6px;
height: 16px;
line-height: 16px;
color: #fff;
font-size: 12px;
&.special {
background-color: #5377ce;
}
}
&_name {
.default {
width: 64px;
height: 16px;
line-height: 16px;
text-align: center;
background: rgba(238, 238, 238, 1);
font-size: 12px;
color: #606266;
}
& > span {
margin-right: 20px;
}
}
}
&_btn_group {
display: flex;
margin-left: auto;
line-height: 14px;
// height: 14px;
.invoice_list_item_btn {
margin: 0 10px;
}
}
}
:global {
span.ant-radio + * {
display: block;
width: 100%;
}
.ant-radio-wrapper {
display: flex;
width: 100%;
align-items: center;
height: 72px;
background-color: #fafafa;
margin: 10px;
padding-left: 16px;
}
.ant-radio-wrapper.ant-radio-wrapper-checked {
border: 1px solid @main-color;
&::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-bottom: 12px solid @main-color;
border-left: 12px solid transparent;
bottom: 0;
right: 0;
z-index: 5;
}
}
}
...@@ -7,6 +7,7 @@ import { DELIVERY_TYPE } from '@/constants' ...@@ -7,6 +7,7 @@ import { DELIVERY_TYPE } from '@/constants'
import style from './index.less' import style from './index.less'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import ContractList from '../../../../components/ContractList' import ContractList from '../../../../components/ContractList'
import cx from 'classnames'
export interface OrderMergeInfoProps { } export interface OrderMergeInfoProps { }
const payInfo = [ const payInfo = [
...@@ -29,7 +30,21 @@ const payInfo = [ ...@@ -29,7 +30,21 @@ const payInfo = [
] ]
const otherInfo = [ const otherInfo = [
{ title: '发票', name: 'theInvoiceInfo' }, { title: '发票', name: 'theInvoiceInfo', render: item => <div className={style.invoice_list_item}>
<div className={style.invoice_list_item_content}>
<div className={cx(style.invoice_list_item_content_tag, item.kind !== 1 ? style.special : '')}>{item.kind === 1 ? '增值税普通发票' : '增值税专用发票'}</div>
<div className={style.invoice_list_item_content_name}>
<div>{item.invoiceTitle}</div>
<div>{item.taxNo}</div>
</div>
</div>
{
<div className={style.invoice_list_item_btn_group}>
{/* 查看功能todo */}
{/* <div className={style.invoice_list_item_btn}>查看</div> */}
</div>
}
</div>, resetCol: {flex: '1 1 100%'} },
{ title: '包装要求', name: 'pageRequire' }, { title: '包装要求', name: 'pageRequire' },
{ title: '其他要求', name: 'restsRequire' }, { title: '其他要求', name: 'restsRequire' },
] ]
...@@ -40,7 +55,7 @@ const electronInfo = [ ...@@ -40,7 +55,7 @@ const electronInfo = [
const RenderCard = ({ infoList, dataSource }) => infoList.map(v => dataSource[v.name] ? <Row key={v.name} className={style['card-list']}> const RenderCard = ({ infoList, dataSource }) => infoList.map(v => dataSource[v.name] ? <Row key={v.name} className={style['card-list']}>
<Col span={6} className={style['card-list_title']}>{v.title}</Col> <Col span={6} className={style['card-list_title']}>{v.title}</Col>
<Col flex={1}>{v.render ? v.render(dataSource[v.name], dataSource) : dataSource[v.name]}</Col> <Col flex={1} {...v.resetCol}>{v.render ? v.render(dataSource[v.name], dataSource) : dataSource[v.name]}</Col>
</Row> : null) </Row> : null)
const OrderMergeInfo: React.FC<OrderMergeInfoProps> = (props) => { const OrderMergeInfo: React.FC<OrderMergeInfoProps> = (props) => {
......
...@@ -41,7 +41,7 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => { ...@@ -41,7 +41,7 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
const electronRef = useRef<any>({}) const electronRef = useRef<any>({})
useEffect(() => { useEffect(() => {
if (id) { if (id) {
PublicApi.getOrderPurchaseOrderDetails({ id }).then(({ data, code }) => { PublicApi.getOrderProcurementOrderDetails({ id }).then(({ data, code }) => {
if (code === 1000) { if (code === 1000) {
setFormData(data) setFormData(data)
} }
......
...@@ -10,4 +10,96 @@ ...@@ -10,4 +10,96 @@
.fullHeight { .fullHeight {
height: 100%; height: 100%;
} }
\ No newline at end of file
.list_radio {
border: 1px solid #fff;
}
.invoice_list_item {
display: flex;
align-items: center;
background: #F4F5F7;
font-size: 12px;
flex: 1;
margin-top: 12px;
padding: 6px 0;
&_content {
padding-left: 10px;
&_tag {
display: inline-block;
background-color: #909399;
padding: 0 6px;
height: 16px;
line-height: 16px;
color: #fff;
font-size: 12px;
&.special {
background-color: #5377ce;
}
}
&_name {
.default {
width: 64px;
height: 16px;
line-height: 16px;
text-align: center;
background: rgba(238, 238, 238, 1);
font-size: 12px;
color: #606266;
}
& > span {
margin-right: 20px;
}
}
}
&_btn_group {
display: flex;
margin-left: auto;
line-height: 14px;
// height: 14px;
.invoice_list_item_btn {
margin: 0 10px;
}
}
}
:global {
span.ant-radio + * {
display: block;
width: 100%;
}
.ant-radio-wrapper {
display: flex;
width: 100%;
align-items: center;
height: 72px;
background-color: #fafafa;
margin: 10px;
padding-left: 16px;
}
.ant-radio-wrapper.ant-radio-wrapper-checked {
border: 1px solid @main-color;
&::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-bottom: 12px solid @main-color;
border-left: 12px solid transparent;
bottom: 0;
right: 0;
z-index: 5;
}
}
}
...@@ -7,6 +7,7 @@ import { DELIVERY_TYPE } from '@/constants' ...@@ -7,6 +7,7 @@ import { DELIVERY_TYPE } from '@/constants'
import style from './index.less' import style from './index.less'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import ContractList from '@/pages/transaction/components/ContractList' import ContractList from '@/pages/transaction/components/ContractList'
import cx from 'classnames'
export interface OrderMergeInfoProps { } export interface OrderMergeInfoProps { }
const payInfo = [ const payInfo = [
...@@ -29,7 +30,21 @@ const payInfo = [ ...@@ -29,7 +30,21 @@ const payInfo = [
] ]
const otherInfo = [ const otherInfo = [
{ title: '发票', name: 'theInvoiceInfo' }, { title: '发票', name: 'theInvoiceInfo', render: item => <div className={style.invoice_list_item}>
<div className={style.invoice_list_item_content}>
<div className={cx(style.invoice_list_item_content_tag, item.kind !== 1 ? style.special : '')}>{item.kind === 1 ? '增值税普通发票' : '增值税专用发票'}</div>
<div className={style.invoice_list_item_content_name}>
<div>{item.invoiceTitle}</div>
<div>{item.taxNo}</div>
</div>
</div>
{
<div className={style.invoice_list_item_btn_group}>
{/* 查看功能todo */}
{/* <div className={style.invoice_list_item_btn}>查看</div> */}
</div>
}
</div>, resetCol: {flex: '1 1 100%'} },
{ title: '包装要求', name: 'pageRequire' }, { title: '包装要求', name: 'pageRequire' },
{ title: '其他要求', name: 'restsRequire' }, { title: '其他要求', name: 'restsRequire' },
] ]
......
...@@ -171,7 +171,7 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => { ...@@ -171,7 +171,7 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
} }
const renderExtra = () => { const renderExtra = () => {
if (!formData || page_type === SALE_ORDER_STATUS.PREVIEW_ORDER || page_type === SaleOrderInsideWorkState.CONFIRM_DELIVERY_ORDER) { if (!formData || page_type === SALE_ORDER_STATUS.PREVIEW_ORDER || page_type === SALE_ORDER_STATUS.CONFIRM_DELIVE_GOODS_ORDER) {
return null return null
} }
let text = '' let text = ''
......
...@@ -19,7 +19,10 @@ import { PublicApi } from '@/services/api'; ...@@ -19,7 +19,10 @@ import { PublicApi } from '@/services/api';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import schemas from './schema'; import schemas from './schema';
const { onFieldValueChange$ } = FormEffectHooks const { onFieldValueChange$, onFieldInputChange$, onFieldValidateEnd$ } = FormEffectHooks
// 国家前缀 暂时写死
const prefixCode = '+86'
let formCache: any = {} let formCache: any = {}
...@@ -36,6 +39,29 @@ const CustomInput = props => { ...@@ -36,6 +39,29 @@ const CustomInput = props => {
// 检验联动 // 检验联动
const useLinkageValidateEffects = () => { const useLinkageValidateEffects = () => {
const { setFieldState, getFieldState } = createFormActions() const { setFieldState, getFieldState } = createFormActions()
onFieldInputChange$('phone').subscribe(fieldState => {
// 手动输入的时候 重置校验信息
setFieldState('phone', state => {
state.errors = []
})
})
onFieldValidateEnd$('phone').subscribe(fieldState => {
if (fieldState.valid) {
// 校验手机号格式通过时, 需请求接口判断手机号是否存在数据库
PublicApi.getMemberRegisterPhoneCheck({
countryCode: prefixCode,
phone: fieldState.value
}, {ctlType: 'none', useCache: true, ttl: 60 * 1000}).then(({code, data}) => {
if (code === 1000) {
} else {
setFieldState('phone', state => {
state.errors = ['手机号已存在']
})
}
})
}
})
onFieldValueChange$('*(password,confirmPassword)').subscribe(fieldState => { onFieldValueChange$('*(password,confirmPassword)').subscribe(fieldState => {
const selfName = fieldState.name const selfName = fieldState.name
const selfValue = fieldState.value const selfValue = fieldState.value
...@@ -177,7 +203,7 @@ const UserRegistry = () => { ...@@ -177,7 +203,7 @@ const UserRegistry = () => {
const { values } = data const { values } = data
formCache = Object.assign({}, formCache, filterUndef(values)) formCache = Object.assign({}, formCache, filterUndef(values))
// 写死传入的区号 // 写死传入的区号
formCache.countryCode = '+86' formCache.countryCode = prefixCode
const params = omit(formCache, ['isRead', 'confirmPassword']) const params = omit(formCache, ['isRead', 'confirmPassword'])
setSubmitLoading(true) setSubmitLoading(true)
PublicApi.postMemberRegister(params).then(({ code }) => { PublicApi.postMemberRegister(params).then(({ code }) => {
......
...@@ -22,6 +22,7 @@ export const registerStep0Schema: ISchema = { ...@@ -22,6 +22,7 @@ export const registerStep0Schema: ISchema = {
message: '请填写手机号' message: '请填写手机号'
} }
], ],
triggerType: 'onBlur',
"x-component-props": { "x-component-props": {
placeholder: '请输入您的手机号码', placeholder: '请输入您的手机号码',
size: 'large' size: 'large'
...@@ -45,7 +46,7 @@ export const registerStep0Schema: ISchema = { ...@@ -45,7 +46,7 @@ export const registerStep0Schema: ISchema = {
} }
}, },
password: { password: {
type: 'password', type: 'string',
required: true, required: true,
"x-rules": [ "x-rules": [
{ {
...@@ -54,12 +55,13 @@ export const registerStep0Schema: ISchema = { ...@@ -54,12 +55,13 @@ export const registerStep0Schema: ISchema = {
} }
], ],
"x-component-props": { "x-component-props": {
type: 'password',
placeholder: '请设置你的登录密码', placeholder: '请设置你的登录密码',
size: 'large', size: 'large'
} }
}, },
confirmPassword: { confirmPassword: {
type: 'password', type: 'string',
required: true, required: true,
"x-rules": [ "x-rules": [
{ {
...@@ -68,6 +70,7 @@ export const registerStep0Schema: ISchema = { ...@@ -68,6 +70,7 @@ export const registerStep0Schema: ISchema = {
} }
], ],
"x-component-props": { "x-component-props": {
type: 'password',
placeholder: '请再次输入你的登录密码', placeholder: '请再次输入你的登录密码',
size: 'large', size: 'large',
} }
......
...@@ -132,7 +132,7 @@ class ApiRequest { ...@@ -132,7 +132,7 @@ class ApiRequest {
} else { } else {
// 使用resolve将数据返回, 请求时需手动处理data为null的情况 // 使用resolve将数据返回, 请求时需手动处理data为null的情况
resolve(res) resolve(res)
message.error(res.message) options.ctlType === 'message' && message.success(res.message)
} }
}).catch((err: IRequestError) => { }).catch((err: IRequestError) => {
......
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