plan_cook_list_model.dart
3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import 'dart:convert';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:one_key/models/cookbook_model.dart';
class PlanCookListModel {
int ret;
PlanCookListSunModel data;
String msg;
PlanCookListModel({this.ret, this.data, this.msg});
PlanCookListModel.fromJson(Map<String, dynamic> json) {
ret = json['ret'];
data = json['data'] != null
? new PlanCookListSunModel.fromJson(json['data'])
: null;
msg = json['msg'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ret'] = this.ret;
if (this.data != null) {
data['data'] = this.data.toJson();
}
data['msg'] = this.msg;
return data;
}
}
class PlanCookListSunModel {
List<SunListPlan> packageList;
List<SunListPlan> plancookList;
PlanCookListSunModel({this.packageList, this.plancookList});
PlanCookListSunModel.fromJson(Map<String, dynamic> json) {
if (json['package_list'] != null) {
packageList = <SunListPlan>[];
json['package_list'].forEach((v) {
packageList.add(new SunListPlan.fromJson(v));
});
}
if (json['plancook_list'] != null) {
plancookList = <SunListPlan>[];
json['plancook_list'].forEach((v) {
plancookList.add(new SunListPlan.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.packageList != null) {
data['package_list'] = this.packageList.map((v) => v.toJson()).toList();
}
if (this.plancookList != null) {
data['plancook_list'] = this.plancookList.map((v) => v.toJson()).toList();
}
return data;
}
}
class SunListPlan {
String id;
String sellerid;
String uid;
String pname;
String type;
String status;
String pnum;
String menuPrice;
String memberPrice;
String planPrice;
List<MenuModel> cookList;
String isDel;
String cdate;
String get cdateStr {
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(cdate) * 1000);
return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
}
SunListPlan(
{this.id,
this.sellerid,
this.uid,
this.pname,
this.type,
this.status,
this.pnum,
this.menuPrice,
this.memberPrice,
this.planPrice,
this.cookList,
this.isDel,
this.cdate});
SunListPlan.fromJson(Map<String, dynamic> json1) {
id = json1['id'];
sellerid = json1['sellerid'];
uid = json1['uid'];
pname = json1['pname'];
type = json1['type'];
status = json1['status'];
pnum = json1['pnum'];
menuPrice = json1['menu_price'];
memberPrice = json1['member_price'];
planPrice = json1['plan_price'];
// cookList = json1['cook_list'];
cookList = <MenuModel>[];
if (json1['cook_list'] != null && json1['cook_list'] != 'null') {
if (json1['cook_list'] is List) {
json1['cook_list'].forEach((v) {
cookList.add(new MenuModel.fromJson2(v));
});
} else {
json.decode(json1['cook_list']).forEach((v) {
cookList.add(new MenuModel.fromJson2(v));
});
}
}
isDel = json1['is_del'];
cdate = json1['cdate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['sellerid'] = this.sellerid;
data['uid'] = this.uid;
data['pname'] = this.pname;
data['type'] = this.type;
data['status'] = this.status;
data['pnum'] = this.pnum;
data['menu_price'] = this.menuPrice;
data['member_price'] = this.memberPrice;
data['plan_price'] = this.planPrice;
data['cook_list'] = this.cookList;
data['is_del'] = this.isDel;
data['cdate'] = this.cdate;
return data;
}
}