w-R
3 years ago
4 changed files with 288 additions and 75 deletions
@ -0,0 +1,146 @@
|
||||
/// cartSum : 0 |
||||
/// numberOfPeople : 0 |
||||
/// selected : 0 |
||||
/// shoppingCartSkuItemList : [{"buyNum":0,"createTime":"","groupId":0,"id":0,"platterList":[{"deleted":true,"id":0,"productId":0,"required":true,"skuId":0}],"productId":0,"productName":"","selected":0,"skuImg":"","skuName":"","skuPrice":0,"skuStock":0,"storeId":0,"tableId":0}] |
||||
/// storeId : 0 |
||||
/// storeName : "" |
||||
/// tableId : 0 |
||||
|
||||
class ShoppingCart { |
||||
int cartSum; |
||||
int numberOfPeople; |
||||
int selected; |
||||
List<ShoppingCartSkuItemListBean> shoppingCartSkuItemList; |
||||
int storeId; |
||||
String storeName; |
||||
int tableId; |
||||
|
||||
static ShoppingCart fromMap(Map<String, dynamic> map) { |
||||
if (map == null) return null; |
||||
ShoppingCart shoppingCartBean = ShoppingCart(); |
||||
shoppingCartBean.cartSum = map['cartSum']; |
||||
shoppingCartBean.numberOfPeople = map['numberOfPeople']; |
||||
shoppingCartBean.selected = map['selected']; |
||||
shoppingCartBean.shoppingCartSkuItemList = List()..addAll( |
||||
(map['shoppingCartSkuItemList'] as List ?? []).map((o) => ShoppingCartSkuItemListBean.fromMap(o)) |
||||
); |
||||
shoppingCartBean.storeId = map['storeId']; |
||||
shoppingCartBean.storeName = map['storeName']; |
||||
shoppingCartBean.tableId = map['tableId']; |
||||
return shoppingCartBean; |
||||
} |
||||
|
||||
Map toJson() => { |
||||
"cartSum": cartSum, |
||||
"numberOfPeople": numberOfPeople, |
||||
"selected": selected, |
||||
"shoppingCartSkuItemList": shoppingCartSkuItemList, |
||||
"storeId": storeId, |
||||
"storeName": storeName, |
||||
"tableId": tableId, |
||||
}; |
||||
} |
||||
|
||||
/// buyNum : 0 |
||||
/// createTime : "" |
||||
/// groupId : 0 |
||||
/// id : 0 |
||||
/// platterList : [{"deleted":true,"id":0,"productId":0,"required":true,"skuId":0}] |
||||
/// productId : 0 |
||||
/// productName : "" |
||||
/// selected : 0 |
||||
/// skuImg : "" |
||||
/// skuName : "" |
||||
/// skuPrice : 0 |
||||
/// skuStock : 0 |
||||
/// storeId : 0 |
||||
/// tableId : 0 |
||||
|
||||
class ShoppingCartSkuItemListBean { |
||||
int buyNum; |
||||
String createTime; |
||||
int groupId; |
||||
int id; |
||||
List<PlatterListBean> platterList; |
||||
int productId; |
||||
String productName; |
||||
int selected; |
||||
String skuImg; |
||||
String skuName; |
||||
int skuPrice; |
||||
int skuStock; |
||||
int storeId; |
||||
int tableId; |
||||
|
||||
static ShoppingCartSkuItemListBean fromMap(Map<String, dynamic> map) { |
||||
if (map == null) return null; |
||||
ShoppingCartSkuItemListBean shoppingCartSkuItemListBean = ShoppingCartSkuItemListBean(); |
||||
shoppingCartSkuItemListBean.buyNum = map['buyNum']; |
||||
shoppingCartSkuItemListBean.createTime = map['createTime']; |
||||
shoppingCartSkuItemListBean.groupId = map['groupId']; |
||||
shoppingCartSkuItemListBean.id = map['id']; |
||||
shoppingCartSkuItemListBean.platterList = List()..addAll( |
||||
(map['platterList'] as List ?? []).map((o) => PlatterListBean.fromMap(o)) |
||||
); |
||||
shoppingCartSkuItemListBean.productId = map['productId']; |
||||
shoppingCartSkuItemListBean.productName = map['productName']; |
||||
shoppingCartSkuItemListBean.selected = map['selected']; |
||||
shoppingCartSkuItemListBean.skuImg = map['skuImg']; |
||||
shoppingCartSkuItemListBean.skuName = map['skuName']; |
||||
shoppingCartSkuItemListBean.skuPrice = map['skuPrice']; |
||||
shoppingCartSkuItemListBean.skuStock = map['skuStock']; |
||||
shoppingCartSkuItemListBean.storeId = map['storeId']; |
||||
shoppingCartSkuItemListBean.tableId = map['tableId']; |
||||
return shoppingCartSkuItemListBean; |
||||
} |
||||
|
||||
Map toJson() => { |
||||
"buyNum": buyNum, |
||||
"createTime": createTime, |
||||
"groupId": groupId, |
||||
"id": id, |
||||
"platterList": platterList, |
||||
"productId": productId, |
||||
"productName": productName, |
||||
"selected": selected, |
||||
"skuImg": skuImg, |
||||
"skuName": skuName, |
||||
"skuPrice": skuPrice, |
||||
"skuStock": skuStock, |
||||
"storeId": storeId, |
||||
"tableId": tableId, |
||||
}; |
||||
} |
||||
|
||||
/// deleted : true |
||||
/// id : 0 |
||||
/// productId : 0 |
||||
/// required : true |
||||
/// skuId : 0 |
||||
|
||||
class PlatterListBean { |
||||
bool deleted; |
||||
int id; |
||||
int productId; |
||||
bool required; |
||||
int skuId; |
||||
|
||||
static PlatterListBean fromMap(Map<String, dynamic> map) { |
||||
if (map == null) return null; |
||||
PlatterListBean platterListBean = PlatterListBean(); |
||||
platterListBean.deleted = map['deleted']; |
||||
platterListBean.id = map['id']; |
||||
platterListBean.productId = map['productId']; |
||||
platterListBean.required = map['required']; |
||||
platterListBean.skuId = map['skuId']; |
||||
return platterListBean; |
||||
} |
||||
|
||||
Map toJson() => { |
||||
"deleted": deleted, |
||||
"id": id, |
||||
"productId": productId, |
||||
"required": required, |
||||
"skuId": skuId, |
||||
}; |
||||
} |
Loading…
Reference in new issue