Commit 2484126a4ff40784389955bcf253a302c368e873

Authored by wdn127929
1 parent 4b836839

差简易模式

... ... @@ -21,6 +21,7 @@ class Notebook {
String pnum_str;
String rname;
String sex;
String aname;
String phone;
String cusdem;
String cusman;
... ...
... ... @@ -21,6 +21,7 @@ Notebook _$NotebookFromJson(Map<String, dynamic> json) {
..pnum_str = json['pnum_str'] as String
..rname = json['rname'] as String
..sex = json['sex'] as String
..aname = json['aname'] as String
..phone = json['phone'] as String
..cusdem = json['cusdem'] as String
..cusman = json['cusman'] as String
... ... @@ -67,6 +68,7 @@ Map<String, dynamic> _$NotebookToJson(Notebook instance) => <String, dynamic>{
'pnum_str': instance.pnum_str,
'rname': instance.rname,
'sex': instance.sex,
'aname':instance.aname,
'phone': instance.phone,
'cusdem': instance.cusdem,
'cusman': instance.cusman,
... ...
import 'dart:convert';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/pages/notebook/spread_widget.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/loading.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
... ... @@ -33,6 +37,16 @@ class NoteBookItemF extends StatefulWidget {
class NoteBookItemFState extends State<NoteBookItemF>
with SingleTickerProviderStateMixin {
bool _large = false;
List cancelReasonList = [];
bool isShowTF = false;
// int paddingBottom;
int paddingTop = 138;
FocusNode _cancelNode = FocusNode();
TextEditingController _cancelController = TextEditingController();
StateSetter _cancelState;
ScrollController _scrollController;
_onOperateClick() {
if (widget.notebook.operationText == "通知客户") {
// String _nameStr = '';
... ... @@ -74,6 +88,19 @@ class NoteBookItemFState extends State<NoteBookItemF>
}
}
/// 初始化取消原因数据
_initCancel() {
// isShowTF = false;
// paddingBottom = ScreenUtil.screenHeightDp.ceil() - 138 - 340;
cancelReasonList = [
{'title': '顾客取消', 'select': false},
{'title': '顾客行程有变', 'select': false},
{'title': '信息填写有误', 'select': false},
{'title': '操作失误', 'select': false},
{'title': '其他原因', 'select': false},
];
}
_updateSize(bool cando) {
if (!cando) {
return;
... ... @@ -83,6 +110,294 @@ class NoteBookItemFState extends State<NoteBookItemF>
});
}
///处理在线预订
setReserveStatus(String status, {String desc}) async {
// bus.emit("remove_untreated_message",widget.mid);
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {
"rid": widget.notebook.id,
"status": status, //5安排包间 2:确认到店(到店),3:用餐完成(离店),4:取消预定,5:分配包间:6:拒单
"uid": userModel.user.openid,
};
if (status == '4') {
Map<String, String> causeMap = {
"uid": userModel.user.openid,
"uname": userModel.user.account,
"desc": desc,
};
params["cause"] = json.encode(causeMap);
}
NotebookDetailModel detailModel =
Provider.of<NotebookDetailModel>(context, listen: false);
bool success =
await detailModel.setReserveStatus(context, params, ifPush: false);
if (success) {
bus.emit("refresh_book_list");
// if (status == "4") {
// //取消预订
// bus.emit("refresh_tablemanager"); //刷新桌位
// }
// _getReserveDetail();
}
}
///取消预订弹框
_showCancelWidget(context) {
_scrollController = ScrollController();
_initCancel();
showGeneralDialog(
context: context,
barrierDismissible: false,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
barrierColor: Color.fromRGBO(0, 0, 0, 0.25),
pageBuilder: (BuildContext context, Animation animation,
Animation secondaryAnimation) {
return Scaffold(
backgroundColor: Color.fromRGBO(0, 0, 0, 0.25),
body: StatefulBuilder(builder: (context, state) {
_cancelState = state;
return GestureDetector(
behavior: HitTestBehavior.opaque,
// onTap: () {
// Navigator.of(context).pop();
// },
child: Center(
child: Container(
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(28 * 2)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(32)),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10)),
),
height: ScreenUtil().setWidth(355 * 2),
child: Column(
// mainAxisSize: MainAxisSize.min,
children: [
// Stack(
// children: [
VEmptyView(48),
Container(
height: ScreenUtil().setWidth(48),
child: Text(
'是否确定取消预订',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Color.fromRGBO(0, 0, 0, 0.9)),
),
),
// Positioned(
// top: ScreenUtil().setWidth(8),
// right: ScreenUtil().setWidth(0),
// child: GestureDetector(
// onTap: () {
// _initCancel();
// Navigator.of(context).pop();
// },
// child: Container(
// padding: EdgeInsets.only(left: 20),
// child: Image.asset(
// 'assets/close.png',
// width: ScreenUtil().setWidth(32),
// height: ScreenUtil().setWidth(32),
// ),
// )))
// ],
// ),
VEmptyView(40),
Container(
child: Column(
// mainAxisSize: MainAxisSize.min,
children: cancelReasonList.map((value) {
return value['title'] == '其他原因'
? SizedBox()
: GestureDetector(
onTap: () {
for (var item in cancelReasonList) {
item['select'] = false;
// isShowTF = false;
// paddingBottom =
// ScreenUtil.screenHeightDp.ceil() -
// 138 -
// 340;
if (item['title'] ==
value['title']) {
item['select'] = true;
// if (item['title'] == '其他原因') {
// // isShowTF = true;
// // paddingBottom = 130;
// // paddingBottom =
// // ScreenUtil.screenHeightDp.ceil() -
// // 138 -
// // 340 -
// // 46;
// }
}
}
state(() {});
},
child: Container(
height: ScreenUtil().setWidth(48),
margin: EdgeInsets.only(
bottom:
ScreenUtil().setWidth(40)),
child: Row(
children: [
Image.asset(
value['select']
? 'assets/select.png'
: 'assets/unselect.png',
width: ScreenUtil()
.setWidth(42)),
HEmptyView(20),
Container(
child: Text(value['title'],
style: TextStyle(
fontSize: ScreenUtil()
.setSp(32),
fontWeight:
FontWeight.normal,
decoration:
TextDecoration
.none,
color: MyColours
.color_333333)))
],
),
),
);
}).toList(),
)),
Material(
child: Container(
color: Colors.white,
height: ScreenUtil().setWidth(42 * 2),
child: Row(children: [
InkWell(
onTap: () {
for (var item in cancelReasonList) {
item['select'] = false;
}
cancelReasonList[4]['select'] =
true;
state(() {});
},
child: Padding(
padding: EdgeInsets.only(
right: ScreenUtil()
.setWidth(20)),
child: Image.asset(
cancelReasonList[4]['select']
? 'assets/select.png'
: 'assets/unselect.png',
width: ScreenUtil()
.setWidth(44)))),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Color.fromRGBO(
240, 240, 240, 1),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
// height: ScreenUtil().setWidth(42 * 2),
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(16)),
child: TextField(
maxLines: 1,
controller: _cancelController,
focusNode: _cancelNode,
style: TextStyle(
textBaseline:
TextBaseline.alphabetic),
textAlignVertical:
TextAlignVertical.center,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
hintText: "其他",
// focusColor: Color.fromRGBO(0, 0, 0, 0.4),
hintStyle: TextStyle(
color:
Color.fromRGBO(0, 0, 0, 0.4),
fontSize: ScreenUtil().setSp(32),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 0,
color: Colors.transparent)),
border: OutlineInputBorder(
borderSide: BorderSide(
width: 0,
color: Colors.transparent)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 0,
color: Colors.transparent)),
),
// border: InputBorder.none,
onChanged: (_) {
setState(() {});
},
onEditingComplete: () {
print('fff');
_cancelNode.unfocus();
},
// keyboardType: TextInputType.number,
),
))
]))),
VEmptyView(15),
Material(
child: RoundButton(
onPressed: () {
String desc = '';
for (var value in cancelReasonList) {
if (value['select'] == true) {
desc = value['title'];
if (value['title'] == '其他原因') {
desc = _cancelController.text.trim();
if (desc.isEmpty) {
Utils.showToast("请填写原因");
return;
}
}
}
}
if (desc == '') {
Utils.showToast('请选择原因');
return;
}
Navigator.of(context).pop();
Loading.showLoading(context);
setReserveStatus('4', desc: desc);
},
text: '确认',
height: ScreenUtil().setWidth(80),
width: ScreenUtil().setWidth(300),
radius: ScreenUtil().setWidth(10),
),
)
],
),
),
));
}));
});
}
@override
Widget build(BuildContext context) {
// TODO: implement build
... ... @@ -94,11 +409,23 @@ class NoteBookItemFState extends State<NoteBookItemF>
notebook.uid != "null" &&
notebook.uid != userModel.user.openid) {
canDo = false;
} else {
if (notebook.status == '0' ||
notebook.status == '1' ||
notebook.status == '2' ||
notebook.status == '5') {
canDo = true;
} else {
canDo = false;
}
}
Color bgColor = notebook.status == "2" || notebook.status == "1"
Color bgColor = notebook.status == '0' ||
notebook.status == "2" ||
notebook.status == "1" ||
notebook.status == '5'
? MyColours.color_438E93
: Color.fromRGBO(191, 196, 212, 0.2);
: MyColours.color_BFC4D4;
String detail = '';
if (notebook.tid.split(",").length >= 2) {
... ... @@ -109,13 +436,17 @@ class NoteBookItemFState extends State<NoteBookItemF>
//有备注
detail += '[备注]:${notebook.cusdem};';
}
if (true) {
if (notebook.aname != null) {
//有优惠
detail += '[优惠]:';
detail += '[优惠]:${notebook.aname}';
}
if (detail.endsWith(';')) {
detail = detail.substring(0, detail.length - 1);
}
double widthBtn = 464.0;
if (notebook.status == '2') {
widthBtn = 208.0;
}
return Stack(
clipBehavior: Clip.none,
alignment: Alignment.centerRight,
... ... @@ -181,7 +512,7 @@ class NoteBookItemFState extends State<NoteBookItemF>
),
false ? SizedBox() : HEmptyView(8),
Offstage(
offstage: true,
offstage: notebook.aname == null,
child: Image.asset(
Utils.getImgPath('ordered_hui'),
width: ScreenUtil().setWidth(18 * 2),
... ... @@ -197,8 +528,9 @@ class NoteBookItemFState extends State<NoteBookItemF>
gradientEnd: bgColor,
textColor: MyColours.color_ffffff,
radius: ScreenUtil().setWidth(6),
fontSize: 28,
width: ScreenUtil().setWidth(56 * 2),
fontSize: 24,
width: ScreenUtil().setWidth(42 * 2),
height: ScreenUtil().setWidth(17 * 2),
)
],
),
... ... @@ -306,14 +638,16 @@ class NoteBookItemFState extends State<NoteBookItemF>
notebook.nick_name == ''
? VEmptyView(6)
: SizedBox(),
Text(
detail,
maxLines: 100,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
),
detail == ''
? SizedBox()
: Text(
detail,
maxLines: 100,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
),
],
)))
],
... ... @@ -322,118 +656,124 @@ class NoteBookItemFState extends State<NoteBookItemF>
Positioned(
right: ScreenUtil().setWidth(8),
child: StatefulBuilder(builder: (context, state) {
// return ScaleAnimatedContent(
// child: InkWell(
// onTap: () {
// state(() {
// show = !show;
// });
// },
// child: Image.asset(
// Utils.getImgPath(show ? 'ordered_open' : 'ordered_off'),
// width: ScreenUtil().setWidth(80),
// )),
// show: show,
// );
return InkWell(
onTap: () => _updateSize(canDo),
child: AnimatedSize(
curve: Curves.easeIn,
duration: Duration(microseconds: 30000),
vsync: this,
child: _large
? Stack(
children: [
Container(
width: ScreenUtil()
.setWidth(232 * 2 + 8 * 2),
height: ScreenUtil().setWidth(80),
child: AnimatedSize(
curve: Curves.easeIn,
duration: Duration(microseconds: 30000),
vsync: this,
child: InkWell(
onTap: () => _updateSize(canDo),
child: _large
? Stack(
children: [
Container(
width:
ScreenUtil().setWidth(widthBtn + 8 * 2),
height: ScreenUtil().setWidth(80),
decoration: BoxDecoration(
color: Color.fromRGBO(67, 142, 147, 0.2),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(16)),
)),
Positioned(
top: ScreenUtil().setWidth(8),
left: ScreenUtil().setWidth(8),
child: Container(
width: ScreenUtil().setWidth(widthBtn),
height: ScreenUtil().setWidth(32 * 2),
decoration: BoxDecoration(
color:
Color.fromRGBO(67, 142, 147, 0.2),
color: Color.fromRGBO(125, 174, 177, 1),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(16)),
)),
Positioned(
top: ScreenUtil().setWidth(8),
left: ScreenUtil().setWidth(8),
child: Container(
width: ScreenUtil().setWidth(232 * 2),
height: ScreenUtil().setWidth(32 * 2),
decoration: BoxDecoration(
color:
Color.fromRGBO(125, 174, 177, 1),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8)),
),
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(16)),
child: Row(
children: [
Image.asset(
Utils.getImgPath(
'ordered_arrow_right'),
width:
ScreenUtil().setWidth(24 * 2),
),
HEmptyView(32),
RoundButton(
text: '到店',
width: ScreenUtil()
.setWidth(36 * 2),
height: ScreenUtil()
.setWidth(24 * 2),
gradientStart:
MyColours.color_ffffff,
gradientEnd:
MyColours.color_ffffff,
textColor:
MyColours.color_260101,
isBold: true,
fontSize: 28,
radius:
ScreenUtil().setWidth(8)),
HEmptyView(44),
RoundButton(
text: '离店',
width: ScreenUtil()
.setWidth(36 * 2),
height: ScreenUtil()
.setWidth(24 * 2),
gradientStart:
MyColours.color_ffffff,
gradientEnd:
MyColours.color_ffffff,
textColor:
MyColours.color_260101,
isBold: true,
fontSize: 28,
radius:
ScreenUtil().setWidth(8)),
HEmptyView(44),
Text(
'取消预订',
style: TextStyle(
decoration:
TextDecoration.underline,
color: MyColours.color_ffffff,
fontSize:
ScreenUtil().setSp(28),
fontWeight: FontWeight.bold),
)
],
),
))
],
)
: Image.asset(
Utils.getImgPath(
canDo ? 'ordered_open' : 'ordered_off'),
width: ScreenUtil().setWidth(80),
)));
}))
ScreenUtil().setWidth(8)),
),
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(16)),
child: Row(
children: [
Image.asset(
Utils.getImgPath(
'ordered_arrow_right'),
width:
ScreenUtil().setWidth(24 * 2),
),
HEmptyView(32),
notebook.status == '2'
? SizedBox()
: RoundButton(
text: '到店',
width: ScreenUtil()
.setWidth(36 * 2),
height: ScreenUtil()
.setWidth(24 * 2),
gradientStart:
MyColours.color_ffffff,
gradientEnd:
MyColours.color_ffffff,
textColor:
MyColours.color_260101,
isBold: true,
fontSize: 28,
radius:
ScreenUtil().setWidth(8),
onPressed: () {
Loading.showLoading(
context);
setReserveStatus('2');
},
),
notebook.status == '2'
? SizedBox()
: HEmptyView(44),
RoundButton(
text: '离店',
width:
ScreenUtil().setWidth(36 * 2),
height:
ScreenUtil().setWidth(24 * 2),
gradientStart:
MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
textColor: MyColours.color_260101,
isBold: true,
fontSize: 28,
radius: ScreenUtil().setWidth(8),
onPressed: () {
Loading.showLoading(context);
setReserveStatus('3');
},
),
notebook.status == '2'
? SizedBox()
: HEmptyView(44),
notebook.status == '2'
? SizedBox()
: InkWell(
onTap: () {
_showCancelWidget(context);
},
child: Text(
'取消预订',
style: TextStyle(
decoration:
TextDecoration
.underline,
color: MyColours
.color_ffffff,
fontSize: ScreenUtil()
.setSp(28),
fontWeight:
FontWeight.bold),
))
],
),
))
],
)
: Image.asset(
Utils.getImgPath(
canDo ? 'ordered_open' : 'ordered_off'),
width: ScreenUtil().setWidth(80),
))))
// Positioned(
// right: ScreenUtil().setWidth(8),
// child: Image.asset(
... ...
... ... @@ -58,6 +58,7 @@ class NoteBookPageState extends State<NoteBookPage> {
CalendarController _calendarController = CalendarController();
StartingDayOfWeek startingDayOfWeek;
bool clearSel = false;
bool isall = true;
@override
void initState() {
... ... @@ -205,7 +206,7 @@ class NoteBookPageState extends State<NoteBookPage> {
"keywords": "",
"sort": "1"
};
if (tabIndex == 1) {
if (!isall) {
params["account"] = userModel.user.account;
}
... ... @@ -893,22 +894,29 @@ class NoteBookPageState extends State<NoteBookPage> {
],
),
),
Column(
children: [
Text(
'我录入的',
style: TextStyle(
fontSize: ScreenUtil().setSp(20),
fontWeight: FontWeight.bold,
color: MyColours.color_515151),
),
VEmptyView(16),
Image.asset(
Utils.getImgPath(
true ? 'f_swich_on' : 'f_swich_off'),
width: ScreenUtil().setWidth(24 * 2))
],
),
InkWell(
onTap: () {
setState(() {
isall = !isall;
});
_getReserveList();
},
child: Column(
children: [
Text(
'我录入的',
style: TextStyle(
fontSize: ScreenUtil().setSp(20),
fontWeight: FontWeight.bold,
color: MyColours.color_515151),
),
VEmptyView(16),
Image.asset(
Utils.getImgPath(
!isall ? 'f_swich_on' : 'f_swich_off'),
width: ScreenUtil().setWidth(24 * 2))
],
)),
Column(
children: [
Text(
... ... @@ -957,7 +965,6 @@ class NoteBookPageState extends State<NoteBookPage> {
bottom: ScreenUtil().setWidth(24)),
child: NoteBookItemF(
model.notebooks[index], index),
);
}, childCount: model.notebooks.length),
// itemExtent: ScreenUtil().setWidth(112),
... ...