Commit 69d499f7b57da4ad0202fea75037fc905801f76c

Authored by wdn127929
1 parent 03feb896

核实通知

class MessageMenuModel {
MessageMenuModel();
String title;
bool select;
}
... ...
... ... @@ -19,6 +19,7 @@ import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/need_item.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/row_multi_text.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
... ... @@ -398,314 +399,293 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
Widget build(BuildContext context) {
detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
return Scaffold(
appBar: SystemAppBar(
"在线预订详情",
onTap: () {
if (widget.fromNotify) {
NavigatorUtil.goHomePage(context, initialIndex: 0);
} else {
Navigator.of(context).pop();
}
},
),
body: SafeArea(
child: WillPopScope(
child: Column(
children: <Widget>[
MyAppBar(
"在线预订详情",
showBack: true,
callback: () {
if (widget.fromNotify) {
NavigatorUtil.goHomePage(context, initialIndex: 0);
} else {
Navigator.of(context).pop();
}
},
),
Expanded(child: Consumer<NotebookDetailModel>(
builder: (context, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () {
_getOrderListData();
},
emptyMsg: "暂时没有预订列表信息哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Expanded(
child: DefaultTextStyle(
style: TextStyle(decoration: TextDecoration.none),
child: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
Expanded(
child: SingleChildScrollView(
child: Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(43)),
child: Column(
children: <Widget>[
RowMultiText(
"用餐时段", detailEntity.ddateMd),
Stack(
alignment: Alignment.center,
children: <Widget>[
Column(
children: <Widget>[
RowMultiText("用餐时间",
detailEntity.ddateHm),
Offstage(
offstage:
detailEntity.type == "0"
? false
: true,
child: RowMultiText("用餐人数",
detailEntity.pnum),
)
],
),
Image.asset(
detailEntity.statuImgAssets,
width:
ScreenUtil().setWidth(100),
height:
ScreenUtil().setWidth(30),
)
],
),
RowMultiText(
"包间需求",
(detailEntity.demands.length
.toString() +
"个") ??
""),
Align(
alignment: Alignment.centerRight,
child: Offstage(
offstage: detailEntity
.demands.length >
0
? false
: true,
child: Container(
height: ScreenUtil()
.setHeight(210),
child: ListView.builder(
itemBuilder:
(BuildContext contxt,
int index) {
return NeedItem(
detailEntity
.demands[index]);
},
itemCount: detailEntity
.demands.length,
shrinkWrap: true,
scrollDirection:
Axis.horizontal,
),
),
)),
RowMultiText(
"客户姓名", detailEntity.rnameStr),
RowMultiText("客户电话", formatPhone),
RowMultiText("备注信息",
detailEntity.cusdem ?? ""),
MyDivider(double.infinity,
ScreenUtil().setHeight(1)),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(80),
alignment: Alignment.center,
child: Stack(
alignment: Alignment.center,
child: Consumer<NotebookDetailModel>(builder: (context, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () {
_getOrderListData();
},
emptyMsg: "暂时没有预订列表信息哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Expanded(
child: DefaultTextStyle(
style: TextStyle(decoration: TextDecoration.none),
child: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
Expanded(
child: SingleChildScrollView(
child: Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(43)),
child: Column(
children: <Widget>[
RowMultiText(
"用餐时段", detailEntity.ddateMd),
Stack(
alignment: Alignment.center,
children: <Widget>[
Column(
children: <Widget>[
Positioned(
left: 0,
child: Text(
"客户经理",
style: TextStyle(
color: MyColours
.color_828282,
fontSize: ScreenUtil()
.setSp(30)),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
List<String> list = [];
for (Manager manager
in managers) {
list.add(manager
.roleUserName);
}
DialogUtil
.showSelectCusmanDialog(
context, list,
(value) {
if (value != null) {
setState(() {
cusmanText =
managers[value
.first]
.userName;
});
_setCurrManager();
}
}).then((value) {});
},
child: Text(
cusmanText,
style: TextStyle(
color: MyColours
.color_353535,
fontSize: ScreenUtil()
.setSp(30),
decoration:
TextDecoration
.underline,
),
),
),
RowMultiText("用餐时间",
detailEntity.ddateHm),
Offstage(
offstage:
detailEntity.type == "0"
? false
: true,
child: RowMultiText("用餐人数",
detailEntity.pnum),
)
],
),
),
],
)),
),
),
Offstage(
offstage: detailEntity.status != "0",
child: Container(
margin: EdgeInsets.only(
top: ScreenUtil().setHeight(30),
bottom: ScreenUtil().setHeight(30)),
child: Column(
children: <Widget>[
CommonButton(
content: "安排包间",
width: 669,
height: 84,
fontSize: 34,
onPress: () async {
Map map = await NavigatorUtil
.goSelectTablePage(
context,
widget.rid,
int.parse(
detailEntity.ddate) *
1000,
detailEntity.ddate_solt);
if (map != null &&
map['tid'] != null) {
setReserveStatus("5",
tid: map['tid']);
}
},
),
VEmptyView(20),
Container(
width: ScreenUtil().setWidth(669),
height: ScreenUtil().setWidth(84),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10)),
Image.asset(
detailEntity.statuImgAssets,
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setWidth(30),
)
],
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: GestureDetector(
child: Center(
RowMultiText(
"包间需求",
(detailEntity.demands.length
.toString() +
"个") ??
""),
Align(
alignment: Alignment.centerRight,
child: Offstage(
offstage:
detailEntity.demands.length >
0
? false
: true,
child: Container(
height:
ScreenUtil().setHeight(210),
child: ListView.builder(
itemBuilder:
(BuildContext contxt,
int index) {
return NeedItem(detailEntity
.demands[index]);
},
itemCount: detailEntity
.demands.length,
shrinkWrap: true,
scrollDirection:
Axis.horizontal,
),
),
)),
RowMultiText(
"客户姓名", detailEntity.rnameStr),
RowMultiText("客户电话", formatPhone),
RowMultiText(
"备注信息", detailEntity.cusdem ?? ""),
MyDivider(double.infinity,
ScreenUtil().setHeight(1)),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(80),
alignment: Alignment.center,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
child: Text(
"拒绝订单",
"客户经理",
style: TextStyle(
color: MyColours
.color_199095,
.color_828282,
fontSize: ScreenUtil()
.setSp(34)),
.setSp(30)),
),
),
onTap: () {
_showRefuseDialog2();
},
)),
Offstage(
offstage: !isCallTel,
child: SizedBox(
width:
ScreenUtil().setWidth(335),
height:
ScreenUtil().setWidth(84),
child: Row(
children: [
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil()
.setHeight(52),
Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
List<String> list = [];
for (Manager manager
in managers) {
list.add(
manager.roleUserName);
}
DialogUtil
.showSelectCusmanDialog(
context, list,
(value) {
if (value != null) {
setState(() {
cusmanText = managers[
value.first]
.userName;
});
_setCurrManager();
}
}).then((value) {});
},
child: Text(
cusmanText,
style: TextStyle(
color: MyColours
.color_199095,
.color_353535,
fontSize: ScreenUtil()
.setSp(30),
decoration: TextDecoration
.underline,
),
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"联系顾客",
style: TextStyle(
color: MyColours
.color_199095,
fontSize:
ScreenUtil()
.setSp(
34)),
),
),
onTap: () {
if (detailEntity
.phone !=
null &&
detailEntity.phone
.isNotEmpty) {
Utils.goPhone(
detailEntity
.phone);
} else {
Utils.showToast(
"没有客户电话!");
}
},
)),
],
),
),
),
)
],
)
],
),
),
)
],
),
],
)),
),
),
Offstage(
offstage: detailEntity.status != "0",
child: Container(
margin: EdgeInsets.only(
top: ScreenUtil().setHeight(30),
bottom: ScreenUtil().setHeight(30)),
child: Column(
children: <Widget>[
CommonButton(
content: "安排包间",
width: 669,
height: 84,
fontSize: 34,
onPress: () async {
Map map = await NavigatorUtil
.goSelectTablePage(
context,
widget.rid,
int.parse(detailEntity.ddate) *
1000,
detailEntity.ddate_solt);
if (map != null && map['tid'] != null) {
setReserveStatus("5",
tid: map['tid']);
}
},
),
VEmptyView(20),
Container(
width: ScreenUtil().setWidth(669),
height: ScreenUtil().setWidth(84),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10)),
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"拒绝订单",
style: TextStyle(
color:
MyColours.color_199095,
fontSize:
ScreenUtil().setSp(34)),
),
),
onTap: () {
_showRefuseDialog2();
},
)),
Offstage(
offstage: !isCallTel,
child: SizedBox(
width: ScreenUtil().setWidth(335),
height: ScreenUtil().setWidth(84),
child: Row(
children: [
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setHeight(52),
color:
MyColours.color_199095,
),
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"联系顾客",
style: TextStyle(
color: MyColours
.color_199095,
fontSize:
ScreenUtil()
.setSp(34)),
),
),
onTap: () {
if (detailEntity.phone !=
null &&
detailEntity.phone
.isNotEmpty) {
Utils.goPhone(
detailEntity.phone);
} else {
Utils.showToast(
"没有客户电话!");
}
},
)),
],
),
),
)
],
),
)
],
),
)
],
))),
);
}
},
))
],
),
onWillPop: () async {
if (widget.fromNotify) {
NavigatorUtil.goHomePage(context, initialIndex: 0);
return true;
}
Navigator.of(context).pop();
return true;
},
)));
),
)
],
))),
);
}
}),
onWillPop: () async {
if (widget.fromNotify) {
NavigatorUtil.goHomePage(context, initialIndex: 0);
return true;
}
Navigator.of(context).pop();
return true;
},
)));
}
}
... ...
... ... @@ -37,6 +37,7 @@ import 'package:one_key/widgets/need_item.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/row_multi_text.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
... ... @@ -1188,22 +1189,15 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
},
child: SafeArea(
child: WillPopScope(
child: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
MyAppBar(
"订座详情",
showBack: true,
callback: () {
if (widget.fromNotify) {
child: Scaffold(
appBar: SystemAppBar( "订座详情",onTap: (){
if (widget.fromNotify) {
NavigatorUtil.goHomePage(context, initialIndex: 0);
} else {
Navigator.of(context).pop();
}
},
),
Expanded(child: Consumer<NotebookDetailModel>(
},),
body: Consumer<NotebookDetailModel>(
builder: (context1, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
... ... @@ -3083,9 +3077,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
],
);
}
})),
],
),
})
),
onWillPop: () async {
if (widget.fromNotify) {
... ...
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/message.dart';
import 'package:one_key/pages/detail/handle_online_page.dart';
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/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';
import '../../app.dart';
class MessageDialogItemF extends StatelessWidget {
final Message message;
final bool isTreated;
MessageDialogItemF(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';
}
if (isTreated) {
bgcolor = MyColours.color_BFC4D4;
}
MessageDialogModel messageDialogModel =
Provider.of<MessageDialogModel>(context, listen: false);
return GestureDetector(
onTap: () async {
messageDialogModel.removeMessage(message.id);
if (messageDialogModel.messages.length == 0) {
Navigator.pop(context);
}
//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"
? Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
height: ScreenUtil().setWidth(40),
child: ListView.builder(
itemCount: 1,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder:
(BuildContext contxt, int index) {
return Row(children: [
Padding(
padding: EdgeInsets.only(
right:
ScreenUtil().setWidth(12)),
child: Text(
message.rnameStr,
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
: 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: isTreated
? MyColours.color_BFC4D4
: 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: isTreated
? MyColours.color_BFC4D4
: MyColours.color_F2995F,
),
borderRadius:
BorderRadius.circular(8)),
child: Text(
'biaoqianvipdsds',
// overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_F2995F,
fontSize:
ScreenUtil().setSp(24)),
),
)
]);
})),
VEmptyView(16),
Text(
'${message.ddateStr}',
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
: 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: isTreated
? MyColours.color_BFC4D4
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
)
],
)
: SizedBox(),
message.message_type == "店内消息"
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"请确认 2022-04-02 午餐 客人是否会如约到店!",
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28)),
),
VEmptyView(8),
Text(
"发起人:系统自动",
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
: 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);
if (messageDialogModel.messages.length == 0) {
Navigator.pop(context);
}
//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),
),
),
),
)
],
));
}
}
... ...
... ... @@ -61,6 +61,9 @@ class MessageItemF extends StatelessWidget {
bgcolor = MyColours.color_5F7292;
btnname = 'store_info_go';
}
if (isTreated) {
bgcolor = MyColours.color_BFC4D4;
}
MessageDialogModel messageDialogModel =
Provider.of<MessageDialogModel>(context, listen: false);
... ... @@ -201,70 +204,116 @@ class MessageItemF extends StatelessWidget {
),
HEmptyView(34),
message.message_type == "10" || message.message_type == "12"
? Column(
? Expanded(
child: 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)),
),
)
]),
Container(
height: ScreenUtil().setWidth(40),
child: ListView.builder(
itemCount: 1,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder:
(BuildContext contxt, int index) {
return Row(children: [
Padding(
padding: EdgeInsets.only(
right:
ScreenUtil().setWidth(12)),
child: Text(
message.rnameStr,
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
: 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: isTreated
? MyColours.color_BFC4D4
: 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: isTreated
? MyColours.color_BFC4D4
: MyColours.color_F2995F,
),
borderRadius:
BorderRadius.circular(8)),
child: Text(
'biaoqianvipdsds',
// overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_F2995F,
fontSize:
ScreenUtil().setSp(24)),
),
)
]);
})),
VEmptyView(16),
Text(
'${message.ddateStr}',
style: TextStyle(
color: MyColours.color_999999,
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
),
VEmptyView(8),
... ... @@ -283,7 +332,7 @@ class MessageItemF extends StatelessWidget {
),
)
],
)
))
: SizedBox(),
message.message_type == "11" || message.message_type == "1"
? Column(
... ... @@ -317,7 +366,9 @@ class MessageItemF extends StatelessWidget {
: Text(
true ? '取消操作人:顾客在线取消' : '取消操作人:方硕',
style: TextStyle(
color: MyColours.color_999999,
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
)
],
... ... @@ -330,14 +381,18 @@ class MessageItemF extends StatelessWidget {
Text(
"请确认 2022-04-02 午餐 客人是否会如约到店!",
style: TextStyle(
color: MyColours.color_515151,
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28)),
),
VEmptyView(8),
Text(
"发起人:系统自动",
style: TextStyle(
color: MyColours.color_999999,
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
),
],
... ...
... ... @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/pages/message/message_online_check_page.dart';
import 'package:one_key/pages/message/message_treated_page.dart';
import 'package:one_key/pages/message/message_untreated_page.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/provider/message_model.dart';
... ... @@ -245,10 +246,9 @@ class MessagePageState extends State<MessagePage>
)),
VEmptyView(11),
Expanded(
flex: 1,
child: TabBarView(controller: tabController, children: [
MessageUntreatedPage(),
MessageOrderPage(),
MessageTreatedPage(),
// MessageOnlineCheckPage()
]),
)
... ...
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/message.dart';
import 'package:one_key/models/message_menu_model.dart';
import 'package:one_key/pages/message/message_item_f.dart';
import 'package:one_key/pages/message/messsage_item.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/provider/message_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/page_error.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:provider/provider.dart';
import 'package:one_key/utils/event_bus.dart';
/**
* 已处理消息
*/
class MessageTreatedPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new MessageTreatedPageState();
}
}
class MessageTreatedPageState extends State<MessageTreatedPage> {
EasyRefreshController _controller;
Color selectedColor = MyColours.color_199095;
Color unSelectedColor = MyColours.color_999999;
int selectedIndex = 0;
int offset = 0;
MessageModel messageModel;
UserModel userModel;
MessageDialogModel messageDialogModel;
List<MessageMenuModel> menuTitle = [];
@override
void initState() {
// TODO: implement initState
super.initState();
_initMenu();
// //移除在线预订消息
// bus.on("remove_untreated_message", (args) {
// messageModel.removeUntreatedMessageByMid(args.toString());
// messageDialogModel.removeMessage(args.toString());
// });
_controller = EasyRefreshController();
// messageModel.pageState = PageState.Loading;
WidgetsBinding.instance.addPostFrameCallback((_) {
getMessage();
setState(() {
messageModel.pageState = PageState.Loading;
});
messageModel.pageState = PageState.Loading;
messageModel.notifyListeners();
});
}
_initMenu() {
MessageMenuModel model1 = MessageMenuModel();
model1.title = '全部';
model1.select = true;
MessageMenuModel model2 = MessageMenuModel();
model2.title = '店内消息';
model2.select = false;
MessageMenuModel model3 = MessageMenuModel();
model3.title = '在线预订';
model3.select = false;
MessageMenuModel model4 = MessageMenuModel();
model4.title = '提前点餐';
model4.select = false;
MessageMenuModel model5 = MessageMenuModel();
model5.title = '在线买单';
model5.select = false;
MessageMenuModel model6 = MessageMenuModel();
model6.title = '完成买单';
model6.select = false;
MessageMenuModel model7 = MessageMenuModel();
model7.title = '申请发票';
model7.select = false;
menuTitle = [model1, model2, model3, model4, model5, model6, model7];
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
// bus.off("remove_untreated_message");
}
//三种分类各自的未读消息数目
_getUnMsgNum() async {
Map<String, String> params = {"sid": userModel.user.sellerid};
await messageModel.getUnMsgNum(context, params);
}
//获取在线预订消息status 0未处理 1已处理
getMessage({bool showLoading = true}) async {
Map<String, String> params = {
"sid": userModel.user.sellerid,
"type_id": "10", //1提前点餐2内部预订10在线预订
"status": '1',
"offset": offset.toString(),
"limit": "20",
};
await messageModel.getMessages(context, params, showLoading: showLoading);
_getUnMsgNum();
}
@override
Widget build(BuildContext context) {
messageModel = Provider.of<MessageModel>(context, listen: true);
userModel = Provider.of<UserModel>(context, listen: false);
messageDialogModel =
Provider.of<MessageDialogModel>(context, listen: false);
return Container(
color: MyColours.color_ffffff,
margin: EdgeInsets.only(top: ScreenUtil().setWidth(10)),
child: Consumer<MessageModel>(
builder: (context, model, _) {
return Column(children: [
Container(
color: MyColours.color_ffffff,
height: ScreenUtil().setWidth(50),
margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(50)),
child: Row(
children: [
HEmptyView(48),
Expanded(
child: SizedBox(
height: ScreenUtil().setWidth(50),
child: ListView.builder(
itemCount: menuTitle.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext contxt, int index) {
return InkWell(
onTap: () {
for (MessageMenuModel item in menuTitle) {
item.select = false;
}
menuTitle[index].select = true;
setState(() {});
offset = 0;
getMessage(showLoading: true);
},
child: Container(
// width: ScreenUtil().setWidth(104 * 2),
// height: ScreenUtil().setWidth(80),
margin: EdgeInsets.only(
right: ScreenUtil().setWidth(15),
),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(16),
vertical: ScreenUtil().setWidth(8)),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(16)),
color: menuTitle[index].select
? MyColours.color_438E93
: MyColours.color_ffffff,
border: Border.all(
color: menuTitle[index].select
? MyColours.color_438E93
: MyColours.color_BFC4D4,
width: ScreenUtil().setWidth(2))),
child: Text(
menuTitle[index].title,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: menuTitle[index].select
? MyColours.color_ffffff
: MyColours.color_BFC4D4,
fontSize: ScreenUtil().setSp(24),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
),
);
})))
],
),
),
Expanded(
child: Container(
color: MyColours.color_ffffff,
child: model.pageState != PageState.Success
? ExceptionPage(
pageState: model.pageState,
callback: () {
offset = 0;
getMessage(showLoading: true);
},
emptyMsg: "暂时没有已处理的消息哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
)
: EasyRefresh.custom(
controller: _controller,
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return MessageItemF(
model.messages[index],
isTreated: true,
);
}, childCount: model.messages.length),
)
],
onRefresh: () async {
offset = 0;
getMessage(showLoading: false);
},
onLoad: () async {
offset++;
getMessage(showLoading: false);
},
)))
]);
},
),
);
}
}
... ...
... ... @@ -54,7 +54,7 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> {
// setState(() {
// messageModel.pageState = PageState.Loading;
// });
messageModel.pageState = PageState.Loading;
messageModel.pageStateUn = PageState.Loading;
messageModel.notifyListeners();
});
}
... ... @@ -77,7 +77,7 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> {
Map<String, String> params = {
"sid": userModel.user.sellerid,
"type_id": "10", //1提前点餐2内部预订10在线预订
"status": selectedIndex.toString(),
"status": '0',
"offset": offset.toString(),
"limit": "20",
};
... ... @@ -96,9 +96,9 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> {
color: MyColours.color_ffffff,
child: Consumer<MessageModel>(
builder: (context, model, _) {
if (model.pageState != PageState.Success) {
if (model.pageStateUn != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
pageState: model.pageStateUn,
callback: () {
offset = 0;
getMessage(showLoading: true);
... ... @@ -135,7 +135,7 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> {
}
return MessageItemF(
model.messages[index],
isTreated: selectedIndex == 1,
isTreated: false,
);
}, childCount: model.messages.length),
)
... ...
... ... @@ -7,6 +7,7 @@ import 'package:one_key/provider/store_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
... ... @@ -40,6 +41,8 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
bool swichState = true;
StoreDetailModel detailModel;
int selectIndex = 0;
String selectNum = '0';
@override
void initState() {
... ... @@ -196,28 +199,10 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
}
///关联包间选择
Widget _select(String title, String hintText) {
Widget _select(String title, String hintText,
{textColor = MyColours.color_333333, GestureTapCallback ontap}) {
return InkWell(
onTap: () async {
Map temp = await NavigatorUtil.goRoomTypeSelectTablePage(
context,
"",
DateTime.now().millisecondsSinceEpoch,
"1",
canChoose: true,
fromPage: 'room_manage',
object: tableListSel,
);
if (temp != null) {
print(temp['tid']);
print(temp['tname']);
String tname = temp['tname'];
String tid = temp['tid'];
tableListSel = temp['tid'];
setState(() {});
// _getTablePhoto(context, temp['tid'], showLoading: true);
}
},
onTap: ontap,
child: Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
... ... @@ -227,7 +212,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
child: Text(
title,
style: TextStyle(
color: MyColours.color_333333,
color: textColor,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
),
... ... @@ -236,9 +221,8 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
Spacer(),
Text(hintText,
style: TextStyle(
color: hintText == '选择包间'
? MyColours.color_999999
: MyColours.color_333333,
color:
hintText == '选择包间' ? MyColours.color_999999 : textColor,
fontWeight:
hintText == '选择包间' ? FontWeight.normal : FontWeight.bold,
fontSize: ScreenUtil().setSp(32),
... ... @@ -416,11 +400,29 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(40),
),
child: _select(
'关联包间',
tableListSel.length == 0
? '选择包间'
: '查看包间')),
child: _select('关联包间',
tableListSel.length == 0 ? '选择包间' : '查看包间',
ontap: () async {
Map temp = await NavigatorUtil
.goRoomTypeSelectTablePage(
context,
"",
DateTime.now().millisecondsSinceEpoch,
"1",
canChoose: true,
fromPage: 'room_manage',
object: tableListSel,
);
if (temp != null) {
print(temp['tid']);
print(temp['tname']);
String tname = temp['tname'];
String tid = temp['tid'];
tableListSel = temp['tid'];
setState(() {});
// _getTablePhoto(context, temp['tid'], showLoading: true);
}
})),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
... ... @@ -430,6 +432,80 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
tableListSel.length == 0
? SizedBox()
: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(40),
),
child: _select('核实通知', '当剩余 $selectNum 间时',
textColor: MyColours.color_000000,
ontap: () async {
List<String> numList = [];
for (int i = 0;
i < tableListSel.split(',').length;
i++) {
numList.add('$i');
}
DialogUtil.showSelectCusmanDialog(
context, numList, (value) async {
if (value != null) {
selectIndex = value.first;
selectNum = numList[value.first];
// bool sucess =
// await detailModel.upReserveInfo(
// context, widget.rid,
// actualPum:
// detailModel.selectNum);
// if (sucess) {
// EventBus().emit(
// "refresh_tablemanager"); //刷新桌位
// await _getReserveDetail(
// showCicle: false);
// }
}
},
selecteds: selectIndex == null
? []
: [selectIndex])
.then((value) {});
})),
tableListSel.length == 0
? SizedBox()
: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(38)),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Image.asset(
Utils.getImgPath('error-circle'),
width: ScreenUtil().setWidth(40)),
HEmptyView(20),
Flexible(
child: Transform.translate(
offset: Offset(
0,
0.3 /
2), //1为 StrutStyle 的 leading的值
child: Text(
'给员工发送核实通知,核实顾客是否如约到店,如不能,及时释放包间',
style: TextStyle(
color: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(24),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
))
],
))
],
)),
),
... ...
... ... @@ -109,33 +109,33 @@ class TableManagerPageState extends State<TableManagerPage> {
}
}
Widget list(List data) => ScrollablePositionedList.builder(
itemCount: data.length,
itemBuilder: (context, index) => item(index),
itemScrollController: itemScrollController,
itemPositionsListener: itemPositionsListener,
reverse: false,
scrollDirection: Axis.vertical,
);
// Widget list(List data) => ScrollablePositionedList.builder(
// itemCount: data.length,
// itemBuilder: (context, index) => item(index),
// itemScrollController: itemScrollController,
// itemPositionsListener: itemPositionsListener,
// reverse: false,
// scrollDirection: Axis.vertical,
// );
void scrollTo(int index) => itemScrollController
.scrollTo(
index: index,
duration: scrollDuration,
curve: Curves.easeInOutCubic,
alignment: 0)
.then((value) {
print(_selectIndex);
// _selectIndex = _selectIndex;
// // }
// isTap = false;
this.setState(() {});
}).whenComplete(() {
// print('');
});
// void scrollTo(int index) => itemScrollController
// .scrollTo(
// index: index,
// duration: scrollDuration,
// curve: Curves.easeInOutCubic,
// alignment: 0)
// .then((value) {
// print(_selectIndex);
// // _selectIndex = _selectIndex;
// // // }
// // isTap = false;
// this.setState(() {});
// }).whenComplete(() {
// // print('');
// });
void jumpTo(int index) =>
itemScrollController.jumpTo(index: index, alignment: 0);
// void jumpTo(int index) =>
// itemScrollController.jumpTo(index: index, alignment: 0);
/// Generate item number [i].
Widget item(int i) {
... ...
... ... @@ -9,7 +9,8 @@ import 'package:one_key/net/http_url.dart';
class MessageModel extends ChangeNotifier {
List<Message> messages = []; //消息
PageState pageState = PageState.Loading;
PageState pageStateUn = PageState.Loading; //未处理
PageState pageState = PageState.Loading; //已处理
// 未处理消息总数
int onlineTotal = 0; //在线消息
int inlineTotal = 0; //内部消息
... ... @@ -18,14 +19,21 @@ class MessageModel extends ChangeNotifier {
initData() {
messages = []; //消息
pageState = PageState.Loading;
pageStateUn = PageState.Loading; //未处理
pageState = PageState.Loading; //已处理
}
//获取消息
getMessages(BuildContext context, Map<String, String> params,
{showLoading = true}) async {
if (showLoading) {
pageState = PageState.Loading;
if (params['status'] == '0') {
//未处理
pageStateUn = PageState.Loading;
} else {
pageState = PageState.Loading;
}
messages = [];
notifyListeners();
}
... ... @@ -34,19 +42,26 @@ class MessageModel extends ChangeNotifier {
data: params, showLoading: false)
.catchError((error) {
print(error.toString());
PageState pageStateTemp;
if (error is MyError) {
switch (error.type) {
case 1:
pageState = PageState.ConnectivityError;
pageStateTemp = PageState.ConnectivityError;
break;
case 2:
pageState = PageState.ConnectivityTimeOut;
pageStateTemp = PageState.ConnectivityTimeOut;
break;
default:
pageState = PageState.ConnectivityError;
pageStateTemp = PageState.ConnectivityError;
break;
}
}
if (params['status'] == '0') {
//未处理
pageStateUn = pageStateTemp;
} else {
pageState = pageStateTemp;
}
notifyListeners();
});
if (baseResp != null && baseResp.code == Constant.status_success) {
... ... @@ -74,9 +89,19 @@ class MessageModel extends ChangeNotifier {
// });
// }
if (messages.isEmpty) {
pageState = PageState.Empty;
if (params['status'] == '0') {
//未处理
pageStateUn = PageState.Empty;
} else {
pageState = PageState.Empty;
}
} else {
pageState = PageState.Success;
if (params['status'] == '0') {
//未处理
pageStateUn = PageState.Success;
} else {
pageState = PageState.Success;
}
}
notifyListeners();
}
... ...
... ... @@ -12,6 +12,7 @@ import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/remark.dart';
import 'package:one_key/models/table_list.dart';
import 'package:one_key/pages/message/message_dialog_item.dart';
import 'package:one_key/pages/message/message_dialog_item_f.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/provider/table_manager_model.dart';
import 'package:one_key/res/colors.dart';
... ... @@ -827,435 +828,414 @@ class DialogUtil {
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return
// Scaffold(
// resizeToAvoidBottomInset: false,
// backgroundColor: Colors.transparent,
// body:
return
// Scaffold(
// resizeToAvoidBottomInset: false,
// backgroundColor: Colors.transparent,
// body:
Center(child: StatefulBuilder(builder: (context, state) {
// globalState = state;
// globalState = state;
return Material(
color: Colors.transparent,
child: Stack(
clipBehavior: Clip.none,
children: [
Container(
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(150)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(50)),
height: mulCreate
? ScreenUtil().setWidth(310 * 2)
: ScreenUtil().setWidth(346 * 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10))),
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(
ScreenUtil().setWidth(10)))), //设置圆角
child: Column(
children: [
VEmptyView(40),
Container(
return Material(
color: Colors.transparent,
child: Stack(
clipBehavior: Clip.none,
children: [
Container(
margin:
EdgeInsets.only(bottom: ScreenUtil().setWidth(150)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(50)),
height: mulCreate
? ScreenUtil().setWidth(310 * 2)
: ScreenUtil().setWidth(346 * 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10))),
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(
ScreenUtil().setWidth(10)))), //设置圆角
child: Column(
children: [
VEmptyView(40),
Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(44)),
// height: ScreenUtil().setWidth(48),
alignment: Alignment.center,
child: Text('新建桌位',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_333333)),
),
VEmptyView(40),
InkWell(
onTap: () {
state(() {
mulCreate = !mulCreate;
});
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(44)),
// height: ScreenUtil().setWidth(48),
alignment: Alignment.center,
child: Text('新建桌位',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_333333)),
),
VEmptyView(40),
InkWell(
onTap: () {
state(() {
mulCreate = !mulCreate;
});
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(44)),
height: ScreenUtil().setWidth(30 * 2),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
HEmptyView(32),
Text('批量创建',
style: TextStyle(
fontSize:
ScreenUtil().setSp(32),
color: MyColours
.color_000000)),
Spacer(),
Image.asset(
mulCreate
? Utils.getImgPath(
'table_manage_swich_on')
: Utils.getImgPath(
'table_manage_swich_off'),
width: ScreenUtil().setWidth(60),
// height: ScreenUtil().setWidth(82),
),
HEmptyView(32),
],
),
)),
VEmptyView(30),
// MyDivider(double.infinity,
// ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7),
// VEmptyView(30),
mulCreate
? Padding(
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(72),
),
child: textfield(
context,
'数量',
'填写个数',
_norNumController,
_norNumFocusNode,
'个',
state))
: Container(
margin: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(44)),
height: ScreenUtil().setWidth(48 * 2),
// margin: EdgeInsets.symmetric(
// horizontal:
// ScreenUtil().setWidth(40)),
decoration: BoxDecoration(
color: MyColours.color_f3f3f3,
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(10))),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
HEmptyView(20),
Expanded(
child: TextField(
controller: controller,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil()
.setSp(32),
color: MyColours
.color_515151),
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
bottom: ScreenUtil()
.setWidth(
40)), //设置文字内容与边框距离
// enabledBorder: UnderlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_efefef),
// ),
// focusedBorder: UnderlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_efefef,
// width: ScreenUtil().setWidth(2)),
// ),
// prefixText: '*',
// prefixStyle: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_E95750),
border: OutlineInputBorder(
borderSide:
BorderSide.none),
hintText: '桌位名称',
hintStyle: TextStyle(
color: MyColours
.color_BFC4D4,
fontSize: ScreenUtil()
.setSp(32),
),
),
onChanged: (value) {
state(() {});
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(
FocusNode()); //点击空白处隐藏键盘
},
keyboardType:
TextInputType.text,
),
)
],
),
height: ScreenUtil().setWidth(30 * 2),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
HEmptyView(32),
Text('批量创建',
style: TextStyle(
fontSize:
ScreenUtil().setSp(32),
color: MyColours.color_000000)),
Spacer(),
Image.asset(
mulCreate
? Utils.getImgPath(
'table_manage_swich_on')
: Utils.getImgPath(
'table_manage_swich_off'),
width: ScreenUtil().setWidth(60),
// height: ScreenUtil().setWidth(82),
),
VEmptyView(32),
InkWell(
onTap: () {
state(() {
showPnumMax = true;
showPnumMin = true;
showBaojian = !showBaojian;
});
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(44)),
height: ScreenUtil().setWidth(30 * 2),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
HEmptyView(32),
Text(
'桌位类型',
HEmptyView(32),
],
),
)),
VEmptyView(30),
// MyDivider(double.infinity,
// ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7),
// VEmptyView(30),
mulCreate
? Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(72),
),
child: textfield(
context,
'数量',
'填写个数',
_norNumController,
_norNumFocusNode,
'个',
state))
: Container(
margin: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(44)),
height: ScreenUtil().setWidth(48 * 2),
// margin: EdgeInsets.symmetric(
// horizontal:
// ScreenUtil().setWidth(40)),
decoration: BoxDecoration(
color: MyColours.color_f3f3f3,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10))),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
HEmptyView(20),
Expanded(
child: TextField(
controller: controller,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize:
ScreenUtil().setSp(32),
color:
MyColours.color_000000),
),
Spacer(),
// Stack(
// overflow: Overflow.visible,
// children: [
Text(
baojian,
style: TextStyle(
color: MyColours.color_515151,
MyColours.color_515151),
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
bottom: ScreenUtil()
.setWidth(
40)), //设置文字内容与边框距离
// enabledBorder: UnderlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_efefef),
// ),
// focusedBorder: UnderlineInputBorder(
// borderSide: BorderSide(
// color: MyColours.color_efefef,
// width: ScreenUtil().setWidth(2)),
// ),
// prefixText: '*',
// prefixStyle: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_E95750),
border: OutlineInputBorder(
borderSide:
BorderSide.none),
hintText: '桌位名称',
hintStyle: TextStyle(
color: MyColours.color_BFC4D4,
fontSize:
ScreenUtil().setSp(32)),
ScreenUtil().setSp(32),
),
),
onChanged: (value) {
state(() {});
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(
FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.text,
),
HEmptyView(12),
Image.asset(
Utils.getImgPath(
'table_manage_arrow_down'),
width:
ScreenUtil().setWidth(40)),
HEmptyView(32),
],
)
],
),
),
VEmptyView(32),
InkWell(
onTap: () {
state(() {
showPnumMax = true;
showPnumMin = true;
showBaojian = !showBaojian;
});
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(44)),
height: ScreenUtil().setWidth(30 * 2),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
HEmptyView(32),
Text(
'桌位类型',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_000000),
),
)),
mulCreate
? SizedBox()
: Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(30)),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(44),
right: ScreenUtil().setWidth(44)),
height: ScreenUtil().setWidth(30 * 2),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
HEmptyView(32),
Text(
'人数',
style: TextStyle(
fontSize:
ScreenUtil().setSp(32),
color:
MyColours.color_000000),
),
Spacer(),
// Stack(
// overflow: Overflow.visible,
// children: [
btnChooseTableManagePnum(
pnumMin,
'min',
ScreenUtil().setWidth(54 * 2),
(value) {
state(() {
showBaojian = true;
showPnumMax = true;
showPnumMin = !showPnumMin;
});
}),
HEmptyView(40),
Text(
'至',
style: TextStyle(
fontSize:
ScreenUtil().setSp(32),
color:
MyColours.color_000000),
),
HEmptyView(40),
btnChooseTableManagePnum(
pnumMax,
'max',
ScreenUtil().setWidth(54 * 2),
(value) {
state(() {
showBaojian = true;
showPnumMin = true;
showPnumMax = !showPnumMax;
});
}),
HEmptyView(32),
],
),
Spacer(),
// Stack(
// overflow: Overflow.visible,
// children: [
Text(
baojian,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
VEmptyView(60),
MyDivider(
double.infinity, ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3),
Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
children: [
RoundButton(
text: '取消',
width: (ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(62) *
2) /
2,
height: ScreenUtil().setWidth(112),
// radius: ScreenUtil().setWidth(10),
gradientStart: Colors.transparent,
gradientEnd: Colors.transparent,
textColor: MyColours.color_000000,
isBold: false,
fontSize: 34,
onPressed: () {
Navigator.pop(context);
}),
MyDivider(ScreenUtil().setWidth(2),
ScreenUtil().setWidth(112),
color: MyColours.color_f3f3f3),
RoundButton(
text: '确定',
width: (ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(62) *
2) /
2,
height: ScreenUtil().setWidth(112),
// radius: ScreenUtil().setWidth(10),
gradientStart: Colors.transparent,
gradientEnd: Colors.transparent,
textColor: (!mulCreate &&
controller.text ==
'') ||
(mulCreate &&
_norNumController.text
.trim() ==
'')
? MyColours.color_999999
: MyColours.color_438E93,
fontSize: 34,
onPressed: () {
if (mulCreate &&
_norNumController.text
.trim()
.length ==
0) {
Utils.showToast('请输入数量!');
return;
}
if (mulCreate &&
!Utils.isNumber(
_norNumController.text)) {
Utils.showToast('请输入数字!');
return;
}
if (mulCreate &&
int.parse(_norNumController
.text) >
20) {
Utils.showToast('最多可创建20个桌位!');
return;
}
if (!mulCreate &&
controller.text.trim() ==
'') {
Utils.showToast('请输入桌位名称!');
return;
}
// 当前选中区域
// areas[currentAreaIndex]
//最低人数
// pnumMin
//最高人数
// pnumMax
HEmptyView(12),
Image.asset(
Utils.getImgPath(
'table_manage_arrow_down'),
width: ScreenUtil().setWidth(40)),
HEmptyView(32),
],
),
)),
onTap({
'bjtype': baojianList[
currentBaojianIndex],
'name': controller.text,
'pnumMin': pnumMin,
'pnumMax': pnumMax,
'mulcreate':
mulCreate.toString(),
'tablenum':
mulCreate
? SizedBox()
: Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(30)),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(44),
right: ScreenUtil().setWidth(44)),
height: ScreenUtil().setWidth(30 * 2),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
HEmptyView(32),
Text(
'人数',
style: TextStyle(
fontSize:
ScreenUtil().setSp(32),
color: MyColours.color_000000),
),
Spacer(),
// Stack(
// overflow: Overflow.visible,
// children: [
btnChooseTableManagePnum(
pnumMin,
'min',
ScreenUtil().setWidth(54 * 2),
(value) {
state(() {
showBaojian = true;
showPnumMax = true;
showPnumMin = !showPnumMin;
});
}),
HEmptyView(40),
Text(
'至',
style: TextStyle(
fontSize:
ScreenUtil().setSp(32),
color: MyColours.color_000000),
),
HEmptyView(40),
btnChooseTableManagePnum(
pnumMax,
'max',
ScreenUtil().setWidth(54 * 2),
(value) {
state(() {
showBaojian = true;
showPnumMin = true;
showPnumMax = !showPnumMax;
});
}),
HEmptyView(32),
],
),
),
VEmptyView(60),
MyDivider(
double.infinity, ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3),
Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
children: [
RoundButton(
text: '取消',
width: (ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(62) * 2) /
2,
height: ScreenUtil().setWidth(112),
// radius: ScreenUtil().setWidth(10),
gradientStart: Colors.transparent,
gradientEnd: Colors.transparent,
textColor: MyColours.color_000000,
isBold: false,
fontSize: 34,
onPressed: () {
Navigator.pop(context);
}),
MyDivider(ScreenUtil().setWidth(2),
ScreenUtil().setWidth(112),
color: MyColours.color_f3f3f3),
RoundButton(
text: '确定',
width: (ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(62) * 2) /
2,
height: ScreenUtil().setWidth(112),
// radius: ScreenUtil().setWidth(10),
gradientStart: Colors.transparent,
gradientEnd: Colors.transparent,
textColor: (!mulCreate &&
controller.text == '') ||
(mulCreate &&
_norNumController.text
});
Navigator.pop(context);
}),
])
],
),
)),
Positioned(
right: ScreenUtil().setWidth(0),
top: ScreenUtil().setWidth(194 * 2),
child: Offstage(
offstage: showBaojian,
child: tableManageSelectWidget(baojianList, 210,
(index) {
state(() {
showBaojian = !showBaojian;
currentBaojianIndex = index;
baojian = baojianList[currentBaojianIndex];
});
}),
)),
Positioned(
left: ScreenUtil().setWidth(190 * 2),
top: ScreenUtil().setWidth(242 * 2),
child: Offstage(
offstage: showPnumMin,
child: selectWidgetTableManage(pnum, (index) {
state(() {
showPnumMin = !showPnumMin;
pnumMin = pnum[index];
});
}),
)),
Positioned(
right: ScreenUtil().setWidth(0),
top: ScreenUtil().setWidth(242 * 2),
child: Offstage(
offstage: showPnumMax,
child: selectWidgetTableManage(pnum, (index) {
state(() {
showPnumMax = !showPnumMax;
pnumMax = pnum[index];
});
}),
)),
],
));
}));
.trim() ==
'')
? MyColours.color_999999
: MyColours.color_438E93,
fontSize: 34,
onPressed: () {
if (mulCreate &&
_norNumController.text
.trim()
.length ==
0) {
Utils.showToast('请输入数量!');
return;
}
if (mulCreate &&
!Utils.isNumber(
_norNumController.text)) {
Utils.showToast('请输入数字!');
return;
}
if (mulCreate &&
int.parse(
_norNumController.text) >
20) {
Utils.showToast('最多可创建20个桌位!');
return;
}
if (!mulCreate &&
controller.text.trim() == '') {
Utils.showToast('请输入桌位名称!');
return;
}
// 当前选中区域
// areas[currentAreaIndex]
//最低人数
// pnumMin
//最高人数
// pnumMax
onTap({
'bjtype': baojianList[
currentBaojianIndex],
'name': controller.text,
'pnumMin': pnumMin,
'pnumMax': pnumMax,
'mulcreate': mulCreate.toString(),
'tablenum': _norNumController.text
});
Navigator.pop(context);
}),
])
],
),
)),
Positioned(
right: ScreenUtil().setWidth(0),
top: ScreenUtil().setWidth(194 * 2),
child: Offstage(
offstage: showBaojian,
child: tableManageSelectWidget(baojianList, 210,
(index) {
state(() {
showBaojian = !showBaojian;
currentBaojianIndex = index;
baojian = baojianList[currentBaojianIndex];
});
}),
)),
Positioned(
left: ScreenUtil().setWidth(190 * 2),
top: ScreenUtil().setWidth(242 * 2),
child: Offstage(
offstage: showPnumMin,
child: selectWidgetTableManage(pnum, (index) {
state(() {
showPnumMin = !showPnumMin;
pnumMin = pnum[index];
});
}),
)),
Positioned(
right: ScreenUtil().setWidth(0),
top: ScreenUtil().setWidth(242 * 2),
child: Offstage(
offstage: showPnumMax,
child: selectWidgetTableManage(pnum, (index) {
state(() {
showPnumMax = !showPnumMax;
pnumMax = pnum[index];
});
}),
)),
],
));
}));
});
}
... ... @@ -2994,7 +2974,7 @@ class DialogUtil {
isScrollControlled: true,
builder: (BuildContext dialogContext) {
Widget widget = Container(
color: MyColours.app_main,
color: MyColours.color_ffffff,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
... ... @@ -3006,8 +2986,8 @@ class DialogUtil {
children: <Widget>[
Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(21),
bottom: ScreenUtil().setWidth(12)),
top: ScreenUtil().setWidth(31),
bottom: ScreenUtil().setWidth(2)),
width: double.infinity,
child: Stack(
alignment: Alignment.center,
... ... @@ -3015,7 +2995,7 @@ class DialogUtil {
Text(
"您有一条新的消息",
style: TextStyle(
color: MyColours.color_ffffff,
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32)),
),
Positioned(
... ... @@ -3028,7 +3008,7 @@ class DialogUtil {
padding: EdgeInsets.all(
ScreenUtil().setWidth(12)),
child: Image.asset(
"assets/icon_close.png",
"assets/close1.png",
width: ScreenUtil().setWidth(28),
height: ScreenUtil().setWidth(28),
),
... ... @@ -3104,7 +3084,8 @@ class DialogUtil {
)
: ListView.builder(
itemBuilder: (context, index) {
return MessageDialogItem(model.messages[index]);
return MessageDialogItemF(
model.messages[index]);
},
itemCount: model.messages.length,
shrinkWrap: true)
... ...