Commit b99bd5f66d0285b4dffce33e55dbc81647fd9e70

Authored by “gaiyaguang”
1 parent edea0c14

取消预订刷新页面

... ... @@ -6,131 +6,155 @@ part 'notebook_detail.g.dart';
@JsonSerializable()
class NotebookDetail {
NotebookDetail();
NotebookDetail();
String id;
String tableinfo;
String pnum;
String rname;
String sex;
String phone;
String cusdem;
String cusman;//客户经理
String ddate;
String is_set_ddate;
String ddate_solt;
String status="0";//订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
String action;
String type;//0 内部订单 1 在线预订
String note_name;
String channel;
String cdate;
List<Table> demands;//需求桌位
List<Table> tables;//预订桌位
Cancel cancel;
String id;
String abolition;
String tableinfo;
String pnum;
String rname;
String sex;
String phone;
String cusdem;
String cusman; //客户经理
String ddate;
String is_set_ddate;
String ddate_solt;
String status = "0"; //订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
String action;
String type; //0 内部订单 1 在线预订
String note_name;
String channel;
String cdate;
List<Table> demands; //需求桌位
List<Table> tables; //预订桌位
Cancel cancel;
String get statuImgAssets{
switch(status){
case "0":
return "assets/status_undeal.png";
case "1":
case "5":
return "assets/statu_booked.png";
case "2":
return "assets/statu_reached.png";
case "3":
return "assets/statu_finished.png";
case "4":
return "assets/statu_canceled.png";
case "6":
return "assets/statu_refuse.png";
}
String get statuImgAssets {
switch (status) {
case "0":
return "assets/status_undeal.png";
case "1":
case "5":
return "assets/statu_booked.png";
case "2":
return "assets/statu_reached.png";
case "3":
return "assets/statu_finished.png";
case "4":
return "assets/statu_canceled.png";
case "6":
return "assets/statu_refuse.png";
}
}
String get ddateMd{
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)*1000);
String md=Utils.addZeroNumber(dateTime.month)+"月"+Utils.addZeroNumber(dateTime.day)+"日";
switch (ddate_solt){
case "1":
md+=" 早餐";
break;
case "2":
md+=" 午餐";
break;
case "3":
md+=" 晚餐";
break;
}
return md;
String get ddateMd {
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000);
String md = Utils.addZeroNumber(dateTime.month) +
"月" +
Utils.addZeroNumber(dateTime.day) +
"日";
switch (ddate_solt) {
case "1":
md += " 早餐";
break;
case "2":
md += " 午餐";
break;
case "3":
md += " 晚餐";
break;
}
return md;
}
String get ddateHm{
if(type=="0"||(type=="1"&&is_set_ddate=="1")){
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)*1000);
String Hm=Utils.addZeroNumber(dateTime.hour)+":"+Utils.addZeroNumber(dateTime.minute);
return Hm;
}else{
return "";
}
String get ddateHm {
if (type == "0" || (type == "1" && is_set_ddate == "1")) {
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000);
String Hm = Utils.addZeroNumber(dateTime.hour) +
":" +
Utils.addZeroNumber(dateTime.minute);
return Hm;
} else {
return "";
}
}
String get ddateStr{
String ddateStr;
if (type=="1"&&is_set_ddate=="0"){//在线预订,没有设置到店时间
switch (ddate_solt){
case "1":
ddateStr="早餐";
break;
case "2":
ddateStr="午餐";
break;
case "3":
ddateStr="晚餐";
break;
default:
ddateStr="";
break;
}
}else{
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)*1000);
ddateStr=Utils.addZeroNumber(dateTime.hour)+":"+Utils.addZeroNumber(dateTime.minute);
}
return ddateStr;
String get ddateStr {
String ddateStr;
if (type == "1" && is_set_ddate == "0") {
//在线预订,没有设置到店时间
switch (ddate_solt) {
case "1":
ddateStr = "早餐";
break;
case "2":
ddateStr = "午餐";
break;
case "3":
ddateStr = "晚餐";
break;
default:
ddateStr = "";
break;
}
} else {
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000);
ddateStr = Utils.addZeroNumber(dateTime.hour) +
":" +
Utils.addZeroNumber(dateTime.minute);
}
return ddateStr;
}
String get rnameStr{
if(rname.isEmpty)return "";
switch(sex){
case "1"://先生
return rname+"先生";
case "2"://女士
return rname+"女士";
case "3"://公司
return rname+"公司";
}
String get rnameStr {
if (rname.isEmpty) return "";
switch (sex) {
case "1": //先生
return rname + "先生";
case "2": //女士
return rname + "女士";
case "3": //公司
return rname + "公司";
}
}
String get tableinfoStr{
return tables[0].name+ "\n"+(tables.length>=2?('等'+tables.length.toString()+'桌'):'');
}
String get tableinfoStr {
return tables[0].name +
"\n" +
(tables.length >= 2 ? ('等' + tables.length.toString() + '桌') : '');
}
factory NotebookDetail.fromJson(Map<String,dynamic> json) => _$NotebookDetailFromJson(json);
Map<String, dynamic> toJson() => _$NotebookDetailToJson(this);
factory NotebookDetail.fromJson(Map<String, dynamic> json) =>
_$NotebookDetailFromJson(json);
Map<String, dynamic> toJson() => _$NotebookDetailToJson(this);
}
@JsonSerializable()
class Cancel {
Cancel();
Cancel();
String uname;
String desc;
String cdate;
String uname;
String desc;
String cdate;
String get cdateStr{
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(cdate)*1000);
return dateTime.year.toString()+"/"+Utils.addZeroNumber(dateTime.month)+"/"+Utils.addZeroNumber(dateTime.day)+" "+Utils.addZeroNumber(dateTime.hour)+":"+Utils.addZeroNumber(dateTime.minute);
}
String get cdateStr {
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(cdate) * 1000);
return dateTime.year.toString() +
"/" +
Utils.addZeroNumber(dateTime.month) +
"/" +
Utils.addZeroNumber(dateTime.day) +
" " +
Utils.addZeroNumber(dateTime.hour) +
":" +
Utils.addZeroNumber(dateTime.minute);
}
factory Cancel.fromJson(Map<String,dynamic> json) => _$CancelFromJson(json);
Map<String, dynamic> toJson() => _$CancelToJson(this);
factory Cancel.fromJson(Map<String, dynamic> json) => _$CancelFromJson(json);
Map<String, dynamic> toJson() => _$CancelToJson(this);
}
... ...
... ... @@ -10,6 +10,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) {
return NotebookDetail()
..id = json['id'] as String
..tableinfo = json['tableinfo'] as String
..abolition = json['abolition'] as String
..pnum = json['pnum'] as String
..rname = json['rname'] as String
..sex = json['sex'] as String
... ... @@ -42,6 +43,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) =>
<String, dynamic>{
'id': instance.id,
'tableinfo': instance.tableinfo,
'abolition':instance.abolition,
'pnum': instance.pnum,
'rname': instance.rname,
'sex': instance.sex,
... ...
... ... @@ -51,7 +51,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
Manager manager = Manager();
List cancelReasonList = [];
bool isShowTF = false;
int paddingBottom;
// int paddingBottom;
int paddingTop = 138;
FocusNode _cancelNode = FocusNode();
TextEditingController _cancelController = TextEditingController();
... ... @@ -102,7 +102,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
/// 初始化取消原因数据
_initCancel() {
isShowTF = false;
paddingBottom = ScreenUtil.screenHeightDp.ceil() - 138 - 340;
// paddingBottom = ScreenUtil.screenHeightDp.ceil() - 138 - 340;
cancelReasonList = [
{'title': '顾客取消', 'select': false},
{'title': '顾客行程有变', 'select': false},
... ... @@ -164,7 +164,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
///取消预订弹框
_showCancelWidget(context) {
_scrollController=ScrollController();
_scrollController = ScrollController();
showGeneralDialog(
context: context,
barrierDismissible: false,
... ... @@ -181,22 +181,22 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
// Navigator.of(context).pop();
// },
child: Container(
decoration: BoxDecoration(
color: Color.fromRGBO(00, 00, 00, 0.5),
),
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(50),
ScreenUtil().setWidth(paddingTop * 2),
ScreenUtil().setWidth(50),
ScreenUtil().setWidth(0)),
child: Align(
decoration: BoxDecoration(
color: Color.fromRGBO(00, 00, 00, 0.5),
),
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(50),
ScreenUtil().setWidth(paddingTop * 2),
ScreenUtil().setWidth(50),
ScreenUtil().setWidth(0)),
child: Align(
alignment: Alignment.topCenter,
child: Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10)),
BorderRadius.circular(ScreenUtil().setWidth(10)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
... ... @@ -245,20 +245,20 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
for (var item in cancelReasonList) {
item['select'] = false;
isShowTF = false;
paddingBottom =
ScreenUtil.screenHeightDp.ceil() -
138 -
340;
// paddingBottom =
// ScreenUtil.screenHeightDp.ceil() -
// 138 -
// 340;
if (item['title'] == value['title']) {
item['select'] = true;
if (item['title'] == '其他原因') {
isShowTF = true;
// paddingBottom = 130;
paddingBottom =
ScreenUtil.screenHeightDp.ceil() -
138 -
340 -
46;
// paddingBottom =
// ScreenUtil.screenHeightDp.ceil() -
// 138 -
// 340 -
// 46;
}
}
}
... ... @@ -275,7 +275,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
HEmptyView(30),
Text(value['title'],
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
fontSize:
ScreenUtil().setSp(32),
fontWeight: FontWeight.normal,
decoration: TextDecoration.none,
color: MyColours.color_333333))
... ... @@ -283,39 +284,42 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
),
value['title'] == '其他原因' && isShowTF
? Material(
child: Container(
color: Colors.white,
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(76)),
child: TextField(
maxLines: 1,
controller: _cancelController,
focusNode: _cancelNode,
textAlignVertical:
TextAlignVertical.bottom,
decoration: InputDecoration(
hintText: "请填写原因",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30),
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color:
MyColours.color_d8d8d8),
child: Container(
color: Colors.white,
padding: EdgeInsets.only(
left:
ScreenUtil().setWidth(76)),
child: TextField(
maxLines: 1,
controller: _cancelController,
focusNode: _cancelNode,
textAlignVertical:
TextAlignVertical.bottom,
decoration: InputDecoration(
hintText: "请填写原因",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize:
ScreenUtil().setSp(30),
),
enabledBorder:
UnderlineInputBorder(
borderSide: BorderSide(
color: MyColours
.color_d8d8d8),
),
// border: InputBorder.none,
),
// border: InputBorder.none,
onChanged: (_) {
setState(() {});
},
onEditingComplete: () {
print('fff');
_cancelNode.unfocus();
},
// keyboardType: TextInputType.number,
),
onChanged: (_) {
setState(() {});
},
onEditingComplete: () {
print('fff');
_cancelNode.unfocus();
},
// keyboardType: TextInputType.number,
),
))
))
: Container(),
VEmptyView(40)
]),
... ... @@ -349,6 +353,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
Navigator.of(context).pop();
Loading.showLoading(context);
setReserveStatus('4', desc: desc);
bus.emit("refresh_book_list");
},
text: '确认',
height: ScreenUtil().setWidth(80),
... ... @@ -359,7 +364,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
],
),
)),
),
),
);
});
});
... ... @@ -490,8 +495,6 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
RowMultiText("客户姓名", detailEntity.rnameStr),
RowMultiText(
"客户电话", detailEntity.phone ?? ""),
RowMultiText(
"备注信息", detailEntity.cusdem ?? ""),
MyDivider(double.infinity,
ScreenUtil().setHeight(1)),
Container(
... ... @@ -522,7 +525,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
list.add(manager.roleUserName);
}
DialogUtil.showSelectCusmanDialog(
context, list,(value){
context, list, (value) {
if (value != null) {
setState(() {
cusmanText =
... ... @@ -531,9 +534,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
});
_setCurrManager();
}
})
.then((value) {
});
}).then((value) {});
},
child: Text(
cusmanText,
... ... @@ -550,8 +551,11 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
],
),
),
RowMultiText(
"记录人", detailEntity.note_name ?? ""),
Offstage(
offstage: detailEntity.note_name == '',
child: RowMultiText(
"记录人", detailEntity.note_name ?? ""),
),
Offstage(
offstage: (detailEntity.status == "4" &&
detailEntity.cancel != null)
... ... @@ -568,8 +572,12 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
"取消时间",
detailEntity.cancel?.cdateStr ??
""),
RowMultiText("操作人",
detailEntity.cancel?.uname ?? ""),
RowMultiText(
"操作人",
detailEntity.abolition == '2'
? '顾客在线取消'
: detailEntity.cancel?.uname ??
""),
],
),
),
... ...
... ... @@ -7,11 +7,10 @@ import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/v_empty_view.dart';
class NoteBookItem extends StatefulWidget {
final num index;
final Notebook notebook;
NoteBookItem(this.notebook,this.index);
NoteBookItem(this.notebook, this.index);
@override
State<StatefulWidget> createState() {
... ... @@ -20,31 +19,41 @@ class NoteBookItem extends StatefulWidget {
}
}
class NotebookItemState extends State<NoteBookItem>{
_onOperateClick(){
if(widget.notebook.operationText=="通知客户"){
NavigatorUtil.goInvicationPage(context, widget.notebook.id,widget.notebook.tableinfoStr,widget.notebook.ddate,widget.notebook.ddateStr);
class NotebookItemState extends State<NoteBookItem> {
_onOperateClick() {
if (widget.notebook.operationText == "通知客户") {
NavigatorUtil.goInvicationPage(
context,
widget.notebook.id,
widget.notebook.tableinfoStr,
widget.notebook.ddate,
widget.notebook.ddateStr);
}
}
@override
Widget build(BuildContext context) {
// TODO: implement build
Notebook notebook=widget.notebook;
Notebook notebook = widget.notebook;
Color textColor=(notebook.status=="3"||notebook.status=="4"||notebook.status=="6")?MyColours.color_bfbfbf:MyColours.color_353535;
Color textColor = (notebook.status == "3" ||
notebook.status == "4" ||
notebook.status == "6")
? MyColours.color_bfbfbf
: MyColours.color_353535;
return Container(
width: double.infinity,
height: ScreenUtil().setHeight(110),
color: (widget.index % 2 == 0) ? MyColours.color_f7fdfd : MyColours.color_ffffff,
color: (widget.index % 2 == 0)
? MyColours.color_f7fdfd
: MyColours.color_ffffff,
child: Row(
children: <Widget>[
GestureDetector(
onTap: (){
NavigatorUtil.goNotebookDetailPage(context,notebook.id);
behavior: HitTestBehavior.translucent,
onTap: () {
NavigatorUtil.goNotebookDetailPage(context, notebook.id);
},
child: Row(
children: <Widget>[
... ... @@ -54,8 +63,7 @@ class NotebookItemState extends State<NoteBookItem>{
child: Text(
notebook.tableinfoStr,
style: TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(28)),
color: textColor, fontSize: ScreenUtil().setSp(28)),
),
),
MyDivider(
... ... @@ -69,9 +77,17 @@ class NotebookItemState extends State<NoteBookItem>{
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(notebook.rnameStr,style: TextStyle(color: textColor,fontSize: ScreenUtil().setSp(28)),),
Text(
notebook.rnameStr,
style: TextStyle(
color: textColor, fontSize: ScreenUtil().setSp(28)),
),
VEmptyView(10),
Text(notebook.phoneStr,style: TextStyle(color: textColor,fontSize: ScreenUtil().setSp(22)),)
Text(
notebook.phoneStr,
style: TextStyle(
color: textColor, fontSize: ScreenUtil().setSp(22)),
)
],
),
),
... ... @@ -86,8 +102,7 @@ class NotebookItemState extends State<NoteBookItem>{
child: Text(
notebook.ddateStr,
style: TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(28)),
color: textColor, fontSize: ScreenUtil().setSp(28)),
),
),
],
... ... @@ -106,7 +121,11 @@ class NotebookItemState extends State<NoteBookItem>{
child: Text(
notebook.operationText,
style: TextStyle(
color: (notebook.status=="3"||notebook.status=="4"||notebook.status=="6")?MyColours.color_bfbfbf:MyColours.color_2bb5b7,
color: (notebook.status == "3" ||
notebook.status == "4" ||
notebook.status == "6")
? MyColours.color_bfbfbf
: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setSp(28)),
),
),
... ... @@ -115,5 +134,4 @@ class NotebookItemState extends State<NoteBookItem>{
),
);
}
}
... ...
... ... @@ -8,6 +8,7 @@ import 'package:one_key/provider/update_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
... ... @@ -47,9 +48,17 @@ class NoteBookPageState extends State<NoteBookPage> {
WidgetsBinding.instance.addPostFrameCallback((_) {
_getReserveList();
_reserveCountDay();
bus.on("refresh_book_list", (args) {
_getReserveList();
});
});
}
@override
void dispose() {
bus.off("refresh_book_list");
}
//初始化时间
_initTime() {
dateTime = DateTime.now();
... ...
... ... @@ -39,7 +39,7 @@ class NotebookDetailModel extends ChangeNotifier {
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
if (baseResp?.code == Constant.status_success) {
return (baseResp.data["manager"] as List)
.map((value) => Manager.fromJson(value as Map<String, dynamic>))
.toList();
... ...