Commit e207a2053b0db78bd50c2abb7cc2700a96416872

Authored by wdn127929
1 parent d903a39c

用餐人数

@@ -2,6 +2,7 @@ import 'dart:convert'; @@ -2,6 +2,7 @@ import 'dart:convert';
2 2
3 import 'package:common_utils/common_utils.dart'; 3 import 'package:common_utils/common_utils.dart';
4 import 'package:flutter/material.dart'; 4 import 'package:flutter/material.dart';
  5 +import 'package:flutter/services.dart';
5 import 'package:flutter_picker/flutter_picker.dart'; 6 import 'package:flutter_picker/flutter_picker.dart';
6 import 'package:flutter_screenutil/flutter_screenutil.dart'; 7 import 'package:flutter_screenutil/flutter_screenutil.dart';
7 import 'package:one_key/constant/state.dart'; 8 import 'package:one_key/constant/state.dart';
@@ -70,6 +71,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -70,6 +71,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
70 71
71 String formatPhone = ""; 72 String formatPhone = "";
72 OnlineCheckEditProvider _onlineCheckEditProvider; 73 OnlineCheckEditProvider _onlineCheckEditProvider;
  74 + List<String> personNumList = []; // 人数
73 75
74 @override 76 @override
75 void initState() { 77 void initState() {
@@ -79,6 +81,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -79,6 +81,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
79 _initCancel(); 81 _initCancel();
80 _getReserveDetail(); 82 _getReserveDetail();
81 _getOrderInfo(); 83 _getOrderInfo();
  84 + _initPersonNumList();
82 managers = await detailModel.getManagers(context); 85 managers = await detailModel.getManagers(context);
83 //添加listener监听 86 //添加listener监听
84 //对应的TextField失去或者获取焦点都会回调此监听 87 //对应的TextField失去或者获取焦点都会回调此监听
@@ -99,6 +102,15 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -99,6 +102,15 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
99 }); 102 });
100 } 103 }
101 104
  105 + //人数
  106 + _initPersonNumList() {
  107 + personNumList = [];
  108 + for (int i = 1; i < 31; i++) {
  109 + personNumList.add(i.toString());
  110 + }
  111 + personNumList.add('30以上');
  112 + }
  113 +
