Commit 182ed04e5c788ce91866d197566268ce0f18c981

Authored by wdn127929
1 parent 78c935ce

修改后排菜和套菜

@@ -2609,50 +2609,50 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -2609,50 +2609,50 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
2609 ? SizedBox() 2609 ? SizedBox()
2610 : Row( 2610 : Row(
2611 children: [ 2611 children: [
2612 - // detailEntity.order.cookbooklist  
2613 - // .length ==  
2614 - // 0  
2615 - // ? Expanded(  
2616 - // flex: 1,  
2617 - // child: InkWell(  
2618 - // onTap: () {  
2619 - // NavigatorUtil  
2620 - // .goOrderAdvanceHomePage(  
2621 - // context,  
2622 - // );  
2623 - // },  
2624 - // child: Container(  
2625 - // margin: EdgeInsets.only(  
2626 - // right: ScreenUtil()  
2627 - // .setWidth(20)),  
2628 - // decoration: BoxDecoration(  
2629 - // color: MyColours  
2630 - // .color_ffffff,  
2631 - // border: Border.all(  
2632 - // width: w(1),  
2633 - // color: MyColours  
2634 - // .color_438E93),  
2635 - // borderRadius:  
2636 - // BorderRadius.circular(  
2637 - // ScreenUtil()  
2638 - // .setWidth(  
2639 - // 10)),  
2640 - // ),  
2641 - // child: Align(  
2642 - // alignment:  
2643 - // Alignment.center,  
2644 - // child: Text('预点菜',  
2645 - // style: TextStyle(  
2646 - // color: MyColours  
2647 - // .color_438E93,  
2648 - // fontSize:  
2649 - // ScreenUtil()  
2650 - // .setSp(  
2651 - // 34))),  
2652 - // ),  
2653 - // ),  
2654 - // ))  
2655 - // : SizedBox(), 2612 + detailEntity.order.cookbooklist
  2613 + .length ==
  2614 + 0
  2615 + ? Expanded(
  2616 + flex: 1,
  2617 + child: InkWell(
  2618 + onTap: () {
  2619 + NavigatorUtil
  2620 + .goOrderAdvanceHomePage(
  2621 + context,
  2622 + );
  2623 + },
  2624 + child: Container(
  2625 + margin: EdgeInsets.only(
  2626 + right: ScreenUtil()
  2627 + .setWidth(20)),
  2628 + decoration: BoxDecoration(
  2629 + color: MyColours
  2630 + .color_ffffff,
  2631 + border: Border.all(
  2632 + width: w(1),
  2633 + color: MyColours
  2634 + .color_438E93),
  2635 + borderRadius:
  2636 + BorderRadius.circular(
  2637 + ScreenUtil()
  2638 + .setWidth(
  2639 + 10)),
  2640 + ),
  2641 + child: Align(
  2642 + alignment:
  2643 + Alignment.center,
  2644 + child: Text('预点菜',
  2645 + style: TextStyle(
  2646 + color: MyColours
  2647 + .color_438E93,
  2648 + fontSize:
  2649 + ScreenUtil()
  2650 + .setSp(
  2651 + 34))),
  2652 + ),
  2653 + ),
  2654 + ))
  2655 + : SizedBox(),
2656 Expanded( 2656 Expanded(
2657 flex: 2, 2657 flex: 2,
2658 child: InkWell( 2658 child: InkWell(
@@ -649,25 +649,25 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -649,25 +649,25 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
649 Utils.getImgPath('cybz'), '常用备注')), 649 Utils.getImgPath('cybz'), '常用备注')),
650 ], 650 ],
651 ), 651 ),
652 - // VEmptyView(68),  
653 - // Row(  
654 - // mainAxisAlignment:  
655 - // MainAxisAlignment.spaceEvenly,  
656 - // children: [  
657 - // InkWell(  
658 - // onTap: () {  
659 - // NavigatorUtil.goMyPlanDishHomePage(  
660 - // context);  
661 - // },  
662 - // child: _item(  
663 - // Utils.getImgPath('cdgl'), '我的排菜')),  
664 - // InkWell(  
665 - // onTap: () {}, child: _item('', '空空空空')),  
666 - // InkWell(  
667 - // onTap: () {}, child: _item('', '空空空空')),  
668 - // InkWell(  
669 - // onTap: () {}, child: _item('', '空空空空')),  
670 - // ]) 652 + VEmptyView(68),
  653 + Row(
  654 + mainAxisAlignment:
  655 + MainAxisAlignment.spaceEvenly,
  656 + children: [
  657 + InkWell(
  658 + onTap: () {
  659 + NavigatorUtil.goMyPlanDishHomePage(
  660 + context);
  661 + },
  662 + child: _item(
  663 + Utils.getImgPath('cdgl'), '套餐排菜')),
  664 + InkWell(
  665 + onTap: () {}, child: _item('', '空空空空')),
  666 + InkWell(
  667 + onTap: () {}, child: _item('', '空空空空')),
  668 + InkWell(
  669 + onTap: () {}, child: _item('', '空空空空')),
  670 + ])
671 ]), 671 ]),
672 )), 672 )),
673 VEmptyView(20), 673 VEmptyView(20),
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
  2 +import 'package:flutter_easyrefresh/easy_refresh.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:one_key/constant/state.dart';
  5 +import 'package:one_key/pages/coupon/coupon_sun_page.dart';
  6 +import 'package:one_key/pages/my/plan_dish/plan_dish_sun_page.dart';
  7 +import 'package:one_key/provider/coupon_provider.dart';
  8 +import 'package:one_key/provider/personnel_provider.dart';
  9 +import 'package:one_key/provider/user_model.dart';
2 import 'package:one_key/res/colors.dart'; 10 import 'package:one_key/res/colors.dart';
  11 +import 'package:one_key/utils/event_bus.dart';
3 import 'package:one_key/route/navigator_util.dart'; 12 import 'package:one_key/route/navigator_util.dart';
4 -import 'package:one_key/utils/utils.dart';  
5 -import 'package:one_key/widgets/MyDivider.dart';  
6 -import 'package:one_key/widgets/h_empty_view.dart';  
7 import 'package:one_key/widgets/round_button.dart'; 13 import 'package:one_key/widgets/round_button.dart';
8 import 'package:one_key/widgets/system_app_bar.dart'; 14 import 'package:one_key/widgets/system_app_bar.dart';
9 import 'package:one_key/widgets/v_empty_view.dart'; 15 import 'package:one_key/widgets/v_empty_view.dart';
  16 +import 'package:provider/provider.dart';
10 17
11 -import '../../../utils/dialog_util.dart';  
12 -import '../../../utils/screen_util.dart'; 18 +import '../../../provider/plan_dish_provider.dart';
13 19
14 /** 20 /**
15 * 21 *
16 * 我的排菜首页 22 * 我的排菜首页
17 */ 23 */
  24 +
