Commit 463d88ef33fb9c049be50a3eef760f558773bd8f

Authored by wdn127929
1 parent 5313562d

客情列表

  1 +import 'package:azlistview/azlistview.dart';
1 import 'package:json_annotation/json_annotation.dart'; 2 import 'package:json_annotation/json_annotation.dart';
2 3
3 part 'user_history_entity.g.dart'; 4 part 'user_history_entity.g.dart';
4 5
5 @JsonSerializable() 6 @JsonSerializable()
6 -class UserHistoryEntity extends Object { 7 +class UserHistoryEntity extends Object with ISuspensionBean {
7 @JsonKey(name: 'id') 8 @JsonKey(name: 'id')
8 String id; 9 String id;
9 10
@@ -25,6 +26,7 @@ class UserHistoryEntity extends Object { @@ -25,6 +26,7 @@ class UserHistoryEntity extends Object {
25 List<String> pinyinList; //全拼数组 26 List<String> pinyinList; //全拼数组
26 String pinyin; //全拼字母 27 String pinyin; //全拼字母
27 String pinyinFirst; //首字母 28 String pinyinFirst; //首字母
  29 + String tagIndex; //abcdefg
28 30
29 UserHistoryEntity( 31 UserHistoryEntity(
30 this.id, 32 this.id,
@@ -39,4 +41,7 @@ class UserHistoryEntity extends Object { @@ -39,4 +41,7 @@ class UserHistoryEntity extends Object {
39 _$UserHistoryEntityFromJson(srcJson); 41 _$UserHistoryEntityFromJson(srcJson);
40 42
41 Map<String, dynamic> toJson() => _$UserHistoryEntityToJson(this); 43 Map<String, dynamic> toJson() => _$UserHistoryEntityToJson(this);
  44 +
  45 + @override
  46 + String getSuspensionTag() => tagIndex;
42 } 47 }
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/screenutil.dart'; 2 import 'package:flutter_screenutil/screenutil.dart';
3 import 'package:one_key/models/user_history_entity.dart'; 3 import 'package:one_key/models/user_history_entity.dart';
4 -import 'package:one_key/provider/contant_show_model.dart'; 4 +import 'package:one_key/provider/customer_provider.dart';
5 import 'package:one_key/res/colors.dart'; 5 import 'package:one_key/res/colors.dart';
6 import 'package:one_key/utils/utils.dart'; 6 import 'package:one_key/utils/utils.dart';
7 import 'package:one_key/widgets/MyDivider.dart'; 7 import 'package:one_key/widgets/MyDivider.dart';
@@ -9,7 +9,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; @@ -9,7 +9,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
9 9
10 class ContantItemPage extends StatefulWidget { 10 class ContantItemPage extends StatefulWidget {
11 final int index; 11 final int index;
12 - final ContantShowModel model; 12 + final CustomerProvider model;
13 final GestureTapCallback onTap; 13 final GestureTapCallback onTap;
14 final List<UserHistoryEntity> data; 14 final List<UserHistoryEntity> data;
15 ContantItemPage({Key key, this.index, this.model, this.onTap, this.data}) 15 ContantItemPage({Key key, this.index, this.model, this.onTap, this.data})
@@ -193,13 +193,13 @@ class _ContantItemPageState extends State<ContantItemPage> { @@ -193,13 +193,13 @@ class _ContantItemPageState extends State<ContantItemPage> {
193 return InkWell( 193 return InkWell(
194 onTap: widget.onTap, 194 onTap: widget.onTap,
195 child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ 195 child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
196 - widget.index == 0  
197 - ? MyDivider(  
198 - double.infinity,  
199 - ScreenUtil().setWidth(20),  
200 - color: MyColours.color_f5f5f5,  
201 - )  
202 - : Container(), 196 + // widget.index == 0
  197 + // ? MyDivider(
  198 + // double.infinity,
  199 + // ScreenUtil().setWidth(20),
  200 + // color: MyColours.color_f5f5f5,
  201 + // )
  202 + // : SizedBox(),
203 Container( 203 Container(
204 width: double.infinity, 204 width: double.infinity,
205 padding: EdgeInsets.symmetric( 205 padding: EdgeInsets.symmetric(
1 -import 'package:flutter/material.dart';  
2 -import 'package:flutter_easyrefresh/easy_refresh.dart'; 1 +// import 'package:flutter/material.dart';
  2 +// import 'package:flutter_easyrefresh/easy_refresh.dart';
3 3
4 -import 'package:one_key/constant/state.dart'; 4 +// import 'package:one_key/constant/state.dart';
5 5
6 -import 'package:one_key/pages/my/contant_item_page.dart';  
7 -import 'package:one_key/provider/contant_show_model.dart';  
8 -import 'package:one_key/provider/user_model.dart';  
9 -import 'package:one_key/utils/dialog_util.dart'; 6 +// import 'package:one_key/pages/my/contant_item_page.dart';
  7 +// import 'package:one_key/provider/contant_show_model.dart';
  8 +// import 'package:one_key/provider/user_model.dart';
  9 +// import 'package:one_key/utils/dialog_util.dart';
10 10
11 -import 'package:one_key/widgets/page_exception.dart'; 11 +// import 'package:one_key/widgets/page_exception.dart';
12 12
13 -import 'package:provider/provider.dart'; 13 +// import 'package:provider/provider.dart';
14 14
15 -class ContantLeftPage extends StatefulWidget {  
16 - ContantLeftPage({Key key}) : super(key: key); 15 +// class ContantLeftPage extends StatefulWidget {
  16 +// ContantLeftPage({Key key}) : super(key: key);
17 17
18 - @override  
19 - _ContantLeftPageState createState() => _ContantLeftPageState();  
20 -} 18 +// @override
  19 +// _ContantLeftPageState createState() => _ContantLeftPageState();
  20 +// }
21 21
22 -class _ContantLeftPageState extends State<ContantLeftPage> {  
23 - EasyRefreshController _controller;  
24 - ContantShowModel contantShowModel; 22 +// class _ContantLeftPageState extends State<ContantLeftPage> {
  23 +// EasyRefreshController _controller;
  24 +// ContantShowModel contantShowModel;
25 25
26 - @override  
27 - void initState() {  
28 - super.initState();  
29 - _controller = EasyRefreshController(); 26 +// @override
  27 +// void initState() {
  28 +// super.initState();
  29 +// _controller = EasyRefreshController();
30 30
31 - WidgetsBinding.instance.addPostFrameCallback((_) {  
32 - _getContantData();  
33 - });  
34 - } 31 +// WidgetsBinding.instance.addPostFrameCallback((_) {
  32 +// _getContantData();
  33 +// });
  34 +// }
35 35
36 - _getContantData() async {  
37 - Map<String, String> params = {  
38 - "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,  
39 - };  
40 - await contantShowModel.getUserHistorys(context, params);  
41 - await contantShowModel.searchData(contantShowModel.controller.text);  
42 - } 36 +// _getContantData() async {
  37 +// Map<String, String> params = {
  38 +// "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  39 +// };
  40 +// await contantShowModel.getUserHistorys(context, params);
  41 +// await contantShowModel.searchData(contantShowModel.controller.text);
  42 +// }
43 43
44 - @override  
45 - Widget build(BuildContext context) {  
46 - contantShowModel = Provider.of<ContantShowModel>(context, listen: true);  
47 - return Consumer<ContantShowModel>(  
48 - builder: (context, model, _) {  
49 - if (model.pageStateLeft != PageState.Success) {  
50 - return ExceptionPage(  
51 - pageState: model.pageStateLeft,  
52 - callback: () {  
53 - model.pageStateLeft = PageState.Loading;  
54 - model.notifyListeners();  
55 - _getContantData();  
56 - },  
57 - emptyMsg: "暂时没有联系人哦",  
58 - emptyImg: "empty_search",  
59 - showMsg: "加载中,请稍后...",  
60 - );  
61 - } else {  
62 - return ListView.builder(  
63 - itemCount: model.userHistorysShow.length,  
64 - itemBuilder: (BuildContext context, int index) {  
65 - String phone = model.userHistorysShow[index].phone == null ||  
66 - model.userHistorysShow[index].phone == ''  
67 - ? ''  
68 - : model.userHistorysShow[index].phone;  
69 - return ContantItemPage(  
70 - onTap: () {  
71 - if (model.userHistorysShow[index].phone != null &&  
72 - model.userHistorysShow[index].phone != '') {  
73 - DialogUtil.goPhone(model.userHistorysShow[index].phone);  
74 - }  
75 - },  
76 - index: index,  
77 - model: contantShowModel,  
78 - data: model.userHistorysShow,  
79 - );  
80 - });  
81 - }  
82 - },  
83 - );  
84 - }  
85 -} 44 +// @override
  45 +// Widget build(BuildContext context) {
  46 +// contantShowModel = Provider.of<ContantShowModel>(context, listen: true);
  47 +// return Consumer<ContantShowModel>(
  48 +// builder: (context, model, _) {
  49 +// if (model.pageStateLeft != PageState.Success) {
  50 +// return ExceptionPage(
  51 +// pageState: model.pageStateLeft,
  52 +// callback: () {
  53 +// model.pageStateLeft = PageState.Loading;
  54 +// model.notifyListeners();
  55 +// _getContantData();
  56 +// },
  57 +// emptyMsg: "暂时没有联系人哦",
  58 +// emptyImg: "empty_search",
  59 +// showMsg: "加载中,请稍后...",
  60 +// );
  61 +// } else {
  62 +// return ListView.builder(
  63 +// itemCount: model.userHistorysShow.length,
  64 +// itemBuilder: (BuildContext context, int index) {
  65 +// String phone = model.userHistorysShow[index].phone == null ||
  66 +// model.userHistorysShow[index].phone == ''
  67 +// ? ''
  68 +// : model.userHistorysShow[index].phone;
  69 +// return ContantItemPage(
  70 +// onTap: () {
  71 +// if (model.userHistorysShow[index].phone != null &&
  72 +// model.userHistorysShow[index].phone != '') {
  73 +// DialogUtil.goPhone(model.userHistorysShow[index].phone);
  74 +// }
  75 +// },
  76 +// index: index,
  77 +// model: contantShowModel,
  78 +// data: model.userHistorysShow,
  79 +// );
  80 +// });
  81 +// }
  82 +// },
  83 +// );
  84 +// }
  85 +// }
1 -import 'package:flutter/material.dart'; 1 +// import 'package:flutter/material.dart';
2 2
3 -import 'package:contacts_service/contacts_service.dart';  
4 -import 'package:flutter_screenutil/screenutil.dart'; 3 +// import 'package:contacts_service/contacts_service.dart';
  4 +// import 'package:flutter_screenutil/screenutil.dart';
5 5
6 -import 'package:one_key/pages/my/contant_left_page.dart';  
7 -import 'package:one_key/pages/my/contant_right_page.dart';  
8 -import 'package:one_key/provider/contant_show_model.dart';  
9 -import 'package:one_key/res/colors.dart';  
10 -import 'package:one_key/utils/event_bus.dart';  
11 -import 'package:one_key/utils/utils.dart'; 6 +// import 'package:one_key/pages/my/contant_left_page.dart';
  7 +// import 'package:one_key/pages/my/contant_right_page.dart';
  8 +// import 'package:one_key/provider/contant_show_model.dart';
  9 +// import 'package:one_key/res/colors.dart';
  10 +// import 'package:one_key/utils/event_bus.dart';
  11 +// import 'package:one_key/utils/utils.dart';
12 12
13 -import 'package:one_key/widgets/custom_tab_indicator.dart';  
14 -import 'package:one_key/widgets/system_app_bar.dart'; 13 +// import 'package:one_key/widgets/custom_tab_indicator.dart';
  14 +// import 'package:one_key/widgets/system_app_bar.dart';
15 15
16 -import 'package:provider/provider.dart'; 16 +// import 'package:provider/provider.dart';
17 17
18 -class ContactListPage extends StatefulWidget {  
19 - @override  
20 - _ContactListPageState createState() => _ContactListPageState();  
21 -} 18 +// class ContactListPage extends StatefulWidget {
  19 +// @override
  20 +// _ContactListPageState createState() => _ContactListPageState();
  21 +// }
22 22
23 -class _ContactListPageState extends State<ContactListPage>  
24 - with TickerProviderStateMixin {  
25 - List<Contact> _contacts;  
26 - List _tabBarTitle;  
27 - TabController tabController; 23 +// class _ContactListPageState extends State<ContactListPage>
  24 +// with TickerProviderStateMixin {
  25 +// List<Contact> _contacts;
  26 +// List _tabBarTitle;
  27 +// TabController tabController;
28 28
29 - ContantShowModel contantShowModel;  
30 - @override  
31 - void initState() {  
32 - _tabBarTitle = ['预订联系人', '手机联系人'];  
33 - super.initState();  
34 - tabController = TabController(length: 2, vsync: this);  
35 - } 29 +// ContantShowModel contantShowModel;
  30 +// @override
  31 +// void initState() {
  32 +// _tabBarTitle = ['预订联系人', '手机联系人'];
  33 +// super.initState();
  34 +// tabController = TabController(length: 2, vsync: this);
  35 +// }
36 36
37 - @override  
38 - Widget build(BuildContext context) {  
39 - contantShowModel = Provider.of<ContantShowModel>(context, listen: true);  
40 - return Material(  
41 - child: InkWell(  
42 - onTap: () {  
43 - // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘  
44 - },  
45 - child: Scaffold(  
46 - resizeToAvoidBottomInset: false,  
47 - backgroundColor: MyColours.color_ffffff,  
48 - appBar: SystemAppBar(  
49 - '联系人',  
50 - onTap: () {  
51 - EventBus().emit('changeStatusColor');  
52 - Navigator.of(context).pop();  
53 - },  
54 - ),  
55 - body: WillPopScope(  
56 - child: SafeArea(  
57 - child: Column(  
58 - children: <Widget>[  
59 - Container(  
60 - // color: Colors.red,  
61 - padding: EdgeInsets.symmetric(  
62 - horizontal: ScreenUtil().setWidth(40),  
63 - vertical: ScreenUtil().setWidth(10)),  
64 - height: ScreenUtil().setWidth(45 * 2),  
65 - // alignment: Alignment.center,  
66 - child: Stack(  
67 - children: [  
68 - Container(  
69 - alignment: Alignment.center,  
70 - padding: EdgeInsets.symmetric(  
71 - horizontal: ScreenUtil().setWidth(20 * 2),  
72 - vertical: ScreenUtil().setWidth(14)),  
73 - decoration: BoxDecoration(  
74 - color: MyColours.color_F0F0F0,  
75 - borderRadius: BorderRadius.circular(  
76 - ScreenUtil().setWidth(24 * 2))),  
77 - child: TextField(  
78 - maxLines: 1,  
79 - controller: contantShowModel.controller,  
80 - // focusNode: _focusNode,  
81 - // autofocus: true,  
82 - style: TextStyle(  
83 - color: MyColours.color_333333,  
84 - fontSize: ScreenUtil().setSp(30)),  
85 - // textAlignVertical: TextAlignVertical.center,  
86 - decoration: InputDecoration(  
87 - contentPadding: EdgeInsets.only(  
88 - right: ScreenUtil().setWidth(40 * 2)),  
89 - hintText: "搜索联系人",  
90 - hintStyle: TextStyle(  
91 - color: MyColours.color_999999,  
92 - fontSize: ScreenUtil().setSp(30),  
93 - ),  
94 - isCollapsed:  
95 - true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度  
96 - border: OutlineInputBorder(  
97 - borderSide: BorderSide.none),  
98 - // 左边图标设置  
99 - icon: Image.asset(  
100 - Utils.getImgPath('search'),  
101 - width: ScreenUtil().setWidth(30),  
102 - ),  
103 - //右边图标设置  
104 - // suffixIcon:  
105 - ),  
106 - keyboardType: TextInputType.text,  
107 - textInputAction: TextInputAction.done, 37 +// @override
  38 +// Widget build(BuildContext context) {
  39 +// contantShowModel = Provider.of<ContantShowModel>(context, listen: true);
  40 +// return Material(
  41 +// child: InkWell(
  42 +// onTap: () {
  43 +// // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  44 +// },
  45 +// child: Scaffold(
  46 +// resizeToAvoidBottomInset: false,
  47 +// backgroundColor: MyColours.color_ffffff,
  48 +// appBar: SystemAppBar(
  49 +// '联系人',
  50 +// onTap: () {
  51 +// EventBus().emit('changeStatusColor');
  52 +// Navigator.of(context).pop();
  53 +// },
  54 +// ),
  55 +// body: WillPopScope(
  56 +// child: SafeArea(
  57 +// child: Column(
  58 +// children: <Widget>[
  59 +// Container(
  60 +// // color: Colors.red,
  61 +// padding: EdgeInsets.symmetric(
  62 +// horizontal: ScreenUtil().setWidth(40),
  63 +// vertical: ScreenUtil().setWidth(10)),
  64 +// height: ScreenUtil().setWidth(45 * 2),
  65 +// // alignment: Alignment.center,
  66 +// child: Stack(
  67 +// children: [
  68 +// Container(
  69 +// alignment: Alignment.center,
  70 +// padding: EdgeInsets.symmetric(
  71 +// horizontal: ScreenUtil().setWidth(20 * 2),
  72 +// vertical: ScreenUtil().setWidth(14)),
  73 +// decoration: BoxDecoration(
  74 +// color: MyColours.color_F0F0F0,
  75 +// borderRadius: BorderRadius.circular(
  76 +// ScreenUtil().setWidth(24 * 2))),
  77 +// child: TextField(
  78 +// maxLines: 1,
  79 +// controller: contantShowModel.controller,
  80 +// // focusNode: _focusNode,
  81 +// // autofocus: true,
  82 +// style: TextStyle(
  83 +// color: MyColours.color_333333,
  84 +// fontSize: ScreenUtil().setSp(30)),
  85 +// // textAlignVertical: TextAlignVertical.center,
  86 +// decoration: InputDecoration(
  87 +// contentPadding: EdgeInsets.only(
  88 +// right: ScreenUtil().setWidth(40 * 2)),
  89 +// hintText: "搜索联系人",
  90 +// hintStyle: TextStyle(
  91 +// color: MyColours.color_999999,
  92 +// fontSize: ScreenUtil().setSp(30),
  93 +// ),
  94 +// isCollapsed:
  95 +// true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  96 +// border: OutlineInputBorder(
  97 +// borderSide: BorderSide.none),
  98 +// // 左边图标设置
  99 +// icon: Image.asset(
  100 +// Utils.getImgPath('search'),
  101 +// width: ScreenUtil().setWidth(30),
  102 +// ),
  103 +// //右边图标设置
  104 +// // suffixIcon:
  105 +// ),
  106 +// keyboardType: TextInputType.text,
  107 +// textInputAction: TextInputAction.done,
108 108
109 - onChanged: (value) {  
110 - // setState(() {});  
111 - // _searchSellerLocation();  
112 - contantShowModel.searchData(value);  
113 - },  
114 - onEditingComplete: () {  
115 - FocusScope.of(context).requestFocus(  
116 - FocusNode()); //点击空白处隐藏键盘  
117 - // contantShowModel.searchData(  
118 - // contantShowModel.controller.text);  
119 - // _searchSellerLocation();  
120 - // _focusNode.unfocus();  
121 - },  
122 - ),  
123 - ),  
124 - Positioned(  
125 - right: 0,  
126 - top: 0,  
127 - bottom: 0,  
128 - child: Offstage(  
129 - offstage:  
130 - contantShowModel.controller.text ==  
131 - '',  
132 - child: GestureDetector(  
133 - child: Container(  
134 - padding: EdgeInsets.only(  
135 - right: ScreenUtil()  
136 - .setWidth(20 * 2)),  
137 - // color: Colors.orange,  
138 - height:  
139 - ScreenUtil().setWidth(45 * 2),  
140 - width:  
141 - ScreenUtil().setWidth(100 * 2),  
142 - alignment: Alignment.centerRight,  
143 - child: Image.asset(  
144 - Utils.getImgPath('clear'),  
145 - width: ScreenUtil().setWidth(30),  
146 - height: ScreenUtil().setWidth(30),  
147 - ),  
148 - ),  
149 - onTap: () {  
150 - WidgetsBinding.instance  
151 - .addPostFrameCallback(((_) {  
152 - contantShowModel.controller  
153 - .clear();  
154 - contantShowModel.searchData('');  
155 - }));  
156 - },  
157 - )))  
158 - ],  
159 - )),  
160 - Container(  
161 - padding: EdgeInsets.only(  
162 - bottom: ScreenUtil().setWidth(10)),  
163 - margin: EdgeInsets.symmetric(  
164 - horizontal: ScreenUtil().setWidth(30)),  
165 - child: TabBar(  
166 - controller: tabController,  
167 - indicator: CustomTabIndicator(  
168 - radius: 0,  
169 - ),  
170 - indicatorColor: MyColours.color_199095,  
171 - indicatorSize: TabBarIndicatorSize.tab,  
172 - // indicatorPadding: EdgeInsets.symmetric(  
173 - // horizontal: ScreenUtil().setWidth(12)),  
174 - labelColor: MyColours.color_199095,  
175 - labelStyle: TextStyle(  
176 - fontSize: ScreenUtil().setSp(32),  
177 - fontWeight: FontWeight.bold),  
178 - labelPadding: EdgeInsets.zero,  
179 - unselectedLabelStyle:  
180 - TextStyle(fontWeight: FontWeight.normal),  
181 - unselectedLabelColor: MyColours.color_999999,  
182 - tabs: _tabBarTitle.map((value) {  
183 - return Tab(  
184 - child: Text(value),  
185 - );  
186 - }).toList()),  
187 - ),  
188 - Expanded(  
189 - child: TabBarView(  
190 - controller: tabController,  
191 - // physics: NeverScrollableScrollPhysics(),  
192 - children: <Widget>[  
193 - ContantLeftPage(),  
194 - ContantRightPage(),  
195 - ],  
196 - )),  
197 - ],  
198 - )),  
199 - onWillPop: () async {  
200 - EventBus().emit('changeStatusColor');  
201 - return true;  
202 - }))));  
203 - }  
204 -} 109 +// onChanged: (value) {
  110 +// // setState(() {});
  111 +// // _searchSellerLocation();
  112 +// contantShowModel.searchData(value);
  113 +// },
  114 +// onEditingComplete: () {
  115 +// FocusScope.of(context).requestFocus(
  116 +// FocusNode()); //点击空白处隐藏键盘
  117 +// // contantShowModel.searchData(
  118 +// // contantShowModel.controller.text);
  119 +// // _searchSellerLocation();
  120 +// // _focusNode.unfocus();
  121 +// },
  122 +// ),
  123 +// ),
  124 +// Positioned(
  125 +// right: 0,
  126 +// top: 0,
  127 +// bottom: 0,
  128 +// child: Offstage(
  129 +// offstage:
  130 +// contantShowModel.controller.text ==
  131 +// '',
  132 +// child: GestureDetector(
  133 +// child: Container(
  134 +// padding: EdgeInsets.only(
  135 +// right: ScreenUtil()
  136 +// .setWidth(20 * 2)),
  137 +// // color: Colors.orange,
  138 +// height:
  139 +// ScreenUtil().setWidth(45 * 2),
  140 +// width:
  141 +// ScreenUtil().setWidth(100 * 2),
  142 +// alignment: Alignment.centerRight,
  143 +// child: Image.asset(
  144 +// Utils.getImgPath('clear'),
  145 +// width: ScreenUtil().setWidth(30),
  146 +// height: ScreenUtil().setWidth(30),
  147 +// ),
  148 +// ),
  149 +// onTap: () {
  150 +// WidgetsBinding.instance
  151 +// .addPostFrameCallback(((_) {
  152 +// contantShowModel.controller
  153 +// .clear();
  154 +// contantShowModel.searchData('');
  155 +// }));
  156 +// },
  157 +// )))
  158 +// ],
  159 +// )),
  160 +// Container(
  161 +// padding: EdgeInsets.only(
  162 +// bottom: ScreenUtil().setWidth(10)),
  163 +// margin: EdgeInsets.symmetric(
  164 +// horizontal: ScreenUtil().setWidth(30)),
  165 +// child: TabBar(
  166 +// controller: tabController,
  167 +// indicator: CustomTabIndicator(
  168 +// radius: 0,
  169 +// ),
  170 +// indicatorColor: MyColours.color_199095,
  171 +// indicatorSize: TabBarIndicatorSize.tab,
  172 +// // indicatorPadding: EdgeInsets.symmetric(
  173 +// // horizontal: ScreenUtil().setWidth(12)),
  174 +// labelColor: MyColours.color_199095,
  175 +// labelStyle: TextStyle(
  176 +// fontSize: ScreenUtil().setSp(32),
  177 +// fontWeight: FontWeight.bold),
  178 +// labelPadding: EdgeInsets.zero,
  179 +// unselectedLabelStyle:
  180 +// TextStyle(fontWeight: FontWeight.normal),
  181 +// unselectedLabelColor: MyColours.color_999999,
  182 +// tabs: _tabBarTitle.map((value) {
  183 +// return Tab(
  184 +// child: Text(value),
  185 +// );
  186 +// }).toList()),
  187 +// ),
  188 +// Expanded(
  189 +// child: TabBarView(
  190 +// controller: tabController,
  191 +// // physics: NeverScrollableScrollPhysics(),
  192 +// children: <Widget>[
  193 +// ContantLeftPage(),
  194 +// ContantRightPage(),
  195 +// ],
  196 +// )),
  197 +// ],
  198 +// )),
  199 +// onWillPop: () async {
  200 +// EventBus().emit('changeStatusColor');
  201 +// return true;
  202 +// }))));
  203 +// }
  204 +// }
1 -import 'package:flutter/material.dart'; 1 +// import 'package:flutter/material.dart';
2 2
3 -import 'package:lpinyin/lpinyin.dart';  
4 -import 'package:one_key/constant/state.dart';  
5 -import 'package:one_key/models/user_history_entity.dart';  
6 -import 'package:one_key/pages/my/contant_item_page.dart';  
7 -import 'package:one_key/provider/contant_show_model.dart'; 3 +// import 'package:lpinyin/lpinyin.dart';
  4 +// import 'package:one_key/constant/state.dart';
  5 +// import 'package:one_key/models/user_history_entity.dart';
  6 +// import 'package:one_key/pages/my/contant_item_page.dart';
  7 +// import 'package:one_key/provider/contant_show_model.dart';
8 8
9 -import 'package:one_key/utils/dialog_util.dart';  
10 -import 'package:one_key/utils/misc.dart'; 9 +// import 'package:one_key/utils/dialog_util.dart';
  10 +// import 'package:one_key/utils/misc.dart';
11 11
12 -import 'package:one_key/widgets/page_exception.dart'; 12 +// import 'package:one_key/widgets/page_exception.dart';
13 13
14 -import 'package:contacts_service/contacts_service.dart';  
15 -import 'package:permission_handler/permission_handler.dart';  
16 -import 'package:provider/provider.dart'; 14 +// import 'package:contacts_service/contacts_service.dart';
  15 +// import 'package:permission_handler/permission_handler.dart';
  16 +// import 'package:provider/provider.dart';
17 17
18 -class ContantRightPage extends StatefulWidget {  
19 - ContantRightPage({Key key}) : super(key: key); 18 +// class ContantRightPage extends StatefulWidget {
  19 +// ContantRightPage({Key key}) : super(key: key);
20 20
21 - @override  
22 - _ContantRightPageState createState() => _ContantRightPageState();  
23 -} 21 +// @override
  22 +// _ContantRightPageState createState() => _ContantRightPageState();
  23 +// }
24 24
25 -class _ContantRightPageState extends State<ContantRightPage> {  
26 - List<Contact> _contacts;  
27 - bool isNeed = false;  
28 - bool goSetting = false;  
29 - bool userNo = false;  
30 - ContantShowModel contantShowModel;  
31 - @override  
32 - void initState() {  
33 - super.initState();  
34 - WidgetsBinding.instance.addPostFrameCallback((_) {  
35 - _openAddressBook();  
36 - });  
37 - } 25 +// class _ContantRightPageState extends State<ContantRightPage> {
  26 +// List<Contact> _contacts;
  27 +// bool isNeed = false;
  28 +// bool goSetting = false;
  29 +// bool userNo = false;
  30 +// ContantShowModel contantShowModel;
  31 +// @override
  32 +// void initState() {
  33 +// super.initState();
  34 +// WidgetsBinding.instance.addPostFrameCallback((_) {
  35 +// _openAddressBook();
  36 +// });
  37 +// }
38 38
39 - _openAddressBook() async {  
40 - if (!(await checkContactPermission())) {  
41 - PermissionStatus permissionStatus = await contactPermissionStatus();  
42 - if (permissionStatus == PermissionStatus.permanentlyDenied) {  
43 - //用户选择不在弹出权限提示框  
44 - print('never');  
45 - userNo = true;  
46 - setState(() {  
47 - contantShowModel.pageStateRight = PageState.NoPermission;  
48 - });  
49 - // DialogUtil.openAlertDialog(  
50 - // context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0,  
51 - // onTap: () {  
52 - // goSetting = true;  
53 - // openSetting();  
54 - // Navigator.pop(context, '');  
55 - // });  
56 - } else {  
57 - // 申请权限  
58 - bool canContacts = await requestContactPermission();  
59 - if (canContacts) {  
60 - refreshContacts();  
61 - } else {  
62 - setState(() {  
63 - contantShowModel.pageStateRight = PageState.NoPermission;  
64 - });  
65 - //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处  
66 - // DialogUtil.openAlertDialog(  
67 - // context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0,  
68 - // onTap: () {  
69 - // goSetting = true;  
70 - // openSetting();  
71 - // Navigator.pop(context, '');  
72 - // });  
73 - }  
74 - }  
75 - } else {  
76 - refreshContacts();  
77 - }  
78 - } 39 +// _openAddressBook() async {
  40 +// if (!(await checkContactPermission())) {
  41 +// PermissionStatus permissionStatus = await contactPermissionStatus();
  42 +// if (permissionStatus == PermissionStatus.permanentlyDenied) {
  43 +// //用户选择不在弹出权限提示框
  44 +// print('never');
  45 +// userNo = true;
  46 +// setState(() {
  47 +// contantShowModel.pageStateRight = PageState.NoPermission;
  48 +// });
  49 +// // DialogUtil.openAlertDialog(
  50 +// // context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0,
  51 +// // onTap: () {
  52 +// // goSetting = true;
  53 +// // openSetting();
  54 +// // Navigator.pop(context, '');
  55 +// // });
  56 +// } else {
  57 +// // 申请权限
  58 +// bool canContacts = await requestContactPermission();
  59 +// if (canContacts) {
  60 +// refreshContacts();
  61 +// } else {
  62 +// setState(() {
  63 +// contantShowModel.pageStateRight = PageState.NoPermission;
  64 +// });
  65 +// //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处
  66 +// // DialogUtil.openAlertDialog(
  67 +// // context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0,
  68 +// // onTap: () {
  69 +// // goSetting = true;
  70 +// // openSetting();
  71 +// // Navigator.pop(context, '');
  72 +// // });
  73 +// }
  74 +// }
  75 +// } else {
  76 +// refreshContacts();
  77 +// }
  78 +// }
79 79
80 - Future<void> refreshContacts() async {  
81 - List<Contact> contacts = (await ContactsService.getContacts(  
82 - withThumbnails: false, iOSLocalizedLabels: false))  
83 - .toList(); 80 +// Future<void> refreshContacts() async {
  81 +// List<Contact> contacts = (await ContactsService.getContacts(
  82 +// withThumbnails: false, iOSLocalizedLabels: false))
  83 +// .toList();
84 84
85 - setState(() {  
86 - _contacts = contacts;  
87 - if (_contacts.length > 0) {  
88 - contantShowModel.contacts = [];  
89 - for (int i = 0; i < _contacts.length; i++) {  
90 - UserHistoryEntity item = UserHistoryEntity(  
91 - '',  
92 - '',  
93 - _contacts[i].displayName == null ? '' : _contacts[i].displayName,  
94 - '',  
95 - _contacts[i].phones == null  
96 - ? ''  
97 - : _contacts[i].phones.first.value.replaceAll(' ', ''),  
98 - '');  
99 - item.pinyin = _contacts[i].displayName == null  
100 - ? ''  
101 - : PinyinHelper.getPinyin(_contacts[i].displayName)  
102 - .replaceAll(' ', '');  
103 - List<String> pinyinList = _contacts[i].displayName == null  
104 - ? []  
105 - : PinyinHelper.getPinyin(_contacts[i].displayName).split(' ');  
106 - item.pinyinFirst = '';  
107 - item.pinyinList = [];  
108 - String pinyinAll = ''; //组装全拼组合  
109 - for (int j = 0; j < pinyinList.length; j++) {  
110 - String letter = pinyinList[j];  
111 - pinyinAll += pinyinList[j];  
112 - item.pinyinList.add(pinyinAll);  
113 - if (letter.length > 0) {  
114 - item.pinyinFirst += pinyinList[j].substring(0, 1);  
115 - } else {  
116 - item.pinyinFirst += '';  
117 - }  
118 - }  
119 - contantShowModel.contacts.add(item);  
120 - }  
121 - contantShowModel.contactsShow = contantShowModel.contacts;  
122 - contantShowModel.pageStateRight = PageState.Success;  
123 - } else {  
124 - contantShowModel.pageStateRight = PageState.Empty;  
125 - }  
126 - });  
127 - await contantShowModel.searchData(contantShowModel.controller.text);  
128 - } 85 +// setState(() {
  86 +// _contacts = contacts;
  87 +// if (_contacts.length > 0) {
  88 +// contantShowModel.contacts = [];
  89 +// for (int i = 0; i < _contacts.length; i++) {
  90 +// UserHistoryEntity item = UserHistoryEntity(
  91 +// '',
  92 +// '',
  93 +// _contacts[i].displayName == null ? '' : _contacts[i].displayName,
  94 +// '',
  95 +// _contacts[i].phones == null
  96 +// ? ''
  97 +// : _contacts[i].phones.first.value.replaceAll(' ', ''),
  98 +// '');
  99 +// item.pinyin = _contacts[i].displayName == null
  100 +// ? ''
  101 +// : PinyinHelper.getPinyin(_contacts[i].displayName)
  102 +// .replaceAll(' ', '');
  103 +// List<String> pinyinList = _contacts[i].displayName == null
  104 +// ? []
  105 +// : PinyinHelper.getPinyin(_contacts[i].displayName).split(' ');
  106 +// item.pinyinFirst = '';
  107 +// item.pinyinList = [];
  108 +// String pinyinAll = ''; //组装全拼组合
  109 +// for (int j = 0; j < pinyinList.length; j++) {
  110 +// String letter = pinyinList[j];
  111 +// pinyinAll += pinyinList[j];
  112 +// item.pinyinList.add(pinyinAll);
  113 +// if (letter.length > 0) {
  114 +// item.pinyinFirst += pinyinList[j].substring(0, 1);
  115 +// } else {
  116 +// item.pinyinFirst += '';
  117 +// }
  118 +// }
  119 +// contantShowModel.contacts.add(item);
  120 +// }
  121 +// contantShowModel.contactsShow = contantShowModel.contacts;
  122 +// contantShowModel.pageStateRight = PageState.Success;
  123 +// } else {
  124 +// contantShowModel.pageStateRight = PageState.Empty;
  125 +// }
  126 +// });
  127 +// await contantShowModel.searchData(contantShowModel.controller.text);
  128 +// }
129 129
130 - @override  
131 - Widget build(BuildContext context) {  
132 - contantShowModel = Provider.of<ContantShowModel>(context, listen: true);  
133 - return Consumer<ContantShowModel>(builder: (context, model, _) {  
134 - if (model.pageStateRight != PageState.Success) {  
135 - return ExceptionPage(  
136 - pageState: model.pageStateRight,  
137 - callback: () async {  
138 - if (await checkContactPermission()) {  
139 - _openAddressBook();  
140 - } else {  
141 - goSetting = true;  
142 - openSetting();  
143 - }  
144 - },  
145 - emptyMsg: "暂时没有联系人哦",  
146 - emptyImg: "empty_search",  
147 - showMsg: "加载中,请稍后...",  
148 - );  
149 - } else {  
150 - return ListView.builder(  
151 - itemCount: contantShowModel.contactsShow?.length ?? 0,  
152 - itemBuilder: (BuildContext context, int index) {  
153 - UserHistoryEntity c = contantShowModel.contactsShow[index];  
154 - return ContantItemPage(  
155 - onTap: () {  
156 - if (c.phone != null && c.phone != '') {  
157 - DialogUtil.goPhone(c.phone);  
158 - }  
159 - },  
160 - index: index,  
161 - model: contantShowModel,  
162 - data: contantShowModel.contactsShow,  
163 - );  
164 - });  
165 - }  
166 - });  
167 - }  
168 -} 130 +// @override
  131 +// Widget build(BuildContext context) {
  132 +// contantShowModel = Provider.of<ContantShowModel>(context, listen: true);
  133 +// return Consumer<ContantShowModel>(builder: (context, model, _) {
  134 +// if (model.pageStateRight != PageState.Success) {
  135 +// return ExceptionPage(
  136 +// pageState: model.pageStateRight,
  137 +// callback: () async {
  138 +// if (await checkContactPermission()) {
  139 +// _openAddressBook();
  140 +// } else {
  141 +// goSetting = true;
  142 +// openSetting();
  143 +// }
  144 +// },
  145 +// emptyMsg: "暂时没有联系人哦",
  146 +// emptyImg: "empty_search",
  147 +// showMsg: "加载中,请稍后...",
  148 +// );
  149 +// } else {
  150 +// return ListView.builder(
  151 +// itemCount: contantShowModel.contactsShow?.length ?? 0,
  152 +// itemBuilder: (BuildContext context, int index) {
  153 +// UserHistoryEntity c = contantShowModel.contactsShow[index];
  154 +// return ContantItemPage(
  155 +// onTap: () {
  156 +// if (c.phone != null && c.phone != '') {
  157 +// DialogUtil.goPhone(c.phone);
  158 +// }
  159 +// },
  160 +// index: index,
  161 +// model: contantShowModel,
  162 +// data: contantShowModel.contactsShow,
  163 +// );
  164 +// });
  165 +// }
  166 +// });
  167 +// }
  168 +// }
  1 +import 'package:azlistview/azlistview.dart';
  2 +import 'package:flutter/material.dart';
  3 +import 'package:flutter/services.dart';
  4 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:lpinyin/lpinyin.dart';
  6 +import 'package:one_key/models/user_history_entity.dart';
  7 +import 'package:one_key/provider/contact_model.dart';
  8 +import 'package:one_key/res/colors.dart';
  9 +import 'package:one_key/utils/utils.dart';
  10 +
  11 +class ContactListPage extends StatefulWidget {
  12 + final List<UserHistoryEntity> contacts;
  13 +
  14 + const ContactListPage({Key key, this.contacts}) : super(key: key);
  15 + @override
  16 + State<StatefulWidget> createState() {
  17 + return new _ContactListPageState();
  18 + }
  19 +}
  20 +
  21 +class _ContactListPageState extends State<ContactListPage> {
  22 + // List<contan> _contacts = [];
  23 + double susItemHeight = ScreenUtil().setWidth(10);
  24 +
  25 + @override
  26 + void initState() {
  27 + super.initState();
  28 + // loadData();
  29 + _handleList(widget.contacts);
  30 + }
  31 +
  32 + // void loadData() async {
  33 + // //加载联系人列表
  34 + // rootBundle.loadString('assets/data/contacts.json').then((value) {
  35 + // List list = json.decode(value);
  36 + // list.forEach((v) {
  37 + // _contacts.add(ContactInfo.fromJson(v));
  38 + // });
  39 + // _handleList(_contacts);
  40 + // });
  41 + // }
  42 +
  43 + void _handleList(List<UserHistoryEntity> list) {
  44 + if (list == null || list.isEmpty) return;
  45 + for (int i = 0, length = list.length; i < length; i++) {
  46 + String pinyin = '';
  47 + String tag = '';
  48 +
  49 + if (list[i].pinyin == null || list[i].pinyin == '') {
  50 + // list[i].pinyin = pinyin;
  51 + } else {
  52 + tag = list[i].pinyin.substring(0, 1).toUpperCase();
  53 + }
  54 +
  55 + if (RegExp("[A-Z]").hasMatch(tag)) {
  56 + list[i].tagIndex = tag;
  57 + } else {
  58 + list[i].tagIndex = "#";
  59 + }
  60 + }
  61 + // A-Z sort.
  62 + SuspensionUtil.sortListBySuspensionTag(widget.contacts);
  63 +
  64 + // show sus tag.
  65 + SuspensionUtil.setShowSuspensionStatus(widget.contacts);
  66 +
  67 + // add header.
  68 + // _contacts.insert(0, UserHistoryEntity(name: 'header', tagIndex: '↑'));
  69 +
  70 + setState(() {});
  71 + }
  72 +
  73 + Widget _buildHeader() {
  74 + return Container(
  75 + padding: EdgeInsets.all(20),
  76 + alignment: Alignment.center,
  77 + child: Column(
  78 + mainAxisAlignment: MainAxisAlignment.center,
  79 + children: <Widget>[
  80 + ClipOval(
  81 + child: Image.asset(
  82 + "./assets/images/avatar.png",
  83 + width: 80.0,
  84 + )),
  85 + Padding(
  86 + padding: const EdgeInsets.all(8.0),
  87 + child: Text(
  88 + "远行",
  89 + textScaleFactor: 1.2,
  90 + ),
  91 + ),
  92 + Text("+86 182-286-44678"),
  93 + ],
  94 + ),
  95 + );
  96 + }
  97 +
  98 + Widget _buildSusWidget(String susTag) {
  99 + return Container(
  100 + padding: EdgeInsets.symmetric(
  101 + horizontal: ScreenUtil().setWidth(20),
  102 + vertical: ScreenUtil().setWidth(10)),
  103 + // height: susItemHeight,
  104 + // margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(20)),
  105 + width: double.infinity,
  106 + color: Color.fromRGBO(239, 239, 239, 1),
  107 + alignment: Alignment.centerLeft,
  108 + child: Text(
  109 + '$susTag',
  110 + style: TextStyle(fontSize: ScreenUtil().setWidth(28)),
  111 + ),
  112 + );
  113 + }
  114 +
  115 + Widget _buildListItem(UserHistoryEntity model) {
  116 + String susTag = model.getSuspensionTag();
  117 + return Column(
  118 + children: <Widget>[
  119 + Offstage(
  120 + offstage: model.isShowSuspension != true,
  121 + child: _buildSusWidget(susTag),
  122 + ),
  123 + Container(
  124 + padding: EdgeInsets.only(
  125 + left: ScreenUtil().setWidth(30),
  126 + right: ScreenUtil().setWidth(30),
  127 + bottom: ScreenUtil().setWidth(30)),
  128 + decoration: BoxDecoration(
  129 + border: Border(
  130 + bottom: BorderSide(
  131 + color: Color.fromRGBO(244, 244, 244, 1),
  132 + width: ScreenUtil().setWidth(2)))),
  133 + child: Row(
  134 + children: [
  135 + Stack(
  136 + alignment: Alignment.bottomCenter,
  137 + clipBehavior: Clip.none,
  138 + children: [
  139 + Stack(
  140 + alignment: Alignment.centerLeft,
  141 + clipBehavior: Clip.none,
  142 + children: [
  143 + CircleAvatar(
  144 + radius: ScreenUtil().setWidth(60),
  145 + backgroundColor: Color.fromRGBO(239, 239, 239, 1),
  146 + child: Text(
  147 + model.rname != null && model.rname != ''
  148 + ? model.rname.substring(0, 1)
  149 + : '',
  150 + style: TextStyle(
  151 + color: Color.fromRGBO(206, 206, 206, 1),
  152 + fontSize: ScreenUtil().setSp(42)),
  153 + ),
  154 + ),
  155 + Positioned(
  156 + left: ScreenUtil().setWidth(-18),
  157 + child: Image.asset(
  158 + Utils.getImgPath('select'),
  159 + width: ScreenUtil().setWidth(36),
  160 + ))
  161 + ]),
  162 + Positioned(
  163 + bottom: ScreenUtil().setWidth(-20),
  164 + child: Container(
  165 + padding: EdgeInsets.symmetric(
  166 + horizontal: ScreenUtil().setWidth(10),
  167 + vertical: ScreenUtil().setWidth(2),
  168 + ),
  169 + decoration: BoxDecoration(
  170 + color: Color.fromRGBO(223, 33, 81, 1),
  171 + borderRadius: BorderRadius.circular(
  172 + ScreenUtil().setWidth(10),
  173 + ),
  174 + ),
  175 + child: Text('沉睡',
  176 + style: TextStyle(
  177 + color: MyColours.color_ffffff,
  178 + fontSize: ScreenUtil().setSp(28)))))
  179 + ],
  180 + )
  181 + ],
  182 + ),
  183 + )
  184 + // ListTile(
  185 + // leading: ,
  186 + // title: Text(model.rname),
  187 + // onTap: () {
  188 + // print("OnItemClick: $model");
  189 + // Navigator.pop(context, model);
  190 + // },
  191 + // )
  192 + ],
  193 + );
  194 + }
  195 +
  196 + Decoration getIndexBarDecoration(Color color) {
  197 + return BoxDecoration(
  198 + color: color,
  199 + borderRadius: BorderRadius.circular(20.0),
  200 + border: Border.all(color: Colors.grey[300], width: .5));
  201 + }
  202 +
  203 + @override
  204 + Widget build(BuildContext context) {
  205 + return AzListView(
  206 + data: widget.contacts,
  207 + itemCount: widget.contacts.length,
  208 + itemBuilder: (BuildContext context, int index) {
  209 + // if (index == 0) return _buildHeader();
  210 + UserHistoryEntity model = widget.contacts[index];
  211 + return Padding(
  212 + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(40)),
  213 + child: _buildListItem(model));
  214 + },
  215 + physics: BouncingScrollPhysics(),
  216 + indexBarData: SuspensionUtil.getTagIndexList(widget.contacts),
  217 + indexHintBuilder: (context, hint) {
  218 + return Container(
  219 + alignment: Alignment.center,
  220 + width: ScreenUtil().setWidth(120),
  221 + height: ScreenUtil().setWidth(120),
  222 + decoration: BoxDecoration(
  223 + color: Color.fromRGBO(239, 239, 239, 1),
  224 + shape: BoxShape.circle,
  225 + ),
  226 + child:
  227 + Text(hint, style: TextStyle(color: Colors.white, fontSize: 30.0)),
  228 + );
  229 + },
  230 + indexBarMargin: EdgeInsets.all(10),
  231 + indexBarOptions: IndexBarOptions(
  232 + needRebuild: true,
  233 + decoration: getIndexBarDecoration(Colors.grey[50]),
  234 + downDecoration: getIndexBarDecoration(Colors.grey[200]),
  235 + ),
  236 + );
  237 + }
  238 +}
  1 +import 'package:flutter/material.dart';
  2 +
  3 +import 'package:flutter_screenutil/screenutil.dart';
  4 +import 'package:one_key/constant/state.dart';
  5 +import 'package:one_key/pages/my/contant_item_page.dart';
  6 +import 'package:one_key/pages/my/customer_type/contant_list_page.dart';
  7 +
  8 +import 'package:one_key/provider/contant_show_model.dart';
  9 +import 'package:one_key/provider/customer_provider.dart';
  10 +import 'package:one_key/provider/user_model.dart';
  11 +import 'package:one_key/res/colors.dart';
  12 +import 'package:one_key/utils/dialog_util.dart';
  13 +import 'package:one_key/utils/event_bus.dart';
  14 +import 'package:one_key/utils/utils.dart';
  15 +
  16 +import 'package:one_key/widgets/custom_tab_indicator.dart';
  17 +import 'package:one_key/widgets/h_empty_view.dart';
  18 +import 'package:one_key/widgets/page_exception.dart';
  19 +import 'package:one_key/widgets/system_app_bar.dart';
  20 +import 'package:one_key/widgets/v_empty_view.dart';
  21 +import 'package:azlistview/azlistview.dart';
  22 +
  23 +import 'package:provider/provider.dart';
  24 +
  25 +class CustomerListPage extends StatefulWidget {
  26 + @override
  27 + _CustomerListPageState createState() => _CustomerListPageState();
  28 +}
  29 +
  30 +class _CustomerListPageState extends State<CustomerListPage>
  31 + with TickerProviderStateMixin {
  32 + List _tabBarTitle;
  33 + TabController tabController;
  34 +
  35 + CustomerProvider customerProvider;
  36 + @override
  37 + void initState() {
  38 + _tabBarTitle = ['全部', '活跃', '沉睡', '流失'];
  39 + super.initState();
  40 + tabController = TabController(length: 4, vsync: this);
  41 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  42 + _getContantData();
  43 + });
  44 + }
  45 +
  46 + _getContantData() async {
  47 + Map<String, String> params = {
  48 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  49 + };
  50 + await customerProvider.getUserHistorys(context, params);
  51 + await customerProvider.searchData(customerProvider.controller.text);
  52 + }
  53 +
  54 + @override
  55 + Widget build(BuildContext context) {
  56 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
  57 + return Material(
  58 + child: InkWell(
  59 + onTap: () {
  60 + // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  61 + },
  62 + child: Scaffold(
  63 + resizeToAvoidBottomInset: false,
  64 + backgroundColor: MyColours.color_ffffff,
  65 + appBar: SystemAppBar(
  66 + '全店客户',
  67 + onTap: () {
  68 + EventBus().emit('changeStatusColor');
  69 + Navigator.of(context).pop();
  70 + },
  71 + ),
  72 + body: WillPopScope(
  73 + child: SafeArea(
  74 + child: Column(
  75 + children: <Widget>[
  76 + Container(
  77 + color: MyColours.color_ffffff,
  78 + padding: EdgeInsets.symmetric(
  79 + horizontal: ScreenUtil().setWidth(40),
  80 + vertical: ScreenUtil().setWidth(10)),
  81 + height: ScreenUtil().setWidth(45 * 2),
  82 + // alignment: Alignment.center,
  83 +
  84 + child: Stack(
  85 + children: [
  86 + Container(
  87 + alignment: Alignment.center,
  88 + padding: EdgeInsets.symmetric(
  89 + horizontal: ScreenUtil().setWidth(20 * 2),
  90 + vertical: ScreenUtil().setWidth(14)),
  91 + decoration: BoxDecoration(
  92 + color: MyColours.color_ffffff,
  93 + borderRadius: BorderRadius.circular(
  94 + ScreenUtil().setWidth(24 * 2)),
  95 + border: Border.all(
  96 + color:
  97 + Color.fromRGBO(228, 228, 228, 1)),
  98 + boxShadow: [
  99 + BoxShadow(
  100 + color: Color.fromRGBO(
  101 + 220, 220, 220, 1), //投影颜色
  102 + offset: Offset(2, 3), //x,y轴
  103 + blurRadius:
  104 + ScreenUtil().setWidth(6) //投影距离
  105 + )
  106 + ]),
  107 + child: TextField(
  108 + maxLines: 1,
  109 + controller: customerProvider.controller,
  110 + // focusNode: _focusNode,
  111 + // autofocus: true,
  112 + style: TextStyle(
  113 + color: MyColours.color_333333,
  114 + fontSize: ScreenUtil().setSp(26)),
  115 + // textAlignVertical: TextAlignVertical.center,
  116 + decoration: InputDecoration(
  117 + contentPadding: EdgeInsets.only(
  118 + right: ScreenUtil().setWidth(40 * 2)),
  119 + hintText: "输入手机号或姓名",
  120 + hintStyle: TextStyle(
  121 + color: MyColours.color_999999,
  122 + fontSize: ScreenUtil().setSp(26),
  123 + ),
  124 + isCollapsed:
  125 + true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  126 + border: OutlineInputBorder(
  127 + borderSide: BorderSide.none),
  128 + // 左边图标设置
  129 + icon: Image.asset(
  130 + Utils.getImgPath('search'),
  131 + width: ScreenUtil().setWidth(30),
  132 + ),
  133 + //右边图标设置
  134 + // suffixIcon:
  135 + ),
  136 + keyboardType: TextInputType.text,
  137 + textInputAction: TextInputAction.done,
  138 +
  139 + onChanged: (value) {
  140 + // setState(() {});
  141 + // _searchSellerLocation();
  142 + customerProvider.searchData(value);
  143 + },
  144 + onEditingComplete: () {
  145 + FocusScope.of(context).requestFocus(
  146 + FocusNode()); //点击空白处隐藏键盘
  147 + // contantShowModel.searchData(
  148 + // contantShowModel.controller.text);
  149 + // _searchSellerLocation();
  150 + // _focusNode.unfocus();
  151 + },
  152 + ),
  153 + ),
  154 + Positioned(
  155 + right: 0,
  156 + top: 0,
  157 + bottom: 0,
  158 + child: Offstage(
  159 + offstage:
  160 + customerProvider.controller.text ==
  161 + '',
  162 + child: GestureDetector(
  163 + child: Container(
  164 + padding: EdgeInsets.only(
  165 + right: ScreenUtil()
  166 + .setWidth(20 * 2)),
  167 + // color: Colors.orange,
  168 + height:
  169 + ScreenUtil().setWidth(45 * 2),
  170 + width:
  171 + ScreenUtil().setWidth(100 * 2),
  172 + alignment: Alignment.centerRight,
  173 + child: Image.asset(
  174 + Utils.getImgPath('clear'),
  175 + width: ScreenUtil().setWidth(30),
  176 + height: ScreenUtil().setWidth(30),
  177 + ),
  178 + ),
  179 + onTap: () {
  180 + WidgetsBinding.instance
  181 + .addPostFrameCallback(((_) {
  182 + customerProvider.controller
  183 + .clear();
  184 + customerProvider.searchData('');
  185 + }));
  186 + },
  187 + )))
  188 + ],
  189 + )),
  190 + Container(
  191 + margin: EdgeInsets.symmetric(
  192 + horizontal: ScreenUtil().setWidth(40),
  193 + vertical: ScreenUtil().setWidth(20)),
  194 + decoration: BoxDecoration(
  195 + color: MyColours.color_ffffff,
  196 + boxShadow: [
  197 + BoxShadow(
  198 + // color: Colors.red,
  199 + color: Color.fromRGBO(
  200 + 220, 220, 220, 1), //投影颜色
  201 + offset: Offset(2, 2), //x,y轴
  202 + blurRadius:
  203 + ScreenUtil().setWidth(6) //投影距离
  204 + )
  205 + ]),
  206 + child: Row(
  207 + children: [
  208 + Expanded(
  209 + child: Container(
  210 + padding: EdgeInsets.only(
  211 + bottom: ScreenUtil().setWidth(10)),
  212 + margin: EdgeInsets.symmetric(
  213 + horizontal: ScreenUtil().setWidth(30)),
  214 + child: TabBar(
  215 + controller: tabController,
  216 + indicator: CustomTabIndicator(
  217 + radius: 0,
  218 + ),
  219 + indicatorColor: MyColours.color_199095,
  220 + indicatorSize: TabBarIndicatorSize.tab,
  221 + // indicatorPadding: EdgeInsets.symmetric(
  222 + // horizontal: ScreenUtil().setWidth(12)),
  223 + labelColor: MyColours.color_199095,
  224 + labelStyle: TextStyle(
  225 + fontSize: ScreenUtil().setSp(32),
  226 + fontWeight: FontWeight.bold),
  227 + labelPadding: EdgeInsets.zero,
  228 + unselectedLabelStyle: TextStyle(
  229 + fontWeight: FontWeight.normal,
  230 + fontSize: ScreenUtil().setSp(28),
  231 + ),
  232 + unselectedLabelColor:
  233 + MyColours.color_999999,
  234 + tabs: _tabBarTitle.map((value) {
  235 + return Tab(
  236 + child: Text(value),
  237 + );
  238 + }).toList()),
  239 + )),
  240 + InkWell(
  241 + onTap: () {},
  242 + child: Container(
  243 + padding: EdgeInsets.only(
  244 + bottom: ScreenUtil().setWidth(10)),
  245 + margin: EdgeInsets.only(
  246 + right: ScreenUtil().setWidth(30)),
  247 + width: ScreenUtil().setWidth(100),
  248 + // height: ScreenUtil().setWidth(50),
  249 + child: Row(
  250 + children: [
  251 + Text(
  252 + '筛选',
  253 + style: TextStyle(
  254 + fontSize:
  255 + ScreenUtil().setSp(28),
  256 + color: MyColours.color_999999),
  257 + ),
  258 + HEmptyView(10),
  259 + Image.asset(
  260 + Utils.getImgPath(
  261 + 'enter_order_arrow'),
  262 + width: ScreenUtil().setWidth(20),
  263 + height: ScreenUtil().setWidth(10),
  264 + )
  265 + ],
  266 + )),
  267 + )
  268 + ],
  269 + )),
  270 + VEmptyView(10),
  271 + Expanded(
  272 + child: TabBarView(
  273 + controller: tabController,
  274 + // physics: NeverScrollableScrollPhysics(),
  275 + children: <Widget>[
  276 + Consumer<CustomerProvider>(
  277 + builder: (context, model, _) {
  278 + if (model.pageState != PageState.Success) {
  279 + return ExceptionPage(
  280 + pageState: model.pageState,
  281 + callback: () {
  282 + model.pageState = PageState.Loading;
  283 + model.notifyListeners();
  284 + _getContantData();
  285 + },
  286 + emptyMsg: "暂时没有联系人哦",
  287 + emptyImg: "empty_search",
  288 + showMsg: "加载中,请稍后...",
  289 + );
  290 + } else {
  291 + return ContactListPage(
  292 + contacts: model.userHistorysShow);
  293 + // return ListView.builder(
  294 + // itemCount: model.userHistorysShow.length,
  295 + // itemBuilder:
  296 + // (BuildContext context, int index) {
  297 + // String phone = model
  298 + // .userHistorysShow[index]
  299 + // .phone ==
  300 + // null ||
  301 + // model.userHistorysShow[index]
  302 + // .phone ==
  303 + // ''
  304 + // ? ''
  305 + // : model
  306 + // .userHistorysShow[index].phone;
  307 + // return ContantItemPage(
  308 + // onTap: () {
  309 + // if (model.userHistorysShow[index]
  310 + // .phone !=
  311 + // null &&
  312 + // model.userHistorysShow[index]
  313 + // .phone !=
  314 + // '') {
  315 + // DialogUtil.goPhone(model
  316 + // .userHistorysShow[index]
  317 + // .phone);
  318 + // }
  319 + // },
  320 + // index: index,
  321 + // model: customerProvider,
  322 + // data: model.userHistorysShow,
  323 + // );
  324 + // });
  325 + }
  326 + },
  327 + ),
  328 + Container(
  329 + height: 200,
  330 + width: 300,
  331 + color: Colors.red,
  332 + ),
  333 + Container(
  334 + height: 200,
  335 + width: 300,
  336 + color: Colors.red,
  337 + ),
  338 + Container(
  339 + height: 200,
  340 + width: 300,
  341 + color: Colors.red,
  342 + )
  343 + ],
  344 + )),
  345 + ],
  346 + )),
  347 + onWillPop: () async {
  348 + EventBus().emit('changeStatusColor');
  349 + return true;
  350 + }))));
  351 + }
  352 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:one_key/widgets/system_app_bar.dart';
  3 +
  4 +class MyCustomerPage extends StatefulWidget {
  5 + MyCustomerPage({Key key}) : super(key: key);
  6 +
  7 + @override
  8 + _MyCustomerPageState createState() => _MyCustomerPageState();
  9 +}
  10 +
  11 +class _MyCustomerPageState extends State<MyCustomerPage> {
  12 + @override
  13 + Widget build(BuildContext context) {
  14 + return Scaffold(
  15 + appBar: SystemAppBar('我的客情', onTap: () {
  16 + Navigator.pop(context);
  17 + }),
  18 + body: Container(),
  19 + );
  20 + }
  21 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/screenutil.dart';
  3 +import 'package:one_key/res/colors.dart';
  4 +import 'package:one_key/route/navigator_util.dart';
  5 +import 'package:one_key/utils/event_bus.dart';
  6 +import 'package:one_key/utils/utils.dart';
  7 +import 'package:one_key/widgets/h_empty_view.dart';
  8 +import 'package:one_key/widgets/round_button.dart';
  9 +import 'package:one_key/widgets/system_app_bar.dart';
  10 +import 'package:one_key/widgets/v_empty_view.dart';
  11 +
  12 +class StoreCustomerPage extends StatefulWidget {
  13 + StoreCustomerPage({Key key}) : super(key: key);
  14 +
  15 + @override
  16 + _StoreCustomerPageState createState() => _StoreCustomerPageState();
  17 +}
  18 +
  19 +class _StoreCustomerPageState extends State<StoreCustomerPage> {
  20 + ScrollController _controller = ScrollController();
  21 +
  22 + ///活跃客户、沉睡客户、流失客户
  23 + Widget _percentWidget(String pnum, String btnTitle, String percent) {
  24 + return Container(
  25 + color: MyColours.color_ffffff,
  26 + // height: ScreenUtil().setWidth(230),
  27 + child: Column(
  28 + mainAxisAlignment: MainAxisAlignment.center,
  29 + children: [
  30 + Row(
  31 + mainAxisAlignment: MainAxisAlignment.center,
  32 + children: [
  33 + Text(pnum,
  34 + style: TextStyle(
  35 + color: MyColours.color_199095,
  36 + fontSize: ScreenUtil().setSp(40),
  37 + fontWeight: FontWeight.bold)),
  38 + Text('位',
  39 + style: TextStyle(
  40 + color: MyColours.color_199095,
  41 + fontSize: ScreenUtil().setSp(24),
  42 + ))
  43 + ],
  44 + ),
  45 + VEmptyView(20),
  46 + RoundButton(
  47 + onPressed: () async {},
  48 + text: btnTitle,
  49 + fontSize: 24,
  50 + isBold: false,
  51 + textColor: MyColours.color_333333,
  52 + gradientStart: MyColours.color_ffffff,
  53 + gradientEnd: MyColours.color_ffffff,
  54 + borderColor: Color.fromRGBO(118, 118, 118, 1),
  55 + height: ScreenUtil().setWidth(45),
  56 + width: ScreenUtil().setWidth(160),
  57 + radius: ScreenUtil().setWidth(30),
  58 + ),
  59 + VEmptyView(16),
  60 + percent == null
  61 + ? SizedBox()
  62 + : Text('${percent}%',
  63 + style: TextStyle(
  64 + color: MyColours.color_199095,
  65 + fontSize: ScreenUtil().setSp(24),
  66 + )),
  67 + ],
  68 + ),
  69 + );
  70 + }
  71 +
  72 + @override
  73 + Widget build(BuildContext context) {
  74 + return Scaffold(
  75 + backgroundColor: Color.fromRGBO(246, 248, 250, 1),
  76 + appBar: SystemAppBar('全店客情', onTap: () {
  77 + EventBus().emit('changeStatusColor');
  78 + Navigator.pop(context);
  79 + }),
  80 + body: WillPopScope(
  81 + onWillPop: () async {
  82 + EventBus().emit('changeStatusColor');
  83 + return true;
  84 + },
  85 + child: Column(children: [
  86 + Expanded(
  87 + child: SingleChildScrollView(
  88 + controller: _controller,
  89 + child: Column(
  90 + children: [
  91 + VEmptyView(10),
  92 + Stack(
  93 + children: [
  94 + Container(
  95 + color: MyColours.color_ffffff,
  96 + padding: EdgeInsets.symmetric(
  97 + vertical: ScreenUtil().setWidth(30)),
  98 + child: Column(
  99 + children: [
  100 + Row(
  101 + mainAxisAlignment: MainAxisAlignment.center,
  102 + children: [
  103 + Text(
  104 + '19906',
  105 + style: TextStyle(
  106 + color: MyColours.color_199095,
  107 + fontSize: ScreenUtil().setSp(60),
  108 + fontWeight: FontWeight.bold),
  109 + ),
  110 + Text(
  111 + '位',
  112 + style: TextStyle(
  113 + color: MyColours.color_199095,
  114 + fontWeight: FontWeight.bold,
  115 + fontSize: ScreenUtil().setSp(30)),
  116 + )
  117 + ],
  118 + ),
  119 + VEmptyView(10),
  120 + RoundButton(
  121 + onPressed: () async {
  122 + NavigatorUtil.goCustomerListPage(context);
  123 + },
  124 + text: '全店客户',
  125 + fontSize: 24,
  126 + isBold: false,
  127 + textColor: MyColours.color_333333,
  128 + gradientStart: MyColours.color_ffffff,
  129 + gradientEnd: MyColours.color_ffffff,
  130 + borderColor: Color.fromRGBO(118, 118, 118, 1),
  131 + height: ScreenUtil().setWidth(45),
  132 + width: ScreenUtil().setWidth(160),
  133 + radius: ScreenUtil().setWidth(30),
  134 + )
  135 + ],
  136 + ),
  137 + ),
  138 + Positioned(
  139 + top: ScreenUtil().setWidth(20),
  140 + right: ScreenUtil().setWidth(40),
  141 + child: Image.asset(Utils.getImgPath('add_area'),
  142 + width: ScreenUtil().setWidth(30)))
  143 + ],
  144 + ),
  145 + VEmptyView(10),
  146 + GridView.builder(
  147 + controller: _controller,
  148 + shrinkWrap: true,
  149 + cacheExtent: ScreenUtil().setWidth(0),
  150 + itemCount: 3,
  151 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  152 + crossAxisCount: 3,
  153 + childAspectRatio: 1,
  154 + mainAxisSpacing: ScreenUtil().setWidth(10),
  155 + crossAxisSpacing: ScreenUtil().setWidth(10)),
  156 + itemBuilder: (BuildContext context, int index) {
  157 + // locationState = state;
  158 + return _percentWidget('1999', '活跃客户', '39.20');
  159 + }),
  160 + // Row(
  161 + // children: [
  162 + // _percentWidget('19992', '活跃客户', '90.90'),
  163 + // HEmptyView(10),
  164 + // _percentWidget('19992', '沉睡客户', '90.90'),
  165 + // HEmptyView(10),
  166 + // _percentWidget('19992', '流失客户', '5.90'),
  167 + // ],
  168 + // ),
  169 + Padding(
  170 + padding: EdgeInsets.symmetric(
  171 + vertical: ScreenUtil().setWidth(30)),
  172 + child: Text(
  173 + '客户经理',
  174 + style: TextStyle(
  175 + fontSize: ScreenUtil().setSp(28),
  176 + color: MyColours.color_333333),
  177 + ),
  178 + ),
  179 + GridView.builder(
  180 + controller: _controller,
  181 + shrinkWrap: true,
  182 + cacheExtent: ScreenUtil().setWidth(0),
  183 + itemCount: 20,
  184 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  185 + crossAxisCount: 3,
  186 + childAspectRatio: 1,
  187 + mainAxisSpacing: ScreenUtil().setWidth(10),
  188 + crossAxisSpacing: ScreenUtil().setWidth(10)),
  189 + itemBuilder: (BuildContext context, int index) {
  190 + // locationState = state;
  191 + return _percentWidget('1999', 'xx经理', null);
  192 + })
  193 + ],
  194 + ),
  195 + )),
  196 + Padding(
  197 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),
  198 + child: RoundButton(
  199 + onPressed: () async {},
  200 + text: '营销记录',
  201 + fontSize: 24,
  202 + isBold: false,
  203 + textColor: MyColours.color_199095,
  204 + gradientStart: MyColours.color_ffffff,
  205 + gradientEnd: MyColours.color_ffffff,
  206 + borderColor: MyColours.color_199095,
  207 + height: ScreenUtil().setWidth(75),
  208 + width: ScreenUtil().setWidth(260),
  209 + radius: ScreenUtil().setWidth(10),
  210 + // image: Utils.getImgPath('add_area')
  211 + ),
  212 + )
  213 + ])),
  214 + );
  215 + }
  216 +}
@@ -264,6 +264,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -264,6 +264,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
264 ]; 264 ];
265 }, body: Consumer<UserModel>( 265 }, body: Consumer<UserModel>(
266 builder: (BuildContext context, UserModel model, Widget child) { 266 builder: (BuildContext context, UserModel model, Widget child) {
  267 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
267 return MediaQuery.removePadding( 268 return MediaQuery.removePadding(
268 context: context, 269 context: context,
269 child: SingleChildScrollView( 270 child: SingleChildScrollView(
@@ -317,9 +318,19 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -317,9 +318,19 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
317 ScreenUtil().setHeight(1), 318 ScreenUtil().setHeight(1),
318 color: MyColours.color_f3f3f3, 319 color: MyColours.color_f3f3f3,
319 ), 320 ),
320 - 321 + userModel.user.role_name == '管理员' ||
  322 + userModel.user.role_name == '店长'
  323 + ? MyItem(
  324 + title: "全店客情",
  325 + content: "",
  326 + callback: () {
  327 + // Utils.goMiniProgramZm(context, "roomtype/roomtype");
  328 + NavigatorUtil.goStoreCustomerPage(context);
  329 + },
  330 + )
  331 + : SizedBox(),
321 MyItem( 332 MyItem(
322 - title: "联系人", 333 + title: "我的客情",
323 content: "", 334 content: "",
324 callback: () { 335 callback: () {
325 // Utils.goMiniProgramZm(context, "roomtype/roomtype"); 336 // Utils.goMiniProgramZm(context, "roomtype/roomtype");
  1 +import 'package:flutter/material.dart';
  2 +import 'package:lpinyin/lpinyin.dart';
  3 +import 'package:one_key/constant/constant.dart';
  4 +import 'package:one_key/constant/error.dart';
  5 +import 'package:one_key/constant/state.dart';
  6 +import 'package:one_key/models/user_history_entity.dart';
  7 +import 'package:one_key/net/base_resp.dart';
  8 +import 'package:one_key/net/dio_util.dart';
  9 +import 'package:one_key/net/http_url.dart';
  10 +import 'package:one_key/widgets/loading.dart';
  11 +
  12 +class CustomerProvider extends ChangeNotifier {
  13 + PageState pageState = PageState.Loading;
  14 + List<UserHistoryEntity> userHistorys = []; //历史录入(总)
  15 + List<UserHistoryEntity> userHistorysShow = []; //历史录入展示
  16 + TextEditingController controller = TextEditingController(); //搜索框
  17 +
  18 + //获取历史录入
  19 + getUserHistorys(BuildContext context, Map<String, String> params) async {
  20 + BaseResp<List> baseResp = await DioUtil()
  21 + .request<List>(context, Method.get, HttpUrl.get_reserve_user,
  22 + data: params, showLoading: false)
  23 + .catchError((error) {
  24 + print(error.toString());
  25 + if (error is MyError) {
  26 + switch (error.type) {
  27 + case 1:
  28 + pageState = PageState.ConnectivityError;
  29 + break;
  30 + case 2:
  31 + pageState = PageState.ConnectivityTimeOut;
  32 + break;
  33 + default:
  34 + pageState = PageState.ConnectivityError;
  35 + break;
  36 + }
  37 + }
  38 + notifyListeners();
  39 + });
  40 + if (baseResp != null && baseResp.code == Constant.status_success) {
  41 + userHistorys = baseResp.data.map<UserHistoryEntity>((value) {
  42 + return UserHistoryEntity.fromJson(value);
  43 + }).toList();
  44 + if (userHistorys.length == 0) {
  45 + pageState = PageState.Empty;
  46 + } else {
  47 + for (int i = 0; i < userHistorys.length; i++) {
  48 + UserHistoryEntity item = userHistorys[i];
  49 + item.pinyinFirst = '';
  50 + item.pinyinList = [];
  51 + item.pinyinList = [];
  52 + if (item.rname != null) {
  53 + item.pinyin =
  54 + PinyinHelper.getPinyin(item.rname).replaceAll(' ', '');
  55 + List<String> pinyinList =
  56 + PinyinHelper.getPinyin(item.rname).split(' ');
  57 +
  58 + String pinyinAll = ''; //组装全拼组合
  59 + for (int j = 0; j < pinyinList.length; j++) {
  60 + String letter = pinyinList[j];
  61 + pinyinAll += pinyinList[j];
  62 + item.pinyinList.add(pinyinAll);
  63 + if (letter.length > 0) {
  64 + item.pinyinFirst += pinyinList[j].substring(0, 1);
  65 + } else {
  66 + item.pinyinFirst += '';
  67 + }
  68 + }
  69 + }
  70 +
  71 + userHistorys[i] = item;
  72 + }
  73 + userHistorysShow = userHistorys;
  74 + pageState = PageState.Success;
  75 + }
  76 + notifyListeners();
  77 + }
  78 + }
  79 +
  80 + searchData(String key) {
  81 + if (key == '') {
  82 + userHistorysShow = userHistorys;
  83 + pageState = PageState.Success;
  84 + } else {
  85 + userHistorysShow = [];
  86 +
  87 + for (int i = 0; i < userHistorys.length; i++) {
  88 + String name = userHistorys[i].rname;
  89 + String pinyinFirst = userHistorys[i].pinyinFirst;
  90 + // String pinyin = userHistorys[i].pinyin;
  91 + String phone = userHistorys[i].phone;
  92 + List<String> pinyinList = userHistorys[i].pinyinList;
  93 + if ((name != null && name.contains(key)) ||
  94 + (pinyinFirst != null && pinyinFirst.contains(key)) ||
  95 + (phone != null && phone.contains(key)) ||
  96 + (pinyinList != null && pinyinList.contains(key))) {
  97 + userHistorysShow.add(userHistorys[i]);
  98 + }
  99 + }
  100 + // for (int i = 0; i < contacts.length; i++) {
  101 + // String name = contacts[i].rname;
  102 + // String pinyinFirst = contacts[i].pinyinFirst;
  103 + // List<String> pinyinList = contacts[i].pinyinList;
  104 + // // String pinyin = contacts[i].pinyin;
  105 + // String phone = contacts[i].phone;
  106 + // if ((name != null && name.contains(key)) ||
  107 + // (pinyinFirst != null && pinyinFirst.contains(key)) ||
  108 + // (phone != null && phone.contains(key)) ||
  109 + // (pinyinList != null && pinyinList.contains(key))) {
  110 + // contactsShow.add(contacts[i]);
  111 + // }
  112 + // }
  113 + if (userHistorysShow.length == 0) {
  114 + pageState = PageState.Empty;
  115 + } else {
  116 + pageState = PageState.Success;
  117 + }
  118 + // if (contactsShow.length == 0) {
  119 + // pageStateRight = PageState.Empty;
  120 + // } else {
  121 + // pageStateRight = PageState.Success;
  122 + // }
  123 + }
  124 +
  125 + notifyListeners();
  126 + }
  127 +}
@@ -506,10 +506,24 @@ class NavigatorUtil { @@ -506,10 +506,24 @@ class NavigatorUtil {
506 506
507 /// 填写预订联系人页面 507 /// 填写预订联系人页面
508 static Future<dynamic> goEditReserverPage( 508 static Future<dynamic> goEditReserverPage(
509 - BuildContext context, String rid, String name,String sex, 509 + BuildContext context, String rid, String name, String sex,
510 {replace = false, bool needBtn = false}) { 510 {replace = false, bool needBtn = false}) {
511 return _navigateTo(context, 511 return _navigateTo(context,
512 "${Routes.edit_reserver_page}?rid=${rid}&needBtn=$needBtn&name=${Uri.encodeComponent(name)}&sex=$sex", 512 "${Routes.edit_reserver_page}?rid=${rid}&needBtn=$needBtn&name=${Uri.encodeComponent(name)}&sex=$sex",
513 replace: replace); 513 replace: replace);
514 } 514 }
  515 +
  516 + /// 全店客情页面
  517 + static Future<dynamic> goStoreCustomerPage(BuildContext context,
  518 + {replace = false, bool needBtn = false}) {
  519 + return _navigateTo(context, "${Routes.store_customer_page}",
  520 + replace: replace);
  521 + }
  522 +
  523 + /// 客情列表
  524 + static Future<dynamic> goCustomerListPage(BuildContext context,
  525 + {replace = false, bool needBtn = false}) {
  526 + return _navigateTo(context, "${Routes.customer_list_page}",
  527 + replace: replace);
  528 + }
515 } 529 }
@@ -39,6 +39,8 @@ import 'package:one_key/pages/detail/handle_online_page.dart'; @@ -39,6 +39,8 @@ import 'package:one_key/pages/detail/handle_online_page.dart';
39 import 'package:one_key/pages/detail/notebook_detail_page.dart'; 39 import 'package:one_key/pages/detail/notebook_detail_page.dart';
40 import 'package:one_key/pages/login/web_page.dart'; 40 import 'package:one_key/pages/login/web_page.dart';
41 import 'package:one_key/pages/message/message_order_menu.dart'; 41 import 'package:one_key/pages/message/message_order_menu.dart';
  42 +import 'package:one_key/pages/my/customer_type/customer_list_page.dart';
  43 +import 'package:one_key/pages/my/customer_type/store_customer_page.dart';
42 import 'package:one_key/pages/my/personnel_type/personnel_detail_page.dart'; 44 import 'package:one_key/pages/my/personnel_type/personnel_detail_page.dart';
43 import 'package:one_key/pages/my/personnel_type/personnel_manage_page.dart'; 45 import 'package:one_key/pages/my/personnel_type/personnel_manage_page.dart';
44 import 'package:one_key/pages/my/personnel_type/personnel_password_edit_page.dart'; 46 import 'package:one_key/pages/my/personnel_type/personnel_password_edit_page.dart';
@@ -75,6 +77,7 @@ import 'package:one_key/provider/choose_table_model.dart'; @@ -75,6 +77,7 @@ import 'package:one_key/provider/choose_table_model.dart';
75 import 'package:one_key/provider/contant_show_model.dart'; 77 import 'package:one_key/provider/contant_show_model.dart';
76 import 'package:one_key/provider/coupon_provider.dart'; 78 import 'package:one_key/provider/coupon_provider.dart';
77 import 'package:one_key/provider/create_store_model.dart'; 79 import 'package:one_key/provider/create_store_model.dart';
  80 +import 'package:one_key/provider/customer_provider.dart';
78 import 'package:one_key/provider/menu_provider.dart'; 81 import 'package:one_key/provider/menu_provider.dart';
79 import 'package:one_key/provider/my_model.dart'; 82 import 'package:one_key/provider/my_model.dart';
80 import 'package:one_key/provider/notebook_detail_change_model.dart'; 83 import 'package:one_key/provider/notebook_detail_change_model.dart';
@@ -581,15 +584,15 @@ var myIntegralPageHandler = new Handler( @@ -581,15 +584,15 @@ var myIntegralPageHandler = new Handler(
581 }); 584 });
582 585
583 ///我的联系人 586 ///我的联系人
584 -var myContantPageHandler = new Handler(  
585 - handlerFunc: (BuildContext context, Map<String, List<Object>> params) {  
586 - // IntegralSunModel sunModel = IntegralSunModel.fromJson(json  
587 - // .decode(FluroConvertUtils.fluroCnParamsDecode(params["sunModel"].first)));  
588 - // String urlStr = FluroConvertUtils.fluroCnParamsDecode(params["urlStr"].first); 587 +// var myContantPageHandler = new Handler(
  588 +// handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  589 +// // IntegralSunModel sunModel = IntegralSunModel.fromJson(json
  590 +// // .decode(FluroConvertUtils.fluroCnParamsDecode(params["sunModel"].first)));
  591 +// // String urlStr = FluroConvertUtils.fluroCnParamsDecode(params["urlStr"].first);
589 592
590 - return ChangeNotifierProvider<ContantShowModel>(  
591 - create: (_) => ContantShowModel(), child: ContactListPage());  
592 -}); 593 +// return ChangeNotifierProvider<ContantShowModel>(
  594 +// create: (_) => ContantShowModel(), child: ContactListPage());
  595 +// });
593 596
594 ///桌位照片管理 597 ///桌位照片管理
595 var tablePhotoManagerHandler = new Handler( 598 var tablePhotoManagerHandler = new Handler(
@@ -814,3 +817,19 @@ var personnelPasswordEditPageHandle = new Handler( @@ -814,3 +817,19 @@ var personnelPasswordEditPageHandle = new Handler(
814 create: (_) => PersonnelProvider(), 817 create: (_) => PersonnelProvider(),
815 child: PersonnelPasswordEditPage(idstr: idstr)); 818 child: PersonnelPasswordEditPage(idstr: idstr));
816 }); 819 });
  820 +
  821 +///全店客情
  822 +var storeCustomerPageHandle = new Handler(
  823 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  824 + // String idstr = params["idstr"].first;
  825 + return ChangeNotifierProvider<CustomerProvider>(
  826 + create: (_) => CustomerProvider(), child: StoreCustomerPage());
  827 +});
  828 +
  829 +///客情列表
  830 +var customerListPageHandle = new Handler(
  831 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  832 + // String idstr = params["idstr"].first;
  833 + return ChangeNotifierProvider<CustomerProvider>(
  834 + create: (_) => CustomerProvider(), child: CustomerListPage());
  835 +});
@@ -66,8 +66,9 @@ class Routes { @@ -66,8 +66,9 @@ class Routes {
66 "/personnel_password_edit_page"; //密码修改页 66 "/personnel_password_edit_page"; //密码修改页
67 static String change_detail_f = "/change_detail_f"; //变更预订_方硕新修改页面 67 static String change_detail_f = "/change_detail_f"; //变更预订_方硕新修改页面
68 static String photo_manager_page = "/photo_manager_page"; //照片管理 68 static String photo_manager_page = "/photo_manager_page"; //照片管理
69 - static String edit_reserver_page = "/edit_reserver_page"; //填写预订联系人  
70 - 69 + static String edit_reserver_page = "/edit_reserver_page"; //填写预订联系人
  70 + static String store_customer_page = "/store_customer_page"; //全店客情
  71 + static String customer_list_page = "/customer_list_page"; //客情列表
71 72
72 static void configureRoutes(FluroRouter router) { 73 static void configureRoutes(FluroRouter router) {
73 router.notFoundHandler = new Handler( 74 router.notFoundHandler = new Handler(
@@ -118,7 +119,7 @@ class Routes { @@ -118,7 +119,7 @@ class Routes {
118 router.define(complete_create_store, 119 router.define(complete_create_store,
119 handler: completeCreateStorePageHandler); 120 handler: completeCreateStorePageHandler);
120 router.define(my_integral_page, handler: myIntegralPageHandler); 121 router.define(my_integral_page, handler: myIntegralPageHandler);
121 - router.define(my_contant_page, handler: myContantPageHandler); 122 + // router.define(my_contant_page, handler: myContantPageHandler);
122 router.define(table_photo_manager, handler: tablePhotoManagerHandler); 123 router.define(table_photo_manager, handler: tablePhotoManagerHandler);
123 router.define(statistics_page, handler: statisticsPageHandler); 124 router.define(statistics_page, handler: statisticsPageHandler);
124 router.define(statistics_sms_page, handler: statisticsSmsPageHandler); 125 router.define(statistics_sms_page, handler: statisticsSmsPageHandler);
@@ -142,7 +143,9 @@ class Routes { @@ -142,7 +143,9 @@ class Routes {
142 handler: personnelPasswordEditPageHandle); 143 handler: personnelPasswordEditPageHandle);
143 router.define(change_detail_f, handler: noteBookChangeFPageHandle); 144 router.define(change_detail_f, handler: noteBookChangeFPageHandle);
144 router.define(photo_manager_page, handler: photoManagerPageHandle); 145 router.define(photo_manager_page, handler: photoManagerPageHandle);
145 -router.define(edit_reserver_page, handler: editReserverPageHandle); 146 + router.define(edit_reserver_page, handler: editReserverPageHandle);
  147 + router.define(store_customer_page, handler: storeCustomerPageHandle);
  148 + router.define(customer_list_page, handler: customerListPageHandle);
146 149
147 150
148 } 151 }
@@ -71,6 +71,13 @@ packages: @@ -71,6 +71,13 @@ packages:
71 url: "https://pub.flutter-io.cn" 71 url: "https://pub.flutter-io.cn"
72 source: hosted 72 source: hosted
73 version: "0.14.2" 73 version: "0.14.2"
  74 + azlistview:
  75 + dependency: "direct main"
  76 + description:
  77 + name: azlistview
  78 + url: "https://pub.flutter-io.cn"
  79 + source: hosted
  80 + version: "1.1.1"
74 boolean_selector: 81 boolean_selector:
75 dependency: transitive 82 dependency: transitive
76 description: 83 description:
@@ -143,6 +143,8 @@ dependencies: @@ -143,6 +143,8 @@ dependencies:
143 path: library/webview_flutter-2.0.13-copy_inappwebview_select_file_20210930 143 path: library/webview_flutter-2.0.13-copy_inappwebview_select_file_20210930
144 sendsms: 144 sendsms:
145 path: library/sendsms-1.0.3 145 path: library/sendsms-1.0.3
  146 + #联系人索引
  147 + azlistview: ^1.1.1
146 # sendsms: ^1.0.3 148 # sendsms: ^1.0.3
147 149
148 150