102 //设置消息状态 114 //设置消息状态
103 setMessageStatus() { 115 setMessageStatus() {
104 if (widget.mid == null || widget.mid.isEmpty) return; 116 if (widget.mid == null || widget.mid.isEmpty) return;
@@ -517,14 +529,6 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -517,14 +529,6 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
517 children: <Widget>[ 529 children: <Widget>[
518 RowMultiText("用餐时间", 530 RowMultiText("用餐时间",
519 detailEntity.ddateHm), 531 detailEntity.ddateHm),
520 - Offstage(  
521 - offstage:  
522 - detailEntity.type == "0"  
523 - ? false  
524 - : true,  
525 - child: RowMultiText("用餐人数",  
526 - detailEntity.pnum),  
527 - )  
528 ], 532 ],
529 ), 533 ),
530 Image.asset( 534 Image.asset(
@@ -535,6 +539,17 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -535,6 +539,17 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
535 ], 539 ],
536 ), 540 ),
537 Offstage( 541 Offstage(
  542 + offstage: detailEntity.type == "0"
  543 + ? false
  544 + : true,
  545 + child: TitleAndTextfield(
  546 + title: "用餐人数",
  547 + bookNum: detailEntity.pnum,
  548 + pnumlist: personNumList,
  549 + detailModel: model,
  550 + ),
  551 + ),
  552 + Offstage(
538 offstage: 553 offstage:
539 detailEntity.demands.length <= 0 554 detailEntity.demands.length <= 0
540 ? true 555 ? true
@@ -1176,3 +1191,140 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -1176,3 +1191,140 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
1176 ); 1191 );
1177 } 1192 }
1178 } 1193 }
  1194 +
  1195 +class TitleAndTextfield extends StatelessWidget {
  1196 + final String title;
  1197 + final String bookNum;
  1198 + final List<String> pnumlist;
  1199 + final NotebookDetailModel detailModel;
  1200 + const TitleAndTextfield(
  1201 + {Key key, this.title, this.bookNum, this.pnumlist, this.detailModel})
  1202 + : super(key: key);
  1203 +
  1204 + @override
  1205 + Widget build(BuildContext context) {
  1206 + return Container(
  1207 + color: MyColours.color_ffffff,
  1208 + width: double.infinity,
  1209 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(25)),
  1210 + alignment: Alignment.center,
  1211 + child: Row(
  1212 + crossAxisAlignment: CrossAxisAlignment.center,
  1213 + children: <Widget>[
  1214 + Align(
  1215 + alignment: Alignment.centerLeft,
  1216 + child: Text(
  1217 + title,
  1218 + style: TextStyle(
  1219 + color: MyColours.color_828282,
  1220 + fontSize: ScreenUtil().setSp(30)),
  1221 + ),
  1222 + ),
  1223 + Spacer(),
  1224 + Text(
  1225 + "预订$bookNum人 实到",
  1226 + style: TextStyle(
  1227 + color: MyColours.color_353535,
  1228 + fontSize: ScreenUtil().setSp(30)),
  1229 + softWrap: true,
  1230 + ),
  1231 + HEmptyView(10),
  1232 + InkWell(
  1233 + onTap: () {
  1234 + FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
  1235 + DialogUtil.showSelectCusmanDialog(context, pnumlist, (value) {
  1236 + if (value != null) {
  1237 + detailModel.selectNum = value.first;
  1238 + detailModel.notifyListeners();
  1239 + // setState(() {
  1240 + // selectPnum = value.first;
  1241 + // pnum = pnumlist[value.first];
  1242 + // });
  1243 +
  1244 + }
  1245 + },
  1246 + selecteds: detailModel.selectNum == null
  1247 + ? []
  1248 + : [detailModel.selectNum])
  1249 + .then((value) {});
  1250 + },
  1251 + child: Container(
  1252 + height: ScreenUtil().setWidth(44),
  1253 + decoration: BoxDecoration(
  1254 + border: Border(
  1255 + bottom: BorderSide(
  1256 + width: ScreenUtil().setWidth(2),
  1257 + color: MyColours.color_199095))),
  1258 + child: Text(
  1259 + detailModel.selectNum == null
  1260 + ? "修改"
  1261 + : "${detailModel.selectNum}",
  1262 + style: TextStyle(
  1263 + color: MyColours.color_199095,
  1264 + fontSize: ScreenUtil().setSp(32))),
  1265 + ),
  1266 + ),
  1267 + HEmptyView(10),
  1268 + Padding(
  1269 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(6)),
  1270 + child: Text(
  1271 + "人",
  1272 + style: TextStyle(
  1273 + color: MyColours.color_353535,
  1274 + fontSize: ScreenUtil().setSp(30)),
  1275 + ),
  1276 + ),
  1277 + ]));
  1278 + }
  1279 +}
  1280 +// Container(
  1281 +// alignment: Alignment.center,
  1282 +// // color: Colors.red,
  1283 +// width: ScreenUtil().setWidth(114),
  1284 +// height: ScreenUtil().setWidth(50),
  1285 +// // padding: EdgeInsets.zero,
  1286 +// child: TextField(
  1287 +// controller: widget.model.numController,
  1288 +// maxLines: 1,
  1289 +
  1290 +// inputFormatters: [
  1291 +// LengthLimitingTextInputFormatter(3),
  1292 +// WhitelistingTextInputFormatter.digitsOnly
  1293 +// ],
  1294 +// //光标颜色
  1295 +// cursorColor:
  1296 +// MyColours.color_199095,
  1297 +// //输入文本的样式
  1298 +// style: TextStyle(
  1299 +// fontSize: ScreenUtil().setSp(30),
  1300 +// color: widget.isSelect
  1301 +// ? Colors.white
  1302 +// : MyColours.color_199095),
  1303 +// // controller: _cancelController,
  1304 +// focusNode: _cancelNode,
  1305 +// textAlignVertical: TextAlignVertical.bottom,
  1306 +// decoration: InputDecoration(
  1307 +// // fillColor: Colors.lightGreenAccent,
  1308 +// // filled: true,
  1309 +// border: OutlineInputBorder(borderSide: BorderSide.none),
  1310 +// hintText: "更多",
  1311 +// hintStyle: TextStyle(
  1312 +// color: widget.isSelect
  1313 +// ? Colors.white
  1314 +// : MyColours.color_199095,
  1315 +// fontSize: ScreenUtil().setSp(30),
  1316 +// ),
  1317 +// // contentPadding: EdgeInsets.only(
  1318 +// // bottom: ScreenUtil().setWidth(30)), //ios 17
  1319 +// // border: InputBorder.none,
  1320 +// ),
  1321 +// onChanged: (value) {
  1322 +
  1323 +// },
  1324 +// onEditingComplete: () {
  1325 +// // _cancelNode.unfocus();
  1326 +
  1327 +// },
  1328 +// keyboardType: TextInputType.number,
  1329 +// ),
  1330 +// )
@@ -14,6 +14,7 @@ import 'package:provider/provider.dart'; @@ -14,6 +14,7 @@ import 'package:provider/provider.dart';
14 14
15 class NotebookDetailModel extends ChangeNotifier { 15 class NotebookDetailModel extends ChangeNotifier {
16 PageState pageState = PageState.Loading; 16 PageState pageState = PageState.Loading;
  17 + int selectNum;
17 18
18 ///获取已预订订单 19 ///获取已预订订单
19 Future<NotebookDetail> getReserveDetail( 20 Future<NotebookDetail> getReserveDetail(