18 class MyPlanDishHomePage extends StatefulWidget { 25 class MyPlanDishHomePage extends StatefulWidget {
19 - MyPlanDishHomePage({Key key}) : super(key: key); 26 + final bool needRefrsh;
  27 + MyPlanDishHomePage({Key key, this.needRefrsh = false}) : super(key: key);
20 28
21 @override 29 @override
22 _MyPlanDishHomePageState createState() => _MyPlanDishHomePageState(); 30 _MyPlanDishHomePageState createState() => _MyPlanDishHomePageState();
23 } 31 }
24 32
25 -class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> { 33 +class _MyPlanDishHomePageState extends State<MyPlanDishHomePage>
  34 + with TickerProviderStateMixin {
  35 + EasyRefreshController _controller = EasyRefreshController();
  36 + CouponProvider couponProvider;
  37 + TabController tabController;
  38 +
  39 + // ///获取优惠券列表数据
  40 + // _couponNetworkData(int index, {bool isShowLoading = true}) async {
  41 + // Map<String, String> params = {
  42 + // "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  43 + // // 'is_time': '0'
  44 + // "is_type": index.toString()
  45 + // };
  46 + // await couponProvider.getCustomerActivity(context, params,
  47 + // isShowLoading: isShowLoading);
  48 + // }
  49 +
  50 + ///修改活动信息
  51 + // _setCustomerActivity(int index) async {
  52 + // Map<String, String> params = {
  53 + // "id": couponProvider.couponList[index].id,
  54 + // "status": couponProvider.couponList[index].isOpenBool ? '1' : '0'
  55 + // };
  56 + // bool isSuccess = await couponProvider.setCustomerActivity(context, params,
  57 + // isShowLoading: false);
  58 + // print(isSuccess);
  59 + // _couponNetworkData(tabController.index, isShowLoading: false);
  60 + // // if (isSuccess) {
  61 + // // couponProvider.notifyListeners();
  62 + // // } else {
  63 + // // couponProvider.couponList[index].isOpenBool =
  64 + // // !couponProvider.couponList[index].isOpenBool;
  65 + // // couponProvider.notifyListeners();
  66 + // // }
  67 + // }
  68 +
  69 + @override
  70 + void initState() {
  71 + // TODO: implement initState
  72 + super.initState();
  73 + tabController = TabController(length: 3, vsync: this);
  74 + tabController.addListener(() {
  75 + // couponProvider.couponList = [];
  76 + // couponProvider.pageState = PageState.Loading;
  77 + // setState(() {});
  78 + //点击tab时或滑动tab回调一次
  79 + if (tabController.index.toDouble() == tabController.animation.value) {
  80 + // couponProvider.notifyListeners();
  81 + // _couponNetworkData(tabController.index);
  82 + // selectIndex = tabController.index;
  83 + // setState(() {});
  84 + }
  85 + });
  86 + WidgetsBinding.instance.addPostFrameCallback((_) {
  87 + // _couponNetworkData(0);
  88 + });
  89 + // bus.on("refresh_coupon_list_f", (arg) {
  90 + // _couponNetworkData(tabController.index);
  91 + // });
  92 + }
  93 +
  94 + @override
  95 + void dispose() {
  96 + bus.off("refresh_coupon_list_f");
  97 + super.dispose();
  98 + }
  99 +
26 @override 100 @override
27 Widget build(BuildContext context) { 101 Widget build(BuildContext context) {
  102 + couponProvider = Provider.of<CouponProvider>(context, listen: true);
28 return Scaffold( 103 return Scaffold(
29 - appBar: SystemAppBar('我的排菜'),  
30 - backgroundColor: MyColours.color_ffffff,  
31 - body: Column(  
32 - children: [  
33 - MyDivider(  
34 - double.infinity,  
35 - w(1),  
36 - color: MyColours.color_DBDBDB,  
37 - ),  
38 - Expanded(  
39 - child: ListView.builder(  
40 - itemCount: 10,  
41 - itemBuilder: (context, index) {  
42 - return Container(  
43 - decoration: BoxDecoration(  
44 - border: Border(  
45 - bottom: BorderSide(  
46 - color: MyColours.color_DBDBDB, width: w(1)))),  
47 - child: Padding(  
48 - padding: EdgeInsets.only(  
49 - left: w(20), right: w(20), top: w(15), bottom: w(3)),  
50 - child: Column(  
51 - children: [  
52 - Row(  
53 - children: [  
54 - Expanded(  
55 - child: Text(  
56 - '8人聚会餐',  
57 - maxLines: 3,  
58 - style: TextStyle(  
59 - fontSize: font(16),  
60 - color: MyColours.color_515151),  
61 - overflow: TextOverflow.ellipsis,  
62 - )),  
63 - HEmptyView(22),  
64 - Text('1200元/8人',  
65 - style: TextStyle(  
66 - fontSize: font(14),  
67 - color: MyColours.color_515151)),  
68 - HEmptyView(22),  
69 - InkWell(  
70 - onTap: () {  
71 - //弹框确认是否删除  
72 - DialogUtil.cupertinoAlertDialog(context,  
73 - title: "",  
74 - content: "是否确定删除该排菜?",  
75 - rTitle: "确定删除", rCallback: () {  
76 - // Navigator.pop(context);  
77 - // _delGuestInfocDay(model.cday[index].id);  
78 - });  
79 - },  
80 - child: Padding(  
81 - padding: EdgeInsets.only(left: w(11)),  
82 - child: Image.asset(  
83 - Utils.getImgPath('f_delete_red'),  
84 - width: w(17),  
85 - )))  
86 - ],  
87 - ),  
88 - VEmptyView(22),  
89 - Text(  
90 - '铁锅炖大鹅,白山叫花鸡,主席红烧肉,清蒸鲈鱼,荷塘小炒,松仁玉米,咸蛋黄焗南瓜,黑椒牛柳,夫妻肺片,蒜泥茄子,卤水拼盘,东北大拉皮,西湖牛肉羹,扬州炒饭,咸蛋黄焗南瓜,黑椒牛柳,夫妻肺片,蒜泥茄子,卤水拼盘,东北大拉皮,西湖牛肉羹,扬州炒饭',  
91 - maxLines: 3,  
92 - style: TextStyle(  
93 - fontSize: font(12),  
94 - color: MyColours.color_515151),  
95 - overflow: TextOverflow.ellipsis,  
96 - ),  
97 - VEmptyView(8),  
98 - Row(  
99 - children: [  
100 - Container(  
101 - height: w(24),  
102 - padding: EdgeInsets.only(top: w(6)),  
103 - child: Text('更新时间:2022-11-08',  
104 - style: TextStyle(  
105 - fontSize: font(12),  
106 - color: MyColours.color_515151)),  
107 - ),  
108 - Spacer(),  
109 - RoundButton(  
110 - text: '复用',  
111 - width: w(80),  
112 - height: w(30),  
113 - fontSize: 24,  
114 - gradientStart: MyColours.color_ffffff,  
115 - gradientEnd: MyColours.color_ffffff,  
116 - borderColor: MyColours.color_438E93,  
117 - textColor: MyColours.color_438E93,  
118 - radius: r(5),  
119 - isBold: false,  
120 - onPressed: () {  
121 - NavigatorUtil.goFinalPlanDishPage(context);  
122 - },  
123 - ),  
124 - HEmptyView(20),  
125 - RoundButton(  
126 - text: '修改',  
127 - width: w(80),  
128 - height: w(30),  
129 - fontSize: 24,  
130 - gradientStart: MyColours.color_ffffff,  
131 - gradientEnd: MyColours.color_ffffff,  
132 - borderColor: MyColours.color_438E93,  
133 - textColor: MyColours.color_438E93,  
134 - radius: r(5),  
135 - isBold: false,  
136 - onPressed: () {  
137 - NavigatorUtil.goFinalPlanDishPage(context);  
138 - },  
139 - )  
140 - ],  
141 - )  
142 - ], 104 + backgroundColor: MyColours.color_f3f3f3,
  105 + appBar: SystemAppBar('排菜与套餐', onTap: () {
  106 + // if (widget.needRefrsh) {
  107 + // EventBus().emit('refresh_coupon_invitation');
  108 + // } else {
  109 + // EventBus().emit('changeStatusColor');
  110 + // }
  111 +
  112 + Navigator.of(context).pop();
  113 + }),
  114 + body: WillPopScope(
  115 + onWillPop: () {
  116 + // if (widget.needRefrsh) {
  117 + // EventBus().emit('refresh_coupon_invitation');
  118 + // } else {
  119 + // EventBus().emit('changeStatusColor');
  120 + // }
  121 + Navigator.of(context).pop();
  122 + },
  123 + child: Column(
  124 + children: <Widget>[
  125 + Container(
  126 + width: double.infinity,
  127 + height: ScreenUtil().setWidth(80),
  128 + color: MyColours.color_ffffff,
  129 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(6)),
  130 + child: TabBar(
  131 + controller: tabController,
  132 + tabs: [
  133 + Tab(
  134 + text: "全部",
  135 + ),
  136 + Tab(
  137 + text: "店铺套餐",
143 ), 138 ),
  139 + Tab(
  140 + text: "我的排菜",
  141 + )
  142 + ],
  143 + indicatorColor: MyColours.color_438E93,
  144 + indicatorSize: TabBarIndicatorSize.label,
  145 + indicatorWeight: ScreenUtil().setWidth(4),
  146 + labelColor: MyColours.color_438E93,
  147 + unselectedLabelColor: MyColours.color_999999,
  148 + labelStyle: TextStyle(
  149 + color: MyColours.color_438E93,
  150 + fontSize: ScreenUtil().setSp(28),
  151 + fontWeight: FontWeight.bold),
  152 + unselectedLabelStyle: TextStyle(
  153 + color: MyColours.color_999999,
  154 + fontSize: ScreenUtil().setSp(24),
144 ), 155 ),
145 - );  
146 - }), 156 + )),
  157 + VEmptyView(32),
  158 + Expanded(
  159 + child: TabBarView(
  160 + controller: tabController,
  161 + children: [
  162 + ChangeNotifierProvider<PlanDishProvider>(
  163 + create: (_) => PlanDishProvider(),
  164 + child: PlanDishSunPage(index: 0)),
  165 + ChangeNotifierProvider<PlanDishProvider>(
  166 + create: (_) => PlanDishProvider(),
  167 + child: PlanDishSunPage(index: 1)),
  168 + ChangeNotifierProvider<PlanDishProvider>(
  169 + create: (_) => PlanDishProvider(),
  170 + child: PlanDishSunPage(index: 2)),
  171 + ],
  172 + ),
  173 + ),
  174 + Container(
  175 + height: ScreenUtil().setWidth(91 * 2),
  176 + width: double.infinity,
  177 + padding: EdgeInsets.only(
  178 + top: ScreenUtil().setWidth(16 * 2),
  179 + bottom: ScreenUtil().setWidth(35 * 2),
  180 + left: ScreenUtil().setWidth(45 * 2),
  181 + right: ScreenUtil().setWidth(45 * 2),
  182 + ),
  183 + decoration: BoxDecoration(
  184 + color: MyColours.color_ffffff,
  185 + boxShadow: [
  186 + BoxShadow(
  187 + spreadRadius: ScreenUtil().setWidth(2),
  188 + color: Color.fromRGBO(0, 0, 0, 0.1),
  189 + offset: Offset(0, ScreenUtil().setWidth(-2)),
  190 + blurRadius: ScreenUtil().setWidth(8))
  191 + ],
  192 + borderRadius: BorderRadius.all(
  193 + Radius.circular(ScreenUtil().setWidth(16)),
  194 + ),
  195 + ),
  196 + child: RoundButton(
  197 + text: '创建新排菜',
  198 + height: ScreenUtil().setWidth(80),
  199 + radius: ScreenUtil().setWidth(14),
  200 + isBold: false,
  201 + fontSize: 28,
  202 + onPressed: () async {
  203 + UserModel userModel =
  204 + Provider.of<UserModel>(context, listen: false);
  205 + if (userModel.user.role_name == '管理员' ||
  206 + userModel.user.role_name == '店长') {
  207 + NavigatorUtil.goPlanDishCreateSelectTypePage(context);
  208 + } else {
  209 + bool needRefresh =
  210 + await NavigatorUtil.goPlanDishEditPage(context);
  211 + print(needRefresh);
  212 + if (needRefresh != null && needRefresh) {
  213 + // bus.emit('refresh_coupon_list_f');
  214 + //刷新页面数据
  215 + // _controller.callRefresh();
  216 + // _couponNetworkData(tabController.index);
  217 + }
  218 + }
  219 + },
  220 + ),
  221 + )
  222 + ],
147 ), 223 ),
148 - Padding(  
149 - padding: EdgeInsets.only(  
150 - top: w(12), bottom: w(25), left: w(45), right: w(45)),  
151 - child: RoundButton(  
152 - text: '创建新排菜',  
153 - gradientStart: MyColours.color_438E93,  
154 - gradientEnd: MyColours.color_438E93,  
155 - width: double.infinity,  
156 - height: w(43),  
157 - radius: r(5),  
158 - fontSize: 36,  
159 - isBold: false,  
160 - onPressed: () {  
161 - NavigatorUtil.goPlanNewDishFirstPage(context);  
162 - },  
163 - ),  
164 - )  
165 - ],  
166 - ),  
167 - ); 224 + // child: Column(
  225 + // children: [
  226 + // Expanded(child: Consumer<CouponProvider>(
  227 + // builder: (context, model, _) {
  228 + // if (model.pageState != PageState.Success) {
  229 + // return ExceptionPage(
  230 + // pageState: model.pageState,
  231 + // callback: () {
  232 + // // offset = 0;
  233 + // // getMessage(showLoading: true);
  234 + // _couponNetworkData();
  235 + // },
  236 + // emptyMsg: "暂时没有列表信息哦",
  237 + // emptyImg: "empty_search",
  238 + // showMsg: "加载中,请稍后...",
  239 + // );
  240 + // } else {
  241 + // return EasyRefresh.custom(
  242 + // controller: _controller,
  243 + // shrinkWrap: true,
  244 + // slivers: [
  245 + // SliverList(
  246 + // delegate: SliverChildBuilderDelegate(
  247 + // (BuildContext context, int index) {
  248 + // return Container(
  249 + // margin:
  250 + // EdgeInsets.all(ScreenUtil().setWidth(40)),
  251 + // padding:
  252 + // EdgeInsets.all(ScreenUtil().setWidth(30)),
  253 + // color: MyColours.color_F0F0F0,
  254 + // child: Text(
  255 + // '使用说明:需在结账前出示优惠券二维码,店内工作人员微信扫码核销。超过有效期的券,会自动作废并移出列表。优惠券不可找零、兑现。',
  256 + // style: TextStyle(
  257 + // color: MyColours.color_666666,
  258 + // fontSize: ScreenUtil().setSp(24),
  259 + // ),
  260 + // strutStyle: StrutStyle(
  261 + // forceStrutHeight: true,
  262 + // height: 1,
  263 + // leading: 0.3),
  264 + // ));
  265 + // }, childCount: 1),
  266 + // ),
  267 + // SliverList(
  268 + // delegate: SliverChildBuilderDelegate(
  269 + // (BuildContext context, int index) {
  270 + // return CouponItem(
  271 + // from: 'quan',
  272 + // couponSonModel:
  273 + // couponProvider.couponList[index],
  274 + // showBtn: true,
  275 + // onPressedSwich: () {
  276 + // couponProvider.couponList[index].isOpenBool =
  277 + // !couponProvider
  278 + // .couponList[index].isOpenBool;
  279 + // _setCustomerActivity(index);
  280 + // },
  281 + // onPressed: () {
  282 + // NavigatorUtil.goCouponDetailPage(context,
  283 + // couponProvider.couponList[index]);
  284 + // },
  285 + // );
  286 + // }, childCount: couponProvider.couponList.length),
  287 + // )
  288 + // ],
  289 + // // onRefresh: () async {
  290 + // // // offset = 0;
  291 + // // // getMessage(showLoading: false);
  292 + // // },
  293 + // // onLoad: () async {
  294 + // // // offset++;
  295 + // // // getMessage(showLoading: false);
  296 + // // },
  297 + // );
  298 + // }
  299 + // },
  300 + // )),
  301 + // VEmptyView(20),
  302 + // Padding(
  303 + // padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
  304 + // ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
  305 + // child: RoundButton(
  306 + // onPressed: () async {
  307 + // bool needRefresh =
  308 + // await NavigatorUtil.goCouponEditPage(context);
  309 + // print(needRefresh);
  310 + // if (needRefresh != null && needRefresh) {
  311 + // //刷新页面数据
  312 + // // _controller.callRefresh();
  313 + // _couponNetworkData();
  314 + // }
  315 + // },
  316 + // text: '创建新券',
  317 + // fontSize: 34,
  318 + // isBold: false,
  319 + // height: ScreenUtil().setWidth(80),
  320 + // width: double.infinity,
  321 + // radius: ScreenUtil().setWidth(10),
  322 + // ))
  323 + // ],
  324 + // )
  325 + ));
168 } 326 }
169 } 327 }
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_inappwebview/flutter_inappwebview.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:one_key/res/colors.dart';
  5 +import 'package:one_key/route/navigator_util.dart';
  6 +import 'package:one_key/utils/event_bus.dart';
  7 +import 'package:one_key/utils/utils.dart';
  8 +import 'package:one_key/widgets/h_empty_view.dart';
  9 +import 'package:one_key/widgets/round_button.dart';
  10 +import 'package:one_key/widgets/system_app_bar.dart';
  11 +import 'package:one_key/widgets/v_empty_view.dart';
  12 +
  13 +/**
  14 + * 创建排菜---类型选择
  15 + */
  16 +class PlanDishCreateSelectTypePage extends StatefulWidget {
  17 + PlanDishCreateSelectTypePage({Key key}) : super(key: key);
  18 +
  19 + @override
  20 + _PlanDishCreateSelectTypePageState createState() =>
  21 + _PlanDishCreateSelectTypePageState();
  22 +}
  23 +
  24 +class _PlanDishCreateSelectTypePageState
  25 + extends State<PlanDishCreateSelectTypePage> {
  26 + bool selectF = true;
  27 + @override
  28 + Widget build(BuildContext context) {
  29 + return Scaffold(
  30 + backgroundColor: MyColours.color_ffffff,
  31 + appBar: SystemAppBar(
  32 + '选择排菜类型',
  33 + onTap: () {
  34 + Navigator.pop(context);
  35 + },
  36 + ),
  37 + body: SingleChildScrollView(
  38 + child: Column(
  39 + children: [
  40 + VEmptyView(98),
  41 + InkWell(
  42 + onTap: () {
  43 + if (!selectF) {
  44 + setState(() {
  45 + selectF = !selectF;
  46 + });
  47 + }
  48 + },
  49 + child: Container(
  50 + padding: EdgeInsets.symmetric(
  51 + horizontal: ScreenUtil().setWidth(60)),
  52 + margin: EdgeInsets.symmetric(
  53 + horizontal: ScreenUtil().setWidth(60)),
  54 + height: ScreenUtil().setWidth(106 * 2),
  55 + decoration: BoxDecoration(
  56 + boxShadow: [
  57 + BoxShadow(
  58 + offset: Offset(0, ScreenUtil().setWidth(4)),
  59 + blurRadius: ScreenUtil().setWidth(20),
  60 + spreadRadius: ScreenUtil().setWidth(2),
  61 + color: Color.fromRGBO(32, 109, 114, 0.2))
  62 + ],
  63 + color: selectF
  64 + ? MyColours.color_438E93
  65 + : MyColours.color_ffffff,
  66 + borderRadius:
  67 + BorderRadius.circular(ScreenUtil().setWidth(24))),
  68 + child: Row(
  69 + children: [
  70 + Image.asset(
  71 + Utils.getImgPath(selectF
  72 + ? 'coupon_select_type_user'
  73 + : 'coupon_select_type_user_un'),
  74 + width: ScreenUtil().setWidth(70 * 2),
  75 + ),
  76 + HEmptyView(70),
  77 + Expanded(
  78 + child: Column(
  79 + mainAxisAlignment: MainAxisAlignment.center,
  80 + crossAxisAlignment: CrossAxisAlignment.start,
  81 + children: [
  82 + Text(
  83 + '仅为我创建',
  84 + style: TextStyle(
  85 + fontWeight: FontWeight.bold,
  86 + fontSize: ScreenUtil().setSp(36),
  87 + color: selectF
  88 + ? MyColours.color_ffffff
  89 + : MyColours.color_999999),
  90 + ),
  91 + VEmptyView(16),
  92 + Text(
  93 + '创建后仅我可使用该排菜给顾客预点菜',
  94 + maxLines: 2,
  95 + overflow: TextOverflow.ellipsis,
  96 + style: TextStyle(
  97 + fontSize: ScreenUtil().setSp(24),
  98 + color: selectF
  99 + ? MyColours.color_ffffff
  100 + : MyColours.color_BFC4D4),
  101 + ),
  102 + ],
  103 + )),
  104 + ],
  105 + ),
  106 + )),
  107 + VEmptyView(94),
  108 + InkWell(
  109 + onTap: () {
  110 + if (selectF) {
  111 + setState(() {
  112 + selectF = !selectF;
  113 + });
  114 + }
  115 + },
  116 + child: Container(
  117 + padding: EdgeInsets.symmetric(
  118 + horizontal: ScreenUtil().setWidth(60)),
  119 + margin: EdgeInsets.symmetric(
  120 + horizontal: ScreenUtil().setWidth(60)),
  121 + height: ScreenUtil().setWidth(106 * 2),
  122 + decoration: BoxDecoration(
  123 + boxShadow: [
  124 + BoxShadow(
  125 + offset: Offset(0, ScreenUtil().setWidth(4)),
  126 + blurRadius: ScreenUtil().setWidth(20),
  127 + spreadRadius: ScreenUtil().setWidth(2),
  128 + color: Color.fromRGBO(0, 0, 0, 0.1))
  129 + ],
  130 + color: !selectF
  131 + ? MyColours.color_438E93
  132 + : MyColours.color_ffffff,
  133 + borderRadius:
  134 + BorderRadius.circular(ScreenUtil().setWidth(24))),
  135 + child: Row(
  136 + children: [
  137 + Image.asset(
  138 + Utils.getImgPath(!selectF
  139 + ? 'coupon_select_type_store'
  140 + : 'coupon_select_type_store_un'),
  141 + width: ScreenUtil().setWidth(75 * 2),
  142 + ),
  143 + HEmptyView(60),
  144 + Expanded(
  145 + child: Column(
  146 + mainAxisAlignment: MainAxisAlignment.center,
  147 + crossAxisAlignment: CrossAxisAlignment.start,
  148 + children: [
  149 + Text(
  150 + '为全店创建',
  151 + style: TextStyle(
  152 + fontWeight: FontWeight.bold,
  153 + fontSize: ScreenUtil().setSp(36),
  154 + color: !selectF
  155 + ? MyColours.color_ffffff
  156 + : MyColours.color_999999),
  157 + ),
  158 + VEmptyView(16),
  159 + Text(
  160 + '创建后所有员工均可使用该排菜给顾客预点菜',
  161 + style: TextStyle(
  162 + fontSize: ScreenUtil().setSp(24),
  163 + color: !selectF
  164 + ? MyColours.color_ffffff
  165 + : MyColours.color_BFC4D4),
  166 + ),
  167 + ],
  168 + )),
  169 + ],
  170 + ),
  171 + )),
  172 + VEmptyView(112),
  173 + RoundButton(
  174 + text: '立即创建',
  175 + gradientStart: MyColours.color_ffffff,
  176 + gradientEnd: MyColours.color_ffffff,
  177 + borderColor: MyColours.color_438E93,
  178 + width: ScreenUtil().setWidth(130 * 2),
  179 + height: ScreenUtil().setWidth(37 * 2),
  180 + textColor: MyColours.color_438E93,
  181 + fontSize: 24,
  182 + isBold: true,
  183 + radius: ScreenUtil().setWidth(22),
  184 + onPressed: () async {
  185 + bool needRefresh = await NavigatorUtil.goPlanDishEditPage(
  186 + context,
  187 + isMine: selectF);
  188 + print(needRefresh);
  189 + if (needRefresh != null && needRefresh) {
  190 + Navigator.pop(context);
  191 + //刷新页面数据
  192 + // _controller.callRefresh();
  193 + // _couponNetworkData();
  194 +
  195 + }
  196 + },
  197 + )
  198 + ],
  199 + ),
  200 + ),
  201 + );
  202 + }
  203 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/provider/plan_dish_provider.dart';
  4 +
  5 +import '../../../res/colors.dart';
  6 +import '../../../utils/screen_util.dart';
  7 +import '../../../widgets/round_button.dart';
  8 +import '../../../widgets/system_app_bar.dart';
  9 +
  10 +/**
  11 + * 我的排菜新建编辑页
  12 + */
  13 +
  14 +import 'package:common_utils/common_utils.dart';
  15 +import 'package:flutter/material.dart';
  16 +import 'package:flutter_picker/flutter_picker.dart';
  17 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  18 +import 'package:fluttertoast/fluttertoast.dart';
  19 +import 'package:one_key/provider/user_model.dart';
  20 +import 'package:one_key/res/colors.dart';
  21 +import 'package:one_key/utils/dialog_util.dart';
  22 +import 'package:one_key/utils/event_bus.dart';
  23 +import 'package:one_key/route/navigator_util.dart';
  24 +import 'package:one_key/utils/utils.dart';
  25 +import 'package:one_key/widgets/MyDivider.dart';
  26 +import 'package:one_key/widgets/h_empty_view.dart';
  27 +import 'package:one_key/widgets/round_button.dart';
  28 +import 'package:one_key/widgets/system_app_bar.dart';
  29 +import 'package:one_key/widgets/v_empty_view.dart';
  30 +import 'package:provider/provider.dart';
  31 +
  32 +/**
  33 + * 新建排菜
  34 + */
  35 +
  36 +class PlanDishEidtPage extends StatefulWidget {
  37 + final bool isMine;
  38 + PlanDishEidtPage({Key key, this.isMine = true}) : super(key: key);
  39 +
  40 + @override
  41 + _PlanDishEidtPageState createState() => _PlanDishEidtPageState();
  42 +}
  43 +
  44 +class _PlanDishEidtPageState extends State<PlanDishEidtPage> {
  45 + ScrollController controller = ScrollController();
  46 + TextEditingController _dishNameEditControl = TextEditingController();
  47 + TextEditingController _dishRequireEditControl = TextEditingController();
  48 + TextEditingController _dishExplainEditControl = TextEditingController();
  49 + final heightCell = ScreenUtil().setWidth(48 * 2);
  50 + bool swichState = true; //默认启用 开关状态
  51 + final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
  52 +
  53 + FocusNode _nameFocusNode = FocusNode();
  54 + FocusNode _requireFocusNode = FocusNode();
  55 + bool showDateSelWidget = false;
  56 + PlanDishProvider dishProvider;
  57 + bool swichHexiao = true; //默认启用 核销状态
  58 + String uids = '';
  59 + List labelList = ['店内通用套餐', '自定义排菜单'];
  60 + int labelSelIndex = 0;
  61 + String labelShow;
  62 + @override
  63 + void initState() {
  64 + super.initState();
  65 + labelShow = labelList[labelSelIndex];
  66 + _nameFocusNode.addListener(() {
  67 + if (_nameFocusNode.hasFocus) {
  68 + //有焦点
  69 + if (showDateSelWidget) {
  70 + Navigator.pop(context);
  71 + showDateSelWidget = false;
  72 + }
  73 + } else {
  74 + //失去焦点
  75 + // _editingController.text = '';
  76 + }
  77 + });
  78 + _requireFocusNode.addListener(() {
  79 + if (_requireFocusNode.hasFocus) {
  80 + //有焦点
  81 + if (showDateSelWidget) {
  82 + Navigator.pop(context);
  83 + showDateSelWidget = false;
  84 + }
  85 + } else {
  86 + //失去焦点
  87 + // _editingController.text = '';
  88 + }
  89 + });
  90 + }
  91 +
  92 + //创建新券 客户经理创建活动
  93 + _createNewdish() async {
  94 + // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  95 + // Map<String, String> params = {
  96 + // "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  97 + // "aname": _dishNameEditControl.text.trim(),
  98 + // "desc": _dishRequireEditControl.text.trim(),
  99 + // "stime": fromDate == '点击选择'
  100 + // ? ""
  101 + // : '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}',
  102 + // "etime": endDate == '点击选择'
  103 + // ? ''
  104 + // : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
  105 + // "explain": _dishExplainEditControl.text,
  106 + // "is_open": swichState ? "1" : "0",
  107 + // "status": swichState ? "1" : "0",
  108 + // 'is_type': widget.isMine ? "2" : "1"
  109 + // };
  110 + // if (!widget.isMine) {
  111 + // params['is_examine'] = swichHexiao ? "1" : "0";
  112 + // params['uid_list'] = uids;
  113 + // }
  114 + // bool isSuccess = await dishProvider.createCustomerActivity(context, params);
  115 + // if (isSuccess) {
  116 + // //成功之后跳回前一个页面
  117 + // // bus.emit('refresh_dish_list');
  118 + // EventBus().emit('refresh_dish_invitation');
  119 + // bus.emit('refresh_dish_list_f');
  120 +
  121 + // bus.emit('refresh_table_m_dish');
  122 + // Navigator.pop(context, true);
  123 + // }
  124 + }
  125 +
  126 + ///输入框
  127 + Widget _textfield(String title, String hintText) {
  128 + return Container(
  129 + height: w(48),
  130 + child: Row(
  131 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  132 + children: [
  133 + Container(
  134 + child: Text(
  135 + title,
  136 + style: TextStyle(
  137 + color: MyColours.color_515151,
  138 + fontSize: ScreenUtil().setSp(32)),
  139 + ),
  140 + ),
  141 + HEmptyView(80),
  142 + Expanded(
  143 + child: Container(
  144 + child: TextField(
  145 + controller: title.contains('排菜名称')
  146 + ? _dishNameEditControl
  147 + : _dishRequireEditControl,
  148 + textAlign: TextAlign.right,
  149 + textAlignVertical: TextAlignVertical.bottom,
  150 + maxLines: 1,
  151 + // //光标颜色
  152 + // cursorColor:
  153 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  154 + //输入文本的样式
  155 + style: TextStyle(
  156 + color: MyColours.color_515151,
  157 + fontSize: ScreenUtil().setSp(32),
  158 + ),
  159 + focusNode:
  160 + title.contains('排菜名称') ? _nameFocusNode : _requireFocusNode,
  161 + decoration: InputDecoration(
  162 + border: OutlineInputBorder(borderSide: BorderSide.none),
  163 + hintText: hintText,
  164 + hintStyle: TextStyle(
  165 + color: MyColours.color_99515151,
  166 + fontSize: ScreenUtil().setSp(32),
  167 + ),
  168 + enabledBorder: new UnderlineInputBorder(
  169 + borderSide: BorderSide.none,
  170 + ),
  171 + focusedBorder: new UnderlineInputBorder(
  172 + borderSide: BorderSide.none,
  173 + ),
  174 + ),
  175 + onChanged: (value) {},
  176 + onEditingComplete: () {
  177 + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  178 + },
  179 + keyboardType: TextInputType.text,
  180 + ),
  181 + )),
  182 + ],
  183 + ),
  184 + );
  185 + }
  186 +
  187 + ///时间选择
  188 + Widget _select(String title, String hintText, GestureTapCallback onTap) {
  189 + return InkWell(
  190 + onTap: onTap,
  191 + child: Container(
  192 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
  193 + child: Row(
  194 + crossAxisAlignment: CrossAxisAlignment.center,
  195 + mainAxisAlignment: MainAxisAlignment.center,
  196 + children: [
  197 + Container(
  198 + // height: ScreenUtil().setWidth(40),
  199 + // color: Colors.red,
  200 + child: Text(
  201 + title,
  202 + style: TextStyle(
  203 + color: MyColours.color_515151,
  204 + fontSize: ScreenUtil().setSp(32)),
  205 + ),
  206 + ),
  207 + HEmptyView(20),
  208 + Spacer(),
  209 + Text(hintText,
  210 + style: TextStyle(
  211 + color: hintText == '点击选择'
  212 + ? MyColours.color_999999
  213 + : MyColours.color_515151,
  214 + fontSize: ScreenUtil().setSp(32),
  215 + )),
  216 + HEmptyView(20),
  217 + Image.asset(
  218 + Utils.getImgPath('arrow_right_new'),
  219 + width: ScreenUtil().setWidth(20),
  220 + ),
  221 + // HEmptyView(32),
  222 + ],
  223 + ),
  224 + ),
  225 + );
  226 + }
  227 +
  228 + ///券说明
  229 + Widget _explain(String title, String hintText) {
  230 + return Container(
  231 + // height: ScreenUtil().setWidth(380),
  232 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)),
  233 + decoration: BoxDecoration(
  234 + borderRadius: BorderRadius.circular(r(5)),
  235 + border: Border.all(width: w(1), color: MyColours.color_DBDBDB)),
  236 + child: Column(
  237 + crossAxisAlignment: CrossAxisAlignment.start,
  238 + children: [
  239 + // Align(
  240 + // alignment: Alignment.centerLeft,
  241 + // child: Text(
  242 + // title,
  243 + // textAlign: TextAlign.left,
  244 + // style: TextStyle(
  245 + // color: Color.fromRGBO(0, 0, 0, 0.9),
  246 + // fontWeight: FontWeight.bold,
  247 + // fontSize: ScreenUtil().setSp(32)),
  248 + // )),
  249 + // VEmptyView(26),
  250 + // Container(
  251 + // height: ScreenUtil().setWidth(2),
  252 + // color: MyColours.color_E7E7E7,
  253 + // ),
  254 + TextField(
  255 + controller: _dishExplainEditControl,
  256 + // keyboardType: TextInputType.number, //键盘类型,数字键盘
  257 + maxLines: 6,
  258 + enabled: false,
  259 + // maxLength: 50,
  260 +
  261 + // maxLengthEnforced: true,
  262 + style: TextStyle(
  263 + fontSize: ScreenUtil().setSp(32),
  264 + color: MyColours.color_999999), //输入文本的样式
  265 + decoration: InputDecoration(
  266 + contentPadding: EdgeInsets.all(ScreenUtil().setWidth(6)),
  267 + hintText: hintText,
  268 + hintStyle: TextStyle(
  269 + color: MyColours.color_999999,
  270 + fontSize: ScreenUtil().setSp(32),
  271 + ),
  272 +
  273 + border: OutlineInputBorder(borderSide: BorderSide.none),
  274 +
  275 + enabledBorder: new UnderlineInputBorder(
  276 + borderSide: BorderSide.none,
  277 + ),
  278 + focusedBorder: new UnderlineInputBorder(
  279 + borderSide: BorderSide.none,
  280 + ),
  281 +
  282 + // fillColor: MyColours.color_F9F9F9,
  283 + // // fillColor: Colors.red,
  284 + // filled: true,
  285 + // enabledBorder: OutlineInputBorder(
  286 + // //未选中时候的颜色
  287 + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
  288 + // borderSide: BorderSide(
  289 + // color: MyColours.color_cccccc,
  290 + // width: ScreenUtil().setWidth(2)),
  291 + // ),
  292 + // focusedBorder: OutlineInputBorder(
  293 + // //选中时外边框颜色
  294 + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
  295 + // borderSide: BorderSide(
  296 + // color: MyColours.app_main,
  297 + // ),
  298 + // ),
  299 + // border: OutlineInputBorder(
  300 + // borderRadius:
  301 + // BorderRadius.circular(ScreenUtil().setWidth(20)),
  302 + // borderSide: BorderSide(
  303 + // color: Colors.red, width: ScreenUtil().setWidth(2))),
  304 + ),
  305 + onChanged: (value) {},
  306 + ),
  307 + ],
  308 + ),
  309 + );
  310 + }
  311 +
  312 + ///是否立即启用
  313 + Widget _canUse(String title, bool swich, GestureTapCallback onTap) {
  314 + return InkWell(
  315 + onTap: onTap,
  316 + child: Container(
  317 + height: w(48),
  318 + // padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
  319 + margin: EdgeInsets.only(top: ScreenUtil().setWidth(24)),
  320 + child: Row(
  321 + crossAxisAlignment: CrossAxisAlignment.center,
  322 + mainAxisAlignment: MainAxisAlignment.center,
  323 + children: [
  324 + Container(
  325 + // height: ScreenUtil().setWidth(40),
  326 + // color: Colors.red,
  327 + child: Text(
  328 + title,
  329 + style: TextStyle(
  330 + color: MyColours.color_515151,
  331 + fontSize: ScreenUtil().setSp(32)),
  332 + ),
  333 + ),
  334 + Spacer(),
  335 + Image.asset(
  336 + swich
  337 + ? Utils.getImgPath('swich_on')
  338 + : Utils.getImgPath('swich_off'),
  339 + width: ScreenUtil().setWidth(44 * 2),
  340 + )
  341 + ],
  342 + ),
  343 + ),
  344 + );
  345 + }
  346 +
  347 + ///
  348 + Widget _item(String title, String subTitle) {
  349 + return Container(
  350 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
  351 + margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)),
  352 + child: Row(
  353 + crossAxisAlignment: CrossAxisAlignment.center,
  354 + mainAxisAlignment: MainAxisAlignment.center,
  355 + children: [
  356 + Container(
  357 + child: Text(
  358 + title,
  359 + style: TextStyle(
  360 + color: Color.fromRGBO(0, 0, 0, 0.9),
  361 + fontWeight: FontWeight.bold,
  362 + fontSize: ScreenUtil().setSp(32)),
  363 + ),
  364 + ),
  365 + HEmptyView(60),
  366 + Expanded(
  367 + child: Text(
  368 + subTitle,
  369 + maxLines: 20,
  370 + textAlign: TextAlign.right,
  371 + overflow: TextOverflow.ellipsis,
  372 + style: TextStyle(
  373 + color: Color.fromRGBO(0, 0, 0, 0.4),
  374 + fontSize: ScreenUtil().setSp(32),
  375 + ),
  376 + ))
  377 + ],
  378 + ),
  379 + );
  380 + }
  381 +
  382 + @override
  383 + Widget build(BuildContext context) {
  384 + dishProvider = Provider.of<PlanDishProvider>(context, listen: true);
  385 + return Scaffold(
  386 + backgroundColor: MyColours.color_ffffff,
  387 + key: scaffoldKey,
  388 + appBar: SystemAppBar(
  389 + '排菜详情',
  390 + onTap: () {
  391 + Navigator.pop(context, false);
  392 + },
  393 + ),
  394 + body: InkWell(
  395 + onTap: () {
  396 + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  397 + },
  398 + child: Container(
  399 + color: MyColours.color_ffffff,
  400 + child: Column(children: [
  401 + Expanded(
  402 + child: SingleChildScrollView(
  403 + controller: controller,
  404 + physics: BouncingScrollPhysics(),
  405 + child: Padding(
  406 + padding: EdgeInsets.symmetric(
  407 + horizontal: ScreenUtil().setWidth(40)),
  408 + child: Column(
  409 + children: [
  410 + VEmptyView(40),
  411 + _textfield('排菜名称 *', '点击输入排菜套餐名称'),
  412 + MyDivider(double.infinity, w(1),
  413 + color: MyColours.color_DBDBDB),
  414 + InkWell(
  415 + onTap: () {
  416 + FocusScope.of(context)
  417 + .requestFocus(FocusNode()); //隐藏键盘
  418 + DialogUtil.showSelectCusmanDialog(
  419 + context,
  420 + labelList.map((item) {
  421 + return item.label;
  422 + }).toList(), (value) {
  423 + if (value != null) {
  424 + setState(() {
  425 + labelSelIndex = value.first;
  426 + labelShow =
  427 + labelList[labelSelIndex].label;
  428 + });
  429 + }
  430 + },
  431 + selecteds: labelSelIndex == null
  432 + ? []
  433 + : [labelSelIndex])
  434 + .then((value) {});
  435 + },
  436 + child: Container(
  437 + height: ScreenUtil().setWidth(48 * 2),
  438 + margin: EdgeInsets.only(
  439 + top: ScreenUtil().setWidth(24)),
  440 + child: Row(
  441 + mainAxisAlignment:
  442 + MainAxisAlignment.spaceBetween,
  443 + crossAxisAlignment:
  444 + CrossAxisAlignment.center,
  445 + children: [
  446 + Container(
  447 + // color: Colors.red,
  448 + width: ScreenUtil().setWidth(150),
  449 + // height: ScreenUtil().setWidth(35),
  450 + // height: ScreenUtil().setWidth(48),
  451 + child: Text(
  452 + '排菜类型',
  453 + style: TextStyle(
  454 + fontSize:
  455 + ScreenUtil().setSp(32),
  456 + color: MyColours.color_515151),
  457 + ),
  458 + ),
  459 + Expanded(
  460 + child: Text(
  461 + labelShow,
  462 + textAlign: TextAlign.right,
  463 + overflow: TextOverflow.ellipsis,
  464 + style: TextStyle(
  465 + color: MyColours.color_515151,
  466 + fontSize: ScreenUtil().setSp(32),
  467 + ),
  468 + )),
  469 + HEmptyView(10),
  470 + Image.asset(
  471 + Utils.getImgPath('c_arrow_down'),
  472 + width: ScreenUtil().setWidth(24),
  473 + // height: ScreenUtil().setWidth(10),
  474 + )
  475 + ],
  476 + ),
  477 + )),
  478 + MyDivider(double.infinity, w(1),
  479 + color: MyColours.color_DBDBDB),
  480 + _canUse('是否启用', swichState, () {
  481 + setState(() {
  482 + swichState = !swichState;
  483 + });
  484 + }),
  485 + MyDivider(double.infinity, w(1),
  486 + color: MyColours.color_DBDBDB),
  487 + VEmptyView(24),
  488 + Container(
  489 + height: w(48),
  490 + child: Row(
  491 + children: [
  492 + Container(
  493 + // height: ScreenUtil().setWidth(40),
  494 + // color: Colors.red,
  495 + child: Text(
  496 + '就餐人数',
  497 + style: TextStyle(
  498 + color: MyColours.color_515151,
  499 + fontSize: ScreenUtil().setSp(32)),
  500 + ),
  501 + ),
  502 + Spacer(),
  503 + Image.asset(
  504 + Utils.getImgPath('plan_dish_minus'),
  505 + width: w(16),
  506 + ),
  507 + HEmptyView(46),
  508 + Container(
  509 + // constraints: BoxConstraints(
  510 + // minWidth: w(34),
  511 + // ),
  512 + width: w(34),
  513 + height: w(48),
  514 + decoration: BoxDecoration(
  515 + // borderRadius:
  516 + // BorderRadius.circular(r(5)),
  517 + // border: Border.all(
  518 + // width: w(1),
  519 + // color: MyColours.color_999999)
  520 + ),
  521 + // constraints: BoxConstraints(minWidth: w(20)),
  522 + child: TextField(
  523 + maxLines: 1,
  524 + // controller:
  525 + // focusNode: _focusNode,
  526 + // autofocus: true,
  527 +
  528 + style: TextStyle(
  529 + color: MyColours.color_438E93,
  530 + fontSize: font(16)),
  531 + textAlign: TextAlign.center,
  532 + // textAlignVertical: TextAlignVertical.center,
  533 + decoration: InputDecoration(
  534 + hintText: "人数",
  535 + hintStyle: TextStyle(
  536 + color: MyColours.color_999999,
  537 + fontSize: font(16),
  538 + ),
  539 + // isCollapsed:
  540 + // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  541 + border: OutlineInputBorder(
  542 + borderSide: BorderSide.none),
  543 + contentPadding: EdgeInsets.zero,
  544 + ),
  545 + keyboardType: TextInputType.number,
  546 + textInputAction:
  547 + TextInputAction.done,
  548 +
  549 + onChanged: (value) {
  550 + // setState(() {});
  551 + // _searchSellerLocation();
  552 + // customerProvider.searchData(value);
  553 + },
  554 + onEditingComplete: () {
  555 + FocusScope.of(context)
  556 + .requestFocus(
  557 + FocusNode()); //点击空白处隐藏键盘
  558 + // contantShowModel.searchData(
  559 + // contantShowModel.controller.text);
  560 + // _searchSellerLocation();
  561 + // _focusNode.unfocus();
  562 + },
  563 + )),
  564 + HEmptyView(46),
  565 + Image.asset(
  566 + Utils.getImgPath('plan_dish_add'),
  567 + width: w(16),
  568 + ),
  569 + ],
  570 + )),
  571 + MyDivider(double.infinity, w(1),
  572 + color: MyColours.color_DBDBDB),
  573 + VEmptyView(24),
  574 + Container(
  575 + height: w(48),
  576 + child: Row(children: [
  577 + Container(
  578 + // height: ScreenUtil().setWidth(40),
  579 + // color: Colors.red,
  580 + child: Text(
  581 + '菜单总价/会员总价',
  582 + style: TextStyle(
  583 + color: MyColours.color_515151,
  584 + fontSize: ScreenUtil().setSp(32)),
  585 + ),
  586 + ),
  587 + Spacer(),
  588 + Text(
  589 + '0元/0元',
  590 + style: TextStyle(
  591 + color: MyColours.color_99515151,
  592 + fontSize: ScreenUtil().setSp(32)),
  593 + ),
  594 + ])),
  595 + MyDivider(double.infinity, w(1),
  596 + color: MyColours.color_DBDBDB),
  597 + VEmptyView(24),
  598 + Container(
  599 + height: w(48),
  600 + child: Row(
  601 + children: [
  602 + Text(
  603 + '排菜价格',
  604 + style: TextStyle(
  605 + fontSize: font(16),
  606 + color: MyColours.color_515151),
  607 + ),
  608 + HEmptyView(20),
  609 + Expanded(
  610 + child: TextField(
  611 + maxLines: 1,
  612 + // controller: controller,
  613 + // focusNode: _focusNode,
  614 + // autofocus: true,
  615 +
  616 + style: TextStyle(
  617 + color: MyColours.color_515151,
  618 + fontSize: font(16)),
  619 + textAlign: TextAlign.right,
  620 + textAlignVertical:
  621 + TextAlignVertical.center,
  622 + decoration: InputDecoration(
  623 + hintText: '点击输入排菜套餐价格',
  624 + hintStyle: TextStyle(
  625 + color: MyColours.color_999999,
  626 + fontSize: font(16),
  627 + ),
  628 + isCollapsed:
  629 + true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  630 + border: OutlineInputBorder(
  631 + borderSide: BorderSide.none),
  632 + contentPadding: EdgeInsets.zero,
  633 + ),
  634 + keyboardType:
  635 + TextInputType.numberWithOptions(),
  636 + textInputAction: TextInputAction.done,
  637 +
  638 + onChanged: (value) {
  639 + // setState(() {});
  640 + // _searchSellerLocation();
  641 + // customerProvider.searchData(value);
  642 + },
  643 + onEditingComplete: () {
  644 + FocusScope.of(context).requestFocus(
  645 + FocusNode()); //点击空白处隐藏键盘
  646 + // contantShowModel.searchData(
  647 + // contantShowModel.controller.text);
  648 + // _searchSellerLocation();
  649 + // _focusNode.unfocus();
  650 + },
  651 + )),
  652 + Text(
  653 + '元',
  654 + style: TextStyle(
  655 + fontSize: font(16),
  656 + color: MyColours.color_515151),
  657 + )
  658 + ],
  659 + )),
  660 + MyDivider(double.infinity, w(1),
  661 + color: MyColours.color_DBDBDB),
  662 + VEmptyView(24),
  663 + _select('菜品', '编辑', () async {
  664 + // Map temp =
  665 + // await NavigatorUtil.godishToPersonnalPage(
  666 + // context, uids);
  667 + // if (temp != null && temp['object'] != null) {
  668 + // uids = temp['object'];
  669 + // }
  670 + NavigatorUtil.goPlanNewDishPage(context);
  671 + }),
  672 + _explain('券说明', '点击上面右侧的“编辑”,开始选菜吧!'),
  673 + VEmptyView(20),
  674 + ],
  675 + ))),
  676 + ),
  677 + VEmptyView(20),
  678 + RoundButton(
  679 + onPressed: () {
  680 + // if (_dishNameEditControl.text.trim().length == 0) {
  681 + // Utils.showToast('请填写券名称');
  682 + // return;
  683 + // }
  684 + // if (_dishRequireEditControl.text.trim().length == 0) {
  685 + // Utils.showToast('请填写券要求');
  686 + // return;
  687 + // }
  688 + // if (fromDate == '点击选择') {
  689 + // Utils.showToast('请选择有效期起始时间');
  690 + // return;
  691 + // }
  692 + // if (endDate == '点击选择') {
  693 + // Utils.showToast('请选择有效期结束时间');
  694 + // return;
  695 + // }
  696 + // if (DateUtil.getDateTime(endDate)
  697 + // .compareTo(DateUtil.getDateTime(fromDate)) <
  698 + // 0) {
  699 + // Utils.showToast('有效期结束时间不能早于起始时间');
  700 + // return;
  701 + // }
  702 + // // ***参数***
  703 + // // _dishNameEditControl.text
  704 + // // _dishRequireEditControl.text
  705 + // // fromDate
  706 + // // endDate
  707 + // // _dishExplainEditControl.text
  708 + // // swichState
  709 + _createNewdish();
  710 + },
  711 + text: '立即创建',
  712 + fontSize: 24,
  713 + isBold: false,
  714 + height: ScreenUtil().setWidth(37 * 2),
  715 + width: ScreenUtil().setWidth(130 * 2),
  716 + radius: ScreenUtil().setWidth(22),
  717 + ),
  718 + VEmptyView(32)
  719 + ]))),
  720 + );
  721 + }
  722 +}
  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:flutter/material.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:one_key/models/coupon_model.dart';
  5 +import 'package:one_key/provider/coupon_provider.dart';
  6 +import 'package:one_key/res/colors.dart';
  7 +import 'package:one_key/utils/utils.dart';
  8 +import 'package:one_key/widgets/dashed_line_widget.dart';
  9 +import 'package:one_key/widgets/h_empty_view.dart';
  10 +import 'package:one_key/widgets/round_button.dart';
  11 +import 'package:one_key/widgets/v_empty_view.dart';
  12 +import 'package:provider/provider.dart';
  13 +
  14 +import '../../../provider/user_model.dart';
  15 +import '../../../utils/screen_util.dart';
  16 +
  17 +class PlanDishItem extends StatefulWidget {
  18 + // final String from;
  19 + final VoidCallback onPressedDel;
  20 + final VoidCallback onPressedReUse;
  21 + // final CouponSunModel couponSonModel;
  22 + // final bool showBtn;
  23 + // final bool showCheck;
  24 + PlanDishItem({
  25 + Key key,
  26 + // this.from,
  27 + this.onPressedDel,
  28 + this.onPressedReUse,
  29 + // this.couponSonModel,
  30 + // this.showBtn = false,
  31 + // this.showCheck = false
  32 + }) : super(key: key);
  33 +
  34 + @override
  35 + _PlanDishItemState createState() => _PlanDishItemState();
  36 +}
  37 +
  38 +class _PlanDishItemState extends State<PlanDishItem> {
  39 + // bool showText = false;
  40 + @override
  41 + Widget build(BuildContext context) {
  42 + // CouponSunModel sunModel = widget.couponSonModel;
  43 + bool notSelect = false;
  44 + // if (widget.from == 'history') {
  45 + // notSelect = false;
  46 + // } else {
  47 + // notSelect = sunModel.isOpenBool;
  48 + // }
  49 + double explainH = 0.0;
  50 +
  51 + // if (ObjectUtil.isNotEmpty(sunModel.explain)) {
  52 + // explainH = Utils.calculateTextHeight(
  53 + // '说明:${sunModel.explain}',
  54 + // ScreenUtil().setSp(20),
  55 + // FontWeight.normal,
  56 + // ScreenUtil().screenWidth -
  57 + // ScreenUtil().setWidth(92 * 2) +
  58 + // ScreenUtil().setWidth(20),
  59 + // 5,
  60 + // context);
  61 + // }
  62 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  63 + return InkWell(
  64 + // onTap: widget.onPressed,
  65 + child: Container(
  66 + // width: ScreenUtil().setWidth(610),
  67 + margin: EdgeInsets.fromLTRB(
  68 + ScreenUtil().setWidth(40),
  69 + ScreenUtil().setWidth(0),
  70 + ScreenUtil().setWidth(40),
  71 + ScreenUtil().setWidth(32)),
  72 + decoration: BoxDecoration(
  73 + color: MyColours.color_ffffff,
  74 + boxShadow: [
  75 + BoxShadow(
  76 + spreadRadius: ScreenUtil().setWidth(2),
  77 + color: Color.fromRGBO(0, 0, 0, 0.25),
  78 + offset: Offset(0, ScreenUtil().setWidth(8)),
  79 + blurRadius: ScreenUtil().setWidth(8))
  80 + ],
  81 + borderRadius: BorderRadius.all(
  82 + Radius.circular(ScreenUtil().setWidth(16)),
  83 + ),
  84 + ),
  85 + child: Column(
  86 + mainAxisSize: MainAxisSize.min,
  87 + crossAxisAlignment: CrossAxisAlignment.start,
  88 + children: [
  89 + Container(
  90 + height: ScreenUtil().setWidth(60),
  91 + padding: EdgeInsets.symmetric(
  92 + horizontal: ScreenUtil().setWidth(24)),
  93 + decoration: BoxDecoration(
  94 + color: true //开启可用
  95 + ? true //店铺
  96 + ? MyColours.color_438E93
  97 + : MyColours.color_ED7B2F
  98 + : MyColours.color_999999,
  99 + // color: widget.from == 'history'
  100 + // ? MyColours.color_BFC4D4
  101 + // : notSelect
  102 + // ? sunModel.isType == '1'
  103 + // ? MyColours.color_438E93
  104 + // : MyColours.color_ED7B2F
  105 + // : MyColours.color_999999,
  106 + borderRadius: BorderRadius.only(
  107 + topLeft: Radius.circular(ScreenUtil().setWidth(16)),
  108 + topRight:
  109 + Radius.circular(ScreenUtil().setWidth(16)))),
  110 + child: Row(
  111 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  112 + children: [
  113 + Container(
  114 + width: w(18),
  115 + height: w(18),
  116 + alignment: Alignment.center,
  117 + decoration: BoxDecoration(
  118 + borderRadius: BorderRadius.circular(w(9)),
  119 + border: Border.all(
  120 + width: w(1), color: MyColours.color_F8F9FD)),
  121 + child: Text(
  122 + // sunModel.isType == '1'
  123 + // ? sunModel.isExamine == '1'
  124 + // ? '店铺优惠券(核销)'
  125 + // : '店铺优惠券'
  126 + // :
  127 + true ? '店' : '私',
  128 + textAlign: TextAlign.center,
  129 + style: TextStyle(
  130 + color: MyColours.color_F8F9FD,
  131 + fontSize: ScreenUtil().setSp(20)),
  132 + ),
  133 + ),
  134 + HEmptyView(6),
  135 + Text(
  136 + // sunModel.isType == '1'
  137 + // ? sunModel.isExamine == '1'
  138 + // ? '店铺优惠券(核销)'
  139 + // : '店铺优惠券'
  140 + // :
  141 + '朋友小聚8人畅享',
  142 + style: TextStyle(
  143 + fontWeight: FontWeight.bold,
  144 + color: MyColours.color_ffffff,
  145 + fontSize: ScreenUtil().setSp(32)),
  146 + ),
  147 + Spacer(),
  148 + InkWell(
  149 + // onTap: widget.onPressedSwich,
  150 + child: Text(
  151 + // sunModel.isType == '1'
  152 + // ? sunModel.isExamine == '1'
  153 + // ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张'
  154 + // : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张'
  155 + // : '被领取:${sunModel.receiveNum}张',
  156 + '1100元/8人',
  157 + maxLines: 1,
  158 + overflow: TextOverflow.ellipsis,
  159 + style: TextStyle(
  160 + color: MyColours.color_ffffff,
  161 + fontSize: ScreenUtil().setSp(24))),
  162 + ),
  163 + ],
  164 + ),
  165 + ),
  166 + Container(
  167 + padding: EdgeInsets.fromLTRB(
  168 + ScreenUtil().setWidth(20 * 2),
  169 + ScreenUtil().setWidth(12 * 2),
  170 + ScreenUtil().setWidth(20 * 2),
  171 + ScreenUtil().setWidth(14 * 2)),
  172 + child: Text(
  173 + // sunModel.isType == '1'
  174 + // ? sunModel.isExamine == '1'
  175 + // ? '店铺优惠券(核销)'
  176 + // : '店铺优惠券'
  177 + // :
  178 + '铁锅炖大鹅,白山叫花鸡,主席红烧肉,清蒸鲈鱼,荷塘小炒,松仁玉米,咸蛋黄焗南瓜,黑椒牛柳,夫妻肺片,蒜泥茄子,卤水…',
  179 +
  180 + maxLines: 2,
  181 + style: TextStyle(
  182 + color: MyColours.color_999999,
  183 + fontSize: ScreenUtil().setSp(20)),
  184 + ),
  185 + ),
  186 + MySeparator(width: w(3), color: MyColours.color_BFC4D4),
  187 + Container(
  188 + padding: EdgeInsets.symmetric(
  189 + horizontal: w(20), vertical: w(8)),
  190 + child: Row(
  191 + children: [
  192 + Text(
  193 + // sunModel.isType == '1'
  194 + // ? sunModel.isExamine == '1'
  195 + // ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张'
  196 + // : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张'
  197 + // : '被领取:${sunModel.receiveNum}张',
  198 + '更新时间:2022-11-08',
  199 + maxLines: 1,
  200 + overflow: TextOverflow.ellipsis,
  201 + style: TextStyle(
  202 + color: MyColours.color_999999,
  203 + fontSize: ScreenUtil().setSp(20))),
  204 + Spacer(),
  205 + //私,则是自己的,可删除
  206 + true || userModel.user.role_name == '管理员' ||
  207 + userModel.user.role_name == '店长'
  208 + ? RoundButton(
  209 + width: ScreenUtil().setWidth(50 * 2),
  210 + height: ScreenUtil().setWidth(20 * 2),
  211 + radius: ScreenUtil().setWidth(10),
  212 + text: '删除',
  213 + fontSize: 24,
  214 + textColor: MyColours.color_E34D59,
  215 + borderColor: MyColours.color_E34D59,
  216 + gradientStart: MyColours.color_ffffff,
  217 + gradientEnd: MyColours.color_ffffff,
  218 + onPressed: widget.onPressedDel,
  219 + )
  220 + : SizedBox(),
  221 + HEmptyView(34),
  222 + RoundButton(
  223 + width: ScreenUtil().setWidth(50 * 2),
  224 + height: ScreenUtil().setWidth(20 * 2),
  225 + radius: ScreenUtil().setWidth(10),
  226 + text: '复用',
  227 + fontSize: 24,
  228 + textColor: MyColours.color_438E93,
  229 + borderColor: MyColours.color_438E93,
  230 + gradientStart: MyColours.color_ffffff,
  231 + gradientEnd: MyColours.color_ffffff,
  232 + onPressed: widget.onPressedReUse,
  233 + )
  234 + ],
  235 + ))
  236 + ])));
  237 + }
  238 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_easyrefresh/easy_refresh.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:one_key/constant/state.dart';
  5 +import 'package:one_key/models/personnel_manage_model.dart';
  6 +import 'package:one_key/pages/coupon/coupon_item_f.dart';
  7 +import 'package:one_key/pages/my/plan_dish/plan_dish_item.dart';
  8 +import 'package:one_key/provider/coupon_provider.dart';
  9 +import 'package:one_key/provider/personnel_provider.dart';
  10 +import 'package:one_key/provider/user_model.dart';
  11 +import 'package:one_key/res/colors.dart';
  12 +import 'package:one_key/route/navigator_util.dart';
  13 +import 'package:one_key/utils/event_bus.dart';
  14 +import 'package:one_key/widgets/page_exception.dart';
  15 +import 'package:one_key/widgets/v_empty_view.dart';
  16 +import 'package:provider/provider.dart';
  17 +
  18 +import '../../../provider/plan_dish_provider.dart';
  19 +import '../../../utils/dialog_util.dart';
  20 +
  21 +class PlanDishSunPage extends StatefulWidget {
  22 + final int index;
  23 + PlanDishSunPage({Key key, this.index}) : super(key: key);
  24 +
  25 + @override
  26 + _PlanDishSunPageState createState() => _PlanDishSunPageState();
  27 +}
  28 +
  29 +class _PlanDishSunPageState extends State<PlanDishSunPage> {
  30 + EasyRefreshController _controller = EasyRefreshController();
  31 + PlanDishProvider planDishProvider;
  32 + List<PersonnelManageSunModel> authUserLists = [];
  33 +
  34 + @override
  35 + void initState() {
  36 + // TODO: implement initState
  37 + super.initState();
  38 +
  39 + WidgetsBinding.instance.addPostFrameCallback((_) {
  40 + // if (widget.index == 0) {
  41 + // planDishProvider.pageState = PageState.Loading;
  42 + // } else if (widget.index == 1) {
  43 + // planDishProvider.pageStateStore = PageState.Loading;
  44 + // } else if (widget.index == 2) {
  45 + // planDishProvider.pageStateMine = PageState.Loading;
  46 + // }
  47 + // couponProvider.notifyListeners();
  48 + // _couponNetworkData(widget.index, isShowLoading: false);
  49 +
  50 + // bus.on("refresh_coupon_list_f", (arg) {
  51 + // _couponNetworkData(widget.index);
  52 + // });
  53 + });
  54 + }
  55 +
  56 + @override
  57 + void dispose() {
  58 + super.dispose();
  59 + }
  60 +
  61 + ///获取优惠券列表数据
  62 + // _couponNetworkData(int index, {bool isShowLoading = true}) async {
  63 + // Map<String, String> params = {
  64 + // "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  65 + // // 'is_time': '0'
  66 + // "is_type": index.toString()
  67 + // };
  68 + // await couponProvider.getCustomerActivity(context, params, index,
  69 + // isShowLoading: isShowLoading);
  70 + // }
  71 +
  72 + ///修改活动信息
  73 + // _setCustomerActivity(int index) async {
  74 + // Map<String, String> params = {
  75 + // "id": couponProvider.couponList[index].id,
  76 + // "status": couponProvider.couponList[index].isOpenBool ? '1' : '0',
  77 + // };
  78 + // bool isSuccess = await couponProvider.setCustomerActivity(context, params,
  79 + // isShowLoading: false);
  80 + // print(isSuccess);
  81 + // _couponNetworkData(widget.index, isShowLoading: false);
  82 + // // if (isSuccess) {
  83 + // // couponProvider.notifyListeners();
  84 + // // } else {
  85 + // // couponProvider.couponList[index].isOpenBool =
  86 + // // !couponProvider.couponList[index].isOpenBool;
  87 + // // couponProvider.notifyListeners();
  88 + // // }
  89 + // }
  90 +
  91 + @override
  92 + Widget build(BuildContext context) {
  93 + planDishProvider = Provider.of<PlanDishProvider>(context, listen: true);
  94 + PageState pageState;
  95 + if (widget.index == 0) {
  96 + pageState = planDishProvider.pageState;
  97 + } else if (widget.index == 1) {
  98 + pageState = planDishProvider.pageStateStore;
  99 + } else if (widget.index == 2) {
  100 + pageState = planDishProvider.pageStateMine;
  101 + }
  102 + return Container(
  103 + child: Consumer<CouponProvider>(builder: (context, model, _) {
  104 + if (pageState != PageState.Success) {
  105 + return ExceptionPage(
  106 + pageState: pageState,
  107 + callback: () {
  108 + // offset = 0;
  109 + // getMessage(showLoading: true);
  110 + // _couponNetworkData(widget.index);
  111 + },
  112 + emptyMsg: "暂时没有列表信息哦,",
  113 + emptyImg: "empty_search",
  114 + showMsg: "加载中,请稍后...",
  115 + needEmpty: true,
  116 + );
  117 + } else {
  118 + return EasyRefresh.custom(
  119 + controller: _controller,
  120 + shrinkWrap: true,
  121 + slivers: [
  122 + SliverList(
  123 + delegate: SliverChildBuilderDelegate(
  124 + (BuildContext context, int index) {
  125 + return PlanDishItem(
  126 + // from: 'quan',
  127 + // couponSonModel: couponProvider.couponList[index],
  128 + // showBtn: true,
  129 + onPressedDel: () {
  130 + //弹框确认是否删除
  131 + DialogUtil.cupertinoAlertDialog(context,
  132 + title: "",
  133 + content: "确定要将该排菜删除吗?删除后将无法再次使用该排菜。",
  134 + rTitle: "确定", rCallback: () {
  135 + // Navigator.pop(context);
  136 + // _delGuestInfocDay(model.cday[index].id);
  137 + });
  138 + },
  139 + onPressedReUse: () {
  140 + NavigatorUtil.goFinalPlanDishPage(context);
  141 + },
  142 + );
  143 + }, childCount: 10),
  144 + ),
  145 + // SliverList(
  146 + // delegate: SliverChildBuilderDelegate(
  147 + // (BuildContext context, int index) {
  148 + // return Column(
  149 + // children: [
  150 + // InkWell(
  151 + // onTap: () {
  152 + // NavigatorUtil.goCouponHistoryPage(context);
  153 + // },
  154 + // child: RichText(
  155 + // text: TextSpan(
  156 + // style: TextStyle(
  157 + // fontSize: ScreenUtil().setSp(28),
  158 + // ),
  159 + // children: [
  160 + // TextSpan(
  161 + // text: '没有更多了,',
  162 + // style: TextStyle(
  163 + // color: MyColours.color_000000)),
  164 + // TextSpan(
  165 + // text: '查看过期优惠券',
  166 + // style: TextStyle(
  167 + // color: MyColours.color_438E93)),
  168 + // ]))),
  169 + // VEmptyView(80)
  170 + // ],
  171 + // );
  172 + // }, childCount: 1),
  173 + // )
  174 + ],
  175 + // onRefresh: () async {
  176 + // // offset = 0;
  177 + // // getMessage(showLoading: false);
  178 + // },
  179 + // onLoad: () async {
  180 + // // offset++;
  181 + // // getMessage(showLoading: false);
  182 + // },
  183 + );
  184 + }
  185 + }),
  186 + );
  187 + }
  188 +}
@@ -585,7 +585,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -585,7 +585,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
585 fontSize: 36, 585 fontSize: 36,
586 isBold: false, 586 isBold: false,
587 onPressed: () { 587 onPressed: () {
588 - NavigatorUtil.goFinalPlanDishPage(context); 588 + Navigator.pop(context);
589 }, 589 },
590 ), 590 ),
591 ) 591 )
@@ -13,8 +13,11 @@ import '../net/http_url.dart'; @@ -13,8 +13,11 @@ import '../net/http_url.dart';
13 * 预排菜 13 * 预排菜
14 */ 14 */
15 class PlanDishProvider extends ChangeNotifier { 15 class PlanDishProvider extends ChangeNotifier {
16 - PageState pageState = PageState.Loading; 16 + PageState pageState = PageState.Success;
  17 + PageState pageStateStore = PageState.Success;
  18 + PageState pageStateMine = PageState.Success;
17 PageState pageStateMy = PageState.Success; 19 PageState pageStateMy = PageState.Success;
  20 +
18 List<MenuModel> menuModel; //菜品数据 21 List<MenuModel> menuModel; //菜品数据
19 // List<CookbookCategorySunModel> categorySunModel; //菜品分类数据 22 // List<CookbookCategorySunModel> categorySunModel; //菜品分类数据
20 // List<CookbookSpecSunModel> specSunModel; //计价单位 23 // List<CookbookSpecSunModel> specSunModel; //计价单位
@@ -1281,4 +1281,41 @@ class NavigatorUtil { @@ -1281,4 +1281,41 @@ class NavigatorUtil {
1281 return _navigateTo(context, "${Routes.order_edit_list_show_page}", 1281 return _navigateTo(context, "${Routes.order_edit_list_show_page}",
1282 replace: replace); 1282 replace: replace);
1283 } 1283 }
  1284 +
  1285 + ///经理排菜- 类型选择
  1286 +
  1287 + static Future<dynamic> goPlanDishCreateSelectTypePage(
  1288 + BuildContext context, {
  1289 + replace = false,
  1290 + }) {
  1291 + // if (invoice != null) {
  1292 + // return _navigateTo(context,
  1293 + // "${Routes.order_advance_home_page}?invoice=${FluroConvertUtils.object2string(invoice)}",
  1294 + // replace: replace);
  1295 + // }
  1296 + // if (object != null) {
  1297 + // return _navigateTo(context,
  1298 + // "${Routes.order_advance_home_page}?tids=$tids&tableidNow=$tableidNow&fromPage=$fromPage&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
  1299 + // }
  1300 + return _navigateTo(context, "${Routes.plan_dish_create_select_type_page}",
  1301 + replace: replace);
  1302 + }
  1303 +
  1304 + ///经理排菜- 编辑页
  1305 +
  1306 + static Future<dynamic> goPlanDishEditPage(BuildContext context,
  1307 + {replace = false, bool isMine}) {
  1308 + // if (invoice != null) {
  1309 + // return _navigateTo(context,
  1310 + // "${Routes.plan_dish_edit_page}?invoice=${FluroConvertUtils.object2string(invoice)}",
  1311 + // replace: replace);
  1312 + // }
  1313 + // if (object != null) {
  1314 + // return _navigateTo(context,
  1315 + // "${Routes.plan_dish_edit_page}?tids=$tids&tableidNow=$tableidNow&fromPage=$fromPage&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
  1316 + // }
  1317 + return _navigateTo(
  1318 + context, "${Routes.plan_dish_edit_page}?isMine=${isMine}",
  1319 + replace: replace);
  1320 + }
1284 } 1321 }
@@ -177,6 +177,8 @@ import '../pages/my/feast_manage/feast_wine_manage_edit_page.dart'; @@ -177,6 +177,8 @@ import '../pages/my/feast_manage/feast_wine_manage_edit_page.dart';
177 import '../pages/my/feast_manage/feast_wine_manage_page.dart'; 177 import '../pages/my/feast_manage/feast_wine_manage_page.dart';
178 import '../pages/my/plan_dish/final_plan_dish_page.dart'; 178 import '../pages/my/plan_dish/final_plan_dish_page.dart';
179 import '../pages/my/plan_dish/my_plan_dish_home_page.dart'; 179 import '../pages/my/plan_dish/my_plan_dish_home_page.dart';
  180 +import '../pages/my/plan_dish/plan_dish_create_select_type_page.dart';
  181 +import '../pages/my/plan_dish/plan_dish_eidt_page.dart';
