Showing
14 changed files
with
2620 additions
and
326 deletions
| @@ -32,10 +32,13 @@ class GetSellerUserBySelleridSunModel extends Object { | @@ -32,10 +32,13 @@ class GetSellerUserBySelleridSunModel extends Object { | ||
| 32 | 32 | ||
| 33 | @JsonKey(name: 'id') | 33 | @JsonKey(name: 'id') |
| 34 | String id; | 34 | String id; |
| 35 | + @JsonKey(name: 'role_name') | ||
| 36 | + String roleName; | ||
| 35 | 37 | ||
| 36 | GetSellerUserBySelleridSunModel( | 38 | GetSellerUserBySelleridSunModel( |
| 37 | this.nickName, | 39 | this.nickName, |
| 38 | this.id, | 40 | this.id, |
| 41 | + this.roleName | ||
| 39 | ); | 42 | ); |
| 40 | 43 | ||
| 41 | factory GetSellerUserBySelleridSunModel.fromJson( | 44 | factory GetSellerUserBySelleridSunModel.fromJson( |
| @@ -33,6 +33,7 @@ GetSellerUserBySelleridSunModel _$GetSellerUserBySelleridSunModelFromJson( | @@ -33,6 +33,7 @@ GetSellerUserBySelleridSunModel _$GetSellerUserBySelleridSunModelFromJson( | ||
| 33 | return GetSellerUserBySelleridSunModel( | 33 | return GetSellerUserBySelleridSunModel( |
| 34 | json['nick_name'] as String, | 34 | json['nick_name'] as String, |
| 35 | json['id'] as String, | 35 | json['id'] as String, |
| 36 | + json['role_name'] as String, | ||
| 36 | ); | 37 | ); |
| 37 | } | 38 | } |
| 38 | 39 | ||
| @@ -41,4 +42,5 @@ Map<String, dynamic> _$GetSellerUserBySelleridSunModelToJson( | @@ -41,4 +42,5 @@ Map<String, dynamic> _$GetSellerUserBySelleridSunModelToJson( | ||
| 41 | <String, dynamic>{ | 42 | <String, dynamic>{ |
| 42 | 'nick_name': instance.nickName, | 43 | 'nick_name': instance.nickName, |
| 43 | 'id': instance.id, | 44 | 'id': instance.id, |
| 45 | + 'role_name': instance.roleName | ||
| 44 | }; | 46 | }; |
| @@ -63,6 +63,7 @@ class Admin extends Object { | @@ -63,6 +63,7 @@ class Admin extends Object { | ||
| 63 | 63 | ||
| 64 | @JsonKey(name: 'role_id') | 64 | @JsonKey(name: 'role_id') |
| 65 | String roleId; | 65 | String roleId; |
| 66 | + int hasWechatNum; //已绑定微信数量 | ||
| 66 | 67 | ||
| 67 | Admin( | 68 | Admin( |
| 68 | this.listdata, | 69 | this.listdata, |
| @@ -109,6 +110,7 @@ class PersonnelManageSunModel extends Object { | @@ -109,6 +110,7 @@ class PersonnelManageSunModel extends Object { | ||
| 109 | 110 | ||
| 110 | @JsonKey(name: 'headimgurl') | 111 | @JsonKey(name: 'headimgurl') |
| 111 | String headimgurl; | 112 | String headimgurl; |
| 113 | + | ||
| 112 | 114 | ||
| 113 | PersonnelManageSunModel( | 115 | PersonnelManageSunModel( |
| 114 | this.id, | 116 | this.id, |
| @@ -137,6 +139,7 @@ class Shopowner extends Object { | @@ -137,6 +139,7 @@ class Shopowner extends Object { | ||
| 137 | 139 | ||
| 138 | @JsonKey(name: 'role_id') | 140 | @JsonKey(name: 'role_id') |
| 139 | String roleId; | 141 | String roleId; |
| 142 | + int hasWechatNum; //已绑定微信数量 | ||
| 140 | 143 | ||
| 141 | Shopowner( | 144 | Shopowner( |
| 142 | this.listdata, | 145 | this.listdata, |
| @@ -156,6 +159,7 @@ class Cashier extends Object { | @@ -156,6 +159,7 @@ class Cashier extends Object { | ||
| 156 | 159 | ||
| 157 | @JsonKey(name: 'role_id') | 160 | @JsonKey(name: 'role_id') |
| 158 | String roleId; | 161 | String roleId; |
| 162 | + int hasWechatNum; //已绑定微信数量 | ||
| 159 | 163 | ||
| 160 | Cashier( | 164 | Cashier( |
| 161 | this.listdata, | 165 | this.listdata, |
| @@ -175,6 +179,7 @@ class Waiter extends Object { | @@ -175,6 +179,7 @@ class Waiter extends Object { | ||
| 175 | 179 | ||
| 176 | @JsonKey(name: 'role_id') | 180 | @JsonKey(name: 'role_id') |
| 177 | String roleId; | 181 | String roleId; |
| 182 | + int hasWechatNum; //已绑定微信数量 | ||
| 178 | 183 | ||
| 179 | Waiter( | 184 | Waiter( |
| 180 | this.listdata, | 185 | this.listdata, |
| @@ -195,6 +200,8 @@ class Manager extends Object { | @@ -195,6 +200,8 @@ class Manager extends Object { | ||
| 195 | @JsonKey(name: 'role_id') | 200 | @JsonKey(name: 'role_id') |
| 196 | String roleId; | 201 | String roleId; |
| 197 | 202 | ||
| 203 | + int hasWechatNum; //已绑定微信数量 | ||
| 204 | + | ||
| 198 | Manager( | 205 | Manager( |
| 199 | this.listdata, | 206 | this.listdata, |
| 200 | this.roleId, | 207 | this.roleId, |
| 1 | +import 'dart:io'; | ||
| 2 | +import 'dart:ui'; | ||
| 3 | + | ||
| 4 | +import 'package:cached_network_image/cached_network_image.dart'; | ||
| 5 | +import 'package:flutter/material.dart'; | ||
| 6 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 7 | +import 'package:one_key/constant/state.dart'; | ||
| 8 | +import 'package:one_key/models/check_seller_acc_model.dart'; | ||
| 9 | +import 'package:one_key/models/personnel_manage_model.dart'; | ||
| 10 | +import 'package:one_key/models/upload_img_model.dart'; | ||
| 11 | +import 'package:one_key/models/user.dart'; | ||
| 12 | +import 'package:one_key/pages/online_check/photo_view_wiget.dart'; | ||
| 13 | +import 'package:one_key/pages/online_check/progress.dart'; | ||
| 14 | +import 'package:one_key/provider/base_info_provider.dart'; | ||
| 15 | +import 'package:one_key/provider/personnel_provider.dart'; | ||
| 16 | +import 'package:one_key/provider/upload_img_provider.dart'; | ||
| 17 | +import 'package:one_key/provider/user_model.dart'; | ||
| 18 | +import 'package:one_key/res/colors.dart'; | ||
| 19 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 20 | +import 'package:one_key/utils/upload_image_util.dart'; | ||
| 21 | +import 'package:one_key/utils/utils.dart'; | ||
| 22 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 23 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 24 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 25 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 26 | +import 'package:image_picker/image_picker.dart'; | ||
| 27 | +import 'package:permission_handler/permission_handler.dart'; | ||
| 28 | +import 'package:provider/provider.dart'; | ||
| 29 | + | ||
| 30 | +import '../../../app.dart'; | ||
| 31 | + | ||
| 32 | +class BaseInfoPersonnalPage extends StatefulWidget { | ||
| 33 | + final PersonnelManageSunModel sunModel; | ||
| 34 | + final String position; | ||
| 35 | + BaseInfoPersonnalPage({Key key, this.sunModel, this.position}) | ||
| 36 | + : super(key: key); | ||
| 37 | + | ||
| 38 | + @override | ||
| 39 | + _BaseInfoPersonnalPageState createState() => _BaseInfoPersonnalPageState(); | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +class _BaseInfoPersonnalPageState extends State<BaseInfoPersonnalPage> { | ||
| 43 | + ScrollController _scrollController; | ||
| 44 | + TextEditingController _nameController = TextEditingController(); | ||
| 45 | + TextEditingController _phoneController = TextEditingController(); | ||
| 46 | + // TextEditingController _positionController = TextEditingController(); | ||
| 47 | + // TextEditingController _wechatController = TextEditingController(); | ||
| 48 | + FocusNode _nameFocusNode = FocusNode(); | ||
| 49 | + FocusNode _phoneFocusNode = FocusNode(); | ||
| 50 | + // FocusNode _positionFocusNode = FocusNode(); | ||
| 51 | + // FocusNode _wechatFocusNode = FocusNode(); | ||
| 52 | + | ||
| 53 | + final picker = ImagePicker(); | ||
| 54 | + PersonnelProvider personnelProvider; | ||
| 55 | + | ||
| 56 | + // UploadImageProvider _uploadImageProvider; | ||
| 57 | + BaseIndoProvider _baseIndoProvider; | ||
| 58 | + String nameStr = '未填写'; | ||
| 59 | + String phoneStr = ''; | ||
| 60 | + bool isSelect = true; | ||
| 61 | + | ||
| 62 | + @override | ||
| 63 | + void initState() { | ||
| 64 | + super.initState(); | ||
| 65 | + _scrollController = ScrollController(); | ||
| 66 | + _getCustomerActivityBaseinfo(); | ||
| 67 | + _nameFocusNode.addListener(() { | ||
| 68 | + if (_nameFocusNode.hasFocus) { | ||
| 69 | + print('得到焦点'); | ||
| 70 | + } else { | ||
| 71 | + print('失去焦点'); | ||
| 72 | + } | ||
| 73 | + setState(() {}); | ||
| 74 | + }); | ||
| 75 | + _phoneFocusNode.addListener(() { | ||
| 76 | + if (_phoneFocusNode.hasFocus) { | ||
| 77 | + print('得到焦点'); | ||
| 78 | + } else { | ||
| 79 | + print('失去焦点'); | ||
| 80 | + } | ||
| 81 | + }); | ||
| 82 | + // _positionFocusNode.addListener(() { | ||
| 83 | + // if (_positionFocusNode.hasFocus) { | ||
| 84 | + // print('得到焦点'); | ||
| 85 | + // } else { | ||
| 86 | + // print('失去焦点'); | ||
| 87 | + // } | ||
| 88 | + // setState(() {}); | ||
| 89 | + // }); | ||
| 90 | + // _wechatFocusNode.addListener(() { | ||
| 91 | + // if (_wechatFocusNode.hasFocus) { | ||
| 92 | + // print('得到焦点'); | ||
| 93 | + // } else { | ||
| 94 | + // print('失去焦点'); | ||
| 95 | + // } | ||
| 96 | + // setState(() {}); | ||
| 97 | + // }); | ||
| 98 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 99 | + // _getQiniuInfo(); | ||
| 100 | + }); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + _getCustomerActivityBaseinfo() async { | ||
| 104 | + // Map<String, String> params; | ||
| 105 | + | ||
| 106 | + // params = { | ||
| 107 | + // 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 108 | + // "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 109 | + // }; | ||
| 110 | + | ||
| 111 | + // bool success = | ||
| 112 | + // await _baseIndoProvider.getCustomerActivityBaseinfo(context, params); | ||
| 113 | + // if (success) { | ||
| 114 | + _nameController.text = widget.sunModel.nickName; | ||
| 115 | + nameStr = widget.sunModel.nickName; | ||
| 116 | + // _uploadImageProvider.touxiang.qiniuUrl = | ||
| 117 | + // _baseIndoProvider.baseInfoSunModel.photo; | ||
| 118 | + // _uploadImageProvider.erweima.qiniuUrl = | ||
| 119 | + // _baseIndoProvider.baseInfoSunModel.qrcode; | ||
| 120 | + _phoneController.text = widget.sunModel.phone; | ||
| 121 | + phoneStr = widget.sunModel.phone ?? ''; | ||
| 122 | + // _wechatController.text = _baseIndoProvider.baseInfoSunModel.wechat; | ||
| 123 | + // if (_baseIndoProvider.baseInfoSunModel.wechat != null && | ||
| 124 | + // _baseIndoProvider.baseInfoSunModel.wechat != '' && | ||
| 125 | + // phoneStr != '' && | ||
| 126 | + // _baseIndoProvider.baseInfoSunModel.wechat == phoneStr) { | ||
| 127 | + // isSelect = true; | ||
| 128 | + // } else { | ||
| 129 | + // isSelect = false; | ||
| 130 | + // } | ||
| 131 | + // _positionController.text = widget.position; | ||
| 132 | + // _uploadImageProvider.imgSizeErweima = 64; | ||
| 133 | + // setState(() {}); | ||
| 134 | + // _uploadImageProvider.notifyListeners(); | ||
| 135 | + // } | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + ///获取七牛云token | ||
| 139 | + /// | ||
| 140 | + // _getQiniuInfo() async { | ||
| 141 | + // await _uploadImageProvider.getQiniuInfo(context, {}); | ||
| 142 | + // } | ||
| 143 | + | ||
| 144 | + //客户经理添加/修改基本信息 | ||
| 145 | + // _setCustomerActivityBaseinfo() async { | ||
| 146 | + // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 147 | + | ||
| 148 | + // String nameTemp = _nameController.text.trim(); | ||
| 149 | + // String phoneTemp = _phoneController.text.trim(); | ||
| 150 | + // Map<String, String> params = { | ||
| 151 | + // "name": nameTemp, | ||
| 152 | + // 'phone': phoneTemp, | ||
| 153 | + // "photo": _uploadImageProvider.touxiang.qiniuUrl.trim().length == 0 || | ||
| 154 | + // _uploadImageProvider.touxiang.qiniuUrl == | ||
| 155 | + // 'http://nosqn.colorcun.com/yd_person.png' | ||
| 156 | + // ? App.sp.getString("headImg") | ||
| 157 | + // : _uploadImageProvider.touxiang.qiniuUrl, | ||
| 158 | + // "position": _positionController.text.trim().length == 0 | ||
| 159 | + // ? '经理' | ||
| 160 | + // : _positionController.text, | ||
| 161 | + // }; | ||
| 162 | + | ||
| 163 | + // params['sellerid'] = | ||
| 164 | + // Provider.of<UserModel>(context, listen: false).user.sellerid; | ||
| 165 | + // params["uid"] = Provider.of<UserModel>(context, listen: false).user.openid; | ||
| 166 | + | ||
| 167 | + // if (isSelect) { | ||
| 168 | + // params['wechat'] = phoneTemp; | ||
| 169 | + // } else { | ||
| 170 | + // // if (_wechatController.text.trim().length > 0) { | ||
| 171 | + // params['wechat'] = _wechatController.text; | ||
| 172 | + // // } | ||
| 173 | + // } | ||
| 174 | + | ||
| 175 | + // if (_uploadImageProvider.erweima.qiniuUrl != null && | ||
| 176 | + // _uploadImageProvider.erweima.qiniuUrl != '') { | ||
| 177 | + // params['qrcode'] = _uploadImageProvider.erweima.qiniuUrl; | ||
| 178 | + // } | ||
| 179 | + // if (_baseIndoProvider.baseInfoSunModel != null) { | ||
| 180 | + // params['id'] = _baseIndoProvider.baseInfoSunModel.id; | ||
| 181 | + // } | ||
| 182 | + // bool isSuccess = | ||
| 183 | + // await _baseIndoProvider.setCustomerActivityBaseinfo(context, params); | ||
| 184 | + // // _baseIndoProvider.baseInfoSunModel = null; | ||
| 185 | + // if (isSuccess) { | ||
| 186 | + // _uploadImageProvider.touxiang.file = null; | ||
| 187 | + // _uploadImageProvider.erweima.file = null; | ||
| 188 | + // nameStr = nameTemp; | ||
| 189 | + | ||
| 190 | + // phoneStr = phoneTemp; | ||
| 191 | + // //成功之后跳回前一个页面 | ||
| 192 | + // // bus.emit('refresh_coupon_list'); | ||
| 193 | + // Utils.showToast('保存成功'); | ||
| 194 | + // EventBus().emit('changeStatusColor'); | ||
| 195 | + | ||
| 196 | + // Navigator.pop(context, true); | ||
| 197 | + // } | ||
| 198 | + // } | ||
| 199 | + | ||
| 200 | + ///输入框 | ||
| 201 | + Widget _text(String image, String text) { | ||
| 202 | + return Container( | ||
| 203 | + child: Row( | ||
| 204 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 205 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 206 | + children: [ | ||
| 207 | + Container( | ||
| 208 | + child: Image.asset( | ||
| 209 | + Utils.getImgPath(image), | ||
| 210 | + width: ScreenUtil().setWidth(34 * 2), | ||
| 211 | + )), | ||
| 212 | + HEmptyView(24), | ||
| 213 | + Expanded( | ||
| 214 | + child: Text( | ||
| 215 | + text, | ||
| 216 | + style: TextStyle( | ||
| 217 | + fontSize: ScreenUtil().setSp(32), | ||
| 218 | + ), | ||
| 219 | + )), | ||
| 220 | + ], | ||
| 221 | + )); | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + ///输入框 | ||
| 225 | + Widget _textfield(String image, String hintText, | ||
| 226 | + TextEditingController editingController, FocusNode focusNode) { | ||
| 227 | + return Container( | ||
| 228 | + child: Row( | ||
| 229 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 230 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 231 | + children: [ | ||
| 232 | + Container( | ||
| 233 | + child: Image.asset( | ||
| 234 | + Utils.getImgPath(image), | ||
| 235 | + width: ScreenUtil().setWidth(34 * 2), | ||
| 236 | + )), | ||
| 237 | + HEmptyView(24), | ||
| 238 | + Expanded( | ||
| 239 | + child: TextField( | ||
| 240 | + controller: editingController, | ||
| 241 | + // textAlign: TextAlign.right, | ||
| 242 | + // textAlignVertical: TextAlignVertical.bottom, | ||
| 243 | + maxLines: 1, | ||
| 244 | + | ||
| 245 | + // //光标颜色 | ||
| 246 | + // cursorColor: | ||
| 247 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 248 | + //输入文本的样式 | ||
| 249 | + style: TextStyle( | ||
| 250 | + fontSize: ScreenUtil().setSp(32), | ||
| 251 | + ), | ||
| 252 | + focusNode: focusNode, | ||
| 253 | + decoration: InputDecoration( | ||
| 254 | + // suffixText: '修改', | ||
| 255 | + // suffixStyle: TextStyle( | ||
| 256 | + // fontSize: ScreenUtil().setSp(24), | ||
| 257 | + // color: MyColours.color_BFC4D4), | ||
| 258 | + // suffixIcon: Container( | ||
| 259 | + // margin: EdgeInsets.only(left: ScreenUtil().setWidth(16)), | ||
| 260 | + // child: Image.asset( | ||
| 261 | + // Utils.getImgPath('arrow_right_new'), | ||
| 262 | + // width: ScreenUtil().setWidth(20), | ||
| 263 | + // height: ScreenUtil().setWidth(40), | ||
| 264 | + // )), | ||
| 265 | + // suffixIconConstraints: | ||
| 266 | + // BoxConstraints(maxWidth: ScreenUtil().setWidth(56)), | ||
| 267 | + border: OutlineInputBorder(borderSide: BorderSide.none), | ||
| 268 | + hintText: hintText, | ||
| 269 | + hintStyle: TextStyle( | ||
| 270 | + color: MyColours.color_999999, | ||
| 271 | + fontSize: ScreenUtil().setSp(32), | ||
| 272 | + ), | ||
| 273 | + enabledBorder: new UnderlineInputBorder( | ||
| 274 | + borderSide: BorderSide.none, | ||
| 275 | + ), | ||
| 276 | + focusedBorder: new UnderlineInputBorder( | ||
| 277 | + borderSide: BorderSide.none, | ||
| 278 | + ), | ||
| 279 | + ), | ||
| 280 | + | ||
| 281 | + onChanged: (value) { | ||
| 282 | + print('vvvvvv'); | ||
| 283 | + if (hintText == '您希望顾客看到的名字') { | ||
| 284 | + setState(() { | ||
| 285 | + nameStr = value; | ||
| 286 | + }); | ||
| 287 | + } else if (hintText == '顾客联系您的手机号') { | ||
| 288 | + setState(() { | ||
| 289 | + phoneStr = value; | ||
| 290 | + }); | ||
| 291 | + } | ||
| 292 | + }, | ||
| 293 | + onEditingComplete: () { | ||
| 294 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 295 | + }, | ||
| 296 | + keyboardType: TextInputType.text, | ||
| 297 | + ), | ||
| 298 | + ), | ||
| 299 | + focusNode.hasFocus | ||
| 300 | + ? SizedBox() | ||
| 301 | + : InkWell( | ||
| 302 | + onTap: () { | ||
| 303 | + FocusScope.of(context).requestFocus(focusNode); // 获取焦点 | ||
| 304 | + setState(() {}); | ||
| 305 | + }, | ||
| 306 | + child: Row( | ||
| 307 | + children: [ | ||
| 308 | + Text( | ||
| 309 | + '修改', | ||
| 310 | + style: TextStyle( | ||
| 311 | + fontSize: ScreenUtil().setSp(24), | ||
| 312 | + color: MyColours.color_BFC4D4), | ||
| 313 | + ), | ||
| 314 | + Container( | ||
| 315 | + margin: | ||
| 316 | + EdgeInsets.only(left: ScreenUtil().setWidth(16)), | ||
| 317 | + child: Image.asset( | ||
| 318 | + Utils.getImgPath('base_arrow_r'), | ||
| 319 | + width: ScreenUtil().setWidth(20), | ||
| 320 | + height: ScreenUtil().setWidth(40), | ||
| 321 | + )), | ||
| 322 | + ], | ||
| 323 | + )) | ||
| 324 | + ], | ||
| 325 | + ), | ||
| 326 | + ); | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + //查看大图 | ||
| 330 | + _showPhotoView(BuildContext context, int index, List imgs, | ||
| 331 | + {isShow = false, List dashName}) async { | ||
| 332 | + // if (imgs.length == 1 && | ||
| 333 | + // imgs[0] == | ||
| 334 | + // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') { | ||
| 335 | + // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png'; | ||
| 336 | + // } | ||
| 337 | + Utils.setBarStatus(false, color: Colors.black); | ||
| 338 | + dynamic result = await showGeneralDialog( | ||
| 339 | + context: context, | ||
| 340 | + barrierDismissible: false, | ||
| 341 | + // barrierColor: Colors.red, | ||
| 342 | + barrierLabel: | ||
| 343 | + MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 344 | + transitionDuration: const Duration(milliseconds: 150), | ||
| 345 | + pageBuilder: (BuildContext context, Animation animation, | ||
| 346 | + Animation secondaryAnimation) { | ||
| 347 | + Widget child = Stack( | ||
| 348 | + children: <Widget>[ | ||
| 349 | + PhotoPreview( | ||
| 350 | + initialIndex: index, | ||
| 351 | + photoList: imgs, | ||
| 352 | + isShow: isShow, | ||
| 353 | + dashName: dashName, | ||
| 354 | + needMask: false, | ||
| 355 | + ) | ||
| 356 | + ], | ||
| 357 | + ); | ||
| 358 | + return child; | ||
| 359 | + }); | ||
| 360 | + Utils.setBarStatus(true, color: Colors.white); | ||
| 361 | + } | ||
| 362 | + | ||
| 363 | + ///#相机拍照,单图选择 | ||
| 364 | + // Future _getFromPictureOrCamera( | ||
| 365 | + // String title, UploadImgModel imgModel, imageSource) async { | ||
| 366 | + // final pickedFile = await picker.getImage(source: imageSource); | ||
| 367 | + // setState(() { | ||
| 368 | + // if (pickedFile != null) { | ||
| 369 | + // imgModel.file = File(pickedFile.path); | ||
| 370 | + // imgModel.process = 0.01; | ||
| 371 | + // } else { | ||
| 372 | + // print('No image selected.'); | ||
| 373 | + // } | ||
| 374 | + // }); | ||
| 375 | + // if (pickedFile != null) { | ||
| 376 | + // if (title == '头像') { | ||
| 377 | + // _uploadImageProvider.imgSizeTouxiang = 76; | ||
| 378 | + // _uploadImageProvider.touxiang.qiniuUrl = null; | ||
| 379 | + // } else { | ||
| 380 | + // _uploadImageProvider.imgSizeErweima = 76; | ||
| 381 | + // _uploadImageProvider.erweima.qiniuUrl = null; | ||
| 382 | + // } | ||
| 383 | + // UploadImageUtil().startUploadOnly(context, File(pickedFile.path), | ||
| 384 | + // title == '头像' ? 0 : 1, true, _uploadImageProvider); | ||
| 385 | + // } | ||
| 386 | + // } | ||
| 387 | + | ||
| 388 | + ///图片 头像和二维码 | ||
| 389 | + Widget _imageWidget(String title, double imgSize, double radius) { | ||
| 390 | + return InkWell( | ||
| 391 | + onTap: () { | ||
| 392 | + // double process; | ||
| 393 | + // String qiniuUrl; | ||
| 394 | + List<String> tempList = []; | ||
| 395 | + // if (title == '头像') { | ||
| 396 | + // process = _uploadImageProvider.touxiang.process; | ||
| 397 | + // qiniuUrl = _uploadImageProvider.touxiang.qiniuUrl; | ||
| 398 | + // } else { | ||
| 399 | + // process = _uploadImageProvider.erweima.process; | ||
| 400 | + // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl; | ||
| 401 | + // } | ||
| 402 | + | ||
| 403 | + if (widget.sunModel.headimgurl != null && | ||
| 404 | + widget.sunModel.headimgurl != '') { | ||
| 405 | + tempList.add(widget.sunModel.headimgurl); | ||
| 406 | + | ||
| 407 | + ///没有上传完成的不可以点击 | ||
| 408 | + _showPhotoView(context, 0, tempList); | ||
| 409 | + // } else { | ||
| 410 | + // Utils.getPickPermission(context, () { | ||
| 411 | + // _getFromPictureOrCamera(title, model, ImageSource.gallery); | ||
| 412 | + // }, Platform.isAndroid ? Permission.storage : Permission.photos); | ||
| 413 | + } | ||
| 414 | + }, | ||
| 415 | + child: Stack(clipBehavior: Clip.none, children: [ | ||
| 416 | + Container( | ||
| 417 | + width: ScreenUtil().setWidth(93 * 2), | ||
| 418 | + height: ScreenUtil().setWidth(93 * 2), | ||
| 419 | + margin: EdgeInsets.only( | ||
| 420 | + right: ScreenUtil().setWidth(24), | ||
| 421 | + ), | ||
| 422 | + child: ClipRRect( | ||
| 423 | + borderRadius: | ||
| 424 | + BorderRadius.circular(ScreenUtil().setWidth(93)), | ||
| 425 | + child: Image.asset( | ||
| 426 | + Utils.getImgPath('base_tx_bg'), | ||
| 427 | + fit: BoxFit.cover, | ||
| 428 | + width: ScreenUtil().setWidth(93 * 2), | ||
| 429 | + height: ScreenUtil().setWidth(93 * 2), | ||
| 430 | + ))), | ||
| 431 | + Positioned( | ||
| 432 | + top: ScreenUtil().setWidth(9), | ||
| 433 | + left: ScreenUtil().setWidth(17), | ||
| 434 | + child: Container( | ||
| 435 | + width: ScreenUtil().setWidth(imgSize * 2), | ||
| 436 | + height: ScreenUtil().setWidth(imgSize * 2), | ||
| 437 | + // margin: EdgeInsets.only( | ||
| 438 | + // right: ScreenUtil().setWidth(24), | ||
| 439 | + // ), | ||
| 440 | + child: ClipRRect( | ||
| 441 | + borderRadius: | ||
| 442 | + BorderRadius.circular(ScreenUtil().setWidth(radius)), | ||
| 443 | + child: widget.sunModel.headimgurl != null && | ||
| 444 | + widget.sunModel.headimgurl != '' && | ||
| 445 | + widget.sunModel.headimgurl != | ||
| 446 | + 'http://nosqn.colorcun.com/yd_person.png' | ||
| 447 | + ? Image.network( | ||
| 448 | + widget.sunModel.headimgurl, | ||
| 449 | + fit: BoxFit.cover, | ||
| 450 | + width: ScreenUtil().setWidth(imgSize * 2), | ||
| 451 | + height: ScreenUtil().setWidth(imgSize * 2), | ||
| 452 | + ) | ||
| 453 | + : Image.asset( | ||
| 454 | + Utils.getImgPath( | ||
| 455 | + title == '头像' ? 'base_tx_mr' : 'erweima'), | ||
| 456 | + fit: BoxFit.cover, | ||
| 457 | + width: ScreenUtil().setWidth(imgSize * 2), | ||
| 458 | + height: ScreenUtil().setWidth(imgSize * 2), | ||
| 459 | + )))), | ||
| 460 | + // Positioned( | ||
| 461 | + // right: ScreenUtil().setWidth(42), | ||
| 462 | + // top: ScreenUtil().setWidth(9), | ||
| 463 | + // child: (model.file != null) && | ||
| 464 | + // model.process != 1 && | ||
| 465 | + // model.process != 0.01 | ||
| 466 | + // ? Container( | ||
| 467 | + // width: ScreenUtil().setWidth(imgSize * 2), | ||
| 468 | + // height: ScreenUtil().setWidth(imgSize * 2), | ||
| 469 | + // decoration: BoxDecoration( | ||
| 470 | + // borderRadius: BorderRadius.circular(radius), | ||
| 471 | + // color: Color.fromRGBO(0, 0, 0, 0.6)), | ||
| 472 | + // child: Center( | ||
| 473 | + // child: Text('上传中', | ||
| 474 | + // style: TextStyle(color: MyColours.color_999999)), | ||
| 475 | + // ), | ||
| 476 | + // ) | ||
| 477 | + // : Container()), | ||
| 478 | + // Positioned( | ||
| 479 | + // right: ScreenUtil().setWidth(14), | ||
| 480 | + // top: ScreenUtil().setWidth(56), | ||
| 481 | + // child: InkWell( | ||
| 482 | + // onTap: () { | ||
| 483 | + // Utils.getPickPermission(context, () { | ||
| 484 | + // _getFromPictureOrCamera( | ||
| 485 | + // title, model, ImageSource.gallery); | ||
| 486 | + // }, | ||
| 487 | + // Platform.isAndroid | ||
| 488 | + // ? Permission.storage | ||
| 489 | + // : Permission.photos); | ||
| 490 | + // }, | ||
| 491 | + // child: Image.asset( | ||
| 492 | + // Utils.getImgPath('base_tx'), | ||
| 493 | + // width: ScreenUtil().setWidth(28 * 2), | ||
| 494 | + // ))) | ||
| 495 | + ])); | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + ///编辑店员 | ||
| 499 | + Future<bool> _editAuthUser(String name, {bool showLoading = true}) async { | ||
| 500 | + Map<String, String> params = {'id': widget.sunModel.id, 'user_name': name}; | ||
| 501 | + | ||
| 502 | + bool success = await personnelProvider.editAuthUser(context, params, | ||
| 503 | + showLoading: showLoading); | ||
| 504 | + if (success) { | ||
| 505 | + return true; | ||
| 506 | + } else { | ||
| 507 | + return false; | ||
| 508 | + } | ||
| 509 | + } | ||
| 510 | + | ||
| 511 | + /// 账号表-员工绑定手机号 | ||
| 512 | + Future<bool> _bindPhoneSellerUser(String phone, | ||
| 513 | + {bool showLoading = true}) async { | ||
| 514 | + Map<String, String> params = {'kid': widget.sunModel.id, 'phone': phone}; | ||
| 515 | + | ||
| 516 | + bool success = await personnelProvider.bindPhoneSellerUser(context, params, | ||
| 517 | + showLoading: showLoading); | ||
| 518 | + if (success) { | ||
| 519 | + return true; | ||
| 520 | + } else { | ||
| 521 | + return false; | ||
| 522 | + } | ||
| 523 | + } | ||
| 524 | + | ||
| 525 | + @override | ||
| 526 | + Widget build(BuildContext context) { | ||
| 527 | + // _uploadImageProvider = | ||
| 528 | + // Provider.of<UploadImageProvider>(context, listen: true); | ||
| 529 | + _baseIndoProvider = Provider.of<BaseIndoProvider>(context, listen: true); | ||
| 530 | + personnelProvider = Provider.of<PersonnelProvider>(context, listen: true); | ||
| 531 | + return Scaffold( | ||
| 532 | + backgroundColor: MyColours.color_fefefe, | ||
| 533 | + appBar: SystemAppBar( | ||
| 534 | + '个人信息', | ||
| 535 | + onTap: () { | ||
| 536 | + EventBus().emit('changeStatusColor'); | ||
| 537 | + Navigator.of(context).pop(); | ||
| 538 | + }, | ||
| 539 | + ), | ||
| 540 | + body: WillPopScope( | ||
| 541 | + onWillPop: () { | ||
| 542 | + EventBus().emit('changeStatusColor'); | ||
| 543 | + Navigator.of(context).pop(); | ||
| 544 | + }, | ||
| 545 | + child: InkWell( | ||
| 546 | + onTap: () { | ||
| 547 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 548 | + }, | ||
| 549 | + child: Container( | ||
| 550 | + color: MyColours.color_ffffff, | ||
| 551 | + child: Column( | ||
| 552 | + // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 553 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 554 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 555 | + children: [ | ||
| 556 | + Expanded( | ||
| 557 | + child: SingleChildScrollView( | ||
| 558 | + controller: _scrollController, | ||
| 559 | + physics: BouncingScrollPhysics(), | ||
| 560 | + child: Column( | ||
| 561 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 562 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 563 | + children: [ | ||
| 564 | + VEmptyView(66), | ||
| 565 | + _imageWidget('头像', 76, 76), | ||
| 566 | + VEmptyView(26), | ||
| 567 | + Text(nameStr, | ||
| 568 | + style: TextStyle( | ||
| 569 | + fontSize: ScreenUtil().setWidth(50), | ||
| 570 | + color: nameStr == '未填写' || | ||
| 571 | + nameStr == '' | ||
| 572 | + ? MyColours.color_BFC4D4 | ||
| 573 | + : MyColours.color_27262B)), | ||
| 574 | + VEmptyView(8), | ||
| 575 | + Text(phoneStr == null ? '' : phoneStr, | ||
| 576 | + style: TextStyle( | ||
| 577 | + fontSize: ScreenUtil().setWidth(30), | ||
| 578 | + color: MyColours.color_BFC4D4)), | ||
| 579 | + VEmptyView(80), | ||
| 580 | + | ||
| 581 | + Padding( | ||
| 582 | + padding: EdgeInsets.symmetric( | ||
| 583 | + horizontal: ScreenUtil().setWidth(48), | ||
| 584 | + ), | ||
| 585 | + child: _textfield( | ||
| 586 | + 'base_name', | ||
| 587 | + '您希望顾客看到的名字', | ||
| 588 | + _nameController, | ||
| 589 | + _nameFocusNode)), | ||
| 590 | + VEmptyView(26), | ||
| 591 | + | ||
| 592 | + Padding( | ||
| 593 | + padding: EdgeInsets.symmetric( | ||
| 594 | + horizontal: ScreenUtil().setWidth(40), | ||
| 595 | + ), | ||
| 596 | + child: _textfield( | ||
| 597 | + 'base_phone', | ||
| 598 | + '顾客联系您的手机号', | ||
| 599 | + _phoneController, | ||
| 600 | + _phoneFocusNode)), | ||
| 601 | + VEmptyView(26), | ||
| 602 | + Padding( | ||
| 603 | + padding: EdgeInsets.symmetric( | ||
| 604 | + horizontal: ScreenUtil().setWidth(40), | ||
| 605 | + ), | ||
| 606 | + child: _text( | ||
| 607 | + 'base_position', widget.position), | ||
| 608 | + ), | ||
| 609 | + // VEmptyView(26), | ||
| 610 | + // _imageWidget('微信二维码', _uploadImageProvider.erweima, | ||
| 611 | + // _uploadImageProvider.imgSizeErweima, 0), | ||
| 612 | + // InkWell( | ||
| 613 | + // onTap: () { | ||
| 614 | + // setState(() { | ||
| 615 | + // isSelect = !isSelect; | ||
| 616 | + // }); | ||
| 617 | + // }, | ||
| 618 | + // child: Container( | ||
| 619 | + // padding: EdgeInsets.only( | ||
| 620 | + // left: ScreenUtil().setWidth(40), | ||
| 621 | + // right: ScreenUtil().setWidth(40), | ||
| 622 | + // bottom: | ||
| 623 | + // ScreenUtil().setWidth(26)), | ||
| 624 | + // child: Row( | ||
| 625 | + // crossAxisAlignment: | ||
| 626 | + // CrossAxisAlignment.center, | ||
| 627 | + // children: [ | ||
| 628 | + // Image.asset( | ||
| 629 | + // Utils.getImgPath(isSelect | ||
| 630 | + // ? 'base_radio_sel' | ||
| 631 | + // : 'base_radio_un'), | ||
| 632 | + // // width: ScreenUtil().setWidth(16), | ||
| 633 | + // height: | ||
| 634 | + // ScreenUtil().setWidth(34), | ||
| 635 | + // ), | ||
| 636 | + // HEmptyView(24), | ||
| 637 | + // Text('微信同电话号', | ||
| 638 | + // style: TextStyle( | ||
| 639 | + // color: isSelect | ||
| 640 | + // ? MyColours.color_438E93 | ||
| 641 | + // : MyColours | ||
| 642 | + // .color_BFC4D4, | ||
| 643 | + // fontSize: | ||
| 644 | + // ScreenUtil().setSp(30), | ||
| 645 | + // )), | ||
| 646 | + // ], | ||
| 647 | + // ), | ||
| 648 | + // )), | ||
| 649 | + | ||
| 650 | + // isSelect | ||
| 651 | + // ? SizedBox() | ||
| 652 | + // : Padding( | ||
| 653 | + // padding: EdgeInsets.symmetric( | ||
| 654 | + // horizontal: | ||
| 655 | + // ScreenUtil().setWidth(40), | ||
| 656 | + // ), | ||
| 657 | + // child: _textfield( | ||
| 658 | + // 'base_wechat', | ||
| 659 | + // '微信号方便顾客加您微信', | ||
| 660 | + // _wechatController, | ||
| 661 | + // _wechatFocusNode)), | ||
| 662 | + VEmptyView(30), | ||
| 663 | + ], | ||
| 664 | + )), | ||
| 665 | + ), | ||
| 666 | + VEmptyView(20), | ||
| 667 | + Padding( | ||
| 668 | + padding: EdgeInsets.fromLTRB( | ||
| 669 | + ScreenUtil().setWidth(40), | ||
| 670 | + 0, | ||
| 671 | + ScreenUtil().setWidth(40), | ||
| 672 | + ScreenUtil().setWidth(56)), | ||
| 673 | + child: RoundButton( | ||
| 674 | + onPressed: () { | ||
| 675 | + if (_phoneController.text.trim().length == | ||
| 676 | + 0 || | ||
| 677 | + _nameController.text.trim().length == 0) { | ||
| 678 | + Utils.showToast('请至少填写您的姓名和电话'); | ||
| 679 | + return; | ||
| 680 | + } //接口 | ||
| 681 | + // _setCustomerActivityBaseinfo(); | ||
| 682 | + String nameTemp = _nameController.text.trim(); | ||
| 683 | + String phoneTemp = | ||
| 684 | + _phoneController.text.trim(); | ||
| 685 | + Future.wait<bool>([ | ||
| 686 | + _editAuthUser(nameTemp), | ||
| 687 | + _bindPhoneSellerUser(phoneTemp) | ||
| 688 | + ]).then((results) { | ||
| 689 | + print(results[0]); | ||
| 690 | + if (results[0] && results[1]) { | ||
| 691 | + //成功 | ||
| 692 | + EventBus().emit('personnel_manage_page'); | ||
| 693 | + EventBus() | ||
| 694 | + .emit('personnel_manage_detail_page'); | ||
| 695 | + Navigator.pop(context); | ||
| 696 | + } else { | ||
| 697 | + if (!results[0]) { | ||
| 698 | + Utils.showToast('修改姓名失败'); | ||
| 699 | + } else { | ||
| 700 | + Utils.showToast('修改电话失败'); | ||
| 701 | + } | ||
| 702 | + } | ||
| 703 | + }).catchError((e) { | ||
| 704 | + print(e); | ||
| 705 | + }); | ||
| 706 | + }, | ||
| 707 | + text: '保存', | ||
| 708 | + fontSize: 34, | ||
| 709 | + isBold: false, | ||
| 710 | + height: ScreenUtil().setWidth(100), | ||
| 711 | + width: ScreenUtil().setWidth(154 * 2), | ||
| 712 | + gradientStart: _phoneController.text | ||
| 713 | + .trim() | ||
| 714 | + .length == | ||
| 715 | + 0 || | ||
| 716 | + _nameController.text.trim().length == 0 | ||
| 717 | + ? MyColours.color_BFC4D4 | ||
| 718 | + : MyColours.color_438E93, | ||
| 719 | + gradientEnd: _phoneController.text | ||
| 720 | + .trim() | ||
| 721 | + .length == | ||
| 722 | + 0 || | ||
| 723 | + _nameController.text.trim().length == 0 | ||
| 724 | + ? MyColours.color_BFC4D4 | ||
| 725 | + : MyColours.color_438E93, | ||
| 726 | + radius: ScreenUtil().setWidth(24), | ||
| 727 | + )) | ||
| 728 | + ]))))); | ||
| 729 | + } | ||
| 730 | +} |
| @@ -5,6 +5,7 @@ import 'package:common_utils/common_utils.dart'; | @@ -5,6 +5,7 @@ import 'package:common_utils/common_utils.dart'; | ||
| 5 | import 'package:dio/dio.dart'; | 5 | import 'package:dio/dio.dart'; |
| 6 | import 'package:flutter/material.dart'; | 6 | import 'package:flutter/material.dart'; |
| 7 | import 'package:flutter_screenutil/screenutil.dart'; | 7 | import 'package:flutter_screenutil/screenutil.dart'; |
| 8 | +import 'package:one_key/constant/state.dart'; | ||
| 8 | import 'package:one_key/models/get_seller_info_model.dart'; | 9 | import 'package:one_key/models/get_seller_info_model.dart'; |
| 9 | import 'package:one_key/models/personnel_manage_model.dart'; | 10 | import 'package:one_key/models/personnel_manage_model.dart'; |
| 10 | import 'package:one_key/net/dio_util.dart'; | 11 | import 'package:one_key/net/dio_util.dart'; |
| @@ -23,9 +24,9 @@ import 'package:one_key/widgets/v_empty_view.dart'; | @@ -23,9 +24,9 @@ import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 23 | import 'package:provider/provider.dart'; | 24 | import 'package:provider/provider.dart'; |
| 24 | 25 | ||
| 25 | class PersonnelDetailPage extends StatefulWidget { | 26 | class PersonnelDetailPage extends StatefulWidget { |
| 26 | - final PersonnelManageSunModel model; | 27 | + final int index; |
| 27 | final String position; | 28 | final String position; |
| 28 | - PersonnelDetailPage({Key key, this.model, this.position}) : super(key: key); | 29 | + PersonnelDetailPage({Key key, this.index, this.position}) : super(key: key); |
| 29 | 30 | ||
| 30 | @override | 31 | @override |
| 31 | _PersonnelDetailPageState createState() => _PersonnelDetailPageState(); | 32 | _PersonnelDetailPageState createState() => _PersonnelDetailPageState(); |
| @@ -34,75 +35,79 @@ class PersonnelDetailPage extends StatefulWidget { | @@ -34,75 +35,79 @@ class PersonnelDetailPage extends StatefulWidget { | ||
| 34 | class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | 35 | class _PersonnelDetailPageState extends State<PersonnelDetailPage> { |
| 35 | String roleNameLogin; | 36 | String roleNameLogin; |
| 36 | String accountLogin; | 37 | String accountLogin; |
| 37 | - bool canEdit = false; | 38 | + // bool canEdit = false; |
| 38 | List<String> btnList = []; | 39 | List<String> btnList = []; |
| 39 | UserModel userModel; | 40 | UserModel userModel; |
| 40 | PersonnelProvider personnelProvider; | 41 | PersonnelProvider personnelProvider; |
| 41 | - String nickName; | ||
| 42 | - String phone; | 42 | + String nickName = ''; |
| 43 | + String phone = ''; | ||
| 43 | String dcAdduserCode; | 44 | String dcAdduserCode; |
| 45 | + String manageShow = '全店未分配客户资源'; | ||
| 46 | + PersonnelManageSunModel data; | ||
| 44 | 47 | ||
| 45 | @override | 48 | @override |
| 46 | void initState() { | 49 | void initState() { |
| 47 | super.initState(); | 50 | super.initState(); |
| 48 | - nickName = widget.model.nickName != null && widget.model.nickName != 'null' | ||
| 49 | - ? widget.model.nickName | ||
| 50 | - : '暂未设置名称'; | ||
| 51 | - phone = widget.model.phone != null && widget.model.userName != 'null' | ||
| 52 | - ? widget.model.phone | ||
| 53 | - : '添加手机号'; | 51 | + |
| 54 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | 52 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { |
| 55 | - if (widget.model.openid == null || widget.model.openid == 'null') { | ||
| 56 | - // _getStoreBaseinfo(); | ||
| 57 | - _getWechatQrcode(); | ||
| 58 | - } | 53 | + _getSellerUserBySellerid(); |
| 54 | + _getAuthUserLists(); | ||
| 55 | + EventBus().on('personnel_manage_detail_page', (arg) { | ||
| 56 | + _getAuthUserLists(showLoading: false); | ||
| 57 | + }); | ||
| 59 | setState(() { | 58 | setState(() { |
| 60 | roleNameLogin = userModel.user.role_name; | 59 | roleNameLogin = userModel.user.role_name; |
| 61 | accountLogin = userModel.user.account; | 60 | accountLogin = userModel.user.account; |
| 62 | 61 | ||
| 63 | - if (roleNameLogin == '管理员') { | ||
| 64 | - canEdit = true; | ||
| 65 | - } else if (roleNameLogin == '店长') { | ||
| 66 | - if (widget.position == '管理员') { | ||
| 67 | - canEdit = false; | ||
| 68 | - } else if (widget.position == '店长') { | ||
| 69 | - if (accountLogin == widget.model.account) { | ||
| 70 | - print('11111'); | ||
| 71 | - //店长自己 | ||
| 72 | - canEdit = true; | ||
| 73 | - } else { | ||
| 74 | - print('333333'); | ||
| 75 | - canEdit = false; | ||
| 76 | - } | ||
| 77 | - } else { | ||
| 78 | - canEdit = true; | ||
| 79 | - } | ||
| 80 | - } else { | ||
| 81 | - if (accountLogin == widget.model.account) { | ||
| 82 | - //自己 | ||
| 83 | - canEdit = true; | ||
| 84 | - } else { | ||
| 85 | - canEdit = false; | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - if (canEdit) { | ||
| 89 | - btnList = [ | ||
| 90 | - '移除店员', | ||
| 91 | - ]; | ||
| 92 | - if (widget.model.openid == null || widget.model.openid == 'null') { | ||
| 93 | - btnList.add('绑定微信'); | ||
| 94 | - } | ||
| 95 | - btnList.add('查看密码'); | ||
| 96 | - if (widget.model.isOnCall == '0') { | ||
| 97 | - btnList.add('设为接单人'); | ||
| 98 | - } | ||
| 99 | - } else { | ||
| 100 | - btnList = []; | ||
| 101 | - } | 62 | + // if (roleNameLogin == '管理员') { |
| 63 | + // canEdit = true; | ||
| 64 | + // } else if (roleNameLogin == '店长') { | ||
| 65 | + // if (widget.position == '管理员') { | ||
| 66 | + // canEdit = false; | ||
| 67 | + // } else if (widget.position == '店长') { | ||
| 68 | + // if (accountLogin == data.account) { | ||
| 69 | + // print('11111'); | ||
| 70 | + // //店长自己 | ||
| 71 | + // canEdit = true; | ||
| 72 | + // } else { | ||
| 73 | + // print('333333'); | ||
| 74 | + // canEdit = false; | ||
| 75 | + // } | ||
| 76 | + // } else { | ||
| 77 | + // canEdit = true; | ||
| 78 | + // } | ||
| 79 | + // } else { | ||
| 80 | + // if (accountLogin == data.account) { | ||
| 81 | + // //自己 | ||
| 82 | + // canEdit = true; | ||
| 83 | + // } else { | ||
| 84 | + // canEdit = false; | ||
| 85 | + // } | ||
| 86 | + // } | ||
| 87 | + // if (canEdit) { | ||
| 88 | + // btnList = [ | ||
| 89 | + // '移除店员', | ||
| 90 | + // ]; | ||
| 91 | + // if (data.openid == null || data.openid == 'null') { | ||
| 92 | + // btnList.add('绑定微信'); | ||
| 93 | + // } | ||
| 94 | + // btnList.add('查看密码'); | ||
| 95 | + // if (data.isOnCall == '0') { | ||
| 96 | + // btnList.add('设为接单人'); | ||
| 97 | + // } | ||
| 98 | + // } else { | ||
| 99 | + // btnList = []; | ||
| 100 | + // } | ||
| 102 | }); | 101 | }); |
| 103 | }); | 102 | }); |
| 104 | } | 103 | } |
| 105 | 104 | ||
| 105 | + void dispose() { | ||
| 106 | + // TODO: implement dispose | ||
| 107 | + super.dispose(); | ||
| 108 | + EventBus().off('personnel_manage_detail_page'); | ||
| 109 | + } | ||
| 110 | + | ||
| 106 | ///获取店铺信息 | 111 | ///获取店铺信息 |
| 107 | // _getStoreBaseinfo() async { | 112 | // _getStoreBaseinfo() async { |
| 108 | // GetSellerInfoSunModel itemModel = | 113 | // GetSellerInfoSunModel itemModel = |
| @@ -112,11 +117,54 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | @@ -112,11 +117,54 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | ||
| 112 | // } | 117 | // } |
| 113 | // } | 118 | // } |
| 114 | 119 | ||
| 120 | + ///商家编辑页面 ----- 获取经理数据 | ||
| 121 | + _getSellerUserBySellerid() async { | ||
| 122 | + await personnelProvider.getSellerUserBySellerid(context); | ||
| 123 | + | ||
| 124 | + // for (int i = 0; i < personnelProvider.sellerManageList.length; i++) { | ||
| 125 | + // if (manageShow == personnelProvider.sellerManageList[i].title) { | ||
| 126 | + // personnelProvider.manageSelIndex = i; | ||
| 127 | + // } | ||
| 128 | + // } | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + //获取员工信息列表 | ||
| 132 | + _getAuthUserLists({bool showLoading = true}) async { | ||
| 133 | + Map<String, String> params = { | ||
| 134 | + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 135 | + }; | ||
| 136 | + | ||
| 137 | + await personnelProvider.getAuthUserLists(context, params, | ||
| 138 | + showLoading: showLoading); | ||
| 139 | + if (personnelProvider.dataMap != null) { | ||
| 140 | + if (widget.position == '管理员') { | ||
| 141 | + data = personnelProvider.dataMap.admin.listdata[widget.index]; | ||
| 142 | + } else if (widget.position == '店长') { | ||
| 143 | + data = personnelProvider.dataMap.shopowner.listdata[widget.index]; | ||
| 144 | + } else if (widget.position == '客户经理') { | ||
| 145 | + data = personnelProvider.dataMap.manager.listdata[widget.index]; | ||
| 146 | + } else if (widget.position == '收银员') { | ||
| 147 | + data = personnelProvider.dataMap.cashier.listdata[widget.index]; | ||
| 148 | + } else if (widget.position == '服务员') { | ||
| 149 | + data = personnelProvider.dataMap.waiter.listdata[widget.index]; | ||
| 150 | + } | ||
| 151 | + nickName = data.nickName != null && data.nickName != 'null' | ||
| 152 | + ? data.nickName | ||
| 153 | + : '暂未设置名称'; | ||
| 154 | + phone = | ||
| 155 | + data.phone != null && data.userName != 'null' ? data.phone : '添加手机号'; | ||
| 156 | + if (data.openid == null || data.openid == 'null') { | ||
| 157 | + // _getStoreBaseinfo(); | ||
| 158 | + _getWechatQrcode(); | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | + } | ||
| 162 | + | ||
| 115 | ///设置接单人 | 163 | ///设置接单人 |
| 116 | _setUserIsCall({bool showLoading = true}) async { | 164 | _setUserIsCall({bool showLoading = true}) async { |
| 117 | Map<String, String> params = { | 165 | Map<String, String> params = { |
| 118 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 166 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 119 | - 'uid': widget.model.id | 167 | + 'uid': data.id |
| 120 | }; | 168 | }; |
| 121 | 169 | ||
| 122 | bool success = await personnelProvider.setUserIsCall(context, params, | 170 | bool success = await personnelProvider.setUserIsCall(context, params, |
| @@ -132,20 +180,17 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | @@ -132,20 +180,17 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | ||
| 132 | } | 180 | } |
| 133 | 181 | ||
| 134 | ///删除店员 | 182 | ///删除店员 |
| 135 | - _delSellerClerk({bool showLoading = true}) async { | ||
| 136 | - Map<String, String> params = {'seller_user_id': widget.model.id}; | 183 | + Future<bool> _delSellerClerk({bool showLoading = true}) async { |
| 184 | + Map<String, String> params = {'seller_user_id': data.id}; | ||
| 137 | 185 | ||
| 138 | bool success = await personnelProvider.delSellerClerk(context, params, | 186 | bool success = await personnelProvider.delSellerClerk(context, params, |
| 139 | showLoading: showLoading); | 187 | showLoading: showLoading); |
| 140 | - if (success) { | ||
| 141 | - EventBus().emit('personnel_manage_page'); | ||
| 142 | - Navigator.pop(context); | ||
| 143 | - } | 188 | + return success; |
| 144 | } | 189 | } |
| 145 | 190 | ||
| 146 | ///编辑店员 | 191 | ///编辑店员 |
| 147 | _editAuthUser(String name, {bool showLoading = true}) async { | 192 | _editAuthUser(String name, {bool showLoading = true}) async { |
| 148 | - Map<String, String> params = {'id': widget.model.id, 'user_name': name}; | 193 | + Map<String, String> params = {'id': data.id, 'user_name': name}; |
| 149 | 194 | ||
| 150 | bool success = await personnelProvider.editAuthUser(context, params, | 195 | bool success = await personnelProvider.editAuthUser(context, params, |
| 151 | showLoading: showLoading); | 196 | showLoading: showLoading); |
| @@ -159,7 +204,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | @@ -159,7 +204,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | ||
| 159 | 204 | ||
| 160 | /// 账号表-员工绑定手机号 | 205 | /// 账号表-员工绑定手机号 |
| 161 | _bindPhoneSellerUser(String name, {bool showLoading = true}) async { | 206 | _bindPhoneSellerUser(String name, {bool showLoading = true}) async { |
| 162 | - Map<String, String> params = {'kid': widget.model.id, 'phone': name}; | 207 | + Map<String, String> params = {'kid': data.id, 'phone': name}; |
| 163 | 208 | ||
| 164 | bool success = await personnelProvider.bindPhoneSellerUser(context, params, | 209 | bool success = await personnelProvider.bindPhoneSellerUser(context, params, |
| 165 | showLoading: showLoading); | 210 | showLoading: showLoading); |
| @@ -205,7 +250,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | @@ -205,7 +250,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | ||
| 205 | } | 250 | } |
| 206 | } else if (element == '查看密码') { | 251 | } else if (element == '查看密码') { |
| 207 | NavigatorUtil.goPersonnelPasswordPage(context, | 252 | NavigatorUtil.goPersonnelPasswordPage(context, |
| 208 | - account: widget.model.account, idstr: widget.model.id); | 253 | + account: data.account, idstr: data.id); |
| 209 | } | 254 | } |
| 210 | }, | 255 | }, |
| 211 | ), | 256 | ), |
| @@ -220,7 +265,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | @@ -220,7 +265,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | ||
| 220 | String id = Provider.of<UserModel>(context, listen: false).user.openid; | 265 | String id = Provider.of<UserModel>(context, listen: false).user.openid; |
| 221 | // https: //xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode/sellerid/商家ID/uid/当前账号ID | 266 | // https: //xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode/sellerid/商家ID/uid/当前账号ID |
| 222 | Response response = await DioUtil.getInstance().getDio().get( | 267 | Response response = await DioUtil.getInstance().getDio().get( |
| 223 | - "https://xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode?sellerid=$sid&uid=${widget.model.id}"); | 268 | + "https://xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode?sellerid=$sid&uid=${data.id}"); |
| 224 | // Response response = await DioUtil.getInstance().getDio().get( | 269 | // Response response = await DioUtil.getInstance().getDio().get( |
| 225 | // "https://xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode?sellerid=$sid&uid=$uid"); | 270 | // "https://xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode?sellerid=$sid&uid=$uid"); |
| 226 | // Response response = await DioUtil.getInstance().getDio().get( | 271 | // Response response = await DioUtil.getInstance().getDio().get( |
| @@ -252,140 +297,372 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | @@ -252,140 +297,372 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | ||
| 252 | return Scaffold( | 297 | return Scaffold( |
| 253 | backgroundColor: MyColours.color_ffffff, | 298 | backgroundColor: MyColours.color_ffffff, |
| 254 | appBar: SystemAppBar( | 299 | appBar: SystemAppBar( |
| 255 | - '店员详情', | 300 | + '员工详情', |
| 256 | onTap: () { | 301 | onTap: () { |
| 257 | Navigator.pop(context); | 302 | Navigator.pop(context); |
| 258 | }, | 303 | }, |
| 259 | ), | 304 | ), |
| 260 | - body: SingleChildScrollView( | ||
| 261 | - child: Column( | ||
| 262 | - children: [ | ||
| 263 | - Container( | ||
| 264 | - margin: EdgeInsets.all(ScreenUtil().setWidth(40)), | ||
| 265 | - child: Column( | ||
| 266 | - crossAxisAlignment: CrossAxisAlignment.center, | 305 | + body: Column(children: [ |
| 306 | + Expanded( | ||
| 307 | + child: SingleChildScrollView( | ||
| 308 | + child: Column( | ||
| 309 | + children: [ | ||
| 310 | + Stack( | ||
| 267 | children: [ | 311 | children: [ |
| 268 | - VEmptyView(40), | ||
| 269 | - widget.model.headimgurl != null && | ||
| 270 | - widget.model.headimgurl != 'null' | ||
| 271 | - ? CachedNetworkImage( | ||
| 272 | - imageUrl: widget.model.headimgurl, | ||
| 273 | - fit: BoxFit.cover, | ||
| 274 | - width: ScreenUtil().setWidth(38 * 2), | ||
| 275 | - height: ScreenUtil().setWidth(38 * 2), | ||
| 276 | - ) | ||
| 277 | - : Image.asset( | ||
| 278 | - Utils.getImgPath('touxiang'), | ||
| 279 | - fit: BoxFit.cover, | ||
| 280 | - width: ScreenUtil().setWidth(38 * 2), | ||
| 281 | - height: ScreenUtil().setWidth(38 * 2), | ||
| 282 | - ), | ||
| 283 | - VEmptyView(40), | ||
| 284 | - InkWell( | ||
| 285 | - onTap: () { | ||
| 286 | - if (canEdit) { | ||
| 287 | - DialogUtil.textfeildAlertDialog(context, | ||
| 288 | - title: '修改店员名称', | ||
| 289 | - text: nickName != '暂未设置名称' ? nickName : '', | ||
| 290 | - hintText: '输入店员名称', | ||
| 291 | - toast: '请输入店员名称', rCallback: (name) { | ||
| 292 | - _editAuthUser(name); | ||
| 293 | - }); | ||
| 294 | - } | ||
| 295 | - }, | ||
| 296 | - child: Row( | ||
| 297 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 298 | - children: [ | ||
| 299 | - Text( | ||
| 300 | - nickName, | ||
| 301 | - style: TextStyle( | ||
| 302 | - fontSize: ScreenUtil().setWidth(36), | ||
| 303 | - color: MyColours.color_333333), | ||
| 304 | - ), | ||
| 305 | - canEdit | ||
| 306 | - ? Padding( | ||
| 307 | - padding: EdgeInsets.only( | ||
| 308 | - left: ScreenUtil().setWidth(20)), | ||
| 309 | - child: Image.asset( | ||
| 310 | - Utils.getImgPath('yd_bianji'), | ||
| 311 | - width: ScreenUtil().setWidth(20), | ||
| 312 | - ), | ||
| 313 | - ) | ||
| 314 | - : SizedBox(), | 312 | + Container( |
| 313 | + padding: EdgeInsets.all(ScreenUtil().setWidth(16 * 2)), | ||
| 314 | + margin: EdgeInsets.only( | ||
| 315 | + top: ScreenUtil().setWidth(57 * 2), | ||
| 316 | + left: ScreenUtil().setWidth(40), | ||
| 317 | + right: ScreenUtil().setWidth(40)), | ||
| 318 | + // height: ScreenUtil().setWidth(154 * 2), | ||
| 319 | + decoration: BoxDecoration( | ||
| 320 | + color: MyColours.color_ffffff, | ||
| 321 | + boxShadow: [ | ||
| 322 | + // BoxShadow( | ||
| 323 | + // color: Color.fromRGBO(0, 0, 0, 0.4), | ||
| 324 | + // offset: Offset(0, ScreenUtil().setWidth(8)), | ||
| 325 | + // spreadRadius: ScreenUtil().setWidth(2), | ||
| 326 | + // blurRadius: ScreenUtil().setWidth(34)) | ||
| 327 | + BoxShadow( | ||
| 328 | + color: Color.fromRGBO(0, 0, 0, 0.1), | ||
| 329 | + offset: Offset(0, ScreenUtil().setWidth(8)), | ||
| 330 | + blurRadius: ScreenUtil().setWidth(20), | ||
| 331 | + spreadRadius: ScreenUtil().setWidth(1)) | ||
| 315 | ], | 332 | ], |
| 316 | - )), | ||
| 317 | - VEmptyView(40), | ||
| 318 | - canEdit | ||
| 319 | - ? InkWell( | ||
| 320 | - onTap: () { | ||
| 321 | - DialogUtil.textfeildAlertDialog(context, | ||
| 322 | - title: '修改手机号', | ||
| 323 | - text: phone != '添加手机号' ? phone : '', | ||
| 324 | - hintText: '输入手机号', | ||
| 325 | - keyboardType: TextInputType.number, | ||
| 326 | - toast: '请输入手机号', rCallback: (phone) { | ||
| 327 | - _bindPhoneSellerUser(phone); | ||
| 328 | - }); | ||
| 329 | - }, | ||
| 330 | - child: Padding( | ||
| 331 | - padding: EdgeInsets.only( | ||
| 332 | - bottom: ScreenUtil().setWidth(40)), | ||
| 333 | - child: Text( | ||
| 334 | - phone, | ||
| 335 | - style: TextStyle( | ||
| 336 | - fontSize: ScreenUtil().setWidth(28), | ||
| 337 | - color: MyColours.color_199095), | ||
| 338 | - ))) | ||
| 339 | - : widget.model.phone != null && | ||
| 340 | - widget.model.phone != 'null' | ||
| 341 | - ? Padding( | ||
| 342 | - padding: EdgeInsets.only( | ||
| 343 | - bottom: ScreenUtil().setWidth(40)), | ||
| 344 | - child: Text( | ||
| 345 | - widget.model.phone, | 333 | + borderRadius: |
| 334 | + BorderRadius.circular(ScreenUtil().setWidth(18))), | ||
| 335 | + child: Column( | ||
| 336 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 337 | + children: [ | ||
| 338 | + Align( | ||
| 339 | + alignment: Alignment.centerRight, | ||
| 340 | + child: RoundButton( | ||
| 341 | + text: '编辑资料', | ||
| 342 | + gradientStart: MyColours.color_ffffff, | ||
| 343 | + gradientEnd: MyColours.color_ffffff, | ||
| 344 | + borderColor: MyColours.color_438E93, | ||
| 345 | + width: ScreenUtil().setWidth(62 * 2), | ||
| 346 | + height: ScreenUtil().setWidth(21 * 2), | ||
| 347 | + fontSize: 24, | ||
| 348 | + isBold: false, | ||
| 349 | + textColor: MyColours.color_438E93, | ||
| 350 | + radius: ScreenUtil().setWidth(26 * 2), | ||
| 351 | + onPressed: () { | ||
| 352 | + NavigatorUtil.goPersonnalBaseInfoPage( | ||
| 353 | + context, data, widget.position); | ||
| 354 | + }), | ||
| 355 | + ), | ||
| 356 | + Column( | ||
| 357 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 358 | + children: [ | ||
| 359 | + VEmptyView(38), | ||
| 360 | + Text( | ||
| 361 | + '姓名: ${nickName == '暂未设置名称' ? '' : nickName}', | ||
| 362 | + style: TextStyle( | ||
| 363 | + fontSize: ScreenUtil().setSp(32), | ||
| 364 | + color: MyColours.color_515151), | ||
| 365 | + ), | ||
| 366 | + VEmptyView(26), | ||
| 367 | + Text( | ||
| 368 | + '电话: ${phone == '添加手机号' ? '' : phone}', | ||
| 369 | + style: TextStyle( | ||
| 370 | + fontSize: ScreenUtil().setSp(32), | ||
| 371 | + color: MyColours.color_515151), | ||
| 372 | + ), | ||
| 373 | + VEmptyView(6), | ||
| 374 | + ], | ||
| 375 | + ), | ||
| 376 | + VEmptyView(14), | ||
| 377 | + Row( | ||
| 378 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 379 | + children: [ | ||
| 380 | + data == null || | ||
| 381 | + data?.openid == null || | ||
| 382 | + data?.openid == 'null' | ||
| 383 | + ? SizedBox() | ||
| 384 | + : RoundButton( | ||
| 385 | + text: '已绑定微信', | ||
| 386 | + gradientStart: MyColours.color_438E93, | ||
| 387 | + gradientEnd: MyColours.color_438E93, | ||
| 388 | + borderColor: MyColours.color_438E93, | ||
| 389 | + width: ScreenUtil().setWidth(58 * 2), | ||
| 390 | + height: ScreenUtil().setWidth(18 * 2), | ||
| 391 | + fontSize: 20, | ||
| 392 | + isBold: false, | ||
| 393 | + textColor: MyColours.color_ffffff, | ||
| 394 | + radius: ScreenUtil().setWidth(10), | ||
| 395 | + onPressed: () {}), | ||
| 396 | + Text('${widget.position} 工号: ${data?.account}', | ||
| 346 | style: TextStyle( | 397 | style: TextStyle( |
| 347 | - fontSize: ScreenUtil().setWidth(28), | ||
| 348 | - color: MyColours.color_333333), | ||
| 349 | - )) | ||
| 350 | - : SizedBox(), | ||
| 351 | - | ||
| 352 | - Row( | ||
| 353 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 354 | - children: [ | ||
| 355 | - Text( | ||
| 356 | - Provider.of<UserModel>(context, listen: false) | ||
| 357 | - .user | ||
| 358 | - .sellername, | ||
| 359 | - style: TextStyle( | ||
| 360 | - fontSize: ScreenUtil().setWidth(30), | ||
| 361 | - color: MyColours.color_333333), | ||
| 362 | - ), | ||
| 363 | - HEmptyView(20), | ||
| 364 | - Text( | ||
| 365 | - widget.position, | ||
| 366 | - style: TextStyle( | ||
| 367 | - fontSize: ScreenUtil().setWidth(28), | ||
| 368 | - color: MyColours.color_199095), | ||
| 369 | - ), | ||
| 370 | - ], | ||
| 371 | - ), | ||
| 372 | - // MyDivider( | ||
| 373 | - // double.infinity, | ||
| 374 | - // ScreenUtil().setWidth(10), | ||
| 375 | - // color: Color.fromRGBO(235, 234, 239, 1), | ||
| 376 | - // ), | ||
| 377 | - VEmptyView(60), | ||
| 378 | - Wrap( | ||
| 379 | - spacing: ScreenUtil().setWidth(20), //主轴上子控件的间距 | ||
| 380 | - runSpacing: ScreenUtil().setWidth(20), //交叉轴上子控件之间的间距 | ||
| 381 | - children: _listWidget(btnList), //要显示的子控件集合 | 398 | + color: MyColours.color_515151, |
| 399 | + fontSize: ScreenUtil().setSp(28), | ||
| 400 | + )), | ||
| 401 | + ], | ||
| 402 | + ) | ||
| 403 | + ], | ||
| 404 | + ), | ||
| 382 | ), | 405 | ), |
| 406 | + Positioned( | ||
| 407 | + top: ScreenUtil().setWidth(13 * 2), | ||
| 408 | + left: ScreenUtil().setWidth(35 * 2), | ||
| 409 | + child: | ||
| 410 | + data?.headimgurl != null && data?.headimgurl != 'null' | ||
| 411 | + ? ClipRRect( | ||
| 412 | + borderRadius: BorderRadius.circular( | ||
| 413 | + ScreenUtil().setWidth(80)), | ||
| 414 | + child: CachedNetworkImage( | ||
| 415 | + imageUrl: data?.headimgurl, | ||
| 416 | + fit: BoxFit.cover, | ||
| 417 | + width: ScreenUtil().setWidth(80 * 2), | ||
| 418 | + height: ScreenUtil().setWidth(80 * 2), | ||
| 419 | + )) | ||
| 420 | + : Stack(alignment: Alignment.center, children: [ | ||
| 421 | + Container( | ||
| 422 | + width: ScreenUtil().setWidth(80 * 2), | ||
| 423 | + height: ScreenUtil().setWidth(80 * 2), | ||
| 424 | + decoration: BoxDecoration( | ||
| 425 | + color: MyColours.color_f3f3f3, | ||
| 426 | + borderRadius: BorderRadius.circular( | ||
| 427 | + ScreenUtil().setWidth(80)))), | ||
| 428 | + Align( | ||
| 429 | + alignment: Alignment.center, | ||
| 430 | + child: Image.asset( | ||
| 431 | + Utils.getImgPath('personnal_no_image'), | ||
| 432 | + fit: BoxFit.cover, | ||
| 433 | + width: ScreenUtil().setWidth(50 * 2), | ||
| 434 | + height: ScreenUtil().setWidth(50 * 2)), | ||
| 435 | + ), | ||
| 436 | + ]), | ||
| 437 | + ) | ||
| 383 | ], | 438 | ], |
| 384 | ), | 439 | ), |
| 385 | - ) | ||
| 386 | - ], | ||
| 387 | - ), | ||
| 388 | - ), | 440 | + VEmptyView(114), |
| 441 | + data?.openid == null || data?.openid == 'null' | ||
| 442 | + ? RoundButton( | ||
| 443 | + text: '绑定微信', | ||
| 444 | + gradientStart: MyColours.color_438E93, | ||
| 445 | + gradientEnd: MyColours.color_438E93, | ||
| 446 | + borderColor: MyColours.color_438E93, | ||
| 447 | + width: ScreenUtil().setWidth(80 * 2), | ||
| 448 | + height: ScreenUtil().setWidth(30 * 2), | ||
| 449 | + fontSize: 32, | ||
| 450 | + isBold: true, | ||
| 451 | + textColor: MyColours.color_ffffff, | ||
| 452 | + radius: ScreenUtil().setWidth(12), | ||
| 453 | + onPressed: () { | ||
| 454 | + if (dcAdduserCode != '' && dcAdduserCode != null) { | ||
| 455 | + DialogUtil.openAlertDialogImage( | ||
| 456 | + context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660); | ||
| 457 | + } else { | ||
| 458 | + _getWechatQrcode(need: true); | ||
| 459 | + } | ||
| 460 | + }) | ||
| 461 | + : SizedBox(), | ||
| 462 | + data?.openid == null || data?.openid == 'null' | ||
| 463 | + ? VEmptyView(48) | ||
| 464 | + : SizedBox(), | ||
| 465 | + InkWell( | ||
| 466 | + onTap: () { | ||
| 467 | + NavigatorUtil.goPersonnelPasswordEditPage(context, | ||
| 468 | + idstr: data.id); | ||
| 469 | + }, | ||
| 470 | + child: Text( | ||
| 471 | + '重置密码', | ||
| 472 | + style: TextStyle( | ||
| 473 | + decoration: TextDecoration.underline, | ||
| 474 | + color: MyColours.color_438E93, | ||
| 475 | + fontSize: ScreenUtil().setSp(28)), | ||
| 476 | + )), | ||
| 477 | + // Container( | ||
| 478 | + // margin: EdgeInsets.all(ScreenUtil().setWidth(40)), | ||
| 479 | + // child: Column( | ||
| 480 | + // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 481 | + // children: [ | ||
| 482 | + // VEmptyView(40), | ||
| 483 | + | ||
| 484 | + // data.headimgurl != null && | ||
| 485 | + // data.headimgurl != 'null' | ||
| 486 | + // ? ClipRRect( | ||
| 487 | + // borderRadius: BorderRadius.circular( | ||
| 488 | + // ScreenUtil().setWidth(80)), | ||
| 489 | + // child: CachedNetworkImage( | ||
| 490 | + // imageUrl: data.headimgurl, | ||
| 491 | + // fit: BoxFit.cover, | ||
| 492 | + // width: ScreenUtil().setWidth(80 * 2), | ||
| 493 | + // height: ScreenUtil().setWidth(80 * 2), | ||
| 494 | + // )) | ||
| 495 | + // : Stack(alignment: Alignment.center, children: [ | ||
| 496 | + // Container( | ||
| 497 | + // width: ScreenUtil().setWidth(80 * 2), | ||
| 498 | + // height: ScreenUtil().setWidth(80 * 2), | ||
| 499 | + // decoration: BoxDecoration( | ||
| 500 | + // color: MyColours.color_f3f3f3, | ||
| 501 | + // borderRadius: BorderRadius.circular( | ||
| 502 | + // ScreenUtil().setWidth(80)))), | ||
| 503 | + // Align( | ||
| 504 | + // alignment: Alignment.center, | ||
| 505 | + // child: Image.asset( | ||
| 506 | + // Utils.getImgPath('personnal_no_image'), | ||
| 507 | + // fit: BoxFit.cover, | ||
| 508 | + // width: ScreenUtil().setWidth(50 * 2), | ||
| 509 | + // height: ScreenUtil().setWidth(50 * 2)), | ||
| 510 | + // ), | ||
| 511 | + // ]), | ||
| 512 | + // VEmptyView(40), | ||
| 513 | + // InkWell( | ||
| 514 | + // onTap: () { | ||
| 515 | + // if (canEdit) { | ||
| 516 | + // DialogUtil.textfeildAlertDialog(context, | ||
| 517 | + // title: '修改店员名称', | ||
| 518 | + // text: nickName != '暂未设置名称' ? nickName : '', | ||
| 519 | + // hintText: '输入店员名称', | ||
| 520 | + // toast: '请输入店员名称', rCallback: (name) { | ||
| 521 | + // _editAuthUser(name); | ||
| 522 | + // }); | ||
| 523 | + // } | ||
| 524 | + // }, | ||
| 525 | + // child: Row( | ||
| 526 | + // mainAxisAlignment: MainAxisAlignment.center, | ||
| 527 | + // children: [ | ||
| 528 | + // Text( | ||
| 529 | + // nickName, | ||
| 530 | + // style: TextStyle( | ||
| 531 | + // fontSize: ScreenUtil().setWidth(36), | ||
| 532 | + // color: MyColours.color_333333), | ||
| 533 | + // ), | ||
| 534 | + // canEdit | ||
| 535 | + // ? Padding( | ||
| 536 | + // padding: EdgeInsets.only( | ||
| 537 | + // left: ScreenUtil().setWidth(20)), | ||
| 538 | + // child: Image.asset( | ||
| 539 | + // Utils.getImgPath('yd_bianji'), | ||
| 540 | + // width: ScreenUtil().setWidth(20), | ||
| 541 | + // ), | ||
| 542 | + // ) | ||
| 543 | + // : SizedBox(), | ||
| 544 | + // ], | ||
| 545 | + // )), | ||
| 546 | + // VEmptyView(40), | ||
| 547 | + // canEdit | ||
| 548 | + // ? InkWell( | ||
| 549 | + // onTap: () { | ||
| 550 | + // DialogUtil.textfeildAlertDialog(context, | ||
| 551 | + // title: '修改手机号', | ||
| 552 | + // text: phone != '添加手机号' ? phone : '', | ||
| 553 | + // hintText: '输入手机号', | ||
| 554 | + // keyboardType: TextInputType.number, | ||
| 555 | + // toast: '请输入手机号', rCallback: (phone) { | ||
| 556 | + // _bindPhoneSellerUser(phone); | ||
| 557 | + // }); | ||
| 558 | + // }, | ||
| 559 | + // child: Padding( | ||
| 560 | + // padding: EdgeInsets.only( | ||
| 561 | + // bottom: ScreenUtil().setWidth(40)), | ||
| 562 | + // child: Text( | ||
| 563 | + // phone, | ||
| 564 | + // style: TextStyle( | ||
| 565 | + // fontSize: ScreenUtil().setWidth(28), | ||
| 566 | + // color: MyColours.color_199095), | ||
| 567 | + // ))) | ||
| 568 | + // : data.phone != null && | ||
| 569 | + // data.phone != 'null' | ||
| 570 | + // ? Padding( | ||
| 571 | + // padding: EdgeInsets.only( | ||
| 572 | + // bottom: ScreenUtil().setWidth(40)), | ||
| 573 | + // child: Text( | ||
| 574 | + // data.phone, | ||
| 575 | + // style: TextStyle( | ||
| 576 | + // fontSize: ScreenUtil().setWidth(28), | ||
| 577 | + // color: MyColours.color_333333), | ||
| 578 | + // )) | ||
| 579 | + // : SizedBox(), | ||
| 580 | + | ||
| 581 | + // Row( | ||
| 582 | + // mainAxisAlignment: MainAxisAlignment.center, | ||
| 583 | + // children: [ | ||
| 584 | + // Text( | ||
| 585 | + // Provider.of<UserModel>(context, listen: false) | ||
| 586 | + // .user | ||
| 587 | + // .sellername, | ||
| 588 | + // style: TextStyle( | ||
| 589 | + // fontSize: ScreenUtil().setWidth(30), | ||
| 590 | + // color: MyColours.color_333333), | ||
| 591 | + // ), | ||
| 592 | + // HEmptyView(20), | ||
| 593 | + // Text( | ||
| 594 | + // widget.position, | ||
| 595 | + // style: TextStyle( | ||
| 596 | + // fontSize: ScreenUtil().setWidth(28), | ||
| 597 | + // color: MyColours.color_199095), | ||
| 598 | + // ), | ||
| 599 | + // ], | ||
| 600 | + // ), | ||
| 601 | + // // MyDivider( | ||
| 602 | + // // double.infinity, | ||
| 603 | + // // ScreenUtil().setWidth(10), | ||
| 604 | + // // color: Color.fromRGBO(235, 234, 239, 1), | ||
| 605 | + // // ), | ||
| 606 | + // VEmptyView(60), | ||
| 607 | + // Wrap( | ||
| 608 | + // spacing: ScreenUtil().setWidth(20), //主轴上子控件的间距 | ||
| 609 | + // runSpacing: ScreenUtil().setWidth(20), //交叉轴上子控件之间的间距 | ||
| 610 | + // children: _listWidget(btnList), //要显示的子控件集合 | ||
| 611 | + // ), | ||
| 612 | + // ], | ||
| 613 | + // ), | ||
| 614 | + // ) | ||
| 615 | + ], | ||
| 616 | + ), | ||
| 617 | + )), | ||
| 618 | + InkWell( | ||
| 619 | + onTap: () async { | ||
| 620 | + await DialogUtil.removePersonnalDialog( | ||
| 621 | + context, personnelProvider.sellerManageList, onTap: (map) { | ||
| 622 | + print(map); | ||
| 623 | + String uid = map['bjtype']; | ||
| 624 | + if (uid == '') { | ||
| 625 | + //选择了 全店未分配客户资源 | ||
| 626 | + } else { | ||
| 627 | + //选择了某个经理 | ||
| 628 | + } | ||
| 629 | + Future.wait<bool>([ | ||
| 630 | + // 2秒后返回结果 | ||
| 631 | + Future.delayed(new Duration(seconds: 2), () { | ||
| 632 | + return true; | ||
| 633 | + }), | ||
| 634 | + // 4秒后返回结果 | ||
| 635 | + _delSellerClerk() | ||
| 636 | + ]).then((results) { | ||
| 637 | + print(results[0]); | ||
| 638 | + if (results[1]) { | ||
| 639 | + //删除员工成功 | ||
| 640 | + EventBus().emit('personnel_manage_page'); | ||
| 641 | + Navigator.pop(context); | ||
| 642 | + } | ||
| 643 | + }).catchError((e) { | ||
| 644 | + print(e); | ||
| 645 | + }); | ||
| 646 | + | ||
| 647 | + // DialogUtil.cupertinoAlertDialog(context, | ||
| 648 | + // title: '提示', | ||
| 649 | + // content: '移除店员后,店员将无法接收门店收款通知,店员收款码也将无法收款', | ||
| 650 | + // rTitle: '移除', rCallback: () { | ||
| 651 | + // _delSellerClerk(); | ||
| 652 | + // }); | ||
| 653 | + }); | ||
| 654 | + }, | ||
| 655 | + child: Padding( | ||
| 656 | + padding: EdgeInsets.symmetric( | ||
| 657 | + vertical: ScreenUtil().setWidth(34 * 2)), | ||
| 658 | + child: Text( | ||
| 659 | + '移除员工', | ||
| 660 | + style: TextStyle( | ||
| 661 | + decoration: TextDecoration.underline, | ||
| 662 | + color: MyColours.color_438E93, | ||
| 663 | + fontSize: ScreenUtil().setSp(28)), | ||
| 664 | + ))), | ||
| 665 | + ]), | ||
| 389 | ); | 666 | ); |
| 390 | } | 667 | } |
| 391 | } | 668 | } |
| 1 | +// import 'dart:convert'; | ||
| 2 | + | ||
| 3 | +// import 'package:cached_network_image/cached_network_image.dart'; | ||
| 4 | +// import 'package:common_utils/common_utils.dart'; | ||
| 5 | +// import 'package:dio/dio.dart'; | ||
| 6 | +// import 'package:flutter/material.dart'; | ||
| 7 | +// import 'package:flutter_screenutil/screenutil.dart'; | ||
| 8 | +// import 'package:one_key/models/get_seller_info_model.dart'; | ||
| 9 | +// import 'package:one_key/models/personnel_manage_model.dart'; | ||
| 10 | +// import 'package:one_key/net/dio_util.dart'; | ||
| 11 | +// import 'package:one_key/provider/personnel_provider.dart'; | ||
| 12 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 13 | +// import 'package:one_key/res/colors.dart'; | ||
| 14 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 15 | +// import 'package:one_key/utils/dialog_util.dart'; | ||
| 16 | +// import 'package:one_key/utils/event_bus.dart'; | ||
| 17 | +// import 'package:one_key/utils/utils.dart'; | ||
| 18 | +// import 'package:one_key/widgets/MyDivider.dart'; | ||
| 19 | +// import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 20 | +// import 'package:one_key/widgets/round_button.dart'; | ||
| 21 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 22 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 23 | +// import 'package:provider/provider.dart'; | ||
| 24 | + | ||
| 25 | +// class PersonnelDetailPage extends StatefulWidget { | ||
| 26 | +// final PersonnelManageSunModel model; | ||
| 27 | +// final String position; | ||
| 28 | +// PersonnelDetailPage({Key key, this.model, this.position}) : super(key: key); | ||
| 29 | + | ||
| 30 | +// @override | ||
| 31 | +// _PersonnelDetailPageState createState() => _PersonnelDetailPageState(); | ||
| 32 | +// } | ||
| 33 | + | ||
| 34 | +// class _PersonnelDetailPageState extends State<PersonnelDetailPage> { | ||
| 35 | +// String roleNameLogin; | ||
| 36 | +// String accountLogin; | ||
| 37 | +// bool canEdit = false; | ||
| 38 | +// List<String> btnList = []; | ||
| 39 | +// UserModel userModel; | ||
| 40 | +// PersonnelProvider personnelProvider; | ||
| 41 | +// String nickName; | ||
| 42 | +// String phone; | ||
| 43 | +// String dcAdduserCode; | ||
| 44 | + | ||
| 45 | +// @override | ||
| 46 | +// void initState() { | ||
| 47 | +// super.initState(); | ||
| 48 | +// nickName = widget.model.nickName != null && widget.model.nickName != 'null' | ||
| 49 | +// ? widget.model.nickName | ||
| 50 | +// : '暂未设置名称'; | ||
| 51 | +// phone = widget.model.phone != null && widget.model.userName != 'null' | ||
| 52 | +// ? widget.model.phone | ||
| 53 | +// : '添加手机号'; | ||
| 54 | +// WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | ||
| 55 | +// if (widget.model.openid == null || widget.model.openid == 'null') { | ||
| 56 | +// // _getStoreBaseinfo(); | ||
| 57 | +// _getWechatQrcode(); | ||
| 58 | +// } | ||
| 59 | +// setState(() { | ||
| 60 | +// roleNameLogin = userModel.user.role_name; | ||
| 61 | +// accountLogin = userModel.user.account; | ||
| 62 | + | ||
| 63 | +// if (roleNameLogin == '管理员') { | ||
| 64 | +// canEdit = true; | ||
| 65 | +// } else if (roleNameLogin == '店长') { | ||
| 66 | +// if (widget.position == '管理员') { | ||
| 67 | +// canEdit = false; | ||
| 68 | +// } else if (widget.position == '店长') { | ||
| 69 | +// if (accountLogin == widget.model.account) { | ||
| 70 | +// print('11111'); | ||
| 71 | +// //店长自己 | ||
| 72 | +// canEdit = true; | ||
| 73 | +// } else { | ||
| 74 | +// print('333333'); | ||
| 75 | +// canEdit = false; | ||
| 76 | +// } | ||
| 77 | +// } else { | ||
| 78 | +// canEdit = true; | ||
| 79 | +// } | ||
| 80 | +// } else { | ||
| 81 | +// if (accountLogin == widget.model.account) { | ||
| 82 | +// //自己 | ||
| 83 | +// canEdit = true; | ||
| 84 | +// } else { | ||
| 85 | +// canEdit = false; | ||
| 86 | +// } | ||
| 87 | +// } | ||
| 88 | +// if (canEdit) { | ||
| 89 | +// btnList = [ | ||
| 90 | +// '移除店员', | ||
| 91 | +// ]; | ||
| 92 | +// if (widget.model.openid == null || widget.model.openid == 'null') { | ||
| 93 | +// btnList.add('绑定微信'); | ||
| 94 | +// } | ||
| 95 | +// btnList.add('查看密码'); | ||
| 96 | +// if (widget.model.isOnCall == '0') { | ||
| 97 | +// btnList.add('设为接单人'); | ||
| 98 | +// } | ||
| 99 | +// } else { | ||
| 100 | +// btnList = []; | ||
| 101 | +// } | ||
| 102 | +// }); | ||
| 103 | +// }); | ||
| 104 | +// } | ||
| 105 | + | ||
| 106 | +// ///获取店铺信息 | ||
| 107 | +// // _getStoreBaseinfo() async { | ||
| 108 | +// // GetSellerInfoSunModel itemModel = | ||
| 109 | +// // await personnelProvider.getSellerById(context); | ||
| 110 | +// // if (itemModel != null) { | ||
| 111 | +// // dcAdduserCode = itemModel.data.dcAdduserCode; | ||
| 112 | +// // } | ||
| 113 | +// // } | ||
| 114 | + | ||
| 115 | +// ///设置接单人 | ||
| 116 | +// _setUserIsCall({bool showLoading = true}) async { | ||
| 117 | +// Map<String, String> params = { | ||
| 118 | +// "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 119 | +// 'uid': widget.model.id | ||
| 120 | +// }; | ||
| 121 | + | ||
| 122 | +// bool success = await personnelProvider.setUserIsCall(context, params, | ||
| 123 | +// showLoading: showLoading); | ||
| 124 | +// if (success) { | ||
| 125 | +// Utils.showToast('设置成功'); | ||
| 126 | +// EventBus().emit('personnel_manage_page'); | ||
| 127 | +// //刷新页面 | ||
| 128 | +// setState(() { | ||
| 129 | +// btnList.remove('设为接单人'); | ||
| 130 | +// }); | ||
| 131 | +// } | ||
| 132 | +// } | ||
| 133 | + | ||
| 134 | +// ///删除店员 | ||
| 135 | +// _delSellerClerk({bool showLoading = true}) async { | ||
| 136 | +// Map<String, String> params = {'seller_user_id': widget.model.id}; | ||
| 137 | + | ||
| 138 | +// bool success = await personnelProvider.delSellerClerk(context, params, | ||
| 139 | +// showLoading: showLoading); | ||
| 140 | +// if (success) { | ||
| 141 | +// EventBus().emit('personnel_manage_page'); | ||
| 142 | +// Navigator.pop(context); | ||
| 143 | +// } | ||
| 144 | +// } | ||
| 145 | + | ||
| 146 | +// ///编辑店员 | ||
| 147 | +// _editAuthUser(String name, {bool showLoading = true}) async { | ||
| 148 | +// Map<String, String> params = {'id': widget.model.id, 'user_name': name}; | ||
| 149 | + | ||
| 150 | +// bool success = await personnelProvider.editAuthUser(context, params, | ||
| 151 | +// showLoading: showLoading); | ||
| 152 | +// if (success) { | ||
| 153 | +// EventBus().emit('personnel_manage_page'); | ||
| 154 | +// setState(() { | ||
| 155 | +// nickName = name; | ||
| 156 | +// }); | ||
| 157 | +// } | ||
| 158 | +// } | ||
| 159 | + | ||
| 160 | +// /// 账号表-员工绑定手机号 | ||
| 161 | +// _bindPhoneSellerUser(String name, {bool showLoading = true}) async { | ||
| 162 | +// Map<String, String> params = {'kid': widget.model.id, 'phone': name}; | ||
| 163 | + | ||
| 164 | +// bool success = await personnelProvider.bindPhoneSellerUser(context, params, | ||
| 165 | +// showLoading: showLoading); | ||
| 166 | +// if (success) { | ||
| 167 | +// EventBus().emit('personnel_manage_page'); | ||
| 168 | +// setState(() { | ||
| 169 | +// phone = name; | ||
| 170 | +// }); | ||
| 171 | +// } | ||
| 172 | +// } | ||
| 173 | + | ||
| 174 | +// List<Widget> _listWidget(List<String> titleList) { | ||
| 175 | +// List<Widget> list = []; | ||
| 176 | +// titleList.forEach((element) { | ||
| 177 | +// list.add( | ||
| 178 | +// RoundButton( | ||
| 179 | +// text: element, | ||
| 180 | +// fontSize: 30, | ||
| 181 | +// isBold: false, | ||
| 182 | +// height: ScreenUtil().setWidth(80), | ||
| 183 | +// // width: double.infinity, | ||
| 184 | +// width: (ScreenUtil.screenWidthDp - ScreenUtil().setWidth(140)) / 2, | ||
| 185 | +// radius: ScreenUtil().setWidth(10), | ||
| 186 | +// onPressed: () { | ||
| 187 | +// if (element == '设为接单人') { | ||
| 188 | +// DialogUtil.cupertinoAlertDialog(context, | ||
| 189 | +// content: '请确认该用户关注了周到安排公众号并填写了手机号,否则无法接单', rCallback: () { | ||
| 190 | +// _setUserIsCall(); | ||
| 191 | +// }); | ||
| 192 | +// } else if (element == '移除店员') { | ||
| 193 | +// DialogUtil.cupertinoAlertDialog(context, | ||
| 194 | +// title: '提示', | ||
| 195 | +// content: '移除店员后,店员将无法接收门店收款通知,店员收款码也将无法收款', | ||
| 196 | +// rTitle: '移除', rCallback: () { | ||
| 197 | +// _delSellerClerk(); | ||
| 198 | +// }); | ||
| 199 | +// } else if (element == '绑定微信') { | ||
| 200 | +// if (dcAdduserCode != '' && dcAdduserCode != null) { | ||
| 201 | +// DialogUtil.openAlertDialogImage( | ||
| 202 | +// context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660); | ||
| 203 | +// } else { | ||
| 204 | +// _getWechatQrcode(need: true); | ||
| 205 | +// } | ||
| 206 | +// } else if (element == '查看密码') { | ||
| 207 | +// NavigatorUtil.goPersonnelPasswordPage(context, | ||
| 208 | +// account: widget.model.account, idstr: widget.model.id); | ||
| 209 | +// } | ||
| 210 | +// }, | ||
| 211 | +// ), | ||
| 212 | +// ); | ||
| 213 | +// }); | ||
| 214 | +// return list; | ||
| 215 | +// } | ||
| 216 | + | ||
| 217 | +// ///获取二维码 | ||
| 218 | +// _getWechatQrcode({bool need = false}) async { | ||
| 219 | +// String sid = Provider.of<UserModel>(context, listen: false).user.sellerid; | ||
| 220 | +// String id = Provider.of<UserModel>(context, listen: false).user.openid; | ||
| 221 | +// // https: //xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode/sellerid/商家ID/uid/当前账号ID | ||
| 222 | +// Response response = await DioUtil.getInstance().getDio().get( | ||
| 223 | +// "https://xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode?sellerid=$sid&uid=${widget.model.id}"); | ||
| 224 | +// // Response response = await DioUtil.getInstance().getDio().get( | ||
| 225 | +// // "https://xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode?sellerid=$sid&uid=$uid"); | ||
| 226 | +// // Response response = await DioUtil.getInstance().getDio().get( | ||
| 227 | +// // "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx85aa3cdd0f791e65&secret=87c9a23c2e6032b2da75af6b0efc5424&code=$code&grant_type=authorization_code"); | ||
| 228 | +// LogUtil.v("access_token:${response.toString()}"); | ||
| 229 | +// Map<String, dynamic> responseData = json.decode(response.toString()); | ||
| 230 | +// print(responseData); | ||
| 231 | +// dcAdduserCode = responseData["data"]; | ||
| 232 | +// if (need) { | ||
| 233 | +// if (dcAdduserCode == null || dcAdduserCode == '') { | ||
| 234 | +// Utils.showToast('二维码获取失败'); | ||
| 235 | +// } else { | ||
| 236 | +// DialogUtil.openAlertDialogImage( | ||
| 237 | +// context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660); | ||
| 238 | +// } | ||
| 239 | +// } | ||
| 240 | + | ||
| 241 | +// print(dcAdduserCode); | ||
| 242 | +// // if (responseData["data"] != null) { | ||
| 243 | +// // // Utils.showToast(responseData["errmsg"] ?? "登录失败,请稍后重试"); | ||
| 244 | +// // // Loading.hideLoading(context); | ||
| 245 | +// // } else {} | ||
| 246 | +// } | ||
| 247 | + | ||
| 248 | +// @override | ||
| 249 | +// Widget build(BuildContext context) { | ||
| 250 | +// userModel = Provider.of<UserModel>(context, listen: false); | ||
| 251 | +// personnelProvider = Provider.of<PersonnelProvider>(context, listen: true); | ||
| 252 | +// return Scaffold( | ||
| 253 | +// backgroundColor: MyColours.color_ffffff, | ||
| 254 | +// appBar: SystemAppBar( | ||
| 255 | +// '店员详情', | ||
| 256 | +// onTap: () { | ||
| 257 | +// Navigator.pop(context); | ||
| 258 | +// }, | ||
| 259 | +// ), | ||
| 260 | +// body: SingleChildScrollView( | ||
| 261 | +// child: Column( | ||
| 262 | +// children: [ | ||
| 263 | +// Container( | ||
| 264 | +// margin: EdgeInsets.all(ScreenUtil().setWidth(40)), | ||
| 265 | +// child: Column( | ||
| 266 | +// crossAxisAlignment: CrossAxisAlignment.center, | ||
| 267 | +// children: [ | ||
| 268 | +// VEmptyView(40), | ||
| 269 | +// widget.model.headimgurl != null && | ||
| 270 | +// widget.model.headimgurl != 'null' | ||
| 271 | +// ? CachedNetworkImage( | ||
| 272 | +// imageUrl: widget.model.headimgurl, | ||
| 273 | +// fit: BoxFit.cover, | ||
| 274 | +// width: ScreenUtil().setWidth(38 * 2), | ||
| 275 | +// height: ScreenUtil().setWidth(38 * 2), | ||
| 276 | +// ) | ||
| 277 | +// : Image.asset( | ||
| 278 | +// Utils.getImgPath('touxiang'), | ||
| 279 | +// fit: BoxFit.cover, | ||
| 280 | +// width: ScreenUtil().setWidth(38 * 2), | ||
| 281 | +// height: ScreenUtil().setWidth(38 * 2), | ||
| 282 | +// ), | ||
| 283 | +// VEmptyView(40), | ||
| 284 | +// InkWell( | ||
| 285 | +// onTap: () { | ||
| 286 | +// if (canEdit) { | ||
| 287 | +// DialogUtil.textfeildAlertDialog(context, | ||
| 288 | +// title: '修改店员名称', | ||
| 289 | +// text: nickName != '暂未设置名称' ? nickName : '', | ||
| 290 | +// hintText: '输入店员名称', | ||
| 291 | +// toast: '请输入店员名称', rCallback: (name) { | ||
| 292 | +// _editAuthUser(name); | ||
| 293 | +// }); | ||
| 294 | +// } | ||
| 295 | +// }, | ||
| 296 | +// child: Row( | ||
| 297 | +// mainAxisAlignment: MainAxisAlignment.center, | ||
| 298 | +// children: [ | ||
| 299 | +// Text( | ||
| 300 | +// nickName, | ||
| 301 | +// style: TextStyle( | ||
| 302 | +// fontSize: ScreenUtil().setWidth(36), | ||
| 303 | +// color: MyColours.color_333333), | ||
| 304 | +// ), | ||
| 305 | +// canEdit | ||
| 306 | +// ? Padding( | ||
| 307 | +// padding: EdgeInsets.only( | ||
| 308 | +// left: ScreenUtil().setWidth(20)), | ||
| 309 | +// child: Image.asset( | ||
| 310 | +// Utils.getImgPath('yd_bianji'), | ||
| 311 | +// width: ScreenUtil().setWidth(20), | ||
| 312 | +// ), | ||
| 313 | +// ) | ||
| 314 | +// : SizedBox(), | ||
| 315 | +// ], | ||
| 316 | +// )), | ||
| 317 | +// VEmptyView(40), | ||
| 318 | +// canEdit | ||
| 319 | +// ? InkWell( | ||
| 320 | +// onTap: () { | ||
| 321 | +// DialogUtil.textfeildAlertDialog(context, | ||
| 322 | +// title: '修改手机号', | ||
| 323 | +// text: phone != '添加手机号' ? phone : '', | ||
| 324 | +// hintText: '输入手机号', | ||
| 325 | +// keyboardType: TextInputType.number, | ||
| 326 | +// toast: '请输入手机号', rCallback: (phone) { | ||
| 327 | +// _bindPhoneSellerUser(phone); | ||
| 328 | +// }); | ||
| 329 | +// }, | ||
| 330 | +// child: Padding( | ||
| 331 | +// padding: EdgeInsets.only( | ||
| 332 | +// bottom: ScreenUtil().setWidth(40)), | ||
| 333 | +// child: Text( | ||
| 334 | +// phone, | ||
| 335 | +// style: TextStyle( | ||
| 336 | +// fontSize: ScreenUtil().setWidth(28), | ||
| 337 | +// color: MyColours.color_199095), | ||
| 338 | +// ))) | ||
| 339 | +// : widget.model.phone != null && | ||
| 340 | +// widget.model.phone != 'null' | ||
| 341 | +// ? Padding( | ||
| 342 | +// padding: EdgeInsets.only( | ||
| 343 | +// bottom: ScreenUtil().setWidth(40)), | ||
| 344 | +// child: Text( | ||
| 345 | +// widget.model.phone, | ||
| 346 | +// style: TextStyle( | ||
| 347 | +// fontSize: ScreenUtil().setWidth(28), | ||
| 348 | +// color: MyColours.color_333333), | ||
| 349 | +// )) | ||
| 350 | +// : SizedBox(), | ||
| 351 | + | ||
| 352 | +// Row( | ||
| 353 | +// mainAxisAlignment: MainAxisAlignment.center, | ||
| 354 | +// children: [ | ||
| 355 | +// Text( | ||
| 356 | +// Provider.of<UserModel>(context, listen: false) | ||
| 357 | +// .user | ||
| 358 | +// .sellername, | ||
| 359 | +// style: TextStyle( | ||
| 360 | +// fontSize: ScreenUtil().setWidth(30), | ||
| 361 | +// color: MyColours.color_333333), | ||
| 362 | +// ), | ||
| 363 | +// HEmptyView(20), | ||
| 364 | +// Text( | ||
| 365 | +// widget.position, | ||
| 366 | +// style: TextStyle( | ||
| 367 | +// fontSize: ScreenUtil().setWidth(28), | ||
| 368 | +// color: MyColours.color_199095), | ||
| 369 | +// ), | ||
| 370 | +// ], | ||
| 371 | +// ), | ||
| 372 | +// // MyDivider( | ||
| 373 | +// // double.infinity, | ||
| 374 | +// // ScreenUtil().setWidth(10), | ||
| 375 | +// // color: Color.fromRGBO(235, 234, 239, 1), | ||
| 376 | +// // ), | ||
| 377 | +// VEmptyView(60), | ||
| 378 | +// Wrap( | ||
| 379 | +// spacing: ScreenUtil().setWidth(20), //主轴上子控件的间距 | ||
| 380 | +// runSpacing: ScreenUtil().setWidth(20), //交叉轴上子控件之间的间距 | ||
| 381 | +// children: _listWidget(btnList), //要显示的子控件集合 | ||
| 382 | +// ), | ||
| 383 | +// ], | ||
| 384 | +// ), | ||
| 385 | +// ) | ||
| 386 | +// ], | ||
| 387 | +// ), | ||
| 388 | +// ), | ||
| 389 | +// ); | ||
| 390 | +// } | ||
| 391 | +// } |
| 1 | +import 'dart:ffi'; | ||
| 2 | + | ||
| 1 | import 'package:cached_network_image/cached_network_image.dart'; | 3 | import 'package:cached_network_image/cached_network_image.dart'; |
| 2 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter_screenutil/screenutil.dart'; | 5 | import 'package:flutter_screenutil/screenutil.dart'; |
| @@ -10,7 +12,9 @@ import 'package:one_key/utils/event_bus.dart'; | @@ -10,7 +12,9 @@ import 'package:one_key/utils/event_bus.dart'; | ||
| 10 | import 'package:one_key/utils/utils.dart'; | 12 | import 'package:one_key/utils/utils.dart'; |
| 11 | import 'package:one_key/widgets/MyDivider.dart'; | 13 | import 'package:one_key/widgets/MyDivider.dart'; |
| 12 | import 'package:one_key/widgets/h_empty_view.dart'; | 14 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 15 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 13 | import 'package:one_key/widgets/system_app_bar.dart'; | 16 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 17 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 14 | import 'package:provider/provider.dart'; | 18 | import 'package:provider/provider.dart'; |
| 15 | 19 | ||
| 16 | class PersonnelManagePage extends StatefulWidget { | 20 | class PersonnelManagePage extends StatefulWidget { |
| @@ -77,7 +81,7 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { | @@ -77,7 +81,7 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { | ||
| 77 | return Scaffold( | 81 | return Scaffold( |
| 78 | backgroundColor: MyColours.color_ffffff, | 82 | backgroundColor: MyColours.color_ffffff, |
| 79 | appBar: SystemAppBar( | 83 | appBar: SystemAppBar( |
| 80 | - '员工与职级管理', | 84 | + '员工管理', |
| 81 | onTap: () { | 85 | onTap: () { |
| 82 | EventBus().emit('changeStatusColor'); | 86 | EventBus().emit('changeStatusColor'); |
| 83 | Navigator.of(context).pop(); | 87 | Navigator.of(context).pop(); |
| @@ -95,27 +99,68 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { | @@ -95,27 +99,68 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { | ||
| 95 | itemBuilder: (BuildContext context, int index) { | 99 | itemBuilder: (BuildContext context, int index) { |
| 96 | String title = titleList[index]; | 100 | String title = titleList[index]; |
| 97 | List<PersonnelManageSunModel> data = []; | 101 | List<PersonnelManageSunModel> data = []; |
| 102 | + String hasWechatNum = ''; | ||
| 98 | String roleId = ''; | 103 | String roleId = ''; |
| 104 | + bool canAdd = false; //是否可新增员工 | ||
| 105 | + if (Provider.of<UserModel>(context, listen: false) | ||
| 106 | + .user | ||
| 107 | + .role_name == | ||
| 108 | + '管理员') { | ||
| 109 | + if (title != '管理员') { | ||
| 110 | + canAdd = true; | ||
| 111 | + } | ||
| 112 | + } else if (Provider.of<UserModel>(context, listen: false) | ||
| 113 | + .user | ||
| 114 | + .role_name == | ||
| 115 | + '店长') { | ||
| 116 | + if (title != '管理员' && title != '店长') { | ||
| 117 | + canAdd = true; | ||
| 118 | + } | ||
| 119 | + } else if (Provider.of<UserModel>(context, listen: false) | ||
| 120 | + .user | ||
| 121 | + .role_name == | ||
| 122 | + '客户经理') { | ||
| 123 | + if (title != '管理员' && title != '店长' && title != '客户经理') { | ||
| 124 | + canAdd = true; | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + | ||
| 99 | if (personnelProvider.dataMap != null) { | 128 | if (personnelProvider.dataMap != null) { |
| 100 | if (title == '管理员') { | 129 | if (title == '管理员') { |
| 101 | data = personnelProvider.dataMap.admin.listdata; | 130 | data = personnelProvider.dataMap.admin.listdata; |
| 102 | roleId = personnelProvider.dataMap.admin.roleId; | 131 | roleId = personnelProvider.dataMap.admin.roleId; |
| 132 | + hasWechatNum = personnelProvider | ||
| 133 | + .dataMap.admin.hasWechatNum | ||
| 134 | + .toString(); | ||
| 103 | } else if (title == '店长') { | 135 | } else if (title == '店长') { |
| 104 | data = personnelProvider.dataMap.shopowner.listdata; | 136 | data = personnelProvider.dataMap.shopowner.listdata; |
| 105 | roleId = personnelProvider.dataMap.shopowner.roleId; | 137 | roleId = personnelProvider.dataMap.shopowner.roleId; |
| 138 | + hasWechatNum = personnelProvider | ||
| 139 | + .dataMap.shopowner.hasWechatNum | ||
| 140 | + .toString(); | ||
| 106 | } else if (title == '客户经理') { | 141 | } else if (title == '客户经理') { |
| 107 | data = personnelProvider.dataMap.manager.listdata; | 142 | data = personnelProvider.dataMap.manager.listdata; |
| 108 | roleId = personnelProvider.dataMap.manager.roleId; | 143 | roleId = personnelProvider.dataMap.manager.roleId; |
| 144 | + hasWechatNum = personnelProvider | ||
| 145 | + .dataMap.manager.hasWechatNum | ||
| 146 | + .toString(); | ||
| 109 | } else if (title == '收银员') { | 147 | } else if (title == '收银员') { |
| 110 | data = personnelProvider.dataMap.cashier.listdata; | 148 | data = personnelProvider.dataMap.cashier.listdata; |
| 111 | roleId = personnelProvider.dataMap.cashier.roleId; | 149 | roleId = personnelProvider.dataMap.cashier.roleId; |
| 150 | + hasWechatNum = personnelProvider | ||
| 151 | + .dataMap.cashier.hasWechatNum | ||
| 152 | + .toString(); | ||
| 112 | } else if (title == '服务员') { | 153 | } else if (title == '服务员') { |
| 113 | data = personnelProvider.dataMap.waiter.listdata; | 154 | data = personnelProvider.dataMap.waiter.listdata; |
| 114 | roleId = personnelProvider.dataMap.waiter.roleId; | 155 | roleId = personnelProvider.dataMap.waiter.roleId; |
| 156 | + hasWechatNum = personnelProvider | ||
| 157 | + .dataMap.waiter.hasWechatNum | ||
| 158 | + .toString(); | ||
| 115 | } | 159 | } |
| 116 | } | 160 | } |
| 117 | 161 | ||
| 118 | return Column( | 162 | return Column( |
| 163 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 119 | children: [ | 164 | children: [ |
| 120 | InkWell( | 165 | InkWell( |
| 121 | onTap: () { | 166 | onTap: () { |
| @@ -133,139 +178,314 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { | @@ -133,139 +178,314 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { | ||
| 133 | _addSellerClerk(roleId); | 178 | _addSellerClerk(roleId); |
| 134 | } | 179 | } |
| 135 | }, | 180 | }, |
| 136 | - child: Padding( | 181 | + child: Container( |
| 182 | + color: MyColours.color_f3f3f3, | ||
| 183 | + height: ScreenUtil().setWidth(60), | ||
| 137 | padding: EdgeInsets.symmetric( | 184 | padding: EdgeInsets.symmetric( |
| 138 | - horizontal: ScreenUtil().setWidth(40), | ||
| 139 | - vertical: ScreenUtil().setWidth(40)), | 185 | + horizontal: ScreenUtil().setWidth(36), |
| 186 | + ), | ||
| 140 | child: Row( | 187 | child: Row( |
| 141 | mainAxisAlignment: | 188 | mainAxisAlignment: |
| 142 | MainAxisAlignment.spaceBetween, | 189 | MainAxisAlignment.spaceBetween, |
| 143 | children: [ | 190 | children: [ |
| 144 | - Text( | ||
| 145 | - title == '管理员' | ||
| 146 | - ? '${title}' | ||
| 147 | - : '${title} (${data.length}人)', | ||
| 148 | - style: TextStyle( | ||
| 149 | - fontSize: ScreenUtil().setWidth(28), | ||
| 150 | - color: MyColours.color_333333), | ||
| 151 | - ), | ||
| 152 | - title == '管理员' | ||
| 153 | - ? SizedBox() | ||
| 154 | - : Provider.of<UserModel>(context, | ||
| 155 | - listen: false) | ||
| 156 | - .user | ||
| 157 | - .role_name == | ||
| 158 | - '管理员' || | ||
| 159 | - (Provider.of<UserModel>(context, | ||
| 160 | - listen: false) | ||
| 161 | - .user | ||
| 162 | - .role_name == | ||
| 163 | - '店长' && | ||
| 164 | - title != '店长') | ||
| 165 | - ? InkWell( | ||
| 166 | - onTap: () { | ||
| 167 | - _addSellerClerk(roleId); | ||
| 168 | - }, | ||
| 169 | - child: Text( | ||
| 170 | - '添加', | 191 | + // Text( |
| 192 | + // title == '管理员' | ||
| 193 | + // ? '${title}' | ||
| 194 | + // : '${title} (${data.length}/${data.length}人)', | ||
| 195 | + // style: TextStyle( | ||
| 196 | + // fontSize: ScreenUtil().setWidth(36), | ||
| 197 | + // color: MyColours.color_515151), | ||
| 198 | + // ), | ||
| 199 | + RichText( | ||
| 200 | + text: TextSpan( | ||
| 201 | + // style: TextStyle( | ||
| 202 | + // fontSize: ScreenUtil().setSp(36), | ||
| 203 | + // color: MyColours.color_515151), | ||
| 204 | + children: [ | ||
| 205 | + // const TextSpan(text: '('), | ||
| 206 | + TextSpan( | ||
| 207 | + text: '${title}', | ||
| 208 | + style: TextStyle( | ||
| 209 | + fontWeight: FontWeight.bold, | ||
| 210 | + fontSize: | ||
| 211 | + ScreenUtil().setSp(36), | ||
| 212 | + color: MyColours.color_515151)), | ||
| 213 | + title == '管理员' | ||
| 214 | + ? TextSpan(text: '') | ||
| 215 | + : TextSpan( | ||
| 216 | + text: | ||
| 217 | + ' ${hasWechatNum}/${data.length}', | ||
| 171 | style: TextStyle( | 218 | style: TextStyle( |
| 172 | - fontSize: ScreenUtil() | ||
| 173 | - .setWidth(30), | ||
| 174 | - color: | ||
| 175 | - MyColours.color_199095), | ||
| 176 | - ), | ||
| 177 | - ) | ||
| 178 | - : SizedBox() | 219 | + fontSize: |
| 220 | + ScreenUtil().setSp(28), | ||
| 221 | + color: MyColours | ||
| 222 | + .color_999999)), | ||
| 223 | + ])), | ||
| 179 | ], | 224 | ], |
| 180 | ))), | 225 | ))), |
| 181 | - MyDivider( | ||
| 182 | - double.infinity, | ||
| 183 | - ScreenUtil().setWidth(2), | ||
| 184 | - color: MyColours.color_f3f3f3, | ||
| 185 | - ), | 226 | + // MyDivider( |
| 227 | + // double.infinity, | ||
| 228 | + // ScreenUtil().setWidth(2), | ||
| 229 | + // color: MyColours.color_f3f3f3, | ||
| 230 | + // ), | ||
| 186 | ListView.builder( | 231 | ListView.builder( |
| 232 | + padding: EdgeInsets.only( | ||
| 233 | + top: ScreenUtil().setWidth(42), | ||
| 234 | + left: ScreenUtil().setWidth(48), | ||
| 235 | + right: ScreenUtil().setWidth(48), | ||
| 236 | + bottom: ScreenUtil().setWidth(20), | ||
| 237 | + ), | ||
| 187 | physics: NeverScrollableScrollPhysics(), | 238 | physics: NeverScrollableScrollPhysics(), |
| 188 | itemCount: data.length, | 239 | itemCount: data.length, |
| 189 | shrinkWrap: true, | 240 | shrinkWrap: true, |
| 190 | controller: _scrollController, | 241 | controller: _scrollController, |
| 191 | itemBuilder: (BuildContext context, int index) { | 242 | itemBuilder: (BuildContext context, int index) { |
| 192 | PersonnelManageSunModel model = data[index]; | 243 | PersonnelManageSunModel model = data[index]; |
| 244 | + bool isWechat = | ||
| 245 | + model.openid == null || model.openid == 'null' | ||
| 246 | + ? false | ||
| 247 | + : true; | ||
| 248 | + bool canIn = false; //是否可进入员工详情 | ||
| 249 | + | ||
| 250 | + if (Provider.of<UserModel>(context, listen: false) | ||
| 251 | + .user | ||
| 252 | + .role_name == | ||
| 253 | + '管理员') { | ||
| 254 | + canIn = true; | ||
| 255 | + } else if (Provider.of<UserModel>(context, | ||
| 256 | + listen: false) | ||
| 257 | + .user | ||
| 258 | + .role_name == | ||
| 259 | + '店长') { | ||
| 260 | + if (title == '管理员') { | ||
| 261 | + canIn = false; | ||
| 262 | + } else if (title == '店长') { | ||
| 263 | + canIn = false; | ||
| 264 | + if (Provider.of<UserModel>(context, | ||
| 265 | + listen: false) | ||
| 266 | + .user | ||
| 267 | + .account == | ||
| 268 | + model.account) { | ||
| 269 | + canIn = true; | ||
| 270 | + } | ||
| 271 | + } else { | ||
| 272 | + canIn = true; | ||
| 273 | + } | ||
| 274 | + } else if (Provider.of<UserModel>(context, | ||
| 275 | + listen: false) | ||
| 276 | + .user | ||
| 277 | + .role_name == | ||
| 278 | + '客户经理') { | ||
| 279 | + if (title == '管理员') { | ||
| 280 | + canIn = false; | ||
| 281 | + } else if (title == '店长') { | ||
| 282 | + canIn = false; | ||
| 283 | + } else if (title == '客户经理') { | ||
| 284 | + canIn = false; | ||
| 285 | + if (Provider.of<UserModel>(context, | ||
| 286 | + listen: false) | ||
| 287 | + .user | ||
| 288 | + .account == | ||
| 289 | + model.account) { | ||
| 290 | + canIn = true; | ||
| 291 | + } | ||
| 292 | + } else { | ||
| 293 | + canIn = true; | ||
| 294 | + } | ||
| 295 | + } else { | ||
| 296 | + canIn = false; | ||
| 297 | + if (Provider.of<UserModel>(context, listen: false) | ||
| 298 | + .user | ||
| 299 | + .account == | ||
| 300 | + model.account) { | ||
| 301 | + canIn = true; | ||
| 302 | + } | ||
| 303 | + } | ||
| 193 | return InkWell( | 304 | return InkWell( |
| 194 | onTap: () { | 305 | onTap: () { |
| 195 | - NavigatorUtil.goPersonnelDetailPage(context, | ||
| 196 | - model: model, position: title); | 306 | + if (canIn) { |
| 307 | + NavigatorUtil.goPersonnelDetailPage(context, | ||
| 308 | + index: index, position: title); | ||
| 309 | + } | ||
| 197 | }, | 310 | }, |
| 198 | child: Stack(children: [ | 311 | child: Stack(children: [ |
| 199 | Column(children: [ | 312 | Column(children: [ |
| 200 | Padding( | 313 | Padding( |
| 201 | - padding: EdgeInsets.symmetric( | ||
| 202 | - vertical: ScreenUtil().setWidth(20), | ||
| 203 | - horizontal: | ||
| 204 | - ScreenUtil().setWidth(40)), | 314 | + padding: EdgeInsets.only( |
| 315 | + bottom: ScreenUtil().setWidth(44), | ||
| 316 | + ), | ||
| 205 | child: Row( | 317 | child: Row( |
| 206 | children: [ | 318 | children: [ |
| 207 | - ClipRRect( | ||
| 208 | - borderRadius: | ||
| 209 | - BorderRadius.circular( | ||
| 210 | - ScreenUtil() | ||
| 211 | - .setWidth(38)), | ||
| 212 | - child: model.headimgurl != | ||
| 213 | - null && | ||
| 214 | - model.headimgurl != | ||
| 215 | - 'null' | ||
| 216 | - ? CachedNetworkImage( | ||
| 217 | - imageUrl: | ||
| 218 | - model.headimgurl, | ||
| 219 | - fit: BoxFit.cover, | ||
| 220 | - width: ScreenUtil() | ||
| 221 | - .setWidth(38 * 2), | ||
| 222 | - height: ScreenUtil() | ||
| 223 | - .setWidth(38 * 2), | 319 | + model.headimgurl != null && |
| 320 | + model.headimgurl != 'null' | ||
| 321 | + ? ClipRRect( | ||
| 322 | + borderRadius: | ||
| 323 | + BorderRadius.circular( | ||
| 324 | + ScreenUtil() | ||
| 325 | + .setWidth(42)), | ||
| 326 | + child: CachedNetworkImage( | ||
| 327 | + imageUrl: | ||
| 328 | + model.headimgurl, | ||
| 329 | + fit: BoxFit.cover, | ||
| 330 | + width: ScreenUtil() | ||
| 331 | + .setWidth(42 * 2), | ||
| 332 | + height: ScreenUtil() | ||
| 333 | + .setWidth(42 * 2), | ||
| 334 | + )) | ||
| 335 | + : Stack( | ||
| 336 | + alignment: Alignment.center, | ||
| 337 | + children: [ | ||
| 338 | + Container( | ||
| 339 | + width: ScreenUtil() | ||
| 340 | + .setWidth( | ||
| 341 | + 42 * 2), | ||
| 342 | + height: ScreenUtil() | ||
| 343 | + .setWidth( | ||
| 344 | + 42 * 2), | ||
| 345 | + decoration: BoxDecoration( | ||
| 346 | + color: MyColours | ||
| 347 | + .color_f3f3f3, | ||
| 348 | + borderRadius: BorderRadius.circular( | ||
| 349 | + ScreenUtil() | ||
| 350 | + .setWidth( | ||
| 351 | + 42)))), | ||
| 352 | + Align( | ||
| 353 | + alignment: | ||
| 354 | + Alignment.center, | ||
| 355 | + child: Image.asset( | ||
| 356 | + Utils.getImgPath( | ||
| 357 | + 'personnal_no_image'), | ||
| 358 | + fit: BoxFit.cover, | ||
| 359 | + width: ScreenUtil() | ||
| 360 | + .setWidth( | ||
| 361 | + 20 * 2), | ||
| 362 | + height: ScreenUtil() | ||
| 363 | + .setWidth( | ||
| 364 | + 20 * 2)), | ||
| 365 | + ), | ||
| 366 | + ]), | ||
| 367 | + HEmptyView(32), | ||
| 368 | + Column( | ||
| 369 | + crossAxisAlignment: | ||
| 370 | + CrossAxisAlignment.start, | ||
| 371 | + mainAxisAlignment: | ||
| 372 | + MainAxisAlignment.center, | ||
| 373 | + children: [ | ||
| 374 | + Row( | ||
| 375 | + mainAxisAlignment: | ||
| 376 | + MainAxisAlignment.start, | ||
| 377 | + crossAxisAlignment: | ||
| 378 | + CrossAxisAlignment | ||
| 379 | + .center, | ||
| 380 | + children: [ | ||
| 381 | + Text( | ||
| 382 | + model.nickName != | ||
| 383 | + null && | ||
| 384 | + model.nickName != | ||
| 385 | + 'null' | ||
| 386 | + ? model.nickName | ||
| 387 | + : '暂未设置名称', | ||
| 388 | + style: TextStyle( | ||
| 389 | + fontSize: | ||
| 390 | + ScreenUtil() | ||
| 391 | + .setWidth( | ||
| 392 | + 32), | ||
| 393 | + color: isWechat | ||
| 394 | + ? MyColours | ||
| 395 | + .color_438E93 | ||
| 396 | + : MyColours | ||
| 397 | + .color_999999), | ||
| 398 | + ), | ||
| 399 | + HEmptyView(8), | ||
| 400 | + Text( | ||
| 401 | + model.phone ?? '', | ||
| 402 | + style: TextStyle( | ||
| 403 | + fontSize: | ||
| 404 | + ScreenUtil() | ||
| 405 | + .setWidth( | ||
| 406 | + 32), | ||
| 407 | + color: isWechat | ||
| 408 | + ? MyColours | ||
| 409 | + .color_438E93 | ||
| 410 | + : MyColours | ||
| 411 | + .color_999999), | ||
| 224 | ) | 412 | ) |
| 225 | - : Image.asset( | ||
| 226 | - Utils.getImgPath( | ||
| 227 | - 'touxiang'), | ||
| 228 | - fit: BoxFit.cover, | 413 | + ]), |
| 414 | + VEmptyView(16), | ||
| 415 | + Row( | ||
| 416 | + mainAxisAlignment: | ||
| 417 | + MainAxisAlignment.start, | ||
| 418 | + children: [ | ||
| 419 | + RoundButton( | ||
| 420 | + text: | ||
| 421 | + '工号:${model.account}', | ||
| 422 | + gradientStart: isWechat | ||
| 423 | + ? MyColours | ||
| 424 | + .color_438E93 | ||
| 425 | + : MyColours | ||
| 426 | + .color_BFC4D4, | ||
| 427 | + gradientEnd: isWechat | ||
| 428 | + ? MyColours | ||
| 429 | + .color_438E93 | ||
| 430 | + : MyColours | ||
| 431 | + .color_BFC4D4, | ||
| 432 | + borderColor: isWechat | ||
| 433 | + ? MyColours | ||
| 434 | + .color_438E93 | ||
| 435 | + : MyColours | ||
| 436 | + .color_BFC4D4, | ||
| 229 | width: ScreenUtil() | 437 | width: ScreenUtil() |
| 230 | - .setWidth(38 * 2), | 438 | + .setWidth(62 * 2), |
| 231 | height: ScreenUtil() | 439 | height: ScreenUtil() |
| 232 | - .setWidth(38 * 2), | ||
| 233 | - )), | ||
| 234 | - HEmptyView(40), | ||
| 235 | - Expanded( | ||
| 236 | - child: Text( | ||
| 237 | - model.nickName != null && | ||
| 238 | - model.nickName != 'null' | ||
| 239 | - ? model.nickName | ||
| 240 | - : '暂未设置名称', | ||
| 241 | - style: TextStyle( | ||
| 242 | - fontSize: | ||
| 243 | - ScreenUtil().setWidth(28), | ||
| 244 | - color: | ||
| 245 | - MyColours.color_333333), | ||
| 246 | - )), | ||
| 247 | - Spacer(), | ||
| 248 | - Text( | ||
| 249 | - '工号:${model.account}', | ||
| 250 | - style: TextStyle( | ||
| 251 | - fontSize: | ||
| 252 | - ScreenUtil().setWidth(28), | ||
| 253 | - color: | ||
| 254 | - MyColours.color_999999), | 440 | + .setWidth(18 * 2), |
| 441 | + fontSize: 20, | ||
| 442 | + isBold: false, | ||
| 443 | + textColor: MyColours | ||
| 444 | + .color_ffffff, | ||
| 445 | + radius: ScreenUtil() | ||
| 446 | + .setWidth(8), | ||
| 447 | + onPressed: () {}), | ||
| 448 | + HEmptyView(8), | ||
| 449 | + isWechat | ||
| 450 | + ? RoundButton( | ||
| 451 | + text: '已绑定微信', | ||
| 452 | + gradientStart: | ||
| 453 | + MyColours | ||
| 454 | + .color_438E93, | ||
| 455 | + gradientEnd: MyColours | ||
| 456 | + .color_438E93, | ||
| 457 | + borderColor: MyColours | ||
| 458 | + .color_438E93, | ||
| 459 | + width: ScreenUtil() | ||
| 460 | + .setWidth( | ||
| 461 | + 58 * 2), | ||
| 462 | + height: ScreenUtil() | ||
| 463 | + .setWidth( | ||
| 464 | + 18 * 2), | ||
| 465 | + fontSize: 20, | ||
| 466 | + isBold: false, | ||
| 467 | + textColor: MyColours | ||
| 468 | + .color_ffffff, | ||
| 469 | + radius: ScreenUtil() | ||
| 470 | + .setWidth(8), | ||
| 471 | + onPressed: () {}) | ||
| 472 | + : SizedBox(), | ||
| 473 | + ], | ||
| 474 | + ) | ||
| 475 | + ], | ||
| 255 | ), | 476 | ), |
| 256 | - HEmptyView(20), | ||
| 257 | - Image.asset( | ||
| 258 | - "assets/arr_right_gray.png", | ||
| 259 | - width: ScreenUtil().setWidth(14), | ||
| 260 | - height: ScreenUtil().setWidth(22), | ||
| 261 | - ) | 477 | + Spacer(), |
| 478 | + canIn | ||
| 479 | + ? Image.asset( | ||
| 480 | + "assets/arr_right_gray.png", | ||
| 481 | + width: ScreenUtil() | ||
| 482 | + .setWidth(14), | ||
| 483 | + height: ScreenUtil() | ||
| 484 | + .setWidth(22), | ||
| 485 | + ) | ||
| 486 | + : SizedBox() | ||
| 262 | ], | 487 | ], |
| 263 | )), | 488 | )), |
| 264 | - MyDivider( | ||
| 265 | - double.infinity, | ||
| 266 | - ScreenUtil().setWidth(2), | ||
| 267 | - color: MyColours.color_f3f3f3, | ||
| 268 | - ) | ||
| 269 | ]), | 489 | ]), |
| 270 | model.isOnCall == '1' | 490 | model.isOnCall == '1' |
| 271 | ? Positioned( | 491 | ? Positioned( |
| @@ -275,13 +495,9 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { | @@ -275,13 +495,9 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { | ||
| 275 | alignment: Alignment.center, | 495 | alignment: Alignment.center, |
| 276 | decoration: BoxDecoration( | 496 | decoration: BoxDecoration( |
| 277 | color: MyColours.color_d93535, | 497 | color: MyColours.color_d93535, |
| 278 | - borderRadius: BorderRadius.only( | ||
| 279 | - topRight: Radius.circular( | ||
| 280 | - ScreenUtil() | ||
| 281 | - .setWidth(16)), | ||
| 282 | - bottomRight: Radius.circular( | ||
| 283 | - ScreenUtil() | ||
| 284 | - .setWidth(16)))), | 498 | + borderRadius: BorderRadius.all( |
| 499 | + Radius.circular(ScreenUtil() | ||
| 500 | + .setWidth(16)))), | ||
| 285 | child: Text( | 501 | child: Text( |
| 286 | 'Call', | 502 | 'Call', |
| 287 | style: TextStyle( | 503 | style: TextStyle( |
| @@ -293,11 +509,40 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { | @@ -293,11 +509,40 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { | ||
| 293 | : SizedBox() | 509 | : SizedBox() |
| 294 | ])); | 510 | ])); |
| 295 | }), | 511 | }), |
| 296 | - MyDivider( | ||
| 297 | - double.infinity, | ||
| 298 | - ScreenUtil().setWidth(20), | ||
| 299 | - color: Color.fromRGBO(235, 234, 239, 1), | ||
| 300 | - ), | 512 | + |
| 513 | + canAdd | ||
| 514 | + ? InkWell( | ||
| 515 | + onTap: () { | ||
| 516 | + _addSellerClerk(roleId); | ||
| 517 | + }, | ||
| 518 | + child: Container( | ||
| 519 | + width: ScreenUtil().setWidth(74 * 2), | ||
| 520 | + height: ScreenUtil().setWidth(44), | ||
| 521 | + margin: EdgeInsets.symmetric( | ||
| 522 | + horizontal: ScreenUtil().setWidth(36), | ||
| 523 | + ), | ||
| 524 | + decoration: BoxDecoration( | ||
| 525 | + color: MyColours.color_ffffff, | ||
| 526 | + border: Border.all( | ||
| 527 | + width: ScreenUtil().setWidth(2), | ||
| 528 | + color: MyColours.color_438E93), | ||
| 529 | + borderRadius: BorderRadius.circular( | ||
| 530 | + ScreenUtil().setWidth(12))), | ||
| 531 | + child: Row( | ||
| 532 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 533 | + children: [ | ||
| 534 | + Image.asset(Utils.getImgPath('add_area'), | ||
| 535 | + width: ScreenUtil().setWidth(20)), | ||
| 536 | + HEmptyView(6), | ||
| 537 | + Text('添加一名', | ||
| 538 | + style: TextStyle( | ||
| 539 | + color: MyColours.color_438E93, | ||
| 540 | + fontSize: ScreenUtil().setSp(24), | ||
| 541 | + )), | ||
| 542 | + ], | ||
| 543 | + ))) | ||
| 544 | + : SizedBox(), | ||
| 545 | + canAdd ? VEmptyView(62) : SizedBox() | ||
| 301 | ], | 546 | ], |
| 302 | ); | 547 | ); |
| 303 | }))); | 548 | }))); |
| 1 | +// import 'package:cached_network_image/cached_network_image.dart'; | ||
| 2 | +// import 'package:flutter/material.dart'; | ||
| 3 | +// import 'package:flutter_screenutil/screenutil.dart'; | ||
| 4 | +// import 'package:one_key/models/personnel_manage_model.dart'; | ||
| 5 | +// import 'package:one_key/provider/personnel_provider.dart'; | ||
| 6 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 7 | +// import 'package:one_key/res/colors.dart'; | ||
| 8 | +// import 'package:one_key/route/navigator_util.dart'; | ||
| 9 | +// import 'package:one_key/utils/event_bus.dart'; | ||
| 10 | +// import 'package:one_key/utils/utils.dart'; | ||
| 11 | +// import 'package:one_key/widgets/MyDivider.dart'; | ||
| 12 | +// import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 13 | +// import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 14 | +// import 'package:provider/provider.dart'; | ||
| 15 | + | ||
| 16 | +// class PersonnelManagePage extends StatefulWidget { | ||
| 17 | +// PersonnelManagePage({Key key}) : super(key: key); | ||
| 18 | + | ||
| 19 | +// @override | ||
| 20 | +// _PersonnelManagePageState createState() => _PersonnelManagePageState(); | ||
| 21 | +// } | ||
| 22 | + | ||
| 23 | +// class _PersonnelManagePageState extends State<PersonnelManagePage> { | ||
| 24 | +// PersonnelProvider personnelProvider; | ||
| 25 | +// ScrollController _scrollController = ScrollController(); | ||
| 26 | +// List<String> titleList = []; | ||
| 27 | + | ||
| 28 | +// @override | ||
| 29 | +// void initState() { | ||
| 30 | +// // TODO: implement initState | ||
| 31 | +// super.initState(); | ||
| 32 | +// titleList = ['管理员', '店长', '客户经理', '收银员', '服务员']; | ||
| 33 | +// WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | ||
| 34 | +// _getAuthUserLists(showLoading: false); | ||
| 35 | +// }); | ||
| 36 | + | ||
| 37 | +// EventBus().on('personnel_manage_page', (arg) { | ||
| 38 | +// _getAuthUserLists(showLoading: false); | ||
| 39 | +// }); | ||
| 40 | +// } | ||
| 41 | + | ||
| 42 | +// @override | ||
| 43 | +// void dispose() { | ||
| 44 | +// // TODO: implement dispose | ||
| 45 | +// super.dispose(); | ||
| 46 | +// EventBus().off('personnel_manage_page'); | ||
| 47 | +// } | ||
| 48 | + | ||
| 49 | +// //获取员工信息列表 | ||
| 50 | +// _getAuthUserLists({bool showLoading = true}) async { | ||
| 51 | +// Map<String, String> params = { | ||
| 52 | +// "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 53 | +// }; | ||
| 54 | + | ||
| 55 | +// await personnelProvider.getAuthUserLists(context, params, | ||
| 56 | +// showLoading: showLoading); | ||
| 57 | +// } | ||
| 58 | + | ||
| 59 | +// ///添加店员 | ||
| 60 | +// _addSellerClerk(String roleId, {bool showLoading = true}) async { | ||
| 61 | +// Map<String, String> params = { | ||
| 62 | +// "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 63 | +// 'role_id': roleId | ||
| 64 | +// }; | ||
| 65 | + | ||
| 66 | +// bool success = await personnelProvider.addSellerClerk(context, params, | ||
| 67 | +// showLoading: showLoading); | ||
| 68 | +// if (success) { | ||
| 69 | +// //刷新页面 | ||
| 70 | +// _getAuthUserLists(showLoading: false); | ||
| 71 | +// } | ||
| 72 | +// } | ||
| 73 | + | ||
| 74 | +// @override | ||
| 75 | +// Widget build(BuildContext context) { | ||
| 76 | +// personnelProvider = Provider.of<PersonnelProvider>(context, listen: true); | ||
| 77 | +// return Scaffold( | ||
| 78 | +// backgroundColor: MyColours.color_ffffff, | ||
| 79 | +// appBar: SystemAppBar( | ||
| 80 | +// '员工与职级管理', | ||
| 81 | +// onTap: () { | ||
| 82 | +// EventBus().emit('changeStatusColor'); | ||
| 83 | +// Navigator.of(context).pop(); | ||
| 84 | +// }, | ||
| 85 | +// ), | ||
| 86 | +// body: WillPopScope( | ||
| 87 | +// onWillPop: () { | ||
| 88 | +// EventBus().emit('changeStatusColor'); | ||
| 89 | +// Navigator.of(context).pop(); | ||
| 90 | +// }, | ||
| 91 | +// child: ListView.builder( | ||
| 92 | +// itemCount: titleList.length, | ||
| 93 | +// shrinkWrap: true, | ||
| 94 | +// controller: _scrollController, | ||
| 95 | +// itemBuilder: (BuildContext context, int index) { | ||
| 96 | +// String title = titleList[index]; | ||
| 97 | +// List<PersonnelManageSunModel> data = []; | ||
| 98 | +// String roleId = ''; | ||
| 99 | +// if (personnelProvider.dataMap != null) { | ||
| 100 | +// if (title == '管理员') { | ||
| 101 | +// data = personnelProvider.dataMap.admin.listdata; | ||
| 102 | +// roleId = personnelProvider.dataMap.admin.roleId; | ||
| 103 | +// } else if (title == '店长') { | ||
| 104 | +// data = personnelProvider.dataMap.shopowner.listdata; | ||
| 105 | +// roleId = personnelProvider.dataMap.shopowner.roleId; | ||
| 106 | +// } else if (title == '客户经理') { | ||
| 107 | +// data = personnelProvider.dataMap.manager.listdata; | ||
| 108 | +// roleId = personnelProvider.dataMap.manager.roleId; | ||
| 109 | +// } else if (title == '收银员') { | ||
| 110 | +// data = personnelProvider.dataMap.cashier.listdata; | ||
| 111 | +// roleId = personnelProvider.dataMap.cashier.roleId; | ||
| 112 | +// } else if (title == '服务员') { | ||
| 113 | +// data = personnelProvider.dataMap.waiter.listdata; | ||
| 114 | +// roleId = personnelProvider.dataMap.waiter.roleId; | ||
| 115 | +// } | ||
| 116 | +// } | ||
| 117 | + | ||
| 118 | +// return Column( | ||
| 119 | +// children: [ | ||
| 120 | +// InkWell( | ||
| 121 | +// onTap: () { | ||
| 122 | +// if ((Provider.of<UserModel>(context, listen: false) | ||
| 123 | +// .user | ||
| 124 | +// .role_name == | ||
| 125 | +// '管理员' || | ||
| 126 | +// (Provider.of<UserModel>(context, | ||
| 127 | +// listen: false) | ||
| 128 | +// .user | ||
| 129 | +// .role_name == | ||
| 130 | +// '店长' && | ||
| 131 | +// title != '店长')) && | ||
| 132 | +// title != '管理员') { | ||
| 133 | +// _addSellerClerk(roleId); | ||
| 134 | +// } | ||
| 135 | +// }, | ||
| 136 | +// child: Padding( | ||
| 137 | +// padding: EdgeInsets.symmetric( | ||
| 138 | +// horizontal: ScreenUtil().setWidth(40), | ||
| 139 | +// vertical: ScreenUtil().setWidth(40)), | ||
| 140 | +// child: Row( | ||
| 141 | +// mainAxisAlignment: | ||
| 142 | +// MainAxisAlignment.spaceBetween, | ||
| 143 | +// children: [ | ||
| 144 | +// Text( | ||
| 145 | +// title == '管理员' | ||
| 146 | +// ? '${title}' | ||
| 147 | +// : '${title} (${data.length}人)', | ||
| 148 | +// style: TextStyle( | ||
| 149 | +// fontSize: ScreenUtil().setWidth(28), | ||
| 150 | +// color: MyColours.color_333333), | ||
| 151 | +// ), | ||
| 152 | +// title == '管理员' | ||
| 153 | +// ? SizedBox() | ||
| 154 | +// : Provider.of<UserModel>(context, | ||
| 155 | +// listen: false) | ||
| 156 | +// .user | ||
| 157 | +// .role_name == | ||
| 158 | +// '管理员' || | ||
| 159 | +// (Provider.of<UserModel>(context, | ||
| 160 | +// listen: false) | ||
| 161 | +// .user | ||
| 162 | +// .role_name == | ||
| 163 | +// '店长' && | ||
| 164 | +// title != '店长') | ||
| 165 | +// ? InkWell( | ||
| 166 | +// onTap: () { | ||
| 167 | +// _addSellerClerk(roleId); | ||
| 168 | +// }, | ||
| 169 | +// child: Text( | ||
| 170 | +// '添加', | ||
| 171 | +// style: TextStyle( | ||
| 172 | +// fontSize: ScreenUtil() | ||
| 173 | +// .setWidth(30), | ||
| 174 | +// color: | ||
| 175 | +// MyColours.color_199095), | ||
| 176 | +// ), | ||
| 177 | +// ) | ||
| 178 | +// : SizedBox() | ||
| 179 | +// ], | ||
| 180 | +// ))), | ||
| 181 | +// MyDivider( | ||
| 182 | +// double.infinity, | ||
| 183 | +// ScreenUtil().setWidth(2), | ||
| 184 | +// color: MyColours.color_f3f3f3, | ||
| 185 | +// ), | ||
| 186 | +// ListView.builder( | ||
| 187 | +// physics: NeverScrollableScrollPhysics(), | ||
| 188 | +// itemCount: data.length, | ||
| 189 | +// shrinkWrap: true, | ||
| 190 | +// controller: _scrollController, | ||
| 191 | +// itemBuilder: (BuildContext context, int index) { | ||
| 192 | +// PersonnelManageSunModel model = data[index]; | ||
| 193 | +// return InkWell( | ||
| 194 | +// onTap: () { | ||
| 195 | +// NavigatorUtil.goPersonnelDetailPage(context, | ||
| 196 | +// model: model, position: title); | ||
| 197 | +// }, | ||
| 198 | +// child: Stack(children: [ | ||
| 199 | +// Column(children: [ | ||
| 200 | +// Padding( | ||
| 201 | +// padding: EdgeInsets.symmetric( | ||
| 202 | +// vertical: ScreenUtil().setWidth(20), | ||
| 203 | +// horizontal: | ||
| 204 | +// ScreenUtil().setWidth(40)), | ||
| 205 | +// child: Row( | ||
| 206 | +// children: [ | ||
| 207 | +// ClipRRect( | ||
| 208 | +// borderRadius: | ||
| 209 | +// BorderRadius.circular( | ||
| 210 | +// ScreenUtil() | ||
| 211 | +// .setWidth(38)), | ||
| 212 | +// child: model.headimgurl != | ||
| 213 | +// null && | ||
| 214 | +// model.headimgurl != | ||
| 215 | +// 'null' | ||
| 216 | +// ? CachedNetworkImage( | ||
| 217 | +// imageUrl: | ||
| 218 | +// model.headimgurl, | ||
| 219 | +// fit: BoxFit.cover, | ||
| 220 | +// width: ScreenUtil() | ||
| 221 | +// .setWidth(38 * 2), | ||
| 222 | +// height: ScreenUtil() | ||
| 223 | +// .setWidth(38 * 2), | ||
| 224 | +// ) | ||
| 225 | +// : Image.asset( | ||
| 226 | +// Utils.getImgPath( | ||
| 227 | +// 'touxiang'), | ||
| 228 | +// fit: BoxFit.cover, | ||
| 229 | +// width: ScreenUtil() | ||
| 230 | +// .setWidth(38 * 2), | ||
| 231 | +// height: ScreenUtil() | ||
| 232 | +// .setWidth(38 * 2), | ||
| 233 | +// )), | ||
| 234 | +// HEmptyView(40), | ||
| 235 | +// Expanded( | ||
| 236 | +// child: Text( | ||
| 237 | +// model.nickName != null && | ||
| 238 | +// model.nickName != 'null' | ||
| 239 | +// ? model.nickName | ||
| 240 | +// : '暂未设置名称', | ||
| 241 | +// style: TextStyle( | ||
| 242 | +// fontSize: | ||
| 243 | +// ScreenUtil().setWidth(28), | ||
| 244 | +// color: | ||
| 245 | +// MyColours.color_333333), | ||
| 246 | +// )), | ||
| 247 | +// Spacer(), | ||
| 248 | +// Text( | ||
| 249 | +// '工号:${model.account}', | ||
| 250 | +// style: TextStyle( | ||
| 251 | +// fontSize: | ||
| 252 | +// ScreenUtil().setWidth(28), | ||
| 253 | +// color: | ||
| 254 | +// MyColours.color_999999), | ||
| 255 | +// ), | ||
| 256 | +// HEmptyView(20), | ||
| 257 | +// Image.asset( | ||
| 258 | +// "assets/arr_right_gray.png", | ||
| 259 | +// width: ScreenUtil().setWidth(14), | ||
| 260 | +// height: ScreenUtil().setWidth(22), | ||
| 261 | +// ) | ||
| 262 | +// ], | ||
| 263 | +// )), | ||
| 264 | +// MyDivider( | ||
| 265 | +// double.infinity, | ||
| 266 | +// ScreenUtil().setWidth(2), | ||
| 267 | +// color: MyColours.color_f3f3f3, | ||
| 268 | +// ) | ||
| 269 | +// ]), | ||
| 270 | +// model.isOnCall == '1' | ||
| 271 | +// ? Positioned( | ||
| 272 | +// child: Container( | ||
| 273 | +// width: ScreenUtil().setWidth(50), | ||
| 274 | +// height: ScreenUtil().setWidth(28), | ||
| 275 | +// alignment: Alignment.center, | ||
| 276 | +// decoration: BoxDecoration( | ||
| 277 | +// color: MyColours.color_d93535, | ||
| 278 | +// borderRadius: BorderRadius.only( | ||
| 279 | +// topRight: Radius.circular( | ||
| 280 | +// ScreenUtil() | ||
| 281 | +// .setWidth(16)), | ||
| 282 | +// bottomRight: Radius.circular( | ||
| 283 | +// ScreenUtil() | ||
| 284 | +// .setWidth(16)))), | ||
| 285 | +// child: Text( | ||
| 286 | +// 'Call', | ||
| 287 | +// style: TextStyle( | ||
| 288 | +// color: MyColours.color_ffffff, | ||
| 289 | +// fontSize: | ||
| 290 | +// ScreenUtil().setSp(18)), | ||
| 291 | +// ), | ||
| 292 | +// )) | ||
| 293 | +// : SizedBox() | ||
| 294 | +// ])); | ||
| 295 | +// }), | ||
| 296 | +// MyDivider( | ||
| 297 | +// double.infinity, | ||
| 298 | +// ScreenUtil().setWidth(20), | ||
| 299 | +// color: Color.fromRGBO(235, 234, 239, 1), | ||
| 300 | +// ), | ||
| 301 | +// ], | ||
| 302 | +// ); | ||
| 303 | +// }))); | ||
| 304 | +// } | ||
| 305 | +// } |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:one_key/constant/constant.dart'; | 2 | import 'package:one_key/constant/constant.dart'; |
| 3 | +import 'package:one_key/constant/error.dart'; | ||
| 4 | +import 'package:one_key/models/filter_btn_model.dart'; | ||
| 3 | import 'package:one_key/models/get_seller_info_model.dart'; | 5 | import 'package:one_key/models/get_seller_info_model.dart'; |
| 6 | +import 'package:one_key/models/get_seller_user_by_sellerid_model.dart'; | ||
| 4 | import 'package:one_key/models/personnel_manage_model.dart'; | 7 | import 'package:one_key/models/personnel_manage_model.dart'; |
| 5 | import 'package:one_key/net/base_resp.dart'; | 8 | import 'package:one_key/net/base_resp.dart'; |
| 6 | import 'package:one_key/net/dio_util.dart'; | 9 | import 'package:one_key/net/dio_util.dart'; |
| @@ -16,6 +19,48 @@ import 'package:provider/provider.dart'; | @@ -16,6 +19,48 @@ import 'package:provider/provider.dart'; | ||
| 16 | class PersonnelProvider extends ChangeNotifier { | 19 | class PersonnelProvider extends ChangeNotifier { |
| 17 | PersonnelManageModelData dataMap; | 20 | PersonnelManageModelData dataMap; |
| 18 | String password = ''; | 21 | String password = ''; |
| 22 | + List<FilterBtnModel> sellerManageList = []; //经理数据 ---- 商家编辑页面 | ||
| 23 | + int manageSelIndex; //当前选中 | ||
| 24 | + | ||
| 25 | + ///商家详情编辑页面 ------ 获取经理数据 | ||
| 26 | + Future<List<FilterBtnModel>> getSellerUserBySellerid(BuildContext context, | ||
| 27 | + {isShowLoading = true}) async { | ||
| 28 | + Map<String, String> params = { | ||
| 29 | + 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid | ||
| 30 | + }; | ||
| 31 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 32 | + .request<dynamic>( | ||
| 33 | + context, Method.get, HttpUrl.get_seller_user_by_sellerid, | ||
| 34 | + data: params, showLoading: false) | ||
| 35 | + .catchError((error) { | ||
| 36 | + print(error.toString()); | ||
| 37 | + if (error is MyError) {} | ||
| 38 | + }); | ||
| 39 | + if (baseResp.code == Constant.status_success) { | ||
| 40 | + List<GetSellerUserBySelleridSunModel> sunmodel = | ||
| 41 | + GetSellerUserBySelleridModel.fromJson(baseResp.responseData).data; | ||
| 42 | + sellerManageList = []; | ||
| 43 | + if (sunmodel != null && sunmodel.length > 0) { | ||
| 44 | + for (GetSellerUserBySelleridSunModel item in sunmodel) { | ||
| 45 | + if (item.nickName != null) { | ||
| 46 | + FilterBtnModel model = FilterBtnModel(); | ||
| 47 | + model.id = item.id; | ||
| 48 | + model.title = item.nickName + '(${item.roleName})'; | ||
| 49 | + sellerManageList.add(model); | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + } else { | ||
| 54 | + if (baseResp != null) { | ||
| 55 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + FilterBtnModel model = FilterBtnModel(); | ||
| 59 | + model.id = ''; | ||
| 60 | + model.title = '全店未分配客户资源'; | ||
| 61 | + sellerManageList.insert(0, model); | ||
| 62 | + return sellerManageList; | ||
| 63 | + } | ||
| 19 | 64 | ||
| 20 | /// 获取店员列表 | 65 | /// 获取店员列表 |
| 21 | getAuthUserLists(BuildContext context, Map<String, String> params, | 66 | getAuthUserLists(BuildContext context, Map<String, String> params, |
| @@ -36,6 +81,36 @@ class PersonnelProvider extends ChangeNotifier { | @@ -36,6 +81,36 @@ class PersonnelProvider extends ChangeNotifier { | ||
| 36 | }); | 81 | }); |
| 37 | baseResp.responseData['data'] = tempData; | 82 | baseResp.responseData['data'] = tempData; |
| 38 | dataMap = PersonnelManageModel.fromJson(baseResp.responseData).data; | 83 | dataMap = PersonnelManageModel.fromJson(baseResp.responseData).data; |
| 84 | + dataMap.admin.hasWechatNum = 0; | ||
| 85 | + for (PersonnelManageSunModel item in dataMap.admin.listdata) { | ||
| 86 | + if (item.openid != null && item.openid != 'null' && item.openid != '') { | ||
| 87 | + dataMap.admin.hasWechatNum++; | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + dataMap.cashier.hasWechatNum = 0; | ||
| 91 | + for (PersonnelManageSunModel item in dataMap.cashier.listdata) { | ||
| 92 | + if (item.openid != null && item.openid != 'null' && item.openid != '') { | ||
| 93 | + dataMap.cashier.hasWechatNum++; | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + dataMap.manager.hasWechatNum = 0; | ||
| 97 | + for (PersonnelManageSunModel item in dataMap.manager.listdata) { | ||
| 98 | + if (item.openid != null && item.openid != 'null' && item.openid != '') { | ||
| 99 | + dataMap.manager.hasWechatNum++; | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + dataMap.shopowner.hasWechatNum = 0; | ||
| 103 | + for (PersonnelManageSunModel item in dataMap.shopowner.listdata) { | ||
| 104 | + if (item.openid != null && item.openid != 'null' && item.openid != '') { | ||
| 105 | + dataMap.shopowner.hasWechatNum++; | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + dataMap.waiter.hasWechatNum = 0; | ||
| 109 | + for (PersonnelManageSunModel item in dataMap.waiter.listdata) { | ||
| 110 | + if (item.openid != null && item.openid != 'null' && item.openid != '') { | ||
| 111 | + dataMap.waiter.hasWechatNum++; | ||
| 112 | + } | ||
| 113 | + } | ||
| 39 | } else { | 114 | } else { |
| 40 | Utils.showToast(baseResp.msg ?? ""); | 115 | Utils.showToast(baseResp.msg ?? ""); |
| 41 | } | 116 | } |
| @@ -65,9 +65,9 @@ class NavigatorUtil { | @@ -65,9 +65,9 @@ class NavigatorUtil { | ||
| 65 | // "${Routes.home}?initialIndex=$initialIndex&needRefresh=$needRefresh&mine=$mine&dateTime=&solt=$solt", | 65 | // "${Routes.home}?initialIndex=$initialIndex&needRefresh=$needRefresh&mine=$mine&dateTime=&solt=$solt", |
| 66 | // clearStack: true); | 66 | // clearStack: true); |
| 67 | // } else { | 67 | // } else { |
| 68 | - _navigateTo(context, | ||
| 69 | - "${Routes.home}?initialIndex=$initialIndex&needRefresh=$needRefresh&mine=$mine&dateTime=$dateTime&solt=$solt", | ||
| 70 | - clearStack: true); | 68 | + _navigateTo(context, |
| 69 | + "${Routes.home}?initialIndex=$initialIndex&needRefresh=$needRefresh&mine=$mine&dateTime=$dateTime&solt=$solt", | ||
| 70 | + clearStack: true); | ||
| 71 | // } | 71 | // } |
| 72 | } | 72 | } |
| 73 | 73 | ||
| @@ -299,6 +299,18 @@ class NavigatorUtil { | @@ -299,6 +299,18 @@ class NavigatorUtil { | ||
| 299 | } | 299 | } |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | + /// 员工管理---个人资料页面 | ||
| 303 | + static Future<dynamic> goPersonnalBaseInfoPage( | ||
| 304 | + BuildContext context, | ||
| 305 | + PersonnelManageSunModel sunModel, | ||
| 306 | + String position, { | ||
| 307 | + replace = false, | ||
| 308 | + }) { | ||
| 309 | + return _navigateTo(context, | ||
| 310 | + "${Routes.base_info_personnal_page}?sunModel=${FluroConvertUtils.object2string(sunModel)}&position=${Uri.encodeComponent(position)}", | ||
| 311 | + replace: replace); | ||
| 312 | + } | ||
| 313 | + | ||
| 302 | /// 绑定手机号吗页面 | 314 | /// 绑定手机号吗页面 |
| 303 | static Future<dynamic> goBindingPhonePage(BuildContext context, | 315 | static Future<dynamic> goBindingPhonePage(BuildContext context, |
| 304 | {replace = false, bool wechat = true}) { | 316 | {replace = false, bool wechat = true}) { |
| @@ -520,9 +532,9 @@ class NavigatorUtil { | @@ -520,9 +532,9 @@ class NavigatorUtil { | ||
| 520 | 532 | ||
| 521 | /// 员工管理页面 | 533 | /// 员工管理页面 |
| 522 | static Future<dynamic> goPersonnelDetailPage(BuildContext context, | 534 | static Future<dynamic> goPersonnelDetailPage(BuildContext context, |
| 523 | - {replace = false, PersonnelManageSunModel model, String position}) { | 535 | + {replace = false, int index, String position}) { |
| 524 | return _navigateTo(context, | 536 | return _navigateTo(context, |
| 525 | - "${Routes.personnel_detail_page}?model=${FluroConvertUtils.object2string(model)}&position=${Uri.encodeComponent(position)}", | 537 | + "${Routes.personnel_detail_page}?index=$index&position=${Uri.encodeComponent(position)}", |
| 526 | replace: replace); | 538 | replace: replace); |
| 527 | } | 539 | } |
| 528 | 540 |
| @@ -74,8 +74,10 @@ import 'package:one_key/pages/my/customer_type/store_customer/make_marking_page. | @@ -74,8 +74,10 @@ import 'package:one_key/pages/my/customer_type/store_customer/make_marking_page. | ||
| 74 | import 'package:one_key/pages/my/customer_type/store_customer/marketing_records_detail_page.dart'; | 74 | import 'package:one_key/pages/my/customer_type/store_customer/marketing_records_detail_page.dart'; |
| 75 | import 'package:one_key/pages/my/customer_type/store_customer/marketing_records_page.dart'; | 75 | import 'package:one_key/pages/my/customer_type/store_customer/marketing_records_page.dart'; |
| 76 | import 'package:one_key/pages/my/customer_type/store_customer/store_customer_page.dart'; | 76 | import 'package:one_key/pages/my/customer_type/store_customer/store_customer_page.dart'; |
| 77 | +import 'package:one_key/pages/my/personnel_type/base_info_personnal_page.dart'; | ||
| 77 | import 'package:one_key/pages/my/personnel_type/personnel_detail_page.dart'; | 78 | import 'package:one_key/pages/my/personnel_type/personnel_detail_page.dart'; |
| 78 | import 'package:one_key/pages/my/personnel_type/personnel_manage_page.dart'; | 79 | import 'package:one_key/pages/my/personnel_type/personnel_manage_page.dart'; |
| 80 | +import 'package:one_key/pages/my/personnel_type/personnel_manage_page_old.dart'; | ||
| 79 | import 'package:one_key/pages/my/personnel_type/personnel_password_edit_page.dart'; | 81 | import 'package:one_key/pages/my/personnel_type/personnel_password_edit_page.dart'; |
| 80 | import 'package:one_key/pages/my/personnel_type/personnel_password_show_page.dart'; | 82 | import 'package:one_key/pages/my/personnel_type/personnel_password_show_page.dart'; |
| 81 | import 'package:one_key/pages/my/base_info.dart'; | 83 | import 'package:one_key/pages/my/base_info.dart'; |
| @@ -521,6 +523,22 @@ var baseInfoPageHandler = new Handler( | @@ -521,6 +523,22 @@ var baseInfoPageHandler = new Handler( | ||
| 521 | ))); | 523 | ))); |
| 522 | }); | 524 | }); |
| 523 | 525 | ||
| 526 | +///员工管理----个人资料页面 | ||
| 527 | +var baseInfoPersonnalPageHandle = new Handler( | ||
| 528 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 529 | + // CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode( | ||
| 530 | + // FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first))); | ||
| 531 | + String position = params["position"].first; | ||
| 532 | + PersonnelManageSunModel sunModel = PersonnelManageSunModel.fromJson(json | ||
| 533 | + .decode(FluroConvertUtils.fluroCnParamsDecode(params["sunModel"].first))); | ||
| 534 | + return ChangeNotifierProvider<BaseIndoProvider>( | ||
| 535 | + create: (_) => BaseIndoProvider(), | ||
| 536 | + child: ChangeNotifierProvider<PersonnelProvider>( | ||
| 537 | + create: (_) => PersonnelProvider(), | ||
| 538 | + child: | ||
| 539 | + BaseInfoPersonnalPage(sunModel: sunModel, position: position))); | ||
| 540 | +}); | ||
| 541 | + | ||
| 524 | ///绑定手机号码页面 | 542 | ///绑定手机号码页面 |
| 525 | var bindingPhonePageHandler = new Handler( | 543 | var bindingPhonePageHandler = new Handler( |
| 526 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | 544 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { |
| @@ -870,13 +888,12 @@ var personnelManagePageHandle = new Handler( | @@ -870,13 +888,12 @@ var personnelManagePageHandle = new Handler( | ||
| 870 | ///店员详情页面 | 888 | ///店员详情页面 |
| 871 | var personnelDetailPageHandle = new Handler( | 889 | var personnelDetailPageHandle = new Handler( |
| 872 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | 890 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { |
| 873 | - PersonnelManageSunModel data = PersonnelManageSunModel.fromJson(json | ||
| 874 | - .decode(FluroConvertUtils.fluroCnParamsDecode(params["model"].first))); | 891 | + int index = int.parse(params["index"].first); |
| 875 | 892 | ||
| 876 | String position = params["position"].first; | 893 | String position = params["position"].first; |
| 877 | return ChangeNotifierProvider<PersonnelProvider>( | 894 | return ChangeNotifierProvider<PersonnelProvider>( |
| 878 | create: (_) => PersonnelProvider(), | 895 | create: (_) => PersonnelProvider(), |
| 879 | - child: PersonnelDetailPage(model: data, position: position)); | 896 | + child: PersonnelDetailPage(index: index, position: position)); |
| 880 | }); | 897 | }); |
| 881 | 898 | ||
| 882 | ///密码展示页面 | 899 | ///密码展示页面 |
| @@ -106,12 +106,11 @@ class Routes { | @@ -106,12 +106,11 @@ class Routes { | ||
| 106 | "/my_show_customer_list_page"; //仅展示的客户列表----我的 | 106 | "/my_show_customer_list_page"; //仅展示的客户列表----我的 |
| 107 | static String table_manager_page = "/table_manager_page"; //客情再次预订跳转的桌位预订页面 | 107 | static String table_manager_page = "/table_manager_page"; //客情再次预订跳转的桌位预订页面 |
| 108 | static String account_login_page = "/account_login_page"; //账号登录页面 | 108 | static String account_login_page = "/account_login_page"; //账号登录页面 |
| 109 | - static String my_table_manager_home_page = "/my_table_manager_home_page"; //我的---桌位管理 | ||
| 110 | - static String my_area_manage_page = "/my_area_manage_page"; //我的---区域管理 | ||
| 111 | - | ||
| 112 | - | ||
| 113 | - | ||
| 114 | - | 109 | + static String my_table_manager_home_page = |
| 110 | + "/my_table_manager_home_page"; //我的---桌位管理 | ||
| 111 | + static String my_area_manage_page = "/my_area_manage_page"; //我的---区域管理 | ||
| 112 | + static String base_info_personnal_page = | ||
| 113 | + "/base_info_personnal_page"; //员工管理---个人资料 | ||
| 115 | 114 | ||
| 116 | static void configureRoutes(FluroRouter router) { | 115 | static void configureRoutes(FluroRouter router) { |
| 117 | router.notFoundHandler = new Handler( | 116 | router.notFoundHandler = new Handler( |
| @@ -220,10 +219,11 @@ class Routes { | @@ -220,10 +219,11 @@ class Routes { | ||
| 220 | router.define(my_show_customer_list_page, | 219 | router.define(my_show_customer_list_page, |
| 221 | handler: myShowCustomerListPageHandle); | 220 | handler: myShowCustomerListPageHandle); |
| 222 | router.define(table_manager_page, handler: tableManagerPageHandle); | 221 | router.define(table_manager_page, handler: tableManagerPageHandle); |
| 223 | - router.define(account_login_page, handler: accountLoginPageHandle); | ||
| 224 | - router.define(my_table_manager_home_page, handler: myTableManagerHomePageHandle); | ||
| 225 | - router.define(my_area_manage_page, handler: myAreaManagePageHandle); | ||
| 226 | - | 222 | + router.define(account_login_page, handler: accountLoginPageHandle); |
| 223 | + router.define(my_table_manager_home_page, | ||
| 224 | + handler: myTableManagerHomePageHandle); | ||
| 225 | + router.define(my_area_manage_page, handler: myAreaManagePageHandle); | ||
| 226 | + router.define(base_info_personnal_page, handler: baseInfoPersonnalPageHandle); | ||
| 227 | 227 | ||
| 228 | } | 228 | } |
| 229 | } | 229 | } |
| @@ -9,6 +9,7 @@ import 'package:flutter/services.dart'; | @@ -9,6 +9,7 @@ import 'package:flutter/services.dart'; | ||
| 9 | import 'package:flutter_picker/flutter_picker.dart'; | 9 | import 'package:flutter_picker/flutter_picker.dart'; |
| 10 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 10 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 11 | import 'package:one_key/constant/constant.dart'; | 11 | import 'package:one_key/constant/constant.dart'; |
| 12 | +import 'package:one_key/models/filter_btn_model.dart'; | ||
| 12 | import 'package:one_key/models/remark.dart'; | 13 | import 'package:one_key/models/remark.dart'; |
| 13 | import 'package:one_key/models/table_list.dart'; | 14 | import 'package:one_key/models/table_list.dart'; |
| 14 | import 'package:one_key/pages/message/message_dialog_item.dart'; | 15 | import 'package:one_key/pages/message/message_dialog_item.dart'; |
| @@ -49,6 +50,233 @@ typedef ClickCallback = void Function(String value); | @@ -49,6 +50,233 @@ typedef ClickCallback = void Function(String value); | ||
| 49 | // }; | 50 | // }; |
| 50 | 51 | ||
| 51 | class DialogUtil { | 52 | class DialogUtil { |
| 53 | + static Future removePersonnalDialog( | ||
| 54 | + BuildContext context, List<FilterBtnModel> managerList, | ||
| 55 | + {CustomCallBackMap onTap}) async { | ||
| 56 | + int currentIndex = 0; | ||
| 57 | + // int currentIndex = | ||
| 58 | + // managerList.indexWhere((element) => element == '包间') ?? 0; | ||
| 59 | + String manager = managerList[currentIndex].title; | ||
| 60 | + bool mulCreate = false; | ||
| 61 | + // StateSetter globalState; | ||
| 62 | +// //输入框焦点 | ||
| 63 | +// focusNode.addListener(() { | ||
| 64 | +// if (!focusNode.hasFocus) { | ||
| 65 | +// // print('失去焦点'); | ||
| 66 | + | ||
| 67 | +// } else { | ||
| 68 | +// // print('得到焦点'); | ||
| 69 | +// globalState(() { | ||
| 70 | +// showPnumMin = true; | ||
| 71 | +// showPnumMax = true; | ||
| 72 | +// showArea = true; | ||
| 73 | +// }); | ||
| 74 | +// } | ||
| 75 | +// }); | ||
| 76 | + | ||
| 77 | + final action = await showDialog( | ||
| 78 | + context: context, | ||
| 79 | + barrierDismissible: false, | ||
| 80 | + builder: (BuildContext context) { | ||
| 81 | + return | ||
| 82 | + // Scaffold( | ||
| 83 | + // resizeToAvoidBottomInset: false, | ||
| 84 | + // backgroundColor: Colors.transparent, | ||
| 85 | + // body: | ||
| 86 | + Center(child: StatefulBuilder(builder: (context, state) { | ||
| 87 | + // globalState = state; | ||
| 88 | + | ||
| 89 | + return Material( | ||
| 90 | + color: Colors.transparent, | ||
| 91 | + child: Stack( | ||
| 92 | + clipBehavior: Clip.none, | ||
| 93 | + children: [ | ||
| 94 | + Container( | ||
| 95 | + margin: | ||
| 96 | + EdgeInsets.only(bottom: ScreenUtil().setWidth(150)), | ||
| 97 | + padding: EdgeInsets.symmetric( | ||
| 98 | + horizontal: ScreenUtil().setWidth(50)), | ||
| 99 | + height: ScreenUtil().setWidth(238 * 2), | ||
| 100 | + decoration: BoxDecoration( | ||
| 101 | + borderRadius: BorderRadius.circular( | ||
| 102 | + ScreenUtil().setWidth(16))), | ||
| 103 | + child: Card( | ||
| 104 | + shape: RoundedRectangleBorder( | ||
| 105 | + borderRadius: BorderRadius.all(Radius.circular( | ||
| 106 | + ScreenUtil().setWidth(16)))), //设置圆角 | ||
| 107 | + child: Column( | ||
| 108 | + children: [ | ||
| 109 | + VEmptyView(64), | ||
| 110 | + Container( | ||
| 111 | + height: ScreenUtil().setWidth(48), | ||
| 112 | + alignment: Alignment.center, | ||
| 113 | + child: Text('移除员工', | ||
| 114 | + style: TextStyle( | ||
| 115 | + fontWeight: FontWeight.bold, | ||
| 116 | + fontSize: ScreenUtil().setSp(32), | ||
| 117 | + color: Color.fromRGBO(0, 0, 0, 0.9))), | ||
| 118 | + ), | ||
| 119 | + VEmptyView(40), | ||
| 120 | + Text('移除员工并把该员工的客户', | ||
| 121 | + style: TextStyle( | ||
| 122 | + fontSize: ScreenUtil().setSp(32), | ||
| 123 | + color: Color.fromRGBO(0, 0, 0, 0.6))), | ||
| 124 | + VEmptyView(36), | ||
| 125 | + Row( | ||
| 126 | + mainAxisAlignment: | ||
| 127 | + MainAxisAlignment.spaceBetween, | ||
| 128 | + children: [ | ||
| 129 | + HEmptyView(70), | ||
| 130 | + Text('转移到', | ||
| 131 | + style: TextStyle( | ||
| 132 | + fontSize: ScreenUtil().setSp(32), | ||
| 133 | + color: MyColours.color_515151)), | ||
| 134 | + HEmptyView(32), | ||
| 135 | + InkWell( | ||
| 136 | + onTap: () { | ||
| 137 | + List<String> list = []; | ||
| 138 | + for (FilterBtnModel item | ||
| 139 | + in managerList) { | ||
| 140 | + list.add(item.title); | ||
| 141 | + } | ||
| 142 | + DialogUtil.showSelectCusmanDialog( | ||
| 143 | + context, list, (value) async { | ||
| 144 | + if (value != null) { | ||
| 145 | + currentIndex = value.first; | ||
| 146 | + manager = list[value.first]; | ||
| 147 | + state(() {}); | ||
| 148 | + // detailModel | ||
| 149 | + // .notifyListeners(); | ||
| 150 | + // setState(() { | ||
| 151 | + // selectPnum = value.first; | ||
| 152 | + // pnum = pnumlist[value.first]; | ||
| 153 | + // }); | ||
| 154 | + // bool sucess = | ||
| 155 | + // await detailModel.upReserveInfo( | ||
| 156 | + // context, widget.rid, | ||
| 157 | + // actualPum: | ||
| 158 | + // detailModel.selectNum); | ||
| 159 | + | ||
| 160 | + // if (sucess) { | ||
| 161 | + // EventBus().emit( | ||
| 162 | + // "refresh_tablemanager"); //刷新桌位 | ||
| 163 | + // await _getReserveDetail( | ||
| 164 | + // showCicle: false); | ||
| 165 | + // } | ||
| 166 | + } | ||
| 167 | + }, | ||
| 168 | + selecteds: currentIndex == null | ||
| 169 | + ? [] | ||
| 170 | + : [currentIndex]) | ||
| 171 | + .then((value) {}); | ||
| 172 | + }, | ||
| 173 | + child: Container( | ||
| 174 | + padding: EdgeInsets.symmetric( | ||
| 175 | + vertical: ScreenUtil().setWidth(16), | ||
| 176 | + horizontal: | ||
| 177 | + ScreenUtil().setWidth(24)), | ||
| 178 | + width: ScreenUtil().setWidth(182 * 2), | ||
| 179 | + height: ScreenUtil().setWidth(40 * 2), | ||
| 180 | + decoration: BoxDecoration( | ||
| 181 | + borderRadius: BorderRadius.circular( | ||
| 182 | + ScreenUtil().setWidth(20)), | ||
| 183 | + border: Border.all( | ||
| 184 | + color: MyColours.color_438E93, | ||
| 185 | + width: | ||
| 186 | + ScreenUtil().setWidth(2))), | ||
| 187 | + child: Row( | ||
| 188 | + crossAxisAlignment: | ||
| 189 | + CrossAxisAlignment.center, | ||
| 190 | + children: [ | ||
| 191 | + Expanded( | ||
| 192 | + child: Text( | ||
| 193 | + manager, | ||
| 194 | + maxLines: 1, | ||
| 195 | + overflow: TextOverflow.ellipsis, | ||
| 196 | + style: TextStyle( | ||
| 197 | + fontSize: | ||
| 198 | + ScreenUtil().setSp(28), | ||
| 199 | + color: | ||
| 200 | + MyColours.color_438E93), | ||
| 201 | + )), | ||
| 202 | + HEmptyView(14), | ||
| 203 | + Image.asset( | ||
| 204 | + Utils.getImgPath( | ||
| 205 | + 'c_arrow_down'), | ||
| 206 | + width: | ||
| 207 | + ScreenUtil().setWidth(40)), | ||
| 208 | + ], | ||
| 209 | + ), | ||
| 210 | + )), | ||
| 211 | + HEmptyView(70), | ||
| 212 | + ], | ||
| 213 | + ), | ||
| 214 | + VEmptyView(40), | ||
| 215 | + MyDivider( | ||
| 216 | + double.infinity, ScreenUtil().setWidth(2), | ||
| 217 | + color: MyColours.color_f3f3f3), | ||
| 218 | + Row( | ||
| 219 | + // mainAxisAlignment: | ||
| 220 | + // MainAxisAlignment.spaceBetween, | ||
| 221 | + children: [ | ||
| 222 | + RoundButton( | ||
| 223 | + text: '取消', | ||
| 224 | + width: (ScreenUtil.screenWidthDp - | ||
| 225 | + ScreenUtil().setWidth(62) * 2) / | ||
| 226 | + 2, | ||
| 227 | + height: ScreenUtil().setWidth(112), | ||
| 228 | + // radius: ScreenUtil().setWidth(10), | ||
| 229 | + gradientStart: Colors.transparent, | ||
| 230 | + gradientEnd: Colors.transparent, | ||
| 231 | + textColor: MyColours.color_000000, | ||
| 232 | + isBold: false, | ||
| 233 | + fontSize: 34, | ||
| 234 | + onPressed: () { | ||
| 235 | + Navigator.pop(context); | ||
| 236 | + }), | ||
| 237 | + MyDivider(ScreenUtil().setWidth(2), | ||
| 238 | + ScreenUtil().setWidth(112), | ||
| 239 | + color: MyColours.color_f3f3f3), | ||
| 240 | + RoundButton( | ||
| 241 | + text: '确定移除', | ||
| 242 | + width: (ScreenUtil.screenWidthDp - | ||
| 243 | + ScreenUtil().setWidth(62) * 2) / | ||
| 244 | + 2, | ||
| 245 | + height: ScreenUtil().setWidth(112), | ||
| 246 | + // radius: ScreenUtil().setWidth(10), | ||
| 247 | + gradientStart: Colors.transparent, | ||
| 248 | + gradientEnd: Colors.transparent, | ||
| 249 | + textColor: MyColours.color_438E93, | ||
| 250 | + fontSize: 34, | ||
| 251 | + onPressed: () { | ||
| 252 | + if (mulCreate) { | ||
| 253 | + Utils.showToast('请输入数量!'); | ||
| 254 | + return; | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + // 当前选中区域 | ||
| 258 | + // areas[currentAreaIndex] | ||
| 259 | + //最低人数 | ||
| 260 | + // pnumMin | ||
| 261 | + //最高人数 | ||
| 262 | + // pnumMax | ||
| 263 | + | ||
| 264 | + onTap({ | ||
| 265 | + 'bjtype': | ||
| 266 | + managerList[currentIndex].id, | ||
| 267 | + }); | ||
| 268 | + Navigator.pop(context); | ||
| 269 | + }), | ||
| 270 | + ]) | ||
| 271 | + ], | ||
| 272 | + ), | ||
| 273 | + )), | ||
| 274 | + ], | ||
| 275 | + )); | ||
| 276 | + })); | ||
| 277 | + }); | ||
| 278 | + } | ||
| 279 | + | ||
| 52 | ///添加图片UI弹出 | 280 | ///添加图片UI弹出 |
| 53 | static openImageModalBottomSheet(context, | 281 | static openImageModalBottomSheet(context, |
| 54 | {VoidCallback lCallback, VoidCallback rCallback}) async { | 282 | {VoidCallback lCallback, VoidCallback rCallback}) async { |
| @@ -2974,7 +3202,9 @@ class DialogUtil { | @@ -2974,7 +3202,9 @@ class DialogUtil { | ||
| 2974 | isScrollControlled: true, | 3202 | isScrollControlled: true, |
| 2975 | builder: (BuildContext dialogContext) { | 3203 | builder: (BuildContext dialogContext) { |
| 2976 | Widget widget = Container( | 3204 | Widget widget = Container( |
| 2977 | - color:messageModel.messages.length > 3 ? MyColours.color_24A4A8: MyColours.color_ffffff, | 3205 | + color: messageModel.messages.length > 3 |
| 3206 | + ? MyColours.color_24A4A8 | ||
| 3207 | + : MyColours.color_ffffff, | ||
| 2978 | child: Column( | 3208 | child: Column( |
| 2979 | mainAxisSize: MainAxisSize.min, | 3209 | mainAxisSize: MainAxisSize.min, |
| 2980 | children: <Widget>[ | 3210 | children: <Widget>[ |
| @@ -29,7 +29,7 @@ class RoundButton extends StatelessWidget { | @@ -29,7 +29,7 @@ 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}) | 32 | + this.space = 6, int imageWidth}) |
| 33 | : super(key: key); | 33 | : super(key: key); |
| 34 | 34 | ||
| 35 | final String image; | 35 | final String image; |
-
Please register or login to post a comment