define({
name: "SmallShop",
template: `
关闭
开启
通过微店店主链接购买任何参与微店分红的商品,店主都可获得对应的等级分红
启用店主独立设置,微店店主拥有独立的分红比例,不受店主等级分红比例影响
等级比例只能填写小数或整数,其他不做保存处理
{{level.level_name}}
%
`,
style: `
.help-block{
font-size:14px;
margin-bottom:0px;
}
.location{
display:flex;
justify-content:flex-end;
}
.gutter{
text-align:center;
}
.flex-col{
margin-top:5px;
}
`,
props: {
form: {
type: Object,
default() {
return {}
}
}
},
data(){
return {
is_open_bonus: 0,
independent_bonus: 0,
micro_levels: [],
}
},
mounted() {
if (this.form.micro && !Array.isArray(this.form.micro)) {
this.is_open_bonus = this.form.micro.is_open_bonus;
this.independent_bonus = this.form.micro.independent_bonus;
}
this.micro_levels = this.form.micro_levels;
},
methods: {
filterList (list=[]) {
let arr = {};
list.forEach((item, index) => {
arr[item.id] = item.value;
})
return arr;
},
validate () {
let json = {
is_open_bonus: this.is_open_bonus,
independent_bonus: this.independent_bonus,
}
if (this.independent_bonus) {
json.level = this.filterList(this.micro_levels);
}
return json;
},
},
})