fix: 修正合并差异

This commit is contained in:
puhui999 2023-09-01 01:24:46 +08:00
parent 5035fc77e7
commit 3e7945e437

View File

@ -185,11 +185,7 @@ import { propTypes } from '@/utils/propTypes'
import { checkSelectedNode, defaultProps, handleTree, treeToString } from '@/utils/tree' import { checkSelectedNode, defaultProps, handleTree, treeToString } from '@/utils/tree'
import { createImageViewer } from '@/components/ImageViewer' import { createImageViewer } from '@/components/ImageViewer'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { import { getPropertyList, RuleConfig, SkuList } from '@/views/mall/product/spu/components/index.ts'
PropertyAndValues,
RuleConfig,
SkuList
} from '@/views/mall/product/spu/components/index.ts'
import ProductAttributes from './ProductAttributes.vue' import ProductAttributes from './ProductAttributes.vue'
import ProductPropertyAddForm from './ProductPropertyAddForm.vue' import ProductPropertyAddForm from './ProductPropertyAddForm.vue'
import { basicInfoSchema } from './spu.data' import { basicInfoSchema } from './spu.data'
@ -241,34 +237,6 @@ const imagePreview = (args) => {
}) })
} }
/**
* 获得商品的规格列表
*
* @param spu
* @return PropertyAndValues 规格列表
*/
const getPropertyList = (spu: Spu): PropertyAndValues[] => {
// skus propertyList
const properties: PropertyAndValues[] = []
//
if (spu.specType) {
spu.skus?.forEach((sku) => {
sku.properties?.forEach(({ propertyId, propertyName, valueId, valueName }) => {
//
if (!properties?.some((item) => item.id === propertyId)) {
properties.push({ id: propertyId!, name: propertyName!, values: [] })
}
//
const index = properties?.findIndex((item) => item.id === propertyId)
if (!properties[index].values?.some((value) => value.id === valueId)) {
properties[index].values?.push({ id: valueId!, name: valueName! })
}
})
})
}
return properties
}
// ====== end ====== // ====== end ======
const message = useMessage() // const message = useMessage() //