Commit ad6f38c0ee9731aa365963962d9995ed2e77c948

Authored by wdn127929
1 parent 69d499f7

在线订单

@@ -155,9 +155,9 @@ class ReserveDetailSunModel extends Object { @@ -155,9 +155,9 @@ class ReserveDetailSunModel extends Object {
155 DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( 155 DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
156 int.parse(ddate.toString()) * 1000); 156 int.parse(ddate.toString()) * 1000);
157 ymd = dateTime.year.toString() + 157 ymd = dateTime.year.toString() +
158 - "/" + 158 + "-" +
159 Utils.addZeroNumber(dateTime.month) + 159 Utils.addZeroNumber(dateTime.month) +
160 - "/" + 160 + "-" +
161 Utils.addZeroNumber(dateTime.day); 161 Utils.addZeroNumber(dateTime.day);
162 } else { 162 } else {
163 ymd = ddate.substring(0, 10); 163 ymd = ddate.substring(0, 10);
@@ -179,9 +179,9 @@ class ReserveDetailSunModel extends Object { @@ -179,9 +179,9 @@ class ReserveDetailSunModel extends Object {
179 DateTime dateTime = 179 DateTime dateTime =
180 DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000); 180 DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000);
181 return dateTime.year.toString() + 181 return dateTime.year.toString() +
182 - "/" + 182 + "-" +
183 Utils.addZeroNumber(dateTime.month) + 183 Utils.addZeroNumber(dateTime.month) +
184 - "/" + 184 + "-" +
185 Utils.addZeroNumber(dateTime.day) + 185 Utils.addZeroNumber(dateTime.day) +
186 " " + 186 " " +
187 Utils.addZeroNumber(dateTime.hour) + 187 Utils.addZeroNumber(dateTime.hour) +
@@ -51,6 +51,9 @@ class TableClassSunModel extends Object { @@ -51,6 +51,9 @@ class TableClassSunModel extends Object {
51 @JsonKey(name: 'status') 51 @JsonKey(name: 'status')
52 String status; 52 String status;
53 53
  54 + @JsonKey(name: 'surplus')
  55 + String surplus;
  56 +
54 @JsonKey(name: 'cdate') 57 @JsonKey(name: 'cdate')
55 String cdate; 58 String cdate;
56 59
@@ -63,6 +66,7 @@ class TableClassSunModel extends Object { @@ -63,6 +66,7 @@ class TableClassSunModel extends Object {
63 this.low, 66 this.low,
64 this.standard, 67 this.standard,
65 this.status, 68 this.status,
  69 + this.surplus,
66 this.cdate, 70 this.cdate,
67 ); 71 );
68 72
@@ -33,6 +33,7 @@ TableClassSunModel _$TableClassSunModelFromJson(Map<String, dynamic> json) { @@ -33,6 +33,7 @@ TableClassSunModel _$TableClassSunModelFromJson(Map<String, dynamic> json) {
33 json['low'] as String, 33 json['low'] as String,
34 json['standard'] as String, 34 json['standard'] as String,
35 json['status'] as String, 35 json['status'] as String,
  36 + json['surplus'] as String,
36 json['cdate'] as String, 37 json['cdate'] as String,
37 ); 38 );
38 } 39 }
@@ -47,5 +48,6 @@ Map<String, dynamic> _$TableClassSunModelToJson(TableClassSunModel instance) => @@ -47,5 +48,6 @@ Map<String, dynamic> _$TableClassSunModelToJson(TableClassSunModel instance) =>
47 'low': instance.low, 48 'low': instance.low,
48 'standard': instance.standard, 49 'standard': instance.standard,
49 'status': instance.status, 50 'status': instance.status,
  51 + 'surplus':instance.surplus,
50 'cdate': instance.cdate, 52 'cdate': instance.cdate,
51 }; 53 };
@@ -234,5 +234,7 @@ class HttpUrl { @@ -234,5 +234,7 @@ class HttpUrl {
234 "?service=App.Tables.DelTableRegion"; // 删除区域同时删除区域下面的桌位 234 "?service=App.Tables.DelTableRegion"; // 删除区域同时删除区域下面的桌位
235 static const String batch_set_table = 235 static const String batch_set_table =
236 "?service=App.Tables.BatchSetTable"; // 批量修改桌位信息 236 "?service=App.Tables.BatchSetTable"; // 批量修改桌位信息
  237 + static const String push_msg_set_message_status =
  238 + "?service=App.PushMsg.SetMessage"; //设置消息状态
237 239
238 } 240 }
@@ -345,22 +345,43 @@ class MessageItemF extends StatelessWidget { @@ -345,22 +345,43 @@ class MessageItemF extends StatelessWidget {
345 fontSize: ScreenUtil().setSp(28)), 345 fontSize: ScreenUtil().setSp(28)),
346 ), 346 ),
347 VEmptyView(8), 347 VEmptyView(8),
348 - message.room_demand == ''  
349 - ? SizedBox()  
350 - : Container(  
351 - padding: EdgeInsets.symmetric(  
352 - horizontal: ScreenUtil().setWidth(16),  
353 - vertical: ScreenUtil().setWidth(6)),  
354 - decoration: BoxDecoration(  
355 - color: bgcolor,  
356 - borderRadius: BorderRadius.circular(8)),  
357 - child: Text(  
358 - '${message.room_demand}',  
359 - style: TextStyle(  
360 - color: MyColours.color_ffffff,  
361 - fontSize: ScreenUtil().setSp(20)),  
362 - ),  
363 - ), 348 + message.message_type == "1"
  349 + ? message.room_info == ''
  350 + ? SizedBox()
  351 + : Container(
  352 + padding: EdgeInsets.symmetric(
  353 + horizontal:
  354 + ScreenUtil().setWidth(16),
  355 + vertical: ScreenUtil().setWidth(6)),
  356 + decoration: BoxDecoration(
  357 + color: bgcolor,
  358 + borderRadius:
  359 + BorderRadius.circular(8)),
  360 + child: Text(
  361 + '${message.room_info == ''}',
  362 + style: TextStyle(
  363 + color: MyColours.color_ffffff,
  364 + fontSize: ScreenUtil().setSp(20)),
  365 + ),
  366 + )
  367 + : message.room_demand == ''
  368 + ? SizedBox()
  369 + : Container(
  370 + padding: EdgeInsets.symmetric(
  371 + horizontal:
  372 + ScreenUtil().setWidth(16),
  373 + vertical: ScreenUtil().setWidth(6)),
  374 + decoration: BoxDecoration(
  375 + color: bgcolor,
  376 + borderRadius:
  377 + BorderRadius.circular(8)),
  378 + child: Text(
  379 + '${message.room_demand}',
  380 + style: TextStyle(
  381 + color: MyColours.color_ffffff,
  382 + fontSize: ScreenUtil().setSp(20)),
  383 + ),
  384 + ),
364 message.message_type == "1" 385 message.message_type == "1"
365 ? SizedBox() 386 ? SizedBox()
366 : Text( 387 : Text(
@@ -36,19 +36,23 @@ class MessagePageState extends State<MessagePage> @@ -36,19 +36,23 @@ class MessagePageState extends State<MessagePage>
36 MessageModel messageModel; 36 MessageModel messageModel;
37 UserModel userModel; 37 UserModel userModel;
38 MessageDialogModel messageDialogModel; 38 MessageDialogModel messageDialogModel;
  39 + // int selectIndex = 0;
39 40
40 @override 41 @override
41 void initState() { 42 void initState() {
42 super.initState(); 43 super.initState();
43 tabController = TabController(length: 2, vsync: this); 44 tabController = TabController(length: 2, vsync: this);
  45 +
44 tabController.addListener(() { 46 tabController.addListener(() {
45 //点击tab时或滑动tab回调一次 47 //点击tab时或滑动tab回调一次
46 - if (tabController.index.toDouble() == tabController.animation.value) {  
47 - getMessage(index: tabController.index);  
48 - } 48 + // if (tabController.index.toDouble() == tabController.animation.value) {
  49 + // getMessage(index: tabController.index);
  50 + // selectIndex = tabController.index;
  51 + setState(() {});
  52 + // }
49 }); 53 });
50 WidgetsBinding.instance.addPostFrameCallback((timeStamp) { 54 WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
51 - getMessage(index: 0); 55 + // getMessage(index: 0);
52 }); 56 });
53 //刷新未读数 57 //刷新未读数
54 bus.on("refresh_untreated_num", (arg) { 58 bus.on("refresh_untreated_num", (arg) {
@@ -70,24 +74,33 @@ class MessagePageState extends State<MessagePage> @@ -70,24 +74,33 @@ class MessagePageState extends State<MessagePage>
70 } 74 }
71 75
72 //获取在线预订消息status 0未处理 1已处理 76 //获取在线预订消息status 0未处理 1已处理
73 - getMessage({bool showLoading = true, int index}) async {  
74 - String typeId = '';  
75 - if (index == 0) {  
76 - typeId = '10';  
77 - } else if (index == 1) {  
78 - typeId = '1';  
79 - } else if (index == 2) {  
80 - typeId = '12';  
81 - }  
82 - Map<String, String> params = {  
83 - "sid": userModel.user.sellerid,  
84 - "type_id": typeId, //1提前点餐2内部预订10在线预订  
85 - "status": '0',  
86 - "offset": '0',  
87 - "limit": "20",  
88 - };  
89 - await messageModel.getMessages(context, params, showLoading: showLoading);  
90 - _getUnMsgNum(); 77 + // getMessage({bool showLoading = true, int index}) async {
  78 + // String typeId = '';
  79 + // if (index == 0) {
  80 + // typeId = '10';
  81 + // } else if (index == 1) {
  82 + // typeId = '1';
  83 + // } else if (index == 2) {
  84 + // typeId = '12';
  85 + // }
  86 + // Map<String, String> params = {
  87 + // "sid": userModel.user.sellerid,
  88 + // "type_id": typeId, //1提前点餐2内部预订10在线预订
  89 + // "status": '0',
  90 + // "offset": '0',
  91 + // "limit": "20",
  92 + // };
  93 + // await messageModel.getMessages(context, params, showLoading: showLoading);
  94 + // _getUnMsgNum();
  95 + // }
  96 + @override
  97 + void dispose() {
  98 + super.dispose();
  99 + messageModel.pageStateUn = PageState.Loading;
  100 + messageModel.pageState = PageState.Loading;
  101 + messageModel.notifyListeners();
  102 + bus.off("refresh_untreated_num");
  103 + bus.off("remove_untreated_message");
91 } 104 }
92 105
93 @override 106 @override
@@ -256,12 +269,4 @@ class MessagePageState extends State<MessagePage> @@ -256,12 +269,4 @@ class MessagePageState extends State<MessagePage>
256 ), 269 ),
257 ); 270 );
258 } 271 }
259 -  
260 - @override  
261 - void dispose() {  
262 - // TODO: implement dispose  
263 - super.dispose();  
264 - bus.off("refresh_untreated_num");  
265 - bus.off("remove_untreated_message");  
266 - }  
267 } 272 }
@@ -40,7 +40,7 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { @@ -40,7 +40,7 @@ class MessageTreatedPageState extends State<MessageTreatedPage> {
40 UserModel userModel; 40 UserModel userModel;
41 MessageDialogModel messageDialogModel; 41 MessageDialogModel messageDialogModel;
42 List<MessageMenuModel> menuTitle = []; 42 List<MessageMenuModel> menuTitle = [];
43 - 43 + String typeid = ''; //默认全部
44 @override 44 @override
45 void initState() { 45 void initState() {
46 // TODO: implement initState 46 // TODO: implement initState
@@ -54,12 +54,9 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { @@ -54,12 +54,9 @@ class MessageTreatedPageState extends State<MessageTreatedPage> {
54 _controller = EasyRefreshController(); 54 _controller = EasyRefreshController();
55 // messageModel.pageState = PageState.Loading; 55 // messageModel.pageState = PageState.Loading;
56 WidgetsBinding.instance.addPostFrameCallback((_) { 56 WidgetsBinding.instance.addPostFrameCallback((_) {
57 - getMessage();  
58 - setState(() {  
59 - messageModel.pageState = PageState.Loading;  
60 - });  
61 messageModel.pageState = PageState.Loading; 57 messageModel.pageState = PageState.Loading;
62 messageModel.notifyListeners(); 58 messageModel.notifyListeners();
  59 + getMessage(typeid);
63 }); 60 });
64 } 61 }
65 62
@@ -79,13 +76,8 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { @@ -79,13 +76,8 @@ class MessageTreatedPageState extends State<MessageTreatedPage> {
79 MessageMenuModel model5 = MessageMenuModel(); 76 MessageMenuModel model5 = MessageMenuModel();
80 model5.title = '在线买单'; 77 model5.title = '在线买单';
81 model5.select = false; 78 model5.select = false;
82 - MessageMenuModel model6 = MessageMenuModel();  
83 - model6.title = '完成买单';  
84 - model6.select = false;  
85 - MessageMenuModel model7 = MessageMenuModel();  
86 - model7.title = '申请发票';  
87 - model7.select = false;  
88 - menuTitle = [model1, model2, model3, model4, model5, model6, model7]; 79 +
  80 + menuTitle = [model1, model2, model3, model4, model5];
89 } 81 }
90 82
91 @override 83 @override
@@ -102,10 +94,10 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { @@ -102,10 +94,10 @@ class MessageTreatedPageState extends State<MessageTreatedPage> {
102 } 94 }
103 95
104 //获取在线预订消息status 0未处理 1已处理 96 //获取在线预订消息status 0未处理 1已处理
105 - getMessage({bool showLoading = true}) async { 97 + getMessage(String typeid, {bool showLoading = true}) async {
106 Map<String, String> params = { 98 Map<String, String> params = {
107 "sid": userModel.user.sellerid, 99 "sid": userModel.user.sellerid,
108 - "type_id": "10", //1提前点餐2内部预订10在线预订 100 + "type_id": typeid, //1提前点餐2内部预订10在线预订店/内消息传15
109 "status": '1', 101 "status": '1',
110 "offset": offset.toString(), 102 "offset": offset.toString(),
111 "limit": "20", 103 "limit": "20",
@@ -150,7 +142,23 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { @@ -150,7 +142,23 @@ class MessageTreatedPageState extends State<MessageTreatedPage> {
150 menuTitle[index].select = true; 142 menuTitle[index].select = true;
151 setState(() {}); 143 setState(() {});
152 offset = 0; 144 offset = 0;
153 - getMessage(showLoading: true); 145 + // 1提前点餐/2内部预订/10在线预订/15店内消息传/12在线买单
  146 +
  147 + if (index == 0) {
  148 + } else if (index == 1) {
  149 + //店内消息
  150 + typeid = '15';
  151 + } else if (index == 2) {
  152 + //在线预订
  153 + typeid = '10';
  154 + } else if (index == 3) {
  155 + //提前点餐
  156 + typeid = '1';
  157 + } else if (index == 4) {
  158 + //在线买单
  159 + typeid = '12';
  160 + }
  161 + getMessage(typeid, showLoading: true);
154 }, 162 },
155 child: Container( 163 child: Container(
156 // width: ScreenUtil().setWidth(104 * 2), 164 // width: ScreenUtil().setWidth(104 * 2),
@@ -198,7 +206,7 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { @@ -198,7 +206,7 @@ class MessageTreatedPageState extends State<MessageTreatedPage> {
198 pageState: model.pageState, 206 pageState: model.pageState,
199 callback: () { 207 callback: () {
200 offset = 0; 208 offset = 0;
201 - getMessage(showLoading: true); 209 + getMessage(typeid, showLoading: true);
202 }, 210 },
203 emptyMsg: "暂时没有已处理的消息哦", 211 emptyMsg: "暂时没有已处理的消息哦",
204 emptyImg: "empty_search", 212 emptyImg: "empty_search",
@@ -219,11 +227,11 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { @@ -219,11 +227,11 @@ class MessageTreatedPageState extends State<MessageTreatedPage> {
219 ], 227 ],
220 onRefresh: () async { 228 onRefresh: () async {
221 offset = 0; 229 offset = 0;
222 - getMessage(showLoading: false); 230 + getMessage(typeid, showLoading: false);
223 }, 231 },
224 onLoad: () async { 232 onLoad: () async {
225 offset++; 233 offset++;
226 - getMessage(showLoading: false); 234 + getMessage(typeid, showLoading: false);
227 }, 235 },
228 ))) 236 )))
229 ]); 237 ]);
@@ -50,12 +50,12 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> { @@ -50,12 +50,12 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> {
50 _controller = EasyRefreshController(); 50 _controller = EasyRefreshController();
51 // messageModel.pageState = PageState.Loading; 51 // messageModel.pageState = PageState.Loading;
52 WidgetsBinding.instance.addPostFrameCallback((_) { 52 WidgetsBinding.instance.addPostFrameCallback((_) {
53 - // getMessage();  
54 // setState(() { 53 // setState(() {
55 // messageModel.pageState = PageState.Loading; 54 // messageModel.pageState = PageState.Loading;
56 // }); 55 // });
57 messageModel.pageStateUn = PageState.Loading; 56 messageModel.pageStateUn = PageState.Loading;
58 messageModel.notifyListeners(); 57 messageModel.notifyListeners();
  58 + getMessage();
59 }); 59 });
60 } 60 }
61 61
@@ -83,9 +83,40 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> { @@ -83,9 +83,40 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> {
83 }; 83 };
84 84
85 await messageModel.getMessages(context, params, showLoading: showLoading); 85 await messageModel.getMessages(context, params, showLoading: showLoading);
  86 + _cancelMessage();
86 _getUnMsgNum(); 87 _getUnMsgNum();
87 } 88 }
88 89
  90 + _cancelMessage() async {
  91 + String messageids = ''; //超过24小时
  92 + for (Message item in messageModel.messages) {
  93 + if (item.message_type == '11') {
  94 + DateTime cdate = DateTime.fromMillisecondsSinceEpoch(
  95 + int.parse(item.cdate.toString()) * 1000);
  96 + DateTime nowdate = DateTime.fromMillisecondsSinceEpoch(
  97 + int.parse(item.cdate.toString()) * 1000);
  98 +
  99 + int hours = nowdate.difference(cdate).inHours;
  100 + if (hours > 24) {
  101 + messageids += '${item.id},';
  102 + }
  103 + }
  104 + }
  105 + if (messageids.endsWith(',')) {
  106 + messageids = messageids.substring(0, messageids.length - 1);
  107 + setMessageStatus(messageids);
  108 + }
  109 + }
  110 +
  111 + //设置消息状态
  112 + setMessageStatus(String messageids) async {
  113 + Map<String, String> params = {
  114 + "id": messageids,
  115 + };
  116 + await messageModel.setMessageStatus(context, params);
  117 + getMessage(showLoading: false);
  118 + }
  119 +