180 import '../pages/my/plan_dish/plan_new_dish_first_page.dart'; 182 import '../pages/my/plan_dish/plan_new_dish_first_page.dart';
181 import '../pages/my/plan_dish/plan_new_dish_page.dart'; 183 import '../pages/my/plan_dish/plan_new_dish_page.dart';
182 import '../pages/my/table_manage/merge_table_select_page.dart'; 184 import '../pages/my/table_manage/merge_table_select_page.dart';
@@ -1999,3 +2001,46 @@ var orderEditListShowPageHandle = new Handler( @@ -1999,3 +2001,46 @@ var orderEditListShowPageHandle = new Handler(
1999 return ChangeNotifierProvider<PlanDishProvider>( 2001 return ChangeNotifierProvider<PlanDishProvider>(
2000 create: (_) => PlanDishProvider(), child: OrderEditListShowPage()); 2002 create: (_) => PlanDishProvider(), child: OrderEditListShowPage());
2001 }); 2003 });
  2004 +
  2005 +///经理排菜--类型选择
  2006 +var planDishCreateSelectTypePageHandle = new Handler(
  2007 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  2008 + // String fromPage = params["fromPage"].first;
  2009 + // String tids = params["tids"].first;
  2010 +
  2011 + // String tableidNow = params["tableidNow"].first;
  2012 + // bool canChoose = params["canChoose"].first == "true" ? true : false;
  2013 + // List<TableList> res = [];
  2014 + // if (params.keys.contains('object')) {
  2015 + // Map object = FluroConvertUtils.string2map(params["object"].first);
  2016 + // List temp = object['object'];
  2017 +
  2018 + // for (var item in temp) {
  2019 + // res.add(TableList.fromJson(item));
  2020 + // }
  2021 + // }
  2022 + return ChangeNotifierProvider<PlanDishProvider>(
  2023 + create: (_) => PlanDishProvider(), child: PlanDishCreateSelectTypePage());
  2024 +});
  2025 +
  2026 +///经理排菜--编辑页
  2027 +var planDishEidtPageHandle = new Handler(
  2028 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  2029 + // String fromPage = params["fromPage"].first;
  2030 + // String tids = params["tids"].first;
  2031 +
  2032 + // String tableidNow = params["tableidNow"].first;
  2033 + // bool canChoose = params["canChoose"].first == "true" ? true : false;
  2034 + // List<TableList> res = [];
  2035 + // if (params.keys.contains('object')) {
  2036 + // Map object = FluroConvertUtils.string2map(params["object"].first);
  2037 + // List temp = object['object'];
  2038 +
  2039 + // for (var item in temp) {
  2040 + // res.add(TableList.fromJson(item));
  2041 + // }
  2042 + // }
  2043 + bool isMine = FluroConvertUtils.string2bool(params["isMine"].first);
  2044 + return ChangeNotifierProvider<PlanDishProvider>(
  2045 + create: (_) => PlanDishProvider(), child: PlanDishEidtPage(isMine: isMine,));
  2046 +});
