Commit 182ed04e5c788ce91866d197566268ce0f18c981

Authored by wdn127929
1 parent 78c935ce

修改后排菜和套菜

... ... @@ -2609,50 +2609,50 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
? SizedBox()
: Row(
children: [
// detailEntity.order.cookbooklist
// .length ==
// 0
// ? Expanded(
// flex: 1,
// child: InkWell(
// onTap: () {
// NavigatorUtil
// .goOrderAdvanceHomePage(
// context,
// );
// },
// child: Container(
// margin: EdgeInsets.only(
// right: ScreenUtil()
// .setWidth(20)),
// decoration: BoxDecoration(
// color: MyColours
// .color_ffffff,
// border: Border.all(
// width: w(1),
// color: MyColours
// .color_438E93),
// borderRadius:
// BorderRadius.circular(
// ScreenUtil()
// .setWidth(
// 10)),
// ),
// child: Align(
// alignment:
// Alignment.center,
// child: Text('预点菜',
// style: TextStyle(
// color: MyColours
// .color_438E93,
// fontSize:
// ScreenUtil()
// .setSp(
// 34))),
// ),
// ),
// ))
// : SizedBox(),
detailEntity.order.cookbooklist
.length ==
0
? Expanded(
flex: 1,
child: InkWell(
onTap: () {
NavigatorUtil
.goOrderAdvanceHomePage(
context,
);
},
child: Container(
margin: EdgeInsets.only(
right: ScreenUtil()
.setWidth(20)),
decoration: BoxDecoration(
color: MyColours
.color_ffffff,
border: Border.all(
width: w(1),
color: MyColours
.color_438E93),
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(
10)),
),
child: Align(
alignment:
Alignment.center,
child: Text('预点菜',
style: TextStyle(
color: MyColours
.color_438E93,
fontSize:
ScreenUtil()
.setSp(
34))),
),
),
))
: SizedBox(),
Expanded(
flex: 2,
child: InkWell(
... ...
... ... @@ -649,25 +649,25 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
Utils.getImgPath('cybz'), '常用备注')),
],
),
// VEmptyView(68),
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceEvenly,
// children: [
// InkWell(
// onTap: () {
// NavigatorUtil.goMyPlanDishHomePage(
// context);
// },
// child: _item(
// Utils.getImgPath('cdgl'), '我的排菜')),
// InkWell(
// onTap: () {}, child: _item('', '空空空空')),
// InkWell(
// onTap: () {}, child: _item('', '空空空空')),
// InkWell(
// onTap: () {}, child: _item('', '空空空空')),
// ])
VEmptyView(68),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
InkWell(
onTap: () {
NavigatorUtil.goMyPlanDishHomePage(
context);
},
child: _item(
Utils.getImgPath('cdgl'), '套餐排菜')),
InkWell(
onTap: () {}, child: _item('', '空空空空')),
InkWell(
onTap: () {}, child: _item('', '空空空空')),
InkWell(
onTap: () {}, child: _item('', '空空空空')),
])
]),
)),
VEmptyView(20),
... ...
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/pages/coupon/coupon_sun_page.dart';
import 'package:one_key/pages/my/plan_dish/plan_dish_sun_page.dart';
import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/provider/personnel_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/route/navigator_util.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/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../../utils/dialog_util.dart';
import '../../../utils/screen_util.dart';
import '../../../provider/plan_dish_provider.dart';
/**
*
* 我的排菜首页
*/
class MyPlanDishHomePage extends StatefulWidget {
MyPlanDishHomePage({Key key}) : super(key: key);
final bool needRefrsh;
MyPlanDishHomePage({Key key, this.needRefrsh = false}) : super(key: key);
@override
_MyPlanDishHomePageState createState() => _MyPlanDishHomePageState();
}
class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> {
class _MyPlanDishHomePageState extends State<MyPlanDishHomePage>
with TickerProviderStateMixin {
EasyRefreshController _controller = EasyRefreshController();
CouponProvider couponProvider;
TabController tabController;
// ///获取优惠券列表数据
// _couponNetworkData(int index, {bool isShowLoading = true}) async {
// Map<String, String> params = {
// "uid": Provider.of<UserModel>(context, listen: false).user.openid,
// // 'is_time': '0'
// "is_type": index.toString()
// };
// await couponProvider.getCustomerActivity(context, params,
// isShowLoading: isShowLoading);
// }
///修改活动信息
// _setCustomerActivity(int index) async {
// Map<String, String> params = {
// "id": couponProvider.couponList[index].id,
// "status": couponProvider.couponList[index].isOpenBool ? '1' : '0'
// };
// bool isSuccess = await couponProvider.setCustomerActivity(context, params,
// isShowLoading: false);
// print(isSuccess);
// _couponNetworkData(tabController.index, isShowLoading: false);
// // if (isSuccess) {
// // couponProvider.notifyListeners();
// // } else {
// // couponProvider.couponList[index].isOpenBool =
// // !couponProvider.couponList[index].isOpenBool;
// // couponProvider.notifyListeners();
// // }
// }
@override
void initState() {
// TODO: implement initState
super.initState();
tabController = TabController(length: 3, vsync: this);
tabController.addListener(() {
// couponProvider.couponList = [];
// couponProvider.pageState = PageState.Loading;
// setState(() {});
//点击tab时或滑动tab回调一次
if (tabController.index.toDouble() == tabController.animation.value) {
// couponProvider.notifyListeners();
// _couponNetworkData(tabController.index);
// selectIndex = tabController.index;
// setState(() {});
}
});
WidgetsBinding.instance.addPostFrameCallback((_) {
// _couponNetworkData(0);
});
// bus.on("refresh_coupon_list_f", (arg) {
// _couponNetworkData(tabController.index);
// });
}
@override
void dispose() {
bus.off("refresh_coupon_list_f");
super.dispose();
}
@override
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
return Scaffold(
appBar: SystemAppBar('我的排菜'),
backgroundColor: MyColours.color_ffffff,
body: Column(
children: [
MyDivider(
double.infinity,
w(1),
color: MyColours.color_DBDBDB,
),
Expanded(
child: ListView.builder(
itemCount: 10,
itemBuilder: (context, index) {
return Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: MyColours.color_DBDBDB, width: w(1)))),
child: Padding(
padding: EdgeInsets.only(
left: w(20), right: w(20), top: w(15), bottom: w(3)),
child: Column(
children: [
Row(
children: [
Expanded(
child: Text(
'8人聚会餐',
maxLines: 3,
style: TextStyle(
fontSize: font(16),
color: MyColours.color_515151),
overflow: TextOverflow.ellipsis,
)),
HEmptyView(22),
Text('1200元/8人',
style: TextStyle(
fontSize: font(14),
color: MyColours.color_515151)),
HEmptyView(22),
InkWell(
onTap: () {
//弹框确认是否删除
DialogUtil.cupertinoAlertDialog(context,
title: "",
content: "是否确定删除该排菜?",
rTitle: "确定删除", rCallback: () {
// Navigator.pop(context);
// _delGuestInfocDay(model.cday[index].id);
});
},
child: Padding(
padding: EdgeInsets.only(left: w(11)),
child: Image.asset(
Utils.getImgPath('f_delete_red'),
width: w(17),
)))
],
),
VEmptyView(22),
Text(
'铁锅炖大鹅,白山叫花鸡,主席红烧肉,清蒸鲈鱼,荷塘小炒,松仁玉米,咸蛋黄焗南瓜,黑椒牛柳,夫妻肺片,蒜泥茄子,卤水拼盘,东北大拉皮,西湖牛肉羹,扬州炒饭,咸蛋黄焗南瓜,黑椒牛柳,夫妻肺片,蒜泥茄子,卤水拼盘,东北大拉皮,西湖牛肉羹,扬州炒饭',
maxLines: 3,
style: TextStyle(
fontSize: font(12),
color: MyColours.color_515151),
overflow: TextOverflow.ellipsis,
),
VEmptyView(8),
Row(
children: [
Container(
height: w(24),
padding: EdgeInsets.only(top: w(6)),
child: Text('更新时间:2022-11-08',
style: TextStyle(
fontSize: font(12),
color: MyColours.color_515151)),
),
Spacer(),
RoundButton(
text: '复用',
width: w(80),
height: w(30),
fontSize: 24,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
radius: r(5),
isBold: false,
onPressed: () {
NavigatorUtil.goFinalPlanDishPage(context);
},
),
HEmptyView(20),
RoundButton(
text: '修改',
width: w(80),
height: w(30),
fontSize: 24,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
radius: r(5),
isBold: false,
onPressed: () {
NavigatorUtil.goFinalPlanDishPage(context);
},
)
],
)
],
backgroundColor: MyColours.color_f3f3f3,
appBar: SystemAppBar('排菜与套餐', onTap: () {
// if (widget.needRefrsh) {
// EventBus().emit('refresh_coupon_invitation');
// } else {
// EventBus().emit('changeStatusColor');
// }
Navigator.of(context).pop();
}),
body: WillPopScope(
onWillPop: () {
// if (widget.needRefrsh) {
// EventBus().emit('refresh_coupon_invitation');
// } else {
// EventBus().emit('changeStatusColor');
// }
Navigator.of(context).pop();
},
child: Column(
children: <Widget>[
Container(
width: double.infinity,
height: ScreenUtil().setWidth(80),
color: MyColours.color_ffffff,
padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(6)),
child: TabBar(
controller: tabController,
tabs: [
Tab(
text: "全部",
),
Tab(
text: "店铺套餐",
),
Tab(
text: "我的排菜",
)
],
indicatorColor: MyColours.color_438E93,
indicatorSize: TabBarIndicatorSize.label,
indicatorWeight: ScreenUtil().setWidth(4),
labelColor: MyColours.color_438E93,
unselectedLabelColor: MyColours.color_999999,
labelStyle: TextStyle(
color: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold),
unselectedLabelStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24),
),
);
}),
)),
VEmptyView(32),
Expanded(
child: TabBarView(
controller: tabController,
children: [
ChangeNotifierProvider<PlanDishProvider>(
create: (_) => PlanDishProvider(),
child: PlanDishSunPage(index: 0)),
ChangeNotifierProvider<PlanDishProvider>(
create: (_) => PlanDishProvider(),
child: PlanDishSunPage(index: 1)),
ChangeNotifierProvider<PlanDishProvider>(
create: (_) => PlanDishProvider(),
child: PlanDishSunPage(index: 2)),
],
),
),
Container(
height: ScreenUtil().setWidth(91 * 2),
width: double.infinity,
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(16 * 2),
bottom: ScreenUtil().setWidth(35 * 2),
left: ScreenUtil().setWidth(45 * 2),
right: ScreenUtil().setWidth(45 * 2),
),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.1),
offset: Offset(0, ScreenUtil().setWidth(-2)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(16)),
),
),
child: RoundButton(
text: '创建新排菜',
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: false,
fontSize: 28,
onPressed: () async {
UserModel userModel =
Provider.of<UserModel>(context, listen: false);
if (userModel.user.role_name == '管理员' ||
userModel.user.role_name == '店长') {
NavigatorUtil.goPlanDishCreateSelectTypePage(context);
} else {
bool needRefresh =
await NavigatorUtil.goPlanDishEditPage(context);
print(needRefresh);
if (needRefresh != null && needRefresh) {
// bus.emit('refresh_coupon_list_f');
//刷新页面数据
// _controller.callRefresh();
// _couponNetworkData(tabController.index);
}
}
},
),
)
],
),
Padding(
padding: EdgeInsets.only(
top: w(12), bottom: w(25), left: w(45), right: w(45)),
child: RoundButton(
text: '创建新排菜',
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
width: double.infinity,
height: w(43),
radius: r(5),
fontSize: 36,
isBold: false,
onPressed: () {
NavigatorUtil.goPlanNewDishFirstPage(context);
},
),
)
],
),
);
// child: Column(
// children: [
// Expanded(child: Consumer<CouponProvider>(
// builder: (context, model, _) {
// if (model.pageState != PageState.Success) {
// return ExceptionPage(
// pageState: model.pageState,
// callback: () {
// // offset = 0;
// // getMessage(showLoading: true);
// _couponNetworkData();
// },
// emptyMsg: "暂时没有列表信息哦",
// emptyImg: "empty_search",
// showMsg: "加载中,请稍后...",
// );
// } else {
// return EasyRefresh.custom(
// controller: _controller,
// shrinkWrap: true,
// slivers: [
// SliverList(
// delegate: SliverChildBuilderDelegate(
// (BuildContext context, int index) {
// return Container(
// margin:
// EdgeInsets.all(ScreenUtil().setWidth(40)),
// padding:
// EdgeInsets.all(ScreenUtil().setWidth(30)),
// color: MyColours.color_F0F0F0,
// child: Text(
// '使用说明:需在结账前出示优惠券二维码,店内工作人员微信扫码核销。超过有效期的券,会自动作废并移出列表。优惠券不可找零、兑现。',
// style: TextStyle(
// color: MyColours.color_666666,
// fontSize: ScreenUtil().setSp(24),
// ),
// strutStyle: StrutStyle(
// forceStrutHeight: true,
// height: 1,
// leading: 0.3),
// ));
// }, childCount: 1),
// ),
// SliverList(
// delegate: SliverChildBuilderDelegate(
// (BuildContext context, int index) {
// return CouponItem(
// from: 'quan',
// couponSonModel:
// couponProvider.couponList[index],
// showBtn: true,
// onPressedSwich: () {
// couponProvider.couponList[index].isOpenBool =
// !couponProvider
// .couponList[index].isOpenBool;
// _setCustomerActivity(index);
// },
// onPressed: () {
// NavigatorUtil.goCouponDetailPage(context,
// couponProvider.couponList[index]);
// },
// );
// }, childCount: couponProvider.couponList.length),
// )
// ],
// // onRefresh: () async {
// // // offset = 0;
// // // getMessage(showLoading: false);
// // },
// // onLoad: () async {
// // // offset++;
// // // getMessage(showLoading: false);
// // },
// );
// }
// },
// )),
// VEmptyView(20),
// Padding(
// padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
// ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
// child: RoundButton(
// onPressed: () async {
// bool needRefresh =
// await NavigatorUtil.goCouponEditPage(context);
// print(needRefresh);
// if (needRefresh != null && needRefresh) {
// //刷新页面数据
// // _controller.callRefresh();
// _couponNetworkData();
// }
// },
// text: '创建新券',
// fontSize: 34,
// isBold: false,
// height: ScreenUtil().setWidth(80),
// width: double.infinity,
// radius: ScreenUtil().setWidth(10),
// ))
// ],
// )
));
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_screenutil/flutter_screenutil.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/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
/**
* 创建排菜---类型选择
*/
class PlanDishCreateSelectTypePage extends StatefulWidget {
PlanDishCreateSelectTypePage({Key key}) : super(key: key);
@override
_PlanDishCreateSelectTypePageState createState() =>
_PlanDishCreateSelectTypePageState();
}
class _PlanDishCreateSelectTypePageState
extends State<PlanDishCreateSelectTypePage> {
bool selectF = true;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'选择排菜类型',
onTap: () {
Navigator.pop(context);
},
),
body: SingleChildScrollView(
child: Column(
children: [
VEmptyView(98),
InkWell(
onTap: () {
if (!selectF) {
setState(() {
selectF = !selectF;
});
}
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
height: ScreenUtil().setWidth(106 * 2),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
offset: Offset(0, ScreenUtil().setWidth(4)),
blurRadius: ScreenUtil().setWidth(20),
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(32, 109, 114, 0.2))
],
color: selectF
? MyColours.color_438E93
: MyColours.color_ffffff,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(24))),
child: Row(
children: [
Image.asset(
Utils.getImgPath(selectF
? 'coupon_select_type_user'
: 'coupon_select_type_user_un'),
width: ScreenUtil().setWidth(70 * 2),
),
HEmptyView(70),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'仅为我创建',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
VEmptyView(16),
Text(
'创建后仅我可使用该排菜给顾客预点菜',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: selectF
? MyColours.color_ffffff
: MyColours.color_BFC4D4),
),
],
)),
],
),
)),
VEmptyView(94),
InkWell(
onTap: () {
if (selectF) {
setState(() {
selectF = !selectF;
});
}
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
height: ScreenUtil().setWidth(106 * 2),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
offset: Offset(0, ScreenUtil().setWidth(4)),
blurRadius: ScreenUtil().setWidth(20),
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.1))
],
color: !selectF
? MyColours.color_438E93
: MyColours.color_ffffff,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(24))),
child: Row(
children: [
Image.asset(
Utils.getImgPath(!selectF
? 'coupon_select_type_store'
: 'coupon_select_type_store_un'),
width: ScreenUtil().setWidth(75 * 2),
),
HEmptyView(60),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'为全店创建',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
VEmptyView(16),
Text(
'创建后所有员工均可使用该排菜给顾客预点菜',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_BFC4D4),
),
],
)),
],
),
)),
VEmptyView(112),
RoundButton(
text: '立即创建',
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
width: ScreenUtil().setWidth(130 * 2),
height: ScreenUtil().setWidth(37 * 2),
textColor: MyColours.color_438E93,
fontSize: 24,
isBold: true,
radius: ScreenUtil().setWidth(22),
onPressed: () async {
bool needRefresh = await NavigatorUtil.goPlanDishEditPage(
context,
isMine: selectF);
print(needRefresh);
if (needRefresh != null && needRefresh) {
Navigator.pop(context);
//刷新页面数据
// _controller.callRefresh();
// _couponNetworkData();
}
},
)
],
),
),
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/plan_dish_provider.dart';
import '../../../res/colors.dart';
import '../../../utils/screen_util.dart';
import '../../../widgets/round_button.dart';
import '../../../widgets/system_app_bar.dart';
/**
* 我的排菜新建编辑页
*/
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_picker/flutter_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.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';
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/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
/**
* 新建排菜
*/
class PlanDishEidtPage extends StatefulWidget {
final bool isMine;
PlanDishEidtPage({Key key, this.isMine = true}) : super(key: key);
@override
_PlanDishEidtPageState createState() => _PlanDishEidtPageState();
}
class _PlanDishEidtPageState extends State<PlanDishEidtPage> {
ScrollController controller = ScrollController();
TextEditingController _dishNameEditControl = TextEditingController();
TextEditingController _dishRequireEditControl = TextEditingController();
TextEditingController _dishExplainEditControl = TextEditingController();
final heightCell = ScreenUtil().setWidth(48 * 2);
bool swichState = true; //默认启用 开关状态
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
FocusNode _nameFocusNode = FocusNode();
FocusNode _requireFocusNode = FocusNode();
bool showDateSelWidget = false;
PlanDishProvider dishProvider;
bool swichHexiao = true; //默认启用 核销状态
String uids = '';
List labelList = ['店内通用套餐', '自定义排菜单'];
int labelSelIndex = 0;
String labelShow;
@override
void initState() {
super.initState();
labelShow = labelList[labelSelIndex];
_nameFocusNode.addListener(() {
if (_nameFocusNode.hasFocus) {
//有焦点
if (showDateSelWidget) {
Navigator.pop(context);
showDateSelWidget = false;
}
} else {
//失去焦点
// _editingController.text = '';
}
});
_requireFocusNode.addListener(() {
if (_requireFocusNode.hasFocus) {
//有焦点
if (showDateSelWidget) {
Navigator.pop(context);
showDateSelWidget = false;
}
} else {
//失去焦点
// _editingController.text = '';
}
});
}
//创建新券 客户经理创建活动
_createNewdish() async {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// Map<String, String> params = {
// "uid": Provider.of<UserModel>(context, listen: false).user.openid,
// "aname": _dishNameEditControl.text.trim(),
// "desc": _dishRequireEditControl.text.trim(),
// "stime": fromDate == '点击选择'
// ? ""
// : '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}',
// "etime": endDate == '点击选择'
// ? ''
// : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
// "explain": _dishExplainEditControl.text,
// "is_open": swichState ? "1" : "0",
// "status": swichState ? "1" : "0",
// 'is_type': widget.isMine ? "2" : "1"
// };
// if (!widget.isMine) {
// params['is_examine'] = swichHexiao ? "1" : "0";
// params['uid_list'] = uids;
// }
// bool isSuccess = await dishProvider.createCustomerActivity(context, params);
// if (isSuccess) {
// //成功之后跳回前一个页面
// // bus.emit('refresh_dish_list');
// EventBus().emit('refresh_dish_invitation');
// bus.emit('refresh_dish_list_f');
// bus.emit('refresh_table_m_dish');
// Navigator.pop(context, true);
// }
}
///输入框
Widget _textfield(String title, String hintText) {
return Container(
height: w(48),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
title,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(80),
Expanded(
child: Container(
child: TextField(
controller: title.contains('排菜名称')
? _dishNameEditControl
: _dishRequireEditControl,
textAlign: TextAlign.right,
textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
),
focusNode:
title.contains('排菜名称') ? _nameFocusNode : _requireFocusNode,
decoration: InputDecoration(
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_99515151,
fontSize: ScreenUtil().setSp(32),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.text,
),
)),
],
),
);
}
///时间选择
Widget _select(String title, String hintText, GestureTapCallback onTap) {
return InkWell(
onTap: onTap,
child: Container(
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
// height: ScreenUtil().setWidth(40),
// color: Colors.red,
child: Text(
title,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(20),
Spacer(),
Text(hintText,
style: TextStyle(
color: hintText == '点击选择'
? MyColours.color_999999
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
)),
HEmptyView(20),
Image.asset(
Utils.getImgPath('arrow_right_new'),
width: ScreenUtil().setWidth(20),
),
// HEmptyView(32),
],
),
),
);
}
///券说明
Widget _explain(String title, String hintText) {
return Container(
// height: ScreenUtil().setWidth(380),
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(5)),
border: Border.all(width: w(1), color: MyColours.color_DBDBDB)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Align(
// alignment: Alignment.centerLeft,
// child: Text(
// title,
// textAlign: TextAlign.left,
// style: TextStyle(
// color: Color.fromRGBO(0, 0, 0, 0.9),
// fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(32)),
// )),
// VEmptyView(26),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
TextField(
controller: _dishExplainEditControl,
// keyboardType: TextInputType.number, //键盘类型,数字键盘
maxLines: 6,
enabled: false,
// maxLength: 50,
// maxLengthEnforced: true,
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_999999), //输入文本的样式
decoration: InputDecoration(
contentPadding: EdgeInsets.all(ScreenUtil().setWidth(6)),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32),
),
border: OutlineInputBorder(borderSide: BorderSide.none),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
// fillColor: MyColours.color_F9F9F9,
// // fillColor: Colors.red,
// filled: true,
// enabledBorder: OutlineInputBorder(
// //未选中时候的颜色
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
// borderSide: BorderSide(
// color: MyColours.color_cccccc,
// width: ScreenUtil().setWidth(2)),
// ),
// focusedBorder: OutlineInputBorder(
// //选中时外边框颜色
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
// borderSide: BorderSide(
// color: MyColours.app_main,
// ),
// ),
// border: OutlineInputBorder(
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(20)),
// borderSide: BorderSide(
// color: Colors.red, width: ScreenUtil().setWidth(2))),
),
onChanged: (value) {},
),
],
),
);
}
///是否立即启用
Widget _canUse(String title, bool swich, GestureTapCallback onTap) {
return InkWell(
onTap: onTap,
child: Container(
height: w(48),
// padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
margin: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
// height: ScreenUtil().setWidth(40),
// color: Colors.red,
child: Text(
title,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
Spacer(),
Image.asset(
swich
? Utils.getImgPath('swich_on')
: Utils.getImgPath('swich_off'),
width: ScreenUtil().setWidth(44 * 2),
)
],
),
),
);
}
///
Widget _item(String title, String subTitle) {
return Container(
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
child: Text(
title,
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(60),
Expanded(
child: Text(
subTitle,
maxLines: 20,
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.4),
fontSize: ScreenUtil().setSp(32),
),
))
],
),
);
}
@override
Widget build(BuildContext context) {
dishProvider = Provider.of<PlanDishProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
key: scaffoldKey,
appBar: SystemAppBar(
'排菜详情',
onTap: () {
Navigator.pop(context, false);
},
),
body: InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
child: Container(
color: MyColours.color_ffffff,
child: Column(children: [
Expanded(
child: SingleChildScrollView(
controller: controller,
physics: BouncingScrollPhysics(),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: Column(
children: [
VEmptyView(40),
_textfield('排菜名称 *', '点击输入排菜套餐名称'),
MyDivider(double.infinity, w(1),
color: MyColours.color_DBDBDB),
InkWell(
onTap: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(
context,
labelList.map((item) {
return item.label;
}).toList(), (value) {
if (value != null) {
setState(() {
labelSelIndex = value.first;
labelShow =
labelList[labelSelIndex].label;
});
}
},
selecteds: labelSelIndex == null
? []
: [labelSelIndex])
.then((value) {});
},
child: Container(
height: ScreenUtil().setWidth(48 * 2),
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(24)),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Container(
// color: Colors.red,
width: ScreenUtil().setWidth(150),
// height: ScreenUtil().setWidth(35),
// height: ScreenUtil().setWidth(48),
child: Text(
'排菜类型',
style: TextStyle(
fontSize:
ScreenUtil().setSp(32),
color: MyColours.color_515151),
),
),
Expanded(
child: Text(
labelShow,
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
),
)),
HEmptyView(10),
Image.asset(
Utils.getImgPath('c_arrow_down'),
width: ScreenUtil().setWidth(24),
// height: ScreenUtil().setWidth(10),
)
],
),
)),
MyDivider(double.infinity, w(1),
color: MyColours.color_DBDBDB),
_canUse('是否启用', swichState, () {
setState(() {
swichState = !swichState;
});
}),
MyDivider(double.infinity, w(1),
color: MyColours.color_DBDBDB),
VEmptyView(24),
Container(
height: w(48),
child: Row(
children: [
Container(
// height: ScreenUtil().setWidth(40),
// color: Colors.red,
child: Text(
'就餐人数',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
Spacer(),
Image.asset(
Utils.getImgPath('plan_dish_minus'),
width: w(16),
),
HEmptyView(46),
Container(
// constraints: BoxConstraints(
// minWidth: w(34),
// ),
width: w(34),
height: w(48),
decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(r(5)),
// border: Border.all(
// width: w(1),
// color: MyColours.color_999999)
),
// constraints: BoxConstraints(minWidth: w(20)),
child: TextField(
maxLines: 1,
// controller:
// focusNode: _focusNode,
// autofocus: true,
style: TextStyle(
color: MyColours.color_438E93,
fontSize: font(16)),
textAlign: TextAlign.center,
// textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
hintText: "人数",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: font(16),
),
// isCollapsed:
// true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
border: OutlineInputBorder(
borderSide: BorderSide.none),
contentPadding: EdgeInsets.zero,
),
keyboardType: TextInputType.number,
textInputAction:
TextInputAction.done,
onChanged: (value) {
// setState(() {});
// _searchSellerLocation();
// customerProvider.searchData(value);
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(
FocusNode()); //点击空白处隐藏键盘
// contantShowModel.searchData(
// contantShowModel.controller.text);
// _searchSellerLocation();
// _focusNode.unfocus();
},
)),
HEmptyView(46),
Image.asset(
Utils.getImgPath('plan_dish_add'),
width: w(16),
),
],
)),
MyDivider(double.infinity, w(1),
color: MyColours.color_DBDBDB),
VEmptyView(24),
Container(
height: w(48),
child: Row(children: [
Container(
// height: ScreenUtil().setWidth(40),
// color: Colors.red,
child: Text(
'菜单总价/会员总价',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
Spacer(),
Text(
'0元/0元',
style: TextStyle(
color: MyColours.color_99515151,
fontSize: ScreenUtil().setSp(32)),
),
])),
MyDivider(double.infinity, w(1),
color: MyColours.color_DBDBDB),
VEmptyView(24),
Container(
height: w(48),
child: Row(
children: [
Text(
'排菜价格',
style: TextStyle(
fontSize: font(16),
color: MyColours.color_515151),
),
HEmptyView(20),
Expanded(
child: TextField(
maxLines: 1,
// controller: controller,
// focusNode: _focusNode,
// autofocus: true,
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(16)),
textAlign: TextAlign.right,
textAlignVertical:
TextAlignVertical.center,
decoration: InputDecoration(
hintText: '点击输入排菜套餐价格',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: font(16),
),
isCollapsed:
true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
border: OutlineInputBorder(
borderSide: BorderSide.none),
contentPadding: EdgeInsets.zero,
),
keyboardType:
TextInputType.numberWithOptions(),
textInputAction: TextInputAction.done,
onChanged: (value) {
// setState(() {});
// _searchSellerLocation();
// customerProvider.searchData(value);
},
onEditingComplete: () {
FocusScope.of(context).requestFocus(
FocusNode()); //点击空白处隐藏键盘
// contantShowModel.searchData(
// contantShowModel.controller.text);
// _searchSellerLocation();
// _focusNode.unfocus();
},
)),
Text(
'元',
style: TextStyle(
fontSize: font(16),
color: MyColours.color_515151),
)
],
)),
MyDivider(double.infinity, w(1),
color: MyColours.color_DBDBDB),
VEmptyView(24),
_select('菜品', '编辑', () async {
// Map temp =
// await NavigatorUtil.godishToPersonnalPage(
// context, uids);
// if (temp != null && temp['object'] != null) {
// uids = temp['object'];
// }
NavigatorUtil.goPlanNewDishPage(context);
}),
_explain('券说明', '点击上面右侧的“编辑”,开始选菜吧!'),
VEmptyView(20),
],
))),
),
VEmptyView(20),
RoundButton(
onPressed: () {
// if (_dishNameEditControl.text.trim().length == 0) {
// Utils.showToast('请填写券名称');
// return;
// }
// if (_dishRequireEditControl.text.trim().length == 0) {
// Utils.showToast('请填写券要求');
// return;
// }
// if (fromDate == '点击选择') {
// Utils.showToast('请选择有效期起始时间');
// return;
// }
// if (endDate == '点击选择') {
// Utils.showToast('请选择有效期结束时间');
// return;
// }
// if (DateUtil.getDateTime(endDate)
// .compareTo(DateUtil.getDateTime(fromDate)) <
// 0) {
// Utils.showToast('有效期结束时间不能早于起始时间');
// return;
// }
// // ***参数***
// // _dishNameEditControl.text
// // _dishRequireEditControl.text
// // fromDate
// // endDate
// // _dishExplainEditControl.text
// // swichState
_createNewdish();
},
text: '立即创建',
fontSize: 24,
isBold: false,
height: ScreenUtil().setWidth(37 * 2),
width: ScreenUtil().setWidth(130 * 2),
radius: ScreenUtil().setWidth(22),
),
VEmptyView(32)
]))),
);
}
}
... ...
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/coupon_model.dart';
import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/dashed_line_widget.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../../provider/user_model.dart';
import '../../../utils/screen_util.dart';
class PlanDishItem extends StatefulWidget {
// final String from;
final VoidCallback onPressedDel;
final VoidCallback onPressedReUse;
// final CouponSunModel couponSonModel;
// final bool showBtn;
// final bool showCheck;
PlanDishItem({
Key key,
// this.from,
this.onPressedDel,
this.onPressedReUse,
// this.couponSonModel,
// this.showBtn = false,
// this.showCheck = false
}) : super(key: key);
@override
_PlanDishItemState createState() => _PlanDishItemState();
}
class _PlanDishItemState extends State<PlanDishItem> {
// bool showText = false;
@override
Widget build(BuildContext context) {
// CouponSunModel sunModel = widget.couponSonModel;
bool notSelect = false;
// if (widget.from == 'history') {
// notSelect = false;
// } else {
// notSelect = sunModel.isOpenBool;
// }
double explainH = 0.0;
// if (ObjectUtil.isNotEmpty(sunModel.explain)) {
// explainH = Utils.calculateTextHeight(
// '说明:${sunModel.explain}',
// ScreenUtil().setSp(20),
// FontWeight.normal,
// ScreenUtil().screenWidth -
// ScreenUtil().setWidth(92 * 2) +
// ScreenUtil().setWidth(20),
// 5,
// context);
// }
UserModel userModel = Provider.of<UserModel>(context, listen: false);
return InkWell(
// onTap: widget.onPressed,
child: Container(
// width: ScreenUtil().setWidth(610),
margin: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(32)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.25),
offset: Offset(0, ScreenUtil().setWidth(8)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(16)),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: ScreenUtil().setWidth(60),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(24)),
decoration: BoxDecoration(
color: true //开启可用
? true //店铺
? MyColours.color_438E93
: MyColours.color_ED7B2F
: MyColours.color_999999,
// color: widget.from == 'history'
// ? MyColours.color_BFC4D4
// : notSelect
// ? sunModel.isType == '1'
// ? MyColours.color_438E93
// : MyColours.color_ED7B2F
// : MyColours.color_999999,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(16)),
topRight:
Radius.circular(ScreenUtil().setWidth(16)))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: w(18),
height: w(18),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(w(9)),
border: Border.all(
width: w(1), color: MyColours.color_F8F9FD)),
child: Text(
// sunModel.isType == '1'
// ? sunModel.isExamine == '1'
// ? '店铺优惠券(核销)'
// : '店铺优惠券'
// :
true ? '店' : '私',
textAlign: TextAlign.center,
style: TextStyle(
color: MyColours.color_F8F9FD,
fontSize: ScreenUtil().setSp(20)),
),
),
HEmptyView(6),
Text(
// sunModel.isType == '1'
// ? sunModel.isExamine == '1'
// ? '店铺优惠券(核销)'
// : '店铺优惠券'
// :
'朋友小聚8人畅享',
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(32)),
),
Spacer(),
InkWell(
// onTap: widget.onPressedSwich,
child: Text(
// sunModel.isType == '1'
// ? sunModel.isExamine == '1'
// ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张'
// : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张'
// : '被领取:${sunModel.receiveNum}张',
'1100元/8人',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24))),
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(20 * 2),
ScreenUtil().setWidth(12 * 2),
ScreenUtil().setWidth(20 * 2),
ScreenUtil().setWidth(14 * 2)),
child: Text(
// sunModel.isType == '1'
// ? sunModel.isExamine == '1'
// ? '店铺优惠券(核销)'
// : '店铺优惠券'
// :
'铁锅炖大鹅,白山叫花鸡,主席红烧肉,清蒸鲈鱼,荷塘小炒,松仁玉米,咸蛋黄焗南瓜,黑椒牛柳,夫妻肺片,蒜泥茄子,卤水…',
maxLines: 2,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(20)),
),
),
MySeparator(width: w(3), color: MyColours.color_BFC4D4),
Container(
padding: EdgeInsets.symmetric(
horizontal: w(20), vertical: w(8)),
child: Row(
children: [
Text(
// sunModel.isType == '1'
// ? sunModel.isExamine == '1'
// ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张'
// : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张'
// : '被领取:${sunModel.receiveNum}张',
'更新时间:2022-11-08',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(20))),
Spacer(),
//私,则是自己的,可删除
true || userModel.user.role_name == '管理员' ||
userModel.user.role_name == '店长'
? RoundButton(
width: ScreenUtil().setWidth(50 * 2),
height: ScreenUtil().setWidth(20 * 2),
radius: ScreenUtil().setWidth(10),
text: '删除',
fontSize: 24,
textColor: MyColours.color_E34D59,
borderColor: MyColours.color_E34D59,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
onPressed: widget.onPressedDel,
)
: SizedBox(),
HEmptyView(34),
RoundButton(
width: ScreenUtil().setWidth(50 * 2),
height: ScreenUtil().setWidth(20 * 2),
radius: ScreenUtil().setWidth(10),
text: '复用',
fontSize: 24,
textColor: MyColours.color_438E93,
borderColor: MyColours.color_438E93,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
onPressed: widget.onPressedReUse,
)
],
))
])));
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/personnel_manage_model.dart';
import 'package:one_key/pages/coupon/coupon_item_f.dart';
import 'package:one_key/pages/my/plan_dish/plan_dish_item.dart';
import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/provider/personnel_provider.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/widgets/page_exception.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../../provider/plan_dish_provider.dart';
import '../../../utils/dialog_util.dart';
class PlanDishSunPage extends StatefulWidget {
final int index;
PlanDishSunPage({Key key, this.index}) : super(key: key);
@override
_PlanDishSunPageState createState() => _PlanDishSunPageState();
}
class _PlanDishSunPageState extends State<PlanDishSunPage> {
EasyRefreshController _controller = EasyRefreshController();
PlanDishProvider planDishProvider;
List<PersonnelManageSunModel> authUserLists = [];
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
// if (widget.index == 0) {
// planDishProvider.pageState = PageState.Loading;
// } else if (widget.index == 1) {
// planDishProvider.pageStateStore = PageState.Loading;
// } else if (widget.index == 2) {
// planDishProvider.pageStateMine = PageState.Loading;
// }
// couponProvider.notifyListeners();
// _couponNetworkData(widget.index, isShowLoading: false);
// bus.on("refresh_coupon_list_f", (arg) {
// _couponNetworkData(widget.index);
// });
});
}
@override
void dispose() {
super.dispose();
}
///获取优惠券列表数据
// _couponNetworkData(int index, {bool isShowLoading = true}) async {
// Map<String, String> params = {
// "uid": Provider.of<UserModel>(context, listen: false).user.openid,
// // 'is_time': '0'
// "is_type": index.toString()
// };
// await couponProvider.getCustomerActivity(context, params, index,
// isShowLoading: isShowLoading);
// }
///修改活动信息
// _setCustomerActivity(int index) async {
// Map<String, String> params = {
// "id": couponProvider.couponList[index].id,
// "status": couponProvider.couponList[index].isOpenBool ? '1' : '0',
// };
// bool isSuccess = await couponProvider.setCustomerActivity(context, params,
// isShowLoading: false);
// print(isSuccess);
// _couponNetworkData(widget.index, isShowLoading: false);
// // if (isSuccess) {
// // couponProvider.notifyListeners();
// // } else {
// // couponProvider.couponList[index].isOpenBool =
// // !couponProvider.couponList[index].isOpenBool;
// // couponProvider.notifyListeners();
// // }
// }
@override
Widget build(BuildContext context) {
planDishProvider = Provider.of<PlanDishProvider>(context, listen: true);
PageState pageState;
if (widget.index == 0) {
pageState = planDishProvider.pageState;
} else if (widget.index == 1) {
pageState = planDishProvider.pageStateStore;
} else if (widget.index == 2) {
pageState = planDishProvider.pageStateMine;
}
return Container(
child: Consumer<CouponProvider>(builder: (context, model, _) {
if (pageState != PageState.Success) {
return ExceptionPage(
pageState: pageState,
callback: () {
// offset = 0;
// getMessage(showLoading: true);
// _couponNetworkData(widget.index);
},
emptyMsg: "暂时没有列表信息哦,",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
needEmpty: true,
);
} else {
return EasyRefresh.custom(
controller: _controller,
shrinkWrap: true,
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return PlanDishItem(
// from: 'quan',
// couponSonModel: couponProvider.couponList[index],
// showBtn: true,
onPressedDel: () {
//弹框确认是否删除
DialogUtil.cupertinoAlertDialog(context,
title: "",
content: "确定要将该排菜删除吗?删除后将无法再次使用该排菜。",
rTitle: "确定", rCallback: () {
// Navigator.pop(context);
// _delGuestInfocDay(model.cday[index].id);
});
},
onPressedReUse: () {
NavigatorUtil.goFinalPlanDishPage(context);
},
);
}, childCount: 10),
),
// SliverList(
// delegate: SliverChildBuilderDelegate(
// (BuildContext context, int index) {
// return Column(
// children: [
// InkWell(
// onTap: () {
// NavigatorUtil.goCouponHistoryPage(context);
// },
// child: RichText(
// text: TextSpan(
// style: TextStyle(
// fontSize: ScreenUtil().setSp(28),
// ),
// children: [
// TextSpan(
// text: '没有更多了,',
// style: TextStyle(
// color: MyColours.color_000000)),
// TextSpan(
// text: '查看过期优惠券',
// style: TextStyle(
// color: MyColours.color_438E93)),
// ]))),
// VEmptyView(80)
// ],
// );
// }, childCount: 1),
// )
],
// onRefresh: () async {
// // offset = 0;
// // getMessage(showLoading: false);
// },
// onLoad: () async {
// // offset++;
// // getMessage(showLoading: false);
// },
);
}
}),
);
}
}
... ...
... ... @@ -585,7 +585,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
fontSize: 36,
isBold: false,
onPressed: () {
NavigatorUtil.goFinalPlanDishPage(context);
Navigator.pop(context);
},
),
)
... ...
... ... @@ -13,8 +13,11 @@ import '../net/http_url.dart';
* 预排菜
*/
class PlanDishProvider extends ChangeNotifier {
PageState pageState = PageState.Loading;
PageState pageState = PageState.Success;
PageState pageStateStore = PageState.Success;
PageState pageStateMine = PageState.Success;
PageState pageStateMy = PageState.Success;
List<MenuModel> menuModel; //菜品数据
// List<CookbookCategorySunModel> categorySunModel; //菜品分类数据
// List<CookbookSpecSunModel> specSunModel; //计价单位
... ...
... ... @@ -1281,4 +1281,41 @@ class NavigatorUtil {
return _navigateTo(context, "${Routes.order_edit_list_show_page}",
replace: replace);
}
///经理排菜- 类型选择
static Future<dynamic> goPlanDishCreateSelectTypePage(
BuildContext context, {
replace = false,
}) {
// if (invoice != null) {
// return _navigateTo(context,
// "${Routes.order_advance_home_page}?invoice=${FluroConvertUtils.object2string(invoice)}",
// replace: replace);
// }
// if (object != null) {
// return _navigateTo(context,
// "${Routes.order_advance_home_page}?tids=$tids&tableidNow=$tableidNow&fromPage=$fromPage&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
// }
return _navigateTo(context, "${Routes.plan_dish_create_select_type_page}",
replace: replace);
}
///经理排菜- 编辑页
static Future<dynamic> goPlanDishEditPage(BuildContext context,
{replace = false, bool isMine}) {
// if (invoice != null) {
// return _navigateTo(context,
// "${Routes.plan_dish_edit_page}?invoice=${FluroConvertUtils.object2string(invoice)}",
// replace: replace);
// }
// if (object != null) {
// return _navigateTo(context,
// "${Routes.plan_dish_edit_page}?tids=$tids&tableidNow=$tableidNow&fromPage=$fromPage&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
// }
return _navigateTo(
context, "${Routes.plan_dish_edit_page}?isMine=${isMine}",
replace: replace);
}
}
... ...
... ... @@ -177,6 +177,8 @@ import '../pages/my/feast_manage/feast_wine_manage_edit_page.dart';
import '../pages/my/feast_manage/feast_wine_manage_page.dart';
import '../pages/my/plan_dish/final_plan_dish_page.dart';
import '../pages/my/plan_dish/my_plan_dish_home_page.dart';
import '../pages/my/plan_dish/plan_dish_create_select_type_page.dart';
import '../pages/my/plan_dish/plan_dish_eidt_page.dart';
import '../pages/my/plan_dish/plan_new_dish_first_page.dart';
import '../pages/my/plan_dish/plan_new_dish_page.dart';
import '../pages/my/table_manage/merge_table_select_page.dart';
... ... @@ -1999,3 +2001,46 @@ var orderEditListShowPageHandle = new Handler(
return ChangeNotifierProvider<PlanDishProvider>(
create: (_) => PlanDishProvider(), child: OrderEditListShowPage());
});
///经理排菜--类型选择
var planDishCreateSelectTypePageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String fromPage = params["fromPage"].first;
// String tids = params["tids"].first;
// String tableidNow = params["tableidNow"].first;
// bool canChoose = params["canChoose"].first == "true" ? true : false;
// List<TableList> res = [];
// if (params.keys.contains('object')) {
// Map object = FluroConvertUtils.string2map(params["object"].first);
// List temp = object['object'];
// for (var item in temp) {
// res.add(TableList.fromJson(item));
// }
// }
return ChangeNotifierProvider<PlanDishProvider>(
create: (_) => PlanDishProvider(), child: PlanDishCreateSelectTypePage());
});
///经理排菜--编辑页
var planDishEidtPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String fromPage = params["fromPage"].first;
// String tids = params["tids"].first;
// String tableidNow = params["tableidNow"].first;
// bool canChoose = params["canChoose"].first == "true" ? true : false;
// List<TableList> res = [];
// if (params.keys.contains('object')) {
// Map object = FluroConvertUtils.string2map(params["object"].first);
// List temp = object['object'];
// for (var item in temp) {
// res.add(TableList.fromJson(item));
// }
// }
bool isMine = FluroConvertUtils.string2bool(params["isMine"].first);
return ChangeNotifierProvider<PlanDishProvider>(
create: (_) => PlanDishProvider(), child: PlanDishEidtPage(isMine: isMine,));
});
... ...
... ... @@ -178,6 +178,9 @@ class Routes {
static String order_preview_page = "/order_preview_page"; //预览页
static String order_edit_list_show_page =
"/order_edit_list_show_page"; //经理排菜编辑列表展示
static String plan_dish_create_select_type_page =
"/plan_dish_create_select_type_page"; //经理排菜---类型选择页
static String plan_dish_edit_page = "/plan_dish_eidt_page"; //经理排菜---编辑页
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -349,5 +352,9 @@ class Routes {
router.define(order_preview_page, handler: orderPreviewPageHandle);
router.define(order_edit_list_show_page,
handler: orderEditListShowPageHandle);
router.define(plan_dish_create_select_type_page,
handler: planDishCreateSelectTypePageHandle);
router.define(plan_dish_edit_page, handler: planDishEidtPageHandle);
}
}
... ...
... ... @@ -29,7 +29,8 @@ class RoundButton extends StatelessWidget {
this.borderColor = Colors.transparent,
this.isBold = true,
this.padding = EdgeInsets.zero,
this.space = 6, int imageWidth})
this.space = 6,
int imageWidth})
: super(key: key);
final String image;
... ... @@ -102,17 +103,19 @@ class RoundButton extends StatelessWidget {
: Text(''),
Expanded(
child: Container(
padding: EdgeInsets.only(top: ScreenUtil().setWidth(2)),
// padding:
// EdgeInsets.only(top: ScreenUtil().setWidth(2)),
child: ExText(
text,
style ??
new TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(fontSize),
fontWeight:
isBold ? FontWeight.bold : FontWeight.normal),
overflow: TextOverflow.ellipsis,
)))
text,
style ??
new TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(fontSize),
fontWeight: isBold
? FontWeight.bold
: FontWeight.normal),
overflow: TextOverflow.ellipsis,
)))
],
),
),
... ...