feat(sku): 支持属性的禁用状态 (#11260)

This commit is contained in:
Fantasy 2022-11-17 15:30:44 +08:00 committed by GitHub
parent 0d54e9644d
commit 207e80c62c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 0 deletions

View File

@ -267,11 +267,13 @@ sku: {
id: 1222,
name: 'Tea',
price: 1,
text_status: 0,
},
{
id: 1223,
name: 'Water',
price: 1,
text_status: 1,
},
],
},

View File

@ -260,11 +260,13 @@ sku: {
id: 1222, // 属性值id
name: '珍珠', // 属性值名
price: 1, // 属性值加价
text_status: 0, // 属性启用/禁用状态 0 - 禁用1 - 启用
},
{
id: 1223,
name: '椰果',
price: 1,
text_status: 1,
},
],
},

View File

@ -750,6 +750,7 @@ export default createComponent({
selectedProp={selectedProp}
skuEventBus={skuEventBus}
multiple={skuTreeItem.is_multiple}
disabled={skuValue.text_status === 0}
/>
))}
</SkuRow>

View File

@ -9,6 +9,7 @@ export default createComponent({
skuEventBus: Object,
selectedProp: Object,
multiple: Boolean,
disabled: Boolean,
},
computed: {
@ -25,6 +26,8 @@ export default createComponent({
methods: {
onSelect() {
if (this.disabled) return;
this.skuEventBus.$emit('sku:propSelect', {
...this.skuValue,
skuKeyStr: this.skuKeyStr,
@ -39,6 +42,7 @@ export default createComponent({
class={[
'van-sku-row__item',
{ 'van-sku-row__item--active': this.choosed },
{ 'van-sku-row__item--disabled': this.disabled },
]}
onClick={this.onSelect}
>

View File

@ -216,6 +216,26 @@ export function getSkuData(largeImageMode = false) {
},
],
},
{
k: '有禁用的属性',
k_id: 127,
is_multiple: false,
is_necessary: false,
v: [
{
id: 1271,
name: '禁用的属性',
price: 0,
text_status: 0,
},
{
id: 1272,
name: '未禁用的属性',
price: 0,
text_status: 1,
},
],
},
],
};
}