Commit a08dee18 authored by GuanHua's avatar GuanHua

fix:商品列表属性筛选问题;购买数量小数点问题

parent 680e09e8
......@@ -48,7 +48,7 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
const handleChange = (e) => {
const { value } = e.target;
const reg = /^\d*?$/;
const reg = /^\d*([.]?\d{0,3})$/
if (reg.test(value)) {
onChange(value, 'change')
}
......@@ -56,15 +56,21 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
const handleBlur = (e) => {
const { value } = e.target;
if (value === "") {
let num: string = value
const reg = /^\d*(.$)/
if(reg.test(num)) {
num = value.replace('.', "")
}
console.log(num, "num")
if (num === "") {
onChange(minCount, 'blur')
} else {
if(Number(value) < minCount) {
if(Number(num) < minCount) {
onChange(minCount, 'blur')
} else if(Number(value) > maxCount) {
} else if(Number(num) > maxCount) {
onChange(maxCount, 'blur')
} else {
onChange(value, 'blur')
onChange(num, 'blur')
}
}
}
......
......@@ -93,8 +93,6 @@ const Category: React.FC<CategoryPropsType> = (props) => {
break
case LAYOUT_TYPE.shopList:
getCategoryListFn = PublicApi.getProductPlatformGetCategoryTree
default:
break
}
getCategoryListFn && getCategoryListFn(param, { headers }).then((res) => {
if (res.code === 1000) {
......@@ -175,7 +173,6 @@ const Category: React.FC<CategoryPropsType> = (props) => {
return {
title: <span className={styles.sub_category_title}>{thirdCategoryItem.title}</span>,
name: thirdCategoryItem.title,
isLastNode: true,
key: thirdCategoryItem.id,
children: []
}
......@@ -189,9 +186,10 @@ const Category: React.FC<CategoryPropsType> = (props) => {
}
const handleSelect = (selectedKeys, info) => {
const { title, isLastNode, name } = info.node
console.log(info)
const { title, children, name } = info.node
setSelectedKeys(selectedKeys)
if (isLastNode) {
if (children.length === 0) {
if (lastCategoryId !== selectedKeys[0]) {
setLastCategoryId(selectedKeys[0])
}
......
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