Commit 08077bb6fe1227c7d440527064ca957d6289ccab

Authored by weixin_45529955
1 parent b61ba2d4

修改职级 OK

@@ -55,6 +55,11 @@ class Constant { @@ -55,6 +55,11 @@ class Constant {
55 '管理员', 55 '管理员',
56 '店长', 56 '店长',
57 ], 57 ],
  58 +
  59 + '修改职级': [
  60 + '管理员',
  61 + '店长',
  62 + ],
58 '员工管理': [ 63 '员工管理': [
59 '管理员', 64 '管理员',
60 '店长', 65 '店长',
  1 +class SellerRoleModel {
  2 + int? ret;
  3 + List<SellerRoleSunModel>? data;
  4 + String? msg;
  5 +
  6 + SellerRoleModel({this.ret, this.data, this.msg});
  7 +
  8 + SellerRoleModel.fromJson(Map<dynamic, dynamic> json) {
  9 + ret = json['ret'];
  10 + if (json['data'] != null) {
  11 + data = <SellerRoleSunModel>[];
  12 + json['data'].forEach((v) {
  13 + data!.add(new SellerRoleSunModel.fromJson(v));
  14 + });
  15 + }
  16 + msg = json['msg'];
  17 + }
  18 +
  19 + Map<String, dynamic> toJson() {
  20 + final Map<String, dynamic> data = new Map<String, dynamic>();
  21 + data['ret'] = this.ret;
  22 + if (this.data != null) {
  23 + data['data'] = this.data!.map((v) => v.toJson()).toList();
  24 + }
  25 + data['msg'] = this.msg;
  26 + return data;
  27 + }
  28 +}
  29 +
  30 +class SellerRoleSunModel {
  31 + String? id;
  32 + String? sellerid;
  33 + String? roleName;
  34 + String? roleAliasName;
  35 + String? roleType;
  36 + String? status;
  37 + String? cdate;
  38 + String? level;
  39 +
  40 + SellerRoleSunModel(
  41 + {this.id,
  42 + this.sellerid,
  43 + this.roleName,
  44 + this.roleAliasName,
  45 + this.roleType,
  46 + this.status,
  47 + this.cdate,
  48 + this.level});
  49 +
  50 + SellerRoleSunModel.fromJson(Map<String, dynamic> json) {
  51 + id = json['id'];
  52 + sellerid = json['sellerid'];
  53 + roleName = json['role_name'];
  54 + roleAliasName = json['role_alias_name'];
  55 + roleType = json['role_type'];
  56 + status = json['status'];
  57 + cdate = json['cdate'];
  58 + level = json['level'];
  59 + }
  60 +
  61 + Map<String, dynamic> toJson() {
  62 + final Map<String, dynamic> data = new Map<String, dynamic>();
  63 + data['id'] = this.id;
  64 + data['sellerid'] = this.sellerid;
  65 + data['role_name'] = this.roleName;
  66 + data['role_alias_name'] = this.roleAliasName;
  67 + data['role_type'] = this.roleType;
  68 + data['status'] = this.status;
  69 + data['cdate'] = this.cdate;
  70 + data['level'] = this.level;
  71 + return data;
  72 + }
  73 +}
@@ -611,53 +611,33 @@ class HttpUrl { @@ -611,53 +611,33 @@ class HttpUrl {
611 611
612 static const discount_pay_refund_apply = 612 static const discount_pay_refund_apply =
613 "?service=App.PayOnline.DiscountPayRefundApply"; // 优惠支付订单退款 613 "?service=App.PayOnline.DiscountPayRefundApply"; // 优惠支付订单退款
614 - static const set_activity_config = 614 + static const set_activity_config =
615 "?service=App.Activity.SetActivityConfig"; // 设置商家券赠送规则配置 615 "?service=App.Activity.SetActivityConfig"; // 设置商家券赠送规则配置
616 static const get_activity_config = 616 static const get_activity_config =
617 "?service=App.Activity.GetActivityConfig"; // 获取商家券赠送规则配置 617 "?service=App.Activity.GetActivityConfig"; // 获取商家券赠送规则配置
618 618
619 - static const applyments=  
620 - "?service=App.PayOnline.Applyments"; // 二级商户进件 619 + static const applyments = "?service=App.PayOnline.Applyments"; // 二级商户进件
621 620
622 -  
623 - static const upLoad_applyments= 621 + static const upLoad_applyments =
624 "?service=App.PayOnline.UpLoadApplyments"; // 上传身份证、营业执照图片 622 "?service=App.PayOnline.UpLoadApplyments"; // 上传身份证、营业执照图片
625 623
626 -  
627 - static const get_reserve_deposit_order_list= 624 + static const get_reserve_deposit_order_list =
628 "?service=App.Reserve.GetReserveDepositOrderList"; // 获取商家定金订单列表 625 "?service=App.Reserve.GetReserveDepositOrderList"; // 获取商家定金订单列表
629 626
630 - static const get_reserve_deposit_order= 627 + static const get_reserve_deposit_order =
631 "?service=App.Reserve.GetReserveDepositOrder"; // 获取商家定金订单详情 628 "?service=App.Reserve.GetReserveDepositOrder"; // 获取商家定金订单详情
632 - static const get_order_recharge_list= 629 + static const get_order_recharge_list =
633 "?service=App.Activity.GetOrderRechargeList"; // 获取会员储值支付订单列表 630 "?service=App.Activity.GetOrderRechargeList"; // 获取会员储值支付订单列表
634 631
635 - static const get_order_recharge_order_info= 632 + static const get_order_recharge_order_info =
636 "?service=App.Activity.GetOrderRechargeOrderInfo"; //通过支付订单号或退款订单号获取会员充值订单 633 "?service=App.Activity.GetOrderRechargeOrderInfo"; //通过支付订单号或退款订单号获取会员充值订单
637 634
638 -  
639 - static const recharge_refund_apply= 635 + static const recharge_refund_apply =
640 "?service=App.PayOnline.RechargeRefundApply"; // 新版购买优惠券退款(会员充值退款) 636 "?service=App.PayOnline.RechargeRefundApply"; // 新版购买优惠券退款(会员充值退款)
641 637
642 -  
643 -static const get_seller_hide_conf= 638 + static const get_seller_hide_conf =
644 "?service=App.Seller.GetSellerHideConf"; // 获取商家隐藏订单日期配置列表 639 "?service=App.Seller.GetSellerHideConf"; // 获取商家隐藏订单日期配置列表
645 640
646 -  
647 -  
648 -  
649 -  
650 -  
651 -  
652 -  
653 -  
654 -  
655 -  
656 -  
657 -  
658 -  
659 -  
660 -  
661 -  
662 - 641 + static const get_seller_role_list =
  642 + "?service=App.Seller.GetSellerRoleList"; // 获取商家角色列表
663 } 643 }
1 -  
2 import 'dart:async'; 1 import 'dart:async';
3 import 'dart:convert'; 2 import 'dart:convert';
4 3
@@ -7,9 +6,11 @@ import 'package:common_utils/common_utils.dart'; @@ -7,9 +6,11 @@ import 'package:common_utils/common_utils.dart';
7 import 'package:dio/dio.dart'; 6 import 'package:dio/dio.dart';
8 import 'package:flutter/material.dart'; 7 import 'package:flutter/material.dart';
9 import 'package:flutter_screenutil/flutter_screenutil.dart'; 8 import 'package:flutter_screenutil/flutter_screenutil.dart';
  9 +import 'package:one_key/app.dart';
10 import 'package:one_key/constant/state.dart'; 10 import 'package:one_key/constant/state.dart';
11 import 'package:one_key/models/get_seller_info_model.dart'; 11 import 'package:one_key/models/get_seller_info_model.dart';
12 import 'package:one_key/models/personnel_manage_model.dart'; 12 import 'package:one_key/models/personnel_manage_model.dart';
  13 +import 'package:one_key/models/user.dart';
13 import 'package:one_key/net/dio_util.dart'; 14 import 'package:one_key/net/dio_util.dart';
14 import 'package:one_key/provider/personnel_provider.dart'; 15 import 'package:one_key/provider/personnel_provider.dart';
15 import 'package:one_key/provider/store_wine_provider.dart'; 16 import 'package:one_key/provider/store_wine_provider.dart';
@@ -57,13 +58,19 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -57,13 +58,19 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
57 bool isall = false; 58 bool isall = false;
58 bool isbook = false; 59 bool isbook = false;
59 bool isserver = false; 60 bool isserver = false;
  61 +
  62 + String? position = '';
60 @override 63 @override
61 void initState() { 64 void initState() {
62 super.initState(); 65 super.initState();
63 66
  67 + position = widget.position;
  68 +
64 WidgetsBinding.instance.addPostFrameCallback((timeStamp) { 69 WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
65 _getSellerUserBySellerid(); 70 _getSellerUserBySellerid();
66 _getAuthUserLists(); 71 _getAuthUserLists();
  72 +
  73 + _getSellerRoleList();
67 EventBus().on('personnel_manage_detail_page', (arg) { 74 EventBus().on('personnel_manage_detail_page', (arg) {
68 _getAuthUserLists(showLoading: false); 75 _getAuthUserLists(showLoading: false);
69 }); 76 });
@@ -74,9 +81,9 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -74,9 +81,9 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
74 // if (roleNameLogin == '管理员') { 81 // if (roleNameLogin == '管理员') {
75 // canEdit = true; 82 // canEdit = true;
76 // } else if (roleNameLogin == '店长') { 83 // } else if (roleNameLogin == '店长') {
77 - // if (widget.position == '管理员') { 84 + // if (position == '管理员') {
78 // canEdit = false; 85 // canEdit = false;
79 - // } else if (widget.position == '店长') { 86 + // } else if (position == '店长') {
80 // if (accountLogin == data.account) { 87 // if (accountLogin == data.account) {
81 // print('11111'); 88 // print('11111');
82 // //店长自己 89 // //店长自己
@@ -144,6 +151,16 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -144,6 +151,16 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
144 // } 151 // }
145 } 152 }
146 153
  154 + _getSellerRoleList({bool showLoading = true}) async {
  155 + Map<String, String?> params = {
  156 + "sellerid": Provider.of<UserModel>(context, listen: false).user!.sellerid,
  157 + "sid": Provider.of<UserModel>(context, listen: false).user!.sellerid,
  158 + };
  159 +
  160 + await personnelProvider.getSellerRoleList(context, params,
  161 + showLoading: showLoading);
  162 + }
  163 +
147 //获取员工信息列表 164 //获取员工信息列表
148 _getAuthUserLists({bool showLoading = true}) async { 165 _getAuthUserLists({bool showLoading = true}) async {
149 Map<String, String?> params = { 166 Map<String, String?> params = {
@@ -153,19 +170,19 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -153,19 +170,19 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
153 await personnelProvider.getAuthUserLists(context, params, 170 await personnelProvider.getAuthUserLists(context, params,
154 showLoading: showLoading); 171 showLoading: showLoading);
155 if (personnelProvider.dataMap != null) { 172 if (personnelProvider.dataMap != null) {
156 - if (widget.position == '管理员') { 173 + if (position == '管理员') {
157 data = personnelProvider.dataMap!.admin!.listdata![widget.index!]; 174 data = personnelProvider.dataMap!.admin!.listdata![widget.index!];
158 - } else if (widget.position == '店长') { 175 + } else if (position == '店长') {
159 data = personnelProvider.dataMap!.shopowner!.listdata![widget.index!]; 176 data = personnelProvider.dataMap!.shopowner!.listdata![widget.index!];
160 - } else if (widget.position == '客户经理') { 177 + } else if (position == '客户经理') {
161 data = personnelProvider.dataMap!.manager!.listdata![widget.index!]; 178 data = personnelProvider.dataMap!.manager!.listdata![widget.index!];
162 - } else if (widget.position == '收银员') { 179 + } else if (position == '收银员') {
163 data = personnelProvider.dataMap!.cashier!.listdata![widget.index!]; 180 data = personnelProvider.dataMap!.cashier!.listdata![widget.index!];
164 - } else if (widget.position == '服务员') { 181 + } else if (position == '服务员') {
165 data = personnelProvider.dataMap!.waiter!.listdata![widget.index!]; 182 data = personnelProvider.dataMap!.waiter!.listdata![widget.index!];
166 - } else if (widget.position == '前台') { 183 + } else if (position == '前台') {
167 data = personnelProvider.dataMap!.reception!.listdata![widget.index!]; 184 data = personnelProvider.dataMap!.reception!.listdata![widget.index!];
168 - } else if (widget.position == '迎宾') { 185 + } else if (position == '迎宾') {
169 data = personnelProvider.dataMap!.welcome!.listdata![widget.index!]; 186 data = personnelProvider.dataMap!.welcome!.listdata![widget.index!];
170 } 187 }
171 if (data!.accountType == null || data!.accountType == '1') { 188 if (data!.accountType == null || data!.accountType == '1') {
@@ -178,8 +195,9 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -178,8 +195,9 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
178 nickName = data!.nickName != null && data!.nickName != 'null' 195 nickName = data!.nickName != null && data!.nickName != 'null'
179 ? data!.nickName 196 ? data!.nickName
180 : '暂未设置名称'; 197 : '暂未设置名称';
181 - phone =  
182 - data!.phone != null && data!.userName != 'null' ? data!.phone : '添加手机号'; 198 + phone = data!.phone != null && data!.userName != 'null'
  199 + ? data!.phone
  200 + : '添加手机号';
183 if (data!.openid == null || data!.openid == 'null') { 201 if (data!.openid == null || data!.openid == 'null') {
184 // _getStoreBaseinfo(); 202 // _getStoreBaseinfo();
185 _getWechatQrcode(); 203 _getWechatQrcode();
@@ -222,23 +240,40 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -222,23 +240,40 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
222 if (success) { 240 if (success) {
223 //删除员工成功 241 //删除员工成功
224 EventBus().emit('personnel_manage_page'); 242 EventBus().emit('personnel_manage_page');
225 - if (Navigator.canPop(context)) {  
226 - Navigator.pop(context);  
227 - } 243 + if (Navigator.canPop(context)) {
  244 + Navigator.pop(context);
  245 + }
228 } 246 }
229 } 247 }
230 248
231 ///编辑店员 249 ///编辑店员
232 - _editAuthUser(String name, {bool showLoading = true}) async {  
233 - Map<String, String?> params = {'id': data!.id, 'user_name': name}; 250 + _editAuthUser(String roleId, {bool showLoading = true}) async {
  251 + Map<String, String?> params = {'id': data!.id, 'role_id': roleId};
234 252
235 bool success = await personnelProvider.editAuthUser(context, params, 253 bool success = await personnelProvider.editAuthUser(context, params,
236 showLoading: showLoading); 254 showLoading: showLoading);
237 if (success) { 255 if (success) {
238 EventBus().emit('personnel_manage_page'); 256 EventBus().emit('personnel_manage_page');
  257 +
239 setState(() { 258 setState(() {
240 - nickName = name; 259 + int index = personnelProvider.roleList!
  260 + .indexWhere((element) => element.id == roleId);
  261 + position = personnelProvider.roleList![index].roleName;
  262 + //当前页面的角色展示刷新,我的页面取值从缓存,刷新缓存
241 }); 263 });
  264 +
  265 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  266 + if (data?.id == userModel.user!.openid) {
  267 + //如果修改的是本人的话,需要刷新缓存,我的页面会显示缓存的数据
  268 + if (App.sp!.containsKey('user')) {
  269 + String s = App.sp!.getString('user')!;
  270 + User _user = User.fromJson(json.decode(s));
  271 +
  272 + _user.role_name_addition = position;
  273 +
  274 + await UserModel().saveUserInfo(_user);
  275 + }
  276 + }
242 } 277 }
243 } 278 }
244 279
@@ -399,12 +434,15 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -399,12 +434,15 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
399 'uid': data!.id, 434 'uid': data!.id,
400 'account_type': accountType 435 'account_type': accountType
401 }; 436 };
402 - bool success = await personnelProvider.setSellerUserAccountType(context, params);  
403 - if(success && accountType == '3' && data!.id == Provider.of<UserModel>(context,listen: false).user!.openid){  
404 - //把自己设置成只服不订人员,需要跳转到已预订页面  
405 - NavigatorUtil.goHomePage(context,initialIndex: 1);  
406 -  
407 - } 437 + bool success =
  438 + await personnelProvider.setSellerUserAccountType(context, params);
  439 + if (success &&
  440 + accountType == '3' &&
  441 + data!.id ==
  442 + Provider.of<UserModel>(context, listen: false).user!.openid) {
  443 + //把自己设置成只服不订人员,需要跳转到已预订页面
  444 + NavigatorUtil.goHomePage(context, initialIndex: 1);
  445 + }
408 } 446 }
409 447
410 @override 448 @override
@@ -421,8 +459,8 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -421,8 +459,8 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
421 appBar: SystemAppBar( 459 appBar: SystemAppBar(
422 '员工详情', 460 '员工详情',
423 onTap: () { 461 onTap: () {
424 - if (Navigator.canPop(context)) {  
425 - Navigator.pop(context); 462 + if (Navigator.canPop(context)) {
  463 + Navigator.pop(context);
426 } 464 }
427 }, 465 },
428 ), 466 ),
@@ -474,7 +512,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -474,7 +512,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
474 radius: ScreenUtil().setWidth(26 * 2), 512 radius: ScreenUtil().setWidth(26 * 2),
475 onPressed: () { 513 onPressed: () {
476 NavigatorUtil.goPersonnalBaseInfoPage( 514 NavigatorUtil.goPersonnalBaseInfoPage(
477 - context, data, widget.position!); 515 + context, data, position!);
478 }), 516 }),
479 ), 517 ),
480 Column( 518 Column(
@@ -517,7 +555,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -517,7 +555,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
517 textColor: MyColours.color_ffffff, 555 textColor: MyColours.color_ffffff,
518 radius: ScreenUtil().setWidth(10), 556 radius: ScreenUtil().setWidth(10),
519 onPressed: () {}), 557 onPressed: () {}),
520 - Text('${widget.position} 工号: ${data?.account}', 558 + Text('${position} 工号: ${data?.account}',
521 style: TextStyle( 559 style: TextStyle(
522 color: MyColours.color_515151, 560 color: MyColours.color_515151,
523 fontSize: ScreenUtil().setSp(28), 561 fontSize: ScreenUtil().setSp(28),
@@ -563,82 +601,84 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -563,82 +601,84 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
563 ], 601 ],
564 ), 602 ),
565 VEmptyView(56), 603 VEmptyView(56),
566 - if(widget.position != '管理员') Container(  
567 - height: w(84),  
568 - padding:  
569 - EdgeInsets.symmetric(horizontal: w(20), vertical: w(12)),  
570 - child: Column(  
571 - crossAxisAlignment: CrossAxisAlignment.start,  
572 - children: [  
573 - Text(  
574 - '预订与服务权限',  
575 - style: TextStyle(  
576 - fontSize: font(16), color: MyColours.color_515151),  
577 - ),  
578 - VEmptyView(24),  
579 - Container(  
580 - height: w(24),  
581 - child: Row(  
582 - children: [  
583 - HEmptyView(32),  
584 - _itemRadioWidget(isall, '预订及服务', onTap: () {  
585 - if (Utils.getAuthority(context, '设置服务人员')) {  
586 - if (!isall) {  
587 - setState(() {  
588 - isall = true;  
589 -  
590 - isbook = false;  
591 - isserver = false;  
592 - });  
593 - _setSellerUserAccountType('1'); 604 + if (position != '管理员')
  605 + Container(
  606 + height: w(84),
  607 + padding:
  608 + EdgeInsets.symmetric(horizontal: w(20), vertical: w(12)),
  609 + child: Column(
  610 + crossAxisAlignment: CrossAxisAlignment.start,
  611 + children: [
  612 + Text(
  613 + '预订与服务权限',
  614 + style: TextStyle(
  615 + fontSize: font(16), color: MyColours.color_515151),
  616 + ),
  617 + VEmptyView(24),
  618 + Container(
  619 + height: w(24),
  620 + child: Row(
  621 + children: [
  622 + HEmptyView(32),
  623 + _itemRadioWidget(isall, '预订及服务', onTap: () {
  624 + if (Utils.getAuthority(context, '设置服务人员')) {
  625 + if (!isall) {
  626 + setState(() {
  627 + isall = true;
  628 +
  629 + isbook = false;
  630 + isserver = false;
  631 + });
  632 + _setSellerUserAccountType('1');
  633 + }
  634 + } else {
  635 + Utils.showToast('您没有相关权限权限');
594 } 636 }
595 - } else {  
596 - Utils.showToast('您没有相关权限权限');  
597 - }  
598 - }),  
599 - Spacer(),  
600 - _itemRadioWidget(isbook, '只订不服', onTap: () {  
601 - if (Utils.getAuthority(context, '设置服务人员')) {  
602 - if (!isbook) {  
603 - setState(() {  
604 - isbook = true;  
605 -  
606 - isall = false;  
607 - isserver = false;  
608 - });  
609 - _setSellerUserAccountType('2'); 637 + }),
  638 + Spacer(),
  639 + _itemRadioWidget(isbook, '只订不服', onTap: () {
  640 + if (Utils.getAuthority(context, '设置服务人员')) {
  641 + if (!isbook) {
  642 + setState(() {
  643 + isbook = true;
  644 +
  645 + isall = false;
  646 + isserver = false;
  647 + });
  648 + _setSellerUserAccountType('2');
  649 + }
  650 + } else {
  651 + Utils.showToast('您没有相关权限权限');
610 } 652 }
611 - } else {  
612 - Utils.showToast('您没有相关权限权限');  
613 - }  
614 - }),  
615 - Spacer(),  
616 - _itemRadioWidget(isserver, '只服不订', onTap: () {  
617 - if (Utils.getAuthority(context, '设置服务人员')) {  
618 - if (!isserver) {  
619 - setState(() {  
620 - isserver = true;  
621 - isall = false;  
622 - isbook = false;  
623 - });  
624 - _setSellerUserAccountType('3'); 653 + }),
  654 + Spacer(),
  655 + _itemRadioWidget(isserver, '只服不订', onTap: () {
  656 + if (Utils.getAuthority(context, '设置服务人员')) {
  657 + if (!isserver) {
  658 + setState(() {
  659 + isserver = true;
  660 + isall = false;
  661 + isbook = false;
  662 + });
  663 + _setSellerUserAccountType('3');
  664 + }
  665 + } else {
  666 + Utils.showToast('您没有相关权限权限');
625 } 667 }
626 - } else {  
627 - Utils.showToast('您没有相关权限权限');  
628 - }  
629 - }),  
630 - HEmptyView(30),  
631 - ],  
632 - ),  
633 - )  
634 - ], 668 + }),
  669 + HEmptyView(30),
  670 + ],
  671 + ),
  672 + )
  673 + ],
  674 + ),
635 ), 675 ),
636 - ),  
637 676
638 - if(widget.position != '管理员') Padding(  
639 - padding: EdgeInsets.only(left: w(20), right: w(16)),  
640 - child: MyDivider(double.infinity, w(1),  
641 - color: MyColours.color_DBDBDB)), 677 + if (position != '管理员')
  678 + Padding(
  679 + padding: EdgeInsets.only(left: w(20), right: w(16)),
  680 + child: MyDivider(double.infinity, w(1),
  681 + color: MyColours.color_DBDBDB)),
642 VEmptyView(32), 682 VEmptyView(32),
643 683
644 (data?.openid == null || data?.openid == 'null') 684 (data?.openid == null || data?.openid == 'null')
@@ -694,6 +734,32 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -694,6 +734,32 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
694 color: MyColours.color_438E93, 734 color: MyColours.color_438E93,
695 fontSize: ScreenUtil().setSp(28)), 735 fontSize: ScreenUtil().setSp(28)),
696 )), 736 )),
  737 + if (Utils.getAuthority(context, '修改职级')) VEmptyView(48),
  738 + if (Utils.getAuthority(context, '修改职级'))
  739 + InkWell(
  740 + onTap: () async {
  741 + if (personnelProvider.roleList == null ||
  742 + personnelProvider.roleList?.length == 0) {
  743 + //没有角色数据
  744 + await _getSellerRoleList();
  745 + }
  746 + await DialogUtil.changeRoleDialog(
  747 + context, personnelProvider.roleList, position ?? '',
  748 + onTap: (map) {
  749 + print(map);
  750 + String? roleId = map['role'];
  751 + if (roleId != null) {
  752 + _editAuthUser(roleId);
  753 + }
  754 + });
  755 + },
  756 + child: Text(
  757 + '修改职级',
  758 + style: TextStyle(
  759 + decoration: TextDecoration.underline,
  760 + color: MyColours.color_438E93,
  761 + fontSize: ScreenUtil().setSp(28)),
  762 + )),
