Commit c318bcc72c72d325868f1d396031703433ef8557

Authored by wdn127929
1 parent 659be1c4

我的客户列表筛选

  1 +///title 和select
  2 +class FilterBtnModel {
  3 + String id;
  4 + String title;
  5 + bool select = false;
  6 +
  7 + FilterBtnModel();
  8 +
  9 + factory FilterBtnModel.fromJson(Map<String, dynamic> json) => FilterBtnModel()
  10 + ..id = json["id"]
  11 + ..title = json["title"]
  12 + ..select = json["select"];
  13 +
  14 + Map<String, dynamic> toJson() =>
  15 + <String, dynamic>{"id": id, "title": title, "select": select};
  16 +}
@@ -114,15 +114,17 @@ class _MyContactListPageState extends State<MyContactListPage> { @@ -114,15 +114,17 @@ class _MyContactListPageState extends State<MyContactListPage> {
114 children: [ 114 children: [
115 InkWell( 115 InkWell(
116 onTap: () { 116 onTap: () {
117 - List<CustomerListSunModel> data =  
118 - widget.provider.returnNowList();  
119 - data[index].select = !data[index].select;  
120 - if (data[index].select) {  
121 - widget.provider.addData(index);  
122 - } else {  
123 - widget.provider.cancelData(index); 117 + if (widget.fromPage != FromPage.FromPageShowCutomerList) {
  118 + List<CustomerListSunModel> data =
  119 + widget.provider.userHistorys;
  120 + data[index].select = !data[index].select;
  121 + if (data[index].select) {
  122 + widget.provider.addData(index);
  123 + } else {
  124 + widget.provider.cancelData(index);
  125 + }
  126 + widget.provider.getCheckValue();
124 } 127 }
125 - widget.provider.getCheckValue();  
126 }, 128 },
127 child: Stack( 129 child: Stack(
128 alignment: Alignment.bottomCenter, 130 alignment: Alignment.bottomCenter,
@@ -144,13 +146,15 @@ class _MyContactListPageState extends State<MyContactListPage> { @@ -144,13 +146,15 @@ class _MyContactListPageState extends State<MyContactListPage> {
144 fontSize: ScreenUtil().setSp(42)), 146 fontSize: ScreenUtil().setSp(42)),
145 ), 147 ),
146 ), 148 ),
147 - Positioned(  
148 - left: ScreenUtil().setWidth(-18),  
149 - child: Image.asset(  
150 - Utils.getImgPath(  
151 - model.select ? 'select' : 'unselect'),  
152 - width: ScreenUtil().setWidth(36),  
153 - )) 149 + widget.fromPage == FromPage.FromPageShowCutomerList
  150 + ? SizedBox()
  151 + : Positioned(
  152 + left: ScreenUtil().setWidth(-18),
  153 + child: Image.asset(
  154 + Utils.getImgPath(
  155 + model.select ? 'select' : 'unselect'),
  156 + width: ScreenUtil().setWidth(36),
  157 + ))
154 ]), 158 ]),
155 Positioned( 159 Positioned(
156 bottom: ScreenUtil().setWidth(-20), 160 bottom: ScreenUtil().setWidth(-20),
@@ -318,27 +322,6 @@ class _MyContactListPageState extends State<MyContactListPage> { @@ -318,27 +322,6 @@ class _MyContactListPageState extends State<MyContactListPage> {
318 ) 322 )
319 ], 323 ],
320 ), 324 ),
321 - widget.fromPage == FromPage.FromPageStoreCustomer  
322 - ? Container(  
323 - padding: EdgeInsets.only(  
324 - left: ScreenUtil().setWidth(12),  
325 - right: ScreenUtil().setWidth(12),  
326 - top: ScreenUtil().setWidth(10),  
327 - ),  
328 - decoration: BoxDecoration(  
329 - border: Border.all(  
330 - color: MyColours.color_199095,  
331 - width: ScreenUtil().setWidth(2)),  
332 - borderRadius: BorderRadius.circular(  
333 - ScreenUtil().setWidth(10))),  
334 - child: Text(  
335 - 'xx经理',  
336 - style: TextStyle(  
337 - fontSize: ScreenUtil().setSp(24),  
338 - color: MyColours.color_333333),  
339 - ),  
340 - )  
341 - : SizedBox()  
342 ], 325 ],
343 )) 326 ))
344 ], 327 ],
@@ -373,7 +356,10 @@ class _MyContactListPageState extends State<MyContactListPage> { @@ -373,7 +356,10 @@ class _MyContactListPageState extends State<MyContactListPage> {
373 CustomerListSunModel model = widget.contacts[index]; 356 CustomerListSunModel model = widget.contacts[index];
374 return InkWell( 357 return InkWell(
375 onTap: () { 358 onTap: () {
376 - NavigatorUtil.goMyCustomerDetailPage(context, model, widget.fromPage); 359 + if (widget.fromPage != FromPage.FromPageShowCutomerList) {
  360 + NavigatorUtil.goMyCustomerDetailPage(
  361 + context, model, widget.fromPage);
  362 + }
377 }, 363 },
378 child: _buildListItem(model, index), 364 child: _buildListItem(model, index),
379 ); 365 );
@@ -22,7 +22,8 @@ class MyCustomerDetailEditPage extends StatefulWidget { @@ -22,7 +22,8 @@ class MyCustomerDetailEditPage extends StatefulWidget {
22 : super(key: key); 22 : super(key: key);
23 23
24 @override 24 @override
25 - _MyCustomerDetailEditPageState createState() => _MyCustomerDetailEditPageState(); 25 + _MyCustomerDetailEditPageState createState() =>
  26 + _MyCustomerDetailEditPageState();
26 } 27 }
27 28
28 class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> { 29 class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> {
@@ -90,11 +91,8 @@ class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> { @@ -90,11 +91,8 @@ class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> {
90 91
91 ///获取商家标签 92 ///获取商家标签
92 _getLabelBySellerid() async { 93 _getLabelBySellerid() async {
93 - Map<String, String> params = {  
94 - "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,  
95 - };  
96 List<CustomerLabelSunModel> modelLabel = 94 List<CustomerLabelSunModel> modelLabel =
97 - await customerProvider.getLabelBySellerid(context, params); 95 + await customerProvider.getLabelBySellerid(context);
98 96
99 if (modelLabel.length > 0) { 97 if (modelLabel.length > 0) {
100 for (int i = 0; i < customerProvider.labelList.length; i++) { 98 for (int i = 0; i < customerProvider.labelList.length; i++) {
@@ -570,7 +568,7 @@ class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> { @@ -570,7 +568,7 @@ class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> {
570 ], 568 ],
571 ), 569 ),
572 )), 570 )),
573 - 571 +
574 VEmptyView(60), 572 VEmptyView(60),
575 _textMulLine('忌口', '输入忌口的东西', jkController), 573 _textMulLine('忌口', '输入忌口的东西', jkController),
576 VEmptyView(30), 574 VEmptyView(30),
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; @@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
2 2
3 import 'package:flutter_screenutil/screenutil.dart'; 3 import 'package:flutter_screenutil/screenutil.dart';
4 import 'package:one_key/constant/state.dart'; 4 import 'package:one_key/constant/state.dart';
  5 +import 'package:one_key/models/customer_label_model.dart';
  6 +import 'package:one_key/models/filter_btn_model.dart';
5 import 'package:one_key/pages/my/customer_type/my_customer/my_contant_list_page.dart'; 7 import 'package:one_key/pages/my/customer_type/my_customer/my_contant_list_page.dart';
6 8
7 import 'package:one_key/provider/customer_making_provider.dart'; 9 import 'package:one_key/provider/customer_making_provider.dart';
@@ -25,6 +27,8 @@ import 'package:one_key/widgets/v_empty_view.dart'; @@ -25,6 +27,8 @@ import 'package:one_key/widgets/v_empty_view.dart';
25 import 'package:provider/provider.dart'; 27 import 'package:provider/provider.dart';
26 28
27 typedef ClickCallback = void Function(dynamic value); 29 typedef ClickCallback = void Function(dynamic value);
  30 +typedef ClickCall = void Function(FilterBtnModel value);
  31 +typedef ClickCallState = void Function(StateSetter state);
28 32
29 class MyCustomerListPage extends StatefulWidget { 33 class MyCustomerListPage extends StatefulWidget {
30 final FromPage fromPage; 34 final FromPage fromPage;
@@ -45,7 +49,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -45,7 +49,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
45 ScrollController _scrollCrl = ScrollController(); 49 ScrollController _scrollCrl = ScrollController();
46 int dropValue = 0; 50 int dropValue = 0;
47 bool showDrop = true; 51 bool showDrop = true;
48 - List<String> timeTilte = ['大于', '等于', '小于']; 52 + List<String> timeTilte = ['等于', '小于', '大于'];
49 53
50 @override 54 @override
51 void initState() { 55 void initState() {
@@ -55,13 +59,27 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -55,13 +59,27 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
55 tabController = TabController(length: 4, vsync: this); 59 tabController = TabController(length: 4, vsync: this);
56 tabController.addListener(() { 60 tabController.addListener(() {
57 if (tabController.index == tabController.animation.value) { 61 if (tabController.index == tabController.animation.value) {
  62 + if (customerProvider.index == tabController.index) {
  63 + return;
  64 + }
58 print(tabController.index); 65 print(tabController.index);
59 customerProvider.index = tabController.index; 66 customerProvider.index = tabController.index;
60 - customerProvider.searchData(customerProvider.controller.text); 67 + if (customerProvider.index != 0 && customerProvider.index != null) {
  68 + //1 活跃 2 沉睡 3 流失
  69 + for (FilterBtnModel item in customerProvider.filterHydList) {
  70 + item.select = false;
  71 + if (item.id == '${customerProvider.index}') {
  72 + item.select = true;
  73 + }
  74 + }
  75 + }
  76 + _getContantData();
61 } 77 }
62 }); 78 });
63 WidgetsBinding.instance.addPostFrameCallback((_) async { 79 WidgetsBinding.instance.addPostFrameCallback((_) async {
  80 + customerProvider.initData();
64 _getContantData(); 81 _getContantData();
  82 + _filterLabelList();
65 }); 83 });
66 bus.on("refresh_guest_list", (arg) { 84 bus.on("refresh_guest_list", (arg) {
67 _getContantData(); 85 _getContantData();
@@ -74,10 +92,80 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -74,10 +92,80 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
74 super.dispose(); 92 super.dispose();
75 } 93 }
76 94
77 - _getContantData() async { 95 + _filterLabelList() async {
  96 + await customerProvider.getLabelBySellerid(context);
  97 + if (customerProvider.labelList != null &&
  98 + customerProvider.labelList.length > 0) {
  99 + customerProvider.filterLabelList = [];
  100 + for (CustomerLabelSunModel item in customerProvider.labelList) {
  101 + FilterBtnModel model = FilterBtnModel();
  102 + model.title = item.label;
  103 + model.id = item.id;
  104 + model.select = false;
  105 + customerProvider.filterLabelList.add(model);
  106 + }
  107 + }
  108 + }
  109 +
  110 + _getContantData({bool showLoading = true}) async {
  111 + if (showLoading) {
  112 + customerProvider.pageState = PageState.Loading;
  113 + }
  114 + customerProvider.notifyListeners();
78 Map<String, String> params = { 115 Map<String, String> params = {
79 "uid": Provider.of<UserModel>(context, listen: false).user.openid, 116 "uid": Provider.of<UserModel>(context, listen: false).user.openid,
80 }; 117 };
  118 + if (customerProvider.index != 0 && customerProvider.index != null) {
  119 + //1 活跃 2 沉睡 3 流失
  120 + for (FilterBtnModel item in customerProvider.filterHydList) {
  121 + if (item.id == '${customerProvider.index}') {
  122 + item.select = true;
  123 + }
  124 + }
  125 + }
  126 + String active = '';
  127 + for (FilterBtnModel item in customerProvider.filterHydList) {
  128 + if (item.select) {
  129 + active += '${item.id},';
  130 + }
  131 + }
  132 + if (active.length > 0) {
  133 + if (active.endsWith(',')) {
  134 + active = active.substring(0, active.length - 1);
  135 + }
  136 + params['active'] = active;
  137 + }
  138 +
  139 + if (customerProvider.controller.text.trim().length > 0) {
  140 + params['keyword'] = customerProvider.controller.text; //搜索手机号/姓名
  141 + }
  142 + String labels = '';
  143 + for (FilterBtnModel item in customerProvider.filterLabelList) {
  144 + if (item.select) {
  145 + labels += '${item.id},';
  146 + }
  147 + }
  148 + if (labels.length > 0) {
  149 + if (labels.endsWith(',')) {
  150 + labels = labels.substring(0, labels.length - 1);
  151 + }
  152 + params['labelid'] = labels;
  153 + }
  154 + if (customerProvider.controllerstime.text.trim().length > 0) {
  155 + params['stime'] = customerProvider.controllerstime.text;
  156 + }
  157 + if (customerProvider.controlleretime.text.trim().length > 0) {
  158 + params['etime'] = customerProvider.controlleretime.text;
  159 + }
  160 + if (customerProvider.controllernum.text.trim().length > 0) {
  161 + params['reserve_num'] = customerProvider.controlleretime.text;
  162 + params['reserve_sort'] = '${dropValue + 1}';
  163 + }
  164 +
  165 + // params['reserve_date'] XX天内,例:30
  166 + // params['reserve_num'] 时间内预定次数
  167 + // params['reserve_sort'] 1 等于 2 小于 3 大于
  168 +
81 await customerProvider.getCustomerList(context, params); 169 await customerProvider.getCustomerList(context, params);
82 // await customerProvider.searchData(customerProvider.controller.text); 170 // await customerProvider.searchData(customerProvider.controller.text);
83 } 171 }
@@ -244,7 +332,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -244,7 +332,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
244 onChanged: (value) { 332 onChanged: (value) {
245 // setState(() {}); 333 // setState(() {});
246 // _searchSellerLocation(); 334 // _searchSellerLocation();
247 - customerProvider.searchData(value); 335 + // customerProvider.searchData(value);
248 }, 336 },
249 onEditingComplete: () { 337 onEditingComplete: () {
250 FocusScope.of(context) 338 FocusScope.of(context)
@@ -275,7 +363,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -275,7 +363,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
275 onTap: () { 363 onTap: () {
276 WidgetsBinding.instance.addPostFrameCallback(((_) { 364 WidgetsBinding.instance.addPostFrameCallback(((_) {
277 customerProvider.controller.clear(); 365 customerProvider.controller.clear();
278 - customerProvider.searchData(''); 366 + // customerProvider.searchData('');
279 })); 367 }));
280 }, 368 },
281 )), 369 )),
@@ -354,16 +442,33 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -354,16 +442,33 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
354 showFilter = !showFilter; 442 showFilter = !showFilter;
355 }); 443 });
356 if (showFilter) { 444 if (showFilter) {
357 - _showFilterDialogFromTop(context, onPressedReset: () {  
358 - Navigator.of(context).pop();  
359 - setState(() {  
360 - showFilter = false; 445 + _showFilterDialogFromTop(context, onPressedReset: (state) {
  446 + // Navigator.of(context).pop();
  447 + // setState(() {
  448 + // showFilter = false;
  449 + // });
  450 + state(() {
  451 + customerProvider.hydSelAll = false;
  452 + for (FilterBtnModel item
  453 + in customerProvider.filterHydList) {
  454 + item.select = false;
  455 + }
  456 + customerProvider.labelSelAll = false;
  457 + for (FilterBtnModel item
  458 + in customerProvider.filterLabelList) {
  459 + item.select = false;
  460 + }
  461 + customerProvider.controllerstime.text = '';
  462 + customerProvider.controlleretime.text = '';
  463 + customerProvider.controllernum.text = '';
  464 + dropValue = 0;
361 }); 465 });
362 }, onPressedComplete: () { 466 }, onPressedComplete: () {
363 Navigator.of(context).pop(); 467 Navigator.of(context).pop();
364 setState(() { 468 setState(() {
365 showFilter = false; 469 showFilter = false;
366 }); 470 });
  471 + _getContantData();
367 }, tapWhiteBack: () { 472 }, tapWhiteBack: () {
368 // Navigator.of(context).pop(); 473 // Navigator.of(context).pop();
369 // setState(() { 474 // setState(() {
@@ -401,7 +506,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -401,7 +506,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
401 506
402 ///筛选弹框 507 ///筛选弹框
403 _showFilterDialogFromTop(BuildContext context, 508 _showFilterDialogFromTop(BuildContext context,
404 - {VoidCallback onPressedReset, 509 + {ClickCallState onPressedReset,
405 VoidCallback onPressedComplete, 510 VoidCallback onPressedComplete,
406 GestureTapCallback tapWhiteBack}) { 511 GestureTapCallback tapWhiteBack}) {
407 showGeneralDialog( 512 showGeneralDialog(
@@ -439,44 +544,44 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -439,44 +544,44 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
439 fontSize: ScreenUtil().setSp(size))); 544 fontSize: ScreenUtil().setSp(size)));
440 } 545 }
441 546
442 - ///客户经理  
443 - Widget _managerWidget() {  
444 - return Column(  
445 - crossAxisAlignment: CrossAxisAlignment.start,  
446 - children: [  
447 - Row(  
448 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
449 - children: [  
450 - _textWidget('客户经理', MyColours.color_333333, FontWeight.bold, 28),  
451 - GestureDetector(  
452 - onTap: () {},  
453 - child: _textWidget(  
454 - '全选', MyColours.color_199095, FontWeight.normal, 24),  
455 - )  
456 - ],  
457 - ),  
458 - VEmptyView(30),  
459 - Wrap(  
460 - spacing: ScreenUtil().setWidth(20),  
461 - runSpacing: ScreenUtil().setWidth(20),  
462 - children: _buildFilterItem([  
463 - {'title': 'kkkk', 'select': false},  
464 - {'title': 'kkkk', 'select': true},  
465 - {'title': 'kkkk', 'select': true},  
466 - {'title': 'kkkk', 'select': true},  
467 - {'title': 'k', 'select': true},  
468 - {'title': 'kkkk', 'select': true},  
469 - {'title': 'kkkk', 'select': true},  
470 - {'title': 'k', 'select': true},  
471 - {'title': 'kdsfjsfsdfhjsdfh', 'select': true},  
472 - {'title': 'kkkk', 'select': true},  
473 - ], false)),  
474 - ],  
475 - );  
476 - } 547 + // ///客户经理
  548 + // Widget _managerWidget() {
  549 + // return Column(
  550 + // crossAxisAlignment: CrossAxisAlignment.start,
  551 + // children: [
  552 + // Row(
  553 + // mainAxisAlignment: MainAxisAlignment.spaceBetween,
  554 + // children: [
  555 + // _textWidget('客户经理', MyColours.color_333333, FontWeight.bold, 28),
  556 + // GestureDetector(
  557 + // onTap: () {},
  558 + // child: _textWidget(
  559 + // '全选', MyColours.color_199095, FontWeight.normal, 24),
  560 + // )
  561 + // ],
  562 + // ),
  563 + // VEmptyView(30),
  564 + // Wrap(
  565 + // spacing: ScreenUtil().setWidth(20),
  566 + // runSpacing: ScreenUtil().setWidth(20),
  567 + // children: _buildFilterItem([
  568 + // {'title': 'kkkk', 'select': false},
  569 + // {'title': 'kkkk', 'select': true},
  570 + // {'title': 'kkkk', 'select': true},
  571 + // {'title': 'kkkk', 'select': true},
  572 + // {'title': 'k', 'select': true},
  573 + // {'title': 'kkkk', 'select': true},
  574 + // {'title': 'kkkk', 'select': true},
  575 + // {'title': 'k', 'select': true},
  576 + // {'title': 'kdsfjsfsdfhjsdfh', 'select': true},
  577 + // {'title': 'kkkk', 'select': true},
  578 + // ], false)),
  579 + // ],
  580 + // );
  581 + // }
477 582
478 ///活跃度 583 ///活跃度
479 - Widget _activityWidget() { 584 + Widget _activityWidget(StateSetter state) {
480 return Column( 585 return Column(
481 crossAxisAlignment: CrossAxisAlignment.start, 586 crossAxisAlignment: CrossAxisAlignment.start,
482 children: [ 587 children: [
@@ -485,9 +590,29 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -485,9 +590,29 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
485 children: [ 590 children: [
486 _textWidget('活跃度', MyColours.color_333333, FontWeight.bold, 28), 591 _textWidget('活跃度', MyColours.color_333333, FontWeight.bold, 28),
487 GestureDetector( 592 GestureDetector(
488 - onTap: () {},  
489 - child: _textWidget(  
490 - '全选', MyColours.color_199095, FontWeight.normal, 24), 593 + onTap: () {
  594 + state(() {
  595 + customerProvider.hydSelAll = !customerProvider.hydSelAll;
  596 + if (customerProvider.hydSelAll) {
  597 + for (FilterBtnModel item
  598 + in customerProvider.filterHydList) {
  599 + item.select = true;
  600 + }
  601 + } else {
  602 + for (FilterBtnModel item
  603 + in customerProvider.filterHydList) {
  604 + item.select = false;
  605 + }
  606 + }
  607 + });
  608 + },
  609 + child: Container(
  610 + color: Colors.white,
  611 + height: ScreenUtil().setWidth(40),
  612 + alignment: Alignment.center,
  613 + padding: EdgeInsets.only(left: ScreenUtil().setWidth(130)),
  614 + child: _textWidget(customerProvider.hydSelAll ? '全不选' : '全选',
  615 + MyColours.color_199095, FontWeight.normal, 24)),
491 ) 616 )
492 ], 617 ],
493 ), 618 ),
@@ -495,24 +620,18 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -495,24 +620,18 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
495 Wrap( 620 Wrap(
496 spacing: ScreenUtil().setWidth(20), 621 spacing: ScreenUtil().setWidth(20),
497 runSpacing: ScreenUtil().setWidth(20), 622 runSpacing: ScreenUtil().setWidth(20),
498 - children: _buildFilterItem([  
499 - {'title': 'kkkk', 'select': false},  
500 - {'title': 'kkkk', 'select': true},  
501 - {'title': 'kkkk', 'select': true},  
502 - {'title': 'kkkk', 'select': true},  
503 - {'title': 'k', 'select': true},  
504 - {'title': 'kkkk', 'select': true},  
505 - {'title': 'kkkk', 'select': true},  
506 - {'title': 'k', 'select': true},  
507 - {'title': 'kdsfjsfsdfhjsdfh', 'select': true},  
508 - {'title': 'kkkk', 'select': true},  
509 - ], false)), 623 + children: _buildFilterItem(customerProvider.filterHydList, false,
  624 + (FilterBtnModel item) {
  625 + state(() {
  626 + item.select = !item.select;
  627 + });
  628 + })),
510 ], 629 ],
511 ); 630 );
512 } 631 }
513 632
514 ///自定义标签 633 ///自定义标签
515 - Widget _labelWidget() { 634 + Widget _labelWidget(StateSetter state) {
516 return Column( 635 return Column(
517 crossAxisAlignment: CrossAxisAlignment.start, 636 crossAxisAlignment: CrossAxisAlignment.start,
518 children: [ 637 children: [
@@ -521,28 +640,45 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -521,28 +640,45 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
521 children: [ 640 children: [
522 _textWidget('自定义标签', MyColours.color_333333, FontWeight.bold, 28), 641 _textWidget('自定义标签', MyColours.color_333333, FontWeight.bold, 28),
523 GestureDetector( 642 GestureDetector(
524 - onTap: () {},  
525 - child: _textWidget(  
526 - '全选', MyColours.color_199095, FontWeight.normal, 24),  
527 - ) 643 + onTap: () {
  644 + state(() {
  645 + customerProvider.labelSelAll =
  646 + !customerProvider.labelSelAll;
  647 + if (customerProvider.labelSelAll) {
  648 + for (FilterBtnModel item
  649 + in customerProvider.filterLabelList) {
  650 + item.select = true;
  651 + }
  652 + } else {
  653 + for (FilterBtnModel item
  654 + in customerProvider.filterLabelList) {
  655 + item.select = false;
  656 + }
  657 + }
  658 + });
  659 + },
  660 + child: Container(
  661 + color: Colors.white,
  662 + height: ScreenUtil().setWidth(40),
  663 + alignment: Alignment.center,
  664 + padding: EdgeInsets.only(left: ScreenUtil().setWidth(130)),
  665 + child: _textWidget(
  666 + customerProvider.labelSelAll ? '全不选' : '全选',
  667 + MyColours.color_199095,
  668 + FontWeight.normal,
  669 + 24))),
528 ], 670 ],
529 ), 671 ),
530 VEmptyView(30), 672 VEmptyView(30),
531 Wrap( 673 Wrap(
532 spacing: ScreenUtil().setWidth(20), 674 spacing: ScreenUtil().setWidth(20),
533 runSpacing: ScreenUtil().setWidth(20), 675 runSpacing: ScreenUtil().setWidth(20),
534 - children: _buildFilterItem([  
535 - {'title': 'kkkk', 'select': false},  
536 - {'title': 'kkkk', 'select': true},  
537 - {'title': 'kkkk', 'select': true},  
538 - {'title': 'kkkk', 'select': true},  
539 - {'title': 'k', 'select': true},  
540 - {'title': 'kkkk', 'select': true},  
541 - {'title': 'kkkk', 'select': true},  
542 - {'title': 'k', 'select': true},  
543 - {'title': 'kdsfjsfsdfhjsdfh', 'select': false},  
544 - {'title': 'kkkk', 'select': true},  
545 - ], true)), 676 + children: _buildFilterItem(customerProvider.filterLabelList, true,
  677 + (FilterBtnModel item) {
  678 + state(() {
  679 + item.select = !item.select;
  680 + });
  681 + })),
546 ], 682 ],
547 ); 683 );
548 } 684 }
@@ -601,7 +737,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -601,7 +737,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
601 } 737 }
602 738
603 ///高级筛选 739 ///高级筛选
604 - Widget _advancedFilterWidget(state) { 740 + Widget _advancedFilterWidget(StateSetter state) {
605 return Column( 741 return Column(
606 crossAxisAlignment: CrossAxisAlignment.start, 742 crossAxisAlignment: CrossAxisAlignment.start,
607 children: [ 743 children: [
@@ -610,32 +746,54 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -610,32 +746,54 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
610 children: [ 746 children: [
611 _textWidget('高级筛选', MyColours.color_333333, FontWeight.bold, 28), 747 _textWidget('高级筛选', MyColours.color_333333, FontWeight.bold, 28),
612 GestureDetector( 748 GestureDetector(
613 - onTap: () {},  
614 - child: _textWidget(  
615 - '清空', MyColours.color_199095, FontWeight.normal, 24),  
616 - ) 749 + onTap: () {
  750 + customerProvider.controllerstime.text = '';
  751 + customerProvider.controlleretime.text = '';
  752 + customerProvider.controllernum.text = '';
  753 + state(() {
  754 + dropValue = 0;
  755 + });
  756 + },
  757 + child: Container(
  758 + color: Colors.white,
  759 + height: ScreenUtil().setWidth(40),
  760 + alignment: Alignment.center,
  761 + padding: EdgeInsets.only(left: ScreenUtil().setWidth(130)),
  762 + child: _textWidget(
  763 + '清空', MyColours.color_199095, FontWeight.normal, 24),
  764 + ))
617 ], 765 ],
618 ), 766 ),
619 VEmptyView(30), 767 VEmptyView(30),
620 Row( 768 Row(
621 children: [ 769 children: [
622 - Expanded(child: _textFeildWidget()), 770 + Expanded(
  771 + child: _textFeildWidget(customerProvider.controllerstime,
  772 + customerProvider.stimeFocus)),
623 HEmptyView(10), 773 HEmptyView(10),
624 _textWidget('至', MyColours.color_199095, FontWeight.normal, 24), 774 _textWidget('至', MyColours.color_199095, FontWeight.normal, 24),
625 HEmptyView(10), 775 HEmptyView(10),
626 - Expanded(child: _textFeildWidget()), 776 + Expanded(
  777 + child: _textFeildWidget(customerProvider.controlleretime,
  778 + customerProvider.etimeFocus)),
627 ], 779 ],
628 ), 780 ),
629 VEmptyView(30), 781 VEmptyView(30),
630 Wrap( 782 Wrap(
631 spacing: ScreenUtil().setWidth(20), 783 spacing: ScreenUtil().setWidth(20),
632 runSpacing: ScreenUtil().setWidth(20), 784 runSpacing: ScreenUtil().setWidth(20),
633 - children: _buildFilterItem([  
634 - {'title': '7天', 'select': true},  
635 - {'title': '30天', 'select': true},  
636 - {'title': '60天', 'select': true},  
637 - {'title': '120天', 'select': true},  
638 - ], true, grayBack: true)), 785 + children: _buildFilterItem(customerProvider.filterDayList, true,
  786 + (FilterBtnModel item) {
  787 + if (customerProvider.stimeFocus.hasFocus) {
  788 + customerProvider.controllerstime.text = item.id;
  789 + }
  790 + if (customerProvider.etimeFocus.hasFocus) {
  791 + customerProvider.controlleretime.text = item.id;
  792 + }
  793 + // state(() {
  794 + // item.select = !item.select;
  795 + // });
  796 + }, grayBack: true)),
639 VEmptyView(30), 797 VEmptyView(30),
640 _textWidget('时间内预订次数', MyColours.color_333333, FontWeight.normal, 24), 798 _textWidget('时间内预订次数', MyColours.color_333333, FontWeight.normal, 24),
641 VEmptyView(30), 799 VEmptyView(30),
@@ -706,6 +864,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -706,6 +864,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
706 ), 864 ),
707 onChanged: (value) { 865 onChanged: (value) {
708 print(value); 866 print(value);
  867 + FocusScope.of(context)
  868 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
709 state(() => dropValue = value); 869 state(() => dropValue = value);
710 }))), 870 }))),
711 HEmptyView(20), 871 HEmptyView(20),
@@ -726,7 +886,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -726,7 +886,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
726 color: MyColours.color_ffffff, 886 color: MyColours.color_ffffff,
727 child: TextField( 887 child: TextField(
728 maxLines: 1, 888 maxLines: 1,
729 - controller: customerProvider.controller, 889 + controller: customerProvider.controllernum,
730 // focusNode: _focusNode, 890 // focusNode: _focusNode,
731 // autofocus: true, 891 // autofocus: true,
732 892
@@ -745,13 +905,13 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -745,13 +905,13 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
745 border: OutlineInputBorder(borderSide: BorderSide.none), 905 border: OutlineInputBorder(borderSide: BorderSide.none),
746 contentPadding: EdgeInsets.zero, 906 contentPadding: EdgeInsets.zero,
747 ), 907 ),
748 - keyboardType: TextInputType.text, 908 + keyboardType: TextInputType.number,
749 textInputAction: TextInputAction.done, 909 textInputAction: TextInputAction.done,
750 910
751 onChanged: (value) { 911 onChanged: (value) {
752 // setState(() {}); 912 // setState(() {});
753 // _searchSellerLocation(); 913 // _searchSellerLocation();
754 - customerProvider.searchData(value); 914 + // customerProvider.searchData(value);
755 }, 915 },
756 onEditingComplete: () { 916 onEditingComplete: () {
757 FocusScope.of(context) 917 FocusScope.of(context)
@@ -766,7 +926,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -766,7 +926,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
766 HEmptyView(20), 926 HEmptyView(20),
767 _textWidget('次预订', MyColours.color_333333, FontWeight.normal, 24), 927 _textWidget('次预订', MyColours.color_333333, FontWeight.normal, 24),
768 ]), 928 ]),
769 - VEmptyView(30), 929 + VEmptyView(50),
770 ], 930 ],
771 ); 931 );
772 } 932 }
@@ -807,7 +967,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -807,7 +967,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
807 } 967 }
808 968
809 /// 高级筛选输入框 969 /// 高级筛选输入框
810 - Widget _textFeildWidget() { 970 + Widget _textFeildWidget(
  971 + TextEditingController controller, FocusNode focusNode) {
811 return Container( 972 return Container(
812 padding: EdgeInsets.symmetric( 973 padding: EdgeInsets.symmetric(
813 horizontal: ScreenUtil().setWidth(20), 974 horizontal: ScreenUtil().setWidth(20),
@@ -823,8 +984,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -823,8 +984,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
823 Expanded( 984 Expanded(
824 child: TextField( 985 child: TextField(
825 maxLines: 1, 986 maxLines: 1,
826 - controller: customerProvider.controller,  
827 - // focusNode: _focusNode, 987 + controller: controller,
  988 + focusNode: focusNode,
828 // autofocus: true, 989 // autofocus: true,
829 990
830 style: TextStyle( 991 style: TextStyle(
@@ -832,7 +993,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -832,7 +993,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
832 fontSize: ScreenUtil().setSp(26)), 993 fontSize: ScreenUtil().setSp(26)),
833 // textAlignVertical: TextAlignVertical.center, 994 // textAlignVertical: TextAlignVertical.center,
834 decoration: InputDecoration( 995 decoration: InputDecoration(
835 - hintText: "xxx", 996 + hintText: "",
836 hintStyle: TextStyle( 997 hintStyle: TextStyle(
837 color: MyColours.color_999999, 998 color: MyColours.color_999999,
838 fontSize: ScreenUtil().setSp(26), 999 fontSize: ScreenUtil().setSp(26),
@@ -842,13 +1003,13 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -842,13 +1003,13 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
842 border: OutlineInputBorder(borderSide: BorderSide.none), 1003 border: OutlineInputBorder(borderSide: BorderSide.none),
843 contentPadding: EdgeInsets.zero, 1004 contentPadding: EdgeInsets.zero,
844 ), 1005 ),
845 - keyboardType: TextInputType.text, 1006 + keyboardType: TextInputType.number,
846 textInputAction: TextInputAction.done, 1007 textInputAction: TextInputAction.done,
847 1008
848 onChanged: (value) { 1009 onChanged: (value) {
849 // setState(() {}); 1010 // setState(() {});
850 // _searchSellerLocation(); 1011 // _searchSellerLocation();
851 - customerProvider.searchData(value); 1012 + // customerProvider.searchData(value);
852 }, 1013 },
853 onEditingComplete: () { 1014 onEditingComplete: () {
854 FocusScope.of(context) 1015 FocusScope.of(context)
@@ -867,7 +1028,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -867,7 +1028,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
867 ///筛选布局 1028 ///筛选布局
868 Widget _filterWidget( 1029 Widget _filterWidget(
869 StateSetter state, 1030 StateSetter state,
870 - VoidCallback onPressedReset, 1031 + ClickCallState onPressedReset,
871 VoidCallback onPressedComplete, 1032 VoidCallback onPressedComplete,
872 ) { 1033 ) {
873 return Container( 1034 return Container(
@@ -896,33 +1057,34 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -896,33 +1057,34 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
896 child: Column( 1057 child: Column(
897 children: [ 1058 children: [
898 Expanded( 1059 Expanded(
899 - child: Scrollbar(  
900 - isAlwaysShown: true, //设置滚动条常亮  
901 - controller: _scrollCrl, //必须设置一个controller 1060 + // child: Scrollbar(
  1061 + // isAlwaysShown: true, //设置滚动条常亮
  1062 + // controller: _scrollCrl, //必须设置一个controller
902 1063
903 - ///添加进度条  
904 - child: SingleChildScrollView(  
905 - controller: _scrollCrl,  
906 - // primary: true,  
907 - // reverse: true,  
908 - // physics: BouncingScrollPhysics(),  
909 - // padding: EdgeInsets.only(  
910 - // bottom:  
911 - // MediaQuery.of(context).viewInsets.bottom),  
912 - child: Column(  
913 - crossAxisAlignment: CrossAxisAlignment.start,  
914 - children: [  
915 - VEmptyView(20),  
916 - _managerWidget(),  
917 - VEmptyView(30),  
918 - _activityWidget(),  
919 - VEmptyView(30),  
920 - _labelWidget(),  
921 - VEmptyView(30),  
922 - _advancedFilterWidget(state)  
923 - ],  
924 - ),  
925 - ))), 1064 + // ///添加进度条
  1065 + child: SingleChildScrollView(
  1066 + controller: _scrollCrl,
  1067 + // primary: true,
  1068 + // reverse: true,
  1069 + // physics: BouncingScrollPhysics(),
  1070 + // padding: EdgeInsets.only(
  1071 + // bottom:
  1072 + // MediaQuery.of(context).viewInsets.bottom),
  1073 + child: Column(
  1074 + crossAxisAlignment: CrossAxisAlignment.start,
  1075 + children: [
  1076 + VEmptyView(20),
  1077 + // _managerWidget(),
  1078 + // VEmptyView(30),
  1079 + _activityWidget(state),
  1080 + VEmptyView(30),
  1081 + _labelWidget(state),
  1082 + VEmptyView(30),
  1083 + _advancedFilterWidget(state)
  1084 + ],
  1085 + ),
  1086 + )),
  1087 + // ),
926 Row( 1088 Row(
927 children: [ 1089 children: [
928 Container( 1090 Container(
@@ -949,7 +1111,9 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -949,7 +1111,9 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
949 flex: 1, 1111 flex: 1,
950 child: Material( 1112 child: Material(
951 child: InkWell( 1113 child: InkWell(
952 - onTap: onPressedReset, 1114 + onTap: () {
  1115 + onPressedReset(state);
  1116 + },
953 child: Container( 1117 child: Container(
954 decoration: BoxDecoration( 1118 decoration: BoxDecoration(
955 color: MyColours.color_ffffff, 1119 color: MyColours.color_ffffff,
@@ -1005,47 +1169,81 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -1005,47 +1169,81 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
1005 } 1169 }
1006 1170
1007 //构建筛选按钮 1171 //构建筛选按钮
1008 - List<Widget> _buildFilterItem(List<Map> data, bool round, 1172 + List<Widget> _buildFilterItem(
  1173 + List<FilterBtnModel> data, bool round, ClickCall onTap,
1009 {bool grayBack = false}) { 1174 {bool grayBack = false}) {
1010 List<Widget> items = []; 1175 List<Widget> items = [];
1011 -  
1012 - for (Map item in data) {  
1013 - items.add(Container(  
1014 - padding: EdgeInsets.symmetric(  
1015 - horizontal: ScreenUtil().setWidth(20),  
1016 - vertical: ScreenUtil().setWidth(6)),  
1017 - decoration: BoxDecoration(  
1018 - color: grayBack  
1019 - ? Color.fromRGBO(239, 239, 239, 1)  
1020 - : item['select']  
1021 - ? MyColours.color_199095  
1022 - : MyColours.color_ffffff,  
1023 - border: Border.all(  
1024 - color: grayBack  
1025 - ? Color.fromRGBO(239, 239, 239, 1)  
1026 - : item['select']  
1027 - ? MyColours.color_199095  
1028 - : round  
1029 - ? Color.fromRGBO(155, 155, 155, 1)  
1030 - : MyColours.color_199095,  
1031 - width: ScreenUtil().setWidth(2)),  
1032 - borderRadius: BorderRadius.circular(  
1033 - ScreenUtil().setWidth(round ? 30 : 10))),  
1034 - child: _textWidget(  
1035 - item['title'],  
1036 - grayBack  
1037 - ? MyColours.color_333333  
1038 - : item['select']  
1039 - ? MyColours.color_ffffff  
1040 - : round  
1041 - ? MyColours.color_333333  
1042 - : MyColours.color_199095,  
1043 - FontWeight.normal,  
1044 - 24))); 1176 + if (data != null && data.length > 0) {
  1177 + for (FilterBtnModel item in data) {
  1178 + items.add(InkWell(
  1179 + onTap: () {
  1180 + onTap(item);
  1181 + },
  1182 + child: Container(
  1183 + padding: EdgeInsets.symmetric(
  1184 + horizontal: ScreenUtil().setWidth(20),
  1185 + vertical: ScreenUtil().setWidth(6)),
  1186 + decoration: BoxDecoration(
  1187 + color: grayBack
  1188 + ? Color.fromRGBO(239, 239, 239, 1)
  1189 + : item.select
  1190 + ? MyColours.color_199095
  1191 + : MyColours.color_ffffff,
  1192 + border: Border.all(
  1193 + color: grayBack
  1194 + ? Color.fromRGBO(239, 239, 239, 1)
  1195 + : item.select
  1196 + ? MyColours.color_199095
  1197 + : round
  1198 + ? Color.fromRGBO(155, 155, 155, 1)
  1199 + : MyColours.color_199095,
  1200 + width: ScreenUtil().setWidth(2)),
  1201 + borderRadius: BorderRadius.circular(
  1202 + ScreenUtil().setWidth(round ? 30 : 10))),
  1203 + child: _textWidget(
  1204 + item.title,
  1205 + grayBack
  1206 + ? MyColours.color_333333
  1207 + : item.select
  1208 + ? MyColours.color_ffffff
  1209 + : round
  1210 + ? MyColours.color_333333
  1211 + : MyColours.color_199095,
  1212 + FontWeight.normal,
  1213 + 24))));
  1214 + }
1045 } 1215 }
  1216 +
1046 return items; 1217 return items;
1047 } 1218 }
1048 1219
  1220 + List<Widget> _returnListWidget() {
  1221 + List<Widget> list = [];
  1222 + for (int i = 0; i < 4; i++) {
  1223 + list.add(Consumer<CustomerProvider>(builder: (context, model, _) {
  1224 + if (model.pageState != PageState.Success) {
  1225 + return ExceptionPage(
  1226 + pageState: model.pageState,
  1227 + callback: () {
  1228 + model.pageState = PageState.Loading;
  1229 + model.notifyListeners();
  1230 + _getContantData();
  1231 + },
  1232 + emptyMsg: "暂时没有客户哦",
  1233 + emptyImg: "empty_search",
  1234 + showMsg: "加载中,请稍后...",
  1235 + );
  1236 + } else {
  1237 + return MyContactListPage(
  1238 + contacts: model.userHistorys,
  1239 + provider: customerProvider,
  1240 + fromPage: widget.fromPage);
  1241 + }
  1242 + }));
  1243 + }
  1244 + return list;
  1245 + }
  1246 +
1049 @override 1247 @override
1050 Widget build(BuildContext context) { 1248 Widget build(BuildContext context) {
1051 customerProvider = Provider.of<CustomerProvider>(context, listen: true); 1249 customerProvider = Provider.of<CustomerProvider>(context, listen: true);
@@ -1069,110 +1267,14 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -1069,110 +1267,14 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
1069 body: SafeArea( 1267 body: SafeArea(
1070 child: Column(children: [ 1268 child: Column(children: [
1071 _searchWidget(), _menuWidget(), 1269 _searchWidget(), _menuWidget(),
1072 - Expanded(child:  
1073 - Consumer<CustomerProvider>(builder: (context, model, _) {  
1074 - if (model.pageState != PageState.Success) {  
1075 - return ExceptionPage(  
1076 - pageState: model.pageState,  
1077 - callback: () {  
1078 - model.pageState = PageState.Loading;  
1079 - model.notifyListeners();  
1080 - _getContantData();  
1081 - },  
1082 - emptyMsg: "暂时没有客户哦",  
1083 - emptyImg: "empty_search",  
1084 - showMsg: "加载中,请稍后...",  
1085 - );  
1086 - } else {  
1087 - return Column(children: [  
1088 - Expanded(  
1089 - child: TabBarView(  
1090 - controller: tabController,  
1091 - physics: NeverScrollableScrollPhysics(),  
1092 - children: <Widget>[  
1093 - MyContactListPage(  
1094 - contacts: model.userHistorysShow,  
1095 - provider: customerProvider,  
1096 - fromPage: widget.fromPage),  
1097 - Consumer<CustomerProvider>(  
1098 - builder: (context, model, _) {  
1099 - if (model.pageStateHuoyue != PageState.Success) {  
1100 - return ExceptionPage(  
1101 - pageState: model.pageStateHuoyue,  
1102 - callback: () {  
1103 - model.pageStateHuoyue = PageState.Loading;  
1104 - model.notifyListeners();  
1105 - _getContantData();  
1106 - },  
1107 - emptyMsg: "暂时没有客户哦",  
1108 - emptyImg: "empty_search",  
1109 - showMsg: "加载中,请稍后...",  
1110 - );  
1111 - } else {  
1112 - return MyContactListPage(  
1113 - contacts: model.userHistorysShowHuoyue,  
1114 - provider: customerProvider,  
1115 - fromPage: widget.fromPage);  
1116 - }  
1117 - }),  
1118 - Consumer<CustomerProvider>(  
1119 - builder: (context, model, _) {  
1120 - if (model.pageStateChenshui !=  
1121 - PageState.Success) {  
1122 - return ExceptionPage(  
1123 - pageState: model.pageStateChenshui,  
1124 - callback: () {  
1125 - model.pageStateChenshui = PageState.Loading;  
1126 - model.notifyListeners();  
1127 - _getContantData();  
1128 - },  
1129 - emptyMsg: "暂时没有客户哦",  
1130 - emptyImg: "empty_search",  
1131 - showMsg: "加载中,请稍后...",  
1132 - );  
1133 - } else {  
1134 - return MyContactListPage(  
1135 - contacts: model.userHistorysShowChenshui,  
1136 - provider: customerProvider,  
1137 - fromPage: widget.fromPage);  
1138 - }  
1139 - }),  
1140 - Consumer<CustomerProvider>(  
1141 - builder: (context, model, _) {  
1142 - if (model.pageStateLiushi != PageState.Success) {  
1143 - return ExceptionPage(  
1144 - pageState: model.pageStateLiushi,  
1145 - callback: () {  
1146 - model.pageStateLiushi = PageState.Loading;  
1147 - model.notifyListeners();  
1148 - _getContantData();  
1149 - },  
1150 - emptyMsg: "暂时没有客户哦",  
1151 - emptyImg: "empty_search",  
1152 - showMsg: "加载中,请稍后...",  
1153 - );  
1154 - } else {  
1155 - return MyContactListPage(  
1156 - contacts: model.userHistorysShowLiushi,  
1157 - provider: customerProvider,  
1158 - fromPage: widget.fromPage);  
1159 - }  
1160 - }),  
1161 - // ContactListPage(  
1162 - // contacts: model.userHistorysShowChenshui,  
1163 - // provider: customerProvider,  
1164 - // fromPage: widget.fromPage),  
1165 - // ContactListPage(  
1166 - // contacts: model.userHistorysShowLiushi,  
1167 - // provider: customerProvider,  
1168 - // fromPage: widget.fromPage),  
1169 - ])),  
1170 - customerProvider.pageState == PageState.Success  
1171 - ? _selectContantWidget()  
1172 - : SizedBox(),  
1173 - ]);  
1174 - }  
1175 - })), 1270 + Expanded(
  1271 + child: TabBarView(
  1272 + controller: tabController,
  1273 + physics: NeverScrollableScrollPhysics(),
  1274 + children: _returnListWidget())),
  1275 + customerProvider.pageState == PageState.Success
  1276 + ? _selectContantWidget()
  1277 + : SizedBox(),
1176 // _searchWidget(), 1278 // _searchWidget(),
1177 // Positioned( 1279 // Positioned(
1178 // top: 0, 1280 // top: 0,
@@ -210,40 +210,40 @@ class _SellerMyMarketingRecordsDetailPageState @@ -210,40 +210,40 @@ class _SellerMyMarketingRecordsDetailPageState
210 color: MyColours.color_999999, 210 color: MyColours.color_999999,
211 fontSize: ScreenUtil().setSp(30)), 211 fontSize: ScreenUtil().setSp(30)),
212 )), 212 )),
213 - Padding(  
214 - padding: EdgeInsets.symmetric(  
215 - vertical: ScreenUtil().setWidth(25),  
216 - ),  
217 - child: Row(  
218 - crossAxisAlignment: CrossAxisAlignment.center,  
219 - children: [  
220 - Text(  
221 - '总客户人数',  
222 - style: TextStyle(  
223 - color: MyColours.color_333333,  
224 - fontSize: ScreenUtil().setSp(30)),  
225 - ),  
226 - Spacer(),  
227 - Text('${widget.sellerList.guestCount}人',  
228 - style: TextStyle(  
229 - color: MyColours.color_333333,  
230 - fontSize: ScreenUtil().setSp(30))),  
231 - HEmptyView(10),  
232 - InkWell(  
233 - onTap: () {  
234 - NavigatorUtil.goShowCustomerListPage(  
235 - context,  
236 - FromPage.FromPageStoreCustomer,  
237 - widget.sellerList.gid);  
238 - // NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context);  
239 - },  
240 - child: Text('查看', 213 + InkWell(
  214 + onTap: () {
  215 + NavigatorUtil.goShowCustomerListPage(
  216 + context,
  217 + FromPage.FromPageStoreCustomer,
  218 + widget.sellerList.gid);
  219 + // NavigatorUtil.goSellerMyMarketingRecordsDetailPage(context);
  220 + },
  221 + child: Padding(
  222 + padding: EdgeInsets.symmetric(
  223 + vertical: ScreenUtil().setWidth(25),
  224 + ),
  225 + child: Row(
  226 + crossAxisAlignment: CrossAxisAlignment.center,
  227 + children: [
  228 + Text(
  229 + '总客户人数',
  230 + style: TextStyle(
  231 + color: MyColours.color_333333,
  232 + fontSize: ScreenUtil().setSp(30)),
  233 + ),
  234 + Spacer(),
  235 + Text('${widget.sellerList.guestCount}人',
  236 + style: TextStyle(
  237 + color: MyColours.color_333333,
  238 + fontSize: ScreenUtil().setSp(30))),
  239 + HEmptyView(10),
  240 + Text('查看',
241 style: TextStyle( 241 style: TextStyle(
242 decoration: 242 decoration:
243 TextDecoration.underline, 243 TextDecoration.underline,
244 color: MyColours.color_199095, 244 color: MyColours.color_199095,
245 - fontSize: ScreenUtil().setSp(30)))),  
246 - ])), 245 + fontSize: ScreenUtil().setSp(30))),
  246 + ]))),
247 ]))), 247 ]))),
248 Column( 248 Column(
249 children: [ 249 children: [
@@ -60,7 +60,7 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -60,7 +60,7 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
60 if (tabController.index == tabController.animation.value) { 60 if (tabController.index == tabController.animation.value) {
61 print(tabController.index); 61 print(tabController.index);
62 customerProvider.index = tabController.index; 62 customerProvider.index = tabController.index;
63 - customerProvider.searchData(customerProvider.controller.text); 63 + // customerProvider.searchData(customerProvider.controller.text);
64 } 64 }
65 }); 65 });
66 WidgetsBinding.instance.addPostFrameCallback((_) async { 66 WidgetsBinding.instance.addPostFrameCallback((_) async {
@@ -239,7 +239,7 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -239,7 +239,7 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
239 onChanged: (value) { 239 onChanged: (value) {
240 // setState(() {}); 240 // setState(() {});
241 // _searchSellerLocation(); 241 // _searchSellerLocation();
242 - customerProvider.searchData(value); 242 + // customerProvider.searchData(value);
243 }, 243 },
244 onEditingComplete: () { 244 onEditingComplete: () {
245 FocusScope.of(context) 245 FocusScope.of(context)
@@ -270,7 +270,7 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -270,7 +270,7 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
270 onTap: () { 270 onTap: () {
271 WidgetsBinding.instance.addPostFrameCallback(((_) { 271 WidgetsBinding.instance.addPostFrameCallback(((_) {
272 customerProvider.controller.clear(); 272 customerProvider.controller.clear();
273 - customerProvider.searchData(''); 273 + // customerProvider.searchData('');
274 })); 274 }));
275 }, 275 },
276 )), 276 )),
@@ -746,7 +746,7 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -746,7 +746,7 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
746 onChanged: (value) { 746 onChanged: (value) {
747 // setState(() {}); 747 // setState(() {});
748 // _searchSellerLocation(); 748 // _searchSellerLocation();
749 - customerProvider.searchData(value); 749 + // customerProvider.searchData(value);
750 }, 750 },
751 onEditingComplete: () { 751 onEditingComplete: () {
752 FocusScope.of(context) 752 FocusScope.of(context)
@@ -843,7 +843,7 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -843,7 +843,7 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
843 onChanged: (value) { 843 onChanged: (value) {
844 // setState(() {}); 844 // setState(() {});
845 // _searchSellerLocation(); 845 // _searchSellerLocation();
846 - customerProvider.searchData(value); 846 + // customerProvider.searchData(value);
847 }, 847 },
848 onEditingComplete: () { 848 onEditingComplete: () {
849 FocusScope.of(context) 849 FocusScope.of(context)
@@ -1049,134 +1049,39 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage> @@ -1049,134 +1049,39 @@ class _ShowCustomerListPageState extends State<ShowCustomerListPage>
1049 1049
1050 return Material( 1050 return Material(
1051 child: InkWell( 1051 child: InkWell(
1052 - onTap: () {  
1053 - // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘  
1054 - },  
1055 - child: Scaffold(  
1056 - resizeToAvoidBottomInset: false,  
1057 - backgroundColor: MyColours.color_ffffff,  
1058 - appBar: SystemAppBar(  
1059 - '全店客户',  
1060 - onTap: () {  
1061 - Navigator.of(context).pop();  
1062 - },  
1063 - ),  
1064 - body: SafeArea(  
1065 - child: Column(children: [  
1066 - _searchWidget(), _menuWidget(),  
1067 - Expanded(child:  
1068 - Consumer<CustomerProvider>(builder: (context, model, _) {  
1069 - if (model.pageStateListShow != PageState.Success) {  
1070 - return ExceptionPage(  
1071 - pageState: model.pageStateListShow,  
1072 - callback: () {  
1073 - model.pageStateListShow = PageState.Loading;  
1074 - model.notifyListeners();  
1075 - _getGuestByGid();  
1076 - },  
1077 - emptyMsg: "暂时没有客户哦",  
1078 - emptyImg: "empty_search",  
1079 - showMsg: "加载中,请稍后...",  
1080 - );  
1081 - } else {  
1082 - return Column(children: [  
1083 - Expanded(  
1084 - child: TabBarView(  
1085 - controller: tabController,  
1086 - physics: NeverScrollableScrollPhysics(),  
1087 - children: <Widget>[  
1088 - MyContactListPage(  
1089 - contacts: model.selectCustomer,  
1090 - provider: customerProvider,  
1091 - fromPage: FromPage.FromPageShowCutomerList),  
1092 - Consumer<CustomerProvider>(  
1093 - builder: (context, model, _) {  
1094 - if (model.pageStateListShow !=  
1095 - PageState.Success) {  
1096 - return ExceptionPage(  
1097 - pageState: model.pageStateListShow,  
1098 - callback: () {  
1099 - model.pageStateListShow = PageState.Loading;  
1100 - model.notifyListeners();  
1101 - _getGuestByGid();  
1102 - },  
1103 - emptyMsg: "暂时没有客户哦",  
1104 - emptyImg: "empty_search",  
1105 - showMsg: "加载中,请稍后...",  
1106 - );  
1107 - } else {  
1108 - return MyContactListPage(  
1109 - contacts: model.userHistorysShowHuoyue,  
1110 - provider: customerProvider,  
1111 - fromPage: FromPage.FromPageShowCutomerList);  
1112 - }  
1113 - }),  
1114 - Consumer<CustomerProvider>(  
1115 - builder: (context, model, _) {  
1116 - if (model.pageStateChenshui !=  
1117 - PageState.Success) {  
1118 - return ExceptionPage(  
1119 - pageState: model.pageStateChenshui,  
1120 - callback: () {  
1121 - model.pageStateChenshui = PageState.Loading;  
1122 - model.notifyListeners();  
1123 - _getGuestByGid();  
1124 - },  
1125 - emptyMsg: "暂时没有客户哦",  
1126 - emptyImg: "empty_search",  
1127 - showMsg: "加载中,请稍后...",  
1128 - );  
1129 - } else {  
1130 - return MyContactListPage(  
1131 - contacts: model.userHistorysShowChenshui,  
1132 - provider: customerProvider,  
1133 - fromPage: FromPage.FromPageShowCutomerList);  
1134 - }  
1135 - }),  
1136 - Consumer<CustomerProvider>(  
1137 - builder: (context, model, _) {  
1138 - if (model.pageStateLiushi != PageState.Success) {  
1139 - return ExceptionPage(  
1140 - pageState: model.pageStateLiushi,  
1141 - callback: () {  
1142 - model.pageStateLiushi = PageState.Loading;  
1143 - model.notifyListeners();  
1144 - _getGuestByGid();  
1145 - },  
1146 - emptyMsg: "暂时没有客户哦",  
1147 - emptyImg: "empty_search",  
1148 - showMsg: "加载中,请稍后...",  
1149 - );  
1150 - } else {  
1151 - return MyContactListPage(  
1152 - contacts: model.userHistorysShowLiushi,  
1153 - provider: customerProvider,  
1154 - fromPage: FromPage.FromPageShowCutomerList);  
1155 - }  
1156 - }),  
1157 - // ContactListPage(  
1158 - // contacts: model.userHistorysShowChenshui,  
1159 - // provider: customerProvider,  
1160 - // fromPage: widget.fromPage),  
1161 - // ContactListPage(  
1162 - // contacts: model.userHistorysShowLiushi,  
1163 - // provider: customerProvider,  
1164 - // fromPage: widget.fromPage),  
1165 - ])),  
1166 - // customerProvider.pageState == PageState.Success  
1167 - // ? _selectContantWidget()  
1168 - // : SizedBox(),  
1169 - ]);  
1170 - }  
1171 - })),  
1172 - // _searchWidget(),  
1173 - // Positioned(  
1174 - // top: 0,  
1175 - // left: ScreenUtil().setWidth(40),  
1176 - // right: ScreenUtil().setWidth(40),  
1177 - // child: _filterWidget())  
1178 - // ],  
1179 - ])),  
1180 - ))); 1052 + onTap: () {
  1053 + // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  1054 + },
  1055 + child: Scaffold(
  1056 + resizeToAvoidBottomInset: false,
  1057 + backgroundColor: MyColours.color_ffffff,
  1058 + appBar: SystemAppBar(
  1059 + '客户',
  1060 + onTap: () {
  1061 + Navigator.of(context).pop();
  1062 + },
  1063 + ),
  1064 + body: Consumer<CustomerProvider>(builder: (context, model, _) {
  1065 + if (model.pageStateListShow != PageState.Success) {
  1066 + return ExceptionPage(
  1067 + pageState: model.pageStateListShow,
  1068 + callback: () {
  1069 + model.pageStateListShow = PageState.Loading;
  1070 + model.notifyListeners();
  1071 + _getGuestByGid();
  1072 + },
  1073 + emptyMsg: "暂时没有客户哦",
  1074 + emptyImg: "empty_search",
  1075 + showMsg: "加载中,请稍后...",
  1076 + );
  1077 + } else {
  1078 + return MyContactListPage(
  1079 + contacts: customerProvider.selectCustomer,
  1080 + provider: customerProvider,
  1081 + fromPage: FromPage.FromPageShowCutomerList);
  1082 + }
  1083 + }),
  1084 + ),
  1085 + ));
1181 } 1086 }
1182 } 1087 }
@@ -90,11 +90,9 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> { @@ -90,11 +90,9 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> {
90 90
91 ///获取商家标签 91 ///获取商家标签
92 _getLabelBySellerid() async { 92 _getLabelBySellerid() async {
93 - Map<String, String> params = {  
94 - "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,  
95 - }; 93 +
96 List<CustomerLabelSunModel> modelLabel = 94 List<CustomerLabelSunModel> modelLabel =
97 - await customerProvider.getLabelBySellerid(context, params); 95 + await customerProvider.getLabelBySellerid(context);
98 96
99 if (modelLabel.length > 0) { 97 if (modelLabel.length > 0) {
100 for (int i = 0; i < customerProvider.labelList.length; i++) { 98 for (int i = 0; i < customerProvider.labelList.length; i++) {
@@ -267,7 +267,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -267,7 +267,7 @@ class _CustomerListPageState extends State<CustomerListPage>
267 onChanged: (value) { 267 onChanged: (value) {
268 // setState(() {}); 268 // setState(() {});
269 // _searchSellerLocation(); 269 // _searchSellerLocation();
270 - customerProvider.searchData(value); 270 + // customerProvider.searchData(value);
271 }, 271 },
272 onEditingComplete: () { 272 onEditingComplete: () {
273 FocusScope.of(context) 273 FocusScope.of(context)
@@ -298,7 +298,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -298,7 +298,7 @@ class _CustomerListPageState extends State<CustomerListPage>
298 onTap: () { 298 onTap: () {
299 WidgetsBinding.instance.addPostFrameCallback(((_) { 299 WidgetsBinding.instance.addPostFrameCallback(((_) {
300 customerProvider.controller.clear(); 300 customerProvider.controller.clear();
301 - customerProvider.searchData(''); 301 + // customerProvider.searchData('');
302 })); 302 }));
303 }, 303 },
304 )), 304 )),
@@ -774,7 +774,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -774,7 +774,7 @@ class _CustomerListPageState extends State<CustomerListPage>
774 onChanged: (value) { 774 onChanged: (value) {
775 // setState(() {}); 775 // setState(() {});
776 // _searchSellerLocation(); 776 // _searchSellerLocation();
777 - customerProvider.searchData(value); 777 + // customerProvider.searchData(value);
778 }, 778 },
779 onEditingComplete: () { 779 onEditingComplete: () {
780 FocusScope.of(context) 780 FocusScope.of(context)
@@ -871,7 +871,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -871,7 +871,7 @@ class _CustomerListPageState extends State<CustomerListPage>
871 onChanged: (value) { 871 onChanged: (value) {
872 // setState(() {}); 872 // setState(() {});
873 // _searchSellerLocation(); 873 // _searchSellerLocation();
874 - customerProvider.searchData(value); 874 + // customerProvider.searchData(value);
875 }, 875 },
876 onEditingComplete: () { 876 onEditingComplete: () {
877 FocusScope.of(context) 877 FocusScope.of(context)
@@ -57,10 +57,7 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { @@ -57,10 +57,7 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> {
57 57
58 ///获取商家标签 58 ///获取商家标签
59 _getLabelBySellerid() async { 59 _getLabelBySellerid() async {
60 - Map<String, String> params = {  
61 - "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,  
62 - };  
63 - await customerProvider.getLabelBySellerid(context, params); 60 + await customerProvider.getLabelBySellerid(context);
64 } 61 }
65 62
66 ///商家创建商家标签 63 ///商家创建商家标签
@@ -250,41 +250,43 @@ class _MarketingRecordsDetailPageState @@ -250,41 +250,43 @@ class _MarketingRecordsDetailPageState
250 color: MyColours.color_999999, 250 color: MyColours.color_999999,
251 fontSize: ScreenUtil().setSp(30)), 251 fontSize: ScreenUtil().setSp(30)),
252 )), 252 )),
253 - Padding(  
254 - padding: EdgeInsets.symmetric(  
255 - vertical: ScreenUtil().setWidth(25),  
256 - ),  
257 - child: Row(  
258 - crossAxisAlignment: CrossAxisAlignment.center,  
259 - children: [  
260 - Text(  
261 - '总客户人数',  
262 - style: TextStyle(  
263 - color: MyColours.color_333333,  
264 - fontSize: ScreenUtil().setSp(30)),  
265 - ),  
266 - Spacer(),  
267 - Text(  
268 - '${model.marketingByIdSunModel.guestCount}人',  
269 - style: TextStyle(  
270 - color: MyColours.color_333333,  
271 - fontSize: ScreenUtil().setSp(30))),  
272 - HEmptyView(10),  
273 - InkWell(  
274 - onTap: () {  
275 - NavigatorUtil.goShowCustomerListPage(  
276 - context,  
277 - FromPage.FromPageStoreCustomer,  
278 - model.marketingByIdSunModel.gid);  
279 - },  
280 - child: Text('查看', 253 + InkWell(
  254 + onTap: () {
  255 + NavigatorUtil.goShowCustomerListPage(
  256 + context,
  257 + FromPage.FromPageStoreCustomer,
  258 + model.marketingByIdSunModel.gid);
  259 + },
  260 + child: Padding(
  261 + padding: EdgeInsets.symmetric(
  262 + vertical: ScreenUtil().setWidth(25),
  263 + ),
  264 + child: Row(
  265 + crossAxisAlignment:
  266 + CrossAxisAlignment.center,
  267 + children: [
  268 + Text(
  269 + '总客户人数',
  270 + style: TextStyle(
  271 + color: MyColours.color_333333,
  272 + fontSize: ScreenUtil().setSp(30)),
  273 + ),
  274 + Spacer(),
  275 + Text(
  276 + '${model.marketingByIdSunModel.guestCount}人',
  277 + style: TextStyle(
  278 + color: MyColours.color_333333,
  279 + fontSize:
  280 + ScreenUtil().setSp(30))),
  281 + HEmptyView(10),
  282 + Text('查看',
281 style: TextStyle( 283 style: TextStyle(
282 decoration: 284 decoration:
283 TextDecoration.underline, 285 TextDecoration.underline,
284 color: MyColours.color_199095, 286 color: MyColours.color_199095,
285 fontSize: 287 fontSize:
286 - ScreenUtil().setSp(30)))),  
287 - ])), 288 + ScreenUtil().setSp(30))),
  289 + ]))),
288 RowMultiText( 290 RowMultiText(
289 '参与经理', 291 '参与经理',
290 '${model.marketingByIdSunModel.sellerUserCount}人', 292 '${model.marketingByIdSunModel.sellerUserCount}人',
@@ -8,6 +8,7 @@ import 'package:one_key/models/coupon_model.dart'; @@ -8,6 +8,7 @@ import 'package:one_key/models/coupon_model.dart';
8 import 'package:one_key/models/customer_by_seller_model.dart'; 8 import 'package:one_key/models/customer_by_seller_model.dart';
9 import 'package:one_key/models/customer_label_model.dart'; 9 import 'package:one_key/models/customer_label_model.dart';
10 import 'package:one_key/models/customer_list_model.dart'; 10 import 'package:one_key/models/customer_list_model.dart';
  11 +import 'package:one_key/models/filter_btn_model.dart';
11 import 'package:one_key/models/guest_info_model.dart'; 12 import 'package:one_key/models/guest_info_model.dart';
12 import 'package:one_key/models/guest_manage_model.dart'; 13 import 'package:one_key/models/guest_manage_model.dart';
13 import 'package:one_key/models/guest_reserve_model.dart'; 14 import 'package:one_key/models/guest_reserve_model.dart';
@@ -27,18 +28,18 @@ import 'package:provider/provider.dart'; @@ -27,18 +28,18 @@ import 'package:provider/provider.dart';
27 class CustomerProvider extends ChangeNotifier { 28 class CustomerProvider extends ChangeNotifier {
28 PageState pageState = PageState.Loading; 29 PageState pageState = PageState.Loading;
29 List<CustomerListSunModel> userHistorys = []; //客户列表(总) 30 List<CustomerListSunModel> userHistorys = []; //客户列表(总)
30 - List<CustomerListSunModel> userHistorysShow = []; //全部展示  
31 - List<CustomerListSunModel> userHistorysShowHuoyue = []; //活跃展示  
32 - List<CustomerListSunModel> userHistorysShowChenshui = []; //沉睡展示  
33 - List<CustomerListSunModel> userHistorysShowLiushi = []; //流失展示  
34 31
35 TextEditingController controller = TextEditingController(); //搜索框 32 TextEditingController controller = TextEditingController(); //搜索框
  33 + TextEditingController controllerstime = TextEditingController(); //高级筛选开始时间
  34 + TextEditingController controlleretime = TextEditingController(); //高级筛选结束时间
  35 + TextEditingController controllernum = TextEditingController(); //预订次数
  36 +
  37 + FocusNode stimeFocus = FocusNode(); //高级筛选开始时间
  38 + FocusNode etimeFocus = FocusNode(); //高级筛选结束时间
36 39
37 PageState pageStateMyHome = PageState.Loading; 40 PageState pageStateMyHome = PageState.Loading;
38 PageState pageStateStoreHome = PageState.Loading; 41 PageState pageStateStoreHome = PageState.Loading;
39 - PageState pageStateHuoyue = PageState.Loading;  
40 - PageState pageStateChenshui = PageState.Loading;  
41 - PageState pageStateLiushi = PageState.Loading; 42 +
42 GuestManageSunModel guestSunmodel; //我的客情首页数据 43 GuestManageSunModel guestSunmodel; //我的客情首页数据
43 StoreCustomerHomeSunModel storeSunmodel; //全店客情首页数据 44 StoreCustomerHomeSunModel storeSunmodel; //全店客情首页数据
44 PageState pageStateGuestInfo = PageState.Loading; //客户详情 45 PageState pageStateGuestInfo = PageState.Loading; //客户详情
@@ -70,6 +71,57 @@ class CustomerProvider extends ChangeNotifier { @@ -70,6 +71,57 @@ class CustomerProvider extends ChangeNotifier {
70 PageState pageStateListShow = PageState.Loading; 71 PageState pageStateListShow = PageState.Loading;
71 72
72 List<CustomerBySellerSunModel> customerBySellerList; //全店客情列表 73 List<CustomerBySellerSunModel> customerBySellerList; //全店客情列表
  74 + List<FilterBtnModel> filterHydList = []; //活跃度
  75 + List<FilterBtnModel> filterLabelList = []; //自定义标签
  76 + List<FilterBtnModel> filterDayList = []; //高级筛选---天数 7、30、60、120
  77 + bool hydSelAll = false;
  78 + bool labelSelAll = false;
  79 +
  80 + initData() {
  81 + filterDayList = [];
  82 + FilterBtnModel model = FilterBtnModel();
  83 + model.id = '7';
  84 + model.title = '7天';
  85 + model.select = false;
  86 + filterDayList.add(model);
  87 + FilterBtnModel model1 = FilterBtnModel();
  88 + model1.id = '30';
  89 + model1.title = '30天';
  90 + model1.select = false;
  91 + filterDayList.add(model1);
  92 + FilterBtnModel model2 = FilterBtnModel();
  93 + model2.id = '60';
  94 + model2.title = '60天';
  95 + model2.select = false;
  96 + filterDayList.add(model2);
  97 + FilterBtnModel model3 = FilterBtnModel();
  98 + model3.id = '120';
  99 + model3.title = '120天';
  100 + model3.select = false;
  101 + filterDayList.add(model3);
  102 +
  103 + filterHydList = [];
  104 + // FilterBtnModel modelhyd1 = FilterBtnModel();
  105 + // modelhyd1.id = '0';
  106 + // modelhyd1.title = '新客';
  107 + // modelhyd1.select = false;
  108 + // filterHydList.add(modelhyd1);
  109 + FilterBtnModel modelhyd2 = FilterBtnModel();
  110 + modelhyd2.id = '1';
  111 + modelhyd2.title = '活跃';
  112 + modelhyd2.select = false;
  113 + filterHydList.add(modelhyd2);
  114 + FilterBtnModel modelhyd3 = FilterBtnModel();
  115 + modelhyd3.id = '2';
  116 + modelhyd3.title = '沉睡';
  117 + modelhyd3.select = false;
  118 + filterHydList.add(modelhyd3);
  119 + FilterBtnModel modelhyd4 = FilterBtnModel();
  120 + modelhyd4.id = '3';
  121 + modelhyd4.title = '流失';
  122 + modelhyd4.select = false;
  123 + filterHydList.add(modelhyd4);
  124 + }
73 125
74 ///客户经理获取所创建活动列表(选择优惠券) 126 ///客户经理获取所创建活动列表(选择优惠券)
75 Future<List<CouponSunModel>> getCustomerSelectActivityNew( 127 Future<List<CouponSunModel>> getCustomerSelectActivityNew(
@@ -96,7 +148,122 @@ class CustomerProvider extends ChangeNotifier { @@ -96,7 +148,122 @@ class CustomerProvider extends ChangeNotifier {
96 return couponListSelect; 148 return couponListSelect;
97 } 149 }
98 150
99 - //用来获取客户列表 151 + // //我的客情列表------获取筛选里面的活跃度,自定义标签
  152 + // getCustomerListWithFilter(BuildContext context) async {
  153 + // Map<String, String> params = {
  154 + // "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  155 + // };
  156 + // BaseResp<List> baseResp = await DioUtil()
  157 + // .request<List>(context, Method.get, HttpUrl.get_customer_list,
  158 + // data: params, showLoading: false)
  159 + // .catchError((error) {
  160 + // print(error.toString());
  161 + // });
  162 + // if (baseResp != null && baseResp.code == Constant.status_success) {
  163 + // List<CustomerListSunModel> temp =
  164 + // CustomerListModel.fromJson(baseResp.responseData).data;
  165 + // if (temp.length == 0) {
  166 + // filterHydList = [];
  167 + // filterLabelList = [];
  168 + // } else {
  169 + // filterHydList = [];
  170 + // filterLabelList = [];
  171 +
  172 + // List<String> temphyd = [];
  173 + // List<String> tempLabel = [];
  174 + // for (int i = 0; i < temp.length; i++) {
  175 + // CustomerListSunModel item = temp[i];
  176 + // if (item.attr != null) {
  177 + // temphyd.add(item.attr);
  178 + // }
  179 + // if (item.label != null) {
  180 + // tempLabel.add(item.label);
  181 + // }
  182 + // }
  183 + // temphyd = temphyd.toSet().toList();
  184 + // for (String item in temphyd) {
  185 + // FilterBtnModel model = FilterBtnModel();
  186 + // model.title = item;
  187 + // filterHydList.add(model);
  188 + // }
  189 + // tempLabel = tempLabel.toSet().toList();
  190 + // for (String item in tempLabel) {
  191 + // FilterBtnModel model = FilterBtnModel();
  192 + // model.title = item;
  193 + // filterLabelList.add(model);
  194 + // }
  195 + // }
  196 + // notifyListeners();
  197 + // }
  198 + // // if (baseResp != null && baseResp.code == Constant.status_success) {
  199 + // // userHistorys = baseResp.data.map<CustomerListSunModel>((value) {
  200 + // // return CustomerListSunModel.fromJson(value);
  201 + // // }).toList();
  202 + // // if (userHistorys.length == 0) {
  203 + // // pageState = PageState.Empty;
  204 + // // } else {
  205 + // // for (int i = 0; i < userHistorys.length; i++) {
  206 + // // CustomerListSunModel item = userHistorys[i];
  207 + // // item.pinyinFirst = '';
  208 + // // item.pinyinList = [];
  209 + // // item.pinyinList = [];
  210 + // // if (item.rname != null) {
  211 + // // item.pinyin =
  212 + // // PinyinHelper.getPinyin(item.rname).replaceAll(' ', '');
  213 + // // List<String> pinyinList =
  214 + // // PinyinHelper.getPinyin(item.rname).split(' ');
  215 +
  216 + // // String pinyinAll = ''; //组装全拼组合
  217 + // // for (int j = 0; j < pinyinList.length; j++) {
  218 + // // String letter = pinyinList[j];
  219 + // // pinyinAll += pinyinList[j];
  220 + // // item.pinyinList.add(pinyinAll);
  221 + // // if (letter.length > 0) {
  222 + // // item.pinyinFirst += pinyinList[j].substring(0, 1);
  223 + // // } else {
  224 + // // item.pinyinFirst += '';
  225 + // // }
  226 + // // }
  227 + // // }
  228 +
  229 + // // userHistorys[i] = item;
  230 + // // }
  231 + // // userHistorysShow = userHistorys; //全部客户列表信息
  232 + // // userHistorysShowHuoyue = [];
  233 + // // userHistorysShowChenshui = [];
  234 + // // userHistorysShowLiushi = [];
  235 + // // for (CustomerListSunModel item in userHistorysShow) {
  236 + // // if (item.attr == '活跃') {
  237 + // // userHistorysShowHuoyue.add(item);
  238 + // // } else if (item.attr == '沉睡') {
  239 + // // userHistorysShowChenshui.add(item);
  240 + // // } else if (item.attr == '流失') {
  241 + // // userHistorysShowLiushi.add(item);
  242 + // // }
  243 + // // }
  244 + // // if (userHistorysShowHuoyue.length > 0) {
  245 + // // pageStateHuoyue = PageState.Success;
  246 + // // } else {
  247 + // // pageStateHuoyue = PageState.Empty;
  248 + // // }
  249 + // // if (userHistorysShowChenshui.length > 0) {
  250 + // // pageStateChenshui = PageState.Success;
  251 + // // } else {
  252 + // // pageStateChenshui = PageState.Empty;
  253 + // // }
  254 + // // if (userHistorysShowLiushi.length > 0) {
  255 + // // pageStateLiushi = PageState.Success;
  256 + // // } else {
  257 + // // pageStateLiushi = PageState.Empty;
  258 + // // }
  259 + // // addAll();
  260 + // // pageState = PageState.Success;
  261 + // // }
  262 + // // notifyListeners();
  263 + // // }
  264 + // }
  265 +
  266 + //我的客情 --- 用来获取客户列表
100 getCustomerList(BuildContext context, Map<String, String> params) async { 267 getCustomerList(BuildContext context, Map<String, String> params) async {
101 BaseResp<List> baseResp = await DioUtil() 268 BaseResp<List> baseResp = await DioUtil()
102 .request<List>(context, Method.get, HttpUrl.get_customer_list, 269 .request<List>(context, Method.get, HttpUrl.get_customer_list,
@@ -119,71 +286,93 @@ class CustomerProvider extends ChangeNotifier { @@ -119,71 +286,93 @@ class CustomerProvider extends ChangeNotifier {
119 notifyListeners(); 286 notifyListeners();
120 }); 287 });
121 if (baseResp != null && baseResp.code == Constant.status_success) { 288 if (baseResp != null && baseResp.code == Constant.status_success) {
122 - userHistorys = baseResp.data.map<CustomerListSunModel>((value) {  
123 - return CustomerListSunModel.fromJson(value);  
124 - }).toList(); 289 + userHistorys = CustomerListModel.fromJson(baseResp.responseData).data;
125 if (userHistorys.length == 0) { 290 if (userHistorys.length == 0) {
126 pageState = PageState.Empty; 291 pageState = PageState.Empty;
127 } else { 292 } else {
  293 + pageState = PageState.Success;
  294 +
128 for (int i = 0; i < userHistorys.length; i++) { 295 for (int i = 0; i < userHistorys.length; i++) {
129 CustomerListSunModel item = userHistorys[i]; 296 CustomerListSunModel item = userHistorys[i];
130 - item.pinyinFirst = '';  
131 - item.pinyinList = [];  
132 - item.pinyinList = []; 297 +
133 if (item.rname != null) { 298 if (item.rname != null) {
134 item.pinyin = 299 item.pinyin =
135 PinyinHelper.getPinyin(item.rname).replaceAll(' ', ''); 300 PinyinHelper.getPinyin(item.rname).replaceAll(' ', '');
136 - List<String> pinyinList =  
137 - PinyinHelper.getPinyin(item.rname).split(' ');  
138 -  
139 - String pinyinAll = ''; //组装全拼组合  
140 - for (int j = 0; j < pinyinList.length; j++) {  
141 - String letter = pinyinList[j];  
142 - pinyinAll += pinyinList[j];  
143 - item.pinyinList.add(pinyinAll);  
144 - if (letter.length > 0) {  
145 - item.pinyinFirst += pinyinList[j].substring(0, 1);  
146 - } else {  
147 - item.pinyinFirst += '';  
148 - }  
149 - }  
150 } 301 }
151 302
152 userHistorys[i] = item; 303 userHistorys[i] = item;
153 } 304 }
154 - userHistorysShow = userHistorys; //全部客户列表信息  
155 - userHistorysShowHuoyue = [];  
156 - userHistorysShowChenshui = [];  
157 - userHistorysShowLiushi = [];  
158 - for (CustomerListSunModel item in userHistorysShow) {  
159 - if (item.attr == '活跃') {  
160 - userHistorysShowHuoyue.add(item);  
161 - } else if (item.attr == '沉睡') {  
162 - userHistorysShowChenshui.add(item);  
163 - } else if (item.attr == '流失') {  
164 - userHistorysShowLiushi.add(item);  
165 - }  
166 - }  
167 - if (userHistorysShowHuoyue.length > 0) {  
168 - pageStateHuoyue = PageState.Success;  
169 - } else {  
170 - pageStateHuoyue = PageState.Empty;  
171 - }  
172 - if (userHistorysShowChenshui.length > 0) {  
173 - pageStateChenshui = PageState.Success;  
174 - } else {  
175 - pageStateChenshui = PageState.Empty;  
176 - }  
177 - if (userHistorysShowLiushi.length > 0) {  
178 - pageStateLiushi = PageState.Success;  
179 - } else {  
180 - pageStateLiushi = PageState.Empty;  
181 - }  
182 - addAll();  
183 - pageState = PageState.Success; 305 +
  306 + myHandleList(userHistorys, needRefresh: true);
184 } 307 }
185 notifyListeners(); 308 notifyListeners();
186 } 309 }
  310 + // if (baseResp != null && baseResp.code == Constant.status_success) {
  311 + // userHistorys = baseResp.data.map<CustomerListSunModel>((value) {
  312 + // return CustomerListSunModel.fromJson(value);
  313 + // }).toList();
  314 + // if (userHistorys.length == 0) {
  315 + // pageState = PageState.Empty;
  316 + // } else {
  317 + // for (int i = 0; i < userHistorys.length; i++) {
  318 + // CustomerListSunModel item = userHistorys[i];
  319 + // item.pinyinFirst = '';
  320 + // item.pinyinList = [];
  321 + // item.pinyinList = [];
  322 + // if (item.rname != null) {
  323 + // item.pinyin =
  324 + // PinyinHelper.getPinyin(item.rname).replaceAll(' ', '');
  325 + // List<String> pinyinList =
  326 + // PinyinHelper.getPinyin(item.rname).split(' ');
  327 +
  328 + // String pinyinAll = ''; //组装全拼组合
  329 + // for (int j = 0; j < pinyinList.length; j++) {
  330 + // String letter = pinyinList[j];
  331 + // pinyinAll += pinyinList[j];
  332 + // item.pinyinList.add(pinyinAll);
  333 + // if (letter.length > 0) {
  334 + // item.pinyinFirst += pinyinList[j].substring(0, 1);
  335 + // } else {
  336 + // item.pinyinFirst += '';
  337 + // }
  338 + // }
  339 + // }
  340 +
  341 + // userHistorys[i] = item;
  342 + // }
  343 + // userHistorysShow = userHistorys; //全部客户列表信息
  344 + // userHistorysShowHuoyue = [];
  345 + // userHistorysShowChenshui = [];
  346 + // userHistorysShowLiushi = [];
  347 + // for (CustomerListSunModel item in userHistorysShow) {
  348 + // if (item.attr == '活跃') {
  349 + // userHistorysShowHuoyue.add(item);
  350 + // } else if (item.attr == '沉睡') {
  351 + // userHistorysShowChenshui.add(item);
  352 + // } else if (item.attr == '流失') {
  353 + // userHistorysShowLiushi.add(item);
  354 + // }
  355 + // }
  356 + // if (userHistorysShowHuoyue.length > 0) {
  357 + // pageStateHuoyue = PageState.Success;
  358 + // } else {
  359 + // pageStateHuoyue = PageState.Empty;
  360 + // }
  361 + // if (userHistorysShowChenshui.length > 0) {
  362 + // pageStateChenshui = PageState.Success;
  363 + // } else {
  364 + // pageStateChenshui = PageState.Empty;
  365 + // }
  366 + // if (userHistorysShowLiushi.length > 0) {
  367 + // pageStateLiushi = PageState.Success;
  368 + // } else {
  369 + // pageStateLiushi = PageState.Empty;
  370 + // }
  371 + // addAll();
  372 + // pageState = PageState.Success;
  373 + // }
  374 + // notifyListeners();
  375 + // }
187 } 376 }
188 377
189 //客户经理营销中的用户列表 378 //客户经理营销中的用户列表
@@ -521,41 +710,41 @@ class CustomerProvider extends ChangeNotifier { @@ -521,41 +710,41 @@ class CustomerProvider extends ChangeNotifier {
521 710
522 //全选按钮执行“全选” 711 //全选按钮执行“全选”
523 addAll() async { 712 addAll() async {
524 - List<CustomerListSunModel> temp = returnNowList();  
525 - //把数据状态全部改成true,即选中状态  
526 - selectCustomer = [];  
527 - for (var i = 0; i < temp.length; i++) {  
528 - temp[i].select = true;  
529 - selectCustomer.add(temp[i]);  
530 - }  
531 - _giveValue(temp);  
532 - checkValue = true;  
533 - labelsValue();  
534 - notifyListeners(); 713 + // List<CustomerListSunModel> temp = returnNowList();
  714 + // //把数据状态全部改成true,即选中状态
  715 + // selectCustomer = [];
  716 + // for (var i = 0; i < temp.length; i++) {
  717 + // temp[i].select = true;
  718 + // selectCustomer.add(temp[i]);
  719 + // }
  720 + // _giveValue(temp);
  721 + // checkValue = true;
  722 + // labelsValue();
  723 + // notifyListeners();
535 } 724 }
536 725
537 labelsValue() { 726 labelsValue() {
538 - List<CustomerListSunModel> temp = returnNowList();  
539 - List<String> tempLabel = [];  
540 - for (CustomerListSunModel item in temp) {  
541 - if (item.select && item.attr != null) {  
542 - tempLabel.add(item.attr);  
543 - }  
544 - }  
545 - tempLabel = tempLabel.toSet().toList();  
546 - labels = Utils.listToStringEnglish(tempLabel); 727 + // List<CustomerListSunModel> temp = returnNowList();
  728 + // List<String> tempLabel = [];
  729 + // for (CustomerListSunModel item in temp) {
  730 + // if (item.select && item.attr != null) {
  731 + // tempLabel.add(item.attr);
  732 + // }
  733 + // }
  734 + // tempLabel = tempLabel.toSet().toList();
  735 + // labels = Utils.listToStringEnglish(tempLabel);
547 } 736 }
548 737
549 _giveValue(List<CustomerListSunModel> temp) { 738 _giveValue(List<CustomerListSunModel> temp) {
550 - if (index == 0) {  
551 - userHistorysShow = temp; //全部  
552 - } else if (index == 1) {  
553 - userHistorysShowHuoyue = temp; //活跃  
554 - } else if (index == 2) {  
555 - userHistorysShowChenshui = temp; //沉睡  
556 - } else if (index == 3) {  
557 - userHistorysShowLiushi = temp; //流失  
558 - } 739 + // if (index == 0) {
  740 + // userHistorysShow = temp; //全部
  741 + // } else if (index == 1) {
  742 + // userHistorysShowHuoyue = temp; //活跃
  743 + // } else if (index == 2) {
  744 + // userHistorysShowChenshui = temp; //沉睡
  745 + // } else if (index == 3) {
  746 + // userHistorysShowLiushi = temp; //流失
  747 + // }
559 } 748 }
560 749
561 ///清除选择 750 ///清除选择
@@ -567,147 +756,147 @@ class CustomerProvider extends ChangeNotifier { @@ -567,147 +756,147 @@ class CustomerProvider extends ChangeNotifier {
567 756
568 //全选按钮执行“全不选” 757 //全选按钮执行“全不选”
569 cancelAll() async { 758 cancelAll() async {
570 - List<CustomerListSunModel> temp = returnNowList();  
571 - selectCustomer = [];  
572 - //把数据状态全部改成false,即不选中状态  
573 - for (var i = 0; i < temp.length; i++) {  
574 - temp[i].select = false;  
575 - }  
576 - _giveValue(temp);  
577 - checkValue = false;  
578 - labelsValue();  
579 - notifyListeners(); 759 + // List<CustomerListSunModel> temp = returnNowList();
  760 + // selectCustomer = [];
  761 + // //把数据状态全部改成false,即不选中状态
  762 + // for (var i = 0; i < temp.length; i++) {
  763 + // temp[i].select = false;
  764 + // }
  765 + // _giveValue(temp);
  766 + // checkValue = false;
  767 + // labelsValue();
  768 + // notifyListeners();
580 } 769 }
581 770
582 //选中 771 //选中
583 addData(int index) { 772 addData(int index) {
584 - List<CustomerListSunModel> temp = returnNowList();  
585 - temp[index].select = true;  
586 - _giveValue(temp);  
587 - selectCustomer.add(temp[index]);  
588 - labelsValue();  
589 - notifyListeners(); 773 + // List<CustomerListSunModel> temp = returnNowList();
  774 + // temp[index].select = true;
  775 + // _giveValue(temp);
  776 + // selectCustomer.add(temp[index]);
  777 + // labelsValue();
  778 + // notifyListeners();
590 } 779 }
591 780
592 - ///返回目前选中的list  
593 - List<CustomerListSunModel> returnNowList() {  
594 - List<CustomerListSunModel> temp = [];  
595 - if (index == 0) {  
596 - temp = userHistorysShow; //全部  
597 - } else if (index == 1) {  
598 - temp = userHistorysShowHuoyue; //活跃  
599 - } else if (index == 2) {  
600 - temp = userHistorysShowChenshui; //沉睡  
601 - } else if (index == 3) {  
602 - temp = userHistorysShowLiushi; //流失  
603 - }  
604 - return temp;  
605 - } 781 + // ///返回目前选中的list
  782 + // List<CustomerListSunModel> returnNowList() {
  783 + // List<CustomerListSunModel> temp = [];
  784 + // if (index == 0) {
  785 + // temp = userHistorysShow; //全部
  786 + // } else if (index == 1) {
  787 + // temp = userHistorysShowHuoyue; //活跃
  788 + // } else if (index == 2) {
  789 + // temp = userHistorysShowChenshui; //沉睡
  790 + // } else if (index == 3) {
  791 + // temp = userHistorysShowLiushi; //流失
  792 + // }
  793 + // return temp;
  794 + // }
606 795
607 //未选中 796 //未选中
608 cancelData(int index) { 797 cancelData(int index) {
609 - List<CustomerListSunModel> temp = returnNowList();  
610 - temp[index].select = false;  
611 - _giveValue(temp);  
612 - selectCustomer.removeWhere((element) => element == temp[index].id);  
613 - labelsValue();  
614 - notifyListeners(); 798 + // List<CustomerListSunModel> temp = returnNowList();
  799 + // temp[index].select = false;
  800 + // _giveValue(temp);
  801 + // selectCustomer.removeWhere((element) => element == temp[index].id);
  802 + // labelsValue();
  803 + // notifyListeners();
615 } 804 }
616 805
617 //获取全选按钮的状态 true or false 806 //获取全选按钮的状态 true or false
618 getCheckValue() { 807 getCheckValue() {
619 - List<CustomerListSunModel> listData = returnNowList();  
620 - bool temp = listData.any((value) {  
621 - return value.select == false;  
622 - });  
623 - if (temp == true) {  
624 - checkValue = false;  
625 - } else {  
626 - checkValue = true;  
627 - }  
628 - notifyListeners(); 808 + // List<CustomerListSunModel> listData = returnNowList();
  809 + // bool temp = listData.any((value) {
  810 + // return value.select == false;
  811 + // });
  812 + // if (temp == true) {
  813 + // checkValue = false;
  814 + // } else {
  815 + // checkValue = true;
  816 + // }
  817 + // notifyListeners();
629 } 818 }
630 819
631 - searchData(String key) {  
632 - // userHistorys 接口请求结果  
633 - // userHistorysShow 侧边栏功能结果  
634 - // 全部,活跃,沉睡,流失的数据是在userHistorysShow 中筛选出来的  
635 - if (userHistorys.length > 0) {  
636 - if (key == '') {  
637 - userHistorysShow = userHistorys;  
638 - pageState = PageState.Success;  
639 - } else {  
640 - userHistorysShow = []; 820 + // searchData(String key) {
  821 + // // userHistorys 接口请求结果
  822 + // // userHistorysShow 侧边栏功能结果
  823 + // // 全部,活跃,沉睡,流失的数据是在userHistorysShow 中筛选出来的
  824 + // if (userHistorys.length > 0) {
  825 + // if (key == '') {
  826 + // userHistorysShow = userHistorys;
  827 + // pageState = PageState.Success;
  828 + // } else {
  829 + // userHistorysShow = [];
641 830
642 - for (int i = 0; i < userHistorys.length; i++) {  
643 - String name = userHistorys[i].rname;  
644 - String pinyinFirst = userHistorys[i].pinyinFirst;  
645 - // String pinyin = userHistorys[i].pinyin;  
646 - String phone = userHistorys[i].phone;  
647 - List<String> pinyinList = userHistorys[i].pinyinList;  
648 - if ((name != null && name.contains(key)) ||  
649 - (pinyinFirst != null && pinyinFirst.contains(key)) ||  
650 - (phone != null && phone.contains(key)) ||  
651 - (pinyinList != null && pinyinList.contains(key))) {  
652 - userHistorysShow.add(userHistorys[i]);  
653 - }  
654 - }  
655 - // for (int i = 0; i < contacts.length; i++) {  
656 - // String name = contacts[i].rname;  
657 - // String pinyinFirst = contacts[i].pinyinFirst;  
658 - // List<String> pinyinList = contacts[i].pinyinList;  
659 - // // String pinyin = contacts[i].pinyin;  
660 - // String phone = contacts[i].phone;  
661 - // if ((name != null && name.contains(key)) ||  
662 - // (pinyinFirst != null && pinyinFirst.contains(key)) ||  
663 - // (phone != null && phone.contains(key)) ||  
664 - // (pinyinList != null && pinyinList.contains(key))) {  
665 - // contactsShow.add(contacts[i]);  
666 - // }  
667 - // }  
668 - if (userHistorysShow.length == 0) {  
669 - pageState = PageState.Empty;  
670 - notifyListeners();  
671 - } else {  
672 - userHistorysShowHuoyue = [];  
673 - userHistorysShowChenshui = [];  
674 - userHistorysShowLiushi = [];  
675 - for (CustomerListSunModel item in userHistorysShow) {  
676 - if (item.attr == '活跃') {  
677 - userHistorysShowHuoyue.add(item);  
678 - } else if (item.attr == '沉睡') {  
679 - userHistorysShowChenshui.add(item);  
680 - } else if (item.attr == '流失') {  
681 - userHistorysShowLiushi.add(item);  
682 - }  
683 - }  
684 - if (userHistorysShowHuoyue.length > 0) {  
685 - pageStateHuoyue = PageState.Success;  
686 - } else {  
687 - pageStateHuoyue = PageState.Empty;  
688 - }  
689 - if (userHistorysShowChenshui.length > 0) {  
690 - pageStateChenshui = PageState.Success;  
691 - } else {  
692 - pageStateChenshui = PageState.Empty;  
693 - }  
694 - if (userHistorysShowLiushi.length > 0) {  
695 - pageStateLiushi = PageState.Success;  
696 - } else {  
697 - pageStateLiushi = PageState.Empty;  
698 - }  
699 - pageState = PageState.Success;  
700 - }  
701 - // if (contactsShow.length == 0) {  
702 - // pageStateRight = PageState.Empty;  
703 - // } else {  
704 - // pageStateRight = PageState.Success;  
705 - // }  
706 - } 831 + // for (int i = 0; i < userHistorys.length; i++) {
  832 + // String name = userHistorys[i].rname;
  833 + // String pinyinFirst = userHistorys[i].pinyinFirst;
  834 + // // String pinyin = userHistorys[i].pinyin;
  835 + // String phone = userHistorys[i].phone;
  836 + // List<String> pinyinList = userHistorys[i].pinyinList;
  837 + // if ((name != null && name.contains(key)) ||
  838 + // (pinyinFirst != null && pinyinFirst.contains(key)) ||
  839 + // (phone != null && phone.contains(key)) ||
  840 + // (pinyinList != null && pinyinList.contains(key))) {
  841 + // userHistorysShow.add(userHistorys[i]);
  842 + // }
  843 + // }
  844 + // // for (int i = 0; i < contacts.length; i++) {
  845 + // // String name = contacts[i].rname;
  846 + // // String pinyinFirst = contacts[i].pinyinFirst;
  847 + // // List<String> pinyinList = contacts[i].pinyinList;
  848 + // // // String pinyin = contacts[i].pinyin;
  849 + // // String phone = contacts[i].phone;
  850 + // // if ((name != null && name.contains(key)) ||
  851 + // // (pinyinFirst != null && pinyinFirst.contains(key)) ||
  852 + // // (phone != null && phone.contains(key)) ||
  853 + // // (pinyinList != null && pinyinList.contains(key))) {
  854 + // // contactsShow.add(contacts[i]);
  855 + // // }
  856 + // // }
  857 + // if (userHistorysShow.length == 0) {
  858 + // pageState = PageState.Empty;
  859 + // notifyListeners();
  860 + // } else {
  861 + // userHistorysShowHuoyue = [];
  862 + // userHistorysShowChenshui = [];
  863 + // userHistorysShowLiushi = [];
  864 + // for (CustomerListSunModel item in userHistorysShow) {
  865 + // if (item.attr == '活跃') {
  866 + // userHistorysShowHuoyue.add(item);
  867 + // } else if (item.attr == '沉睡') {
  868 + // userHistorysShowChenshui.add(item);
  869 + // } else if (item.attr == '流失') {
  870 + // userHistorysShowLiushi.add(item);
  871 + // }
  872 + // }
  873 + // if (userHistorysShowHuoyue.length > 0) {
  874 + // pageStateHuoyue = PageState.Success;
  875 + // } else {
  876 + // pageStateHuoyue = PageState.Empty;
  877 + // }
  878 + // if (userHistorysShowChenshui.length > 0) {
  879 + // pageStateChenshui = PageState.Success;
  880 + // } else {
  881 + // pageStateChenshui = PageState.Empty;
  882 + // }
  883 + // if (userHistorysShowLiushi.length > 0) {
  884 + // pageStateLiushi = PageState.Success;
  885 + // } else {
  886 + // pageStateLiushi = PageState.Empty;
  887 + // }
  888 + // pageState = PageState.Success;
  889 + // }
  890 + // // if (contactsShow.length == 0) {
  891 + // // pageStateRight = PageState.Empty;
  892 + // // } else {
  893 + // // pageStateRight = PageState.Success;
  894 + // // }
  895 + // }
707 896
708 - myHandleList(userHistorysShow, needRefresh: true);  
709 - }  
710 - } 897 + // myHandleList(userHistorysShow, needRefresh: true);
  898 + // }
  899 + // }
711 900
712 //实时更新右边数据 ABCDEFGHIGK.... 901 //实时更新右边数据 ABCDEFGHIGK....
713 902
@@ -1129,9 +1318,11 @@ class CustomerProvider extends ChangeNotifier { @@ -1129,9 +1318,11 @@ class CustomerProvider extends ChangeNotifier {
1129 } 1318 }
1130 1319
1131 // 商家获取商家标签 1320 // 商家获取商家标签
1132 - Future<List<CustomerLabelSunModel>> getLabelBySellerid(  
1133 - BuildContext context, Map<String, String> params, 1321 + Future<List<CustomerLabelSunModel>> getLabelBySellerid(BuildContext context,
1134 {bool showLoading = false}) async { 1322 {bool showLoading = false}) async {
  1323 + Map<String, String> params = {
  1324 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  1325 + };
1135 BaseResp<dynamic> baseResp = await DioUtil() 1326 BaseResp<dynamic> baseResp = await DioUtil()
1136 .request<dynamic>(context, Method.get, HttpUrl.get_label_by_sellerid, 1327 .request<dynamic>(context, Method.get, HttpUrl.get_label_by_sellerid,
1137 data: params, showLoading: showLoading) 1328 data: params, showLoading: showLoading)