
export function returnSkuSnap(goods) {
	const selectSpec = typeof goods.selectSpec === 'string' ? JSON.parse(goods.selectSpec) : goods.selectSpec
	let result = selectSpec.map(v => {
		return {
			name: v.name,
			value: v.selectSpecResult.join(',')
		}
	})
	return result
}

export function returnCategory(cateName, cateList) {
	console.log(cateName);
	console.log(cateList);
	const item = cateList.find(v => v.name == cateName)
	let result = item ? item : undefined
	return result
}
export function returnAllCategory(arr) {
	const result = arr.reduce((prve, cur) => {
		prve.push(...[{
			...cur,
			name: '' + cur.name,
			childrenList: undefined
		},
		//  ...cur.childrenList.map(v => {
		// 	return {
		// 		...v,
		// 		name: '' + v.name
		// 	}
		// })
		])
		return prve
	}, [])
	return result
}
