Commit 58258094 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents f5224258 19ae3462
......@@ -13,6 +13,7 @@ const router = [
routes: [
{
path: '/',
relationParentCode: 'home',
redirect: '/memberCenter/home'
},
{
......
......@@ -12,16 +12,20 @@ const IMG_WIDTH = 352
const IMG_HEIGHT = 180
const Phone = (props) => {
const { value, form, schema } = props
const {text, isActive, start} = useCountDown({
maxTime: 60,
minTime: 0,
initText: '获取验证码',
onEnd: () => {},
onEnd: () => {
form.setFieldState('phone', state => {
state.smsLoading = instanceRef.current.canIUseSms
})
},
decayRate: 1,
delay: 1 * 1000
})
const { value, form, schema } = props
const { smsFn, ...componentProps } = schema.getExtendsComponentProps() || {}
const [loading, setLoading] = useState(false)
......@@ -38,11 +42,11 @@ const Phone = (props) => {
useEffect(() => {
godEvent.on('SHOW_PHONE_VALIDATE', (payload) => {
if (!isActive) {
if (isActive) {
// 验证码在loading的时候 不能再次触发
return ;
}
setIsShowValidate(true)
setIsShowValidate(payload)
})
return () => {
......@@ -51,14 +55,13 @@ const Phone = (props) => {
}, [])
useEffect(() => {
if (isShowValidate) {
if (isShowValidate && !isActive) {
PublicApi.getMemberCaptcha({
width: IMG_WIDTH.toString(),
height: IMG_HEIGHT.toString(),
size: FLAG_SIZE.toString()
}).then(res => {
const { backImage, width, height, imgId } = res.data
console.log(Number(decryptedByAES(width)))
setRemoteImg(() => {
return {
img: 'data:image/jpeg;base64,' +backImage,
......@@ -70,10 +73,21 @@ const Phone = (props) => {
})
}
}, [isShowValidate])
const handleClickSms = () => {
}, [isShowValidate, isActive])
const handleClickSms = async () => {
const validateState = await form.validate('phone')
// 手机号未通过校验
if (validateState.errors > 0) {
return false
}
// 短信正在读秒中
if (isActive) {
return false
}
// 尚未通过滑块校验
if (!instanceRef.current.canIUseSms) {
message.error('请先进行验证码校验')
setIsShowValidate(true)
return false
}
......@@ -89,6 +103,9 @@ const Phone = (props) => {
const handleStartSms = () => {
setLoading(true)
form.setFieldState('phone', state => {
state.smsLoading = instanceRef.current.canIUseSms
})
PublicApi.postMemberRegisterSms({
countryCode: '+86',
width: String(remoteImg.x),
......@@ -103,8 +120,8 @@ const Phone = (props) => {
const handleCheckSuccess = (reset) => {
setTimeout(() => {
setIsShowValidate(false)
handleStartSms()
instanceRef.current.canIUseSms = true
handleStartSms()
}, 1000)
}
......
......@@ -93,7 +93,6 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
const list = routes.filter((item: any) => pathname.indexOf(item.key) > -1)
return list[0]
}
// const { formatMessage } = useIntl();
const basicInfo = getMenuData(props.route.routes, { locale: false })
const menuData = basicInfo.menuData ? basicInfo.menuData.filter(item => !item.redirect) : []
......
......@@ -40,6 +40,7 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
if (code && code === item.relationParentCode) {
defaultSelectedKeys = item.relationParentCode
}
!item.hideInMenu && isAuthPath(item.path) && subHeadMenus.push({
path: item.path,
title: item.name,
......@@ -66,7 +67,7 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
<ul className={styles.menuBox}>
{
siderMenu.map(item => (
!item.hideInMenu && <li key={item.key} className={defaultSelectedKeys === item.relationParentCode ? styles.currentItem : ''}>
<li key={item.key} className={defaultSelectedKeys === item.relationParentCode ? styles.currentItem : ''}>
<Link to={item.path}>
<CustomIcon type={item.icon} style={{width: 20, height: 20}}/>
<label>{item.title}</label>
......
......@@ -303,7 +303,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
// 合同下单模式
const contractOrder = (orderKind === OrderKindType.SRM_ORDER)
const [warehouseVisible, setWarehouseVisible] = useState(false)
const [checkProductId, setCheckProductId] = useState(0) // 选中的商品id
const [checkProduct, setCheckProduct] = useState<any>({}) // 选中的商品id
const warehouseRef = useRef<any>({})
// 判断是否可操作当前表格
......@@ -369,7 +369,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
};
const handlePreviewWarehouse = (record) => {
setCheckProductId(record.skuId)
setCheckProduct(record)
setWarehouseVisible(true)
}
......@@ -559,9 +559,9 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
]
const fetchWarehouseData = useCallback(async (params) => {
const { data } = await PublicApi.getProductPositionDeductionRecordList({...params, productId: String(checkProductId)})
const { data } = await PublicApi.getProductPositionDeductionRecordList({...params, productId: String(checkProduct?.skuId), stockId: checkProduct?.stockId})
return data
}, [checkProductId])
}, [checkProduct])
const columns = productInfoColumns.map(col => {
if (!col.editable) {
......
......@@ -68,6 +68,8 @@ export const procurementRenderField = (data) => {
// 冗余memberId memberRoleId查询自提地址使用
memberId: data.vendorMemberId,
memberRoleId: data.vendorRoleId,
// 冗余运费
freight: data.product.freight,
}
})
}
......@@ -82,6 +84,8 @@ export const procurementProcessField = (value) => {
name: item.productName,
logo: item.imgUrl,
quantity: item.purchaseCount,
logisticTemplateId: item.logistics.templateId,
weight: item.logistics.weight,
}
})
return value
......
......@@ -57,6 +57,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
const receiverAddressId = form.getFieldValue('deliveryAddresId')
const sum = data.reduce((prev, next) => (prev*100 + (next.money || 0)*100)/100, 0)
const [freePrice, setFreePrice] = useState<number>(0)
const { pageStatus } = usePageStatus()
useEffect(() => {
if (sum + freePrice) {
......@@ -68,16 +69,32 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
}, [sum, freePrice])
useEffect(() => {
// 存在商品 并且有选择收货地址,则开始计算运费,此外 收货方式变动也要重新计算
// 存在商品 并且有选择收货地址,则开始计算运费(有物流和运费模板的商品),此外 收货方式变动也要重新计算
if (data && data.length > 0 && receiverAddressId) {
// 筛选配送方式为物流的商品并且使用了运费模板
const logsiticsDataMaps = data.filter(v => v.logistics && v.logistics.useTemplate && v.logistics.deliveryType === 1)
console.log(data, 'ooo')
let logsiticsDataMaps = []
// 新增和编辑取不同的字段
if(pageStatus === PageStatus.ADD) {
logsiticsDataMaps = data.filter(v => v.logistics && v.logistics.useTemplate && v.logistics.deliveryType === 1)
} else if(pageStatus === PageStatus.EDIT) {
logsiticsDataMaps = data.filter(v => v.logistics && v.deliveryType === 1)
}
if (logsiticsDataMaps.length > 0) {
PublicApi.postLogisticsFreightTemplateCalFreightPrice({
orderProductList: logsiticsDataMaps.map(v => ({
orderProductList: pageStatus === PageStatus.ADD
?
logsiticsDataMaps.map(v => ({
templateId: v.logistics.templateId,
weight: v.logistics.weight,
count: v?.purchaseCount || 0
}))
:
logsiticsDataMaps.map(v => ({
templateId: v.logisticTemplateId,
weight: v.weight,
count: v.purchaseCount
})),
receiverAddressId: typeof receiverAddressId === 'object' ? receiverAddressId.id : receiverAddressId
}, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => {
......@@ -86,7 +103,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
}
})
} else {
setFreePrice(0)
setFreePrice(Number(data[0]?.freight) || 0)
}
}
}, [data, receiverAddressId])
......
......@@ -7,6 +7,7 @@ import { PublicApi } from '@/services/api'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, products: any = []): any => {
const paywayData = useRef<any>({})
const [columns, setColumns] = useState<any[]>(paymentInformationColumns)
const markRef = useRef<boolean>(true)
// const { schemaActions, detailData } = useContext(ReadyAddOrderDetailContext)
const components = {
body: {
......@@ -16,11 +17,12 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
}
useEffect(() => {
// 当选择报价单/会员/商品时有memberId传入时 调用支付方式api
if(memberId && products.length) {
getPayLists(memberId, memberRoleId)
// 商品有传入时 调用支付方式api
if(products.length && markRef.current) {
getPayLists(products[0].memberId, products[0].memberRoleId)
markRef.current = false
}
}, [memberId, products])
}, [products])
const initPayWayList = (memberId, memberRoleId) => {
let result = []
......
......@@ -48,7 +48,7 @@ const useLinkageValidateEffects = () => {
})
})
onFieldValidateEnd$('phone').subscribe(fieldState => {
if (fieldState.valid) {
if (fieldState.valid && !fieldState.smsLoading) {
// 校验手机号格式通过时, 需请求接口判断手机号是否存在数据库
PublicApi.getMemberRegisterPhoneCheck({
countryCode: prefixCode,
......@@ -57,11 +57,14 @@ const useLinkageValidateEffects = () => {
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 => {
......
......@@ -109,7 +109,8 @@ export const asyncRouter = async (routeLists: string[], routes: any[]) => {
asyncRouter(routeLists, item.routes)
} else {
// 参与权限校验的页面
if (item.path && !routeLists.includes(item.path)) {
// fix: 修复左侧菜单首页无法显示
if (item.path && !routeLists.includes(item.path) && item.path !== '/memberCenter/home') {
item.hideInMenu = true
item.noAuth = true
}
......
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