Commit 71a7a8ce1d6525c49981b6dddf70033752e27917

Authored by wdn127929
1 parent 7fa3544b

店员展示,店员详情UI

@@ -11,14 +11,14 @@ if (flutterRoot == null) { @@ -11,14 +11,14 @@ if (flutterRoot == null) {
11 throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 11 throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 } 12 }
13 13
14 -def flutterVersionCode = "302" 14 +def flutterVersionCode = "303"
15 if (flutterVersionCode == null) { 15 if (flutterVersionCode == null) {
16 - flutterVersionCode = '302' 16 + flutterVersionCode = '303'
17 } 17 }
18 18
19 -def flutterVersionName = "3.0.2" 19 +def flutterVersionName = "3.0.3"
20 if (flutterVersionName == null) { 20 if (flutterVersionName == null) {
21 - flutterVersionName = '3.0.2' 21 + flutterVersionName = '3.0.3'
22 } 22 }
23 23
24 apply plugin: 'com.android.application' 24 apply plugin: 'com.android.application'
  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'personnel_manage_model.g.dart';
  4 +
  5 +@JsonSerializable()
  6 +class PersonnelManageModel extends Object {
  7 + @JsonKey(name: 'ret')
  8 + int ret;
  9 +
  10 + @JsonKey(name: 'data')
  11 + PersonnelManageModelData data;
  12 +
  13 + @JsonKey(name: 'msg')
  14 + String msg;
  15 +
  16 + PersonnelManageModel(
  17 + this.ret,
  18 + this.data,
  19 + this.msg,
  20 + );
  21 +
  22 + factory PersonnelManageModel.fromJson(Map<String, dynamic> srcJson) =>
  23 + _$PersonnelManageModelFromJson(srcJson);
  24 +
  25 + Map<String, dynamic> toJson() => _$PersonnelManageModelToJson(this);
  26 +}
  27 +
  28 +@JsonSerializable()
  29 +class PersonnelManageModelData extends Object {
  30 + @JsonKey(name: 'admin')
  31 + Admin admin;
  32 +
  33 + @JsonKey(name: 'shopowner')
  34 + Shopowner shopowner;
  35 +
  36 + @JsonKey(name: 'cashier')
  37 + Cashier cashier;
  38 +
  39 + @JsonKey(name: 'waiter')
  40 + Waiter waiter;
  41 +
  42 + @JsonKey(name: 'manager')
  43 + Manager manager;
  44 +
  45 + PersonnelManageModelData(
  46 + this.admin,
  47 + this.shopowner,
  48 + this.cashier,
  49 + this.waiter,
  50 + this.manager,
  51 + );
  52 +
  53 + factory PersonnelManageModelData.fromJson(Map<String, dynamic> srcJson) =>
  54 + _$PersonnelManageModelDataFromJson(srcJson);
  55 +
  56 + Map<String, dynamic> toJson() => _$PersonnelManageModelDataToJson(this);
  57 +}
  58 +
  59 +@JsonSerializable()
  60 +class Admin extends Object {
  61 + @JsonKey(name: 'listdata')
  62 + List<PersonnelManageSunModel> listdata;
  63 +
  64 + @JsonKey(name: 'role_id')
  65 + String roleId;
  66 +
  67 + Admin(
  68 + this.listdata,
  69 + this.roleId,
  70 + );
  71 +
  72 + factory Admin.fromJson(Map<String, dynamic> srcJson) =>
  73 + _$AdminFromJson(srcJson);
  74 +
  75 + Map<String, dynamic> toJson() => _$AdminToJson(this);
  76 +}
  77 +
  78 +@JsonSerializable()
  79 +class PersonnelManageSunModel extends Object {
  80 + @JsonKey(name: 'id')
  81 + String id;
  82 +
  83 + @JsonKey(name: 'openid')
  84 + String openid;
  85 +
  86 + @JsonKey(name: 'user_name')
  87 + String userName;
  88 +
  89 + @JsonKey(name: 'is_first')
  90 + String isFirst;
  91 +
  92 + @JsonKey(name: 'role_id')
  93 + String roleId;
  94 +
  95 + @JsonKey(name: 'phone')
  96 + String phone;
  97 +
  98 + @JsonKey(name: 'code')
  99 + String code;
  100 +
  101 + @JsonKey(name: 'account')
  102 + String account;
  103 +
  104 + @JsonKey(name: 'is_on_call')
  105 + String isOnCall;
  106 +
  107 + @JsonKey(name: 'headimgurl')
  108 + String headimgurl;
  109 +
  110 + PersonnelManageSunModel(
  111 + this.id,
  112 + this.openid,
  113 + this.userName,
  114 + this.isFirst,
  115 + this.roleId,
  116 + this.phone,
  117 + this.code,
  118 + this.account,
  119 + this.isOnCall,
  120 + this.headimgurl,
  121 + );
  122 +
  123 + factory PersonnelManageSunModel.fromJson(Map<String, dynamic> srcJson) =>
  124 + _$PersonnelManageSunModelFromJson(srcJson);
  125 +
  126 + Map<String, dynamic> toJson() => _$PersonnelManageSunModelToJson(this);
  127 +}
  128 +
  129 +@JsonSerializable()
  130 +class Shopowner extends Object {
  131 + @JsonKey(name: 'listdata')
  132 + List<PersonnelManageSunModel> listdata;
  133 +
  134 + @JsonKey(name: 'role_id')
  135 + String roleId;
  136 +
  137 + Shopowner(
  138 + this.listdata,
  139 + this.roleId,
  140 + );
  141 +
  142 + factory Shopowner.fromJson(Map<String, dynamic> srcJson) =>
  143 + _$ShopownerFromJson(srcJson);
  144 +
  145 + Map<String, dynamic> toJson() => _$ShopownerToJson(this);
  146 +}
  147 +
  148 +@JsonSerializable()
  149 +class Cashier extends Object {
  150 + @JsonKey(name: 'listdata')
  151 + List<PersonnelManageSunModel> listdata;
  152 +
  153 + @JsonKey(name: 'role_id')
  154 + String roleId;
  155 +
  156 + Cashier(
  157 + this.listdata,
  158 + this.roleId,
  159 + );
  160 +
  161 + factory Cashier.fromJson(Map<String, dynamic> srcJson) =>
  162 + _$CashierFromJson(srcJson);
  163 +
  164 + Map<String, dynamic> toJson() => _$CashierToJson(this);
  165 +}
  166 +
  167 +@JsonSerializable()
  168 +class Waiter extends Object {
  169 + @JsonKey(name: 'listdata')
  170 + List<PersonnelManageSunModel> listdata;
  171 +
  172 + @JsonKey(name: 'role_id')
  173 + String roleId;
  174 +
  175 + Waiter(
  176 + this.listdata,
  177 + this.roleId,
  178 + );
  179 +
  180 + factory Waiter.fromJson(Map<String, dynamic> srcJson) =>
  181 + _$WaiterFromJson(srcJson);
  182 +
  183 + Map<String, dynamic> toJson() => _$WaiterToJson(this);
  184 +}
  185 +
  186 +@JsonSerializable()
  187 +class Manager extends Object {
  188 + @JsonKey(name: 'listdata')
  189 + List<PersonnelManageSunModel> listdata;
  190 +
  191 + @JsonKey(name: 'role_id')
  192 + String roleId;
  193 +
  194 + Manager(
  195 + this.listdata,
  196 + this.roleId,
  197 + );
  198 +
  199 + factory Manager.fromJson(Map<String, dynamic> srcJson) =>
  200 + _$ManagerFromJson(srcJson);
  201 +
  202 + Map<String, dynamic> toJson() => _$ManagerToJson(this);
  203 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'personnel_manage_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +PersonnelManageModel _$PersonnelManageModelFromJson(Map<String, dynamic> json) {
  10 + return PersonnelManageModel(
  11 + json['ret'] as int,
  12 + json['data'] == null
  13 + ? null
  14 + : PersonnelManageModelData.fromJson(json['data'] as Map<String, dynamic>),
  15 + json['msg'] as String,
  16 + );
  17 +}
  18 +
  19 +Map<String, dynamic> _$PersonnelManageModelToJson(
  20 + PersonnelManageModel instance) =>
  21 + <String, dynamic>{
  22 + 'ret': instance.ret,
  23 + 'data': instance.data,
  24 + 'msg': instance.msg,
  25 + };
  26 +
  27 +PersonnelManageModelData _$PersonnelManageModelDataFromJson(Map<String, dynamic> json) {
  28 + return PersonnelManageModelData(
  29 + json['admin'] == null
  30 + ? null
  31 + : Admin.fromJson(json['admin'] as Map<String, dynamic>),
  32 + json['shopowner'] == null
  33 + ? null
  34 + : Shopowner.fromJson(json['shopowner'] as Map<String, dynamic>),
  35 + json['cashier'] == null
  36 + ? null
  37 + : Cashier.fromJson(json['cashier'] as Map<String, dynamic>),
  38 + json['waiter'] == null
  39 + ? null
  40 + : Waiter.fromJson(json['waiter'] as Map<String, dynamic>),
  41 + json['manager'] == null
  42 + ? null
  43 + : Manager.fromJson(json['manager'] as Map<String, dynamic>),
  44 + );
  45 +}
  46 +
  47 +Map<String, dynamic> _$PersonnelManageModelDataToJson(PersonnelManageModelData instance) => <String, dynamic>{
  48 + 'admin': instance.admin,
  49 + 'shopowner': instance.shopowner,
  50 + 'cashier': instance.cashier,
  51 + 'waiter': instance.waiter,
  52 + 'manager': instance.manager,
  53 + };
  54 +
  55 +Admin _$AdminFromJson(Map<String, dynamic> json) {
  56 + return Admin(
  57 + (json['listdata'] as List)
  58 + ?.map((e) => e == null
  59 + ? null
  60 + : PersonnelManageSunModel.fromJson(e as Map<String, dynamic>))
  61 + ?.toList(),
  62 + json['role_id'] as String,
  63 + );
  64 +}
  65 +
  66 +Map<String, dynamic> _$AdminToJson(Admin instance) => <String, dynamic>{
  67 + 'listdata': instance.listdata,
  68 + 'role_id': instance.roleId,
  69 + };
  70 +
  71 +PersonnelManageSunModel _$PersonnelManageSunModelFromJson(
  72 + Map<String, dynamic> json) {
  73 + return PersonnelManageSunModel(
  74 + json['id'] as String,
  75 + json['openid'] as String,
  76 + json['user_name'] as String,
  77 + json['is_first'] as String,
  78 + json['role_id'] as String,
  79 + json['phone'] as String,
  80 + json['code'] as String,
  81 + json['account'] as String,
  82 + json['is_on_call'] as String,
  83 + json['headimgurl'] as String,
  84 + );
  85 +}
  86 +
  87 +Map<String, dynamic> _$PersonnelManageSunModelToJson(
  88 + PersonnelManageSunModel instance) =>
  89 + <String, dynamic>{
  90 + 'id': instance.id,
  91 + 'openid': instance.openid,
  92 + 'user_name': instance.userName,
  93 + 'is_first': instance.isFirst,
  94 + 'role_id': instance.roleId,
  95 + 'phone': instance.phone,
  96 + 'code': instance.code,
  97 + 'account': instance.account,
  98 + 'is_on_call': instance.isOnCall,
  99 + 'headimgurl': instance.headimgurl,
  100 + };
  101 +
  102 +Shopowner _$ShopownerFromJson(Map<String, dynamic> json) {
  103 + return Shopowner(
  104 + (json['listdata'] as List)
  105 + ?.map((e) => e == null
  106 + ? null
  107 + : PersonnelManageSunModel.fromJson(e as Map<String, dynamic>))
  108 + ?.toList(),
  109 + json['role_id'] as String,
  110 + );
  111 +}
  112 +
  113 +Map<String, dynamic> _$ShopownerToJson(Shopowner instance) => <String, dynamic>{
  114 + 'listdata': instance.listdata,
  115 + 'role_id': instance.roleId,
  116 + };
  117 +
  118 +Cashier _$CashierFromJson(Map<String, dynamic> json) {
  119 + return Cashier(
  120 + (json['listdata'] as List)
  121 + ?.map((e) => e == null
  122 + ? null
  123 + : PersonnelManageSunModel.fromJson(e as Map<String, dynamic>))
  124 + ?.toList(),
  125 + json['role_id'] as String,
  126 + );
  127 +}
  128 +
  129 +Map<String, dynamic> _$CashierToJson(Cashier instance) => <String, dynamic>{
  130 + 'listdata': instance.listdata,
  131 + 'role_id': instance.roleId,
  132 + };
  133 +
  134 +Waiter _$WaiterFromJson(Map<String, dynamic> json) {
  135 + return Waiter(
  136 + (json['listdata'] as List)
  137 + ?.map((e) => e == null
  138 + ? null
  139 + : PersonnelManageSunModel.fromJson(e as Map<String, dynamic>))
  140 + ?.toList(),
  141 + json['role_id'] as String,
  142 + );
  143 +}
  144 +
  145 +Map<String, dynamic> _$WaiterToJson(Waiter instance) => <String, dynamic>{
  146 + 'listdata': instance.listdata,
  147 + 'role_id': instance.roleId,
  148 + };
  149 +
  150 +Manager _$ManagerFromJson(Map<String, dynamic> json) {
  151 + return Manager(
  152 + (json['listdata'] as List)
  153 + ?.map((e) => e == null
  154 + ? null
  155 + : PersonnelManageSunModel.fromJson(e as Map<String, dynamic>))
  156 + ?.toList(),
  157 + json['role_id'] as String,
  158 + );
  159 +}
  160 +
  161 +Map<String, dynamic> _$ManagerToJson(Manager instance) => <String, dynamic>{
  162 + 'listdata': instance.listdata,
  163 + 'role_id': instance.roleId,
  164 + };
