update logic
This commit is contained in:
+18
-8
@@ -1,8 +1,10 @@
|
||||
export class Article{
|
||||
constructor() {
|
||||
this.id = 0;
|
||||
this.name = "";
|
||||
this.short = "";
|
||||
this.dimension = "";
|
||||
this.dimension = 0;
|
||||
this.group = 0;
|
||||
this.content = {
|
||||
size : 0,
|
||||
price: 0
|
||||
@@ -10,7 +12,7 @@ export class Article{
|
||||
this.portion = {
|
||||
size : 0,
|
||||
price : 0,
|
||||
type : ""
|
||||
type : 0
|
||||
};
|
||||
}
|
||||
get Name() {
|
||||
@@ -55,6 +57,12 @@ export class Article{
|
||||
set PortionPrice(value) {
|
||||
this.portion.price = value;
|
||||
}
|
||||
get Group() {
|
||||
return this.group;
|
||||
}
|
||||
set Group(value) {
|
||||
this.group = value;
|
||||
}
|
||||
get ContentPrice() {
|
||||
return this.Portions * this.portion.price;
|
||||
}
|
||||
@@ -68,13 +76,15 @@ Article.thaw = function (json) {
|
||||
article.id = json.id;
|
||||
article.Name = json.name;
|
||||
article.Short = json.short;
|
||||
article.Dimension = json.dimension;
|
||||
article.ContentSize = json.content.size;
|
||||
article.PortionPrice = json.portion.price;
|
||||
article.PortionSize = json.portion.size;
|
||||
article.PortionType = json.portion.type;
|
||||
article.Dimension = json.content_dimension;
|
||||
article.ContentSize = json.content_size;
|
||||
article.PortionPrice = json.portion_price;
|
||||
article.PortionSize = json.portion_size;
|
||||
article.PortionType = json.portion_dimension;
|
||||
article.Group = json.group_id;
|
||||
article.variants = json.variants;
|
||||
|
||||
return article;
|
||||
};
|
||||
|
||||
export const thawArticle = Article.thaw;
|
||||
export const thawArticle = Article.thaw;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
export class Variant{
|
||||
constructor() {
|
||||
this.id = 0;
|
||||
this.name = "";
|
||||
this.article_id = 0;
|
||||
this.price = 0;
|
||||
}
|
||||
get Name() {
|
||||
return this.name;
|
||||
}
|
||||
set Name(value) {
|
||||
this.name = value;
|
||||
}
|
||||
get ArticleId() {
|
||||
return this.article_id;
|
||||
}
|
||||
set ArticleId(value) {
|
||||
this.article_id = value;
|
||||
}
|
||||
get Price() {
|
||||
return this.price;
|
||||
}
|
||||
set Price(value) {
|
||||
this.price = value;
|
||||
}
|
||||
}
|
||||
|
||||
Variant.thaw = function (json) {
|
||||
var variant = new Variant();
|
||||
variant.id = json.id;
|
||||
variant.Name = json.name;
|
||||
variant.ArticleId = json.article_id;
|
||||
variant.Price = json.price;
|
||||
|
||||
return variant;
|
||||
};
|
||||
|
||||
export const thawVariant = Variant.thaw;
|
||||
Reference in New Issue
Block a user