89 @override 120 @override
90 Widget build(BuildContext context) { 121 Widget build(BuildContext context) {
91 messageModel = Provider.of<MessageModel>(context, listen: true); 122 messageModel = Provider.of<MessageModel>(context, listen: true);
@@ -67,10 +67,16 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -67,10 +67,16 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
67 _norNumController.text = sunModel.standard; 67 _norNumController.text = sunModel.standard;
68 _maxNumController.text = sunModel.max; 68 _maxNumController.text = sunModel.max;
69 _minMoneyController.text = sunModel.low; 69 _minMoneyController.text = sunModel.low;
70 - setState(() {  
71 - sunModel.status == '1' ? swichState = true : swichState = false;  
72 - tableListSel = sunModel.tableid != null ? sunModel.tableid : '';  
73 - }); 70 +
  71 + sunModel.status == '1' ? swichState = true : swichState = false;
  72 + tableListSel = sunModel.tableid != null ? sunModel.tableid : '';
  73 + selectNum = sunModel.surplus;
  74 + List<String> numList = [];
  75 + for (int i = 0; i < tableListSel.split(',').length; i++) {
  76 + numList.add('$i');
  77 + }
  78 + selectIndex = numList.indexOf(selectNum);
  79 + setState(() {});
74 } 80 }
75 } 81 }
76 82
@@ -96,6 +102,10 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -96,6 +102,10 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
96 if (widget.tableClassId != 'null') { 102 if (widget.tableClassId != 'null') {
97 params['id'] = widget.tableClassId; 103 params['id'] = widget.tableClassId;
98 } 104 }
  105 + if (tableListSel.split(',').length > 0) {
  106 + params['surplus'] = selectNum;
  107 + }
  108 +
