|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/models/message.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/route/navigator_util.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/common_button.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
class MessageItemF extends StatelessWidget {
|
|
|
|
final Message message;
|
|
|
|
final bool isTreated;
|
|
|
|
MessageItemF(this.message, {this.isTreated = false});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
// TODO: implement build
|
|
|
|
Color textColor =
|
|
|
|
isTreated ? MyColours.color_999999 : MyColours.color_353535;
|
|
|
|
String titleText = "";
|
|
|
|
String subTitleTextFir = "";
|
|
|
|
String subTitleTextSec = "";
|
|
|
|
String attr = '';
|
|
|
|
Color bgcolor = MyColours.color_438E93;
|
|
|
|
String btnname = 'online_go';
|
|
|
|
if (message.message_type == "10") {
|
|
|
|
titleText = "在线\n预订";
|
|
|
|
subTitleTextFir = '包间需求';
|
|
|
|
subTitleTextSec = '就餐时间';
|
|
|
|
} else if (message.message_type == "11") {
|
|
|
|
titleText = "取消\n预订";
|
|
|
|
bgcolor = MyColours.color_999999;
|
|
|
|
btnname = 'cancel_go';
|
|
|
|
} else if (message.message_type == "1") {
|
|
|
|
titleText = "提前\n点餐";
|
|
|
|
subTitleTextFir = '桌位信息';
|
|
|
|
subTitleTextSec = '就餐时间';
|
|
|
|
bgcolor = MyColours.color_F78D94;
|
|
|
|
btnname = 'order_go';
|
|
|
|
} else if (message.message_type == "12") {
|
|
|
|
titleText = "在线\n买单";
|
|
|
|
subTitleTextFir = '桌位信息';
|
|
|
|
subTitleTextSec = '申请时间';
|
|
|
|
bgcolor = MyColours.color_F2995F;
|
|
|
|
btnname = 'online_order_go';
|
|
|
|
} else if (message.message_type == "13") {
|
|
|
|
titleText = "买单\n通知";
|
|
|
|
subTitleTextFir = '桌位信息';
|
|
|
|
subTitleTextSec = '申请时间';
|
|
|
|
} else if (message.message_type == "14") {
|
|
|
|
titleText = "发票\n申请";
|
|
|
|
subTitleTextFir = '桌位信息';
|
|
|
|
subTitleTextSec = '申请时间';
|
|
|
|
} else if (message.message_type == "店内消息") {
|
|
|
|
titleText = "店内\n消息";
|
|
|
|
bgcolor = MyColours.color_5F7292;
|
|
|
|
btnname = 'store_info_go';
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageDialogModel messageDialogModel =
|
|
|
|
Provider.of<MessageDialogModel>(context, listen: false);
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () async {
|
|
|
|
//true已处理跳转 false未处理列表不需要点击事件
|
|
|
|
if (isTreated) {
|
|
|
|
if (message.message_type == "10") {
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context, message.rid.toString(), message.uid);
|
|
|
|
} else if (message.message_type == "1") {
|
|
|
|
NavigatorUtil.goHasOrderFoodPage(context, rid: message.rid);
|
|
|
|
} else if (message.message_type == "11") {
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context, message.rid.toString(), message.uid);
|
|
|
|
} else if (message.message_type == "12") {
|
|
|
|
//在线买单消息查看
|
|
|
|
NavigatorUtil.goOnlineCheckDetailPage(context,
|
|
|
|
rid: '${message.rid}');
|
|
|
|
} else if (message.message_type == "13") {
|
|
|
|
//买单通知,跳转至买单详情查看
|
|
|
|
NavigatorUtil.goOnlineCheckDetailPage(context,
|
|
|
|
rid: '${message.rid}');
|
|
|
|
} else if (message.message_type == "14") {
|
|
|
|
//发票详情页面跳转
|
|
|
|
NavigatorUtil.goInvoiceDetailPage(context, rid: '${message.rid}');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
messageDialogModel.removeMessage(message.id);
|
|
|
|
//message_type:10 跳转在线预订 11 取消订单 1 提前点餐
|
|
|
|
if (message.message_type == "10") {
|
|
|
|
NavigatorUtil.goHandleOnlinePage(
|
|
|
|
context, message.rid.toString(), message.id);
|
|
|
|
} else if (message.message_type == "11") {
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context, message.rid.toString(), message.uid);
|
|
|
|
bus.emit("remove_untreated_message", message.id);
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": message.message_type == "1" ? "is_read" : "is_handle"
|
|
|
|
};
|
|
|
|
await messageDialogModel.setMessageStatus(context, params);
|
|
|
|
bus.emit("refresh_untreated_num"); //刷新未读消息数目
|
|
|
|
} else if (message.message_type == "1") {
|
|
|
|
//提前点餐
|
|
|
|
NavigatorUtil.goHasOrderFoodPage(context, rid: message.rid);
|
|
|
|
bus.emit("remove_untreated_message", message.id);
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": message.message_type == "1" ? "is_read" : "is_handle"
|
|
|
|
};
|
|
|
|
await messageDialogModel.setMessageStatus(context, params);
|
|
|
|
bus.emit("refresh_untreated_num"); //刷新未读消息数目
|
|
|
|
} else if ('${message.message_type}' == "12") {
|
|
|
|
//在线买单消息 去处理 跳转在线买单处理页面
|
|
|
|
NavigatorUtil.goOnlineCheckEditPage(context,
|
|
|
|
rid: '${message.rid}', mid: message.id);
|
|
|
|
} else if ('${message.message_type}' == "13") {
|
|
|
|
//在线买单消息 去查看 跳转在线买单详情页面
|
|
|
|
NavigatorUtil.goOnlineCheckDetailPage(context,
|
|
|
|
rid: '${message.rid}');
|
|
|
|
bus.emit("remove_untreated_message", message.id);
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": message.message_type == "1" ? "is_read" : "is_handle"
|
|
|
|
};
|
|
|
|
await messageDialogModel.setMessageStatus(context, params);
|
|
|
|
bus.emit("refresh_untreated_num"); //刷新未读消息数目
|
|
|
|
} else if (message.message_type == "14") {
|
|
|
|
//发票详情页面跳转
|
|
|
|
NavigatorUtil.goInvoiceDetailPage(context, rid: '${message.rid}');
|
|
|
|
bus.emit("remove_untreated_message", message.id);
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": message.message_type == "1" ? "is_read" : "is_handle"
|
|
|
|
};
|
|
|
|
await messageDialogModel.setMessageStatus(context, params);
|
|
|
|
bus.emit("refresh_untreated_num"); //刷新未读消息数目
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Stack(
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(24 * 2),
|
|
|
|
vertical: ScreenUtil().setWidth(20)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
right: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
width: ScreenUtil().setWidth(2), color: bgcolor),
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(ScreenUtil().setWidth(18)))),
|
|
|
|
child: Row(
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
width: ScreenUtil().setWidth(128),
|
|
|
|
height: ScreenUtil().setWidth(160),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: bgcolor,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(ScreenUtil().setWidth(16)),
|
|
|
|
bottomLeft:
|
|
|
|
Radius.circular(ScreenUtil().setWidth(16)))),
|
|
|
|
child: Transform.translate(
|
|
|
|
offset: Offset(0, 0.1 / 2), //1为 StrutStyle 的 leading的值
|
|
|
|
child: Text(
|
|
|
|
titleText,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
),
|
|
|
|
strutStyle: StrutStyle(
|
|
|
|
forceStrutHeight: true, height: 1, leading: 0.1),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(34),
|
|
|
|
message.message_type == "10" || message.message_type == "12"
|
|
|
|
? Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Row(children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
right: ScreenUtil().setWidth(12)),
|
|
|
|
child: Text(
|
|
|
|
message.rnameStr,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
)),
|
|
|
|
attr == '' || attr == null
|
|
|
|
? Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
right: ScreenUtil().setWidth(12)),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(16),
|
|
|
|
vertical: ScreenUtil().setWidth(6)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: attr == '沉睡'
|
|
|
|
? Color.fromRGBO(223, 33, 81, 1)
|
|
|
|
: attr == '活跃'
|
|
|
|
? Color.fromRGBO(
|
|
|
|
81, 170, 94, 1)
|
|
|
|
: attr == '流失'
|
|
|
|
? Color.fromRGBO(
|
|
|
|
109, 101, 248, 1)
|
|
|
|
: Color.fromRGBO(
|
|
|
|
239, 143, 49, 1),
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(8)),
|
|
|
|
child: Text(
|
|
|
|
'活跃',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(24)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(16),
|
|
|
|
vertical: ScreenUtil().setWidth(6)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
width: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_F2995F,
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(8)),
|
|
|
|
child: Text(
|
|
|
|
'biaoqianvipdsds',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_F2995F,
|
|
|
|
fontSize: ScreenUtil().setSp(24)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
VEmptyView(16),
|
|
|
|
Text(
|
|
|
|
'${message.ddateStr}',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(24)),
|
|
|
|
),
|
|
|
|
VEmptyView(8),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(16),
|
|
|
|
vertical: ScreenUtil().setWidth(6)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: bgcolor,
|
|
|
|
borderRadius: BorderRadius.circular(8)),
|
|
|
|
child: Text(
|
|
|
|
'${message.message_type == '1' ? message.room_info : message.room_demand}',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(20)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
message.message_type == "11" || message.message_type == "1"
|
|
|
|
? Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"预订日期:${message.ddateStr}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_BFC4D4,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
VEmptyView(8),
|
|
|
|
message.room_demand == ''
|
|
|
|
? SizedBox()
|
|
|
|
: Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(16),
|
|
|
|
vertical: ScreenUtil().setWidth(6)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: bgcolor,
|
|
|
|
borderRadius: BorderRadius.circular(8)),
|
|
|
|
child: Text(
|
|
|
|
'${message.room_demand}',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(20)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
message.message_type == "1"
|
|
|
|
? SizedBox()
|
|
|
|
: Text(
|
|
|
|
true ? '取消操作人:顾客在线取消' : '取消操作人:方硕',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(24)),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
message.message_type == "店内消息"
|
|
|
|
? Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"请确认 2022-04-02 午餐 客人是否会如约到店!",
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
VEmptyView(8),
|
|
|
|
Text(
|
|
|
|
"发起人:系统自动",
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(24)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox()
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
right: ScreenUtil().setWidth(24 * 2 + 16 * 2),
|
|
|
|
top: ScreenUtil().setWidth(28 + 24 * 2),
|
|
|
|
child: Offstage(
|
|
|
|
offstage: isTreated ? true : false,
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
messageDialogModel.removeMessage(message.id);
|
|
|
|
//message_type:10 跳转在线预订 11 取消订单 1 提前点餐
|
|
|
|
if (message.message_type == "10") {
|
|
|
|
NavigatorUtil.goHandleOnlinePage(
|
|
|
|
context, message.rid.toString(), message.id);
|
|
|
|
} else if (message.message_type == "11") {
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context, message.rid.toString(), message.uid);
|
|
|
|
bus.emit("remove_untreated_message", message.id);
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": message.message_type == "1"
|
|
|
|
? "is_read"
|
|
|
|
: "is_handle"
|
|
|
|
};
|
|
|
|
await messageDialogModel.setMessageStatus(
|
|
|
|
context, params);
|
|
|
|
bus.emit("refresh_untreated_num"); //刷新未读消息数目
|
|
|
|
} else if (message.message_type == "1") {
|
|
|
|
//提前点餐
|
|
|
|
NavigatorUtil.goHasOrderFoodPage(context,
|
|
|
|
rid: message.rid);
|
|
|
|
bus.emit("remove_untreated_message", message.id);
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": message.message_type == "1"
|
|
|
|
? "is_read"
|
|
|
|
: "is_handle"
|
|
|
|
};
|
|
|
|
await messageDialogModel.setMessageStatus(
|
|
|
|
context, params);
|
|
|
|
bus.emit("refresh_untreated_num"); //刷新未读消息数目
|
|
|
|
} else if ('${message.message_type}' == "12") {
|
|
|
|
//在线买单消息 去处理 跳转在线买单处理页面
|
|
|
|
NavigatorUtil.goOnlineCheckEditPage(context,
|
|
|
|
rid: '${message.rid}', mid: message.id);
|
|
|
|
} else if ('${message.message_type}' == "13") {
|
|
|
|
//在线买单消息 去查看 跳转在线买单详情页面
|
|
|
|
NavigatorUtil.goOnlineCheckDetailPage(context,
|
|
|
|
rid: '${message.rid}');
|
|
|
|
bus.emit("remove_untreated_message", message.id);
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": message.message_type == "1"
|
|
|
|
? "is_read"
|
|
|
|
: "is_handle"
|
|
|
|
};
|
|
|
|
await messageDialogModel.setMessageStatus(
|
|
|
|
context, params);
|
|
|
|
bus.emit("refresh_untreated_num"); //刷新未读消息数目
|
|
|
|
} else if (message.message_type == "14") {
|
|
|
|
//发票详情页面跳转
|
|
|
|
NavigatorUtil.goInvoiceDetailPage(context,
|
|
|
|
rid: '${message.rid}');
|
|
|
|
bus.emit("remove_untreated_message", message.id);
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
"id": message.id,
|
|
|
|
"status": message.message_type == "1"
|
|
|
|
? "is_read"
|
|
|
|
: "is_handle"
|
|
|
|
};
|
|
|
|
await messageDialogModel.setMessageStatus(
|
|
|
|
context, params);
|
|
|
|
bus.emit("refresh_untreated_num"); //刷新未读消息数目
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath('$btnname'),
|
|
|
|
width: ScreenUtil().setWidth(24 * 2),
|
|
|
|
height: ScreenUtil().setWidth(24 * 2),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|