@@ -152,5 +152,7 @@ class HttpUrl { @@ -152,5 +152,7 @@ class HttpUrl {
152 "?service=App.Cookbook.GetSpecBySellerid"; //获取商家计价单位 152 "?service=App.Cookbook.GetSpecBySellerid"; //获取商家计价单位
153 static const String get_cookbook_by_id = 153 static const String get_cookbook_by_id =
154 "?service=App.Cookbook.GetCookbookById"; // 获取单个菜品信息 154 "?service=App.Cookbook.GetCookbookById"; // 获取单个菜品信息
  155 + static const String get_auth_user_lists =
  156 + "?service=App.Seller.GetAuthUserLists"; // 店员列表
155 157
156 } 158 }
  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/user_model.dart';
  6 +import 'package:one_key/res/colors.dart';
  7 +import 'package:one_key/utils/utils.dart';
  8 +import 'package:one_key/widgets/MyDivider.dart';
  9 +import 'package:one_key/widgets/h_empty_view.dart';
  10 +import 'package:one_key/widgets/round_button.dart';
  11 +import 'package:one_key/widgets/system_app_bar.dart';
  12 +import 'package:one_key/widgets/v_empty_view.dart';
  13 +import 'package:provider/provider.dart';
  14 +
  15 +class PersonnelDetailPage extends StatefulWidget {
  16 + final PersonnelManageSunModel model;
  17 + final String position;
  18 + PersonnelDetailPage({Key key, this.model, this.position}) : super(key: key);
  19 +
  20 + @override
  21 + _PersonnelDetailPageState createState() => _PersonnelDetailPageState();
  22 +}
  23 +
  24 +class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
  25 + @override
  26 + Widget build(BuildContext context) {
  27 + return Scaffold(
  28 + backgroundColor: MyColours.color_ffffff,
  29 + appBar: SystemAppBar('店员详情'),
  30 + body: SingleChildScrollView(
  31 + child: Column(
  32 + children: [
  33 + Container(
  34 + margin: EdgeInsets.all(ScreenUtil().setWidth(40)),
  35 + // decoration: BoxDecoration(
  36 + // border: Border.all(color: Color.fromRGBO(235, 234, 239, 1)),
  37 + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
  38 + // ),
  39 + child: Column(
  40 + crossAxisAlignment: CrossAxisAlignment.center,
  41 + children: [
  42 + VEmptyView(40),
  43 + widget.model.headimgurl != null &&
  44 + widget.model.headimgurl != 'null'
  45 + ? CachedNetworkImage(
  46 + imageUrl: widget.model.headimgurl,
  47 + fit: BoxFit.cover,
  48 + width: ScreenUtil().setWidth(38 * 2),
  49 + height: ScreenUtil().setWidth(38 * 2),
  50 + )
  51 + : Image.asset(
  52 + Utils.getImgPath('touxiang'),
  53 + fit: BoxFit.cover,
  54 + width: ScreenUtil().setWidth(38 * 2),
  55 + height: ScreenUtil().setWidth(38 * 2),
  56 + ),
  57 + VEmptyView(30),
  58 + Row(
  59 + mainAxisAlignment: MainAxisAlignment.center,
  60 + children: [
  61 + Text(
  62 + widget.model.userName != null &&
  63 + widget.model.userName != 'null'
  64 + ? widget.model.userName
  65 + : '暂未设置名称',
  66 + style: TextStyle(
  67 + fontSize: ScreenUtil().setWidth(34),
  68 + color: MyColours.color_333333),
  69 + ),
  70 + HEmptyView(20),
  71 + Image.asset(
  72 + Utils.getImgPath('yd_bianji'),
  73 + width: ScreenUtil().setWidth(20),
  74 + ),
  75 + ],
  76 + ),
  77 + VEmptyView(30),
  78 + Text(
  79 + widget.model.phone != null &&
  80 + widget.model.userName != 'null'
  81 + ? widget.model.phone
  82 + : '',
  83 + style: TextStyle(
  84 + fontSize: ScreenUtil().setWidth(28),
  85 + color: MyColours.color_199095),
  86 + ),
  87 + VEmptyView(30),
  88 + Row(
  89 + mainAxisAlignment: MainAxisAlignment.center,
  90 + children: [
  91 + Text(
  92 + Provider.of<UserModel>(context, listen: false)
  93 + .user
  94 + .sellername,
  95 + style: TextStyle(
  96 + fontSize: ScreenUtil().setWidth(30),
  97 + color: MyColours.color_333333),
  98 + ),
  99 + HEmptyView(20),
  100 + Text(
  101 + widget.position,
  102 + style: TextStyle(
  103 + fontSize: ScreenUtil().setWidth(28),
  104 + color: MyColours.color_199095),
  105 + ),
  106 + ],
  107 + ),
  108 + // MyDivider(
  109 + // double.infinity,
  110 + // ScreenUtil().setWidth(10),
  111 + // color: Color.fromRGBO(235, 234, 239, 1),
  112 + // ),
  113 + VEmptyView(60),
  114 + Padding(
  115 + padding: EdgeInsets.symmetric(
  116 + vertical: ScreenUtil().setWidth(20)),
  117 + child: Row(
  118 + mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  119 + children: [
  120 + RoundButton(
  121 + text: '移除店员',
  122 + fontSize: 30,
  123 + isBold: false,
  124 + height: ScreenUtil().setWidth(80),
  125 + // width: double.infinity,
  126 + width: (ScreenUtil.screenWidthDp -
  127 + ScreenUtil().setWidth(140)) /
  128 + 2,
  129 + radius: ScreenUtil().setWidth(10),
  130 + ),
  131 + RoundButton(
  132 + text: '查看初始密码',
  133 + fontSize: 30,
  134 + isBold: false,
  135 + height: ScreenUtil().setWidth(80),
  136 + // width: double.infinity,
  137 + width: (ScreenUtil.screenWidthDp -
  138 + ScreenUtil().setWidth(140)) /
  139 + 2,
  140 + radius: ScreenUtil().setWidth(10),
  141 + ),
  142 + ],
  143 + ),
  144 + ),
  145 + Padding(
  146 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(60)),
  147 + child: Row(
  148 + mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  149 + children: [
  150 + RoundButton(
  151 + text: '设为接单人',
  152 + fontSize: 30,
  153 + isBold: false,
  154 + height: ScreenUtil().setWidth(80),
  155 + // width: double.infinity,
  156 + width: (ScreenUtil.screenWidthDp -
  157 + ScreenUtil().setWidth(140)) /
  158 + 2,
  159 + radius: ScreenUtil().setWidth(10),
  160 + ),
  161 + RoundButton(
  162 + text: '绑定微信',
  163 + fontSize: 30,
  164 + isBold: false,
  165 + height: ScreenUtil().setWidth(80),
  166 + // width: double.infinity,
  167 + width: (ScreenUtil.screenWidthDp -
  168 + ScreenUtil().setWidth(140)) /
  169 + 2,
  170 + radius: ScreenUtil().setWidth(10),
  171 + ),
  172 + ],
  173 + ),
  174 + ),
  175 + ],
  176 + ),
  177 + )
  178 + ],
  179 + ),
  180 + ),
  181 + );
  182 + }
  183 +}
  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 +
  38 +//获取员工信息列表
  39 + _getAuthUserLists({bool showLoading = true}) async {
  40 + Map<String, String> params = {
  41 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  42 + };
  43 +
  44 + await personnelProvider.getAuthUserLists(context, params,
  45 + showLoading: showLoading);
  46 + }
  47 +
  48 + @override
  49 + Widget build(BuildContext context) {
  50 + personnelProvider = Provider.of<PersonnelProvider>(context, listen: true);
  51 + return Scaffold(
  52 + backgroundColor: MyColours.color_ffffff,
  53 + appBar: SystemAppBar(
  54 + '员工与职级管理',
  55 + onTap: () {
  56 + EventBus().emit('changeStatusColor');
  57 + Navigator.of(context).pop();
  58 + },
  59 + ),
  60 + body: WillPopScope(
  61 + onWillPop: () {
  62 + EventBus().emit('changeStatusColor');
  63 + Navigator.of(context).pop();
  64 + },
  65 + child: ListView.builder(
  66 + itemCount: titleList.length,
  67 + shrinkWrap: true,
  68 + controller: _scrollController,
  69 + itemBuilder: (BuildContext context, int index) {
  70 + String title = titleList[index];
  71 + List<PersonnelManageSunModel> data = [];
  72 + if (personnelProvider.dataMap != null) {
  73 + if (title == '管理员') {
  74 + data = personnelProvider.dataMap.admin.listdata;
  75 + } else if (title == '店长') {
  76 + data = personnelProvider.dataMap.shopowner.listdata;
  77 + } else if (title == '客户经理') {
  78 + data = personnelProvider.dataMap.manager.listdata;
  79 + } else if (title == '收银员') {
  80 + data = personnelProvider.dataMap.cashier.listdata;
  81 + } else if (title == '服务员') {
  82 + data = personnelProvider.dataMap.waiter.listdata;
  83 + }
  84 + }
  85 +
  86 + return Column(
  87 + children: [
  88 + Padding(
  89 + padding: EdgeInsets.symmetric(
  90 + horizontal: ScreenUtil().setWidth(40),
  91 + vertical: ScreenUtil().setWidth(40)),
  92 + child: Row(
  93 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  94 + children: [
  95 + Text(
  96 + title == '管理员'
  97 + ? '${title}'
  98 + : '${title} (${data.length}人)',
  99 + style: TextStyle(
  100 + fontSize: ScreenUtil().setWidth(28),
  101 + color: MyColours.color_333333),
  102 + ),
  103 + InkWell(
  104 + onTap: () {},
  105 + child: Text(
  106 + '添加',
  107 + style: TextStyle(
  108 + fontSize: ScreenUtil().setWidth(30),
  109 + color: MyColours.color_199095),
  110 + ),
  111 + )
  112 + ],
  113 + )),
  114 + MyDivider(
  115 + double.infinity,
  116 + ScreenUtil().setWidth(2),
  117 + color: MyColours.color_f3f3f3,
  118 + ),
  119 + ListView.builder(
  120 + physics: NeverScrollableScrollPhysics(),
  121 + itemCount: data.length,
  122 + shrinkWrap: true,
  123 + controller: _scrollController,
  124 + itemBuilder: (BuildContext context, int index) {
  125 + PersonnelManageSunModel model = data[index];
  126 + return InkWell(
  127 + onTap: () {
  128 + NavigatorUtil.goPersonnelDetailPage(context,
  129 + model: model, position: title);
  130 + },
  131 + child: Stack(children: [
  132 + Column(children: [
  133 + Padding(
  134 + padding: EdgeInsets.symmetric(
  135 + vertical: ScreenUtil().setWidth(20),
  136 + horizontal:
  137 + ScreenUtil().setWidth(40)),
  138 + child: Row(
  139 + children: [
  140 + ClipRRect(
  141 + borderRadius:
  142 + BorderRadius.circular(
  143 + ScreenUtil()
  144 + .setWidth(38)),
  145 + child: model.headimgurl !=
  146 + null &&
  147 + model.headimgurl !=
  148 + 'null'
  149 + ? CachedNetworkImage(
  150 + imageUrl:
  151 + model.headimgurl,
  152 + fit: BoxFit.cover,
  153 + width: ScreenUtil()
  154 + .setWidth(38 * 2),
  155 + height: ScreenUtil()
  156 + .setWidth(38 * 2),
  157 + )
  158 + : Image.asset(
  159 + Utils.getImgPath(
  160 + 'touxiang'),
  161 + fit: BoxFit.cover,
  162 + width: ScreenUtil()
  163 + .setWidth(38 * 2),
  164 + height: ScreenUtil()
  165 + .setWidth(38 * 2),
  166 + )),
  167 + HEmptyView(40),
  168 + Expanded(
  169 + child: Text(
  170 + model.userName != null &&
  171 + model.userName != 'null'
  172 + ? model.userName
  173 + : '暂未设置名称',
  174 + style: TextStyle(
  175 + fontSize:
  176 + ScreenUtil().setWidth(28),
  177 + color:
  178 + MyColours.color_333333),
  179 + )),
  180 + Spacer(),
  181 + Text(
  182 + '工号:${model.account}',
  183 + style: TextStyle(
  184 + fontSize:
  185 + ScreenUtil().setWidth(28),
  186 + color:
  187 + MyColours.color_999999),
  188 + ),
  189 + HEmptyView(20),
  190 + Image.asset(
  191 + "assets/arr_right_gray.png",
  192 + width: ScreenUtil().setWidth(14),
  193 + height: ScreenUtil().setWidth(22),
  194 + )
  195 + ],
  196 + )),
  197 + MyDivider(
  198 + double.infinity,
  199 + ScreenUtil().setWidth(2),
  200 + color: MyColours.color_f3f3f3,
  201 + )
  202 + ]),
  203 + Provider.of<UserModel>(context, listen: false)
  204 + .user
  205 + .account ==
  206 + model.account
  207 + ? Positioned(
  208 + child: Container(
  209 + width: ScreenUtil().setWidth(50),
  210 + height: ScreenUtil().setWidth(28),
  211 + alignment: Alignment.center,
  212 + decoration: BoxDecoration(
  213 + color: MyColours.color_d93535,
  214 + borderRadius: BorderRadius.only(
  215 + topRight: Radius.circular(
  216 + ScreenUtil()
  217 + .setWidth(16)),
  218 + bottomRight: Radius.circular(
  219 + ScreenUtil()
  220 + .setWidth(16)))),
  221 + child: Text(
  222 + 'Call',
  223 + style: TextStyle(
  224 + color: MyColours.color_ffffff,
  225 + fontSize:
  226 + ScreenUtil().setSp(18)),
  227 + ),
  228 + ))
  229 + : SizedBox()
  230 + ]));
  231 + }),
  232 + MyDivider(
  233 + double.infinity,
  234 + ScreenUtil().setWidth(20),
  235 + color: Color.fromRGBO(235, 234, 239, 1),
  236 + ),
  237 + ],
  238 + );
  239 + })));
  240 + }
  241 +}