99 bool success = 109 bool success =
100 await detailModel.setTableClass(context, params, showLoading: true); 110 await detailModel.setTableClass(context, params, showLoading: true);
101 if (success) { 111 if (success) {
@@ -400,9 +410,11 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -400,9 +410,11 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
400 horizontal: ScreenUtil().setWidth(40), 410 horizontal: ScreenUtil().setWidth(40),
401 vertical: ScreenUtil().setWidth(40), 411 vertical: ScreenUtil().setWidth(40),
402 ), 412 ),
403 - child: _select('关联包间',  
404 - tableListSel.length == 0 ? '选择包间' : '查看包间',  
405 - ontap: () async { 413 + child: _select(
  414 + '关联包间',
  415 + tableListSel.split(',').length == 0
  416 + ? '选择包间'
  417 + : '查看包间', ontap: () async {
406 Map temp = await NavigatorUtil 418 Map temp = await NavigatorUtil
407 .goRoomTypeSelectTablePage( 419 .goRoomTypeSelectTablePage(
408 context, 420 context,
@@ -432,7 +444,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -432,7 +444,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
432 right: ScreenUtil().setWidth(40)), 444 right: ScreenUtil().setWidth(40)),
433 ), 445 ),
434 VEmptyView(10), 446 VEmptyView(10),
435 - tableListSel.length == 0 447 + tableListSel.split(',').length == 0
436 ? SizedBox() 448 ? SizedBox()
437 : Padding( 449 : Padding(
438 padding: EdgeInsets.symmetric( 450 padding: EdgeInsets.symmetric(
@@ -453,6 +465,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -453,6 +465,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
453 if (value != null) { 465 if (value != null) {
454 selectIndex = value.first; 466 selectIndex = value.first;
455 selectNum = numList[value.first]; 467 selectNum = numList[value.first];
  468 + setState(() {});
456 469
457 // bool sucess = 470 // bool sucess =
458 // await detailModel.upReserveInfo( 471 // await detailModel.upReserveInfo(
@@ -473,7 +486,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { @@ -473,7 +486,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
473 : [selectIndex]) 486 : [selectIndex])
474 .then((value) {}); 487 .then((value) {});
475 })), 488 })),
476 - tableListSel.length == 0 489 + tableListSel.split(',').length == 0
477 ? SizedBox() 490 ? SizedBox()
478 : Padding( 491 : Padding(
479 padding: EdgeInsets.symmetric( 492 padding: EdgeInsets.symmetric(
  1 +import 'dart:convert';
  2 +
  3 +import 'dart:io';
  4 +import 'dart:async';
  5 +
  6 +import 'package:cached_network_image/cached_network_image.dart';
  7 +import 'package:flutter/material.dart';
  8 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  9 +import 'package:one_key/models/upload_img_model.dart';
  10 +import 'package:one_key/pages/online_check/photo_view_wiget.dart';
  11 +import 'package:one_key/pages/online_check/progress.dart';
  12 +
  13 +import 'package:one_key/provider/online_check_edit_provider.dart';
  14 +import 'package:one_key/provider/upload_img_provider.dart';
  15 +import 'package:one_key/res/colors.dart';
  16 +import 'package:one_key/utils/dialog_util.dart';
  17 +import 'package:one_key/utils/misc.dart';
  18 +import 'package:one_key/utils/upload_image_util.dart';
  19 +import 'package:one_key/utils/utils.dart';
  20 +import 'package:one_key/widgets/MyDivider.dart';
  21 +import 'package:one_key/widgets/v_empty_view.dart';
  22 +import 'package:permission_handler/permission_handler.dart';
  23 +import 'package:photo/photo.dart';
  24 +import 'package:provider/provider.dart';
  25 +
  26 +import 'package:image_picker/image_picker.dart';
  27 +import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart';
  28 +import './dispose.dart';
  29 +import 'package:photo_manager/photo_manager.dart';
  30 +import 'package:flutter_native_image/flutter_native_image.dart';
  31 +
  32 +typedef void OnPickImageCallback(
  33 + double maxWidth, double maxHeight, int quality);
  34 +typedef void DeleteCallback(int index);
  35 +
  36 +class ImgPickerFWidget extends StatefulWidget {
  37 + final ScrollController scrollController;
  38 + final Color borderColor;
  39 + final VoidCallback callback;
  40 + final int maxImageNumber;
  41 + final UploadImageProvider model;
  42 + final UploadType uploadType;
  43 + final DeleteCallback deleteCallback;
  44 + ImgPickerFWidget(
  45 + {Key key,
  46 + this.scrollController,
  47 + this.borderColor = Colors.blue,
  48 + this.callback,
  49 + this.maxImageNumber = 5,
  50 + this.model,
  51 + this.uploadType,
  52 + this.deleteCallback})
  53 + : super(key: key);
  54 +
  55 + @override
  56 + _ImgPickerFWidgetState createState() => _ImgPickerFWidgetState();
  57 +}
  58 +
  59 +class _ImgPickerFWidgetState extends DisposableState<ImgPickerFWidget> {
  60 + final picker = ImagePicker();
  61 + // OnlineCheckEditProvider _onlineCheckEditProvider;
  62 + // UploadImageProvider _uploadImageProvider;
  63 +
  64 + // 用户输入的文件名
  65 + String key;
  66 + // 用户输入的 partSize
  67 + int partSize = 4;
  68 + // 用户输入的 token
  69 + String token;
  70 +
  71 + /// storage 实例
  72 + final Storage storage = Storage();
  73 + // 控制器,可以用于取消任务、获取上述的状态,进度等信息
  74 + // PutController putController = PutController();
  75 + // 当前的任务状态
  76 +
  77 + @override
  78 + void initState() {
  79 + // storage = Storage();
  80 + // putController = PutController();
  81 + super.initState();
  82 + }
  83 +
  84 + @override
  85 + void dispose() {
  86 + super.dispose();
  87 + }
  88 +
  89 + ///#相机拍照,单图选择
  90 + Future _getFromPictureOrCamera(imageSource) async {
  91 + final pickedFile = await picker.getImage(source: imageSource);
  92 + File compressedFile = await FlutterNativeImage.compressImage(
  93 + pickedFile.path,
  94 + quality: 50,
  95 + percentage: 50);
  96 + setState(() {
  97 + if (pickedFile != null) {
  98 + UploadImgModel imgModel = UploadImgModel();
  99 + imgModel.file = compressedFile;
  100 + imgModel.process = 0.01;
  101 + if (widget.uploadType == UploadType.ConsumptionUploadType) {
  102 + widget.model.imageList.add(imgModel);
  103 + } else if (widget.uploadType == UploadType.StoreFrontUploadType) {
  104 + widget.model.imageListFront.add(imgModel);
  105 + } else if (widget.uploadType == UploadType.EnvironmentUploadType) {
  106 + widget.model.imageListDenvironment.add(imgModel);
  107 + } else if (widget.uploadType == UploadType.TableManagerType) {
  108 + widget.model.tableImageList.add(imgModel);
  109 + }
  110 + } else {
  111 + print('No image selected.');
  112 + }
  113 + });
  114 + if (pickedFile != null) {
  115 + List<UploadImgModel> temp = [];
  116 +
  117 + if (widget.uploadType == UploadType.ConsumptionUploadType) {
  118 + temp = widget.model.imageList;
  119 + } else if (widget.uploadType == UploadType.StoreFrontUploadType) {
  120 + temp = widget.model.imageListFront;
  121 + } else if (widget.uploadType == UploadType.EnvironmentUploadType) {
  122 + temp = widget.model.imageListDenvironment;
  123 + } else if (widget.uploadType == UploadType.TableManagerType) {
  124 + temp = widget.model.tableImageList;
  125 + }
  126 + UploadImageUtil().startUpload(context, File(pickedFile.path),
  127 + temp.length - 1, true, widget.model, widget.uploadType,
  128 + callback: widget.callback, countAll: 1);
  129 + }
  130 + }
  131 +
  132 + ///多图片选择
  133 + void pickAsset(PickType type, {List<AssetPathEntity> pathList}) async {
  134 + List<UploadImgModel> temp = [];
  135 + if (widget.uploadType == UploadType.ConsumptionUploadType) {
  136 + temp = widget.model.imageList;
  137 + } else if (widget.uploadType == UploadType.StoreFrontUploadType) {
  138 + temp = widget.model.imageListFront;
  139 + } else if (widget.uploadType == UploadType.EnvironmentUploadType) {
  140 + temp = widget.model.imageListDenvironment;
  141 + } else if (widget.uploadType == UploadType.TableManagerType) {
  142 + temp = widget.model.tableImageList;
  143 + }
  144 +
  145 + /// context is required, other params is optional.
  146 + List<AssetEntity> imgList = await PhotoPicker.pickAsset(
  147 + // BuildContext required
  148 + context: context,
  149 +
  150 + /// The following are optional parameters.
  151 + themeColor: MyColours.color_199095,
  152 + // the title color and bottom color
  153 + textColor: Colors.white,
  154 + // text color
  155 + padding: 1.0,
  156 + // item padding
  157 + dividerColor: Colors.grey,
  158 + // divider color
  159 + disableColor: Colors.grey.shade300,
  160 + // the check box disable color
  161 + itemRadio: 0.88,
  162 + // the content item radio
  163 + maxSelected: widget.maxImageNumber - temp.length,
  164 + // max picker image count
  165 + // provider: I18nProvider.english,
  166 + provider: I18nProvider.chinese,
  167 + // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
  168 + rowCount: 3,
  169 + // item row count
  170 + thumbSize: 150,
  171 + // preview thumb size , default is 64
  172 + sortDelegate: SortDelegate.common,
  173 + // default is common ,or you make custom delegate to sort your gallery
  174 + checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(
  175 + activeColor: MyColours.color_353535,
  176 + unselectedColor: Colors.white,
  177 + checkColor: MyColours.color_199095,
  178 + ),
  179 + // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox
  180 + // loadingDelegate: this,
  181 + // if you want to build custom loading widget,extends LoadingDelegate, [see example/lib/main.dart]
  182 + badgeDelegate: const DurationBadgeDelegate(),
  183 + // badgeDelegate to show badge widget
  184 + pickType: type,
  185 + photoPathList: pathList,
  186 + );
  187 + if (imgList == null || imgList.isEmpty) {
  188 + print("No pick item.");
  189 + return;
  190 + } else {
  191 + for (int i = 0; i < imgList.length; i++) {
  192 + var file = await imgList[i].file;
  193 + File compressedFile = await FlutterNativeImage.compressImage(
  194 + file.absolute.path,
  195 + quality: 50,
  196 + percentage: 50);
  197 + setState(() {
  198 + UploadImgModel imgModel = UploadImgModel();
  199 + imgModel.file = compressedFile;
  200 + imgModel.process = 0.01;
  201 +
  202 + temp.add(imgModel);
  203 + });
  204 + UploadImageUtil().startUpload(context, File(file.absolute.path),
  205 + temp.length - 1, false, widget.model, widget.uploadType,
  206 + countAll: imgList.length, callback: widget.callback);
  207 + // startUpload(File(file.absolute.path),
  208 + // _uploadImageProvider.imageList.length - 1, false);
  209 + }
  210 + }
  211 + }
  212 +
  213 + // ///上传到七牛云
  214 + // void startUpload(File selectedFile, int index, bool needInit) async {
  215 + // final PutController putController = PutController();
  216 + // print(index);
  217 +
  218 + // // 添加状态监听
  219 + // putController.addStatusListener((StorageStatus status) {
  220 + // print('状态变化: 当前任务状态:${status.toString()}');
  221 + // });
  222 + // // 添加整体进度监听
  223 + // putController.addProgressListener((percent) {
  224 + // print('${index}任务进度变化:进度:${percent.toStringAsFixed(4)}');
  225 + // _uploadImageProvider.imageList[index].process = percent;
  226 + // _uploadImageProvider.notifyListeners();
  227 + // });
  228 + // // 添加实际发送进度订阅
  229 + // putController.addSendProgressListener((percent) {
  230 + // // _onlineCheckEditProvider.imageList[index].process = percent;
  231 + // // setState(() {});
  232 + // print('${index}实际发送变化:进度:${percent.toStringAsFixed(4)}');
  233 + // });
  234 + // if (token == null || token == '') {
  235 + // await _uploadImageProvider.getQiniuInfo(context, {});
  236 + // }
  237 + // var usedToken = _uploadImageProvider.qiniuInfoSunModel.token;
  238 + // if (usedToken == null || usedToken == '') {
  239 + // print('token 不能为空');
  240 + // return;
  241 + // }
  242 + // print('开始上传文件');
  243 + // storage.putFile(
  244 + // selectedFile,
  245 + // usedToken,
  246 + // options: PutOptions(
  247 + // key: key,
  248 + // partSize: partSize,
  249 + // controller: putController,
  250 + // ),
  251 + // )
  252 + // ..then((PutResponse response) {
  253 + // print('${index}上传已完成: 原始响应数据: ${jsonEncode(response.rawData)}');
  254 + // print('------------------------');
  255 + // String imgUrl = _uploadImageProvider.qiniuInfoSunModel.domain +
  256 + // '/' +
  257 + // response.rawData['key'];
  258 + // _uploadImageProvider.imageList[index].process = 1;
  259 + // _uploadImageProvider.imageList[index].qiniuUrl = imgUrl;
  260 + // // 取消当前任务
  261 + // putController.cancel();
  262 + // // _image
  263 + // _uploadImageProvider.notifyListeners();
  264 + // })
  265 + // ..catchError((dynamic error) {
  266 + // if (error is StorageError) {
  267 + // switch (error.type) {
  268 + // case StorageErrorType.CONNECT_TIMEOUT:
  269 + // print('发生错误: 连接超时');
  270 + // break;
  271 + // case StorageErrorType.SEND_TIMEOUT:
  272 + // print('发生错误: 发送数据超时');
  273 + // break;
  274 + // case StorageErrorType.RECEIVE_TIMEOUT:
  275 + // print('发生错误: 响应数据超时');
  276 + // break;
  277 + // case StorageErrorType.RESPONSE:
  278 + // print('发生错误: ${error.message}');
  279 + // break;
  280 + // case StorageErrorType.CANCEL:
  281 + // print('发生错误: 请求取消');
  282 + // break;
  283 + // case StorageErrorType.UNKNOWN:
  284 + // print('发生错误: 未知错误');
  285 + // break;
  286 + // case StorageErrorType.NO_AVAILABLE_HOST:
  287 + // print('发生错误: 无可用 Host');
  288 + // break;
  289 + // case StorageErrorType.IN_PROGRESS:
  290 + // print('发生错误: 已在队列中');
  291 + // break;
  292 + // }
  293 + // } else {
  294 + // print('发生错误: ${error.toString()}');
  295 + // }
  296 +
  297 + // print('------------------------');
  298 + // });
  299 + // }
  300 +
  301 + ///添加图片UI弹出
  302 + Future _openModalBottomSheet(context) async {
  303 + final option = await showModalBottomSheet(
  304 + context: context,
  305 + backgroundColor: Colors.transparent,
  306 + isDismissible: false,
  307 + builder: (BuildContext context) {
  308 + return Container(
  309 + // height: ScreenUtil().setWidth(180 * 2),
  310 + decoration: BoxDecoration(
  311 + color: MyColours.color_ffffff,
  312 + borderRadius: BorderRadius.only(
  313 + topLeft: Radius.circular(ScreenUtil().setWidth(24)),
  314 + topRight: Radius.circular(ScreenUtil().setWidth(24)))),
  315 + child: Column(
  316 + mainAxisSize: MainAxisSize.min,
  317 + children: <Widget>[
  318 + InkWell(
  319 + onTap: () {
  320 + Utils.getPickPermission(context, () {
  321 + _getFromPictureOrCamera(ImageSource.camera);
  322 + Navigator.pop(context);
  323 + }, Permission.camera);
  324 + },
  325 + child: Container(
  326 + width: double.infinity,
  327 + height: ScreenUtil().setWidth(58 * 2),
  328 + child: Center(
  329 + child: Text(
  330 + '拍摄',
  331 + style: TextStyle(
  332 + fontSize: ScreenUtil().setSp(32),
  333 + color: MyColours.color_353535,
  334 + fontWeight: FontWeight.bold),
  335 + ),
  336 + )),
  337 + ),
  338 + MyDivider(
  339 + double.infinity,
  340 + ScreenUtil().setWidth(2),
  341 + color: MyColours.color_EEEEEE,
  342 + ),
  343 + InkWell(
  344 + onTap: () {
  345 + Utils.getPickPermission(context, () {
  346 + pickAsset(PickType.onlyImage);
  347 + // _getFromPictureOrCamera(ImageSource.gallery);
  348 + Navigator.pop(context);
  349 + },
  350 + Platform.isAndroid
  351 + ? Permission.storage
  352 + : Permission.photos);
  353 + },
  354 + child: Container(
  355 + width: double.infinity,
  356 + height: ScreenUtil().setWidth(58 * 2),
  357 + child: Center(
  358 + child: Text(
  359 + '从相册选择',
  360 + style: TextStyle(
  361 + fontSize: ScreenUtil().setSp(32),
  362 + color: MyColours.color_353535,
  363 + fontWeight: FontWeight.bold),
  364 + ),
  365 + )),
  366 + ),
  367 + MyDivider(
  368 + double.infinity,
  369 + ScreenUtil().setWidth(10),
  370 + color: MyColours.color_EEEEEE,
  371 + ),
  372 + InkWell(
  373 + onTap: () {
  374 + Navigator.pop(context, '取消');
  375 + },
  376 + child: Container(
  377 + width: double.infinity,
  378 + height: ScreenUtil().setWidth(58 * 2),
  379 + child: Center(
  380 + child: Text(
  381 + '取消',
  382 + style: TextStyle(
  383 + fontSize: ScreenUtil().setSp(32),
  384 + color: MyColours.color_353535,
  385 + fontWeight: FontWeight.bold),
  386 + ),
  387 + )))
  388 + ],
  389 + ),
  390 + );
  391 + });
  392 + }
  393 +
  394 + //查看大图
  395 + _showPhotoView(BuildContext context, int index, List<String> imgs,
  396 + {isShow = false, List dashName}) async {
  397 + // if (imgs.length == 1 &&
  398 + // imgs[0] ==
  399 + // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
  400 + // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
  401 + // }
  402 + Utils.setBarStatus(false, color: Colors.black);
  403 + dynamic result = await showGeneralDialog(
  404 + context: context,
  405 + barrierDismissible: false,
  406 + // barrierColor: Colors.red,
  407 + barrierLabel:
  408 + MaterialLocalizations.of(context).modalBarrierDismissLabel,
  409 + transitionDuration: const Duration(milliseconds: 150),
  410 + pageBuilder: (BuildContext context, Animation animation,
  411 + Animation secondaryAnimation) {
  412 + Widget child = Stack(
  413 + children: <Widget>[
  414 + PhotoPreview(
  415 + initialIndex: index,
  416 + photoList: imgs,
  417 + isShow: isShow,
  418 + dashName: dashName)
  419 + ],
  420 + );
  421 + return child;
  422 + });
  423 + Utils.setBarStatus(true, color: Colors.white);
  424 + }
  425 +
  426 + @override
  427 + Widget build(BuildContext context) {
  428 + // _uploadImageProvider =
  429 + // Provider.of<UploadImageProvider>(context, listen: true);
  430 + List<UploadImgModel> temp = [];
  431 + if (widget.uploadType == UploadType.ConsumptionUploadType) {
  432 + temp = widget.model.imageList;
  433 + } else if (widget.uploadType == UploadType.StoreFrontUploadType) {
  434 + temp = widget.model.imageListFront;
  435 + } else if (widget.uploadType == UploadType.EnvironmentUploadType) {
  436 + temp = widget.model.imageListDenvironment;
  437 + } else if (widget.uploadType == UploadType.TableManagerType) {
  438 + temp = widget.model.tableImageList;
  439 + }
  440 + return _getGridImg(
  441 + temp.length < widget.maxImageNumber ? temp.length + 1 : temp.length,
  442 + context,
  443 + temp.length == widget.maxImageNumber ? true : false,
  444 + temp);
  445 + }
  446 +
  447 + /// 九宫格
  448 + Widget _getGridImg(count, context, isLinjie, List<UploadImgModel> temp) {
  449 + return GridView.builder(
  450 + controller: widget.scrollController,
  451 + // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
  452 + shrinkWrap: true,
  453 + itemCount: count,
  454 +
  455 + //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
  456 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  457 + //横轴元素个数
  458 + crossAxisCount: 3,
  459 + //纵轴间距
  460 + mainAxisSpacing: ScreenUtil().setWidth(40),
  461 + //横轴间距
  462 + crossAxisSpacing: ScreenUtil().setWidth(36),
  463 + //子组件宽高长度比例
  464 + childAspectRatio: 1.0),
  465 + itemBuilder: (BuildContext context, int index) {
  466 + //Widget Function(BuildContext context, int index)
  467 + var linjie = widget.maxImageNumber;
  468 + if (isLinjie) {
  469 + linjie = widget.maxImageNumber - 1;
  470 + }
  471 + if (index == count - 1 && index < linjie) {
  472 + return InkWell(
  473 + onTap: () {
  474 + // 触摸收起键盘
  475 + FocusScope.of(context).requestFocus(FocusNode());
  476 + _openModalBottomSheet(context);
  477 + },
  478 + child: Container(
  479 + width: ScreenUtil().setWidth(80 * 2),
  480 + height: ScreenUtil().setWidth(80 * 2),
  481 + decoration: BoxDecoration(
  482 + color: MyColours.color_f3f3f3,
  483 + // border: Border.all(
  484 + // color: MyColours.color_E0E0E0,
  485 + // width: ScreenUtil().setWidth(2)),
  486 + ),
  487 + child: Column(
  488 + mainAxisAlignment: MainAxisAlignment.center,
  489 + children: [
  490 + // VEmptyView(46),
  491 + Image.asset(
  492 + Utils.getImgPath('add_store'),
  493 + width: ScreenUtil().setWidth(28),
  494 + height: ScreenUtil().setWidth(28),
  495 + ),
  496 + // VEmptyView(10),
  497 + // Text(
  498 + // '上传照片',
  499 + // style: TextStyle(
  500 + // fontSize: ScreenUtil().setSp(24),
  501 + // color: MyColours.color_999999),
  502 + // )
  503 + ],
  504 + )),
  505 + );
  506 + }
  507 + return temp.length < 1
  508 + ? Text('')
  509 + : InkWell(
  510 + onTap: () {
  511 + if (temp[index].process == 1) {
  512 + widget.model.imageQiniuUrlList = [];
  513 + if (temp[index].qiniuUrl != null) {
  514 + for (int i = 0; i < temp.length; i++) {
  515 + widget.model.imageQiniuUrlList.add(temp[i].qiniuUrl);
  516 + }
  517 +
  518 + ///没有上传完成的不可以点击
  519 + _showPhotoView(
  520 + context, index, widget.model.imageQiniuUrlList);
  521 + }
  522 + }
  523 + },
  524 + child: Stack(
  525 + children: [
  526 + Stack(
  527 + // alignment: Alignment.topRight,
  528 + children: [
  529 + temp[index].file != null
  530 + ? Container(
  531 + child: Image.file(
  532 + temp[index].file,
  533 + fit: BoxFit.cover,
  534 + width: ScreenUtil().setWidth(100 * 2),
  535 + height: ScreenUtil().setWidth(100 * 2),
  536 + ),
  537 + )
  538 + : CachedNetworkImage(
  539 + imageUrl: temp[index].qiniuUrl,
  540 + fit: BoxFit.cover,
  541 + width: ScreenUtil().setWidth(100 * 2),
  542 + height: ScreenUtil().setWidth(100 * 2),
  543 + ),
  544 + Offstage(
  545 + offstage: temp[index].process < 1,
  546 + child: Align(
  547 + alignment: Alignment.topRight,
  548 + child: GestureDetector(
  549 + child: Image.asset(
  550 + Utils.getImgPath("delete"),
  551 + width: ScreenUtil().setWidth(40),
  552 + height: ScreenUtil().setWidth(40),
  553 + ),
  554 + onTap: () {
  555 + if (widget.uploadType ==
  556 + UploadType.TableManagerType) {
  557 + if (temp[index].isUpload) {
  558 + //已经传到服务器,弹提醒窗口,是否删除
  559 + //修改之前有内容,则弹框
  560 + DialogUtil.cupertinoAlertDialog(context,
  561 + title: "确认删除",
  562 + content: "是否确定删除该照片,删除操作不可逆转,请谨慎操作",
  563 + lCallback: () {
  564 + print("取消");
  565 + }, rCallback: () {
  566 + print("确定");
  567 + widget.deleteCallback(index);
  568 + });
  569 + } else {
  570 + //直接删除
  571 + setState(() {
  572 + temp.removeWhere((element) =>
  573 + element == temp[index]);
  574 + });
  575 + }
  576 + } else {
  577 + //点击删除按钮
  578 + setState(() {
  579 + temp.removeWhere((element) =>
  580 + element == temp[index]);
  581 + widget.model.imageQiniuUrlList
  582 + .removeWhere((element) =>
  583 + element ==
  584 + widget.model
  585 + .imageQiniuUrlList[index]);
  586 + });
  587 + }
  588 + },
  589 + )),
  590 + ),
  591 + ],
  592 + ),
  593 + Offstage(
  594 + offstage: temp[index].process == 1,
  595 + child: Progress(temp[index].process),
  596 + )
  597 + ],
  598 + ));
  599 + });
  600 + }
  601 +}
  1 +import 'package:cached_network_image/cached_network_image.dart';
1 import 'package:flutter/material.dart'; 2 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/screenutil.dart'; 3 import 'package:flutter_screenutil/screenutil.dart';
  4 +import 'package:one_key/pages/online_check/img_picker_widget_f.dart';
3 import 'package:one_key/pages/online_check/photo_view_wiget.dart'; 5 import 'package:one_key/pages/online_check/photo_view_wiget.dart';
4 import 'package:one_key/provider/message_dialog_model.dart'; 6 import 'package:one_key/provider/message_dialog_model.dart';
5 import 'package:one_key/provider/online_check_edit_provider.dart'; 7 import 'package:one_key/provider/online_check_edit_provider.dart';
@@ -91,22 +93,23 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { @@ -91,22 +93,23 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> {
91 93
92 ///顾客信息 94 ///顾客信息
93 Widget _customInfoItemWidget(String title, String subTitle, 95 Widget _customInfoItemWidget(String title, String subTitle,
94 - {Color textColor = MyColours.color_707070, bool isBold = false}) { 96 + {double fontsize = 28}) {
95 return Row( 97 return Row(
96 mainAxisAlignment: MainAxisAlignment.spaceBetween, 98 mainAxisAlignment: MainAxisAlignment.spaceBetween,
97 children: [ 99 children: [
98 Text( 100 Text(
99 title, 101 title,
100 style: TextStyle( 102 style: TextStyle(
101 - fontWeight: isBold ? FontWeight.bold : FontWeight.normal,  
102 - fontSize: ScreenUtil().setSp(28),  
103 - color: textColor), 103 + fontSize: ScreenUtil().setSp(24), color: MyColours.color_515151),
104 ), 104 ),
105 Text( 105 Text(
106 subTitle, 106 subTitle,
107 style: TextStyle( 107 style: TextStyle(
108 - fontSize: ScreenUtil().setSp(28),  
109 - color: textColor, 108 + decoration: fontsize == 20
  109 + ? TextDecoration.underline
  110 + : TextDecoration.none,
  111 + fontSize: ScreenUtil().setSp(fontsize),
  112 + color: MyColours.color_515151,
110 fontWeight: FontWeight.bold), 113 fontWeight: FontWeight.bold),
111 ) 114 )
112 ], 115 ],
@@ -263,6 +266,164 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { @@ -263,6 +266,164 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> {
263 ); 266 );
264 } 267 }
265 268
  269 + ///桌位信息
  270 + Widget _getTabInfoWidget() {
  271 + bool showArrow = false;
  272 + //1散座 2包间 3卡座
  273 + List<String> tableNameSunList1 = []; //单个类型包含的所有桌子名称
  274 + List<String> tableNameSunList2 = []; //单个类型包含的所有桌子名称
  275 + List<String> tableNameSunList3 = []; //单个类型包含的所有桌子名称
  276 + if (_orderFoodProvider.reserveDetailSunModel != null) {
  277 + tableNameSunList1 =
  278 + _orderFoodProvider.reserveDetailSunModel.tableNameList[0]['散座'];
  279 + tableNameSunList2 =
  280 + _orderFoodProvider.reserveDetailSunModel.tableNameList[1]['包间'];
  281 + tableNameSunList3 =
  282 + _orderFoodProvider.reserveDetailSunModel.tableNameList[2]['卡座'];
  283 + if (tableNameSunList2.length > 0) {
  284 + if (arrowStatus) {
  285 + _orderFoodProvider.showTable = '【包间】${tableNameSunList2[0]}';
  286 + } else {
  287 + _orderFoodProvider.showTable = '';
  288 + }
  289 + } else if (tableNameSunList3.length > 0) {
  290 + if (arrowStatus) {
  291 + _orderFoodProvider.showTable = '【卡座】${tableNameSunList3[0]}';
  292 + } else {
  293 + _orderFoodProvider.showTable = '';
  294 + }
  295 + } else if (tableNameSunList1.length > 0) {
  296 + if (arrowStatus) {
  297 + _orderFoodProvider.showTable = '【散座】${tableNameSunList1[0]}';
  298 + } else {
  299 + _orderFoodProvider.showTable = '';
  300 + }
  301 + }
  302 + if (tableNameSunList1.length > 1 ||
  303 + tableNameSunList2.length > 1 ||
  304 + tableNameSunList3.length > 1) {
  305 + showArrow = true;
  306 + } else {
  307 + showArrow = false;
  308 + }
  309 + }
  310 +
  311 + return Container(
  312 + // decoration: BoxDecoration(
  313 + // color: Colors.white,
  314 + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
  315 + child: Column(
  316 + children: [
  317 + InkWell(
  318 + onTap: () {
  319 + if (showArrow) {
  320 + //有arrow
  321 + arrowStatus = !arrowStatus;
  322 + _orderFoodProvider.notifyListeners();
  323 + }
  324 + },
  325 + child: Container(
  326 + // padding: EdgeInsets.symmetric(
  327 + // horizontal: ScreenUtil().setWidth(40),
  328 + // vertical: ScreenUtil().setWidth(36)),
  329 + child: Row(
  330 + children: [
  331 + Text(
  332 + '桌位信息',
  333 + style: TextStyle(
  334 + fontSize: ScreenUtil().setSp(24),
  335 + color: MyColours.color_515151),
  336 + ),
  337 + Spacer(),
  338 + Text(
  339 + _orderFoodProvider.reserveDetailSunModel != null
  340 + ? _orderFoodProvider.showTable
  341 + : '',
  342 + style: TextStyle(
  343 + fontSize: ScreenUtil().setSp(32),
  344 + fontWeight: FontWeight.bold,
  345 + color: MyColours.color_515151),
  346 + ),
  347 + Offstage(
  348 + offstage: !showArrow,
  349 + child: Row(
  350 + children: [
  351 + HEmptyView(20),
  352 + Image.asset(
  353 + arrowStatus
  354 + ? Utils.getImgPath('down')
  355 + : Utils.getImgPath('up'),
  356 + width: ScreenUtil().setWidth(24),
  357 + height: ScreenUtil().setWidth(12))
  358 + ],
  359 + ),
  360 + )
  361 + ],
  362 + ),
  363 + ),
  364 + ),
  365 + Offstage(
  366 + offstage: arrowStatus,
  367 + child: Column(
  368 + crossAxisAlignment: CrossAxisAlignment.start,
  369 + children: [
  370 + tableNameSunList2.length > 0
  371 + ? Padding(
  372 + padding: EdgeInsets.fromLTRB(
  373 + ScreenUtil().setWidth(60),
  374 + ScreenUtil().setWidth(0),
  375 + ScreenUtil().setWidth(60),
  376 + ScreenUtil().setWidth(10)),
  377 + child: Text(
  378 + '【包间】${Utils.listToString(tableNameSunList2)}',
  379 + style: TextStyle(
  380 + fontSize: ScreenUtil().setSp(32),
  381 + fontWeight: FontWeight.bold,
  382 + color: MyColours.color_515151),
  383 + ),
  384 + )
  385 + : Container(),
  386 + tableNameSunList3.length > 0
  387 + ? Padding(
  388 + padding: EdgeInsets.fromLTRB(
  389 + ScreenUtil().setWidth(60),
  390 + ScreenUtil().setWidth(0),
  391 + ScreenUtil().setWidth(60),
  392 + ScreenUtil().setWidth(10)),
  393 + child: Text(
  394 + '【卡座】${Utils.listToString(tableNameSunList3)}',
  395 + style: TextStyle(
  396 + fontSize: ScreenUtil().setSp(32),
  397 + fontWeight: FontWeight.bold,
  398 + color: MyColours.color_515151),
  399 + ),
  400 + )
  401 + : Container(),
  402 + tableNameSunList1.length > 0
  403 + ? Padding(
  404 + padding: EdgeInsets.fromLTRB(
  405 + ScreenUtil().setWidth(60),
  406 + ScreenUtil().setWidth(0),
  407 + ScreenUtil().setWidth(60),
  408 + ScreenUtil().setWidth(10)),
  409 + child: Text(
  410 + '【散座】${Utils.listToString(tableNameSunList1)}',
  411 + style: TextStyle(
  412 + fontSize: ScreenUtil().setSp(32),
  413 + fontWeight: FontWeight.bold,
  414 + color: MyColours.color_515151),
  415 + ),
  416 + )
  417 + : Container(),
  418 + VEmptyView(36),
  419 + ],
  420 + ),
  421 + ),
  422 + ],
  423 + ),
  424 + );
  425 + }
  426 +
266 ///顾客信息 427 ///顾客信息
267 Widget _customerInfoWidget() { 428 Widget _customerInfoWidget() {
268 bool showArrow = false; 429 bool showArrow = false;
@@ -497,68 +658,296 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { @@ -497,68 +658,296 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> {
497 ); 658 );
498 } 659 }
499 660
500 - ///买单信息  
501 - Widget _orderInfoWidget() { 661 + // ///买单信息
  662 + // Widget _orderInfoWidget() {
  663 + // return Container(
  664 + // width: double.infinity,
  665 + // decoration: BoxDecoration(
  666 + // color: Colors.white, borderRadius: BorderRadius.circular(10)),
  667 + // child: Column(
  668 + // crossAxisAlignment: CrossAxisAlignment.start,
  669 + // children: <Widget>[
  670 + // Container(
  671 + // height: ScreenUtil().setWidth(58 * 2),
  672 + // width: double.infinity,
  673 + // padding: EdgeInsets.fromLTRB(
  674 + // ScreenUtil().setWidth(20),
  675 + // ScreenUtil().setWidth(36),
  676 + // ScreenUtil().setWidth(20),
  677 + // ScreenUtil().setWidth(26)),
  678 + // decoration: BoxDecoration(
  679 + // color: MyColours.color_FAFAFA,
  680 + // borderRadius: BorderRadius.only(
  681 + // topLeft: Radius.circular(10),
  682 + // topRight: Radius.circular(10)),
  683 + // ),
  684 + // child: Text(
  685 + // '买单信息',
  686 + // style: TextStyle(
  687 + // fontSize: ScreenUtil().setSp(32),
  688 + // color: MyColours.color_353535,
  689 + // fontWeight: FontWeight.bold),
  690 + // )),
  691 + // Padding(
  692 + // padding: EdgeInsets.fromLTRB(
  693 + // ScreenUtil().setWidth(40),
  694 + // ScreenUtil().setWidth(24),
  695 + // ScreenUtil().setWidth(40),
  696 + // ScreenUtil().setWidth(36)),
  697 + // child: Column(children: [
  698 + // _customInfoItemWidget(
  699 + // '应收金额',
  700 + // _onlineCheckEditProvider.orderInfoSunModel != null
  701 + // ? '¥ ${_onlineCheckEditProvider.orderInfoSunModel.shouldPrice}'
  702 + // : ''),
  703 + // VEmptyView(24),
  704 + // _customInfoItemWidget(
  705 + // '实收金额',
  706 + // _onlineCheckEditProvider.orderInfoSunModel != null
  707 + // ? '¥ ${_onlineCheckEditProvider.orderInfoSunModel.price}'
  708 + // : '',
  709 + // textColor: MyColours.color_353535,
  710 + // isBold: true),
  711 + // VEmptyView(24),
  712 + // _customInfoItemWidget('支付方式', '微信支付'),
  713 + // VEmptyView(24),
  714 + // _customInfoItemWidget(
  715 + // '买单时间',
  716 + // _onlineCheckEditProvider.orderInfoSunModel != null
  717 + // ? _onlineCheckEditProvider
  718 + // .orderInfoSunModel?.payTimeStr
  719 + // : ''),
  720 + // VEmptyView(24),
  721 + // ]))
  722 + // ]));
  723 + // }
  724 +
  725 + Widget _customInfoWidget() {
  726 + return Container(
  727 + width: double.infinity,
  728 + decoration: BoxDecoration(
  729 + color: Colors.white, borderRadius: BorderRadius.circular(10)),
  730 + child: Column(
  731 + crossAxisAlignment: CrossAxisAlignment.start,
  732 + children: <Widget>[
  733 + Container(
  734 + color: Colors.white,
  735 + padding: EdgeInsets.fromLTRB(
  736 + ScreenUtil().setWidth(64),
  737 + ScreenUtil().setWidth(26),
  738 + ScreenUtil().setWidth(64),
  739 + ScreenUtil().setWidth(26)),
  740 + child: Column(
  741 + children: [
  742 + _customInfoItemWidget(
  743 + '顾客',
  744 + _orderFoodProvider.reserveDetailSunModel != null
  745 + ? _orderFoodProvider.reserveDetailSunModel.rnameStr
  746 + : ''),
  747 + VEmptyView(24),
  748 + // _customInfoItemWidget(
  749 + // '顾客电话',
  750 + // _orderFoodProvider.reserveDetailSunModel != null
  751 + // ? _orderFoodProvider.reserveDetailSunModel.phone
  752 + // : ''),
  753 + _getTabInfoWidget(),
  754 + VEmptyView(24),
  755 + _customInfoItemWidget(
  756 + '到店时间',
  757 + _orderFoodProvider.reserveDetailSunModel != null
  758 + ? _orderFoodProvider.reserveDetailSunModel.ddateStr
  759 + : ''),
  760 + VEmptyView(24),
  761 + _customInfoItemWidget(
  762 + '申请时间',
  763 + _orderFoodProvider.reserveDetailSunModel != null
  764 + ? _orderFoodProvider.reserveDetailSunModel.cdateStr
  765 + : '')
  766 + ],
  767 + ),
  768 + )
  769 + // _getGridImg(1, context)
  770 + ],
  771 + ),
  772 + );
  773 + }
  774 +
  775 + ///发票信息
  776 + Widget _invoiceInfoWidget() {
502 return Container( 777 return Container(
503 width: double.infinity, 778 width: double.infinity,
504 decoration: BoxDecoration( 779 decoration: BoxDecoration(
505 color: Colors.white, borderRadius: BorderRadius.circular(10)), 780 color: Colors.white, borderRadius: BorderRadius.circular(10)),
506 - child: Column(  
507 - crossAxisAlignment: CrossAxisAlignment.start,  
508 - children: <Widget>[  
509 - Container(  
510 - height: ScreenUtil().setWidth(58 * 2),  
511 - width: double.infinity,  
512 - padding: EdgeInsets.fromLTRB(  
513 - ScreenUtil().setWidth(20),  
514 - ScreenUtil().setWidth(36),  
515 - ScreenUtil().setWidth(20),  
516 - ScreenUtil().setWidth(26)),  
517 - decoration: BoxDecoration(  
518 - color: MyColours.color_FAFAFA,  
519 - borderRadius: BorderRadius.only(  
520 - topLeft: Radius.circular(10),  
521 - topRight: Radius.circular(10)), 781 + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: <
  782 + Widget>[
  783 + // Container(
  784 + // height: ScreenUtil().setWidth(53 * 2),
  785 + // width: double.infinity,
  786 + // decoration: BoxDecoration(
  787 + // color: MyColours.color_FAFAFA,
  788 + // borderRadius: BorderRadius.only(
  789 + // topLeft: Radius.circular(10),
  790 + // topRight: Radius.circular(10)),
  791 + // ),
  792 + // child: Padding(
  793 + // padding: EdgeInsets.fromLTRB(
  794 + // ScreenUtil().setWidth(20),
  795 + // ScreenUtil().setWidth(36),
  796 + // ScreenUtil().setWidth(20),
  797 + // ScreenUtil().setWidth(26)),
  798 + // child: Text(
  799 + // '发票信息',
  800 + // style: TextStyle(
  801 + // fontSize: ScreenUtil().setSp(32),
  802 + // color: MyColours.color_353535,
  803 + // fontWeight: FontWeight.bold),
  804 + // ),
  805 + // )),
  806 + Container(
  807 + color: Colors.white,
  808 + padding: EdgeInsets.fromLTRB(
  809 + ScreenUtil().setWidth(40),
  810 + ScreenUtil().setWidth(24),
  811 + ScreenUtil().setWidth(40),
  812 + ScreenUtil().setWidth(36)),
  813 + child: Column(children: [
  814 + _customInfoItemWidget(
  815 + '发票抬头',
  816 + _onlineCheckEditProvider.orderInfoSunModel != null
  817 + ? _onlineCheckEditProvider
  818 + .orderInfoSunModel.invoice.title
  819 + : '',
  820 + fontsize: 20),
  821 + Offstage(
  822 + offstage: _onlineCheckEditProvider.orderInfoSunModel != null
  823 + ? _onlineCheckEditProvider
  824 + .orderInfoSunModel.invoice.taxnumber ==
  825 + ''
  826 + : true,
  827 + child: Padding(
  828 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  829 + child: _customInfoItemWidget(
  830 + '税号',
  831 + _onlineCheckEditProvider.orderInfoSunModel != null
  832 + ? _onlineCheckEditProvider
  833 + .orderInfoSunModel.invoice.taxnumber
  834 + : '',
  835 + fontsize: 20),
522 ), 836 ),
523 - child: Text(  
524 - '买单信息',  
525 - style: TextStyle(  
526 - fontSize: ScreenUtil().setSp(32),  
527 - color: MyColours.color_353535,  
528 - fontWeight: FontWeight.bold),  
529 - )),  
530 - Padding(  
531 - padding: EdgeInsets.fromLTRB(  
532 - ScreenUtil().setWidth(40),  
533 - ScreenUtil().setWidth(24),  
534 - ScreenUtil().setWidth(40),  
535 - ScreenUtil().setWidth(36)),  
536 - child: Column(children: [  
537 - _customInfoItemWidget(  
538 - '应收金额', 837 + ),
  838 + Offstage(
  839 + offstage: _onlineCheckEditProvider.orderInfoSunModel != null
  840 + ? _onlineCheckEditProvider
  841 + .orderInfoSunModel.invoice.companyaddress ==
  842 + ''
  843 + : true,
  844 + child: Padding(
  845 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  846 + child: _customInfoItemWidget(
  847 + '地址',
539 _onlineCheckEditProvider.orderInfoSunModel != null 848 _onlineCheckEditProvider.orderInfoSunModel != null
540 - ? '¥ ${_onlineCheckEditProvider.orderInfoSunModel.shouldPrice}'  
541 - : ''),  
542 - VEmptyView(24),  
543 - _customInfoItemWidget(  
544 - '实收金额', 849 + ? _onlineCheckEditProvider
  850 + .orderInfoSunModel.invoice.companyaddress
  851 + : '',
  852 + fontsize: 20),
  853 + ),
  854 + ),
  855 + Offstage(
  856 + offstage: _onlineCheckEditProvider.orderInfoSunModel != null
  857 + ? _onlineCheckEditProvider
  858 + .orderInfoSunModel.invoice.telephone ==
  859 + ''
  860 + : true,
  861 + child: Padding(
  862 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  863 + child: _customInfoItemWidget(
  864 + '电话',
545 _onlineCheckEditProvider.orderInfoSunModel != null 865 _onlineCheckEditProvider.orderInfoSunModel != null
546 - ? '¥ ${_onlineCheckEditProvider.orderInfoSunModel.price}' 866 + ? _onlineCheckEditProvider
  867 + .orderInfoSunModel.invoice.telephone
547 : '', 868 : '',
548 - textColor: MyColours.color_353535,  
549 - isBold: true),  
550 - VEmptyView(24),  
551 - _customInfoItemWidget('支付方式', '微信支付'),  
552 - VEmptyView(24),  
553 - _customInfoItemWidget(  
554 - '买单时间', 869 + fontsize: 20),
  870 + ),
  871 + ),
  872 + Offstage(
  873 + offstage: _onlineCheckEditProvider.orderInfoSunModel != null
  874 + ? _onlineCheckEditProvider
  875 + .orderInfoSunModel.invoice.bankname ==
  876 + ''
  877 + : true,
  878 + child: Padding(
  879 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  880 + child: _customInfoItemWidget(
  881 + '开户行',
555 _onlineCheckEditProvider.orderInfoSunModel != null 882 _onlineCheckEditProvider.orderInfoSunModel != null
556 ? _onlineCheckEditProvider 883 ? _onlineCheckEditProvider
557 - .orderInfoSunModel?.payTimeStr  
558 - : ''),  
559 - VEmptyView(24),  
560 - ]))  
561 - ])); 884 + .orderInfoSunModel.invoice.bankname
  885 + : '',
  886 + fontsize: 20),
  887 + ),
  888 + ),
  889 + Offstage(
  890 + offstage: _onlineCheckEditProvider.orderInfoSunModel != null
  891 + ? _onlineCheckEditProvider
  892 + .orderInfoSunModel.invoice.bankaccount ==
  893 + ''
  894 + : true,
  895 + child: Padding(
  896 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  897 + child: _customInfoItemWidget(
  898 + '账号',
  899 + _onlineCheckEditProvider.orderInfoSunModel != null
  900 + ? _onlineCheckEditProvider
  901 + .orderInfoSunModel.invoice.bankaccount
  902 + : '',
  903 + fontsize: 20),
  904 + ),
  905 + )
  906 + ]))
  907 + ]));
  908 + }
  909 +
  910 + ///应收金额
  911 + Widget _getMoneyInfoWidget() {
  912 + return Container(
  913 + color: Colors.white,
  914 + padding: EdgeInsets.symmetric(
  915 + horizontal: ScreenUtil().setWidth(64),
  916 + vertical: ScreenUtil().setWidth(14)),
  917 + child: Row(
  918 + children: [
  919 + Text(
  920 + '消费金额',
  921 + style: TextStyle(
  922 + fontSize: ScreenUtil().setSp(24),
  923 + color: MyColours.color_515151),
  924 + ),
  925 + Spacer(),
  926 + // HEmptyView(40),
  927 + Container(
  928 + width: ScreenUtil().setWidth(110),
  929 + height: ScreenUtil().setWidth(40),
  930 + decoration: BoxDecoration(
  931 + border: Border(
  932 + bottom: BorderSide(
  933 + width: ScreenUtil().setWidth(2),
  934 + color: MyColours.color_515151))),
  935 + alignment: Alignment.center,
  936 + child: Text(
  937 + _onlineCheckEditProvider.orderInfoSunModel != null
  938 + ? '¥ ${_onlineCheckEditProvider.orderInfoSunModel.price}'
  939 + : '',
  940 + maxLines: 1,
  941 + // textAlign: TextAlign.center,
  942 + //输入文本的样式
  943 + style: TextStyle(
  944 + // decoration: TextDecoration.underline,
  945 + fontSize: ScreenUtil().setSp(28),
  946 + color: MyColours.color_515151),
  947 + ))
  948 + ],
  949 + ),
  950 + );
562 } 951 }
563 952
564 @override 953 @override
@@ -571,7 +960,7 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { @@ -571,7 +960,7 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> {
571 return Scaffold( 960 return Scaffold(
572 backgroundColor: MyColours.color_f5f5f5, 961 backgroundColor: MyColours.color_f5f5f5,
573 appBar: SystemAppBar( 962 appBar: SystemAppBar(
574 - '买单申请详情', 963 + '在线买单',
575 onTap: () { 964 onTap: () {
576 if (widget.fromNotify) { 965 if (widget.fromNotify) {
577 NavigatorUtil.goHomePage(context, initialIndex: 0); 966 NavigatorUtil.goHomePage(context, initialIndex: 0);
@@ -582,26 +971,184 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { @@ -582,26 +971,184 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> {
582 ), 971 ),
583 body: WillPopScope( 972 body: WillPopScope(
584 child: SingleChildScrollView( 973 child: SingleChildScrollView(
585 - child: Padding(  
586 - padding: EdgeInsets.all(ScreenUtil().setWidth(20)),  
587 - child: Column(  
588 - children: [  
589 - _consumptionInfoWidget(),  
590 - VEmptyView(20),  
591 - _customerInfoWidget(),  
592 - VEmptyView(20),  
593 - Offstage(  
594 - offstage: _onlineCheckEditProvider.orderInfoSunModel !=  
595 - null  
596 - ? _onlineCheckEditProvider.orderInfoSunModel.status ==  
597 - '2'  
598 - : true,  
599 - child: _orderInfoWidget(),  
600 - )  
601 - ],  
602 - ),  
603 - ),  
604 - ), 974 + child: Padding(
  975 + padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
  976 + child: Column(children: [
  977 + // _consumptionInfoWidget(),
  978 + // VEmptyView(20),
  979 + // _customerInfoWidget(),
  980 + VEmptyView(30),
  981 + _customInfoWidget(),
  982 +
  983 + VEmptyView(72),
  984 + Stack(
  985 + alignment: Alignment.center,
  986 + children: [
  987 + _getMoneyInfoWidget(),
  988 + //2待支付 wait_pay 3已买单 has_pay
  989 + _onlineCheckEditProvider.orderInfoSunModel != null
  990 + ? Align(
  991 + child: Image.asset(
  992 + Utils.getImgPath(_onlineCheckEditProvider
  993 + .orderInfoSunModel.status ==
  994 + '2'
  995 + ? 'wait_pay'
  996 + : 'has_pay'),
  997 + width: ScreenUtil().setWidth(56 * 2),
  998 + height: ScreenUtil().setWidth(28 * 2),
  999 + ),
  1000 + )
  1001 + : Container(),
  1002 + ],
  1003 + ),
  1004 + // 备注信息
  1005 + Offstage(
  1006 + offstage:
  1007 + _onlineCheckEditProvider.orderInfoSunModel != null
  1008 + ? _onlineCheckEditProvider
  1009 + .orderInfoSunModel.orderRemark ==
  1010 + ''
  1011 + : true,
  1012 + child: Container(
  1013 + padding: EdgeInsets.only(
  1014 + top: ScreenUtil().setWidth(20),
  1015 + right: ScreenUtil().setWidth(20),
  1016 + left: ScreenUtil().setWidth(20)),
  1017 + child: Text(
  1018 + _onlineCheckEditProvider.orderInfoSunModel != null
  1019 + ? _onlineCheckEditProvider
  1020 + .orderInfoSunModel.orderRemark
  1021 + : '',
  1022 + style: TextStyle(
  1023 + fontSize: ScreenUtil().setSp(24),
  1024 + color: MyColours.color_FD5656),
  1025 + ),
  1026 + ),
  1027 + ),
  1028 + VEmptyView(20),
  1029 + Container(
  1030 + width: double.infinity,
  1031 + decoration: BoxDecoration(
  1032 + color: Colors.white,
  1033 + // borderRadius:
  1034 + // BorderRadius.circular(10)
  1035 + ),
  1036 + child: Column(
  1037 + crossAxisAlignment: CrossAxisAlignment.start,
  1038 + children: <Widget>[
  1039 + _onlineCheckEditProvider
  1040 + .orderInfoSunModel.billList.length >
  1041 + 0
  1042 + ? Container(
  1043 + height: ScreenUtil().setWidth(53 * 2),
  1044 + width: double.infinity,
  1045 + decoration: BoxDecoration(
  1046 + color: MyColours.color_ffffff,
  1047 + // borderRadius:
  1048 + // BorderRadius.only(
  1049 + // topLeft:
  1050 + // Radius.circular(
  1051 + // 10),
  1052 + // topRight:
  1053 + // Radius.circular(
  1054 + // 10)),
  1055 + ),
  1056 + child: Padding(
  1057 + padding: EdgeInsets.fromLTRB(
  1058 + ScreenUtil().setWidth(32),
  1059 + ScreenUtil().setWidth(24),
  1060 + ScreenUtil().setWidth(20),
  1061 + ScreenUtil().setWidth(24)),
  1062 + child: Text(
  1063 + '上传图片',
  1064 + style: TextStyle(
  1065 + fontSize: ScreenUtil().setSp(32),
  1066 + color: MyColours.color_000000,
  1067 + fontWeight: FontWeight.bold),
  1068 + ),
  1069 + ))
  1070 + : SizedBox(),
  1071 + _onlineCheckEditProvider.orderInfoSunModel != null
  1072 + ? Padding(
  1073 + padding: EdgeInsets.fromLTRB(
  1074 + ScreenUtil().setWidth(32),
  1075 + ScreenUtil().setWidth(0),
  1076 + ScreenUtil().setWidth(20),
  1077 + ScreenUtil().setWidth(24)),
  1078 + child: Consumer<UploadImageProvider>(
  1079 + builder: (context, model, _) {
  1080 + List<String> temp = [];
  1081 + for (int i = 0;
  1082 + i <
  1083 + _onlineCheckEditProvider
  1084 + .orderInfoSunModel
  1085 + .billList
  1086 + .length;
  1087 + i++) {
  1088 + temp.add(_onlineCheckEditProvider
  1089 + .orderInfoSunModel.billList[i]);
  1090 + }
  1091 +
  1092 + return temp.length > 0
  1093 + ? GridView.builder(
  1094 + // controller: widget.scrollController,
  1095 + // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
  1096 + shrinkWrap: true,
  1097 + itemCount: temp.length,
  1098 +
  1099 + //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
  1100 + gridDelegate:
  1101 + SliverGridDelegateWithFixedCrossAxisCount(
  1102 + //横轴元素个数
  1103 + crossAxisCount: 3,
  1104 + //纵轴间距
  1105 + mainAxisSpacing:
  1106 + ScreenUtil()
  1107 + .setWidth(40),
  1108 + //横轴间距
  1109 + crossAxisSpacing:
  1110 + ScreenUtil()
  1111 + .setWidth(36),
  1112 + //子组件宽高长度比例
  1113 + childAspectRatio: 1.0),
  1114 + itemBuilder:
  1115 + (BuildContext context,
  1116 + int index) {
  1117 + return InkWell(
  1118 + onTap: () {
  1119 + _showPhotoView(
  1120 + context,
  1121 + 0,
  1122 + temp,
  1123 + );
  1124 + },
  1125 + child: CachedNetworkImage(
  1126 + imageUrl: temp[index],
  1127 + fit: BoxFit.cover,
  1128 + width: ScreenUtil()
  1129 + .setWidth(80 * 2),
  1130 + height: ScreenUtil()
  1131 + .setWidth(80 * 2),
  1132 + ));
  1133 + })
  1134 + : SizedBox();
  1135 + }))
  1136 + : SizedBox(),
  1137 + VEmptyView(36),
  1138 + _invoiceInfoWidget(),
  1139 + VEmptyView(36),
  1140 + // Offstage(
  1141 + // offstage: _onlineCheckEditProvider.orderInfoSunModel !=
  1142 + // null
  1143 + // ? _onlineCheckEditProvider.orderInfoSunModel.status ==
  1144 + // '2'
  1145 + // : true,
  1146 + // child: _orderInfoWidget(),
  1147 + // )
  1148 + ],
  1149 + ),
  1150 + )
  1151 + ]))),
605 onWillPop: () async { 1152 onWillPop: () async {
606 if (widget.fromNotify) { 1153 if (widget.fromNotify) {
607 NavigatorUtil.goHomePage(context, initialIndex: 0); 1154 NavigatorUtil.goHomePage(context, initialIndex: 0);
@@ -3,6 +3,7 @@ import 'dart:convert'; @@ -3,6 +3,7 @@ import 'dart:convert';
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
4 import 'package:flutter_screenutil/screenutil.dart'; 4 import 'package:flutter_screenutil/screenutil.dart';
5 import 'package:one_key/pages/online_check/img_picker_widget.dart'; 5 import 'package:one_key/pages/online_check/img_picker_widget.dart';
  6 +import 'package:one_key/pages/online_check/img_picker_widget_f.dart';
6 import 'package:one_key/provider/message_dialog_model.dart'; 7 import 'package:one_key/provider/message_dialog_model.dart';
7 import 'package:one_key/provider/notebook_detail_model.dart'; 8 import 'package:one_key/provider/notebook_detail_model.dart';
8 import 'package:one_key/provider/online_check_edit_provider.dart'; 9 import 'package:one_key/provider/online_check_edit_provider.dart';
@@ -177,8 +178,8 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -177,8 +178,8 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
177 ); 178 );
178 } 179 }
179 180
180 - ///桌位信息、应收金额  
181 - Widget _getTabAndMoneyInfoWidget() { 181 + ///桌位信息
  182 + Widget _getTabInfoWidget() {
182 bool showArrow = false; 183 bool showArrow = false;
183 //1散座 2包间 3卡座 184 //1散座 2包间 3卡座
184 List<String> tableNameSunList1 = []; //单个类型包含的所有桌子名称 185 List<String> tableNameSunList1 = []; //单个类型包含的所有桌子名称
@@ -220,9 +221,9 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -220,9 +221,9 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
220 } 221 }
221 222
222 return Container( 223 return Container(
223 - decoration: BoxDecoration(  
224 - color: Colors.white,  
225 - borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))), 224 + // decoration: BoxDecoration(
  225 + // color: Colors.white,
  226 + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
226 child: Column( 227 child: Column(
227 children: [ 228 children: [
228 InkWell( 229 InkWell(
@@ -234,16 +235,16 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -234,16 +235,16 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
234 } 235 }
235 }, 236 },
236 child: Container( 237 child: Container(
237 - padding: EdgeInsets.symmetric(  
238 - horizontal: ScreenUtil().setWidth(40),  
239 - vertical: ScreenUtil().setWidth(36)), 238 + // padding: EdgeInsets.symmetric(
  239 + // horizontal: ScreenUtil().setWidth(40),
  240 + // vertical: ScreenUtil().setWidth(36)),
240 child: Row( 241 child: Row(
241 children: [ 242 children: [
242 Text( 243 Text(
243 '桌位信息', 244 '桌位信息',
244 style: TextStyle( 245 style: TextStyle(
245 - fontSize: ScreenUtil().setSp(32),  
246 - color: MyColours.color_707070), 246 + fontSize: ScreenUtil().setSp(24),
  247 + color: MyColours.color_515151),
247 ), 248 ),
248 Spacer(), 249 Spacer(),
249 Text( 250 Text(
@@ -252,7 +253,8 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -252,7 +253,8 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
252 : '', 253 : '',
253 style: TextStyle( 254 style: TextStyle(
254 fontSize: ScreenUtil().setSp(32), 255 fontSize: ScreenUtil().setSp(32),
255 - color: MyColours.color_353535), 256 + fontWeight: FontWeight.bold,
  257 + color: MyColours.color_515151),
256 ), 258 ),
257 Offstage( 259 Offstage(
258 offstage: !showArrow, 260 offstage: !showArrow,
@@ -287,8 +289,9 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -287,8 +289,9 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
287 child: Text( 289 child: Text(
288 '【包间】${Utils.listToString(tableNameSunList2)}', 290 '【包间】${Utils.listToString(tableNameSunList2)}',
289 style: TextStyle( 291 style: TextStyle(
290 - fontSize: ScreenUtil().setSp(30),  
291 - color: MyColours.color_353535), 292 + fontSize: ScreenUtil().setSp(32),
  293 + fontWeight: FontWeight.bold,
  294 + color: MyColours.color_515151),
292 ), 295 ),
293 ) 296 )
294 : Container(), 297 : Container(),
@@ -302,8 +305,9 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -302,8 +305,9 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
302 child: Text( 305 child: Text(
303 '【卡座】${Utils.listToString(tableNameSunList3)}', 306 '【卡座】${Utils.listToString(tableNameSunList3)}',
304 style: TextStyle( 307 style: TextStyle(
305 - fontSize: ScreenUtil().setSp(30),  
306 - color: MyColours.color_353535), 308 + fontSize: ScreenUtil().setSp(32),
  309 + fontWeight: FontWeight.bold,
  310 + color: MyColours.color_515151),
307 ), 311 ),
308 ) 312 )
309 : Container(), 313 : Container(),
@@ -317,8 +321,9 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -317,8 +321,9 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
317 child: Text( 321 child: Text(
318 '【散座】${Utils.listToString(tableNameSunList1)}', 322 '【散座】${Utils.listToString(tableNameSunList1)}',
319 style: TextStyle( 323 style: TextStyle(
320 - fontSize: ScreenUtil().setSp(30),  
321 - color: MyColours.color_353535), 324 + fontSize: ScreenUtil().setSp(32),
  325 + fontWeight: FontWeight.bold,
  326 + color: MyColours.color_515151),
322 ), 327 ),
323 ) 328 )
324 : Container(), 329 : Container(),
@@ -326,77 +331,78 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -326,77 +331,78 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
326 ], 331 ],
327 ), 332 ),
328 ), 333 ),
329 - Padding(  
330 - padding:  
331 - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)),  
332 - child: MyDivider(  
333 - double.infinity,  
334 - ScreenUtil().setWidth(2),  
335 - color: MyColours.color_EEEEEE,  
336 - ), 334 + ],
  335 + ),
  336 + );
  337 + }
  338 +
  339 + ///应收金额
  340 + Widget _getMoneyInfoWidget() {
  341 + return Container(
  342 + color: Colors.white,
  343 + padding: EdgeInsets.symmetric(
  344 + horizontal: ScreenUtil().setWidth(64),
  345 + vertical: ScreenUtil().setWidth(14)),
  346 + child: Row(
  347 + children: [
  348 + Text(
  349 + '消费金额',
  350 + style: TextStyle(
  351 + fontSize: ScreenUtil().setSp(24),
  352 + color: MyColours.color_515151),
337 ), 353 ),
  354 + Spacer(),
  355 + // HEmptyView(40),
338 Container( 356 Container(
339 - padding: EdgeInsets.symmetric(  
340 - horizontal: ScreenUtil().setWidth(40),  
341 - vertical: ScreenUtil().setWidth(36)),  
342 - child: Row(  
343 - children: [  
344 - Text(  
345 - '应收金额', 357 + width: ScreenUtil().setWidth(110),
  358 + height: ScreenUtil().setWidth(40),
  359 + decoration: BoxDecoration(
  360 + border: Border(
  361 + bottom: BorderSide(
  362 + width: ScreenUtil().setWidth(2),
  363 + color: MyColours.color_515151))),
  364 + alignment: Alignment.center,
  365 + child: TextField(
  366 + maxLines: 1,
  367 + // textAlign: TextAlign.center,
  368 + //输入文本的样式
346 style: TextStyle( 369 style: TextStyle(
347 - fontSize: ScreenUtil().setSp(32),  
348 - color: MyColours.color_707070),  
349 - ),  
350 - // Spacer(),  
351 - HEmptyView(40),  
352 - Expanded(  
353 - flex: 1,  
354 - child: TextField(  
355 - maxLines: 1,  
356 - textAlign: TextAlign.end,  
357 - //输入文本的样式  
358 - style: TextStyle(  
359 - fontSize: ScreenUtil().setSp(34),  
360 - color: MyColours.color_353535),  
361 - controller: _editingController,  
362 - focusNode: _focusNode,  
363 - keyboardType:  
364 - TextInputType.numberWithOptions(decimal: true),  
365 - // textAlignVertical: TextAlignVertical.top,  
366 - decoration: InputDecoration(  
367 - hintText: "点击填写金额",  
368 - hintStyle: TextStyle(  
369 - color: MyColours.color_9C9C9C,  
370 - fontSize: ScreenUtil().setSp(32),  
371 - ),  
372 - // contentPadding:  
373 - // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),  
374 - contentPadding: EdgeInsets.zero,  
375 - border:  
376 - OutlineInputBorder(borderSide: BorderSide.none),  
377 - ),  
378 - onChanged: (value) {  
379 - print(value);  
380 - // currentRemark = value;  
381 - // print();  
382 - setState(() {  
383 - if (value != '¥' && value.trim().length > 0) {  
384 - btnState = 1;  
385 - } else {  
386 - btnState = -1;  
387 - }  
388 - });  
389 - },  
390 - onEditingComplete: () {  
391 - print('fff');  
392 - _focusNode.unfocus(); 370 + fontSize: ScreenUtil().setSp(28),
  371 + color: MyColours.color_515151),
  372 + controller: _editingController,
  373 + focusNode: _focusNode,
  374 + keyboardType: TextInputType.numberWithOptions(decimal: true),
  375 + // textAlignVertical: TextAlignVertical.bottom,
  376 + decoration: InputDecoration(
  377 + hintText: "点击填写",
  378 + hintStyle: TextStyle(
  379 + color: MyColours.color_515151,
  380 + fontSize: ScreenUtil().setSp(28),
  381 + ),
  382 + // contentPadding:
  383 + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
  384 + contentPadding: EdgeInsets.zero,
  385 + border: OutlineInputBorder(borderSide: BorderSide.none),
  386 + ),
  387 + onChanged: (value) {
  388 + print(value);
  389 + // currentRemark = value;
  390 + // print();
  391 + setState(() {
  392 + if (value != '¥' && value.trim().length > 0) {
  393 + btnState = 1;
  394 + } else {
  395 + btnState = -1;
  396 + }
  397 + });
  398 + },
  399 + onEditingComplete: () {
  400 + print('fff');
  401 + _focusNode.unfocus();
393 402
394 - // _editingController.text = '';  
395 - // _needNode.unfocus();  
396 - }))  
397 - ],  
398 - ),  
399 - ), 403 + // _editingController.text = '';
  404 + // _needNode.unfocus();
  405 + }))
400 ], 406 ],
401 ), 407 ),
402 ); 408 );
@@ -405,20 +411,24 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -405,20 +411,24 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
405 /// 411 ///
406 412
407 ///顾客信息 413 ///顾客信息
408 - Widget _customInfoItemWidget(String title, String subTitle) { 414 + Widget _customInfoItemWidget(String title, String subTitle,
  415 + {double fontsize = 28}) {
409 return Row( 416 return Row(
410 mainAxisAlignment: MainAxisAlignment.spaceBetween, 417 mainAxisAlignment: MainAxisAlignment.spaceBetween,
411 children: [ 418 children: [
412 Text( 419 Text(
413 title, 420 title,
414 style: TextStyle( 421 style: TextStyle(
415 - fontSize: ScreenUtil().setSp(28), color: MyColours.color_707070), 422 + fontSize: ScreenUtil().setSp(24), color: MyColours.color_515151),
416 ), 423 ),
417 Text( 424 Text(
418 subTitle, 425 subTitle,
419 style: TextStyle( 426 style: TextStyle(
420 - fontSize: ScreenUtil().setSp(28),  
421 - color: MyColours.color_707070, 427 + decoration: fontsize == 20
  428 + ? TextDecoration.underline
  429 + : TextDecoration.none,
  430 + fontSize: ScreenUtil().setSp(fontsize),
  431 + color: MyColours.color_515151,
422 fontWeight: FontWeight.bold), 432 fontWeight: FontWeight.bold),
423 ) 433 )
424 ], 434 ],
@@ -434,48 +444,26 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -434,48 +444,26 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
434 crossAxisAlignment: CrossAxisAlignment.start, 444 crossAxisAlignment: CrossAxisAlignment.start,
435 children: <Widget>[ 445 children: <Widget>[
436 Container( 446 Container(
437 - height: ScreenUtil().setWidth(53 * 2),  
438 - width: double.infinity,  
439 - decoration: BoxDecoration(  
440 - color: MyColours.color_FAFAFA,  
441 - borderRadius: BorderRadius.only(  
442 - topLeft: Radius.circular(10),  
443 - topRight: Radius.circular(10)),  
444 - ),  
445 - child: Padding(  
446 - padding: EdgeInsets.fromLTRB(  
447 - ScreenUtil().setWidth(20),  
448 - ScreenUtil().setWidth(36),  
449 - ScreenUtil().setWidth(20),  
450 - ScreenUtil().setWidth(26)),  
451 - child: Text(  
452 - '顾客信息',  
453 - style: TextStyle(  
454 - fontSize: ScreenUtil().setSp(32),  
455 - color: MyColours.color_353535,  
456 - fontWeight: FontWeight.bold),  
457 - ),  
458 - )),  
459 - Container(  
460 color: Colors.white, 447 color: Colors.white,
461 padding: EdgeInsets.fromLTRB( 448 padding: EdgeInsets.fromLTRB(
462 - ScreenUtil().setWidth(40),  
463 - ScreenUtil().setWidth(24),  
464 - ScreenUtil().setWidth(40),  
465 - ScreenUtil().setWidth(36)), 449 + ScreenUtil().setWidth(64),
  450 + ScreenUtil().setWidth(26),
  451 + ScreenUtil().setWidth(64),
  452 + ScreenUtil().setWidth(26)),
466 child: Column( 453 child: Column(
467 children: [ 454 children: [
468 _customInfoItemWidget( 455 _customInfoItemWidget(
469 - '买单顾客', 456 + '顾客',
470 _orderFoodProvider.reserveDetailSunModel != null 457 _orderFoodProvider.reserveDetailSunModel != null
471 ? _orderFoodProvider.reserveDetailSunModel.rnameStr 458 ? _orderFoodProvider.reserveDetailSunModel.rnameStr
472 : ''), 459 : ''),
473 VEmptyView(24), 460 VEmptyView(24),
474 - _customInfoItemWidget(  
475 - '顾客电话',  
476 - _orderFoodProvider.reserveDetailSunModel != null  
477 - ? _orderFoodProvider.reserveDetailSunModel.phone  
478 - : ''), 461 + // _customInfoItemWidget(
  462 + // '顾客电话',
  463 + // _orderFoodProvider.reserveDetailSunModel != null
  464 + // ? _orderFoodProvider.reserveDetailSunModel.phone
  465 + // : ''),
  466 + _getTabInfoWidget(),
479 VEmptyView(24), 467 VEmptyView(24),
480 _customInfoItemWidget( 468 _customInfoItemWidget(
481 '到店时间', 469 '到店时间',
@@ -497,6 +485,141 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -497,6 +485,141 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
497 ); 485 );
498 } 486 }
499 487
  488 + ///发票信息
  489 + Widget _invoiceInfoWidget() {
  490 + return Container(
  491 + width: double.infinity,
  492 + decoration: BoxDecoration(
  493 + color: Colors.white, borderRadius: BorderRadius.circular(10)),
  494 + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: <
  495 + Widget>[
  496 + // Container(
  497 + // height: ScreenUtil().setWidth(53 * 2),
  498 + // width: double.infinity,
  499 + // decoration: BoxDecoration(
  500 + // color: MyColours.color_FAFAFA,
  501 + // borderRadius: BorderRadius.only(
  502 + // topLeft: Radius.circular(10),
  503 + // topRight: Radius.circular(10)),
  504 + // ),
  505 + // child: Padding(
  506 + // padding: EdgeInsets.fromLTRB(
  507 + // ScreenUtil().setWidth(20),
  508 + // ScreenUtil().setWidth(36),
  509 + // ScreenUtil().setWidth(20),
  510 + // ScreenUtil().setWidth(26)),
  511 + // child: Text(
  512 + // '发票信息',
  513 + // style: TextStyle(
  514 + // fontSize: ScreenUtil().setSp(32),
  515 + // color: MyColours.color_353535,
  516 + // fontWeight: FontWeight.bold),
  517 + // ),
  518 + // )),
  519 + Container(
  520 + color: Colors.white,
  521 + padding: EdgeInsets.fromLTRB(
  522 + ScreenUtil().setWidth(40),
  523 + ScreenUtil().setWidth(24),
  524 + ScreenUtil().setWidth(40),
  525 + ScreenUtil().setWidth(36)),
  526 + child: Column(children: [
  527 + _customInfoItemWidget(
  528 + '发票抬头',
  529 + _onlineCheckEditProvider.orderInfoSunModel != null
  530 + ? _onlineCheckEditProvider
  531 + .orderInfoSunModel.invoice.title
  532 + : '',
  533 + fontsize: 20),
  534 + Offstage(
  535 + offstage: _onlineCheckEditProvider.orderInfoSunModel != null
  536 + ? _onlineCheckEditProvider
  537 + .orderInfoSunModel.invoice.taxnumber ==
  538 + ''
  539 + : true,
  540 + child: Padding(
  541 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  542 + child: _customInfoItemWidget(
  543 + '税号',
  544 + _onlineCheckEditProvider.orderInfoSunModel != null
  545 + ? _onlineCheckEditProvider
  546 + .orderInfoSunModel.invoice.taxnumber
  547 + : '',
  548 + fontsize: 20),
  549 + ),
  550 + ),
  551 + Offstage(
  552 + offstage: _onlineCheckEditProvider.orderInfoSunModel != null
  553 + ? _onlineCheckEditProvider
  554 + .orderInfoSunModel.invoice.companyaddress ==
  555 + ''
  556 + : true,
  557 + child: Padding(
  558 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  559 + child: _customInfoItemWidget(
  560 + '地址',
  561 + _onlineCheckEditProvider.orderInfoSunModel != null
  562 + ? _onlineCheckEditProvider
  563 + .orderInfoSunModel.invoice.companyaddress
  564 + : '',
  565 + fontsize: 20),
  566 + ),
  567 + ),
  568 + Offstage(
  569 + offstage: _onlineCheckEditProvider.orderInfoSunModel != null
  570 + ? _onlineCheckEditProvider
  571 + .orderInfoSunModel.invoice.telephone ==
  572 + ''
  573 + : true,
  574 + child: Padding(
  575 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  576 + child: _customInfoItemWidget(
  577 + '电话',
  578 + _onlineCheckEditProvider.orderInfoSunModel != null
  579 + ? _onlineCheckEditProvider
  580 + .orderInfoSunModel.invoice.telephone
  581 + : '',
  582 + fontsize: 20),
  583 + ),
  584 + ),
  585 + Offstage(
  586 + offstage: _onlineCheckEditProvider.orderInfoSunModel != null
  587 + ? _onlineCheckEditProvider
  588 + .orderInfoSunModel.invoice.bankname ==
  589 + ''
  590 + : true,
  591 + child: Padding(
  592 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  593 + child: _customInfoItemWidget(
  594 + '开户行',
  595 + _onlineCheckEditProvider.orderInfoSunModel != null
  596 + ? _onlineCheckEditProvider
  597 + .orderInfoSunModel.invoice.bankname
  598 + : '',
  599 + fontsize: 20),
  600 + ),
  601 + ),
  602 + Offstage(
  603 + offstage: _onlineCheckEditProvider.orderInfoSunModel != null
  604 + ? _onlineCheckEditProvider
  605 + .orderInfoSunModel.invoice.bankaccount ==
  606 + ''
  607 + : true,
  608 + child: Padding(
  609 + padding: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  610 + child: _customInfoItemWidget(
  611 + '账号',
  612 + _onlineCheckEditProvider.orderInfoSunModel != null
  613 + ? _onlineCheckEditProvider
  614 + .orderInfoSunModel.invoice.bankaccount
  615 + : '',
  616 + fontsize: 20),
  617 + ),
  618 + )
  619 + ]))
  620 + ]));
  621 + }
  622 +
500 @override 623 @override
501 Widget build(BuildContext context) { 624 Widget build(BuildContext context) {
502 detailModel = Provider.of<NotebookDetailModel>(context, listen: true); 625 detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
@@ -506,9 +629,9 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -506,9 +629,9 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
506 _uploadImageProvider = 629 _uploadImageProvider =
507 Provider.of<UploadImageProvider>(context, listen: true); 630 Provider.of<UploadImageProvider>(context, listen: true);
508 return Scaffold( 631 return Scaffold(
509 - backgroundColor: MyColours.color_f5f5f5, 632 + backgroundColor: MyColours.color_F7F7F7,
510 appBar: SystemAppBar( 633 appBar: SystemAppBar(
511 - '提前买单', 634 + '在线买单',
512 onTap: () { 635 onTap: () {
513 if (widget.fromNotify) { 636 if (widget.fromNotify) {
514 NavigatorUtil.goHomePage(context, initialIndex: 0); 637 NavigatorUtil.goHomePage(context, initialIndex: 0);
@@ -525,143 +648,163 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { @@ -525,143 +648,163 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
525 child: Padding( 648 child: Padding(
526 padding: EdgeInsets.symmetric( 649 padding: EdgeInsets.symmetric(
527 horizontal: ScreenUtil().setWidth(20)), 650 horizontal: ScreenUtil().setWidth(20)),
528 - child: Column(  
529 - children: [  
530 - Expanded(  
531 - child: SingleChildScrollView(  
532 - controller: _scrollController,  
533 - child: Column(  
534 - crossAxisAlignment: CrossAxisAlignment.start,  
535 - children: [  
536 - VEmptyView(40),  
537 - //图标  
538 - _getLogoWidget(),  
539 - VEmptyView(40),  
540 - _getTabAndMoneyInfoWidget(),  
541 - VEmptyView(10),  
542 - // 备注信息  
543 - Offstage(  
544 - offstage: _onlineCheckEditProvider  
545 - .orderInfoSunModel !=  
546 - null  
547 - ? _onlineCheckEditProvider  
548 - .orderInfoSunModel  
549 - .orderRemark ==  
550 - ''  
551 - : true,  
552 - child: Container(  
553 - padding: EdgeInsets.symmetric(  
554 - horizontal:  
555 - ScreenUtil().setWidth(20)),  
556 - child: Text(  
557 - _onlineCheckEditProvider 651 + child: Container(
  652 + color: MyColours.color_F7F7F7,
  653 + child: Column(
  654 + children: [
  655 + Expanded(
  656 + child: SingleChildScrollView(
  657 + controller: _scrollController,
  658 + child: Column(
  659 + crossAxisAlignment:
  660 + CrossAxisAlignment.start,
  661 + children: [
  662 + VEmptyView(30),
  663 + _customInfoWidget(),
  664 + // //图标
  665 + // _getLogoWidget(),
  666 + // VEmptyView(40),
  667 +
  668 + VEmptyView(72),
  669 + _getMoneyInfoWidget(),
  670 + // 备注信息
  671 + Offstage(
  672 + offstage: _onlineCheckEditProvider
558 .orderInfoSunModel != 673 .orderInfoSunModel !=
559 null 674 null
560 ? _onlineCheckEditProvider 675 ? _onlineCheckEditProvider
561 - .orderInfoSunModel.orderRemark  
562 - : '',  
563 - style: TextStyle(  
564 - fontSize: ScreenUtil().setSp(28),  
565 - color: MyColours.color_FD5656), 676 + .orderInfoSunModel
  677 + .orderRemark ==
  678 + ''
  679 + : true,
  680 + child: Container(
  681 + padding: EdgeInsets.only(
  682 + top: ScreenUtil().setWidth(20),
  683 + right: ScreenUtil().setWidth(20),
  684 + left: ScreenUtil().setWidth(20)),
  685 + child: Text(
  686 + _onlineCheckEditProvider
  687 + .orderInfoSunModel !=
  688 + null
  689 + ? _onlineCheckEditProvider
  690 + .orderInfoSunModel
  691 + .orderRemark
  692 + : '',
  693 + style: TextStyle(
  694 + fontSize:
  695 + ScreenUtil().setSp(24),
  696 + color: MyColours.color_FD5656),
  697 + ),
  698 + ),
566 ), 699 ),
567 - ),  
568 - ),  
569 - VEmptyView(20),  
570 - Container(  
571 - width: double.infinity,  
572 - decoration: BoxDecoration(  
573 - color: Colors.white,  
574 - borderRadius:  
575 - BorderRadius.circular(10)),  
576 - child: Column(  
577 - crossAxisAlignment:  
578 - CrossAxisAlignment.start,  
579 - children: <Widget>[  
580 - Container(  
581 - height:  
582 - ScreenUtil().setWidth(53 * 2),  
583 - width: double.infinity,  
584 - decoration: BoxDecoration(  
585 - color: MyColours.color_FAFAFA,  
586 - borderRadius: BorderRadius.only(  
587 - topLeft: Radius.circular(10),  
588 - topRight:  
589 - Radius.circular(10)),  
590 - ),  
591 - child: Padding( 700 + VEmptyView(20),
  701 + Container(
  702 + width: double.infinity,
  703 + decoration: BoxDecoration(
  704 + color: Colors.white,
  705 + // borderRadius:
  706 + // BorderRadius.circular(10)
  707 + ),
  708 + child: Column(
  709 + crossAxisAlignment:
  710 + CrossAxisAlignment.start,
  711 + children: <Widget>[
  712 + Container(
  713 + height: ScreenUtil()
  714 + .setWidth(53 * 2),
  715 + width: double.infinity,
  716 + decoration: BoxDecoration(
  717 + color: MyColours.color_ffffff,
  718 + // borderRadius:
  719 + // BorderRadius.only(
  720 + // topLeft:
  721 + // Radius.circular(
  722 + // 10),
  723 + // topRight:
  724 + // Radius.circular(
  725 + // 10)),
  726 + ),
  727 + child: Padding(
  728 + padding: EdgeInsets.fromLTRB(
  729 + ScreenUtil().setWidth(32),
  730 + ScreenUtil().setWidth(24),
  731 + ScreenUtil().setWidth(20),
  732 + ScreenUtil()
  733 + .setWidth(24)),
  734 + child: Text(
  735 + '上传小票',
  736 + style: TextStyle(
  737 + fontSize: ScreenUtil()
  738 + .setSp(32),
  739 + color: MyColours
  740 + .color_000000,
  741 + fontWeight:
  742 + FontWeight.bold),
  743 + ),
  744 + )),
  745 + Padding(
592 padding: EdgeInsets.fromLTRB( 746 padding: EdgeInsets.fromLTRB(
  747 + ScreenUtil().setWidth(32),
  748 + ScreenUtil().setWidth(0),
593 ScreenUtil().setWidth(20), 749 ScreenUtil().setWidth(20),
594 - ScreenUtil().setWidth(36),  
595 - ScreenUtil().setWidth(20),  
596 - ScreenUtil().setWidth(26)),  
597 - child: Text(  
598 - '消费清单(选填)',  
599 - style: TextStyle(  
600 - fontSize:  
601 - ScreenUtil().setSp(32),  
602 - color:  
603 - MyColours.color_353535,  
604 - fontWeight:  
605 - FontWeight.bold),  
606 - ),  
607 - )),  
608 - Padding(  
609 - padding: EdgeInsets.all(  
610 - ScreenUtil().setWidth(40)),  
611 - child: Consumer<UploadImageProvider>(  
612 - builder: (context, model, _) {  
613 - return ImgPickerWidget(  
614 - model: model,  
615 - scrollController:  
616 - _scrollController,  
617 - uploadType: UploadType  
618 - .ConsumptionUploadType,  
619 - );  
620 - }),  
621 - )  
622 - // _getGridImg(1, context)  
623 - ],  
624 - ),  
625 - ),  
626 -  
627 - VEmptyView(20),  
628 - _customInfoWidget()  
629 - ],  
630 - ))),  
631 - Padding(  
632 - padding: EdgeInsets.fromLTRB(  
633 - ScreenUtil().setWidth(16),  
634 - 0,  
635 - ScreenUtil().setWidth(16),  
636 - ScreenUtil().setWidth(40)),  
637 - child: CommonButton(  
638 - width: double.infinity,  
639 - height: 84,  
640 - fontSize: 34,  
641 - content: '发送给顾客',  
642 - state: btnState,  
643 - onPress: () async {  
644 - if (btnState == 1) {  
645 - _focusNode.unfocus();  
646 - if (_editingController.text.startsWith('¥') &&  
647 - _editingController.text.length == 1) {  
648 - Utils.showToast('请输入金额');  
649 - setState(() {  
650 - btnState = -1;  
651 - });  
652 - return;  
653 - }  
654 - DialogUtil.confirmDialog(  
655 - context, _editingController.text, 438,  
656 - onTap: () {  
657 - Navigator.pop(context);  
658 - _updateOrderInfo();  
659 - });  
660 - }  
661 - },  
662 - ))  
663 - ],  
664 - )), 750 + ScreenUtil().setWidth(24)),
  751 + child:
  752 + Consumer<UploadImageProvider>(
  753 + builder:
  754 + (context, model, _) {
  755 + return ImgPickerFWidget(
  756 + model: model,
  757 + scrollController:
  758 + _scrollController,
  759 + uploadType: UploadType
  760 + .ConsumptionUploadType,
  761 + );
  762 + }),
  763 + )
  764 + // _getGridImg(1, context)
  765 + ],
  766 + ),
  767 + ),
  768 + VEmptyView(36),
  769 + _invoiceInfoWidget(),
  770 + VEmptyView(36),
  771 + ],
  772 + ))),
  773 + Padding(
  774 + padding: EdgeInsets.fromLTRB(
  775 + ScreenUtil().setWidth(180),
  776 + 0,
  777 + ScreenUtil().setWidth(180),
  778 + ScreenUtil().setWidth(40)),
  779 + child: CommonButton(
  780 + width: double.infinity,
  781 + height: 84,
  782 + fontSize: 32,
  783 + content: '发送给顾客',
  784 + state: btnState,
  785 + onPress: () async {
  786 + if (btnState == 1) {
  787 + _focusNode.unfocus();
  788 + if (_editingController.text
  789 + .startsWith('¥') &&
  790 + _editingController.text.length == 1) {
  791 + Utils.showToast('请输入金额');
  792 + setState(() {
  793 + btnState = -1;
  794 + });
  795 + return;
  796 + }
  797 + DialogUtil.confirmDialog(
  798 + context, _editingController.text, 438,
  799 + onTap: () {
  800 + Navigator.pop(context);
  801 + _updateOrderInfo();
  802 + });
  803 + }
  804 + },
  805 + ))
  806 + ],
  807 + ))),
665 ), 808 ),
666 onWillPop: () async { 809 onWillPop: () async {
667 if (widget.fromNotify) { 810 if (widget.fromNotify) {
@@ -6,6 +6,7 @@ import 'package:one_key/models/message.dart'; @@ -6,6 +6,7 @@ import 'package:one_key/models/message.dart';
6 import 'package:one_key/net/base_resp.dart'; 6 import 'package:one_key/net/base_resp.dart';
7 import 'package:one_key/net/dio_util.dart'; 7 import 'package:one_key/net/dio_util.dart';
8 import 'package:one_key/net/http_url.dart'; 8 import 'package:one_key/net/http_url.dart';
  9 +import 'package:one_key/utils/utils.dart';
9 10
10 class MessageModel extends ChangeNotifier { 11 class MessageModel extends ChangeNotifier {
11 List<Message> messages = []; //消息 12 List<Message> messages = []; //消息
@@ -125,6 +126,21 @@ class MessageModel extends ChangeNotifier { @@ -125,6 +126,21 @@ class MessageModel extends ChangeNotifier {
125 } 126 }
126 } 127 }
127 128
  129 + //设置消息状态
  130 + setMessageStatus(BuildContext context, Map<String, String> params) async {
  131 + BaseResp<dynamic> baseResp = await DioUtil()
  132 + .request<dynamic>(
  133 + context, Method.get, HttpUrl.push_msg_set_message_status,
  134 + data: params, showLoading: false)
  135 + .catchError((error) {
  136 + print(error.toString());
  137 + });
  138 + if (baseResp.code == Constant.status_success) {
  139 + } else {
  140 + Utils.showToast(baseResp.msg);
  141 + }
  142 + }
  143 +
128 //根据消息id移除消息 144 //根据消息id移除消息
129 removeUntreatedMessageByMid(String mid) { 145 removeUntreatedMessageByMid(String mid) {
130 messages.removeWhere((element) => element.id == mid); 146 messages.removeWhere((element) => element.id == mid);