-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoods_details_bean.dart
executable file
·301 lines (243 loc) · 7.67 KB
/
goods_details_bean.dart
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
import 'package:json_annotation/json_annotation.dart';
import 'package:worldfunclub/bean/home_category.dart';
part 'goods_details_bean.g.dart';
@JsonSerializable()
class GoodsDetailsBean extends Resp {
GoodsData data;
GoodsDetailsBean();
factory GoodsDetailsBean.fromJson(Map<String, dynamic> json) =>
_$GoodsDetailsBeanFromJson(json);
Map<String, dynamic> toJson() => _$GoodsDetailsBeanToJson(this);
}
@JsonSerializable()
class GoodsData {
@JsonKey(defaultValue: "", name: "goods_id")
String goodsId;
@JsonKey(defaultValue: "", name: "goods_name")
String goodsName;
@JsonKey(defaultValue: "", name: "selling_point")
String sellingPoint;
@JsonKey(defaultValue: "", name: "category_id")
String categoryId;
@JsonKey(defaultValue: "", name: "goods_type")
String goodsType;
@JsonKey(defaultValue: "", name: "spec_type")
String specType;
@JsonKey(defaultValue: "")
String content;
@JsonKey(defaultValue: "", name: "is_shop")
String isShop;
@JsonKey(defaultValue: "", name: "shop_id")
String shopId;
@JsonKey(defaultValue: "")
String subscribe;
@JsonKey(defaultValue: "", name: "lh_start_time")
String startTime;
@JsonKey(defaultValue: "", name: "lh_end_time")
String endTime;
@JsonKey(defaultValue: "", name: "goods_sales")
String goodsSales;
@JsonKey(defaultValue: "", name: "collected_status")
String collectedStatus;
@JsonKey(defaultValue: "", name: "comment_data_count")
String commentDataCount;
@JsonKey(defaultValue: "", name: "cart_total_num")
String cartTotalNum;
@JsonKey(name: "comment_data", defaultValue: [])
List<CommentData> commentData;
@JsonKey(defaultValue: [], name: "goods_images")
List<String> goodsImages;
@JsonKey(name: "spec_attr")
List<SpecAttrBean> specAttr;
@JsonKey(name: "sku_list")
List<SkuListBean> skuList;
GoodsData();
factory GoodsData.fromJson(Map<String, dynamic> json) =>
_$GoodsDataFromJson(json);
Map<String, dynamic> toJson() => _$GoodsDataToJson(this);
}
@JsonSerializable()
class CommentData {
@JsonKey(name: "comment_id")
String commentId;
String star;
String content;
@JsonKey(name: "create_time")
String createTime;
@JsonKey(name: "user_id")
String userId;
@JsonKey(defaultValue: "")
String nickName;
@JsonKey(defaultValue: "")
String avatarUrl;
List<String> images;
@JsonKey(name: "goods_attr")
String goodsAttr;
@JsonKey(name: "thumb_num")
String thumbNum;
@JsonKey(name: "is_thumb")
String isThumb;
CommentData();
Map<String, dynamic> toJson() => _$CommentDataToJson(this);
factory CommentData.fromJson(Map<String, dynamic> json) =>
_$CommentDataFromJson(json);
}
@JsonSerializable()
class CommentDataList extends CommentData {
@JsonKey(defaultValue: "", name: "nickname") String nickName;
@JsonKey(defaultValue: "", name: "avatar") String avatarUrl;
CommentDataList();
Map<String, dynamic> toJson() => _$CommentDataListToJson(this);
factory CommentDataList.fromJson(Map<String, dynamic> json) =>
_$CommentDataListFromJson(json);
}
@JsonSerializable()
class CommentPageData {
List<CommentDataList> list;
@JsonKey(defaultValue:"0",name: "all_num") String all;
@JsonKey(defaultValue:"0",name: "praise_num") String praise;
@JsonKey(defaultValue:"0",name: "review_num") String review;
@JsonKey(defaultValue:"0",name: "negative_num") String negative;
@JsonKey(defaultValue:"0",name: "picture_num") String picture;
CommentPageData();
Map<String, dynamic> toJson() => _$CommentPageDataToJson(this);
factory CommentPageData.fromJson(Map<String, dynamic> json) =>
_$CommentPageDataFromJson(json);
}
@JsonSerializable()
class CommentResp extends Resp{
CommentPageData data;
CommentResp();
Map<String, dynamic> toJson() => _$CommentRespToJson(this);
factory CommentResp.fromJson(Map<String, dynamic> json) =>
_$CommentRespFromJson(json);
}
@JsonSerializable()
class SpecAttrBean {
@JsonKey(name: "group_id")
String groupId;
@JsonKey(name: "group_name")
String groupName;
@JsonKey(defaultValue: 0)
int selected = 0;
@JsonKey(name: "spec_items")
List<SpecItemsBean> specItems;
SpecAttrBean();
factory SpecAttrBean.fromJson(Map<String, dynamic> json) =>
_$SpecAttrBeanFromJson(json);
Map<String, dynamic> toJson() => _$SpecAttrBeanToJson(this);
}
@JsonSerializable()
class SkuListBean {
@JsonKey(name: "goods_sku_id")
String goodsSkuId;
@JsonKey(name: "goods_id")
String goodsId;
@JsonKey(name: "spec_sku_id")
String specSkuId;
@JsonKey(name: "image_id")
String imageId;
@JsonKey(name: "goods_no")
String goodsNo;
@JsonKey(name: "goods_price")
String goodsPrice;
@JsonKey(name: "line_price")
String linePrice;
@JsonKey(name: "stock_num")
String stockNum;
@JsonKey(name: "goods_sales")
String goodsSales;
@JsonKey(name: "goods_weight")
String goodsWeight;
String image;
SkuListBean();
factory SkuListBean.fromJson(Map<String, dynamic> json) =>
_$SkuListBeanFromJson(json);
Map<String, dynamic> toJson() => _$SkuListBeanToJson(this);
}
class LiveGoodsItemMapping {
SkuListBean sku;
String itemId = "";
String specValue = "";
var groupId = "";
var groupName = "";
var needSubScribe = false;
var needSubScribeDate = "";
LiveGoodsItemMapping.most(this.sku, LiveGoodsDetailsData data,
SpecAttrBean attr, SpecItemsBean item) {
needSubScribe = data.subscribe == "20";
itemId = item.itemId;
specValue = item.specValue;
groupId = attr.groupId;
groupName = attr.groupName;
needSubScribeDate = needSubScribe
? "${data.shopInfo.shopHours ?? "8:00-22:00"} | 需要预约"
: "周一至周日 | 免预约";
}
LiveGoodsItemMapping.single(this.sku, LiveGoodsDetailsData data) {
itemId = sku.goodsId;
specValue = data.goodsName;
groupId = data.goodsId;
groupName = data.sellingPoint;
needSubScribe = data.subscribe == "20";
needSubScribeDate = needSubScribe
? "${data.shopInfo.shopHours ?? "8:00-22:00"} | 需要预约"
: "周一至周日 | 免预约";
}
}
@JsonSerializable()
class SpecItemsBean {
@JsonKey(name: "item_id")
String itemId;
@JsonKey(name: "spec_value")
String specValue;
SpecItemsBean();
factory SpecItemsBean.fromJson(Map<String, dynamic> json) =>
_$SpecItemsBeanFromJson(json);
Map<String, dynamic> toJson() => _$SpecItemsBeanToJson(this);
}
@JsonSerializable()
class LiveGoodsDetailsResp extends Resp {
LiveGoodsDetailsData data;
LiveGoodsDetailsResp();
factory LiveGoodsDetailsResp.fromJson(Map<String, dynamic> json) =>
_$LiveGoodsDetailsRespFromJson(json);
Map<String, dynamic> toJson() => _$LiveGoodsDetailsRespToJson(this);
}
@JsonSerializable()
class LiveGoodsDetailsData extends GoodsData {
LiveShopInfo shopInfo;
LiveGoodsDetailsData();
factory LiveGoodsDetailsData.fromJson(Map<String, dynamic> json) =>
_$LiveGoodsDetailsDataFromJson(json);
Map<String, dynamic> toJson() => _$LiveGoodsDetailsDataToJson(this);
}
@JsonSerializable()
class LiveShopInfo {
@JsonKey(defaultValue: "", name: "shop_id")
String shopId;
@JsonKey(defaultValue: "", name: "shop_name")
String shopName;
@JsonKey(defaultValue: "")
String phone;
@JsonKey(defaultValue: "", name: "shop_hours")
String shopHours;
@JsonKey(defaultValue: "")
String address;
@JsonKey(defaultValue: "")
String longitude;
@JsonKey(defaultValue: "")
String latitude;
@JsonKey(defaultValue: "")
String logo;
@JsonKey(defaultValue: "")
String province;
@JsonKey(defaultValue: "")
String city;
@JsonKey(defaultValue: "")
String region;
LiveShopInfo();
factory LiveShopInfo.fromJson(Map<String, dynamic> json) =>
_$LiveShopInfoFromJson(json);
Map<String, dynamic> toJson() => _$LiveShopInfoToJson(this);
}