@@ -338,28 +338,38 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -338,28 +338,38 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
338 smsInfoData: smsInfoData); 338 smsInfoData: smsInfoData);
339 }, 339 },
340 ), 340 ),
341 - MyDivider( 341 + MyDivider(
342 double.infinity, 342 double.infinity,
343 ScreenUtil().setHeight(1), 343 ScreenUtil().setHeight(1),
344 color: MyColours.color_f3f3f3, 344 color: MyColours.color_f3f3f3,
345 ), 345 ),
  346 +
346 MyItem( 347 MyItem(
347 - title: "菜单管理", 348 + title: "员工管理",
348 content: "", 349 content: "",
349 callback: () { 350 callback: () {
350 - NavigatorUtil.goMenuManagePage(context); 351 + NavigatorUtil.goPersonnelManagePage(context);
351 }, 352 },
352 ), 353 ),
  354 +
353 MyDivider( 355 MyDivider(
354 double.infinity, 356 double.infinity,
355 ScreenUtil().setHeight(1), 357 ScreenUtil().setHeight(1),
356 color: MyColours.color_f3f3f3, 358 color: MyColours.color_f3f3f3,
357 ), 359 ),
  360 + MyItem(
  361 + title: "菜单管理",
  362 + content: "",
  363 + callback: () {
  364 + NavigatorUtil.goMenuManagePage(context);
  365 + },
  366 + ),
