Showing
17 changed files
with
886 additions
and
53 deletions
assets/select_f.png
0 → 100755
1.12 KB
assets/show_select_f.png
0 → 100755
1.01 KB
assets/unselect_f.png
0 → 100755
1.16 KB
| @@ -60,6 +60,13 @@ class CouponSunModel extends Object { | @@ -60,6 +60,13 @@ class CouponSunModel extends Object { | ||
| 60 | @JsonKey(name: 'use_num') | 60 | @JsonKey(name: 'use_num') |
| 61 | String useNum; | 61 | String useNum; |
| 62 | 62 | ||
| 63 | + @JsonKey(name: 'uid_list') | ||
| 64 | + String uidList; | ||
| 65 | + @JsonKey(name: 'is_examine') | ||
| 66 | + String isExamine; | ||
| 67 | + @JsonKey(name: 'is_type') | ||
| 68 | + String isType; | ||
| 69 | + | ||
| 63 | @JsonKey(name: 'is_open') | 70 | @JsonKey(name: 'is_open') |
| 64 | String isOpen; | 71 | String isOpen; |
| 65 | 72 | ||
| @@ -81,6 +88,9 @@ class CouponSunModel extends Object { | @@ -81,6 +88,9 @@ class CouponSunModel extends Object { | ||
| 81 | this.cdate, | 88 | this.cdate, |
| 82 | this.receiveNum, | 89 | this.receiveNum, |
| 83 | this.useNum, | 90 | this.useNum, |
| 91 | + this.uidList, | ||
| 92 | + this.isExamine, | ||
| 93 | + this.isType, | ||
| 84 | this.isOpen, | 94 | this.isOpen, |
| 85 | this.isOpenBool); | 95 | this.isOpenBool); |
| 86 | 96 |
| @@ -37,6 +37,9 @@ CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) { | @@ -37,6 +37,9 @@ CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) { | ||
| 37 | json['cdate'] as String, | 37 | json['cdate'] as String, |
| 38 | json['receive_num'] as String, | 38 | json['receive_num'] as String, |
| 39 | json['use_num'] as String, | 39 | json['use_num'] as String, |
| 40 | + json['uid_list'] as String, | ||
| 41 | + json['is_examine'] as String, | ||
| 42 | + json['is_type'] as String, | ||
| 40 | json['is_open'] as String, | 43 | json['is_open'] as String, |
| 41 | json['status'] == "1" ? true : false, | 44 | json['status'] == "1" ? true : false, |
| 42 | ); | 45 | ); |
| @@ -55,6 +58,9 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) => | @@ -55,6 +58,9 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) => | ||
| 55 | 'cdate': instance.cdate, | 58 | 'cdate': instance.cdate, |
| 56 | 'receiveNum': instance.receiveNum, | 59 | 'receiveNum': instance.receiveNum, |
| 57 | 'useNum': instance.useNum, | 60 | 'useNum': instance.useNum, |
| 61 | + 'uid_list': instance.uidList, | ||
| 62 | + 'is_examine': instance.isExamine, | ||
| 63 | + 'is_type': instance.isType, | ||
| 58 | 'isOpen': instance.isOpen, | 64 | 'isOpen': instance.isOpen, |
| 59 | 'isOpenBool': instance.isOpenBool | 65 | 'isOpenBool': instance.isOpenBool |
| 60 | }; | 66 | }; |
| @@ -41,6 +41,7 @@ class PersonnelManageModelData extends Object { | @@ -41,6 +41,7 @@ class PersonnelManageModelData extends Object { | ||
| 41 | 41 | ||
| 42 | @JsonKey(name: 'manager') | 42 | @JsonKey(name: 'manager') |
| 43 | Manager manager; | 43 | Manager manager; |
| 44 | + bool select = false; | ||
| 44 | 45 | ||
| 45 | PersonnelManageModelData( | 46 | PersonnelManageModelData( |
| 46 | this.admin, | 47 | this.admin, |
| @@ -64,6 +65,7 @@ class Admin extends Object { | @@ -64,6 +65,7 @@ class Admin extends Object { | ||
| 64 | @JsonKey(name: 'role_id') | 65 | @JsonKey(name: 'role_id') |
| 65 | String roleId; | 66 | String roleId; |
| 66 | int hasWechatNum; //已绑定微信数量 | 67 | int hasWechatNum; //已绑定微信数量 |
| 68 | + bool select = false; | ||
| 67 | 69 | ||
| 68 | Admin( | 70 | Admin( |
| 69 | this.listdata, | 71 | this.listdata, |
| @@ -110,7 +112,7 @@ class PersonnelManageSunModel extends Object { | @@ -110,7 +112,7 @@ class PersonnelManageSunModel extends Object { | ||
| 110 | 112 | ||
| 111 | @JsonKey(name: 'headimgurl') | 113 | @JsonKey(name: 'headimgurl') |
| 112 | String headimgurl; | 114 | String headimgurl; |
| 113 | - | 115 | + bool select = false; |
| 114 | 116 | ||
| 115 | PersonnelManageSunModel( | 117 | PersonnelManageSunModel( |
| 116 | this.id, | 118 | this.id, |
| @@ -140,6 +142,7 @@ class Shopowner extends Object { | @@ -140,6 +142,7 @@ class Shopowner extends Object { | ||
| 140 | @JsonKey(name: 'role_id') | 142 | @JsonKey(name: 'role_id') |
| 141 | String roleId; | 143 | String roleId; |
| 142 | int hasWechatNum; //已绑定微信数量 | 144 | int hasWechatNum; //已绑定微信数量 |
| 145 | + bool select = false; | ||
| 143 | 146 | ||
| 144 | Shopowner( | 147 | Shopowner( |
| 145 | this.listdata, | 148 | this.listdata, |
| @@ -160,6 +163,7 @@ class Cashier extends Object { | @@ -160,6 +163,7 @@ class Cashier extends Object { | ||
| 160 | @JsonKey(name: 'role_id') | 163 | @JsonKey(name: 'role_id') |
| 161 | String roleId; | 164 | String roleId; |
| 162 | int hasWechatNum; //已绑定微信数量 | 165 | int hasWechatNum; //已绑定微信数量 |
| 166 | + bool select = false; | ||
| 163 | 167 | ||
| 164 | Cashier( | 168 | Cashier( |
| 165 | this.listdata, | 169 | this.listdata, |
| @@ -180,6 +184,7 @@ class Waiter extends Object { | @@ -180,6 +184,7 @@ class Waiter extends Object { | ||
| 180 | @JsonKey(name: 'role_id') | 184 | @JsonKey(name: 'role_id') |
| 181 | String roleId; | 185 | String roleId; |
| 182 | int hasWechatNum; //已绑定微信数量 | 186 | int hasWechatNum; //已绑定微信数量 |
| 187 | + bool select = false; | ||
| 183 | 188 | ||
| 184 | Waiter( | 189 | Waiter( |
| 185 | this.listdata, | 190 | this.listdata, |
| @@ -201,6 +206,7 @@ class Manager extends Object { | @@ -201,6 +206,7 @@ class Manager extends Object { | ||
| 201 | String roleId; | 206 | String roleId; |
| 202 | 207 | ||
| 203 | int hasWechatNum; //已绑定微信数量 | 208 | int hasWechatNum; //已绑定微信数量 |
| 209 | + bool select = false; | ||
| 204 | 210 | ||
| 205 | Manager( | 211 | Manager( |
| 206 | this.listdata, | 212 | this.listdata, |
| @@ -3,6 +3,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart'; | @@ -3,6 +3,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart'; | ||
| 3 | import 'package:flutter_screenutil/screenutil.dart'; | 3 | import 'package:flutter_screenutil/screenutil.dart'; |
| 4 | import 'package:one_key/res/colors.dart'; | 4 | import 'package:one_key/res/colors.dart'; |
| 5 | import 'package:one_key/route/navigator_util.dart'; | 5 | import 'package:one_key/route/navigator_util.dart'; |
| 6 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 6 | import 'package:one_key/utils/utils.dart'; | 7 | import 'package:one_key/utils/utils.dart'; |
| 7 | import 'package:one_key/widgets/h_empty_view.dart'; | 8 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 8 | import 'package:one_key/widgets/round_button.dart'; | 9 | import 'package:one_key/widgets/round_button.dart'; |
| @@ -179,9 +180,11 @@ class _CouponCreateSelectTypePageState | @@ -179,9 +180,11 @@ class _CouponCreateSelectTypePageState | ||
| 179 | isMine: selectF); | 180 | isMine: selectF); |
| 180 | print(needRefresh); | 181 | print(needRefresh); |
| 181 | if (needRefresh != null && needRefresh) { | 182 | if (needRefresh != null && needRefresh) { |
| 183 | + Navigator.pop(context); | ||
| 182 | //刷新页面数据 | 184 | //刷新页面数据 |
| 183 | // _controller.callRefresh(); | 185 | // _controller.callRefresh(); |
| 184 | // _couponNetworkData(); | 186 | // _couponNetworkData(); |
| 187 | + bus.emit('refresh_coupon_list_f'); | ||
| 185 | } | 188 | } |
| 186 | }, | 189 | }, |
| 187 | ) | 190 | ) |
| @@ -39,10 +39,52 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -39,10 +39,52 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 39 | super.initState(); | 39 | super.initState(); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | + ///时间选择 | ||
| 43 | + Widget _select(String title, String hintText, GestureTapCallback onTap) { | ||
| 44 | + return InkWell( | ||
| 45 | + onTap: onTap, | ||
| 46 | + child: Container( | ||
| 47 | + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)), | ||
| 48 | + child: Row( | ||
| 49 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 50 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 51 | + children: [ | ||
| 52 | + Container( | ||
| 53 | + // height: ScreenUtil().setWidth(40), | ||
| 54 | + // color: Colors.red, | ||
| 55 | + child: Text( | ||
| 56 | + title, | ||
| 57 | + style: TextStyle( | ||
| 58 | + color: Color.fromRGBO(0, 0, 0, 0.9), | ||
| 59 | + fontWeight: FontWeight.bold, | ||
| 60 | + fontSize: ScreenUtil().setSp(32)), | ||
| 61 | + ), | ||
| 62 | + ), | ||
| 63 | + HEmptyView(20), | ||
| 64 | + Spacer(), | ||
| 65 | + Text(hintText, | ||
| 66 | + style: TextStyle( | ||
| 67 | + color: hintText == '点击选择' | ||
| 68 | + ? MyColours.color_999999 | ||
| 69 | + : MyColours.color_515151, | ||
| 70 | + fontSize: ScreenUtil().setSp(32), | ||
| 71 | + )), | ||
| 72 | + HEmptyView(20), | ||
| 73 | + Image.asset( | ||
| 74 | + Utils.getImgPath('arrow_right_new'), | ||
| 75 | + width: ScreenUtil().setWidth(20), | ||
| 76 | + ), | ||
| 77 | + HEmptyView(32), | ||
| 78 | + ], | ||
| 79 | + ), | ||
| 80 | + ), | ||
| 81 | + ); | ||
| 82 | + } | ||
| 83 | + | ||
| 42 | ///输入框 | 84 | ///输入框 |
| 43 | Widget _item(String title, String subTitle) { | 85 | Widget _item(String title, String subTitle) { |
| 44 | return Container( | 86 | return Container( |
| 45 | - constraints: BoxConstraints(minHeight: heightCell), | 87 | + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)), |
| 46 | child: Row( | 88 | child: Row( |
| 47 | crossAxisAlignment: CrossAxisAlignment.center, | 89 | crossAxisAlignment: CrossAxisAlignment.center, |
| 48 | mainAxisAlignment: MainAxisAlignment.center, | 90 | mainAxisAlignment: MainAxisAlignment.center, |
| @@ -51,8 +93,9 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -51,8 +93,9 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 51 | child: Text( | 93 | child: Text( |
| 52 | title, | 94 | title, |
| 53 | style: TextStyle( | 95 | style: TextStyle( |
| 96 | + color: Color.fromRGBO(0, 0, 0, 0.9), | ||
| 54 | fontWeight: FontWeight.bold, | 97 | fontWeight: FontWeight.bold, |
| 55 | - fontSize: ScreenUtil().setSp(30)), | 98 | + fontSize: ScreenUtil().setSp(32)), |
| 56 | ), | 99 | ), |
| 57 | ), | 100 | ), |
| 58 | HEmptyView(60), | 101 | HEmptyView(60), |
| @@ -63,8 +106,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -63,8 +106,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 63 | textAlign: TextAlign.right, | 106 | textAlign: TextAlign.right, |
| 64 | overflow: TextOverflow.ellipsis, | 107 | overflow: TextOverflow.ellipsis, |
| 65 | style: TextStyle( | 108 | style: TextStyle( |
| 66 | - color: MyColours.color_333333, | ||
| 67 | - fontSize: ScreenUtil().setSp(26), | 109 | + color: Color.fromRGBO(0, 0, 0, 0.4), |
| 110 | + fontSize: ScreenUtil().setSp(32), | ||
| 68 | ), | 111 | ), |
| 69 | )) | 112 | )) |
| 70 | ], | 113 | ], |
| @@ -76,8 +119,9 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -76,8 +119,9 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 76 | Widget build(BuildContext context) { | 119 | Widget build(BuildContext context) { |
| 77 | couponProvider = Provider.of<CouponProvider>(context, listen: true); | 120 | couponProvider = Provider.of<CouponProvider>(context, listen: true); |
| 78 | return Scaffold( | 121 | return Scaffold( |
| 122 | + backgroundColor: MyColours.color_ffffff, | ||
| 79 | appBar: SystemAppBar( | 123 | appBar: SystemAppBar( |
| 80 | - '券详情', | 124 | + '优惠券详情', |
| 81 | onTap: () { | 125 | onTap: () { |
| 82 | Navigator.pop(context); | 126 | Navigator.pop(context); |
| 83 | }, | 127 | }, |
| @@ -89,34 +133,103 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -89,34 +133,103 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 89 | physics: BouncingScrollPhysics(), | 133 | physics: BouncingScrollPhysics(), |
| 90 | child: Padding( | 134 | child: Padding( |
| 91 | padding: EdgeInsets.symmetric( | 135 | padding: EdgeInsets.symmetric( |
| 92 | - horizontal: ScreenUtil().setWidth(40)), | 136 | + horizontal: ScreenUtil().setWidth(32)), |
| 93 | child: Column( | 137 | child: Column( |
| 94 | children: [ | 138 | children: [ |
| 95 | - VEmptyView(20), | 139 | + VEmptyView(56), |
| 140 | + _item( | ||
| 141 | + '券类型', | ||
| 142 | + widget.couponSunModel.isType == '1' | ||
| 143 | + ? widget.couponSunModel.isExamine == '1' | ||
| 144 | + ? '店铺优惠券(核销券)' | ||
| 145 | + : '店铺优惠券' | ||
| 146 | + : '我的优惠券'), | ||
| 147 | + Container( | ||
| 148 | + height: ScreenUtil().setWidth(2), | ||
| 149 | + color: MyColours.color_E7E7E7, | ||
| 150 | + ), | ||
| 151 | + VEmptyView(24), | ||
| 96 | _item('券名称', widget.couponSunModel.aname), | 152 | _item('券名称', widget.couponSunModel.aname), |
| 97 | - VEmptyView(5), | 153 | + Container( |
| 154 | + height: ScreenUtil().setWidth(2), | ||
| 155 | + color: MyColours.color_E7E7E7, | ||
| 156 | + ), | ||
| 157 | + VEmptyView(24), | ||
| 98 | _item('券要求', widget.couponSunModel.desc), | 158 | _item('券要求', widget.couponSunModel.desc), |
| 99 | - VEmptyView(5), | 159 | + Container( |
| 160 | + height: ScreenUtil().setWidth(2), | ||
| 161 | + color: MyColours.color_E7E7E7, | ||
| 162 | + ), | ||
| 163 | + VEmptyView(24), | ||
| 100 | _item( | 164 | _item( |
| 101 | '有效期从', | 165 | '有效期从', |
| 102 | Utils.getDateStrFromJiekou( | 166 | Utils.getDateStrFromJiekou( |
| 103 | widget.couponSunModel.stime)), | 167 | widget.couponSunModel.stime)), |
| 104 | - VEmptyView(5), | 168 | + Container( |
| 169 | + height: ScreenUtil().setWidth(2), | ||
| 170 | + color: MyColours.color_E7E7E7, | ||
| 171 | + ), | ||
| 172 | + VEmptyView(24), | ||
| 105 | _item( | 173 | _item( |
| 106 | '有效期至', | 174 | '有效期至', |
| 107 | Utils.getDateStrFromJiekou( | 175 | Utils.getDateStrFromJiekou( |
| 108 | widget.couponSunModel.etime)), | 176 | widget.couponSunModel.etime)), |
| 109 | - widget.couponSunModel.explain != null || | 177 | + widget.couponSunModel.isType == '1' |
| 178 | + ? Column( | ||
| 179 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 180 | + children: [ | ||
| 181 | + Container( | ||
| 182 | + height: ScreenUtil().setWidth(2), | ||
| 183 | + color: MyColours.color_E7E7E7, | ||
| 184 | + ), | ||
| 185 | + VEmptyView(24), | ||
| 186 | + _item('创建人', widget.couponSunModel.uid), | ||
| 187 | + ], | ||
| 188 | + ) | ||
| 189 | + : SizedBox(), | ||
| 190 | + widget.couponSunModel.isType == '1' | ||
| 191 | + ? Column( | ||
| 192 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 193 | + children: [ | ||
| 194 | + Container( | ||
| 195 | + height: ScreenUtil().setWidth(2), | ||
| 196 | + color: MyColours.color_E7E7E7, | ||
| 197 | + ), | ||
| 198 | + VEmptyView(24), | ||
| 199 | + _select( | ||
| 200 | + '谁可以发放', | ||
| 201 | + '查看', | ||
| 202 | + () async { | ||
| 203 | + await NavigatorUtil.goCouponToPersonnalPage( | ||
| 204 | + context, widget.couponSunModel.uidList, | ||
| 205 | + onlyShow: true); | ||
| 206 | + }, | ||
| 207 | + ) | ||
| 208 | + ], | ||
| 209 | + ) | ||
| 210 | + : SizedBox(), | ||
| 211 | + widget.couponSunModel.explain != null && | ||
| 212 | + widget.couponSunModel.explain != '' | ||
| 213 | + ? Container( | ||
| 214 | + height: ScreenUtil().setWidth(2), | ||
| 215 | + color: MyColours.color_E7E7E7, | ||
| 216 | + ) | ||
| 217 | + : SizedBox(), | ||
| 218 | + widget.couponSunModel.explain != null && | ||
| 110 | widget.couponSunModel.explain != '' | 219 | widget.couponSunModel.explain != '' |
| 111 | - ? VEmptyView(5) | ||
| 112 | - : Container(), | 220 | + ? VEmptyView(24) |
| 221 | + : SizedBox(), | ||
| 113 | widget.couponSunModel.explain != null && | 222 | widget.couponSunModel.explain != null && |
| 114 | widget.couponSunModel.explain != '' | 223 | widget.couponSunModel.explain != '' |
| 115 | ? _item('券说明', widget.couponSunModel.explain) | 224 | ? _item('券说明', widget.couponSunModel.explain) |
| 116 | - : Container(), | ||
| 117 | - VEmptyView(5), | 225 | + : SizedBox(), |
| 226 | + Container( | ||
| 227 | + height: ScreenUtil().setWidth(2), | ||
| 228 | + color: MyColours.color_E7E7E7, | ||
| 229 | + ), | ||
| 230 | + VEmptyView(24), | ||
| 118 | _item('券状态', | 231 | _item('券状态', |
| 119 | - widget.couponSunModel.status == '1' ? '启用' : '停用') | 232 | + widget.couponSunModel.status == '1' ? '发放中' : '停用') |
| 120 | ], | 233 | ], |
| 121 | ))), | 234 | ))), |
| 122 | ) | 235 | ) |
| @@ -44,6 +44,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -44,6 +44,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 44 | bool showDateSelWidget = false; | 44 | bool showDateSelWidget = false; |
| 45 | CouponProvider couponProvider; | 45 | CouponProvider couponProvider; |
| 46 | bool swichHexiao = true; //默认启用 核销状态 | 46 | bool swichHexiao = true; //默认启用 核销状态 |
| 47 | + String uids = ''; | ||
| 47 | 48 | ||
| 48 | @override | 49 | @override |
| 49 | void initState() { | 50 | void initState() { |
| @@ -94,7 +95,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -94,7 +95,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 94 | }; | 95 | }; |
| 95 | if (!widget.isMine) { | 96 | if (!widget.isMine) { |
| 96 | params['is_examine'] = swichHexiao ? "1" : "0"; | 97 | params['is_examine'] = swichHexiao ? "1" : "0"; |
| 97 | - params['uid_list'] = ''; | 98 | + params['uid_list'] = uids; |
| 98 | } | 99 | } |
| 99 | bool isSuccess = | 100 | bool isSuccess = |
| 100 | await couponProvider.createCustomerActivity(context, params); | 101 | await couponProvider.createCustomerActivity(context, params); |
| @@ -478,7 +479,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -478,7 +479,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 478 | VEmptyView(24), | 479 | VEmptyView(24), |
| 479 | widget.isMine | 480 | widget.isMine |
| 480 | ? SizedBox() | 481 | ? SizedBox() |
| 481 | - : _select('谁可以发放', '编辑', () {}), | 482 | + : _select('谁可以发放', '编辑', () async { |
| 483 | + Map temp = await NavigatorUtil | ||
| 484 | + .goCouponToPersonnalPage(context, uids); | ||
| 485 | + if (temp != null && temp['object'] != null) { | ||
| 486 | + uids = temp['object']; | ||
| 487 | + } | ||
| 488 | + }), | ||
| 482 | widget.isMine | 489 | widget.isMine |
| 483 | ? SizedBox() | 490 | ? SizedBox() |
| 484 | : Container( | 491 | : Container( |
| @@ -88,7 +88,9 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -88,7 +88,9 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 88 | horizontal: ScreenUtil().setWidth(24)), | 88 | horizontal: ScreenUtil().setWidth(24)), |
| 89 | decoration: BoxDecoration( | 89 | decoration: BoxDecoration( |
| 90 | color: notSelect | 90 | color: notSelect |
| 91 | - ? MyColours.color_438E93 | 91 | + ? sunModel.isType == '1' |
| 92 | + ? MyColours.color_438E93 | ||
| 93 | + : MyColours.color_ED7B2F | ||
| 92 | : MyColours.color_999999, | 94 | : MyColours.color_999999, |
| 93 | borderRadius: BorderRadius.only( | 95 | borderRadius: BorderRadius.only( |
| 94 | topLeft: Radius.circular(ScreenUtil().setWidth(16)), | 96 | topLeft: Radius.circular(ScreenUtil().setWidth(16)), |
| @@ -98,7 +100,11 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -98,7 +100,11 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 98 | mainAxisAlignment: MainAxisAlignment.spaceBetween, | 100 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 99 | children: [ | 101 | children: [ |
| 100 | Text( | 102 | Text( |
| 101 | - '店铺优惠券(核销)', | 103 | + sunModel.isType == '1' |
| 104 | + ? sunModel.isExamine == '1' | ||
| 105 | + ? '店铺优惠券(核销)' | ||
| 106 | + : '店铺优惠券' | ||
| 107 | + : '我的优惠券', | ||
| 102 | style: TextStyle( | 108 | style: TextStyle( |
| 103 | color: MyColours.color_ffffff, | 109 | color: MyColours.color_ffffff, |
| 104 | fontSize: ScreenUtil().setSp(24)), | 110 | fontSize: ScreenUtil().setSp(24)), |
| @@ -106,7 +112,11 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -106,7 +112,11 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 106 | InkWell( | 112 | InkWell( |
| 107 | onTap: widget.onPressedSwich, | 113 | onTap: widget.onPressedSwich, |
| 108 | child: Text( | 114 | child: Text( |
| 109 | - '被领取:${sunModel.receiveNum}张 已使用:${sunModel.useNum}张', | 115 | + sunModel.isType == '1' |
| 116 | + ? sunModel.isExamine == '1' | ||
| 117 | + ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张' | ||
| 118 | + : '创建人:${sunModel.uid} 被领取:${sunModel.receiveNum}张' | ||
| 119 | + : '被领取:${sunModel.receiveNum}张', | ||
| 110 | maxLines: 1, | 120 | maxLines: 1, |
| 111 | overflow: TextOverflow.ellipsis, | 121 | overflow: TextOverflow.ellipsis, |
| 112 | style: TextStyle( | 122 | style: TextStyle( |
| @@ -33,10 +33,11 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -33,10 +33,11 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 33 | TabController tabController; | 33 | TabController tabController; |
| 34 | 34 | ||
| 35 | ///获取优惠券列表数据 | 35 | ///获取优惠券列表数据 |
| 36 | - _couponNetworkData({bool isShowLoading = true}) async { | 36 | + _couponNetworkData(int index, {bool isShowLoading = true}) async { |
| 37 | Map<String, String> params = { | 37 | Map<String, String> params = { |
| 38 | "uid": Provider.of<UserModel>(context, listen: false).user.openid, | 38 | "uid": Provider.of<UserModel>(context, listen: false).user.openid, |
| 39 | // 'is_time': '0' | 39 | // 'is_time': '0' |
| 40 | + "is_type": index.toString() | ||
| 40 | }; | 41 | }; |
| 41 | await couponProvider.getCustomerActivity(context, params, | 42 | await couponProvider.getCustomerActivity(context, params, |
| 42 | isShowLoading: isShowLoading); | 43 | isShowLoading: isShowLoading); |
| @@ -51,7 +52,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -51,7 +52,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 51 | bool isSuccess = await couponProvider.setCustomerActivity(context, params, | 52 | bool isSuccess = await couponProvider.setCustomerActivity(context, params, |
| 52 | isShowLoading: false); | 53 | isShowLoading: false); |
| 53 | print(isSuccess); | 54 | print(isSuccess); |
| 54 | - _couponNetworkData(isShowLoading: false); | 55 | + _couponNetworkData(tabController.index, isShowLoading: false); |
| 55 | // if (isSuccess) { | 56 | // if (isSuccess) { |
| 56 | // couponProvider.notifyListeners(); | 57 | // couponProvider.notifyListeners(); |
| 57 | // } else { | 58 | // } else { |
| @@ -67,25 +68,29 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -67,25 +68,29 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 67 | super.initState(); | 68 | super.initState(); |
| 68 | tabController = TabController(length: 3, vsync: this); | 69 | tabController = TabController(length: 3, vsync: this); |
| 69 | tabController.addListener(() { | 70 | tabController.addListener(() { |
| 70 | - //点击tab时或滑动tab回调一次 | ||
| 71 | - // if (tabController.index.toDouble() == tabController.animation.value) { | ||
| 72 | - // getMessage(index: tabController.index); | ||
| 73 | - // selectIndex = tabController.index; | 71 | + couponProvider.couponList = []; |
| 72 | + couponProvider.pageState = PageState.Loading; | ||
| 74 | setState(() {}); | 73 | setState(() {}); |
| 75 | - // } | 74 | + //点击tab时或滑动tab回调一次 |
| 75 | + if (tabController.index.toDouble() == tabController.animation.value) { | ||
| 76 | + // couponProvider.notifyListeners(); | ||
| 77 | + _couponNetworkData(tabController.index); | ||
| 78 | + // selectIndex = tabController.index; | ||
| 79 | + // setState(() {}); | ||
| 80 | + } | ||
| 76 | }); | 81 | }); |
| 77 | WidgetsBinding.instance.addPostFrameCallback((_) { | 82 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 78 | - _couponNetworkData(); | 83 | + _couponNetworkData(0); |
| 84 | + }); | ||
| 85 | + bus.on("refresh_coupon_list_f", (arg) { | ||
| 86 | + _couponNetworkData(tabController.index); | ||
| 79 | }); | 87 | }); |
| 80 | - // bus.on("refresh_coupon_list", (arg) { | ||
| 81 | - // _couponNetworkData(); | ||
| 82 | - // }); | ||
| 83 | } | 88 | } |
| 84 | 89 | ||
| 85 | @override | 90 | @override |
| 86 | void dispose() { | 91 | void dispose() { |
| 87 | bus.off('changeStatusColor'); | 92 | bus.off('changeStatusColor'); |
| 88 | - // bus.off("refresh_coupon_list"); | 93 | + bus.off("refresh_coupon_list_f"); |
| 89 | super.dispose(); | 94 | super.dispose(); |
| 90 | } | 95 | } |
| 91 | 96 | ||
| @@ -158,7 +163,109 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -158,7 +163,109 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 158 | callback: () { | 163 | callback: () { |
| 159 | // offset = 0; | 164 | // offset = 0; |
| 160 | // getMessage(showLoading: true); | 165 | // getMessage(showLoading: true); |
| 161 | - _couponNetworkData(); | 166 | + _couponNetworkData(tabController.index); |
| 167 | + }, | ||
| 168 | + emptyMsg: "暂时没有列表信息哦", | ||
| 169 | + emptyImg: "empty_search", | ||
| 170 | + showMsg: "加载中,请稍后...", | ||
| 171 | + ); | ||
| 172 | + } else { | ||
| 173 | + return EasyRefresh.custom( | ||
| 174 | + controller: _controller, | ||
| 175 | + shrinkWrap: true, | ||
| 176 | + slivers: [ | ||
| 177 | + SliverList( | ||
| 178 | + delegate: SliverChildBuilderDelegate( | ||
| 179 | + (BuildContext context, int index) { | ||
| 180 | + return CouponItemF( | ||
| 181 | + from: 'quan', | ||
| 182 | + couponSonModel: | ||
| 183 | + couponProvider.couponList[index], | ||
| 184 | + showBtn: true, | ||
| 185 | + onPressedSwich: () { | ||
| 186 | + couponProvider.couponList[index].isOpenBool = | ||
| 187 | + !couponProvider | ||
| 188 | + .couponList[index].isOpenBool; | ||
| 189 | + _setCustomerActivity(index); | ||
| 190 | + }, | ||
| 191 | + onPressed: () { | ||
| 192 | + NavigatorUtil.goCouponDetailPage(context, | ||
| 193 | + couponProvider.couponList[index]); | ||
| 194 | + }, | ||
| 195 | + ); | ||
| 196 | + }, childCount: couponProvider.couponList.length), | ||
| 197 | + ) | ||
| 198 | + ], | ||
| 199 | + // onRefresh: () async { | ||
| 200 | + // // offset = 0; | ||
| 201 | + // // getMessage(showLoading: false); | ||
| 202 | + // }, | ||
| 203 | + // onLoad: () async { | ||
| 204 | + // // offset++; | ||
| 205 | + // // getMessage(showLoading: false); | ||
| 206 | + // }, | ||
| 207 | + ); | ||
| 208 | + } | ||
| 209 | + }), | ||
| 210 | + Consumer<CouponProvider>(builder: (context, model, _) { | ||
| 211 | + if (model.pageState != PageState.Success) { | ||
| 212 | + return ExceptionPage( | ||
| 213 | + pageState: model.pageState, | ||
| 214 | + callback: () { | ||
| 215 | + // offset = 0; | ||
| 216 | + // getMessage(showLoading: true); | ||
| 217 | + _couponNetworkData(tabController.index); | ||
| 218 | + }, | ||
| 219 | + emptyMsg: "暂时没有列表信息哦", | ||
| 220 | + emptyImg: "empty_search", | ||
| 221 | + showMsg: "加载中,请稍后...", | ||
| 222 | + ); | ||
| 223 | + } else { | ||
| 224 | + return EasyRefresh.custom( | ||
| 225 | + controller: _controller, | ||
| 226 | + shrinkWrap: true, | ||
| 227 | + slivers: [ | ||
| 228 | + SliverList( | ||
| 229 | + delegate: SliverChildBuilderDelegate( | ||
| 230 | + (BuildContext context, int index) { | ||
| 231 | + return CouponItemF( | ||
| 232 | + from: 'quan', | ||
| 233 | + couponSonModel: | ||
| 234 | + couponProvider.couponList[index], | ||
| 235 | + showBtn: true, | ||
| 236 | + onPressedSwich: () { | ||
| 237 | + couponProvider.couponList[index].isOpenBool = | ||
| 238 | + !couponProvider | ||
| 239 | + .couponList[index].isOpenBool; | ||
| 240 | + _setCustomerActivity(index); | ||
| 241 | + }, | ||
| 242 | + onPressed: () { | ||
| 243 | + NavigatorUtil.goCouponDetailPage(context, | ||
| 244 | + couponProvider.couponList[index]); | ||
| 245 | + }, | ||
| 246 | + ); | ||
| 247 | + }, childCount: couponProvider.couponList.length), | ||
| 248 | + ) | ||
| 249 | + ], | ||
| 250 | + // onRefresh: () async { | ||
| 251 | + // // offset = 0; | ||
| 252 | + // // getMessage(showLoading: false); | ||
| 253 | + // }, | ||
| 254 | + // onLoad: () async { | ||
| 255 | + // // offset++; | ||
| 256 | + // // getMessage(showLoading: false); | ||
| 257 | + // }, | ||
| 258 | + ); | ||
| 259 | + } | ||
| 260 | + }), | ||
| 261 | + Consumer<CouponProvider>(builder: (context, model, _) { | ||
| 262 | + if (model.pageState != PageState.Success) { | ||
| 263 | + return ExceptionPage( | ||
| 264 | + pageState: model.pageState, | ||
| 265 | + callback: () { | ||
| 266 | + // offset = 0; | ||
| 267 | + // getMessage(showLoading: true); | ||
| 268 | + _couponNetworkData(tabController.index); | ||
| 162 | }, | 269 | }, |
| 163 | emptyMsg: "暂时没有列表信息哦", | 270 | emptyMsg: "暂时没有列表信息哦", |
| 164 | emptyImg: "empty_search", | 271 | emptyImg: "empty_search", |
| @@ -202,16 +309,6 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -202,16 +309,6 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 202 | ); | 309 | ); |
| 203 | } | 310 | } |
| 204 | }), | 311 | }), |
| 205 | - Container( | ||
| 206 | - width: 100, | ||
| 207 | - height: 100, | ||
| 208 | - color: Colors.blue, | ||
| 209 | - ), | ||
| 210 | - Container( | ||
| 211 | - width: 100, | ||
| 212 | - height: 100, | ||
| 213 | - color: Colors.purple, | ||
| 214 | - ) | ||
| 215 | // MessageOnlineCheckPage() | 312 | // MessageOnlineCheckPage() |
| 216 | ]), | 313 | ]), |
| 217 | ), | 314 | ), |
| @@ -243,20 +340,20 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -243,20 +340,20 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 243 | radius: ScreenUtil().setWidth(14), | 340 | radius: ScreenUtil().setWidth(14), |
| 244 | isBold: false, | 341 | isBold: false, |
| 245 | fontSize: 28, | 342 | fontSize: 28, |
| 246 | - onPressed: () async{ | 343 | + onPressed: () async { |
| 247 | UserModel userModel = | 344 | UserModel userModel = |
| 248 | Provider.of<UserModel>(context, listen: false); | 345 | Provider.of<UserModel>(context, listen: false); |
| 249 | if (userModel.user.role_name == '管理员' || | 346 | if (userModel.user.role_name == '管理员' || |
| 250 | userModel.user.role_name == '店长') { | 347 | userModel.user.role_name == '店长') { |
| 251 | NavigatorUtil.goCouponCreateSelectTypePage(context); | 348 | NavigatorUtil.goCouponCreateSelectTypePage(context); |
| 252 | - }else{ | ||
| 253 | - bool needRefresh = | 349 | + } else { |
| 350 | + bool needRefresh = | ||
| 254 | await NavigatorUtil.goCouponEditPage(context); | 351 | await NavigatorUtil.goCouponEditPage(context); |
| 255 | print(needRefresh); | 352 | print(needRefresh); |
| 256 | if (needRefresh != null && needRefresh) { | 353 | if (needRefresh != null && needRefresh) { |
| 257 | //刷新页面数据 | 354 | //刷新页面数据 |
| 258 | // _controller.callRefresh(); | 355 | // _controller.callRefresh(); |
| 259 | - _couponNetworkData(); | 356 | + _couponNetworkData(tabController.index); |
| 260 | } | 357 | } |
| 261 | } | 358 | } |
| 262 | }, | 359 | }, |
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 3 | +import 'package:one_key/models/personnel_manage_model.dart'; | ||
| 4 | +import 'package:one_key/provider/personnel_provider.dart'; | ||
| 5 | +import 'package:one_key/provider/user_model.dart'; | ||
| 6 | +import 'package:one_key/res/colors.dart'; | ||
| 7 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 8 | +import 'package:one_key/utils/utils.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/system_app_bar.dart'; | ||
| 12 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 13 | +import 'package:provider/provider.dart'; | ||
| 14 | + | ||
| 15 | +class CouponToPersonnalPage extends StatefulWidget { | ||
| 16 | + final String uids; | ||
| 17 | + final bool onlyShow; | ||
| 18 | + CouponToPersonnalPage({Key key, this.uids, this.onlyShow = false}) | ||
| 19 | + : super(key: key); | ||
| 20 | + | ||
| 21 | + @override | ||
| 22 | + _CouponToPersonnalPageState createState() => _CouponToPersonnalPageState(); | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +class _CouponToPersonnalPageState extends State<CouponToPersonnalPage> { | ||
| 26 | + PersonnelProvider personnelProvider; | ||
| 27 | + ScrollController _scrollController = ScrollController(); | ||
| 28 | + List<String> titleList = []; | ||
| 29 | + | ||
| 30 | + @override | ||
| 31 | + void initState() { | ||
| 32 | + // TODO: implement initState | ||
| 33 | + super.initState(); | ||
| 34 | + titleList = ['管理员', '店长', '客户经理', '收银员', '服务员']; | ||
| 35 | + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | ||
| 36 | + _getAuthUserLists(showLoading: false); | ||
| 37 | + }); | ||
| 38 | + | ||
| 39 | + EventBus().on('personnel_manage_page', (arg) { | ||
| 40 | + _getAuthUserLists(showLoading: false); | ||
| 41 | + }); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @override | ||
| 45 | + void dispose() { | ||
| 46 | + // TODO: implement dispose | ||
| 47 | + super.dispose(); | ||
| 48 | + EventBus().off('personnel_manage_page'); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | +//获取员工信息列表 | ||
| 52 | + _getAuthUserLists({bool showLoading = true}) async { | ||
| 53 | + Map<String, String> params = { | ||
| 54 | + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 55 | + }; | ||
| 56 | + | ||
| 57 | + await personnelProvider.getAuthUserLists(context, params, | ||
| 58 | + showLoading: showLoading); | ||
| 59 | + | ||
| 60 | + List uidsList = widget.uids.split(','); | ||
| 61 | + if (uidsList.length == 1 && uidsList[0] == '') { | ||
| 62 | + } else { | ||
| 63 | + for (String uid in uidsList) { | ||
| 64 | + for (PersonnelManageSunModel item | ||
| 65 | + in personnelProvider.dataMap.admin.listdata) { | ||
| 66 | + if (uid == item.id) { | ||
| 67 | + item.select = true; | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + for (PersonnelManageSunModel item | ||
| 71 | + in personnelProvider.dataMap.shopowner.listdata) { | ||
| 72 | + if (uid == item.id) { | ||
| 73 | + item.select = true; | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + for (PersonnelManageSunModel item | ||
| 77 | + in personnelProvider.dataMap.manager.listdata) { | ||
| 78 | + if (uid == item.id) { | ||
| 79 | + item.select = true; | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + for (PersonnelManageSunModel item | ||
| 83 | + in personnelProvider.dataMap.cashier.listdata) { | ||
| 84 | + if (uid == item.id) { | ||
| 85 | + item.select = true; | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + for (PersonnelManageSunModel item | ||
| 89 | + in personnelProvider.dataMap.waiter.listdata) { | ||
| 90 | + if (uid == item.id) { | ||
| 91 | + item.select = true; | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + personnelProvider.dataMap.admin.select = | ||
| 96 | + !personnelProvider.dataMap.admin.listdata.any((value) { | ||
| 97 | + return value.select == false; | ||
| 98 | + }); | ||
| 99 | + personnelProvider.dataMap.shopowner.select = | ||
| 100 | + !personnelProvider.dataMap.shopowner.listdata.any((value) { | ||
| 101 | + return value.select == false; | ||
| 102 | + }); | ||
| 103 | + personnelProvider.dataMap.manager.select = | ||
| 104 | + !personnelProvider.dataMap.manager.listdata.any((value) { | ||
| 105 | + return value.select == false; | ||
| 106 | + }); | ||
| 107 | + personnelProvider.dataMap.cashier.select = | ||
| 108 | + !personnelProvider.dataMap.cashier.listdata.any((value) { | ||
| 109 | + return value.select == false; | ||
| 110 | + }); | ||
| 111 | + personnelProvider.dataMap.waiter.select = | ||
| 112 | + !personnelProvider.dataMap.waiter.listdata.any((value) { | ||
| 113 | + return value.select == false; | ||
| 114 | + }); | ||
| 115 | + _btnAllSelect(); | ||
| 116 | + personnelProvider.notifyListeners(); | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + ///全体员工选择按钮 | ||
| 121 | + _btnAllSelect() { | ||
| 122 | + if (personnelProvider.dataMap.waiter.select && | ||
| 123 | + personnelProvider.dataMap.cashier.select && | ||
| 124 | + personnelProvider.dataMap.manager.select && | ||
| 125 | + personnelProvider.dataMap.admin.select && | ||
| 126 | + personnelProvider.dataMap.shopowner.select) { | ||
| 127 | + personnelProvider.dataMap.select = true; | ||
| 128 | + } else { | ||
| 129 | + personnelProvider.dataMap.select = false; | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + @override | ||
| 134 | + Widget build(BuildContext context) { | ||
| 135 | + personnelProvider = Provider.of<PersonnelProvider>(context, listen: true); | ||
| 136 | + return Scaffold( | ||
| 137 | + backgroundColor: MyColours.color_ffffff, | ||
| 138 | + appBar: SystemAppBar( | ||
| 139 | + '可发放员工', | ||
| 140 | + onTap: () { | ||
| 141 | + Navigator.of(context).pop(); | ||
| 142 | + }, | ||
| 143 | + ), | ||
| 144 | + body: Column(children: [ | ||
| 145 | + Align( | ||
| 146 | + alignment: Alignment.centerRight, | ||
| 147 | + child: InkWell( | ||
| 148 | + onTap: () { | ||
| 149 | + if (widget.onlyShow) { | ||
| 150 | + return; | ||
| 151 | + } | ||
| 152 | + personnelProvider.dataMap.select = | ||
| 153 | + !personnelProvider.dataMap.select; | ||
| 154 | + if (personnelProvider.dataMap.select) { | ||
| 155 | + personnelProvider.dataMap.waiter.select = true; | ||
| 156 | + personnelProvider.dataMap.cashier.select = true; | ||
| 157 | + personnelProvider.dataMap.manager.select = true; | ||
| 158 | + personnelProvider.dataMap.admin.select = true; | ||
| 159 | + personnelProvider.dataMap.shopowner.select = true; | ||
| 160 | + for (PersonnelManageSunModel item | ||
| 161 | + in personnelProvider.dataMap.waiter.listdata) { | ||
| 162 | + item.select = true; | ||
| 163 | + } | ||
| 164 | + for (PersonnelManageSunModel item | ||
| 165 | + in personnelProvider.dataMap.cashier.listdata) { | ||
| 166 | + item.select = true; | ||
| 167 | + } | ||
| 168 | + for (PersonnelManageSunModel item | ||
| 169 | + in personnelProvider.dataMap.manager.listdata) { | ||
| 170 | + item.select = true; | ||
| 171 | + } | ||
| 172 | + for (PersonnelManageSunModel item | ||
| 173 | + in personnelProvider.dataMap.admin.listdata) { | ||
| 174 | + item.select = true; | ||
| 175 | + } | ||
| 176 | + for (PersonnelManageSunModel item | ||
| 177 | + in personnelProvider.dataMap.shopowner.listdata) { | ||
| 178 | + item.select = true; | ||
| 179 | + } | ||
| 180 | + } else { | ||
| 181 | + personnelProvider.dataMap.waiter.select = false; | ||
| 182 | + personnelProvider.dataMap.cashier.select = false; | ||
| 183 | + personnelProvider.dataMap.manager.select = false; | ||
| 184 | + personnelProvider.dataMap.admin.select = false; | ||
| 185 | + personnelProvider.dataMap.shopowner.select = false; | ||
| 186 | + for (PersonnelManageSunModel item | ||
| 187 | + in personnelProvider.dataMap.waiter.listdata) { | ||
| 188 | + item.select = false; | ||
| 189 | + } | ||
| 190 | + for (PersonnelManageSunModel item | ||
| 191 | + in personnelProvider.dataMap.cashier.listdata) { | ||
| 192 | + item.select = false; | ||
| 193 | + } | ||
| 194 | + for (PersonnelManageSunModel item | ||
| 195 | + in personnelProvider.dataMap.manager.listdata) { | ||
| 196 | + item.select = false; | ||
| 197 | + } | ||
| 198 | + for (PersonnelManageSunModel item | ||
| 199 | + in personnelProvider.dataMap.admin.listdata) { | ||
| 200 | + item.select = false; | ||
| 201 | + } | ||
| 202 | + for (PersonnelManageSunModel item | ||
| 203 | + in personnelProvider.dataMap.shopowner.listdata) { | ||
| 204 | + item.select = false; | ||
| 205 | + } | ||
| 206 | + } | ||
| 207 | + setState(() {}); | ||
| 208 | + }, | ||
| 209 | + child: Padding( | ||
| 210 | + padding: EdgeInsets.symmetric( | ||
| 211 | + vertical: ScreenUtil().setWidth(32), | ||
| 212 | + horizontal: ScreenUtil().setWidth(36)), | ||
| 213 | + child: Row( | ||
| 214 | + mainAxisAlignment: MainAxisAlignment.end, | ||
| 215 | + children: [ | ||
| 216 | + Image.asset( | ||
| 217 | + Utils.getImgPath( | ||
| 218 | + personnelProvider.dataMap != null && | ||
| 219 | + personnelProvider.dataMap?.select | ||
| 220 | + ? widget.onlyShow | ||
| 221 | + ? 'show_select_f' | ||
| 222 | + : 'select_f' | ||
| 223 | + : 'unselect'), | ||
| 224 | + width: ScreenUtil().setWidth(40), | ||
| 225 | + ), | ||
| 226 | + HEmptyView(20), | ||
| 227 | + Text( | ||
| 228 | + '全体员工', | ||
| 229 | + style: TextStyle( | ||
| 230 | + fontSize: ScreenUtil().setWidth(32), | ||
| 231 | + color: widget.onlyShow | ||
| 232 | + ? MyColours.color_999999 | ||
| 233 | + : MyColours.color_000000), | ||
| 234 | + ), | ||
| 235 | + ], | ||
| 236 | + )))), | ||
| 237 | + Expanded( | ||
| 238 | + child: Container( | ||
| 239 | + child: ListView.builder( | ||
| 240 | + itemCount: titleList.length, | ||
| 241 | + shrinkWrap: true, | ||
| 242 | + controller: _scrollController, | ||
| 243 | + itemBuilder: (BuildContext context, int index) { | ||
| 244 | + String title = titleList[index]; | ||
| 245 | + List<PersonnelManageSunModel> data = []; | ||
| 246 | + bool select = false; | ||
| 247 | + | ||
| 248 | + if (personnelProvider.dataMap != null) { | ||
| 249 | + if (title == '管理员') { | ||
| 250 | + data = personnelProvider.dataMap.admin.listdata; | ||
| 251 | + select = personnelProvider.dataMap.admin.select; | ||
| 252 | + } else if (title == '店长') { | ||
| 253 | + data = personnelProvider.dataMap.shopowner.listdata; | ||
| 254 | + select = personnelProvider.dataMap.shopowner.select; | ||
| 255 | + } else if (title == '客户经理') { | ||
| 256 | + data = personnelProvider.dataMap.manager.listdata; | ||
| 257 | + select = personnelProvider.dataMap.manager.select; | ||
| 258 | + } else if (title == '收银员') { | ||
| 259 | + data = personnelProvider.dataMap.cashier.listdata; | ||
| 260 | + select = personnelProvider.dataMap.cashier.select; | ||
| 261 | + } else if (title == '服务员') { | ||
| 262 | + data = personnelProvider.dataMap.waiter.listdata; | ||
| 263 | + select = personnelProvider.dataMap.waiter.select; | ||
| 264 | + } | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + return Column( | ||
| 268 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 269 | + children: [ | ||
| 270 | + InkWell( | ||
| 271 | + onTap: () { | ||
| 272 | + if (widget.onlyShow) { | ||
| 273 | + return; | ||
| 274 | + } | ||
| 275 | + if (personnelProvider.dataMap != null) { | ||
| 276 | + if (title == '管理员') { | ||
| 277 | + personnelProvider.dataMap.admin.select = | ||
| 278 | + !personnelProvider | ||
| 279 | + .dataMap.admin.select; | ||
| 280 | + select = personnelProvider | ||
| 281 | + .dataMap.admin.select; | ||
| 282 | + } else if (title == '店长') { | ||
| 283 | + personnelProvider | ||
| 284 | + .dataMap.shopowner.select = | ||
| 285 | + !personnelProvider | ||
| 286 | + .dataMap.shopowner.select; | ||
| 287 | + select = personnelProvider | ||
| 288 | + .dataMap.shopowner.select; | ||
| 289 | + } else if (title == '客户经理') { | ||
| 290 | + personnelProvider.dataMap.manager.select = | ||
| 291 | + !personnelProvider | ||
| 292 | + .dataMap.manager.select; | ||
| 293 | + select = personnelProvider | ||
| 294 | + .dataMap.manager.select; | ||
| 295 | + } else if (title == '收银员') { | ||
| 296 | + personnelProvider.dataMap.cashier.select = | ||
| 297 | + !personnelProvider | ||
| 298 | + .dataMap.cashier.select; | ||
| 299 | + select = personnelProvider | ||
| 300 | + .dataMap.cashier.select; | ||
| 301 | + } else if (title == '服务员') { | ||
| 302 | + personnelProvider.dataMap.waiter.select = | ||
| 303 | + !personnelProvider | ||
| 304 | + .dataMap.waiter.select; | ||
| 305 | + select = personnelProvider | ||
| 306 | + .dataMap.waiter.select; | ||
| 307 | + } | ||
| 308 | + if (select) { | ||
| 309 | + for (PersonnelManageSunModel item | ||
| 310 | + in data) { | ||
| 311 | + item.select = true; | ||
| 312 | + } | ||
| 313 | + } else { | ||
| 314 | + for (PersonnelManageSunModel item | ||
| 315 | + in data) { | ||
| 316 | + item.select = false; | ||
| 317 | + } | ||
| 318 | + } | ||
| 319 | + _btnAllSelect(); | ||
| 320 | + setState(() {}); | ||
| 321 | + } | ||
| 322 | + }, | ||
| 323 | + child: Container( | ||
| 324 | + color: MyColours.color_f3f3f3, | ||
| 325 | + height: ScreenUtil().setWidth(60), | ||
| 326 | + padding: EdgeInsets.symmetric( | ||
| 327 | + horizontal: ScreenUtil().setWidth(36), | ||
| 328 | + ), | ||
| 329 | + child: Row( | ||
| 330 | + mainAxisAlignment: | ||
| 331 | + MainAxisAlignment.spaceBetween, | ||
| 332 | + children: [ | ||
| 333 | + Text('${title}', | ||
| 334 | + style: TextStyle( | ||
| 335 | + fontWeight: FontWeight.bold, | ||
| 336 | + fontSize: | ||
| 337 | + ScreenUtil().setSp(36), | ||
| 338 | + color: | ||
| 339 | + MyColours.color_515151)), | ||
| 340 | + data.length == 0 | ||
| 341 | + ? SizedBox() | ||
| 342 | + : Row( | ||
| 343 | + children: [ | ||
| 344 | + Image.asset( | ||
| 345 | + Utils.getImgPath(select | ||
| 346 | + ? widget.onlyShow | ||
| 347 | + ? 'show_select_f' | ||
| 348 | + : 'select_f' | ||
| 349 | + : 'unselect'), | ||
| 350 | + width: ScreenUtil() | ||
| 351 | + .setWidth(30), | ||
| 352 | + ), | ||
| 353 | + HEmptyView(10), | ||
| 354 | + Text( | ||
| 355 | + '全选', | ||
| 356 | + style: TextStyle( | ||
| 357 | + fontSize: ScreenUtil() | ||
| 358 | + .setWidth(28), | ||
| 359 | + color: MyColours | ||
| 360 | + .color_515151), | ||
| 361 | + ), | ||
| 362 | + ], | ||
| 363 | + ) | ||
| 364 | + ]))), | ||
| 365 | + // MyDivider( | ||
| 366 | + // double.infinity, | ||
| 367 | + // ScreenUtil().setWidth(2), | ||
| 368 | + // color: MyColours.color_f3f3f3, | ||
| 369 | + // ), | ||
| 370 | + ListView.builder( | ||
| 371 | + padding: EdgeInsets.only( | ||
| 372 | + top: ScreenUtil().setWidth(0), | ||
| 373 | + left: ScreenUtil().setWidth(36), | ||
| 374 | + right: ScreenUtil().setWidth(36), | ||
| 375 | + bottom: ScreenUtil().setWidth(28 * 2), | ||
| 376 | + ), | ||
| 377 | + physics: NeverScrollableScrollPhysics(), | ||
| 378 | + itemCount: data.length, | ||
| 379 | + shrinkWrap: true, | ||
| 380 | + controller: _scrollController, | ||
| 381 | + itemBuilder: (BuildContext context, int index) { | ||
| 382 | + PersonnelManageSunModel model = data[index]; | ||
| 383 | + | ||
| 384 | + return InkWell( | ||
| 385 | + onTap: () { | ||
| 386 | + if (widget.onlyShow) { | ||
| 387 | + return; | ||
| 388 | + } | ||
| 389 | + model.select = !model.select; | ||
| 390 | + | ||
| 391 | + bool temp = data.any((value) { | ||
| 392 | + return value.select == false; | ||
| 393 | + }); | ||
| 394 | + if (temp == true) { | ||
| 395 | + personnelProvider.dataMap.select = | ||
| 396 | + false; | ||
| 397 | + if (personnelProvider.dataMap != null) { | ||
| 398 | + if (title == '管理员') { | ||
| 399 | + personnelProvider | ||
| 400 | + .dataMap.admin.select = false; | ||
| 401 | + select = personnelProvider | ||
| 402 | + .dataMap.admin.select; | ||
| 403 | + } else if (title == '店长') { | ||
| 404 | + personnelProvider.dataMap.shopowner | ||
| 405 | + .select = false; | ||
| 406 | + select = personnelProvider | ||
| 407 | + .dataMap.shopowner.select; | ||
| 408 | + } else if (title == '客户经理') { | ||
| 409 | + personnelProvider | ||
| 410 | + .dataMap.manager.select = false; | ||
| 411 | + select = personnelProvider | ||
| 412 | + .dataMap.manager.select; | ||
| 413 | + } else if (title == '收银员') { | ||
| 414 | + personnelProvider | ||
| 415 | + .dataMap.cashier.select = false; | ||
| 416 | + select = personnelProvider | ||
| 417 | + .dataMap.cashier.select; | ||
| 418 | + } else if (title == '服务员') { | ||
| 419 | + personnelProvider | ||
| 420 | + .dataMap.waiter.select = false; | ||
| 421 | + select = personnelProvider | ||
| 422 | + .dataMap.waiter.select; | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + } else { | ||
| 426 | + if (personnelProvider.dataMap != null) { | ||
| 427 | + if (title == '管理员') { | ||
| 428 | + personnelProvider | ||
| 429 | + .dataMap.admin.select = true; | ||
| 430 | + select = personnelProvider | ||
| 431 | + .dataMap.admin.select; | ||
| 432 | + } else if (title == '店长') { | ||
| 433 | + personnelProvider.dataMap.shopowner | ||
| 434 | + .select = true; | ||
| 435 | + select = personnelProvider | ||
| 436 | + .dataMap.shopowner.select; | ||
| 437 | + } else if (title == '客户经理') { | ||
| 438 | + personnelProvider | ||
| 439 | + .dataMap.manager.select = true; | ||
| 440 | + select = personnelProvider | ||
| 441 | + .dataMap.manager.select; | ||
| 442 | + } else if (title == '收银员') { | ||
| 443 | + personnelProvider | ||
| 444 | + .dataMap.cashier.select = true; | ||
| 445 | + select = personnelProvider | ||
| 446 | + .dataMap.cashier.select; | ||
| 447 | + } else if (title == '服务员') { | ||
| 448 | + personnelProvider | ||
| 449 | + .dataMap.waiter.select = true; | ||
| 450 | + select = personnelProvider | ||
| 451 | + .dataMap.waiter.select; | ||
| 452 | + } | ||
| 453 | + _btnAllSelect(); | ||
| 454 | + } | ||
| 455 | + } | ||
| 456 | + setState(() {}); | ||
| 457 | + }, | ||
| 458 | + child: Column(children: [ | ||
| 459 | + Padding( | ||
| 460 | + padding: EdgeInsets.symmetric( | ||
| 461 | + vertical: ScreenUtil().setWidth(32), | ||
| 462 | + ), | ||
| 463 | + child: Row( | ||
| 464 | + children: [ | ||
| 465 | + Image.asset( | ||
| 466 | + Utils.getImgPath(model.select | ||
| 467 | + ? widget.onlyShow | ||
| 468 | + ? 'show_select_f' | ||
| 469 | + : 'select_f' | ||
| 470 | + : 'unselect'), | ||
| 471 | + width: | ||
| 472 | + ScreenUtil().setWidth(40), | ||
| 473 | + ), | ||
| 474 | + HEmptyView(20), | ||
| 475 | + Text( | ||
| 476 | + model.nickName != null && | ||
| 477 | + model.nickName != 'null' | ||
| 478 | + ? model.nickName | ||
| 479 | + : model.account, | ||
| 480 | + style: TextStyle( | ||
| 481 | + fontSize: ScreenUtil() | ||
| 482 | + .setWidth(32), | ||
| 483 | + color: Color.fromRGBO( | ||
| 484 | + 0, 0, 0, 0.9)), | ||
| 485 | + ), | ||
| 486 | + ], | ||
| 487 | + )), | ||
| 488 | + Padding( | ||
| 489 | + padding: EdgeInsets.only( | ||
| 490 | + left: | ||
| 491 | + ScreenUtil().setWidth(30 * 2)), | ||
| 492 | + child: Container( | ||
| 493 | + width: double.infinity, | ||
| 494 | + height: ScreenUtil().setWidth(2), | ||
| 495 | + color: MyColours.color_E7E7E7, | ||
| 496 | + ), | ||
| 497 | + ) | ||
| 498 | + ]), | ||
| 499 | + ); | ||
| 500 | + }), | ||
| 501 | + ], | ||
| 502 | + ); | ||
| 503 | + }))), | ||
| 504 | + widget.onlyShow | ||
| 505 | + ? SizedBox() | ||
| 506 | + : RoundButton( | ||
| 507 | + text: '保存', | ||
| 508 | + width: ScreenUtil().setWidth(130 * 2), | ||
| 509 | + height: ScreenUtil().setWidth(37 * 2), | ||
| 510 | + radius: ScreenUtil().setWidth(22), | ||
| 511 | + isBold: true, | ||
| 512 | + fontSize: 24, | ||
| 513 | + onPressed: () async { | ||
| 514 | + String uids = ''; | ||
| 515 | + for (PersonnelManageSunModel item | ||
| 516 | + in personnelProvider.dataMap.admin.listdata) { | ||
| 517 | + if (item.select) { | ||
| 518 | + uids += item.id + ','; | ||
| 519 | + } | ||
| 520 | + } | ||
| 521 | + for (PersonnelManageSunModel item | ||
| 522 | + in personnelProvider.dataMap.shopowner.listdata) { | ||
| 523 | + if (item.select) { | ||
| 524 | + uids += item.id + ','; | ||
| 525 | + } | ||
| 526 | + } | ||
| 527 | + for (PersonnelManageSunModel item | ||
| 528 | + in personnelProvider.dataMap.manager.listdata) { | ||
| 529 | + if (item.select) { | ||
| 530 | + uids += item.id + ','; | ||
| 531 | + } | ||
| 532 | + } | ||
| 533 | + for (PersonnelManageSunModel item | ||
| 534 | + in personnelProvider.dataMap.cashier.listdata) { | ||
| 535 | + if (item.select) { | ||
| 536 | + uids += item.id + ','; | ||
| 537 | + } | ||
| 538 | + } | ||
| 539 | + for (PersonnelManageSunModel item | ||
| 540 | + in personnelProvider.dataMap.waiter.listdata) { | ||
| 541 | + if (item.select) { | ||
| 542 | + uids += item.id + ','; | ||
| 543 | + } | ||
| 544 | + } | ||
| 545 | + if (uids.endsWith(',')) { | ||
| 546 | + uids = uids.substring(0, uids.length - 1); | ||
| 547 | + } | ||
| 548 | + | ||
| 549 | + Map temp = {'object': uids}; | ||
| 550 | + Navigator.of(context).pop(temp); | ||
| 551 | + }), | ||
| 552 | + VEmptyView(30) | ||
| 553 | + ])); | ||
| 554 | + } | ||
| 555 | +} |
| @@ -114,7 +114,9 @@ class PersonnelProvider extends ChangeNotifier { | @@ -114,7 +114,9 @@ class PersonnelProvider extends ChangeNotifier { | ||
| 114 | } else { | 114 | } else { |
| 115 | Utils.showToast(baseResp.msg ?? ""); | 115 | Utils.showToast(baseResp.msg ?? ""); |
| 116 | } | 116 | } |
| 117 | + | ||
| 117 | notifyListeners(); | 118 | notifyListeners(); |
| 119 | + return dataMap; | ||
| 118 | } | 120 | } |
| 119 | 121 | ||
| 120 | /// 添加店员 | 122 | /// 添加店员 |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | 2 | ||
| 3 | class MyColours { | 3 | class MyColours { |
| 4 | - | ||
| 5 | - | 4 | + static const Color color_ED7B2F = Color(0xffED7B2F); |
| 6 | static const Color color_DBDBDB = Color(0xffDBDBDB); | 5 | static const Color color_DBDBDB = Color(0xffDBDBDB); |
| 7 | static const Color color_F8F9FD = Color(0xffF8F9FD); | 6 | static const Color color_F8F9FD = Color(0xffF8F9FD); |
| 8 | static const Color color_5F7292 = Color(0xff5F7292); | 7 | static const Color color_5F7292 = Color(0xff5F7292); |
| @@ -829,7 +829,7 @@ class NavigatorUtil { | @@ -829,7 +829,7 @@ class NavigatorUtil { | ||
| 829 | BuildContext context, { | 829 | BuildContext context, { |
| 830 | replace = false, | 830 | replace = false, |
| 831 | }) { | 831 | }) { |
| 832 | - return _navigateTo(context, "${Routes.my_area_manage_page}?", | 832 | + return _navigateTo(context, "${Routes.my_area_manage_page}", |
| 833 | replace: replace); | 833 | replace: replace); |
| 834 | } | 834 | } |
| 835 | 835 | ||
| @@ -838,7 +838,16 @@ class NavigatorUtil { | @@ -838,7 +838,16 @@ class NavigatorUtil { | ||
| 838 | BuildContext context, { | 838 | BuildContext context, { |
| 839 | replace = false, | 839 | replace = false, |
| 840 | }) { | 840 | }) { |
| 841 | - return _navigateTo(context, "${Routes.coupon_create_select_type_page}?", | 841 | + return _navigateTo(context, "${Routes.coupon_create_select_type_page}", |
| 842 | + replace: replace); | ||
| 843 | + } | ||
| 844 | + | ||
| 845 | + ///优惠券----可发放员工 | ||
| 846 | + static Future<dynamic> goCouponToPersonnalPage( | ||
| 847 | + BuildContext context, String uids, | ||
| 848 | + {replace = false, bool onlyShow = false}) { | ||
| 849 | + return _navigateTo(context, | ||
| 850 | + "${Routes.coupon_to_personnel_page}?uids=$uids&onlyShow=$onlyShow", | ||
| 842 | replace: replace); | 851 | replace: replace); |
| 843 | } | 852 | } |
| 844 | } | 853 | } |
| @@ -24,6 +24,7 @@ import 'package:one_key/pages/coupon/coupon_edit_page.dart'; | @@ -24,6 +24,7 @@ import 'package:one_key/pages/coupon/coupon_edit_page.dart'; | ||
| 24 | import 'package:one_key/pages/coupon/coupon_history_page.dart'; | 24 | import 'package:one_key/pages/coupon/coupon_history_page.dart'; |
| 25 | import 'package:one_key/pages/coupon/coupon_page.dart'; | 25 | import 'package:one_key/pages/coupon/coupon_page.dart'; |
| 26 | import 'package:one_key/pages/coupon/coupon_selecet_page.dart'; | 26 | import 'package:one_key/pages/coupon/coupon_selecet_page.dart'; |
| 27 | +import 'package:one_key/pages/coupon/coupon_to_personal_page.dart'; | ||
| 27 | import 'package:one_key/pages/create_store/complete_create_store.dart'; | 28 | import 'package:one_key/pages/create_store/complete_create_store.dart'; |
| 28 | import 'package:one_key/pages/create_store/create_store.dart'; | 29 | import 'package:one_key/pages/create_store/create_store.dart'; |
| 29 | import 'package:one_key/pages/create_store/enter_store_address.dart'; | 30 | import 'package:one_key/pages/create_store/enter_store_address.dart'; |
| @@ -1295,3 +1296,14 @@ var couponCreateSelectTypePageHandle = new Handler( | @@ -1295,3 +1296,14 @@ var couponCreateSelectTypePageHandle = new Handler( | ||
| 1295 | // params["userHistoryEntity"].first))); | 1296 | // params["userHistoryEntity"].first))); |
| 1296 | return CouponCreateSelectTypePage(); | 1297 | return CouponCreateSelectTypePage(); |
| 1297 | }); | 1298 | }); |
| 1299 | + | ||
| 1300 | +///优惠券----可发放员工 | ||
| 1301 | +var couponToPersonnelPageHandle = new Handler( | ||
| 1302 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 1303 | + String uids = params["uids"].first; | ||
| 1304 | + | ||
| 1305 | + bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); | ||
| 1306 | + return ChangeNotifierProvider<PersonnelProvider>( | ||
| 1307 | + create: (_) => PersonnelProvider(), | ||
| 1308 | + child: CouponToPersonnalPage(uids: uids, onlyShow: onlyShow)); | ||
| 1309 | +}); |
| @@ -113,6 +113,8 @@ class Routes { | @@ -113,6 +113,8 @@ class Routes { | ||
| 113 | "/base_info_personnal_page"; //员工管理---个人资料 | 113 | "/base_info_personnal_page"; //员工管理---个人资料 |
| 114 | static String coupon_create_select_type_page = | 114 | static String coupon_create_select_type_page = |
| 115 | "/coupon_create_select_type_page"; //选择优惠券类型 | 115 | "/coupon_create_select_type_page"; //选择优惠券类型 |
| 116 | + static String coupon_to_personnel_page = | ||
| 117 | + "/coupon_to_personnel_page"; //优惠券----可发放员工 | ||
| 116 | 118 | ||
| 117 | static void configureRoutes(FluroRouter router) { | 119 | static void configureRoutes(FluroRouter router) { |
| 118 | router.notFoundHandler = new Handler( | 120 | router.notFoundHandler = new Handler( |
| @@ -229,5 +231,7 @@ class Routes { | @@ -229,5 +231,7 @@ class Routes { | ||
| 229 | handler: baseInfoPersonnalPageHandle); | 231 | handler: baseInfoPersonnalPageHandle); |
| 230 | router.define(coupon_create_select_type_page, | 232 | router.define(coupon_create_select_type_page, |
| 231 | handler: couponCreateSelectTypePageHandle); | 233 | handler: couponCreateSelectTypePageHandle); |
| 234 | + router.define(coupon_to_personnel_page, | ||
| 235 | + handler: couponToPersonnelPageHandle); | ||
| 232 | } | 236 | } |
| 233 | } | 237 | } |
-
Please register or login to post a comment