table.dart
3.35 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
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
import 'package:json_annotation/json_annotation.dart';
part 'table.g.dart';
@JsonSerializable()
class Table {
Table();
String id; //主键id
String rid; //关联区域id
String tid; //桌位类型 1散座 2包间 3卡座
String name; //桌位名称
String table_pnum; //桌位最少可做人数
String most_pnum; //桌位最多可做人数
String order_o; //桌位排序编号
String status; //桌位状态 0未使用 1使用中 2已删除
String tablestatus; //桌位状态 0未使用 1使用中 2已删除
String enable; //0禁用 1启用
String spell; //1拼桌
String rname; //关联区域名称
String max; //最多可做人数
String low; //最低消费
String sign; //标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
String reserver; //订餐人
String notebookId; //桌位对应的预订id
bool selected; //是否选中
int isPhoto; //桌位是否有照片
//获取桌位类型
String get tidStr {
switch (tid) {
case "1":
return "散座";
case "2":
return "包间";
case "3":
return "卡座";
}
}
String get maxText {
if (max == null || max == "0" || max == "null") {
return "";
} else {
return "最多可坐" + max + "人";
}
}
//获取桌位可坐人数
String get tableNum {
if (table_pnum == null || table_pnum.isEmpty || table_pnum == "0") {
return "";
} else if (most_pnum != null &&
most_pnum.isNotEmpty &&
most_pnum != "0" &&
most_pnum != "null") {
if (table_pnum == most_pnum) {
return "$table_pnum人";
} else {
return "$table_pnum-$most_pnum人";
}
} else {
return "$table_pnum人";
}
}
//获取最低消费
String get lowStr {
return (low == null || low.isEmpty || low == "0") ? "" : "最低消费\n$low元";
}
String get signStr {
if (sign != null && sign.isNotEmpty) {
switch (sign) {
case "1": //已预订
case "5": //已安排包间
// itemRv.setBackgroundResource(R.drawable.table_white);
// if(item.getOrder_status()==3){
// status.setBackgroundResource(R.drawable.table_bg_bottom_yellow);
// status.setText("已买单");
// }else{
// status.setBackgroundResource(R.drawable.table_bg_bottom_red);
// status.setText("已预订");
// }
// status.setVisibility(View.VISIBLE);
// pnum.setText(item.getNoteName());
return "已预订";
case "2": //用餐中
return "用餐中";
default:
return "";
}
}
if (enable == "0") return "已停用";
return "";
}
factory Table.fromJson(Map<String, dynamic> json) => _$TableFromJson(json);
Map<String, dynamic> toJson() => _$TableToJson(this);
@override
String toString() {
return 'Table{id: $id,isPhoto:$isPhoto rid: $rid, tid: $tid, name: $name, table_pnum: $table_pnum, most_pnum: $most_pnum, order_o: $order_o, status: $status, tablestatus: $tablestatus, enable: $enable, spell: $spell, rname: $rname, max: $max, low: $low}';
}
}