358 MyDivider( 367 MyDivider(
359 double.infinity, 368 double.infinity,
360 ScreenUtil().setHeight(1), 369 ScreenUtil().setHeight(1),
361 color: MyColours.color_f3f3f3, 370 color: MyColours.color_f3f3f3,
362 ), 371 ),
  372 +
363 MyItem( 373 MyItem(
364 title: "包间类型", 374 title: "包间类型",
365 content: "", 375 content: "",
  1 +import 'package:flutter/material.dart';
  2 +import 'package:one_key/constant/constant.dart';
  3 +import 'package:one_key/models/personnel_manage_model.dart';
  4 +import 'package:one_key/net/base_resp.dart';
  5 +import 'package:one_key/net/dio_util.dart';
  6 +
  7 +import 'package:one_key/net/http_url.dart';
  8 +import 'package:one_key/utils/utils.dart';
  9 +
  10 +/**
  11 + * 员工管理
  12 + */
  13 +class PersonnelProvider extends ChangeNotifier {
  14 + PersonnelManageModelData dataMap;
  15 +
  16 + /// 获取店员列表
  17 + getAuthUserLists(BuildContext context, Map<String, String> params,
  18 + {showLoading = false}) async {
  19 + BaseResp<dynamic> baseResp = await DioUtil()
  20 + .request<dynamic>(context, Method.get, HttpUrl.get_auth_user_lists,
  21 + data: params, showLoading: showLoading)
  22 + .catchError((error) {
  23 + print(error.toString());
  24 + });
  25 + if (baseResp != null && baseResp.code == Constant.status_success) {
  26 + Map data = baseResp.data;
  27 + Map<String, dynamic> tempData = {};
  28 + data.forEach((key, value) {
  29 + String keyTemp = key.split('_')[0];
  30 + String role_id = key.split('_')[1];
  31 + tempData[keyTemp] = {'listdata': value, 'role_id': role_id};
  32 + });
  33 + baseResp.responseData['data'] = tempData;
  34 + dataMap = PersonnelManageModel.fromJson(baseResp.responseData).data;
  35 + } else {
  36 + Utils.showToast(baseResp.msg ?? "");
  37 + }
  38 + notifyListeners();
  39 + }
  40 +}
@@ -5,6 +5,7 @@ import 'package:one_key/models/coupon_model.dart'; @@ -5,6 +5,7 @@ import 'package:one_key/models/coupon_model.dart';
5 import 'package:one_key/models/integral_model.dart'; 5 import 'package:one_key/models/integral_model.dart';
6 import 'package:one_key/models/notebook.dart'; 6 import 'package:one_key/models/notebook.dart';
7 import 'package:one_key/models/notebook_detail.dart'; 7 import 'package:one_key/models/notebook_detail.dart';
  8 +import 'package:one_key/models/personnel_manage_model.dart';
8 import 'package:one_key/models/sms_info.dart'; 9 import 'package:one_key/models/sms_info.dart';
9 import 'package:one_key/models/statics_model.dart'; 10 import 'package:one_key/models/statics_model.dart';
10 import 'package:one_key/models/table_list.dart'; 11 import 'package:one_key/models/table_list.dart';
@@ -421,4 +422,22 @@ class NavigatorUtil { @@ -421,4 +422,22 @@ class NavigatorUtil {
421 context, "${Routes.menu_add_dishes_page}?isNew=$isNew&idstr=${idstr}", 422 context, "${Routes.menu_add_dishes_page}?isNew=$isNew&idstr=${idstr}",
422 replace: replace); 423 replace: replace);
423 } 424 }
  425 +
  426 + /// 员工管理页面
  427 + static Future<dynamic> goPersonnelManagePage(BuildContext context,
  428 + {replace = false, bool isNew = true, String idstr}) {
  429 + return _navigateTo(context, "${Routes.personnel_manage_page}",
  430 + replace: replace);
  431 + }
  432 +
  433 + /// 员工管理页面
  434 + static Future<dynamic> goPersonnelDetailPage(BuildContext context,
  435 + {replace = false,
  436 + bool isNew = true,
  437 + PersonnelManageSunModel model,
  438 + String position}) {
  439 + return _navigateTo(context,
  440 + "${Routes.personnel_detail_page}?model=${FluroConvertUtils.object2string(model)}&position=${Uri.encodeComponent(position)}",
  441 + replace: replace);
  442 + }
