|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_picker/flutter_picker.dart';
|
|
...
|
...
|
@@ -235,23 +237,6 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///编辑订单附加信息
|
|
|
|
Future<bool> _upReserveInfo({String actualPum, String conAmount}) async {
|
|
|
|
Map<String, dynamic> params = {
|
|
|
|
"rid": widget.rid,
|
|
|
|
};
|
|
|
|
if (actualPum != null) {
|
|
|
|
params['actual_pum'] = actualPum;
|
|
|
|
}
|
|
|
|
if (conAmount != null) {
|
|
|
|
params['con_amount'] = conAmount;
|
|
|
|
}
|
|
|
|
bool sucess = await detailModel.upReserveInfo(context, params);
|
|
|
|
if (sucess) {
|
|
|
|
Utils.showToast("修改成功!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 取消预订, 变更预订按钮
|
|
|
|
Widget _cancelAndChangeBtn(GestureTapCallback onTap, String title,
|
|
|
|
{Color bgColor = MyColours.color_ffffff,
|
|
...
|
...
|
@@ -505,6 +490,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
|
|
print(widget.rid);
|
|
|
|
print(widget.uid);
|
|
|
|
return Scaffold(
|
|
|
|
resizeToAvoidBottomInset: false,
|
|
|
|
body: SafeArea(
|
|
|
|
child: WillPopScope(
|
|
|
|
child: Container(
|
|
...
|
...
|
@@ -581,7 +567,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
|
|
pnumlist: personNumList,
|
|
|
|
detailModel: model,
|
|
|
|
callback: () {
|
|
|
|
_upReserveInfo(
|
|
|
|
detailModel.upReserveInfo(context,
|
|
|
|
rid: widget.rid,
|
|
|
|
actualPum:
|
|
|
|
detailModel.selectNum);
|
|
|
|
},
|
|
...
|
...
|
@@ -668,11 +655,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
|
|
TitleAndTextfield(
|
|
|
|
title: "消费金额",
|
|
|
|
detailModel: detailModel,
|
|
|
|
callback: () {
|
|
|
|
_upReserveInfo(
|
|
|
|
conAmount:
|
|
|
|
detailModel.prestrTF);
|
|
|
|
},
|
|
|
|
rid: widget.rid,
|
|
|
|
),
|
|
|
|
RowMultiText(
|
|
|
|
"客户姓名", detailEntity.rnameStr),
|
|
...
|
...
|
@@ -1332,12 +1315,12 @@ class TitleAndBtn extends StatelessWidget { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class TitleAndTextfield extends StatelessWidget {
|
|
|
|
class TitleAndTextfield extends StatefulWidget {
|
|
|
|
final String title;
|
|
|
|
final String bookNum;
|
|
|
|
final List<String> pnumlist;
|
|
|
|
final NotebookDetailModel detailModel;
|
|
|
|
final VoidCallback callback;
|
|
|
|
final String rid;
|
|
|
|
|
|
|
|
const TitleAndTextfield(
|
|
|
|
{Key key,
|
|
...
|
...
|
@@ -1345,10 +1328,89 @@ class TitleAndTextfield extends StatelessWidget { |
|
|
|
this.bookNum,
|
|
|
|
this.pnumlist,
|
|
|
|
this.detailModel,
|
|
|
|
this.callback})
|
|
|
|
this.rid})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_TitleAndTextfieldState createState() => _TitleAndTextfieldState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _TitleAndTextfieldState extends State<TitleAndTextfield> {
|
|
|
|
FocusNode numberFocusNode = new FocusNode();
|
|
|
|
OverlayEntry overlayEntry;
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
numberFocusNode.addListener(() {
|
|
|
|
if (numberFocusNode.hasFocus) {
|
|
|
|
showOverlay(context);
|
|
|
|
} else {
|
|
|
|
removeOverlay();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
showOverlay(BuildContext context) {
|
|
|
|
if (overlayEntry != null) return;
|
|
|
|
OverlayState overlayState = Overlay.of(context);
|
|
|
|
overlayEntry = OverlayEntry(builder: (context) {
|
|
|
|
return Positioned(
|
|
|
|
bottom: MediaQuery.of(context).viewInsets.bottom,
|
|
|
|
right: 0.0,
|
|
|
|
left: 0.0,
|
|
|
|
child: InputDoneView(
|
|
|
|
callback: () {
|
|
|
|
_updateMoney();
|
|
|
|
},
|
|
|
|
));
|
|
|
|
});
|
|
|
|
|
|
|
|
overlayState.insert(overlayEntry);
|
|
|
|
}
|
|
|
|
|
|
|
|
removeOverlay() {
|
|
|
|
if (overlayEntry != null) {
|
|
|
|
overlayEntry.remove();
|
|
|
|
overlayEntry = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 修改金额
|
|
|
|
_updateMoney() {
|
|
|
|
if (widget.detailModel.prestrTF == null ||
|
|
|
|
widget.detailModel.prestrTF == "") {
|
|
|
|
if (widget.detailModel.numController.text.trim().length > 0) {
|
|
|
|
//修改之前无内容,不弹框
|
|
|
|
widget.detailModel.prestrTF = widget.detailModel.numController.text;
|
|
|
|
widget.detailModel.upReserveInfo(context,
|
|
|
|
rid: widget.rid, conAmount: widget.detailModel.prestrTF);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//修改之前有内容,则弹框
|
|
|
|
DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
title: "是否修改",
|
|
|
|
content: "金额已修改,是否保存为新修改的金额",
|
|
|
|
lTitle: "不保存",
|
|
|
|
rTitle: "确认修改", lCallback: () {
|
|
|
|
print("取消");
|
|
|
|
widget.detailModel.numController.text =
|
|
|
|
widget.detailModel.prestrTF == null
|
|
|
|
? ""
|
|
|
|
: widget.detailModel.prestrTF;
|
|
|
|
widget.detailModel.strTF = widget.detailModel.numController.text;
|
|
|
|
}, rCallback: () {
|
|
|
|
print("确定");
|
|
|
|
widget.detailModel.prestrTF = widget.detailModel.numController.text;
|
|
|
|
widget.detailModel.upReserveInfo(context,
|
|
|
|
rid: widget.rid, conAmount: widget.detailModel.prestrTF);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
...
|
...
|
@@ -1362,30 +1424,41 @@ class TitleAndTextfield extends StatelessWidget { |
|
|
|
Align(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
widget.title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_828282,
|
|
|
|
fontSize: ScreenUtil().setSp(30)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// Spacer(),
|
|
|
|
// widget.detailModel.strTF != null &&
|
|
|
|
// widget.detailModel.strTF.trim().length > 0
|
|
|
|
// ? Text("¥", style: TextStyle(color: MyColours.color_199095))
|
|
|
|
// : SizedBox(),
|
|
|
|
Container(
|
|
|
|
constraints:
|
|
|
|
BoxConstraints(maxHeight: ScreenUtil().setWidth(80)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
// color: Colors.red,
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_199095))),
|
|
|
|
child: IntrinsicWidth(
|
|
|
|
child: TextField(
|
|
|
|
controller: detailModel.numController,
|
|
|
|
controller: widget.detailModel.numController,
|
|
|
|
maxLines: 1,
|
|
|
|
// inputFormatters: [
|
|
|
|
// LengthLimitingTextInputFormatter(9),
|
|
|
|
// WhitelistingTextInputFormatter.digitsOnly
|
|
|
|
// ],
|
|
|
|
|
|
|
|
inputFormatters: [
|
|
|
|
NumLengthInputFormatter(
|
|
|
|
decimalLength: 2, integerLength: 6),
|
|
|
|
],
|
|
|
|
focusNode: numberFocusNode,
|
|
|
|
|
|
|
|
//光标颜色
|
|
|
|
cursorColor: MyColours.color_199095,
|
|
|
|
//输入文本的样式
|
|
...
|
...
|
@@ -1399,54 +1472,68 @@ class TitleAndTextfield extends StatelessWidget { |
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
),
|
|
|
|
prefixIcon: detailModel.strTF != null &&
|
|
|
|
detailModel.strTF.trim().length > 0
|
|
|
|
prefix: widget.detailModel.strTF != null &&
|
|
|
|
widget.detailModel.strTF.trim().length > 0
|
|
|
|
? Text("¥",
|
|
|
|
style: TextStyle(color: MyColours.color_199095))
|
|
|
|
: SizedBox(), //添加内部左边图标
|
|
|
|
prefixIconConstraints: BoxConstraints(
|
|
|
|
//添加内部图标之后,图标和文字会有间距,实现这个方法,不用写任何参数即可解决
|
|
|
|
),
|
|
|
|
: SizedBox(),
|
|
|
|
|
|
|
|
// prefixIcon: widget.detailModel.strTF != null &&
|
|
|
|
// widget.detailModel.strTF.trim().length > 0
|
|
|
|
// ? Text("¥",
|
|
|
|
// style: TextStyle(color: MyColours.color_199095))
|
|
|
|
// : SizedBox(), //添加内部左边图标
|
|
|
|
// prefixIconConstraints:
|
|
|
|
// BoxConstraints(maxHeight: ScreenUtil().setWidth(20)
|
|
|
|
// //添加内部图标之后,图标和文字会有间距,实现这个方法,不用写任何参数即可解决
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// contentPadding: EdgeInsets.only(
|
|
|
|
// bottom: ScreenUtil().setWidth(30)), //ios 17
|
|
|
|
contentPadding: EdgeInsets.zero, //ios 17
|
|
|
|
border: InputBorder.none,
|
|
|
|
),
|
|
|
|
onChanged: (value) {
|
|
|
|
detailModel.strTF = value;
|
|
|
|
widget.detailModel.strTF = value;
|
|
|
|
|
|
|
|
print(detailModel.numController.text);
|
|
|
|
detailModel.notifyListeners();
|
|
|
|
print(widget.detailModel.numController.text);
|
|
|
|
widget.detailModel.notifyListeners();
|
|
|
|
},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
|
|
|
|
if (detailModel.prestrTF == null ||
|
|
|
|
detailModel.prestrTF == "") {
|
|
|
|
//修改之前无内容,不弹框
|
|
|
|
detailModel.prestrTF = detailModel.numController.text;
|
|
|
|
callback();
|
|
|
|
} else {
|
|
|
|
//修改之前有内容,则弹框
|
|
|
|
DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
title: "是否修改",
|
|
|
|
content: "金额已修改,是否保存为新修改的金额",
|
|
|
|
lTitle: "不保存",
|
|
|
|
rTitle: "确认修改", lCallback: () {
|
|
|
|
print("取消");
|
|
|
|
detailModel.numController.text =
|
|
|
|
detailModel.prestrTF == null
|
|
|
|
? ""
|
|
|
|
: detailModel.prestrTF;
|
|
|
|
detailModel.strTF = detailModel.numController.text;
|
|
|
|
}, rCallback: () {
|
|
|
|
print("确定");
|
|
|
|
detailModel.prestrTF = detailModel.numController.text;
|
|
|
|
callback();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
_updateMoney();
|
|
|
|
},
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
keyboardType:
|
|
|
|
TextInputType.numberWithOptions(decimal: true),
|
|
|
|
)))
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class InputDoneView extends StatelessWidget {
|
|
|
|
final VoidCallback callback;
|
|
|
|
const InputDoneView({Key key, this.callback}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Align(
|
|
|
|
alignment: Alignment.topRight,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 4.0, bottom: 4.0),
|
|
|
|
child: CupertinoButton(
|
|
|
|
padding: EdgeInsets.only(right: 24.0, top: 8.0, bottom: 8.0),
|
|
|
|
onPressed: () {
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
callback();
|
|
|
|
},
|
|
|
|
child: Text("完成",
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|