|
@@ -13,6 +13,7 @@ import 'package:one_key/provider/notebook_detail_model.dart'; |
|
@@ -13,6 +13,7 @@ import 'package:one_key/provider/notebook_detail_model.dart'; |
|
13
|
import 'package:one_key/provider/online_check_edit_provider.dart';
|
13
|
import 'package:one_key/provider/online_check_edit_provider.dart';
|
|
14
|
import 'package:one_key/provider/user_model.dart';
|
14
|
import 'package:one_key/provider/user_model.dart';
|
|
15
|
import 'package:one_key/res/colors.dart';
|
15
|
import 'package:one_key/res/colors.dart';
|
|
|
|
16
|
+import 'package:one_key/utils/NumLengthInputFormatter.dart';
|
|
16
|
import 'package:one_key/utils/dialog_util.dart';
|
17
|
import 'package:one_key/utils/dialog_util.dart';
|
|
17
|
import 'package:one_key/utils/event_bus.dart';
|
18
|
import 'package:one_key/utils/event_bus.dart';
|
|
18
|
import 'package:one_key/route/navigator_util.dart';
|
19
|
import 'package:one_key/route/navigator_util.dart';
|
|
@@ -77,6 +78,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -77,6 +78,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
77
|
void initState() {
|
78
|
void initState() {
|
|
78
|
// TODO: implement initState
|
79
|
// TODO: implement initState
|
|
79
|
super.initState();
|
80
|
super.initState();
|
|
|
|
81
|
+
|
|
80
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
82
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
81
|
_initCancel();
|
83
|
_initCancel();
|
|
82
|
_getReserveDetail();
|
84
|
_getReserveDetail();
|
|
@@ -145,6 +147,20 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -145,6 +147,20 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
145
|
"rid": widget.rid,
|
147
|
"rid": widget.rid,
|
|
146
|
});
|
148
|
});
|
|
147
|
setState(() {
|
149
|
setState(() {
|
|
|
|
150
|
+ detailModel.selectNum = detailEntity.actual_pum;
|
|
|
|
151
|
+ detailModel.selectIndex = detailEntity.actual_pum != null
|
|
|
|
152
|
+ ? personNumList.indexOf(detailEntity.actual_pum)
|
|
|
|
153
|
+ : null;
|
|
|
|
154
|
+ if (detailEntity.con_amount != null) {
|
|
|
|
155
|
+ detailModel.prestrTF = detailEntity.con_amount;
|
|
|
|
156
|
+ detailModel.numController.text = detailEntity.con_amount;
|
|
|
|
157
|
+ }
|
|
|
|
158
|
+ if (detailEntity.con_amount != null) {
|
|
|
|
159
|
+ detailModel.prestrTF = detailEntity.con_amount;
|
|
|
|
160
|
+ detailModel.strTF = detailEntity.con_amount;
|
|
|
|
161
|
+ detailModel.numController.text = detailEntity.con_amount;
|
|
|
|
162
|
+ }
|
|
|
|
163
|
+
|
|
148
|
cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
|
164
|
cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
|
|
149
|
formatPhone = detailEntity.phone;
|
165
|
formatPhone = detailEntity.phone;
|
|
150
|
if (App.sp.getString("is_call_tel") != null &&
|
166
|
if (App.sp.getString("is_call_tel") != null &&
|
|
@@ -219,6 +235,23 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -219,6 +235,23 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
219
|
}
|
235
|
}
|
|
220
|
}
|
236
|
}
|
|
221
|
|
237
|
|
|
|
|
238
|
+ ///编辑订单附加信息
|
|
|
|
239
|
+ Future<bool> _upReserveInfo({String actualPum, String conAmount}) async {
|
|
|
|
240
|
+ Map<String, dynamic> params = {
|
|
|
|
241
|
+ "rid": widget.rid,
|
|
|
|
242
|
+ };
|
|
|
|
243
|
+ if (actualPum != null) {
|
|
|
|
244
|
+ params['actual_pum'] = actualPum;
|
|
|
|
245
|
+ }
|
|
|
|
246
|
+ if (conAmount != null) {
|
|
|
|
247
|
+ params['con_amount'] = conAmount;
|
|
|
|
248
|
+ }
|
|
|
|
249
|
+ bool sucess = await detailModel.upReserveInfo(context, params);
|
|
|
|
250
|
+ if (sucess) {
|
|
|
|
251
|
+ Utils.showToast("修改成功!");
|
|
|
|
252
|
+ }
|
|
|
|
253
|
+ }
|
|
|
|
254
|
+
|
|
222
|
/// 取消预订, 变更预订按钮
|
255
|
/// 取消预订, 变更预订按钮
|
|
223
|
Widget _cancelAndChangeBtn(GestureTapCallback onTap, String title,
|
256
|
Widget _cancelAndChangeBtn(GestureTapCallback onTap, String title,
|
|
224
|
{Color bgColor = MyColours.color_ffffff,
|
257
|
{Color bgColor = MyColours.color_ffffff,
|
|
@@ -542,11 +575,16 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -542,11 +575,16 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
542
|
offstage: detailEntity.type == "0"
|
575
|
offstage: detailEntity.type == "0"
|
|
543
|
? false
|
576
|
? false
|
|
544
|
: true,
|
577
|
: true,
|
|
545
|
- child: TitleAndTextfield(
|
578
|
+ child: TitleAndBtn(
|
|
546
|
title: "用餐人数",
|
579
|
title: "用餐人数",
|
|
547
|
bookNum: detailEntity.pnum,
|
580
|
bookNum: detailEntity.pnum,
|
|
548
|
pnumlist: personNumList,
|
581
|
pnumlist: personNumList,
|
|
549
|
detailModel: model,
|
582
|
detailModel: model,
|
|
|
|
583
|
+ callback: () {
|
|
|
|
584
|
+ _upReserveInfo(
|
|
|
|
585
|
+ actualPum:
|
|
|
|
586
|
+ detailModel.selectNum);
|
|
|
|
587
|
+ },
|
|
550
|
),
|
588
|
),
|
|
551
|
),
|
589
|
),
|
|
552
|
Offstage(
|
590
|
Offstage(
|
|
@@ -627,6 +665,15 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -627,6 +665,15 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
627
|
),
|
665
|
),
|
|
628
|
),
|
666
|
),
|
|
629
|
)),
|
667
|
)),
|
|
|
|
668
|
+ TitleAndTextfield(
|
|
|
|
669
|
+ title: "消费金额",
|
|
|
|
670
|
+ detailModel: detailModel,
|
|
|
|
671
|
+ callback: () {
|
|
|
|
672
|
+ _upReserveInfo(
|
|
|
|
673
|
+ conAmount:
|
|
|
|
674
|
+ detailModel.prestrTF);
|
|
|
|
675
|
+ },
|
|
|
|
676
|
+ ),
|
|
630
|
RowMultiText(
|
677
|
RowMultiText(
|
|
631
|
"客户姓名", detailEntity.rnameStr),
|
678
|
"客户姓名", detailEntity.rnameStr),
|
|
632
|
InkWell(
|
679
|
InkWell(
|
|
@@ -1192,13 +1239,19 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -1192,13 +1239,19 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
1192
|
}
|
1239
|
}
|
|
1193
|
}
|
1240
|
}
|
|
1194
|
|
1241
|
|
|
1195
|
-class TitleAndTextfield extends StatelessWidget {
|
1242
|
+class TitleAndBtn extends StatelessWidget {
|
|
1196
|
final String title;
|
1243
|
final String title;
|
|
1197
|
final String bookNum;
|
1244
|
final String bookNum;
|
|
1198
|
final List<String> pnumlist;
|
1245
|
final List<String> pnumlist;
|
|
1199
|
final NotebookDetailModel detailModel;
|
1246
|
final NotebookDetailModel detailModel;
|
|
1200
|
- const TitleAndTextfield(
|
|
|
|
1201
|
- {Key key, this.title, this.bookNum, this.pnumlist, this.detailModel})
|
1247
|
+ final VoidCallback callback;
|
|
|
|
1248
|
+ const TitleAndBtn(
|
|
|
|
1249
|
+ {Key key,
|
|
|
|
1250
|
+ this.title,
|
|
|
|
1251
|
+ this.bookNum,
|
|
|
|
1252
|
+ this.pnumlist,
|
|
|
|
1253
|
+ this.detailModel,
|
|
|
|
1254
|
+ this.callback})
|
|
1202
|
: super(key: key);
|
1255
|
: super(key: key);
|
|
1203
|
|
1256
|
|
|
1204
|
@override
|
1257
|
@override
|
|
@@ -1234,18 +1287,19 @@ class TitleAndTextfield extends StatelessWidget { |
|
@@ -1234,18 +1287,19 @@ class TitleAndTextfield extends StatelessWidget { |
|
1234
|
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
|
1287
|
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
|
|
1235
|
DialogUtil.showSelectCusmanDialog(context, pnumlist, (value) {
|
1288
|
DialogUtil.showSelectCusmanDialog(context, pnumlist, (value) {
|
|
1236
|
if (value != null) {
|
1289
|
if (value != null) {
|
|
1237
|
- detailModel.selectNum = value.first;
|
1290
|
+ detailModel.selectIndex = value.first;
|
|
|
|
1291
|
+ detailModel.selectNum = pnumlist[value.first];
|
|
1238
|
detailModel.notifyListeners();
|
1292
|
detailModel.notifyListeners();
|
|
1239
|
// setState(() {
|
1293
|
// setState(() {
|
|
1240
|
// selectPnum = value.first;
|
1294
|
// selectPnum = value.first;
|
|
1241
|
// pnum = pnumlist[value.first];
|
1295
|
// pnum = pnumlist[value.first];
|
|
1242
|
// });
|
1296
|
// });
|
|
1243
|
-
|
1297
|
+ callback();
|
|
1244
|
}
|
1298
|
}
|
|
1245
|
},
|
1299
|
},
|
|
1246
|
- selecteds: detailModel.selectNum == null
|
1300
|
+ selecteds: detailModel.selectIndex == null
|
|
1247
|
? []
|
1301
|
? []
|
|
1248
|
- : [detailModel.selectNum])
|
1302
|
+ : [detailModel.selectIndex])
|
|
1249
|
.then((value) {});
|
1303
|
.then((value) {});
|
|
1250
|
},
|
1304
|
},
|
|
1251
|
child: Container(
|
1305
|
child: Container(
|
|
@@ -1277,54 +1331,122 @@ class TitleAndTextfield extends StatelessWidget { |
|
@@ -1277,54 +1331,122 @@ class TitleAndTextfield extends StatelessWidget { |
|
1277
|
]));
|
1331
|
]));
|
|
1278
|
}
|
1332
|
}
|
|
1279
|
}
|
1333
|
}
|
|
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
|
|
1334
|
|
|
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) {
|
1335
|
+class TitleAndTextfield extends StatelessWidget {
|
|
|
|
1336
|
+ final String title;
|
|
|
|
1337
|
+ final String bookNum;
|
|
|
|
1338
|
+ final List<String> pnumlist;
|
|
|
|
1339
|
+ final NotebookDetailModel detailModel;
|
|
|
|
1340
|
+ final VoidCallback callback;
|
|
|
|
1341
|
+
|
|
|
|
1342
|
+ const TitleAndTextfield(
|
|
|
|
1343
|
+ {Key key,
|
|
|
|
1344
|
+ this.title,
|
|
|
|
1345
|
+ this.bookNum,
|
|
|
|
1346
|
+ this.pnumlist,
|
|
|
|
1347
|
+ this.detailModel,
|
|
|
|
1348
|
+ this.callback})
|
|
|
|
1349
|
+ : super(key: key);
|
|
|
|
1350
|
+
|
|
|
|
1351
|
+ @override
|
|
|
|
1352
|
+ Widget build(BuildContext context) {
|
|
|
|
1353
|
+ return Container(
|
|
|
|
1354
|
+ color: MyColours.color_ffffff,
|
|
|
|
1355
|
+ width: double.infinity,
|
|
|
|
1356
|
+ padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(25)),
|
|
|
|
1357
|
+ alignment: Alignment.center,
|
|
|
|
1358
|
+ child: Row(
|
|
|
|
1359
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
1360
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
1361
|
+ children: <Widget>[
|
|
|
|
1362
|
+ Align(
|
|
|
|
1363
|
+ alignment: Alignment.centerLeft,
|
|
|
|
1364
|
+ child: Text(
|
|
|
|
1365
|
+ title,
|
|
|
|
1366
|
+ style: TextStyle(
|
|
|
|
1367
|
+ color: MyColours.color_828282,
|
|
|
|
1368
|
+ fontSize: ScreenUtil().setSp(30)),
|
|
|
|
1369
|
+ ),
|
|
|
|
1370
|
+ ),
|
|
|
|
1371
|
+ Container(
|
|
|
|
1372
|
+ decoration: BoxDecoration(
|
|
|
|
1373
|
+ border: Border(
|
|
|
|
1374
|
+ bottom: BorderSide(
|
|
|
|
1375
|
+ width: ScreenUtil().setWidth(2),
|
|
|
|
1376
|
+ color: MyColours.color_199095))),
|
|
|
|
1377
|
+ child: IntrinsicWidth(
|
|
|
|
1378
|
+ child: TextField(
|
|
|
|
1379
|
+ controller: detailModel.numController,
|
|
|
|
1380
|
+ maxLines: 1,
|
|
|
|
1381
|
+ // inputFormatters: [
|
|
|
|
1382
|
+ // LengthLimitingTextInputFormatter(9),
|
|
|
|
1383
|
+ // WhitelistingTextInputFormatter.digitsOnly
|
|
|
|
1384
|
+ // ],
|
|
|
|
1385
|
+ inputFormatters: [
|
|
|
|
1386
|
+ NumLengthInputFormatter(
|
|
|
|
1387
|
+ decimalLength: 2, integerLength: 6),
|
|
|
|
1388
|
+ ],
|
|
|
|
1389
|
+ //光标颜色
|
|
|
|
1390
|
+ cursorColor: MyColours.color_199095,
|
|
|
|
1391
|
+ //输入文本的样式
|
|
|
|
1392
|
+ style: TextStyle(
|
|
|
|
1393
|
+ fontSize: ScreenUtil().setSp(30),
|
|
|
|
1394
|
+ color: MyColours.color_199095),
|
|
|
|
1395
|
+ textAlign: TextAlign.right,
|
|
|
|
1396
|
+ decoration: InputDecoration(
|
|
|
|
1397
|
+ hintText: "修改",
|
|
|
|
1398
|
+ hintStyle: TextStyle(
|
|
|
|
1399
|
+ color: MyColours.color_199095,
|
|
|
|
1400
|
+ fontSize: ScreenUtil().setSp(30),
|
|
|
|
1401
|
+ ),
|
|
|
|
1402
|
+ prefixIcon: detailModel.strTF != null &&
|
|
|
|
1403
|
+ detailModel.strTF.trim().length > 0
|
|
|
|
1404
|
+ ? Text("¥",
|
|
|
|
1405
|
+ style: TextStyle(color: MyColours.color_199095))
|
|
|
|
1406
|
+ : SizedBox(), //添加内部左边图标
|
|
|
|
1407
|
+ prefixIconConstraints: BoxConstraints(
|
|
|
|
1408
|
+ //添加内部图标之后,图标和文字会有间距,实现这个方法,不用写任何参数即可解决
|
|
|
|
1409
|
+ ),
|
|
1322
|
|
1410
|
|
|
1323
|
-// },
|
|
|
|
1324
|
-// onEditingComplete: () {
|
|
|
|
1325
|
-// // _cancelNode.unfocus();
|
1411
|
+ // contentPadding: EdgeInsets.only(
|
|
|
|
1412
|
+ // bottom: ScreenUtil().setWidth(30)), //ios 17
|
|
|
|
1413
|
+ border: InputBorder.none,
|
|
|
|
1414
|
+ ),
|
|
|
|
1415
|
+ onChanged: (value) {
|
|
|
|
1416
|
+ detailModel.strTF = value;
|
|
1326
|
|
1417
|
|
|
1327
|
-// },
|
|
|
|
1328
|
-// keyboardType: TextInputType.number,
|
|
|
|
1329
|
-// ),
|
|
|
|
1330
|
-// ) |
1418
|
+ print(detailModel.numController.text);
|
|
|
|
1419
|
+ detailModel.notifyListeners();
|
|
|
|
1420
|
+ },
|
|
|
|
1421
|
+ onEditingComplete: () {
|
|
|
|
1422
|
+ FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
|
|
|
|
1423
|
+ if (detailModel.prestrTF == null ||
|
|
|
|
1424
|
+ detailModel.prestrTF == "") {
|
|
|
|
1425
|
+ //修改之前无内容,不弹框
|
|
|
|
1426
|
+ detailModel.prestrTF = detailModel.numController.text;
|
|
|
|
1427
|
+ callback();
|
|
|
|
1428
|
+ } else {
|
|
|
|
1429
|
+ //修改之前有内容,则弹框
|
|
|
|
1430
|
+ DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
1431
|
+ title: "是否修改",
|
|
|
|
1432
|
+ content: "金额已修改,是否保存为新修改的金额",
|
|
|
|
1433
|
+ lTitle: "不保存",
|
|
|
|
1434
|
+ rTitle: "确认修改", lCallback: () {
|
|
|
|
1435
|
+ print("取消");
|
|
|
|
1436
|
+ detailModel.numController.text =
|
|
|
|
1437
|
+ detailModel.prestrTF == null
|
|
|
|
1438
|
+ ? ""
|
|
|
|
1439
|
+ : detailModel.prestrTF;
|
|
|
|
1440
|
+ detailModel.strTF = detailModel.numController.text;
|
|
|
|
1441
|
+ }, rCallback: () {
|
|
|
|
1442
|
+ print("确定");
|
|
|
|
1443
|
+ detailModel.prestrTF = detailModel.numController.text;
|
|
|
|
1444
|
+ callback();
|
|
|
|
1445
|
+ });
|
|
|
|
1446
|
+ }
|
|
|
|
1447
|
+ },
|
|
|
|
1448
|
+ keyboardType: TextInputType.number,
|
|
|
|
1449
|
+ )))
|
|
|
|
1450
|
+ ]));
|
|
|
|
1451
|
+ }
|
|
|
|
1452
|
+} |