424 } 443 }
@@ -6,6 +6,7 @@ import 'package:one_key/models/cookbook_model.dart'; @@ -6,6 +6,7 @@ import 'package:one_key/models/cookbook_model.dart';
6 import 'package:one_key/models/coupon_model.dart'; 6 import 'package:one_key/models/coupon_model.dart';
7 import 'package:one_key/models/integral_model.dart'; 7 import 'package:one_key/models/integral_model.dart';
8 import 'package:one_key/models/notebook_detail.dart'; 8 import 'package:one_key/models/notebook_detail.dart';
  9 +import 'package:one_key/models/personnel_manage_model.dart';
9 import 'package:one_key/models/sms_info.dart'; 10 import 'package:one_key/models/sms_info.dart';
10 import 'package:one_key/models/statics_model.dart'; 11 import 'package:one_key/models/statics_model.dart';
11 import 'package:one_key/models/table_list.dart'; 12 import 'package:one_key/models/table_list.dart';
@@ -35,6 +36,8 @@ import 'package:one_key/pages/detail/handle_online_page.dart'; @@ -35,6 +36,8 @@ import 'package:one_key/pages/detail/handle_online_page.dart';
35 import 'package:one_key/pages/detail/notebook_detail_page.dart'; 36 import 'package:one_key/pages/detail/notebook_detail_page.dart';
36 import 'package:one_key/pages/login/web_page.dart'; 37 import 'package:one_key/pages/login/web_page.dart';
37 import 'package:one_key/pages/message/message_order_menu.dart'; 38 import 'package:one_key/pages/message/message_order_menu.dart';
  39 +import 'package:one_key/pages/my/%20%20personnel_type/personnel_detail_page.dart';
  40 +import 'package:one_key/pages/my/%20%20personnel_type/personnel_manage_page.dart';
