Commit 680e09e8 authored by GuanHua's avatar GuanHua

fix:商品类型筛选问题

parent b9e486a5
......@@ -34,9 +34,9 @@ const Category: React.FC<CategoryPropsType> = (props) => {
setLastCategoryId(null)
setSelectAttrbuteList([])
} else {
let initKeys = []
const initKeys = []
// let initAttrKeys = []
for (let item of filterList) {
for (const item of filterList) {
if (item.type === FILTER_TYPE.category) {
initKeys.push(String(item.key))
}
......@@ -50,7 +50,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
useEffect(() => {
let getCategoryListFn
let param: any = {}
const param: any = {}
let headers = {}
/**
* 根据不通过的页面类型,请求不同的品类接口
......@@ -105,7 +105,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
useEffect(() => {
if (lastCategoryId) {
let param: any = {
const param: any = {
categoryId: lastCategoryId
}
let getAttributeFn
......@@ -160,8 +160,8 @@ const Category: React.FC<CategoryPropsType> = (props) => {
if (!list) {
return []
}
let initExpandKeys = []
let result: any = list.map(item => {
const initExpandKeys = []
const result: any = list.map(item => {
initExpandKeys.push(item.id)
return {
title: item.title,
......@@ -200,7 +200,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
setAttributeList([])
onFilter({
type: FILTER_TYPE.attribute,
key: [],
key: null,
title: ``
})
}
......@@ -217,12 +217,12 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const getDetailById = (attrId, attrValId, state = 2) => {
let detail = {}
for (let item of attributeList) {
for (const item of attributeList) {
if (item.id === attrId) {
if (state === 1) {
detail = item
} else {
for (let childItem of item.attributeValueList) {
for (const childItem of item.attributeValueList) {
if (childItem.value === attrValId) {
detail = childItem
}
......@@ -235,7 +235,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const getSelectAttributeList = (selectList) => {
let ids = []
for (let item of selectList) {
for (const item of selectList) {
ids = [...ids, ...item.customerAttributeValueList.map(childItem => childItem.id)]
}
return ids
......@@ -243,12 +243,12 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const handleChange = (attrId, checkedList) => {
let tempSelect = [...initSelectAttributeList]
let attrInfo: any = getDetailById(attrId, attrId, 1)
let tempItem = {
const attrInfo: any = getDetailById(attrId, attrId, 1)
const tempItem = {
customerAttributeId: attrId,
customerAttributeName: attrInfo.name,
customerAttributeValueList: checkedList.map(item => {
let detail: any = getDetailById(attrId, item)
const detail: any = getDetailById(attrId, item)
return {
id: detail.value,
name: detail.label
......@@ -268,7 +268,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
tempSelect.push(tempItem)
}
let keys = getSelectAttributeList(tempSelect)
const keys = getSelectAttributeList(tempSelect)
setSelectAttrbuteList(keys)
tempSelect = tempSelect.filter(item => item.customerAttributeValueList.length > 0)
onFilter({
......
......@@ -27,8 +27,8 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => {
if (isEmpty(filterList)) {
setSelectKeys([])
} else {
let initKeys = []
for (let item of filterList) {
const initKeys = []
for (const item of filterList) {
if (item.type === FILTER_TYPE.commodityType) {
initKeys.push(Number(item.key))
}
......@@ -54,7 +54,7 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => {
} else {
onFilter({
type: FILTER_TYPE.commodityType,
key: [],
key: false,
title: ''
})
}
......@@ -62,7 +62,7 @@ const CommodityType: React.FC<CommodityTypePropsType> = (props) => {
const getItemText = (key: number) => {
let result = ""
for (let item of styleOptions) {
for (const item of styleOptions) {
if (item.value === key) {
result = item.label
}
......
......@@ -3,7 +3,7 @@ import { PublicApi } from '@/services/api'
import { FILTER_TYPE } from '@/constants'
interface FilterValueType {
key: string | string[] | number;
key: any;
title: string;
type: FILTER_TYPE;
}
......
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