menu_unit_model.dart
1.17 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
import 'package:flutter/material.dart';
class MenuUnitModel {
String? specs; //销售单位
String? specid; //销售单位id
String? price; //售价
String? memberPrice; //会员价
String? status; //是否启用
late bool select; //是否启用
TextEditingController priceC = TextEditingController();
TextEditingController memberPriceC = TextEditingController();
MenuUnitModel();
factory MenuUnitModel.fromJson(Map<String, dynamic> json) => MenuUnitModel()
..specs = json["specs"]
..specid = json["specid"]
..price = json["price"]
..memberPrice = json["member_price"]
..status = json["status"]
..select = json["status"] == '1' ? true : false
..memberPriceC.text = json["member_price"]
..priceC.text = json["price"];
Map<String, dynamic> toJson() => <String, dynamic>{
"specs": specs,
"specid": specid,
'price': price,
'member_price': memberPrice,
'status': select ? '1' : '0'
};
Map<String, dynamic> toJson1() => <String, dynamic>{
"specs": specs,
"id": specid,
'price': price,
'member_price': memberPrice,
'status': select ? '1' : '0'
};
}