38 import 'package:one_key/pages/my/base_info.dart'; 41 import 'package:one_key/pages/my/base_info.dart';
39 import 'package:one_key/pages/my/book_time_set.dart'; 42 import 'package:one_key/pages/my/book_time_set.dart';
40 import 'package:one_key/pages/my/contant_page.dart'; 43 import 'package:one_key/pages/my/contant_page.dart';
@@ -71,6 +74,7 @@ import 'package:one_key/provider/notebook_detail_change_model.dart'; @@ -71,6 +74,7 @@ import 'package:one_key/provider/notebook_detail_change_model.dart';
71 import 'package:one_key/provider/notebook_detail_model.dart'; 74 import 'package:one_key/provider/notebook_detail_model.dart';
72 import 'package:one_key/provider/order_food_provider.dart'; 75 import 'package:one_key/provider/order_food_provider.dart';
73 import 'package:one_key/provider/other_login_provider.dart'; 76 import 'package:one_key/provider/other_login_provider.dart';
  77 +import 'package:one_key/provider/personnel_provider.dart';
74 import 'package:one_key/provider/remark_manager_model.dart'; 78 import 'package:one_key/provider/remark_manager_model.dart';
75 import 'package:one_key/provider/sms_recharge_provider.dart'; 79 import 'package:one_key/provider/sms_recharge_provider.dart';
76 import 'package:one_key/provider/statistics_provider.dart'; 80 import 'package:one_key/provider/statistics_provider.dart';
@@ -659,3 +663,22 @@ var menuAddDishesPageHandle = new Handler( @@ -659,3 +663,22 @@ var menuAddDishesPageHandle = new Handler(
659 // return ChangeNotifierProvider<UploadImageProvider>( 663 // return ChangeNotifierProvider<UploadImageProvider>(
660 // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); 664 // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
661 }); 665 });
  666 +
  667 +///店员管理
  668 +var personnelManagePageHandle = new Handler(
  669 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  670 + return ChangeNotifierProvider<PersonnelProvider>(
  671 + create: (_) => PersonnelProvider(), child: PersonnelManagePage());
  672 +});
  673 +
  674 +///店员详情页面
  675 +var personnelDetailPageHandle = new Handler(
  676 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  677 + PersonnelManageSunModel data = PersonnelManageSunModel.fromJson(json
  678 + .decode(FluroConvertUtils.fluroCnParamsDecode(params["model"].first)));
  679 +
  680 + String position = params["position"].first;
  681 + return ChangeNotifierProvider<PersonnelProvider>(
  682 + create: (_) => PersonnelProvider(),
  683 + child: PersonnelDetailPage(model: data, position: position));
  684 +});
