|
...
|
...
|
@@ -13,6 +13,7 @@ import 'package:one_key/provider/notebook_detail_model.dart'; |
|
|
|
import 'package:one_key/provider/online_check_edit_provider.dart';
|
|
|
|
import 'package:one_key/provider/user_model.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/utils/NumLengthInputFormatter.dart';
|
|
|
|
import 'package:one_key/utils/dialog_util.dart';
|
|
|
|
import 'package:one_key/utils/event_bus.dart';
|
|
|
|
import 'package:one_key/route/navigator_util.dart';
|
|
...
|
...
|
@@ -77,6 +78,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
_initCancel();
|
|
|
|
_getReserveDetail();
|
|
...
|
...
|
@@ -145,6 +147,20 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
|
|
"rid": widget.rid,
|
|
|
|
});
|
|
|
|
setState(() {
|
|
|
|
detailModel.selectNum = detailEntity.actual_pum;
|
|
|
|
detailModel.selectIndex = detailEntity.actual_pum != null
|
|
|
|
? personNumList.indexOf(detailEntity.actual_pum)
|
|
|
|
: null;
|
|
|
|
if (detailEntity.con_amount != null) {
|
|
|
|
detailModel.prestrTF = detailEntity.con_amount;
|
|
|
|
detailModel.numController.text = detailEntity.con_amount;
|
|
|
|
}
|
|
|
|
if (detailEntity.con_amount != null) {
|
|
|
|
detailModel.prestrTF = detailEntity.con_amount;
|
|
|
|
detailModel.strTF = detailEntity.con_amount;
|
|
|
|
detailModel.numController.text = detailEntity.con_amount;
|
|
|
|
}
|
|
|
|
|
|
|
|
cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
|
|
|
|
formatPhone = detailEntity.phone;
|
|
|
|
if (App.sp.getString("is_call_tel") != null &&
|
|
...
|
...
|
@@ -219,6 +235,23 @@ 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,
|
|
...
|
...
|
@@ -542,11 +575,16 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
|
|
offstage: detailEntity.type == "0"
|
|
|
|
? false
|
|
|
|
: true,
|
|
|
|
child: TitleAndTextfield(
|
|
|
|
child: TitleAndBtn(
|
|
|
|
title: "用餐人数",
|
|
|
|
bookNum: detailEntity.pnum,
|
|
|
|
pnumlist: personNumList,
|
|
|
|
detailModel: model,
|
|
|
|
callback: () {
|
|
|
|
_upReserveInfo(
|
|
|
|
actualPum:
|
|
|
|
detailModel.selectNum);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Offstage(
|
|
...
|
...
|
@@ -627,6 +665,15 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
TitleAndTextfield(
|
|
|
|
title: "消费金额",
|
|
|
|
detailModel: detailModel,
|
|
|
|
callback: () {
|
|
|
|
_upReserveInfo(
|
|
|
|
conAmount:
|
|
|
|
detailModel.prestrTF);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
RowMultiText(
|
|
|
|
"客户姓名", detailEntity.rnameStr),
|
|
|
|
InkWell(
|
|
...
|
...
|
@@ -1192,13 +1239,19 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class TitleAndTextfield extends StatelessWidget {
|
|
|
|
class TitleAndBtn extends StatelessWidget {
|
|
|
|
final String title;
|
|
|
|
final String bookNum;
|
|
|
|
final List<String> pnumlist;
|
|
|
|
final NotebookDetailModel detailModel;
|
|
|
|
const TitleAndTextfield(
|
|
|
|
{Key key, this.title, this.bookNum, this.pnumlist, this.detailModel})
|
|
|
|
final VoidCallback callback;
|
|
|
|
const TitleAndBtn(
|
|
|
|
{Key key,
|
|
|
|
this.title,
|
|
|
|
this.bookNum,
|
|
|
|
this.pnumlist,
|
|
|
|
this.detailModel,
|
|
|
|
this.callback})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
...
|
...
|
@@ -1234,18 +1287,19 @@ class TitleAndTextfield extends StatelessWidget { |
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
|
|
|
|
DialogUtil.showSelectCusmanDialog(context, pnumlist, (value) {
|
|
|
|
if (value != null) {
|
|
|
|
detailModel.selectNum = value.first;
|
|
|
|
detailModel.selectIndex = value.first;
|
|
|
|
detailModel.selectNum = pnumlist[value.first];
|
|
|
|
detailModel.notifyListeners();
|
|
|
|
// setState(() {
|
|
|
|
// selectPnum = value.first;
|
|
|
|
// pnum = pnumlist[value.first];
|
|
|
|
// });
|
|
|
|
|
|
|
|
callback();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selecteds: detailModel.selectNum == null
|
|
|
|
selecteds: detailModel.selectIndex == null
|
|
|
|
? []
|
|
|
|
: [detailModel.selectNum])
|
|
|
|
: [detailModel.selectIndex])
|
|
|
|
.then((value) {});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
...
|
...
|
@@ -1277,54 +1331,122 @@ class TitleAndTextfield extends StatelessWidget { |
|
|
|
]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Container(
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// // color: Colors.red,
|
|
|
|
// width: ScreenUtil().setWidth(114),
|
|
|
|
// height: ScreenUtil().setWidth(50),
|
|
|
|
// // padding: EdgeInsets.zero,
|
|
|
|
// child: TextField(
|
|
|
|
// controller: widget.model.numController,
|
|
|
|
// maxLines: 1,
|
|
|
|
|
|
|
|
// inputFormatters: [
|
|
|
|
// LengthLimitingTextInputFormatter(3),
|
|
|
|
// WhitelistingTextInputFormatter.digitsOnly
|
|
|
|
// ],
|
|
|
|
// //光标颜色
|
|
|
|
// cursorColor:
|
|
|
|
// MyColours.color_199095,
|
|
|
|
// //输入文本的样式
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: ScreenUtil().setSp(30),
|
|
|
|
// color: widget.isSelect
|
|
|
|
// ? Colors.white
|
|
|
|
// : MyColours.color_199095),
|
|
|
|
// // controller: _cancelController,
|
|
|
|
// focusNode: _cancelNode,
|
|
|
|
// textAlignVertical: TextAlignVertical.bottom,
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
// // fillColor: Colors.lightGreenAccent,
|
|
|
|
// // filled: true,
|
|
|
|
// border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
// hintText: "更多",
|
|
|
|
// hintStyle: TextStyle(
|
|
|
|
// color: widget.isSelect
|
|
|
|
// ? Colors.white
|
|
|
|
// : MyColours.color_199095,
|
|
|
|
// fontSize: ScreenUtil().setSp(30),
|
|
|
|
// ),
|
|
|
|
// // contentPadding: EdgeInsets.only(
|
|
|
|
// // bottom: ScreenUtil().setWidth(30)), //ios 17
|
|
|
|
// // border: InputBorder.none,
|
|
|
|
// ),
|
|
|
|
// onChanged: (value) {
|
|
|
|
class TitleAndTextfield extends StatelessWidget {
|
|
|
|
final String title;
|
|
|
|
final String bookNum;
|
|
|
|
final List<String> pnumlist;
|
|
|
|
final NotebookDetailModel detailModel;
|
|
|
|
final VoidCallback callback;
|
|
|
|
|
|
|
|
const TitleAndTextfield(
|
|
|
|
{Key key,
|
|
|
|
this.title,
|
|
|
|
this.bookNum,
|
|
|
|
this.pnumlist,
|
|
|
|
this.detailModel,
|
|
|
|
this.callback})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(25)),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: <Widget>[
|
|
|
|
Align(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_828282,
|
|
|
|
fontSize: ScreenUtil().setSp(30)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_199095))),
|
|
|
|
child: IntrinsicWidth(
|
|
|
|
child: TextField(
|
|
|
|
controller: detailModel.numController,
|
|
|
|
maxLines: 1,
|
|
|
|
// inputFormatters: [
|
|
|
|
// LengthLimitingTextInputFormatter(9),
|
|
|
|
// WhitelistingTextInputFormatter.digitsOnly
|
|
|
|
// ],
|
|
|
|
inputFormatters: [
|
|
|
|
NumLengthInputFormatter(
|
|
|
|
decimalLength: 2, integerLength: 6),
|
|
|
|
],
|
|
|
|
//光标颜色
|
|
|
|
cursorColor: MyColours.color_199095,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
color: MyColours.color_199095),
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "修改",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
),
|
|
|
|
prefixIcon: detailModel.strTF != null &&
|
|
|
|
detailModel.strTF.trim().length > 0
|
|
|
|
? Text("¥",
|
|
|
|
style: TextStyle(color: MyColours.color_199095))
|
|
|
|
: SizedBox(), //添加内部左边图标
|
|
|
|
prefixIconConstraints: BoxConstraints(
|
|
|
|
//添加内部图标之后,图标和文字会有间距,实现这个方法,不用写任何参数即可解决
|
|
|
|
),
|
|
|
|
|
|
|
|
// },
|
|
|
|
// onEditingComplete: () {
|
|
|
|
// // _cancelNode.unfocus();
|
|
|
|
// contentPadding: EdgeInsets.only(
|
|
|
|
// bottom: ScreenUtil().setWidth(30)), //ios 17
|
|
|
|
border: InputBorder.none,
|
|
|
|
),
|
|
|
|
onChanged: (value) {
|
|
|
|
detailModel.strTF = value;
|
|
|
|
|
|
|
|
// },
|
|
|
|
// keyboardType: TextInputType.number,
|
|
|
|
// ),
|
|
|
|
// ) |
|
|
|
print(detailModel.numController.text);
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
)))
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|