|
1
|
import 'dart:convert';
|
1
|
import 'dart:convert';
|
|
|
|
2
|
+import 'dart:io';
|
|
2
|
|
3
|
|
|
3
|
import 'package:common_utils/common_utils.dart';
|
4
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
5
|
+import 'package:flutter/cupertino.dart';
|
|
4
|
import 'package:flutter/material.dart';
|
6
|
import 'package:flutter/material.dart';
|
|
5
|
import 'package:flutter/services.dart';
|
7
|
import 'package:flutter/services.dart';
|
|
6
|
import 'package:flutter_picker/flutter_picker.dart';
|
8
|
import 'package:flutter_picker/flutter_picker.dart';
|
|
@@ -235,23 +237,6 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -235,23 +237,6 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
235
|
}
|
237
|
}
|
|
236
|
}
|
238
|
}
|
|
237
|
|
239
|
|
|
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
|
-
|
|
|
|
255
|
/// 取消预订, 变更预订按钮
|
240
|
/// 取消预订, 变更预订按钮
|
|
256
|
Widget _cancelAndChangeBtn(GestureTapCallback onTap, String title,
|
241
|
Widget _cancelAndChangeBtn(GestureTapCallback onTap, String title,
|
|
257
|
{Color bgColor = MyColours.color_ffffff,
|
242
|
{Color bgColor = MyColours.color_ffffff,
|
|
@@ -505,6 +490,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -505,6 +490,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
505
|
print(widget.rid);
|
490
|
print(widget.rid);
|
|
506
|
print(widget.uid);
|
491
|
print(widget.uid);
|
|
507
|
return Scaffold(
|
492
|
return Scaffold(
|
|
|
|
493
|
+ resizeToAvoidBottomInset: false,
|
|
508
|
body: SafeArea(
|
494
|
body: SafeArea(
|
|
509
|
child: WillPopScope(
|
495
|
child: WillPopScope(
|
|
510
|
child: Container(
|
496
|
child: Container(
|
|
@@ -581,7 +567,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -581,7 +567,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
581
|
pnumlist: personNumList,
|
567
|
pnumlist: personNumList,
|
|
582
|
detailModel: model,
|
568
|
detailModel: model,
|
|
583
|
callback: () {
|
569
|
callback: () {
|
|
584
|
- _upReserveInfo(
|
570
|
+ detailModel.upReserveInfo(context,
|
|
|
|
571
|
+ rid: widget.rid,
|
|
585
|
actualPum:
|
572
|
actualPum:
|
|
586
|
detailModel.selectNum);
|
573
|
detailModel.selectNum);
|
|
587
|
},
|
574
|
},
|
|
@@ -668,11 +655,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -668,11 +655,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
668
|
TitleAndTextfield(
|
655
|
TitleAndTextfield(
|
|
669
|
title: "消费金额",
|
656
|
title: "消费金额",
|
|
670
|
detailModel: detailModel,
|
657
|
detailModel: detailModel,
|
|
671
|
- callback: () {
|
|
|
|
672
|
- _upReserveInfo(
|
|
|
|
673
|
- conAmount:
|
|
|
|
674
|
- detailModel.prestrTF);
|
|
|
|
675
|
- },
|
658
|
+ rid: widget.rid,
|
|
676
|
),
|
659
|
),
|
|
677
|
RowMultiText(
|
660
|
RowMultiText(
|
|
678
|
"客户姓名", detailEntity.rnameStr),
|
661
|
"客户姓名", detailEntity.rnameStr),
|
|
@@ -1332,12 +1315,12 @@ class TitleAndBtn extends StatelessWidget { |
|
@@ -1332,12 +1315,12 @@ class TitleAndBtn extends StatelessWidget { |
|
1332
|
}
|
1315
|
}
|
|
1333
|
}
|
1316
|
}
|
|
1334
|
|
1317
|
|
|
1335
|
-class TitleAndTextfield extends StatelessWidget {
|
1318
|
+class TitleAndTextfield extends StatefulWidget {
|
|
1336
|
final String title;
|
1319
|
final String title;
|
|
1337
|
final String bookNum;
|
1320
|
final String bookNum;
|
|
1338
|
final List<String> pnumlist;
|
1321
|
final List<String> pnumlist;
|
|
1339
|
final NotebookDetailModel detailModel;
|
1322
|
final NotebookDetailModel detailModel;
|
|
1340
|
- final VoidCallback callback;
|
1323
|
+ final String rid;
|
|
1341
|
|
1324
|
|
|
1342
|
const TitleAndTextfield(
|
1325
|
const TitleAndTextfield(
|
|
1343
|
{Key key,
|
1326
|
{Key key,
|
|
@@ -1345,10 +1328,89 @@ class TitleAndTextfield extends StatelessWidget { |
|
@@ -1345,10 +1328,89 @@ class TitleAndTextfield extends StatelessWidget { |
|
1345
|
this.bookNum,
|
1328
|
this.bookNum,
|
|
1346
|
this.pnumlist,
|
1329
|
this.pnumlist,
|
|
1347
|
this.detailModel,
|
1330
|
this.detailModel,
|
|
1348
|
- this.callback})
|
1331
|
+ this.rid})
|
|
1349
|
: super(key: key);
|
1332
|
: super(key: key);
|
|
1350
|
|
1333
|
|
|
1351
|
@override
|
1334
|
@override
|
|
|
|
1335
|
+ _TitleAndTextfieldState createState() => _TitleAndTextfieldState();
|
|
|
|
1336
|
+}
|
|
|
|
1337
|
+
|
|
|
|
1338
|
+class _TitleAndTextfieldState extends State<TitleAndTextfield> {
|
|
|
|
1339
|
+ FocusNode numberFocusNode = new FocusNode();
|
|
|
|
1340
|
+ OverlayEntry overlayEntry;
|
|
|
|
1341
|
+ @override
|
|
|
|
1342
|
+ void initState() {
|
|
|
|
1343
|
+ super.initState();
|
|
|
|
1344
|
+
|
|
|
|
1345
|
+ if (Platform.isIOS) {
|
|
|
|
1346
|
+ numberFocusNode.addListener(() {
|
|
|
|
1347
|
+ if (numberFocusNode.hasFocus) {
|
|
|
|
1348
|
+ showOverlay(context);
|
|
|
|
1349
|
+ } else {
|
|
|
|
1350
|
+ removeOverlay();
|
|
|
|
1351
|
+ }
|
|
|
|
1352
|
+ });
|
|
|
|
1353
|
+ }
|
|
|
|
1354
|
+ }
|
|
|
|
1355
|
+
|
|
|
|
1356
|
+ showOverlay(BuildContext context) {
|
|
|
|
1357
|
+ if (overlayEntry != null) return;
|
|
|
|
1358
|
+ OverlayState overlayState = Overlay.of(context);
|
|
|
|
1359
|
+ overlayEntry = OverlayEntry(builder: (context) {
|
|
|
|
1360
|
+ return Positioned(
|
|
|
|
1361
|
+ bottom: MediaQuery.of(context).viewInsets.bottom,
|
|
|
|
1362
|
+ right: 0.0,
|
|
|
|
1363
|
+ left: 0.0,
|
|
|
|
1364
|
+ child: InputDoneView(
|
|
|
|
1365
|
+ callback: () {
|
|
|
|
1366
|
+ _updateMoney();
|
|
|
|
1367
|
+ },
|
|
|
|
1368
|
+ ));
|
|
|
|
1369
|
+ });
|
|
|
|
1370
|
+
|
|
|
|
1371
|
+ overlayState.insert(overlayEntry);
|
|
|
|
1372
|
+ }
|
|
|
|
1373
|
+
|
|
|
|
1374
|
+ removeOverlay() {
|
|
|
|
1375
|
+ if (overlayEntry != null) {
|
|
|
|
1376
|
+ overlayEntry.remove();
|
|
|
|
1377
|
+ overlayEntry = null;
|
|
|
|
1378
|
+ }
|
|
|
|
1379
|
+ }
|
|
|
|
1380
|
+
|
|
|
|
1381
|
+ /// 修改金额
|
|
|
|
1382
|
+ _updateMoney() {
|
|
|
|
1383
|
+ if (widget.detailModel.prestrTF == null ||
|
|
|
|
1384
|
+ widget.detailModel.prestrTF == "") {
|
|
|
|
1385
|
+ if (widget.detailModel.numController.text.trim().length > 0) {
|
|
|
|
1386
|
+ //修改之前无内容,不弹框
|
|
|
|
1387
|
+ widget.detailModel.prestrTF = widget.detailModel.numController.text;
|
|
|
|
1388
|
+ widget.detailModel.upReserveInfo(context,
|
|
|
|
1389
|
+ rid: widget.rid, conAmount: widget.detailModel.prestrTF);
|
|
|
|
1390
|
+ }
|
|
|
|
1391
|
+ } else {
|
|
|
|
1392
|
+ //修改之前有内容,则弹框
|
|
|
|
1393
|
+ DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
1394
|
+ title: "是否修改",
|
|
|
|
1395
|
+ content: "金额已修改,是否保存为新修改的金额",
|
|
|
|
1396
|
+ lTitle: "不保存",
|
|
|
|
1397
|
+ rTitle: "确认修改", lCallback: () {
|
|
|
|
1398
|
+ print("取消");
|
|
|
|
1399
|
+ widget.detailModel.numController.text =
|
|
|
|
1400
|
+ widget.detailModel.prestrTF == null
|
|
|
|
1401
|
+ ? ""
|
|
|
|
1402
|
+ : widget.detailModel.prestrTF;
|
|
|
|
1403
|
+ widget.detailModel.strTF = widget.detailModel.numController.text;
|
|
|
|
1404
|
+ }, rCallback: () {
|
|
|
|
1405
|
+ print("确定");
|
|
|
|
1406
|
+ widget.detailModel.prestrTF = widget.detailModel.numController.text;
|
|
|
|
1407
|
+ widget.detailModel.upReserveInfo(context,
|
|
|
|
1408
|
+ rid: widget.rid, conAmount: widget.detailModel.prestrTF);
|
|
|
|
1409
|
+ });
|
|
|
|
1410
|
+ }
|
|
|
|
1411
|
+ }
|
|
|
|
1412
|
+
|
|
|
|
1413
|
+ @override
|
|
1352
|
Widget build(BuildContext context) {
|
1414
|
Widget build(BuildContext context) {
|
|
1353
|
return Container(
|
1415
|
return Container(
|
|
1354
|
color: MyColours.color_ffffff,
|
1416
|
color: MyColours.color_ffffff,
|
|
@@ -1362,30 +1424,41 @@ class TitleAndTextfield extends StatelessWidget { |
|
@@ -1362,30 +1424,41 @@ class TitleAndTextfield extends StatelessWidget { |
|
1362
|
Align(
|
1424
|
Align(
|
|
1363
|
alignment: Alignment.centerLeft,
|
1425
|
alignment: Alignment.centerLeft,
|
|
1364
|
child: Text(
|
1426
|
child: Text(
|
|
1365
|
- title,
|
1427
|
+ widget.title,
|
|
1366
|
style: TextStyle(
|
1428
|
style: TextStyle(
|
|
1367
|
color: MyColours.color_828282,
|
1429
|
color: MyColours.color_828282,
|
|
1368
|
fontSize: ScreenUtil().setSp(30)),
|
1430
|
fontSize: ScreenUtil().setSp(30)),
|
|
1369
|
),
|
1431
|
),
|
|
1370
|
),
|
1432
|
),
|
|
|
|
1433
|
+ // Spacer(),
|
|
|
|
1434
|
+ // widget.detailModel.strTF != null &&
|
|
|
|
1435
|
+ // widget.detailModel.strTF.trim().length > 0
|
|
|
|
1436
|
+ // ? Text("¥", style: TextStyle(color: MyColours.color_199095))
|
|
|
|
1437
|
+ // : SizedBox(),
|
|
1371
|
Container(
|
1438
|
Container(
|
|
|
|
1439
|
+ constraints:
|
|
|
|
1440
|
+ BoxConstraints(maxHeight: ScreenUtil().setWidth(80)),
|
|
1372
|
decoration: BoxDecoration(
|
1441
|
decoration: BoxDecoration(
|
|
|
|
1442
|
+ // color: Colors.red,
|
|
1373
|
border: Border(
|
1443
|
border: Border(
|
|
1374
|
bottom: BorderSide(
|
1444
|
bottom: BorderSide(
|
|
1375
|
width: ScreenUtil().setWidth(2),
|
1445
|
width: ScreenUtil().setWidth(2),
|
|
1376
|
color: MyColours.color_199095))),
|
1446
|
color: MyColours.color_199095))),
|
|
1377
|
child: IntrinsicWidth(
|
1447
|
child: IntrinsicWidth(
|
|
1378
|
child: TextField(
|
1448
|
child: TextField(
|
|
1379
|
- controller: detailModel.numController,
|
1449
|
+ controller: widget.detailModel.numController,
|
|
1380
|
maxLines: 1,
|
1450
|
maxLines: 1,
|
|
1381
|
// inputFormatters: [
|
1451
|
// inputFormatters: [
|
|
1382
|
// LengthLimitingTextInputFormatter(9),
|
1452
|
// LengthLimitingTextInputFormatter(9),
|
|
1383
|
// WhitelistingTextInputFormatter.digitsOnly
|
1453
|
// WhitelistingTextInputFormatter.digitsOnly
|
|
1384
|
// ],
|
1454
|
// ],
|
|
|
|
1455
|
+
|
|
1385
|
inputFormatters: [
|
1456
|
inputFormatters: [
|
|
1386
|
NumLengthInputFormatter(
|
1457
|
NumLengthInputFormatter(
|
|
1387
|
decimalLength: 2, integerLength: 6),
|
1458
|
decimalLength: 2, integerLength: 6),
|
|
1388
|
],
|
1459
|
],
|
|
|
|
1460
|
+ focusNode: numberFocusNode,
|
|
|
|
1461
|
+
|
|
1389
|
//光标颜色
|
1462
|
//光标颜色
|
|
1390
|
cursorColor: MyColours.color_199095,
|
1463
|
cursorColor: MyColours.color_199095,
|
|
1391
|
//输入文本的样式
|
1464
|
//输入文本的样式
|
|
@@ -1399,54 +1472,68 @@ class TitleAndTextfield extends StatelessWidget { |
|
@@ -1399,54 +1472,68 @@ class TitleAndTextfield extends StatelessWidget { |
|
1399
|
color: MyColours.color_199095,
|
1472
|
color: MyColours.color_199095,
|
|
1400
|
fontSize: ScreenUtil().setSp(30),
|
1473
|
fontSize: ScreenUtil().setSp(30),
|
|
1401
|
),
|
1474
|
),
|
|
1402
|
- prefixIcon: detailModel.strTF != null &&
|
|
|
|
1403
|
- detailModel.strTF.trim().length > 0
|
1475
|
+ prefix: widget.detailModel.strTF != null &&
|
|
|
|
1476
|
+ widget.detailModel.strTF.trim().length > 0
|
|
1404
|
? Text("¥",
|
1477
|
? Text("¥",
|
|
1405
|
style: TextStyle(color: MyColours.color_199095))
|
1478
|
style: TextStyle(color: MyColours.color_199095))
|
|
1406
|
- : SizedBox(), //添加内部左边图标
|
|
|
|
1407
|
- prefixIconConstraints: BoxConstraints(
|
|
|
|
1408
|
- //添加内部图标之后,图标和文字会有间距,实现这个方法,不用写任何参数即可解决
|
|
|
|
1409
|
- ),
|
1479
|
+ : SizedBox(),
|
|
|
|
1480
|
+
|
|
|
|
1481
|
+ // prefixIcon: widget.detailModel.strTF != null &&
|
|
|
|
1482
|
+ // widget.detailModel.strTF.trim().length > 0
|
|
|
|
1483
|
+ // ? Text("¥",
|
|
|
|
1484
|
+ // style: TextStyle(color: MyColours.color_199095))
|
|
|
|
1485
|
+ // : SizedBox(), //添加内部左边图标
|
|
|
|
1486
|
+ // prefixIconConstraints:
|
|
|
|
1487
|
+ // BoxConstraints(maxHeight: ScreenUtil().setWidth(20)
|
|
|
|
1488
|
+ // //添加内部图标之后,图标和文字会有间距,实现这个方法,不用写任何参数即可解决
|
|
|
|
1489
|
+ // ),
|
|
1410
|
|
1490
|
|
|
1411
|
- // contentPadding: EdgeInsets.only(
|
|
|
|
1412
|
- // bottom: ScreenUtil().setWidth(30)), //ios 17
|
1491
|
+ contentPadding: EdgeInsets.zero, //ios 17
|
|
1413
|
border: InputBorder.none,
|
1492
|
border: InputBorder.none,
|
|
1414
|
),
|
1493
|
),
|
|
1415
|
onChanged: (value) {
|
1494
|
onChanged: (value) {
|
|
1416
|
- detailModel.strTF = value;
|
1495
|
+ widget.detailModel.strTF = value;
|
|
1417
|
|
1496
|
|
|
1418
|
- print(detailModel.numController.text);
|
|
|
|
1419
|
- detailModel.notifyListeners();
|
1497
|
+ print(widget.detailModel.numController.text);
|
|
|
|
1498
|
+ widget.detailModel.notifyListeners();
|
|
1420
|
},
|
1499
|
},
|
|
1421
|
onEditingComplete: () {
|
1500
|
onEditingComplete: () {
|
|
1422
|
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
|
1501
|
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
|
- }
|
1502
|
+ _updateMoney();
|
|
1447
|
},
|
1503
|
},
|
|
1448
|
- keyboardType: TextInputType.number,
|
1504
|
+ keyboardType:
|
|
|
|
1505
|
+ TextInputType.numberWithOptions(decimal: true),
|
|
1449
|
)))
|
1506
|
)))
|
|
1450
|
]));
|
1507
|
]));
|
|
1451
|
}
|
1508
|
}
|
|
1452
|
}
|
1509
|
}
|
|
|
|
1510
|
+
|
|
|
|
1511
|
+class InputDoneView extends StatelessWidget {
|
|
|
|
1512
|
+ final VoidCallback callback;
|
|
|
|
1513
|
+ const InputDoneView({Key key, this.callback}) : super(key: key);
|
|
|
|
1514
|
+
|
|
|
|
1515
|
+ @override
|
|
|
|
1516
|
+ Widget build(BuildContext context) {
|
|
|
|
1517
|
+ return Container(
|
|
|
|
1518
|
+ width: double.infinity,
|
|
|
|
1519
|
+ color: Colors.white,
|
|
|
|
1520
|
+ child: Align(
|
|
|
|
1521
|
+ alignment: Alignment.topRight,
|
|
|
|
1522
|
+ child: Padding(
|
|
|
|
1523
|
+ padding: const EdgeInsets.only(top: 4.0, bottom: 4.0),
|
|
|
|
1524
|
+ child: CupertinoButton(
|
|
|
|
1525
|
+ padding: EdgeInsets.only(right: 24.0, top: 8.0, bottom: 8.0),
|
|
|
|
1526
|
+ onPressed: () {
|
|
|
|
1527
|
+ FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
1528
|
+ callback();
|
|
|
|
1529
|
+ },
|
|
|
|
1530
|
+ child: Text("完成",
|
|
|
|
1531
|
+ style: TextStyle(
|
|
|
|
1532
|
+ color: MyColours.color_199095,
|
|
|
|
1533
|
+ fontWeight: FontWeight.bold)),
|
|
|
|
1534
|
+ ),
|
|
|
|
1535
|
+ ),
|
|
|
|
1536
|
+ ),
|
|
|
|
1537
|
+ );
|
|
|
|
1538
|
+ }
|
|
|
|
1539
|
+} |