@@ -58,6 +58,9 @@ class Routes { @@ -58,6 +58,9 @@ class Routes {
58 static String menu_manage_page = "/menu_manage_page"; //菜单管理页面 58 static String menu_manage_page = "/menu_manage_page"; //菜单管理页面
59 static String menu_category_page = "/menu_category_page"; //菜单分类管理 59 static String menu_category_page = "/menu_category_page"; //菜单分类管理
60 static String menu_add_dishes_page = "/menu_add_dishes_page"; //添加菜品页面 60 static String menu_add_dishes_page = "/menu_add_dishes_page"; //添加菜品页面
  61 + static String personnel_manage_page = "/personnel_manage_page"; //店员管理页面
  62 + static String personnel_detail_page = "/personnel_detail_page"; //店员详情页面
  63 +
61 64
62 static void configureRoutes(FluroRouter router) { 65 static void configureRoutes(FluroRouter router) {
63 router.notFoundHandler = new Handler( 66 router.notFoundHandler = new Handler(
@@ -123,5 +126,10 @@ class Routes { @@ -123,5 +126,10 @@ class Routes {
123 router.define(menu_manage_page, handler: menuManagePageHandle); 126 router.define(menu_manage_page, handler: menuManagePageHandle);
124 router.define(menu_category_page, handler: menuCategoryPageHandle); 127 router.define(menu_category_page, handler: menuCategoryPageHandle);
125 router.define(menu_add_dishes_page, handler: menuAddDishesPageHandle); 128 router.define(menu_add_dishes_page, handler: menuAddDishesPageHandle);
  129 + router.define(personnel_manage_page, handler: personnelManagePageHandle);
  130 + router.define(personnel_detail_page, handler: personnelDetailPageHandle);
  131 +
  132 +
  133 +
126 } 134 }
127 } 135 }