Commit 2e7ef061 authored by GuanHua's avatar GuanHua
parents dca2278f 4da6bc54
......@@ -79,7 +79,7 @@ const memberCenterRoute = {
// ProcurementRoute,
// // 合同能力
// contracRoute,
AuthConfigRoute,
// AuthConfigRoute,
// MemberRoute,
// HandlingRoute,
// PayandSettleRoute,
......
......@@ -11,6 +11,10 @@ const FLAG_SIZE = 60
const IMG_WIDTH = 352
const IMG_HEIGHT = 180
// 国家前缀 暂时写死
const prefixCode = '+86'
const Phone = (props) => {
const { value, form, schema } = props
const {text, isActive, start} = useCountDown({
......@@ -18,6 +22,7 @@ const Phone = (props) => {
minTime: 0,
initText: '获取验证码',
onEnd: () => {
instanceRef.current.canIUseSms = false
form.setFieldState('phone', state => {
state.smsLoading = instanceRef.current.canIUseSms
})
......@@ -74,10 +79,39 @@ const Phone = (props) => {
}
}, [isShowValidate, isActive])
const validatePhoneRequest = async () => {
return new Promise(async (resolve, reject) => {
try {
const { code } = await PublicApi.getMemberRegisterPhoneCheck({
countryCode: prefixCode,
phone: form.getFieldValue('phone')
}, { ctlType: 'none', useCache: true, ttl: 60 * 1000 })
if (code !== 1000) {
form.setFieldState('phone', state => {
state.errors = ['手机号已存在']
resolve(false)
godEvent.emit('SHOW_PHONE_VALIDATE', false)
})
} else {
resolve(true)
}
} catch(err) {
console.log(err)
resolve(false)
}
})
}
const handleClickSms = async () => {
const validateState = await form.validate('phone')
// 注册页手机号字段
const validatePhoneState = await form.validate('phone')
// 忘记密码 手机号或邮箱字段
const validateAccountState = await form.validate('account')
const phoneAsyncValidate = await validatePhoneRequest()
// 手机号未通过校验
if (validateState.errors > 0) {
if (validatePhoneState.errors > 0 || validateAccountState.errors > 0 || !phoneAsyncValidate) {
return false
}
......
......@@ -191,7 +191,7 @@ export const GeneralEffect = (int, data) => {
col: [
{
label: '优惠规则', extra: <Space direction='vertical'>
{data.ladderBOList.map(item => (<div>{`满 ${item.discount} 件, 打 ${item.num} 折`}</div>))}
{data.ladderList.map(item => (<div>{`满 ${item.discount} 件, 打 ${item.num} 折`}</div>))}
</Space>
},
{
......
......@@ -13,20 +13,11 @@ const columns_1 = ({
const handleInputChange = (e, name, index) => {
const { value } = e.target;
const params = [...dataSource];
const newData = params.map((_item, _i) => {
const _idx = Number(((current - 1) * 10) + _i);
if (_idx === index) {
return {
..._item,
[name]: Number(value)
}
}
return _item
})
params[index][name] = Number(value);
form.setFieldsValue({
'productList': newData
'productList': params
})
setDataSource(newData)
setDataSource(params)
}
return (
......
......@@ -16,28 +16,16 @@ const columns_2 = ({
const handleInputChange = (e, name, index) => {
const { value } = e.target;
const params = [...dataSource];
const newData = params.map((_item, _i) => {
const _idx = Number(((current - 1) * 10) + _i);
if (_idx === index) {
if (name === 'plummetPrice') {
return {
..._item,
[name]: Number(value),
'activityPrice': sumTotal(_item.price, value)
}
} else {
return {
..._item,
[name]: Number(value)
}
}
}
return _item
})
if(name === 'plummetPrice') {
params[index][name] = Number(value);
params[index]['activityPrice'] = sumTotal(params[index]['price'], value);
} else {
params[index][name] = Number(value);
}
form.setFieldsValue({
'productList': newData
'productList': params
})
setDataSource(newData)
setDataSource(params)
}
return (
......
......@@ -13,29 +13,16 @@ const columns_3 = ({
const handleInputChange = (e, name, index) => {
const { value } = e.target;
const params = [...dataSource];
const newData = params.map((_item, _i) => {
const _idx = Number(((current - 1) * 10) + _i);
if (_idx === index) {
if (name === 'discount') {
return {
..._item,
[name]: Number(value),
'activityPrice': Number(_item.price) * (Number(value)) / 100,
}
} else {
return {
..._item,
[name]: Number(value)
}
}
}
return _item
})
if(name === 'discount') {
params[index][name] = Number(value);
params[index]['activityPrice'] = Number(params[index]['price']) * (Number(value)) / 100;
} else {
params[index][name] = Number(value);
}
form.setFieldsValue({
'productList': newData
'productList': params
})
setDataSource(newData)
setDataSource(params)
}
return (
[
......
......@@ -14,20 +14,11 @@ const columns_4 = ({
const handleInputChange = (e, name, index) => {
const { value } = e.target;
const params = [...dataSource];
const newData = params.map((_item, _i) => {
const _idx = Number(((current - 1) * 10) + _i);
if (_idx === index) {
return {
..._item,
[name]: Number(value)
}
}
return _item
})
params[index][name] = Number(value);
form.setFieldsValue({
'productList': newData
'productList': params
})
setDataSource(newData)
setDataSource(params)
}
return (
[
......
......@@ -12,20 +12,11 @@ const columns_5 = ({
const handleInputChange = (e, name, index) => {
const { value } = e.target;
const params = [...dataSource];
const newData = params.map((_item, _i) => {
const _idx = Number(((current - 1) * 10) + _i);
if (_idx === index) {
return {
..._item,
[name]: Number(value)
}
}
return _item
})
params[index][name] = Number(value);
form.setFieldsValue({
'productList': newData
'productList': params
})
setDataSource(newData)
setDataSource(params)
}
return (
[
......
......@@ -13,20 +13,11 @@ const columns_6 = ({
const handleInputChange = (e, name, index) => {
const { value } = e.target;
const params = [...dataSource];
const newData = params.map((_item, _i) => {
const _idx = Number(((current - 1) * 10) + _i);
if (_idx === index) {
return {
..._item,
[name]: Number(value)
}
}
return _item
})
params[index][name] = Number(value);
form.setFieldsValue({
'productList': newData
'productList': params
})
setDataSource(newData)
setDataSource(params)
}
return (
[
......
......@@ -13,20 +13,11 @@ const columns_7 = ({
const handleInputChange = (e, name, index) => {
const { value } = e.target;
const params = [...dataSource];
const newData = params.map((_item, _i) => {
const _idx = Number(((current - 1) * 10) + _i);
if (_idx === index) {
return {
..._item,
[name]: Number(value)
}
}
return _item
})
params[index][name] = Number(value);
form.setFieldsValue({
'productList': newData
'productList': params
})
setDataSource(newData)
setDataSource(params)
}
return (
......
......@@ -12,20 +12,11 @@ const columns_8 = ({
const handleInputChange = (e, name, index) => {
const { value } = e.target;
const params = [...dataSource];
const newData = params.map((_item, _i) => {
const _idx = Number(((current - 1) * 10) + _i);
if (_idx === index) {
return {
..._item,
[name]: Number(value)
}
}
return _item
})
params[index][name] = Number(value);
form.setFieldsValue({
'productList': newData
'productList': params
})
setDataSource(newData)
setDataSource(params)
}
return (
[
......
......@@ -9,6 +9,7 @@ import CollocationLayout from '@/pages/transaction/marketingAbility/components/c
import { remindLayout, RemindLayoutProps } from '@/pages/transaction/marketingAbility/paltformSign/readySubmitExamine/components/productListLayout/remind';
import CouponsListLayout from '@/pages/transaction/marketingAbility/components/couponsListLayout';
import { number } from 'yargs';
import { PublicApi } from '@/services/api';
type optionProps = {
/** key */
......@@ -185,7 +186,6 @@ const ProductListLayout: React.FC<ProductListProps> = (props: any) => {
setDataSource(fields)
}
return (
<CardLayout
id="productListLayout"
......
......@@ -199,6 +199,22 @@ const DetialLayout = () => {
})
}
// useEffect(() => {
// if (!isEmpty(dataSource)) {
// PublicApi.postMarketingPlatformActivitySignupGetFilterSkuId({
// activityType: dataSource.activityType,
// activityDefinedBO: dataSource.activityDefined.allowActivity,
// startTime: dataSource.startTime,
// endTime: dataSource.endTime,
// }, { ctlType: 'none' }).then(res => {
// if (res.code !== 1000) {
// return
// }
// console.log(res.data)
// })
// }
// }, [dataSource])
return (
<Context.Provider value={dataSource}>
<PeripheralLayout
......
......@@ -5,6 +5,7 @@ import CardLayout from '../card';
import style from './index.less';
import { isEmpty } from 'lodash';
import { PublicApi } from '@/services/api';
import { GlobalConfig } from '@/global/config';
type ShopItem = {
describe?: string
......@@ -31,7 +32,7 @@ const ShopLayout: React.FC<shopListProps> = (props: any) => {
const [mallList, setMallList] = useState<ShopItem[]>([]);
useEffect(() => {
PublicApi.getManageShopFindByMemberType().then(res => {
PublicApi.postManageWebShopWebAll({siteId: GlobalConfig.global.siteInfo.id.toString(), hasMemberType: 1}, { ctlType: 'none' }).then(res => {
if (res.code !== 1000) {
return
}
......@@ -69,6 +70,8 @@ const ShopLayout: React.FC<shopListProps> = (props: any) => {
console.log(onSetShopList, mallList)
}, [onSetShopList])
return (
<CardLayout
id="shopLayout"
......
......@@ -48,24 +48,24 @@ const useLinkageValidateEffects = () => {
})
})
onFieldValidateEnd$('phone').subscribe(fieldState => {
if (fieldState.valid && !fieldState.smsLoading) {
// 校验手机号格式通过时, 需请求接口判断手机号是否存在数据库
PublicApi.getMemberRegisterPhoneCheck({
countryCode: prefixCode,
phone: fieldState.value
}, { ctlType: 'none', useCache: true, ttl: 60 * 1000 }).then(({ code, data }) => {
if (code !== 1000) {
setFieldState('phone', state => {
state.errors = ['手机号已存在']
eventEmitter.emit('SHOW_PHONE_VALIDATE', false)
})
} else {
eventEmitter.emit('SHOW_PHONE_VALIDATE', true)
}
})
} else {
eventEmitter.emit('SHOW_PHONE_VALIDATE', false)
}
// if (fieldState.valid && !fieldState.smsLoading) {
// // 校验手机号格式通过时, 需请求接口判断手机号是否存在数据库
// PublicApi.getMemberRegisterPhoneCheck({
// countryCode: prefixCode,
// phone: fieldState.value
// }, { ctlType: 'none', useCache: true, ttl: 60 * 1000 }).then(({ code, data }) => {
// if (code !== 1000) {
// setFieldState('phone', state => {
// state.errors = ['手机号已存在']
// eventEmitter.emit('SHOW_PHONE_VALIDATE', false)
// })
// } else {
// eventEmitter.emit('SHOW_PHONE_VALIDATE', true)
// }
// })
// } else {
// eventEmitter.emit('SHOW_PHONE_VALIDATE', false)
// }
})
onFieldValueChange$('*(confirmPassword)').subscribe(fieldState => {
const selfValue = fieldState.value
......
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