feat(sku): 支持商品属性必选配置 (#8558)

Co-authored-by: liu <liujie@youzan.com>
This commit is contained in:
niuniu1448870058 2021-04-18 20:32:08 +08:00 committed by GitHub
parent 59389a8fd7
commit 6ecb25d756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 3 deletions

View File

@ -183,9 +183,9 @@ export default createComponent({
} }
// 属性未全选 // 属性未全选
return !this.propList.some( return !this.propList
(it) => (this.selectedProp[it.k_id] || []).length < 1 .filter((i) => i.is_necessary !== false)
); .some((i) => (this.selectedProp[i.k_id] || []).length === 0);
}, },
isSkuEmpty() { isSkuEmpty() {

View File

@ -179,6 +179,24 @@ export function getSkuData(largeImageMode = false) {
}, },
], ],
}, },
{
k: '非必选属性',
k_id: 125,
is_multiple: true,
is_necessary: false,
v: [
{
id: 1234,
name: '属性1',
price: 3,
},
{
id: 1235,
name: '属性2',
price: 4,
},
],
},
], ],
}; };
} }

1
types/sku.d.ts vendored
View File

@ -32,6 +32,7 @@ export type SkuPropItemData = {
v: SkuPropItemValueData[]; v: SkuPropItemValueData[];
k_id: number; k_id: number;
is_multiple?: boolean; is_multiple?: boolean;
is_necessary?: boolean;
}; };
export type SkuPropItemValueData = { export type SkuPropItemValueData = {