update logic

This commit is contained in:
2021-07-18 01:04:13 +02:00
parent 20490ef9b6
commit 8d18e5838e
36 changed files with 7103 additions and 3695 deletions
+18 -8
View File
@@ -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;
+38
View File
@@ -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;