|
...
|
...
|
@@ -7,6 +7,7 @@ import 'package:one_key/pages/home/home_page.dart'; |
|
|
|
import 'package:one_key/provider/message_dialog_model.dart';
|
|
|
|
import 'package:one_key/provider/user_model.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/utils/event_bus.dart';
|
|
|
|
import 'package:one_key/utils/navigator_util.dart';
|
|
|
|
import 'package:one_key/widgets/common_button.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
...
|
...
|
@@ -16,126 +17,176 @@ import 'package:provider/provider.dart'; |
|
|
|
import '../../app.dart';
|
|
|
|
|
|
|
|
class MessageDialogItem extends StatelessWidget {
|
|
|
|
|
|
|
|
final Message message;
|
|
|
|
final bool isTreated;
|
|
|
|
final VoidCallback callback;
|
|
|
|
MessageDialogItem(this.message,{this.isTreated=false,this.callback});
|
|
|
|
MessageDialogItem(this.message, {this.isTreated = false, this.callback});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
// TODO: implement build
|
|
|
|
Color textColor=isTreated?MyColours.color_999999:MyColours.color_353535;
|
|
|
|
MessageDialogModel messageDialogModel=Provider.of<MessageDialogModel>(context,listen: false);
|
|
|
|
String title = ''; //大标题
|
|
|
|
String subTitleFir = ''; //第一行标题
|
|
|
|
String subTitleSec = ''; //第二行标题
|
|
|
|
String subTitleThr = ''; //第三行标题
|
|
|
|
if (message.message_type == "10") {
|
|
|
|
title = "在线预订";
|
|
|
|
subTitleFir = '包间需求';
|
|
|
|
subTitleSec = '就餐时间';
|
|
|
|
subTitleThr = '预订人';
|
|
|
|
} else if (message.message_type == "11") {
|
|
|
|
title = "取消预订";
|
|
|
|
} else if (message.message_type == "1") {
|
|
|
|
title = "提前点餐";
|
|
|
|
subTitleFir = '桌位信息';
|
|
|
|
subTitleSec = '就餐时间';
|
|
|
|
subTitleThr = '预订人';
|
|
|
|
}
|
|
|
|
Color textColor =
|
|
|
|
isTreated ? MyColours.color_999999 : MyColours.color_353535;
|
|
|
|
MessageDialogModel messageDialogModel =
|
|
|
|
Provider.of<MessageDialogModel>(context, listen: false);
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: (){
|
|
|
|
if(isTreated){
|
|
|
|
NavigatorUtil.goNotebookDetailPage(context,message.rid.toString());
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Stack(
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(290),
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(39),vertical: ScreenUtil().setWidth(12)),
|
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(45),
|
|
|
|
ScreenUtil().setWidth(21),
|
|
|
|
ScreenUtil().setWidth(43)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_fefefe,
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8)))),
|
|
|
|
child:Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
message.message_type=="10"?"在线预订":"取消预订",
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
message.cdateStr,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(24)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
message.message_type=="11"?
|
|
|
|
Text(
|
|
|
|
"${message.ddateStr}的${message.rnameStr}取消了预订",
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
):
|
|
|
|
Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
"包间需求:${message.room_demand}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
VEmptyView(10),
|
|
|
|
Text(
|
|
|
|
"就餐时间:${message.ddateStr}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
VEmptyView(10),
|
|
|
|
Text(
|
|
|
|
"预订人:${message.rnameStr}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
right: ScreenUtil().setWidth(60),
|
|
|
|
bottom: ScreenUtil().setWidth(55),
|
|
|
|
child:Offstage(
|
|
|
|
offstage: isTreated?true:false,
|
|
|
|
child: CommonButton(
|
|
|
|
width: 160,
|
|
|
|
height: 48,
|
|
|
|
fontSize: 28,
|
|
|
|
content: message.message_type=="10"?"立即处理":"立即查看",
|
|
|
|
state: 1,
|
|
|
|
onPress: () {
|
|
|
|
messageDialogModel.removeMessage(message.id);
|
|
|
|
if(message.message_type=="10"){
|
|
|
|
NavigatorUtil.goHandleOnlinePage(context,message.rid.toString(),message.id,replace: messageDialogModel.messages.isEmpty?true:false);
|
|
|
|
}else{
|
|
|
|
NavigatorUtil.goNotebookDetailPage(context,message.rid.toString(),replace: messageDialogModel.messages.isEmpty?true:false);
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": "is_handle"
|
|
|
|
};
|
|
|
|
messageDialogModel.setMessageStatus(context,params);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onTap: () {
|
|
|
|
if (isTreated) {
|
|
|
|
NavigatorUtil.goNotebookDetailPage(context, message.rid.toString());
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Stack(
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(290),
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(39),
|
|
|
|
vertical: ScreenUtil().setWidth(12)),
|
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(45),
|
|
|
|
ScreenUtil().setWidth(21),
|
|
|
|
ScreenUtil().setWidth(43)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_fefefe,
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(ScreenUtil().setWidth(8)))),
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor, fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
message.cdateStr,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(24)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
message.message_type == "11"
|
|
|
|
? Text(
|
|
|
|
"${message.ddateStr}的${message.rnameStr}取消了预订",
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
)
|
|
|
|
: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
"${subTitleFir}:${message.room_demand}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
VEmptyView(10),
|
|
|
|
Text(
|
|
|
|
"${subTitleSec}:${message.ddateStr}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
VEmptyView(10),
|
|
|
|
Text(
|
|
|
|
"${subTitleThr}:${message.rnameStr}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: textColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
);
|
|
|
|
Positioned(
|
|
|
|
right: ScreenUtil().setWidth(60),
|
|
|
|
bottom: ScreenUtil().setWidth(55),
|
|
|
|
child: Offstage(
|
|
|
|
offstage: isTreated ? true : false,
|
|
|
|
child: CommonButton(
|
|
|
|
width: 160,
|
|
|
|
height: 48,
|
|
|
|
fontSize: 28,
|
|
|
|
content: message.message_type == "10" ? "立即处理" : "立即查看",
|
|
|
|
state: 1,
|
|
|
|
onPress: () async {
|
|
|
|
messageDialogModel.removeMessage(message.id);
|
|
|
|
if (message.message_type == "10") {
|
|
|
|
NavigatorUtil.goHandleOnlinePage(
|
|
|
|
context, message.rid.toString(), message.id,
|
|
|
|
replace: messageDialogModel.messages.isEmpty
|
|
|
|
? true
|
|
|
|
: false);
|
|
|
|
} else if (message.message_type == "11") {
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context, message.rid.toString(),
|
|
|
|
replace: messageDialogModel.messages.isEmpty
|
|
|
|
? true
|
|
|
|
: false);
|
|
|
|
bus.emit("remove_untreated_message", message.id);
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": "is_handle"
|
|
|
|
};
|
|
|
|
await messageDialogModel.setMessageStatus(
|
|
|
|
context, params);
|
|
|
|
bus.emit("refresh_untreated_num"); //刷新未读消息数目
|
|
|
|
} else if (message.message_type == "1") {
|
|
|
|
//提前点餐
|
|
|
|
NavigatorUtil.goHasOrderFoodPage(context,
|
|
|
|
rid: message.rid,
|
|
|
|
replace: messageDialogModel.messages.isEmpty
|
|
|
|
? true
|
|
|
|
: false);
|
|
|
|
bus.emit("remove_untreated_message_order", message.id);
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": "is_read"
|
|
|
|
};
|
|
|
|
await messageDialogModel.setMessageStatus(
|
|
|
|
context, params);
|
|
|
|
bus.emit("refresh_untreated_num"); //刷新未读消息数目
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|