|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:one_key/provider/user_model.dart';
|
|
|
|
import 'package:one_key/widgets/MyDivider.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../models/reserve_recheck_model.dart';
|
|
|
|
import '../../provider/notebook_detail_model.dart';
|
|
|
|
import '../../res/colors.dart';
|
|
|
|
import '../../utils/event_bus.dart';
|
|
|
|
import '../../utils/screen_util.dart';
|
|
|
|
import '../../utils/utils.dart';
|
|
|
|
import '../../widgets/h_empty_view.dart';
|
|
...
|
...
|
@@ -13,7 +18,8 @@ import '../../widgets/v_empty_view.dart'; |
|
|
|
* 核餐页面
|
|
|
|
* */
|
|
|
|
class VerifyFoodPage extends StatefulWidget {
|
|
|
|
VerifyFoodPage({Key key}) : super(key: key);
|
|
|
|
final String rid;
|
|
|
|
VerifyFoodPage({Key key, this.rid}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_VerifyFoodPageState createState() => _VerifyFoodPageState();
|
|
...
|
...
|
@@ -26,6 +32,17 @@ class _VerifyFoodPageState extends State<VerifyFoodPage> { |
|
|
|
|
|
|
|
TextEditingController customController = TextEditingController();
|
|
|
|
FocusNode _cusdemNode = FocusNode();
|
|
|
|
NotebookDetailModel detailModel;
|
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
|
|
super.initState();
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
_getReserveRecheckByRid();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_itemRadioWidget(bool select, String title, {GestureTapCallback onTap}) {
|
|
|
|
return InkWell(
|
|
...
|
...
|
@@ -44,8 +61,38 @@ class _VerifyFoodPageState extends State<VerifyFoodPage> { |
|
|
|
]));
|
|
|
|
}
|
|
|
|
|
|
|
|
///创建核餐
|
|
|
|
_createReserveRecheck() async {
|
|
|
|
Map<String, String> pramas = {
|
|
|
|
'rid': widget.rid,
|
|
|
|
'uid': Provider.of<UserModel>(context, listen: false).user.openid,
|
|
|
|
'type': confirmed
|
|
|
|
? '1'
|
|
|
|
: connected
|
|
|
|
? '2'
|
|
|
|
: '3', //1 已确认 2 未接通 3 待定
|
|
|
|
'desc': customController.text
|
|
|
|
};
|
|
|
|
bool success = await detailModel.createReserveRecheck(context, pramas);
|
|
|
|
if (success) {
|
|
|
|
Utils.showToast('保存成功');
|
|
|
|
|
|
|
|
bus.emit('refresh_detail_reserve_recheck');
|
|
|
|
Navigator.pop(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取核餐记录
|
|
|
|
_getReserveRecheckByRid() async {
|
|
|
|
Map<String, String> params = {
|
|
|
|
'rid': widget.rid,
|
|
|
|
};
|
|
|
|
await detailModel.getReserveRecheckByRid(context, params);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar('核餐确认'),
|
|
...
|
...
|
@@ -53,149 +100,178 @@ class _VerifyFoodPageState extends State<VerifyFoodPage> { |
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
controller: controller,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(16), vertical: w(24)),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
_itemRadioWidget(confirmed, '已确认', onTap: () {
|
|
|
|
if (!confirmed) {
|
|
|
|
setState(() {
|
|
|
|
confirmed = true;
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(16), vertical: w(24)),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
_itemRadioWidget(confirmed, '已确认', onTap: () {
|
|
|
|
if (!confirmed) {
|
|
|
|
setState(() {
|
|
|
|
confirmed = true;
|
|
|
|
|
|
|
|
connected = false;
|
|
|
|
undetermined = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Spacer(),
|
|
|
|
_itemRadioWidget(connected, '未接通', onTap: () {
|
|
|
|
if (!connected) {
|
|
|
|
setState(() {
|
|
|
|
connected = true;
|
|
|
|
connected = false;
|
|
|
|
undetermined = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Spacer(),
|
|
|
|
_itemRadioWidget(connected, '未接通', onTap: () {
|
|
|
|
if (!connected) {
|
|
|
|
setState(() {
|
|
|
|
connected = true;
|
|
|
|
|
|
|
|
confirmed = false;
|
|
|
|
undetermined = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Spacer(),
|
|
|
|
_itemRadioWidget(undetermined, '待定', onTap: () {
|
|
|
|
if (!undetermined) {
|
|
|
|
setState(() {
|
|
|
|
undetermined = true;
|
|
|
|
connected = false;
|
|
|
|
confirmed = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
confirmed = false;
|
|
|
|
undetermined = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Spacer(),
|
|
|
|
_itemRadioWidget(undetermined, '待定', onTap: () {
|
|
|
|
if (!undetermined) {
|
|
|
|
setState(() {
|
|
|
|
undetermined = true;
|
|
|
|
connected = false;
|
|
|
|
confirmed = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
|
|
|
|
Text(
|
|
|
|
'备注',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151, fontSize: font(15)),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'备注',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: font(15)),
|
|
|
|
),
|
|
|
|
|
|
|
|
VEmptyView(30),
|
|
|
|
//输入框
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: w(10), vertical: w(10)),
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_DBDBDB, width: w(1)),
|
|
|
|
borderRadius: BorderRadius.circular(r(8))),
|
|
|
|
child: TextField(
|
|
|
|
controller: customController,
|
|
|
|
focusNode: _cusdemNode,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: font(14),
|
|
|
|
textBaseline: TextBaseline.alphabetic),
|
|
|
|
textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 5,
|
|
|
|
maxLength: 100,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "请输入备注或点击快捷选择标签",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_979797,
|
|
|
|
fontSize: font(14),
|
|
|
|
VEmptyView(30),
|
|
|
|
//输入框
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(10), vertical: w(10)),
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_DBDBDB, width: w(1)),
|
|
|
|
borderRadius: BorderRadius.circular(r(8))),
|
|
|
|
child: TextField(
|
|
|
|
controller: customController,
|
|
|
|
focusNode: _cusdemNode,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: font(14),
|
|
|
|
textBaseline: TextBaseline.alphabetic),
|
|
|
|
textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 5,
|
|
|
|
maxLength: 100,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "请输入备注或点击快捷选择标签",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_979797,
|
|
|
|
fontSize: font(14),
|
|
|
|
),
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide.none),
|
|
|
|
),
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
onChanged: (value) {
|
|
|
|
// setState(() {
|
|
|
|
// currentRemark = value ?? "";
|
|
|
|
// });
|
|
|
|
// if (value.length < currRemark.length &&
|
|
|
|
// currRemark.substring(value.length) != ',') {
|
|
|
|
// setState(() {
|
|
|
|
// currRemark = value ?? "";
|
|
|
|
// });
|
|
|
|
// if (sum == 0) {
|
|
|
|
// for (int i = 0; i < remarks.length; i++) {
|
|
|
|
// if (remarks[i].isSelect &&
|
|
|
|
// remarks[i].remark == selectItem.last) {
|
|
|
|
// setState(() {
|
|
|
|
// remarks[i].isSelect = false;
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// sum++;
|
|
|
|
// if (sum == selectItem.last.length ||
|
|
|
|
// selectItem.length == 1 ||
|
|
|
|
// selectItem.length == 0) {
|
|
|
|
// selectItem.removeLast();
|
|
|
|
// sum = 0;
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// setState(() {
|
|
|
|
// currRemark = value ?? "";
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
),
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
onChanged: (value) {
|
|
|
|
// setState(() {
|
|
|
|
// currentRemark = value ?? "";
|
|
|
|
// });
|
|
|
|
// if (value.length < currRemark.length &&
|
|
|
|
// currRemark.substring(value.length) != ',') {
|
|
|
|
// setState(() {
|
|
|
|
// currRemark = value ?? "";
|
|
|
|
// });
|
|
|
|
// if (sum == 0) {
|
|
|
|
// for (int i = 0; i < remarks.length; i++) {
|
|
|
|
// if (remarks[i].isSelect &&
|
|
|
|
// remarks[i].remark == selectItem.last) {
|
|
|
|
// setState(() {
|
|
|
|
// remarks[i].isSelect = false;
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// sum++;
|
|
|
|
// if (sum == selectItem.last.length ||
|
|
|
|
// selectItem.length == 1 ||
|
|
|
|
// selectItem.length == 0) {
|
|
|
|
// selectItem.removeLast();
|
|
|
|
// sum = 0;
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// setState(() {
|
|
|
|
// currRemark = value ?? "";
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_BFC4D4,
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(bottom: w(10)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'未接通、已确认、待定',
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: font(14)),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'张小娴 2023-12-16 15:23',
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: font(14)),
|
|
|
|
),
|
|
|
|
]))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
))),
|
|
|
|
VEmptyView(20),
|
|
|
|
MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_BFC4D4,
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
ListView.builder(
|
|
|
|
padding: EdgeInsets.only(left: w(13), top: w(20)),
|
|
|
|
itemCount: detailModel.reserveRecheckList.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
controller: controller,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
ReserveRecheckSunModel data =
|
|
|
|
detailModel.reserveRecheckList[index];
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(bottom: w(10)),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'${data.typeShow}',
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: font(14)),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'${data.nickName} ${data.cdateStr}',
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: font(14)),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
Align(
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: Text(
|
|
|
|
'${data.desc}',
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
// overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: font(14)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
))),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(24), vertical: w(35)),
|
|
|
|
child: Row(
|
|
...
|
...
|
@@ -228,7 +304,7 @@ class _VerifyFoodPageState extends State<VerifyFoodPage> { |
|
|
|
textColor: MyColours.color_ffffff,
|
|
|
|
borderColor: MyColours.color_438E93,
|
|
|
|
onPressed: () {
|
|
|
|
// _setBanquetDeposit();
|
|
|
|
_createReserveRecheck();
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
],
|
...
|
...
|
|