category_goods_model.dart 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. class CategoryGoodsModel {
  2. String code;
  3. String message;
  4. List<CategoryGoodsInfo> data;
  5. static CategoryGoodsModel fromMap(Map<String, dynamic> map) {
  6. CategoryGoodsModel bean = new CategoryGoodsModel();
  7. bean.code = map['code'];
  8. bean.message = map['message'];
  9. bean.data = CategoryGoodsInfo.fromMapList(map['data']);
  10. return bean;
  11. }
  12. static List<CategoryGoodsModel> fromMapList(dynamic mapList) {
  13. List<CategoryGoodsModel> list = new List(mapList.length);
  14. for (int i = 0; i < mapList.length; i++) {
  15. list[i] = fromMap(mapList[i]);
  16. }
  17. return list;
  18. }
  19. }
  20. class CategoryGoodsInfo {
  21. String image;
  22. String goodsId;
  23. String goodsName;
  24. double oriPrice;
  25. double presentPrice;
  26. static CategoryGoodsInfo fromMap(Map<String, dynamic> map) {
  27. CategoryGoodsInfo dataListBean = new CategoryGoodsInfo();
  28. dataListBean.image = map['image'];
  29. dataListBean.goodsId = map['goodsId'];
  30. dataListBean.goodsName = map['goodsName'];
  31. dataListBean.oriPrice = map['oriPrice'] + 0.0;
  32. dataListBean.presentPrice = map['presentPrice'] + 0.0;
  33. return dataListBean;
  34. }
  35. static List<CategoryGoodsInfo> fromMapList(dynamic mapList) {
  36. List<CategoryGoodsInfo> list = new List(mapList.length);
  37. for (int i = 0; i < mapList.length; i++) {
  38. list[i] = fromMap(mapList[i]);
  39. }
  40. return list;
  41. }
  42. }