@@ -178,6 +178,9 @@ class Routes { @@ -178,6 +178,9 @@ class Routes {
178 static String order_preview_page = "/order_preview_page"; //预览页 178 static String order_preview_page = "/order_preview_page"; //预览页
179 static String order_edit_list_show_page = 179 static String order_edit_list_show_page =
180 "/order_edit_list_show_page"; //经理排菜编辑列表展示 180 "/order_edit_list_show_page"; //经理排菜编辑列表展示
  181 + static String plan_dish_create_select_type_page =
  182 + "/plan_dish_create_select_type_page"; //经理排菜---类型选择页
  183 + static String plan_dish_edit_page = "/plan_dish_eidt_page"; //经理排菜---编辑页
181 184
182 static void configureRoutes(FluroRouter router) { 185 static void configureRoutes(FluroRouter router) {
183 router.notFoundHandler = new Handler( 186 router.notFoundHandler = new Handler(
@@ -349,5 +352,9 @@ class Routes { @@ -349,5 +352,9 @@ class Routes {
349 router.define(order_preview_page, handler: orderPreviewPageHandle); 352 router.define(order_preview_page, handler: orderPreviewPageHandle);
350 router.define(order_edit_list_show_page, 353 router.define(order_edit_list_show_page,
351 handler: orderEditListShowPageHandle); 354 handler: orderEditListShowPageHandle);
  355 + router.define(plan_dish_create_select_type_page,
  356 + handler: planDishCreateSelectTypePageHandle);
  357 +
  358 + router.define(plan_dish_edit_page, handler: planDishEidtPageHandle);
352 } 359 }
353 } 360 }
@@ -29,7 +29,8 @@ class RoundButton extends StatelessWidget { @@ -29,7 +29,8 @@ class RoundButton extends StatelessWidget {
29 this.borderColor = Colors.transparent, 29 this.borderColor = Colors.transparent,
30 this.isBold = true, 30 this.isBold = true,
31 this.padding = EdgeInsets.zero, 31 this.padding = EdgeInsets.zero,
32 - this.space = 6, int imageWidth}) 32 + this.space = 6,
  33 + int imageWidth})
33 : super(key: key); 34 : super(key: key);
34 35
35 final String image; 36 final String image;
@@ -102,17 +103,19 @@ class RoundButton extends StatelessWidget { @@ -102,17 +103,19 @@ class RoundButton extends StatelessWidget {
102 : Text(''), 103 : Text(''),
103 Expanded( 104 Expanded(
104 child: Container( 105 child: Container(
105 - padding: EdgeInsets.only(top: ScreenUtil().setWidth(2)), 106 + // padding:
  107 + // EdgeInsets.only(top: ScreenUtil().setWidth(2)),
106 child: ExText( 108 child: ExText(
107 - text,  
108 - style ??  
109 - new TextStyle(  
110 - color: textColor,  
111 - fontSize: ScreenUtil().setSp(fontSize),  
112 - fontWeight:  
113 - isBold ? FontWeight.bold : FontWeight.normal),  
114 - overflow: TextOverflow.ellipsis,  
115 - ))) 109 + text,
  110 + style ??
  111 + new TextStyle(
  112 + color: textColor,
  113 + fontSize: ScreenUtil().setSp(fontSize),
  114 + fontWeight: isBold
  115 + ? FontWeight.bold
  116 + : FontWeight.normal),
  117 + overflow: TextOverflow.ellipsis,
  118 + )))
116 ], 119 ],
117 ), 120 ),
118 ), 121 ),