697 VEmptyView(40), 763 VEmptyView(40),
698 764
699 // (userModel.user.role_name == '管理员' || 765 // (userModel.user.role_name == '管理员' ||
@@ -844,7 +910,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -844,7 +910,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
844 // ), 910 // ),
845 // HEmptyView(20), 911 // HEmptyView(20),
846 // Text( 912 // Text(
847 - // widget.position, 913 + // position,
848 // style: TextStyle( 914 // style: TextStyle(
849 // fontSize: ScreenUtil().setWidth(28), 915 // fontSize: ScreenUtil().setWidth(28),
850 // color: MyColours.color_199095), 916 // color: MyColours.color_199095),
@@ -868,7 +934,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -868,7 +934,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
868 ], 934 ],
869 ), 935 ),
870 )), 936 )),
871 - if (widget.position != '管理员') 937 + if (position != '管理员')
872 InkWell( 938 InkWell(
873 onTap: () async { 939 onTap: () async {
874 await DialogUtil.removePersonnalDialog( 940 await DialogUtil.removePersonnalDialog(
@@ -7,6 +7,7 @@ import 'package:one_key/models/filter_btn_model.dart'; @@ -7,6 +7,7 @@ import 'package:one_key/models/filter_btn_model.dart';
7 import 'package:one_key/models/get_seller_info_model.dart'; 7 import 'package:one_key/models/get_seller_info_model.dart';
8 import 'package:one_key/models/get_seller_user_by_sellerid_model.dart'; 8 import 'package:one_key/models/get_seller_user_by_sellerid_model.dart';
9 import 'package:one_key/models/personnel_manage_model.dart'; 9 import 'package:one_key/models/personnel_manage_model.dart';
  10 +import 'package:one_key/models/seller_role_model.dart';
10 import 'package:one_key/net/base_resp.dart'; 11 import 'package:one_key/net/base_resp.dart';
11 import 'package:one_key/net/dio_util.dart'; 12 import 'package:one_key/net/dio_util.dart';
12 13
@@ -27,6 +28,8 @@ class PersonnelProvider extends ChangeNotifier { @@ -27,6 +28,8 @@ class PersonnelProvider extends ChangeNotifier {
27 int? manageSelIndex; //当前选中 28 int? manageSelIndex; //当前选中
28 List<SellerUserAccountTypeSunModel>? serverList = []; //服务人员 29 List<SellerUserAccountTypeSunModel>? serverList = []; //服务人员
29 30
  31 + List<SellerRoleSunModel>? roleList = [];
  32 +
30 /// 设置账号服务类型 33 /// 设置账号服务类型
31 Future<bool> setSellerUserAccountType( 34 Future<bool> setSellerUserAccountType(
32 BuildContext context, Map<String, String?> params, 35 BuildContext context, Map<String, String?> params,
@@ -117,6 +120,27 @@ class PersonnelProvider extends ChangeNotifier { @@ -117,6 +120,27 @@ class PersonnelProvider extends ChangeNotifier {
117 } 120 }
118 } 121 }
119 122
  123 + /// 获取角色列表
  124 + getSellerRoleList(BuildContext context, Map<String, String?> params,
  125 + {showLoading = false}) async {
  126 + try {
  127 + BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
  128 + context, Method.post, HttpUrl.get_seller_role_list,
  129 + data: params, showLoading: showLoading);
  130 + if (baseResp != null && baseResp.code == Constant.status_success) {
  131 + roleList = SellerRoleModel.fromJson(baseResp.responseData!).data ?? [];
  132 + } else {
  133 + Utils.showToast(baseResp.msg ?? "");
  134 + }
  135 +
  136 + notifyListeners();
  137 + return roleList;
  138 + } catch (error) {
  139 + print(error.toString());
  140 + }
  141 + return [];
  142 + }
  143 +
120 /// 获取店员列表 144 /// 获取店员列表
121 getAuthUserLists(BuildContext context, Map<String, String?> params, 145 getAuthUserLists(BuildContext context, Map<String, String?> params,
122 {showLoading = false}) async { 146 {showLoading = false}) async {
@@ -133,9 +157,7 @@ class PersonnelProvider extends ChangeNotifier { @@ -133,9 +157,7 @@ class PersonnelProvider extends ChangeNotifier {
133 tempData[keyTemp] = {'listdata': value, 'role_id': role_id}; 157 tempData[keyTemp] = {'listdata': value, 'role_id': role_id};
134 }); 158 });
135 baseResp.responseData!['data'] = tempData; 159 baseResp.responseData!['data'] = tempData;
136 - dataMap = PersonnelManageModel.fromJson(  
137 - baseResp.responseData!)  
138 - .data; 160 + dataMap = PersonnelManageModel.fromJson(baseResp.responseData!).data;
139 dataMap!.admin!.hasWechatNum = 0; 161 dataMap!.admin!.hasWechatNum = 0;
140 dataMap!.admin!.listdata!.forEach((item) { 162 dataMap!.admin!.listdata!.forEach((item) {
141 // for (PersonnelManageSunModel item in dataMap!.admin!.listdata!) { 163 // for (PersonnelManageSunModel item in dataMap!.admin!.listdata!) {
@@ -220,8 +242,7 @@ class PersonnelProvider extends ChangeNotifier { @@ -220,8 +242,7 @@ class PersonnelProvider extends ChangeNotifier {
220 } 242 }
221 243
222 /// 添加店员 244 /// 添加店员
223 - Future<bool> addSellerClerk(  
224 - BuildContext context, Map<String, String?> params, 245 + Future<bool> addSellerClerk(BuildContext context, Map<String, String?> params,
225 {showLoading = false}) async { 246 {showLoading = false}) async {
226 try { 247 try {
227 BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>( 248 BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
@@ -242,8 +263,7 @@ class PersonnelProvider extends ChangeNotifier { @@ -242,8 +263,7 @@ class PersonnelProvider extends ChangeNotifier {
242 } 263 }
243 264
244 /// 删除店员 265 /// 删除店员
245 - Future<bool> delSellerClerk(  
246 - BuildContext context, Map<String, String?> params, 266 + Future<bool> delSellerClerk(BuildContext context, Map<String, String?> params,
247 {showLoading = false}) async { 267 {showLoading = false}) async {
248 try { 268 try {
249 BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>( 269 BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
@@ -343,8 +363,7 @@ class PersonnelProvider extends ChangeNotifier { @@ -343,8 +363,7 @@ class PersonnelProvider extends ChangeNotifier {
343 } 363 }
344 364
345 /// 设置商家接单人 365 /// 设置商家接单人
346 - Future<bool> setUserIsCall(  
347 - BuildContext context, Map<String, String?> params, 366 + Future<bool> setUserIsCall(BuildContext context, Map<String, String?> params,
348 {showLoading = false}) async { 367 {showLoading = false}) async {
349 try { 368 try {
350 BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>( 369 BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
@@ -383,8 +402,7 @@ class PersonnelProvider extends ChangeNotifier { @@ -383,8 +402,7 @@ class PersonnelProvider extends ChangeNotifier {
383 } 402 }
384 403
385 /// 员工密码修改 404 /// 员工密码修改
386 - Future<bool> updatePassword(  
387 - BuildContext context, Map<String, String?> params, 405 + Future<bool> updatePassword(BuildContext context, Map<String, String?> params,
388 {showLoading = false}) async { 406 {showLoading = false}) async {
389 try { 407 try {
390 BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>( 408 BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
@@ -16,6 +16,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -16,6 +16,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
16 import 'package:one_key/constant/constant.dart'; 16 import 'package:one_key/constant/constant.dart';
17 import 'package:one_key/models/filter_btn_model.dart'; 17 import 'package:one_key/models/filter_btn_model.dart';
18 import 'package:one_key/models/remark.dart'; 18 import 'package:one_key/models/remark.dart';
  19 +import 'package:one_key/models/seller_role_model.dart';
19 import 'package:one_key/models/table_list.dart'; 20 import 'package:one_key/models/table_list.dart';
20 import 'package:one_key/pages/message/message_dialog_item.dart'; 21 import 'package:one_key/pages/message/message_dialog_item.dart';
21 import 'package:one_key/pages/message/message_dialog_item_f.dart'; 22 import 'package:one_key/pages/message/message_dialog_item_f.dart';
@@ -2530,6 +2531,195 @@ class DialogUtil { @@ -2530,6 +2531,195 @@ class DialogUtil {
2530 }); 2531 });
2531 } 2532 }
2532 2533
  2534 + static Future changeRoleDialog(BuildContext context,
  2535 + List<SellerRoleSunModel>? roleList, String roleNameCurr,
  2536 + {CustomCallBackMap? onTap}) async {
  2537 + int currentIndex = 0;
  2538 +
  2539 + if (roleNameCurr != '') {
  2540 + // 存在角色数据
  2541 + currentIndex =
  2542 + roleList!.indexWhere((element) => element.roleName == roleNameCurr);
  2543 + }
  2544 + String? roleName = roleList?[currentIndex].roleName;
  2545 + final action = await showDialog(
  2546 + context: context,
  2547 + barrierDismissible: false,
  2548 + builder: (BuildContext context) {
  2549 + return
  2550 + // Scaffold(
  2551 + // resizeToAvoidBottomInset: false,
  2552 + // backgroundColor: Colors.transparent,
  2553 + // body:
  2554 + Center(child: StatefulBuilder(builder: (context, state) {
  2555 + // globalState = state;
  2556 +
  2557 + return Material(
  2558 + color: Colors.transparent,
  2559 + child: Stack(
  2560 + clipBehavior: Clip.none,
  2561 + children: [
  2562 + Container(
  2563 + margin:
  2564 + EdgeInsets.only(bottom: ScreenUtil().setWidth(150)),
  2565 + padding: EdgeInsets.symmetric(
  2566 + horizontal: ScreenUtil().setWidth(40)),
  2567 + // height: ScreenUtil().setWidth(238 * 2),
  2568 + decoration: BoxDecoration(
  2569 + borderRadius: BorderRadius.circular(
  2570 + ScreenUtil().setWidth(16))),
  2571 + child: Card(
  2572 + shape: RoundedRectangleBorder(
  2573 + borderRadius: BorderRadius.all(Radius.circular(
  2574 + ScreenUtil().setWidth(16)))), //设置圆角
  2575 + child: Column(
  2576 + mainAxisSize: MainAxisSize.min,
  2577 + children: [
  2578 + VEmptyView(64),
  2579 + Container(
  2580 + height: ScreenUtil().setWidth(48),
  2581 + alignment: Alignment.center,
  2582 + child: Text('修改职级',
  2583 + style: TextStyle(
  2584 + fontWeight: FontWeight.bold,
  2585 + fontSize: ScreenUtil().setSp(32),
  2586 + color: Color.fromRGBO(0, 0, 0, 0.9))),
  2587 + ),
  2588 + VEmptyView(40),
  2589 + // Text('移除员工并把该员工的客户',
  2590 + // style: TextStyle(
  2591 + // fontSize: ScreenUtil().setSp(32),
  2592 + // color: Color.fromRGBO(0, 0, 0, 0.6))),
  2593 + VEmptyView(36),
  2594 + Row(
  2595 + mainAxisAlignment:
  2596 + MainAxisAlignment.spaceBetween,
  2597 + children: [
  2598 + HEmptyView(56),
  2599 + Text('将当前员工修改为',
  2600 + style: TextStyle(
  2601 + fontSize: ScreenUtil().setSp(28),
  2602 + color: MyColours.color_515151)),
  2603 + HEmptyView(32),
  2604 + InkWell(
  2605 + onTap: () {
  2606 + List<String?> list = [];
  2607 + for (SellerRoleSunModel item
  2608 + in roleList!) {
  2609 + list.add(item.roleName);
  2610 + }
  2611 + DialogUtil.showSelectCusmanDialog(
  2612 + context, list, (value) async {
  2613 + if (value != null) {
  2614 + currentIndex = value.first;
  2615 + roleName = list[value.first];
  2616 + state(() {});
  2617 + }
  2618 + },
  2619 + selecteds: currentIndex == null
  2620 + ? []
  2621 + : [currentIndex])
  2622 + .then((value) {});
  2623 + },
  2624 + child: Container(
  2625 + padding: EdgeInsets.symmetric(
  2626 + vertical: ScreenUtil().setWidth(16),
  2627 + horizontal:
  2628 + ScreenUtil().setWidth(24)),
  2629 + width: ScreenUtil().setWidth(138 * 2),
  2630 + height: ScreenUtil().setWidth(40 * 2),
  2631 + decoration: BoxDecoration(
  2632 + borderRadius: BorderRadius.circular(
  2633 + ScreenUtil().setWidth(20)),
  2634 + border: Border.all(
  2635 + color: MyColours.color_438E93,
  2636 + width:
  2637 + ScreenUtil().setWidth(2))),
  2638 + child: Row(
  2639 + crossAxisAlignment:
  2640 + CrossAxisAlignment.center,
  2641 + children: [
  2642 + Expanded(
  2643 + child: Text(
  2644 + roleName ?? '',
  2645 + maxLines: 1,
  2646 + textAlign: TextAlign.center,
  2647 + overflow: TextOverflow.ellipsis,
  2648 + style: TextStyle(
  2649 + fontSize:
  2650 + ScreenUtil().setSp(28),
  2651 + color:
  2652 + MyColours.color_438E93),
  2653 + )),
  2654 + HEmptyView(14),
  2655 + Image.asset(
  2656 + Utils.getImgPath(
  2657 + 'c_arrow_down'),
  2658 + width:
  2659 + ScreenUtil().setWidth(20)),
  2660 + ],
  2661 + ),
  2662 + )),
  2663 + HEmptyView(56),
  2664 + ],
  2665 + ),
  2666 + VEmptyView(40),
  2667 + MyDivider(
  2668 + double.infinity, ScreenUtil().setWidth(2),
  2669 + color: MyColours.color_f3f3f3),
  2670 + Row(
  2671 + // mainAxisAlignment:
  2672 + // MainAxisAlignment.spaceBetween,
  2673 + children: [
  2674 + RoundButton(
  2675 + text: '取消',
  2676 + width: (ScreenUtil().screenWidth -
  2677 + ScreenUtil().setWidth(62) * 2) /
  2678 + 2,
  2679 + height: ScreenUtil().setWidth(112),
  2680 + // radius: ScreenUtil().setWidth(10),
  2681 + gradientStart: Colors.transparent,
  2682 + gradientEnd: Colors.transparent,
  2683 + textColor: MyColours.color_000000,
  2684 + isBold: false,
  2685 + fontSize: 28,
  2686 + onPressed: () {
  2687 + if (Navigator.canPop(context)) {
  2688 + Navigator.pop(context);
  2689 + }
  2690 + }),
  2691 + MyDivider(ScreenUtil().setWidth(2),
  2692 + ScreenUtil().setWidth(112),
  2693 + color: MyColours.color_f3f3f3),
  2694 + RoundButton(
  2695 + text: '确定',
  2696 + width: (ScreenUtil().screenWidth -
  2697 + ScreenUtil().setWidth(62) * 2) /
  2698 + 2,
  2699 + height: ScreenUtil().setWidth(112),
  2700 + // radius: ScreenUtil().setWidth(10),
  2701 + gradientStart: Colors.transparent,
  2702 + gradientEnd: Colors.transparent,
  2703 + textColor: MyColours.color_438E93,
  2704 + fontSize: 28,
  2705 + onPressed: () {
  2706 + onTap!({
  2707 + 'role': roleList![currentIndex].id,
  2708 + });
  2709 + if (Navigator.canPop(context)) {
  2710 + Navigator.pop(context);
  2711 + }
  2712 + }),
  2713 + ])
  2714 + ],
  2715 + ),
  2716 + )),
  2717 + ],
  2718 + ));
  2719 + }));
  2720 + });
  2721 + }
  2722 +
2533 static Future removePersonnalDialog( 2723 static Future removePersonnalDialog(
2534 BuildContext context, List<FilterBtnModel> managerList, 2724 BuildContext context, List<FilterBtnModel> managerList,
2535 {CustomCallBackMap? onTap}) async { 2725 {CustomCallBackMap? onTap}) async {
This diff could not be displayed because it is too large.