set_xuan_tai_model.dart
8.61 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
import 'package:flutter/material.dart';
import 'package:one_key/models/dsolt_xt.dart';
import 'package:one_key/models/setmeal_by_id_model.dart';
import 'package:one_key/models/setmeal_model.dart';
import 'package:one_key/models/table_list.dart' as t;
import 'package:one_key/models/upload_img_model.dart';
import '../provider/upload_img_provider.dart';
class SetXuanTaiModel {
String rid;
String reserveOrder;
String ddateInterval;
// String rdate;
List<Tids> tids;
List<Setmeal> setmeal;
List<Wine> wine;
List<Other> other;
String remark;
List<Images> images;
String dateTimeShowxt = '请选择'; //宴会日期显示 选台 2022-08-02(周二 七月十五)
DateTime dateTimext = DateTime.now(); //宴会日期
String cdShow = '请选择';
int cdSelIndex;
String cdCode = '';
String qsDateShow = '暂未选择'; //起始时间
String startDate = '';
String endDate = '';
List<t.TableList> tableList;
int tableSum = 0; //桌位总数
TextEditingController customCxt = TextEditingController(); //选台备注
FocusNode customFxt = FocusNode(); //选台备注
List<UploadImgModel> feastRemarkXtImageList = []; //宴会备注图片信息列表----选台
String reserveId;
SetXuanTaiModel(
{this.rid,
this.reserveOrder,
this.ddateInterval,
// this.rdate,
this.tids,
this.setmeal,
this.wine,
this.other,
this.remark,
this.images});
SetXuanTaiModel.fromJson(Map<String, dynamic> json) {
rid = json['rid'];
reserveOrder = json['reserve_order'];
ddateInterval = json['ddate_interval'];
// rdate = json['rdate'];
if (json['tids'] != null) {
tids = <Tids>[];
json['tids'].forEach((v) {
tids.add(new Tids.fromJson(v));
});
}
if (json['setmeal'] != null) {
setmeal = <Setmeal>[];
json['setmeal'].forEach((v) {
setmeal.add(new Setmeal.fromJson(v));
});
}
if (json['wine'] != null) {
wine = <Wine>[];
json['wine'].forEach((v) {
wine.add(new Wine.fromJson(v));
});
}
if (json['other'] != null) {
other = <Other>[];
json['other'].forEach((v) {
other.add(new Other.fromJson(v));
});
}
remark = json['remark'];
customCxt.text = json['remark'];
if (json['images'] != null) {
images = <Images>[];
json['images'].forEach((v) {
images.add(new Images.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['rid'] = this.rid;
data['reserve_order'] = this.reserveOrder;
data['ddate_interval'] = this.ddateInterval;
// data['rdate'] = this.rdate;
if (this.tids != null) {
data['tids'] = this.tids.map((v) => v.toJson()).toList();
}
if (this.setmeal != null) {
data['setmeal'] = this.setmeal.map((v) => v.toJson()).toList();
}
if (this.wine != null) {
data['wine'] = this.wine.map((v) => v.toJson()).toList();
}
if (this.other != null) {
data['other'] = this.other.map((v) => v.toJson()).toList();
}
data['remark'] = this.remark;
if (this.images != null) {
data['images'] = this.images.map((v) => v.toJson()).toList();
}
return data;
}
}
class Tids {
dynamic tid;
dynamic numStr;
String name;
TextEditingController tableNumC = TextEditingController(); //桌位个数
Tids({this.tid, this.numStr, this.name});
Tids.fromJson(Map<String, dynamic> json) {
tid = json['tid'];
numStr = json['num'];
name = json['name'];
tableNumC.text = numStr;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['tid'] = this.tid;
data['num'] = this.numStr;
data['name'] = this.name;
return data;
}
}
class Setmeal {
String setmealId;
String price;
String finalPrice;
String pnum;
String min;
String spare;
String name;
bool select = false;
String bargaining;
TextEditingController finalPriceC;
TextEditingController pnumC;
TextEditingController minC;
TextEditingController spareC;
List<Cooklist> cooklist;
Map<String, List<Cook>> dataMenu = {};
Setmeal({
this.setmealId,
this.price,
this.finalPrice,
this.pnum,
this.min,
this.spare,
this.name,
this.select,
this.bargaining,
this.cooklist,
this.dataMenu,
// this.finalPriceC,
// this.pnumC,
// this.minC,
// this.spareC,
});
Setmeal.fromJson(Map<String, dynamic> json) {
setmealId = json['setmeal_id'];
price = json['price'];
finalPrice = json['final_price'];
pnum = json['pnum'];
min = json['min'];
spare = json['spare'];
name = json['name'];
select = json['select'];
bargaining = json['bargaining'];
// if (json['cooklist'] != null) {
// cooklist = <Cooklist>[];
// json['cooklist'].forEach((v) {
// cooklist.add(new Cooklist.fromJson(v));
// });
// }
if (json['cooklist'] is List) {
cooklist = <Cooklist>[];
json['cooklist'].forEach((v) {
cooklist.add(new Cooklist.fromJson(v));
});
} else {
if (json['cooklist'] != null && json['cooklist'].length > 0) {
cooklist = <Cooklist>[];
dataMenu = {};
Map map = json['cooklist'];
map.forEach((key, v) {
List<Cook> cooktemp = [];
v.forEach((v1) {
cooklist.add(new Cooklist.fromJson(v1));
cooktemp.add(new Cook.fromJson(v1));
});
dataMenu[key] = cooktemp;
});
print(dataMenu);
}
}
// finalPriceC = json['finalPriceC'];
// pnumC = json['pnumC'];
// minC = json['minC'];
// spareC = json['spareC'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['setmeal_id'] = this.setmealId;
data['price'] = this.price;
data['final_price'] = this.finalPrice;
data['pnum'] = this.pnum;
data['min'] = this.min;
data['spare'] = this.spare;
data['name'] = this.name;
data['select'] = this.select;
data['bargaining'] = this.bargaining;
// data['finalPriceC'] = this.finalPriceC;
// data['pnumC'] = this.pnumC;
// data['minC'] = this.minC;
// data['spareC'] = this.spareC;
if (this.cooklist != null) {
data['cooklist'] = this.cooklist.map((v) => v.toJson()).toList();
}
return data;
}
}
class Cooklist {
String id;
String cname;
Cooklist({this.cname});
Cooklist.fromJson(Map<String, dynamic> json) {
id = json['id'];
cname = json['cname'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['cname'] = this.cname;
return data;
}
}
class Wine {
String wineId;
String price;
String finalPrice;
String numStr;
String name;
String bargaining;
bool select = false;
String spec;
TextEditingController finalPriceC;
TextEditingController numC;
Wine({this.wineId, this.price, this.finalPrice, this.numStr});
Wine.fromJson(Map<String, dynamic> json) {
wineId = json['wine_id'];
price = json['price'];
finalPrice = json['final_price'];
numStr = json['num'];
name = json['name'];
spec = json['spec'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['wine_id'] = this.wineId;
data['price'] = this.price;
data['final_price'] = this.finalPrice;
data['num'] = this.numStr;
data['name'] = this.name;
data['spec'] = this.spec;
return data;
}
}
class Other {
String otherId;
String price;
String finalPrice;
String numStr;
String name;
String bargaining;
bool select = false;
String spec;
TextEditingController finalPriceC;
TextEditingController numC;
Other({this.otherId, this.price, this.finalPrice, this.numStr});
Other.fromJson(Map<String, dynamic> json) {
otherId = json['other_id'];
price = json['price'];
finalPrice = json['final_price'];
numStr = json['num'];
name = json['name'];
spec = json['spec'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['other_id'] = this.otherId;
data['price'] = this.price;
data['final_price'] = this.finalPrice;
data['num'] = this.numStr;
data['name'] = this.name;
data['spec'] = this.spec;
return data;
}
}
class Images {
String url;
Images({this.url});
Images.fromJson(Map<String, dynamic> json) {
url = json['url'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
return data;
}
}