goods_detail_model.dart 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. class GoodsDetailModel {
  2. String code;
  3. String message;
  4. GoodsDetailInfo data;
  5. static GoodsDetailModel fromMap(Map<String, dynamic> map) {
  6. GoodsDetailModel model = new GoodsDetailModel();
  7. model.code = map['code'];
  8. model.message = map['message'];
  9. model.data = GoodsDetailInfo.fromMap(map['data']);
  10. return model;
  11. }
  12. static List<GoodsDetailModel> fromMapList(dynamic mapList) {
  13. List<GoodsDetailModel> 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 GoodsDetailInfo {
  21. AdvertesPictureBean advertesPicture;
  22. GoodInfoBean goodInfo;
  23. List<GoodCommentsListBean> goodComments;
  24. static GoodsDetailInfo fromMap(Map<String, dynamic> map) {
  25. GoodsDetailInfo dataBean = new GoodsDetailInfo();
  26. dataBean.advertesPicture = AdvertesPictureBean.fromMap(map['advertesPicture']);
  27. dataBean.goodInfo = GoodInfoBean.fromMap(map['goodInfo']);
  28. dataBean.goodComments = GoodCommentsListBean.fromMapList(map['goodComments']);
  29. return dataBean;
  30. }
  31. static List<GoodsDetailInfo> fromMapList(dynamic mapList) {
  32. List<GoodsDetailInfo> list = new List(mapList.length);
  33. for (int i = 0; i < mapList.length; i++) {
  34. list[i] = fromMap(mapList[i]);
  35. }
  36. return list;
  37. }
  38. }
  39. class AdvertesPictureBean {
  40. // ignore: non_constant_identifier_names
  41. String PICTURE_ADDRESS;
  42. // ignore: non_constant_identifier_names
  43. String TO_PLACE;
  44. static AdvertesPictureBean fromMap(Map<String, dynamic> map) {
  45. AdvertesPictureBean advertesPictureBean = new AdvertesPictureBean();
  46. advertesPictureBean.PICTURE_ADDRESS = map['PICTURE_ADDRESS'];
  47. advertesPictureBean.TO_PLACE = map['TO_PLACE'];
  48. return advertesPictureBean;
  49. }
  50. static List<AdvertesPictureBean> fromMapList(dynamic mapList) {
  51. List<AdvertesPictureBean> list = new List(mapList.length);
  52. for (int i = 0; i < mapList.length; i++) {
  53. list[i] = fromMap(mapList[i]);
  54. }
  55. return list;
  56. }
  57. }
  58. class GoodInfoBean {
  59. String image5;
  60. String image3;
  61. String image4;
  62. String goodsId;
  63. String isOnline;
  64. String image1;
  65. String image2;
  66. String goodsSerialNumber;
  67. String comPic;
  68. String shopId;
  69. String goodsName;
  70. String goodsDetail;
  71. int amount;
  72. double oriPrice;
  73. double presentPrice;
  74. int state;
  75. static GoodInfoBean fromMap(Map<String, dynamic> map) {
  76. GoodInfoBean goodInfoBean = new GoodInfoBean();
  77. goodInfoBean.image5 = map['image5'];
  78. goodInfoBean.image3 = map['image3'];
  79. goodInfoBean.image4 = map['image4'];
  80. goodInfoBean.goodsId = map['goodsId'];
  81. goodInfoBean.isOnline = map['isOnline'];
  82. goodInfoBean.image1 = map['image1'];
  83. goodInfoBean.image2 = map['image2'];
  84. goodInfoBean.goodsSerialNumber = map['goodsSerialNumber'];
  85. goodInfoBean.comPic = map['comPic'];
  86. goodInfoBean.shopId = map['shopId'];
  87. goodInfoBean.goodsName = map['goodsName'];
  88. goodInfoBean.goodsDetail = map['goodsDetail'];
  89. goodInfoBean.amount = map['amount'];
  90. goodInfoBean.oriPrice = map['oriPrice'] + 0.0;
  91. goodInfoBean.presentPrice = map['presentPrice'] + 0.0;
  92. goodInfoBean.state = map['state'];
  93. return goodInfoBean;
  94. }
  95. static List<GoodInfoBean> fromMapList(dynamic mapList) {
  96. List<GoodInfoBean> list = new List(mapList.length);
  97. for (int i = 0; i < mapList.length; i++) {
  98. list[i] = fromMap(mapList[i]);
  99. }
  100. return list;
  101. }
  102. }
  103. class GoodCommentsListBean {
  104. String comments;
  105. String userName;
  106. // ignore: non_constant_identifier_names
  107. int SCORE;
  108. int discussTime;
  109. static GoodCommentsListBean fromMap(Map<String, dynamic> map) {
  110. GoodCommentsListBean goodCommentsListBean = new GoodCommentsListBean();
  111. goodCommentsListBean.comments = map['comments'];
  112. goodCommentsListBean.userName = map['userName'];
  113. goodCommentsListBean.SCORE = map['SCORE'];
  114. goodCommentsListBean.discussTime = map['discussTime'];
  115. return goodCommentsListBean;
  116. }
  117. static List<GoodCommentsListBean> fromMapList(dynamic mapList) {
  118. List<GoodCommentsListBean> list = new List(mapList.length);
  119. for (int i = 0; i < mapList.length; i++) {
  120. list[i] = fromMap(mapList[i]);
  121. }
  122. return list;
  123. }
  124. }