Showing
7 changed files
with
186 additions
and
127 deletions
| @@ -33,7 +33,7 @@ class Constant { | @@ -33,7 +33,7 @@ class Constant { | ||
| 33 | 33 | ||
| 34 | static const String qiniuUrl = 'https://qn.colorcun.com/'; | 34 | static const String qiniuUrl = 'https://qn.colorcun.com/'; |
| 35 | 35 | ||
| 36 | - static const String wechatAccessTokenKey = 'access_token'; | 36 | + static const String wechatAccessTokenKey = 'access_token'; |
| 37 | 37 | ||
| 38 | static const Map<String, List<String>> authorityConfig = { | 38 | static const Map<String, List<String>> authorityConfig = { |
| 39 | '充值短信': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], | 39 | '充值短信': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], |
| @@ -41,16 +41,19 @@ class Constant { | @@ -41,16 +41,19 @@ class Constant { | ||
| 41 | '个人信息': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], | 41 | '个人信息': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], |
| 42 | '我的客情': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], | 42 | '我的客情': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], |
| 43 | '优惠券': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], | 43 | '优惠券': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], |
| 44 | + | ||
| 45 | + '优惠券-停用-启用': ['管理员', '店长'], | ||
| 46 | + '优惠券-详情页按钮': ['管理员', '店长'], | ||
| 47 | + | ||
| 44 | '常用备注': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], | 48 | '常用备注': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], |
| 45 | '套餐排菜': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], | 49 | '套餐排菜': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], |
| 46 | '客户存酒': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], | 50 | '客户存酒': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'], |
| 47 | '店铺信息': ['管理员', '店长'], | 51 | '店铺信息': ['管理员', '店长'], |
| 48 | '全店客情': ['管理员', '店长'], | 52 | '全店客情': ['管理员', '店长'], |
| 49 | - '桌位管理': ['管理员', '店长', '客户经理'], | 53 | + '桌位管理': ['管理员', '店长'], |
| 50 | '桌位照片': [ | 54 | '桌位照片': [ |
| 51 | '管理员', | 55 | '管理员', |
| 52 | '店长', | 56 | '店长', |
| 53 | - '客户经理', | ||
| 54 | ], | 57 | ], |
| 55 | '员工管理': [ | 58 | '员工管理': [ |
| 56 | '管理员', | 59 | '管理员', |
| @@ -65,7 +68,6 @@ class Constant { | @@ -65,7 +68,6 @@ class Constant { | ||
| 65 | '包间类型': [ | 68 | '包间类型': [ |
| 66 | '管理员', | 69 | '管理员', |
| 67 | '店长', | 70 | '店长', |
| 68 | - '客户经理', | ||
| 69 | ], | 71 | ], |
| 70 | '包间置满': [ | 72 | '包间置满': [ |
| 71 | '管理员', | 73 | '管理员', |
| @@ -75,12 +77,10 @@ class Constant { | @@ -75,12 +77,10 @@ class Constant { | ||
| 75 | '宴会管理': [ | 77 | '宴会管理': [ |
| 76 | '管理员', | 78 | '管理员', |
| 77 | '店长', | 79 | '店长', |
| 78 | - '客户经理', | ||
| 79 | ], | 80 | ], |
| 80 | '营销中心': [ | 81 | '营销中心': [ |
| 81 | '管理员', | 82 | '管理员', |
| 82 | '店长', | 83 | '店长', |
| 83 | - '客户经理', | ||
| 84 | ], | 84 | ], |
| 85 | '评价管理': [ | 85 | '评价管理': [ |
| 86 | '管理员', | 86 | '管理员', |
| @@ -369,6 +369,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -369,6 +369,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 369 | } | 369 | } |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | + bool canOperate = Utils.getAuthority(context, '优惠券-详情页按钮'); | ||
| 373 | + | ||
| 372 | return Scaffold( | 374 | return Scaffold( |
| 373 | backgroundColor: MyColours.color_ffffff, | 375 | backgroundColor: MyColours.color_ffffff, |
| 374 | appBar: SystemAppBar( | 376 | appBar: SystemAppBar( |
| @@ -873,40 +875,48 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -873,40 +875,48 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 873 | width: w(100), | 875 | width: w(100), |
| 874 | gradientStart: MyColours.color_ffffff, | 876 | gradientStart: MyColours.color_ffffff, |
| 875 | gradientEnd: MyColours.color_ffffff, | 877 | gradientEnd: MyColours.color_ffffff, |
| 876 | - borderColor: MyColours.color_438E93, | ||
| 877 | - textColor: MyColours.color_438E93, | 878 | + borderColor: canOperate |
| 879 | + ? MyColours.color_438E93 | ||
| 880 | + : MyColours.color_999999, | ||
| 881 | + textColor: canOperate | ||
| 882 | + ? MyColours.color_438E93 | ||
| 883 | + : MyColours.color_999999, | ||
| 878 | height: ScreenUtil().setWidth(80), | 884 | height: ScreenUtil().setWidth(80), |
| 879 | radius: ScreenUtil().setWidth(14), | 885 | radius: ScreenUtil().setWidth(14), |
| 880 | isBold: true, | 886 | isBold: true, |
| 881 | fontSize: 28, | 887 | fontSize: 28, |
| 882 | onPressed: () async { | 888 | onPressed: () async { |
| 883 | - if (couponProvider.couponSunModel!.status != '1') { | ||
| 884 | - Utils.showToast('请先启用优惠券后再进行操作!'); | ||
| 885 | - return; | ||
| 886 | - } | 889 | + if (canOperate) { |
| 890 | + if (couponProvider.couponSunModel!.status != | ||
| 891 | + '1') { | ||
| 892 | + Utils.showToast('请先启用优惠券后再进行操作!'); | ||
| 893 | + return; | ||
| 894 | + } | ||
| 887 | 895 | ||
| 888 | - if (couponProvider.couponSunModel!.isType == '3') { | ||
| 889 | - NavigatorUtil.goCouponPosterPage( | ||
| 890 | - context, | ||
| 891 | - widget.idstr, | ||
| 892 | - couponProvider.couponSunModel!.use, | ||
| 893 | - couponProvider.couponSunModel); | ||
| 894 | - } else { | ||
| 895 | - // 谁可以发放 | ||
| 896 | - // 可以发放的才能分享 | ||
| 897 | - if (couponProvider.couponSunModel!.uidList! | ||
| 898 | - .split(',') | ||
| 899 | - .contains(Provider.of<UserModel>(context, | ||
| 900 | - listen: false) | ||
| 901 | - .user! | ||
| 902 | - .openid)) { | 896 | + if (couponProvider.couponSunModel!.isType == |
| 897 | + '3') { | ||
| 903 | NavigatorUtil.goCouponPosterPage( | 898 | NavigatorUtil.goCouponPosterPage( |
| 904 | context, | 899 | context, |
| 905 | widget.idstr, | 900 | widget.idstr, |
| 906 | couponProvider.couponSunModel!.use, | 901 | couponProvider.couponSunModel!.use, |
| 907 | couponProvider.couponSunModel); | 902 | couponProvider.couponSunModel); |
| 908 | } else { | 903 | } else { |
| 909 | - Utils.showToast('您没有此权限'); | 904 | + // 谁可以发放 |
| 905 | + // 可以发放的才能分享 | ||
| 906 | + if (couponProvider.couponSunModel!.uidList! | ||
| 907 | + .split(',') | ||
| 908 | + .contains(Provider.of<UserModel>(context, | ||
| 909 | + listen: false) | ||
| 910 | + .user! | ||
| 911 | + .openid)) { | ||
| 912 | + NavigatorUtil.goCouponPosterPage( | ||
| 913 | + context, | ||
| 914 | + widget.idstr, | ||
| 915 | + couponProvider.couponSunModel!.use, | ||
| 916 | + couponProvider.couponSunModel); | ||
| 917 | + } else { | ||
| 918 | + Utils.showToast('您没有此权限'); | ||
| 919 | + } | ||
| 910 | } | 920 | } |
| 911 | } | 921 | } |
| 912 | }, | 922 | }, |
| @@ -920,44 +930,52 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -920,44 +930,52 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 920 | width: w(100), | 930 | width: w(100), |
| 921 | gradientStart: MyColours.color_ffffff, | 931 | gradientStart: MyColours.color_ffffff, |
| 922 | gradientEnd: MyColours.color_ffffff, | 932 | gradientEnd: MyColours.color_ffffff, |
| 923 | - borderColor: MyColours.color_438E93, | ||
| 924 | - textColor: MyColours.color_438E93, | 933 | + borderColor: canOperate |
| 934 | + ? MyColours.color_438E93 | ||
| 935 | + : MyColours.color_999999, | ||
| 936 | + textColor: canOperate | ||
| 937 | + ? MyColours.color_438E93 | ||
| 938 | + : MyColours.color_999999, | ||
| 925 | height: ScreenUtil().setWidth(80), | 939 | height: ScreenUtil().setWidth(80), |
| 926 | radius: ScreenUtil().setWidth(14), | 940 | radius: ScreenUtil().setWidth(14), |
| 927 | isBold: true, | 941 | isBold: true, |
| 928 | fontSize: 28, | 942 | fontSize: 28, |
| 929 | onPressed: () async { | 943 | onPressed: () async { |
| 930 | - if (couponProvider.couponSunModel!.isType == '3') { | ||
| 931 | - //复用,跳转至编辑页面 | ||
| 932 | - dynamic needRefresh = | ||
| 933 | - await NavigatorUtil.goCouponEditPage(context, | ||
| 934 | - isMine: couponProvider | ||
| 935 | - .couponSunModel!.isType == | ||
| 936 | - '1' | ||
| 937 | - ? false | ||
| 938 | - : true, | ||
| 939 | - couponSunModel: | ||
| 940 | - couponProvider.couponSunModel); | ||
| 941 | - if (needRefresh != null && needRefresh) { | ||
| 942 | - if (Navigator.canPop(context)) { | ||
| 943 | - Navigator.pop(context); | 944 | + if (canOperate) { |
| 945 | + if (couponProvider.couponSunModel!.isType == | ||
| 946 | + '3') { | ||
| 947 | + //复用,跳转至编辑页面 | ||
| 948 | + dynamic needRefresh = | ||
| 949 | + await NavigatorUtil.goCouponEditPage( | ||
| 950 | + context, | ||
| 951 | + isMine: couponProvider | ||
| 952 | + .couponSunModel!.isType == | ||
| 953 | + '1' | ||
| 954 | + ? false | ||
| 955 | + : true, | ||
| 956 | + couponSunModel: | ||
| 957 | + couponProvider.couponSunModel); | ||
| 958 | + if (needRefresh != null && needRefresh) { | ||
| 959 | + if (Navigator.canPop(context)) { | ||
| 960 | + Navigator.pop(context); | ||
| 961 | + } | ||
| 944 | } | 962 | } |
| 945 | - } | ||
| 946 | - } else { | ||
| 947 | - //复用,跳转至编辑页面 | ||
| 948 | - dynamic needRefresh = | ||
| 949 | - await NavigatorUtil.goCouponEditPayPage( | ||
| 950 | - context, | ||
| 951 | - isMine: couponProvider | ||
| 952 | - .couponSunModel!.isType == | ||
| 953 | - '1' | ||
| 954 | - ? false | ||
| 955 | - : true, | ||
| 956 | - couponSunModel: | ||
| 957 | - couponProvider.couponSunModel); | ||
| 958 | - if (needRefresh != null && needRefresh) { | ||
| 959 | - if (Navigator.canPop(context)) { | ||
| 960 | - Navigator.pop(context); | 963 | + } else { |
| 964 | + //复用,跳转至编辑页面 | ||
| 965 | + dynamic needRefresh = | ||
| 966 | + await NavigatorUtil.goCouponEditPayPage( | ||
| 967 | + context, | ||
| 968 | + isMine: couponProvider | ||
| 969 | + .couponSunModel!.isType == | ||
| 970 | + '1' | ||
| 971 | + ? false | ||
| 972 | + : true, | ||
| 973 | + couponSunModel: | ||
| 974 | + couponProvider.couponSunModel); | ||
| 975 | + if (needRefresh != null && needRefresh) { | ||
| 976 | + if (Navigator.canPop(context)) { | ||
| 977 | + Navigator.pop(context); | ||
| 978 | + } | ||
| 961 | } | 979 | } |
| 962 | } | 980 | } |
| 963 | } | 981 | } |
| @@ -969,32 +987,25 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -969,32 +987,25 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 969 | text: '分享给客户', | 987 | text: '分享给客户', |
| 970 | height: ScreenUtil().setWidth(80), | 988 | height: ScreenUtil().setWidth(80), |
| 971 | radius: ScreenUtil().setWidth(14), | 989 | radius: ScreenUtil().setWidth(14), |
| 990 | + gradientStart: canOperate | ||
| 991 | + ? MyColours.color_438E93 | ||
| 992 | + : MyColours.color_999999, | ||
| 993 | + gradientEnd: canOperate | ||
| 994 | + ? MyColours.color_438E93 | ||
| 995 | + : MyColours.color_999999, | ||
| 972 | isBold: false, | 996 | isBold: false, |
| 973 | fontSize: 28, | 997 | fontSize: 28, |
| 974 | onPressed: () { | 998 | onPressed: () { |
| 975 | - if (couponProvider.couponSunModel!.status != '1') { | ||
| 976 | - Utils.showToast('请先启用优惠券后再进行操作!'); | ||
| 977 | - return; | ||
| 978 | - } | ||
| 979 | - if (couponProvider.couponSunModel!.status == '1') { | ||
| 980 | - if (couponProvider.couponSunModel!.isType == | ||
| 981 | - '3') { | ||
| 982 | - Utils.goShareBuyCouponToWeChat( | ||
| 983 | - context, | ||
| 984 | - widget.idstr, | ||
| 985 | - couponProvider.couponSunModel!.isType, | ||
| 986 | - couponProvider.couponSunModel!.use, | ||
| 987 | - couponProvider.couponSunModel); | ||
| 988 | - } else { | ||
| 989 | - // 谁可以发放 | ||
| 990 | - // 可以发放的才能分享 | ||
| 991 | - if (couponProvider.couponSunModel!.uidList! | ||
| 992 | - .split(',') | ||
| 993 | - .contains(Provider.of<UserModel>(context, | ||
| 994 | - listen: false) | ||
| 995 | - .user! | ||
| 996 | - .openid)) { | ||
| 997 | - //包含当前登录人 | 999 | + if (canOperate) { |
| 1000 | + if (couponProvider.couponSunModel!.status != | ||
| 1001 | + '1') { | ||
| 1002 | + Utils.showToast('请先启用优惠券后再进行操作!'); | ||
| 1003 | + return; | ||
| 1004 | + } | ||
| 1005 | + if (couponProvider.couponSunModel!.status == | ||
| 1006 | + '1') { | ||
| 1007 | + if (couponProvider.couponSunModel!.isType == | ||
| 1008 | + '3') { | ||
| 998 | Utils.goShareBuyCouponToWeChat( | 1009 | Utils.goShareBuyCouponToWeChat( |
| 999 | context, | 1010 | context, |
| 1000 | widget.idstr, | 1011 | widget.idstr, |
| @@ -1002,20 +1013,37 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -1002,20 +1013,37 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 1002 | couponProvider.couponSunModel!.use, | 1013 | couponProvider.couponSunModel!.use, |
| 1003 | couponProvider.couponSunModel); | 1014 | couponProvider.couponSunModel); |
| 1004 | } else { | 1015 | } else { |
| 1005 | - Utils.showToast('您没有此权限'); | 1016 | + // 谁可以发放 |
| 1017 | + // 可以发放的才能分享 | ||
| 1018 | + if (couponProvider.couponSunModel!.uidList! | ||
| 1019 | + .split(',') | ||
| 1020 | + .contains(Provider.of<UserModel>(context, | ||
| 1021 | + listen: false) | ||
| 1022 | + .user! | ||
| 1023 | + .openid)) { | ||
| 1024 | + //包含当前登录人 | ||
| 1025 | + Utils.goShareBuyCouponToWeChat( | ||
| 1026 | + context, | ||
| 1027 | + widget.idstr, | ||
| 1028 | + couponProvider.couponSunModel!.isType, | ||
| 1029 | + couponProvider.couponSunModel!.use, | ||
| 1030 | + couponProvider.couponSunModel); | ||
| 1031 | + } else { | ||
| 1032 | + Utils.showToast('您没有此权限'); | ||
| 1033 | + } | ||
| 1006 | } | 1034 | } |
| 1007 | } | 1035 | } |
| 1036 | + // else if (couponProvider.couponSunModel.isType == | ||
| 1037 | + // '2' && | ||
| 1038 | + // couponProvider.couponSunModel.status == '1') { | ||
| 1039 | + // // 我的优惠券 | ||
| 1040 | + // Utils.goShareBuyCouponToWeChatMy( | ||
| 1041 | + // context, | ||
| 1042 | + // widget.idstr, | ||
| 1043 | + // managerName, | ||
| 1044 | + // couponProvider.couponSunModel); | ||
| 1045 | + // } | ||
| 1008 | } | 1046 | } |
| 1009 | - // else if (couponProvider.couponSunModel.isType == | ||
| 1010 | - // '2' && | ||
| 1011 | - // couponProvider.couponSunModel.status == '1') { | ||
| 1012 | - // // 我的优惠券 | ||
| 1013 | - // Utils.goShareBuyCouponToWeChatMy( | ||
| 1014 | - // context, | ||
| 1015 | - // widget.idstr, | ||
| 1016 | - // managerName, | ||
| 1017 | - // couponProvider.couponSunModel); | ||
| 1018 | - // } | ||
| 1019 | }, | 1047 | }, |
| 1020 | ), | 1048 | ), |
| 1021 | ) | 1049 | ) |
| @@ -21,6 +21,7 @@ class CouponItemF extends StatefulWidget { | @@ -21,6 +21,7 @@ class CouponItemF extends StatefulWidget { | ||
| 21 | final bool showCheck; | 21 | final bool showCheck; |
| 22 | final bool radio; | 22 | final bool radio; |
| 23 | final bool needNum; | 23 | final bool needNum; |
| 24 | + final bool canOperate; | ||
| 24 | 25 | ||
| 25 | CouponItemF( | 26 | CouponItemF( |
| 26 | {Key? key, | 27 | {Key? key, |
| @@ -32,7 +33,8 @@ class CouponItemF extends StatefulWidget { | @@ -32,7 +33,8 @@ class CouponItemF extends StatefulWidget { | ||
| 32 | this.showBtn = false, | 33 | this.showBtn = false, |
| 33 | this.showCheck = false, | 34 | this.showCheck = false, |
| 34 | this.radio = false, | 35 | this.radio = false, |
| 35 | - this.needNum = true}) | 36 | + this.needNum = true, |
| 37 | + this.canOperate = false}) | ||
| 36 | : super(key: key); | 38 | : super(key: key); |
| 37 | 39 | ||
| 38 | @override | 40 | @override |
| @@ -607,14 +609,14 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -607,14 +609,14 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 607 | fontSize: 24, | 609 | fontSize: 24, |
| 608 | textColor: widget.from == 'history' | 610 | textColor: widget.from == 'history' |
| 609 | ? MyColours.color_BFC4D4 | 611 | ? MyColours.color_BFC4D4 |
| 610 | - : notSelect | 612 | + : widget.canOperate && notSelect |
| 611 | ? MyColours.color_438E93 | 613 | ? MyColours.color_438E93 |
| 612 | : MyColours.color_999999, | 614 | : MyColours.color_999999, |
| 613 | gradientStart: MyColours.color_ffffff, | 615 | gradientStart: MyColours.color_ffffff, |
| 614 | gradientEnd: MyColours.color_ffffff, | 616 | gradientEnd: MyColours.color_ffffff, |
| 615 | borderColor: widget.from == 'history' | 617 | borderColor: widget.from == 'history' |
| 616 | ? MyColours.color_BFC4D4 | 618 | ? MyColours.color_BFC4D4 |
| 617 | - : notSelect | 619 | + : widget.canOperate && notSelect |
| 618 | ? MyColours.color_438E93 | 620 | ? MyColours.color_438E93 |
| 619 | : MyColours.color_999999, | 621 | : MyColours.color_999999, |
| 620 | onPressed: widget.onPressedSwich, | 622 | onPressed: widget.onPressedSwich, |
| @@ -125,7 +125,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -125,7 +125,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 125 | super.dispose(); | 125 | super.dispose(); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | - Future<void> _scan() async { | 128 | + Future<void> _scan() async { |
| 129 | try { | 129 | try { |
| 130 | //全局提示权限使用目的 | 130 | //全局提示权限使用目的 |
| 131 | if (Platform.isAndroid) { | 131 | if (Platform.isAndroid) { |
| @@ -190,6 +190,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -190,6 +190,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 190 | @override | 190 | @override |
| 191 | Widget build(BuildContext context) { | 191 | Widget build(BuildContext context) { |
| 192 | couponProvider = Provider.of<CouponProvider>(context, listen: true); | 192 | couponProvider = Provider.of<CouponProvider>(context, listen: true); |
| 193 | + bool isCreate = Utils.getAuthority(context, '创建新券'); | ||
| 193 | return Scaffold( | 194 | return Scaffold( |
| 194 | backgroundColor: MyColours.color_f3f3f3, | 195 | backgroundColor: MyColours.color_f3f3f3, |
| 195 | appBar: Utils.getAuthority(context, '线上券-设置') | 196 | appBar: Utils.getAuthority(context, '线上券-设置') |
| @@ -221,7 +222,6 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -221,7 +222,6 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 221 | Tab( | 222 | Tab( |
| 222 | text: "全部", | 223 | text: "全部", |
| 223 | ), | 224 | ), |
| 224 | - | ||
| 225 | Tab( | 225 | Tab( |
| 226 | text: "免费代金券", | 226 | text: "免费代金券", |
| 227 | ), | 227 | ), |
| @@ -310,7 +310,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -310,7 +310,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 310 | height: ScreenUtil().setWidth(80), | 310 | height: ScreenUtil().setWidth(80), |
| 311 | radius: ScreenUtil().setWidth(14), | 311 | radius: ScreenUtil().setWidth(14), |
| 312 | isBold: true, | 312 | isBold: true, |
| 313 | - fontSize:32, | 313 | + fontSize: 32, |
| 314 | onPressed: () async { | 314 | onPressed: () async { |
| 315 | _scan(); | 315 | _scan(); |
| 316 | }, | 316 | }, |
| @@ -338,6 +338,18 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -338,6 +338,18 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 338 | text: '创建新券', | 338 | text: '创建新券', |
| 339 | height: ScreenUtil().setWidth(80), | 339 | height: ScreenUtil().setWidth(80), |
| 340 | radius: ScreenUtil().setWidth(14), | 340 | radius: ScreenUtil().setWidth(14), |
| 341 | + gradientStart: isCreate | ||
| 342 | + ? MyColours.color_199095 | ||
| 343 | + : MyColours.color_ffffff, | ||
| 344 | + gradientEnd: isCreate | ||
| 345 | + ? MyColours.color_199095 | ||
| 346 | + : MyColours.color_ffffff, | ||
| 347 | + textColor: isCreate | ||
| 348 | + ? MyColours.color_ffffff | ||
| 349 | + : MyColours.color_999999, | ||
| 350 | + borderColor: isCreate | ||
| 351 | + ? MyColours.color_199095 | ||
| 352 | + : MyColours.color_999999, | ||
| 341 | isBold: true, | 353 | isBold: true, |
| 342 | fontSize: 32, | 354 | fontSize: 32, |
| 343 | onPressed: () async { | 355 | onPressed: () async { |
| @@ -18,6 +18,7 @@ import 'package:provider/provider.dart'; | @@ -18,6 +18,7 @@ import 'package:provider/provider.dart'; | ||
| 18 | 18 | ||
| 19 | import '../../models/coupon_model.dart'; | 19 | import '../../models/coupon_model.dart'; |
| 20 | import '../../provider/marketing_center_provider.dart'; | 20 | import '../../provider/marketing_center_provider.dart'; |
| 21 | +import '../../utils/utils.dart'; | ||
| 21 | 22 | ||
| 22 | class CouponSunPage extends StatefulWidget { | 23 | class CouponSunPage extends StatefulWidget { |
| 23 | final int? index; | 24 | final int? index; |
| @@ -85,9 +86,9 @@ class _CouponSunPageState extends State<CouponSunPage> { | @@ -85,9 +86,9 @@ class _CouponSunPageState extends State<CouponSunPage> { | ||
| 85 | // } | 86 | // } |
| 86 | } | 87 | } |
| 87 | 88 | ||
| 88 | - _getCouponData() async { | 89 | + _getCouponData({bool isShowLoading = false}) async { |
| 89 | (bool, bool) result = await ( | 90 | (bool, bool) result = await ( |
| 90 | - _couponNetworkData(widget.index, isShowLoading: false), | 91 | + _couponNetworkData(widget.index, isShowLoading: isShowLoading), |
| 91 | getSellerTemplateConf(context) | 92 | getSellerTemplateConf(context) |
| 92 | ).wait; | 93 | ).wait; |
| 93 | 94 | ||
| @@ -115,7 +116,8 @@ class _CouponSunPageState extends State<CouponSunPage> { | @@ -115,7 +116,8 @@ class _CouponSunPageState extends State<CouponSunPage> { | ||
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | Future<bool> getSellerTemplateConf(BuildContext context) async { | 118 | Future<bool> getSellerTemplateConf(BuildContext context) async { |
| 118 | - bool success = await marketingCenterProvider.getSellerTemplateConf(context); | 119 | + bool success = await marketingCenterProvider.getSellerTemplateConf(context, |
| 120 | + showLoading: false); | ||
| 119 | if (success && | 121 | if (success && |
| 120 | marketingCenterProvider.markDataModel != null && | 122 | marketingCenterProvider.markDataModel != null && |
| 121 | marketingCenterProvider.markDataModel!.marketing != null) { | 123 | marketingCenterProvider.markDataModel!.marketing != null) { |
| @@ -149,7 +151,8 @@ class _CouponSunPageState extends State<CouponSunPage> { | @@ -149,7 +151,8 @@ class _CouponSunPageState extends State<CouponSunPage> { | ||
| 149 | isShowLoading: true); | 151 | isShowLoading: true); |
| 150 | print(isSuccess); | 152 | print(isSuccess); |
| 151 | // bus.emit('refresh_marketting_page'); | 153 | // bus.emit('refresh_marketting_page'); |
| 152 | - _couponNetworkData(widget.index, isShowLoading: true); | 154 | + |
| 155 | + _getCouponData(isShowLoading: true); | ||
| 153 | // if (isSuccess) { | 156 | // if (isSuccess) { |
| 154 | // couponProvider.notifyListeners(); | 157 | // couponProvider.notifyListeners(); |
| 155 | // } else { | 158 | // } else { |
| @@ -194,6 +197,8 @@ class _CouponSunPageState extends State<CouponSunPage> { | @@ -194,6 +197,8 @@ class _CouponSunPageState extends State<CouponSunPage> { | ||
| 194 | showText: '查看过期优惠券', | 197 | showText: '查看过期优惠券', |
| 195 | ); | 198 | ); |
| 196 | } else { | 199 | } else { |
| 200 | + bool canOperate = Utils.getAuthority(context, '优惠券-停用-启用'); | ||
| 201 | + | ||
| 197 | return EasyRefresh.custom( | 202 | return EasyRefresh.custom( |
| 198 | controller: _controller, | 203 | controller: _controller, |
| 199 | shrinkWrap: true, | 204 | shrinkWrap: true, |
| @@ -205,10 +210,13 @@ class _CouponSunPageState extends State<CouponSunPage> { | @@ -205,10 +210,13 @@ class _CouponSunPageState extends State<CouponSunPage> { | ||
| 205 | from: 'quan', | 210 | from: 'quan', |
| 206 | couponSonModel: couponProvider.couponList![index], | 211 | couponSonModel: couponProvider.couponList![index], |
| 207 | showBtn: true, | 212 | showBtn: true, |
| 213 | + canOperate: canOperate, | ||
| 208 | onPressedSwich: () { | 214 | onPressedSwich: () { |
| 209 | - couponProvider.couponList![index].isOpenBool = | ||
| 210 | - !couponProvider.couponList![index].isOpenBool; | ||
| 211 | - _setCustomerActivity(index); | 215 | + if (canOperate) { |
| 216 | + couponProvider.couponList![index].isOpenBool = | ||
| 217 | + !couponProvider.couponList![index].isOpenBool; | ||
| 218 | + _setCustomerActivity(index); | ||
| 219 | + } | ||
| 212 | }, | 220 | }, |
| 213 | onPressed: () { | 221 | onPressed: () { |
| 214 | NavigatorUtil.goCouponDetailPage( | 222 | NavigatorUtil.goCouponDetailPage( |
| @@ -5347,7 +5347,7 @@ class InvicationPageState extends State<InvicationPage> | @@ -5347,7 +5347,7 @@ class InvicationPageState extends State<InvicationPage> | ||
| 5347 | return; | 5347 | return; |
| 5348 | } else if (ObjectUtil.isEmpty( | 5348 | } else if (ObjectUtil.isEmpty( |
| 5349 | detailModel.baseInfoSunModel) || | 5349 | detailModel.baseInfoSunModel) || |
| 5350 | - ObjectUtil.isEmpty(_baseIndoProvider | 5350 | + ObjectUtil.isEmpty( detailModel |
| 5351 | .baseInfoSunModel!.phone)) { | 5351 | .baseInfoSunModel!.phone)) { |
| 5352 | // Utils.showToast('请填写经理的联系电话'); | 5352 | // Utils.showToast('请填写经理的联系电话'); |
| 5353 | DialogUtil.cupertinoAlertDialog(context, | 5353 | DialogUtil.cupertinoAlertDialog(context, |
| @@ -5608,7 +5608,7 @@ class InvicationPageState extends State<InvicationPage> | @@ -5608,7 +5608,7 @@ class InvicationPageState extends State<InvicationPage> | ||
| 5608 | callback: () async { | 5608 | callback: () async { |
| 5609 | if (ObjectUtil.isEmpty( | 5609 | if (ObjectUtil.isEmpty( |
| 5610 | detailModel.baseInfoSunModel) || | 5610 | detailModel.baseInfoSunModel) || |
| 5611 | - ObjectUtil.isEmpty(_baseIndoProvider | 5611 | + ObjectUtil.isEmpty( detailModel |
| 5612 | .baseInfoSunModel!.phone)) { | 5612 | .baseInfoSunModel!.phone)) { |
| 5613 | // Utils.showToast('请填写经理的联系电话'); | 5613 | // Utils.showToast('请填写经理的联系电话'); |
| 5614 | DialogUtil.cupertinoAlertDialog(context, | 5614 | DialogUtil.cupertinoAlertDialog(context, |
| 1 | - | ||
| 2 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter_easyrefresh/easy_refresh.dart'; | 2 | import 'package:flutter_easyrefresh/easy_refresh.dart'; |
| 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| @@ -34,8 +33,7 @@ class MyPlanDishHomePage extends StatefulWidget { | @@ -34,8 +33,7 @@ class MyPlanDishHomePage extends StatefulWidget { | ||
| 34 | } | 33 | } |
| 35 | 34 | ||
| 36 | class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | 35 | class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> |
| 37 | - with TickerProviderStateMixin | ||
| 38 | - { | 36 | + with TickerProviderStateMixin { |
| 39 | EasyRefreshController _controller = EasyRefreshController(); | 37 | EasyRefreshController _controller = EasyRefreshController(); |
| 40 | late PlanDishProvider planDishProvider; | 38 | late PlanDishProvider planDishProvider; |
| 41 | TabController? tabController; | 39 | TabController? tabController; |
| @@ -74,14 +72,14 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | @@ -74,14 +72,14 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | ||
| 74 | void initState() { | 72 | void initState() { |
| 75 | // TODO: implement initState | 73 | // TODO: implement initState |
| 76 | super.initState(); | 74 | super.initState(); |
| 77 | - tabController = TabController(length: 3,vsync: this ); | 75 | + tabController = TabController(length: 3, vsync: this); |
| 78 | tabController!.addListener(() { | 76 | tabController!.addListener(() { |
| 79 | // couponProvider.couponList = []; | 77 | // couponProvider.couponList = []; |
| 80 | // couponProvider.pageState = PageState.Loading; | 78 | // couponProvider.pageState = PageState.Loading; |
| 81 | // setState(() {}); | 79 | // setState(() {}); |
| 82 | //点击tab时或滑动tab回调一次 | 80 | //点击tab时或滑动tab回调一次 |
| 83 | if (tabController!.index.toDouble() == tabController!.animation!.value) { | 81 | if (tabController!.index.toDouble() == tabController!.animation!.value) { |
| 84 | - // couponProvider.notifyListeners(); | 82 | + setState(() {}); |
| 85 | // _couponNetworkData(tabController.index); | 83 | // _couponNetworkData(tabController.index); |
| 86 | // selectIndex = tabController.index; | 84 | // selectIndex = tabController.index; |
| 87 | // setState(() {}); | 85 | // setState(() {}); |
| @@ -233,23 +231,34 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | @@ -233,23 +231,34 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | ||
| 233 | height: ScreenUtil().setWidth(80), | 231 | height: ScreenUtil().setWidth(80), |
| 234 | radius: ScreenUtil().setWidth(14), | 232 | radius: ScreenUtil().setWidth(14), |
| 235 | isBold: false, | 233 | isBold: false, |
| 234 | + gradientStart: tabController?.index == 1 && | ||
| 235 | + !Utils.getAuthority(context, '创建新排菜') | ||
| 236 | + ? MyColours.color_999999 | ||
| 237 | + : MyColours.color_199095, | ||
| 238 | + gradientEnd: tabController?.index == 1 && | ||
| 239 | + !Utils.getAuthority(context, '创建新排菜') | ||
| 240 | + ? MyColours.color_999999 | ||
| 241 | + : MyColours.color_199095, | ||
| 236 | fontSize: 28, | 242 | fontSize: 28, |
| 237 | onPressed: () async { | 243 | onPressed: () async { |
| 238 | // UserModel userModel = | 244 | // UserModel userModel = |
| 239 | // Provider.of<UserModel>(context, listen: false); | 245 | // Provider.of<UserModel>(context, listen: false); |
| 240 | - if (Utils.getAuthority(context, '创建新排菜')) { | ||
| 241 | - NavigatorUtil.goPlanDishCreateSelectTypePage(context); | ||
| 242 | - } else { | ||
| 243 | - bool? needRefresh = await NavigatorUtil.goPlanDishEditPage( | ||
| 244 | - context, | ||
| 245 | - isMine: true, | ||
| 246 | - isEdit: true); | ||
| 247 | - print(needRefresh); | ||
| 248 | - if (needRefresh != null && needRefresh) { | ||
| 249 | - // bus.emit('refresh_coupon_list_f'); | ||
| 250 | - //刷新页面数据 | ||
| 251 | - // _controller.callRefresh(); | ||
| 252 | - // _couponNetworkData(tabController.index); | 246 | + if (!(tabController?.index == 1 && |
| 247 | + !Utils.getAuthority(context, '创建新排菜'))) { | ||
| 248 | + if (Utils.getAuthority(context, '创建新排菜')) { | ||
| 249 | + NavigatorUtil.goPlanDishCreateSelectTypePage(context); | ||
| 250 | + } else { | ||
| 251 | + bool? needRefresh = await NavigatorUtil.goPlanDishEditPage( | ||
| 252 | + context, | ||
| 253 | + isMine: true, | ||
| 254 | + isEdit: true); | ||
| 255 | + print(needRefresh); | ||
| 256 | + if (needRefresh != null && needRefresh) { | ||
| 257 | + // bus.emit('refresh_coupon_list_f'); | ||
| 258 | + //刷新页面数据 | ||
| 259 | + // _controller.callRefresh(); | ||
| 260 | + // _couponNetworkData(tabController.index); | ||
| 261 | + } | ||
| 253 | } | 262 | } |
| 254 | } | 263 | } |
| 255 | }, | 264 | }, |
-
Please register or login to post a comment