Commit 09d474cb8e2868b4d9dccf2613c1f75166653ae9

Authored by wdn127929
1 parent 0b80d8cd

刷新和加载中bug

@@ -10,7 +10,9 @@ import 'package:one_key/route/navigator_util.dart'; @@ -10,7 +10,9 @@ import 'package:one_key/route/navigator_util.dart';
10 import 'package:one_key/utils/utils.dart'; 10 import 'package:one_key/utils/utils.dart';
11 import 'package:one_key/widgets/h_empty_view.dart'; 11 import 'package:one_key/widgets/h_empty_view.dart';
12 import 'package:one_key/widgets/v_empty_view.dart'; 12 import 'package:one_key/widgets/v_empty_view.dart';
  13 +import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
13 14
  15 +import '../../../../utils/event_bus.dart';
14 import '../../../../utils/screen_util.dart'; 16 import '../../../../utils/screen_util.dart';
15 17
16 class MyContactListPage extends StatefulWidget { 18 class MyContactListPage extends StatefulWidget {
@@ -31,11 +33,50 @@ class _MyContactListPageState extends State<MyContactListPage> { @@ -31,11 +33,50 @@ class _MyContactListPageState extends State<MyContactListPage> {
31 // List<contan> _contacts = []; 33 // List<contan> _contacts = [];
32 double susItemHeight = ScreenUtil().setWidth(10); 34 double susItemHeight = ScreenUtil().setWidth(10);
33 35
  36 + ItemScrollController controller = ItemScrollController();
  37 + ItemPositionsListener positon = ItemPositionsListener.create();
  38 +
34 @override 39 @override
35 void initState() { 40 void initState() {
36 super.initState(); 41 super.initState();
37 // loadData(); 42 // loadData();
38 widget.provider.myHandleList(widget.contacts); 43 widget.provider.myHandleList(widget.contacts);
  44 + positon.itemPositions.addListener(_itemPositonChanaged
  45 + // print('${positon.itemPositions.value.last.index}');
  46 + // // positon.itemPositions.value
  47 + // if (positon.itemPositions.value.last.index ==
  48 + // widget.contacts.length - 1) {
  49 + // //上拉加载方法
  50 + // bus.emit('onload_guest_list');
  51 + // }
  52 + );
  53 + }
  54 +
  55 + @override
  56 + void dispose() {
  57 + // TODO: implement dispose
  58 + super.dispose();
  59 + positon.itemPositions.removeListener(_itemPositonChanaged);
  60 + }
  61 +
  62 + _itemPositonChanaged() {
  63 + // ItemPosition itemPosition = positon.itemPositions.value.first;
  64 + print('${positon.itemPositions.value.last.index}');
  65 + // positon.itemPositions.value
  66 + if (positon.itemPositions.value.last.index == 1) {
  67 + bus.emit(
  68 + 'onrefresh_guest_list_my',
  69 + );
  70 + }
  71 + if (positon.itemPositions.value.last.index == widget.contacts.length - 1) {
  72 + //上拉加载方法,最底部
  73 +
  74 + bus.emit(
  75 + 'onload_guest_list_my',
  76 + (widget.contacts.length / 10) < 1
  77 + ? 1
  78 + : (widget.contacts.length / 10).toInt());
  79 + }
39 } 80 }
40 81
41 // void loadData() async { 82 // void loadData() async {
@@ -674,6 +715,8 @@ class _MyContactListPageState extends State<MyContactListPage> { @@ -674,6 +715,8 @@ class _MyContactListPageState extends State<MyContactListPage> {
674 return AzListView( 715 return AzListView(
675 indexBarItemHeight: w(12), 716 indexBarItemHeight: w(12),
676 data: widget.contacts, 717 data: widget.contacts,
  718 + itemScrollController: controller,
  719 + itemPositionsListener: positon,
677 itemCount: widget.contacts.length, 720 itemCount: widget.contacts.length,
678 itemBuilder: (BuildContext context, int index) { 721 itemBuilder: (BuildContext context, int index) {
679 // if (index == 0) return _buildHeader(); 722 // if (index == 0) return _buildHeader();
@@ -54,7 +54,6 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -54,7 +54,6 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
54 List<String> timeTilte = ['等于', '小于', '大于']; 54 List<String> timeTilte = ['等于', '小于', '大于'];
55 int filterHydIndex = 0; 55 int filterHydIndex = 0;
56 56
57 - List pageData = [];  
58 int page = 1; 57 int page = 1;
59 58
60 @override 59 @override
@@ -86,15 +85,27 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -86,15 +85,27 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
86 // item.select = true; 85 // item.select = true;
87 // // item.select = false; 86 // // item.select = false;
88 // } 87 // }
89 - for (FilterBtnModel item in customerProvider.filterHydList) {  
90 - item.select = false;  
91 - // if (item.id == '${customerProvider.index}') {  
92 - // item.select = true;  
93 - // } 88 + // for (FilterBtnModel item in customerProvider.filterHydList) {
  89 + // item.select = false;
  90 + // // if (item.id == '${customerProvider.index}') {
  91 + // // item.select = true;
  92 + // // }
  93 + // }
  94 + int selectNum = 0;
  95 + customerProvider.filterHydList.forEach((element) {
  96 + if (element.select) {
  97 + selectNum++;
  98 + }
  99 + });
  100 + if (selectNum <= 1) {
  101 + //选中一个或者0个
  102 + for (FilterBtnModel item in customerProvider.filterHydList) {
  103 + item.select = false;
  104 + }
94 } 105 }
95 } 106 }
96 page = 1; 107 page = 1;
97 - pageData = []; 108 + customerProvider.pageDataMy = [];
98 _getContantData(first: true); 109 _getContantData(first: true);
99 } 110 }
100 }); 111 });
@@ -124,14 +135,14 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -124,14 +135,14 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
124 }); 135 });
125 bus.on("onload_guest_list_my", (arg) { 136 bus.on("onload_guest_list_my", (arg) {
126 print(arg); 137 print(arg);
127 - if (!pageData.contains(arg)) {  
128 - pageData.add(arg);  
129 - pageData.removeWhere((element) => element == 0); 138 + if (!customerProvider.pageDataMy.contains(arg)) {
  139 + customerProvider.pageDataMy.add(arg);
  140 + customerProvider.pageDataMy.removeWhere((element) => element == 0);
130 _onload(); 141 _onload();
131 } 142 }
132 }); 143 });
133 bus.on("onrefresh_guest_list_my", (arg) { 144 bus.on("onrefresh_guest_list_my", (arg) {
134 - if (!pageData.contains(0)) { 145 + if (!customerProvider.pageDataMy.contains(0)) {
135 _onrefresh(); 146 _onrefresh();
136 } 147 }
137 }); 148 });
@@ -152,7 +163,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -152,7 +163,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
152 163
153 _onrefresh() { 164 _onrefresh() {
154 page = 1; 165 page = 1;
155 - pageData = [0]; 166 + customerProvider.pageDataMy = [0];
156 _getContantData(showLoading: false); 167 _getContantData(showLoading: false);
157 } 168 }
158 169
@@ -289,9 +300,9 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -289,9 +300,9 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
289 // customerProvider.checkValue = false; 300 // customerProvider.checkValue = false;
290 // } 301 // }
291 // if (first || customerProvider.checkValue) { 302 // if (first || customerProvider.checkValue) {
292 - if (first) {  
293 - customerProvider.addAllMy();  
294 - } 303 + // if (first) {
  304 + // customerProvider.addAllMy();
  305 + // }
295 // await customerProvider.searchData(customerProvider.controller.text); 306 // await customerProvider.searchData(customerProvider.controller.text);
296 } 307 }
297 308
@@ -469,14 +480,14 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -469,14 +480,14 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
469 // _searchSellerLocation(); 480 // _searchSellerLocation();
470 // customerProvider.searchData(value); 481 // customerProvider.searchData(value);
471 page = 1; 482 page = 1;
472 - pageData = []; 483 + customerProvider.pageDataMy = [];
473 _getContantData(showLoading: false); 484 _getContantData(showLoading: false);
474 }, 485 },
475 onEditingComplete: () { 486 onEditingComplete: () {
476 FocusScope.of(context) 487 FocusScope.of(context)
477 .requestFocus(FocusNode()); //点击空白处隐藏键盘 488 .requestFocus(FocusNode()); //点击空白处隐藏键盘
478 page = 1; 489 page = 1;
479 - pageData = []; 490 + customerProvider.pageDataMy = [];
480 _getContantData(showLoading: false); 491 _getContantData(showLoading: false);
481 // contantShowModel.searchData( 492 // contantShowModel.searchData(
482 // contantShowModel.controller.text); 493 // contantShowModel.controller.text);
@@ -508,7 +519,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -508,7 +519,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
508 FocusScope.of(context) 519 FocusScope.of(context)
509 .requestFocus(FocusNode()); //点击空白处隐藏键盘 520 .requestFocus(FocusNode()); //点击空白处隐藏键盘
510 page = 1; 521 page = 1;
511 - pageData = []; 522 + customerProvider.pageDataMy = [];
512 _getContantData(showLoading: false); 523 _getContantData(showLoading: false);
513 })); 524 }));
514 }, 525 },
@@ -687,7 +698,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -687,7 +698,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
687 showFilter = false; 698 showFilter = false;
688 }); 699 });
689 page = 1; 700 page = 1;
690 - pageData = []; 701 + customerProvider.pageDataMy = [];
691 _getContantData(); 702 _getContantData();
692 }, tapWhiteBack: () { 703 }, tapWhiteBack: () {
693 Navigator.of(context).pop(); 704 Navigator.of(context).pop();
@@ -1521,7 +1532,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -1521,7 +1532,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
1521 pageState: model.pageState, 1532 pageState: model.pageState,
1522 callback: () { 1533 callback: () {
1523 page = 1; 1534 page = 1;
1524 - pageData = []; 1535 + customerProvider.pageDataMy = [];
1525 _getContantData(); 1536 _getContantData();
1526 }, 1537 },
1527 emptyMsg: "暂时没有客户哦", 1538 emptyMsg: "暂时没有客户哦",
@@ -64,8 +64,6 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -64,8 +64,6 @@ class _CustomerListPageState extends State<CustomerListPage>
64 bool distribution = false; 64 bool distribution = false;
65 int page = 1; 65 int page = 1;
66 66
67 - List pageData = [];  
68 -  
69 @override 67 @override
70 void initState() { 68 void initState() {
71 distribution = widget.distribution; 69 distribution = widget.distribution;
@@ -95,15 +93,27 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -95,15 +93,27 @@ class _CustomerListPageState extends State<CustomerListPage>
95 // item.select = true; 93 // item.select = true;
96 // // item.select = false; 94 // // item.select = false;
97 // } 95 // }
98 - for (FilterBtnModel item in customerProvider.filterHydList) {  
99 - item.select = false;  
100 - // if (item.id == '${customerProvider.index}') {  
101 - // item.select = true;  
102 - // } 96 + // for (FilterBtnModel item in customerProvider.filterHydList) {
  97 + // item.select = false;
  98 + // // if (item.id == '${customerProvider.index}') {
  99 + // // item.select = true;
  100 + // // }
  101 + // }
  102 + int selectNum = 0;
  103 + customerProvider.filterHydList.forEach((element) {
  104 + if (element.select) {
  105 + selectNum++;
  106 + }
  107 + });
  108 + if (selectNum <= 1) {
  109 + //选中一个或者0个
  110 + for (FilterBtnModel item in customerProvider.filterHydList) {
  111 + item.select = false;
  112 + }
103 } 113 }
104 } 114 }
105 page = 1; 115 page = 1;
106 - pageData = []; 116 + customerProvider.pageData = [];
107 _getContantData(first: true); 117 _getContantData(first: true);
108 } 118 }
109 }); 119 });
@@ -128,9 +138,12 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -128,9 +138,12 @@ class _CustomerListPageState extends State<CustomerListPage>
128 // } 138 // }
129 page = 1; 139 page = 1;
130 140
131 - _getContantData(first: first); 141 + // _getSellerGuestManage();
  142 + // _getContantData(first: first);
132 _filterLabelList(); 143 _filterLabelList();
133 - _getSellerGuestManage(); 144 + _getManagerAndList();
  145 +
  146 + // _getManagerAndList();
134 }); 147 });
135 148
136 bus.on("refresh_guest_list", (arg) { 149 bus.on("refresh_guest_list", (arg) {
@@ -139,14 +152,14 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -139,14 +152,14 @@ class _CustomerListPageState extends State<CustomerListPage>
139 152
140 bus.on("onload_guest_list", (arg) { 153 bus.on("onload_guest_list", (arg) {
141 print(arg); 154 print(arg);
142 - if (!pageData.contains(arg)) {  
143 - pageData.add(arg);  
144 - pageData.removeWhere((element) => element == 0); 155 + if (!customerProvider.pageData.contains(arg)) {
  156 + customerProvider.pageData.add(arg);
  157 + customerProvider.pageData.removeWhere((element) => element == 0);
145 _onload(); 158 _onload();
146 } 159 }
147 }); 160 });
148 bus.on("onrefresh_guest_list", (arg) { 161 bus.on("onrefresh_guest_list", (arg) {
149 - if (!pageData.contains(0)) { 162 + if (!customerProvider.pageData.contains(0)) {
150 _onrefresh(); 163 _onrefresh();
151 } 164 }
152 }); 165 });
@@ -160,6 +173,11 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -160,6 +173,11 @@ class _CustomerListPageState extends State<CustomerListPage>
160 super.dispose(); 173 super.dispose();
161 } 174 }
162 175
  176 + _getManagerAndList() async {
  177 + await _getSellerGuestManage();
  178 + await _getContantData();
  179 + }
  180 +
163 _onload() { 181 _onload() {
164 page++; 182 page++;
165 _getContantData(showLoading: false, load: true); 183 _getContantData(showLoading: false, load: true);
@@ -167,7 +185,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -167,7 +185,7 @@ class _CustomerListPageState extends State<CustomerListPage>
167 185
168 _onrefresh() { 186 _onrefresh() {
169 page = 1; 187 page = 1;
170 - pageData = [0]; 188 + customerProvider.pageData = [0];
171 _getContantData(showLoading: false); 189 _getContantData(showLoading: false);
172 } 190 }
173 191
@@ -184,6 +202,9 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -184,6 +202,9 @@ class _CustomerListPageState extends State<CustomerListPage>
184 // model.id = item.id; 202 // model.id = item.id;
185 model1.title = '未分配经理'; 203 model1.title = '未分配经理';
186 model1.select = false; 204 model1.select = false;
  205 + if (distribution) {
  206 + model1.select = true;
  207 + }
187 customerProvider.filterManageList.add(model1); 208 customerProvider.filterManageList.add(model1);
188 if (model != null && 209 if (model != null &&
189 model.sellerUser != null && 210 model.sellerUser != null &&
@@ -285,28 +306,28 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -285,28 +306,28 @@ class _CustomerListPageState extends State<CustomerListPage>
285 // 306 //
286 // 307 //
287 // params['uid'] 经理ID 308 // params['uid'] 经理ID
288 - if (first && widget.uidStr != null && widget.uidStr != '') {  
289 - params['uid'] = widget.uidStr;  
290 - } else {  
291 - String uid = '';  
292 - List<FilterBtnModel> tempfilterManage =  
293 - List.from(customerProvider.filterManageList);  
294 - if (tempfilterManage.length > 0) {  
295 - tempfilterManage.removeAt(0);  
296 - }  
297 - for (FilterBtnModel item in tempfilterManage) {  
298 - if (item.select) {  
299 - uid += '${item.id},';  
300 - } 309 + // if (first && widget.uidStr != null && widget.uidStr != '') {
  310 + // params['uid'] = widget.uidStr;
  311 + // } else {
  312 + String uid = '';
  313 + List<FilterBtnModel> tempfilterManage =
  314 + List.from(customerProvider.filterManageList);
  315 + if (tempfilterManage.length > 0) {
  316 + tempfilterManage.removeAt(0);
  317 + }
  318 + for (FilterBtnModel item in tempfilterManage) {
  319 + if (item.select) {
  320 + uid += '${item.id},';
301 } 321 }
  322 + }
302 323
303 - if (uid.length > 0) {  
304 - if (uid.endsWith(',')) {  
305 - uid = uid.substring(0, uid.length - 1);  
306 - }  
307 - params['uid'] = uid; 324 + if (uid.length > 0) {
  325 + if (uid.endsWith(',')) {
  326 + uid = uid.substring(0, uid.length - 1);
308 } 327 }
  328 + params['uid'] = uid;
309 } 329 }
  330 + // }
310 331
311 // if (customerProvider.controllerstime.text.trim().length > 0) { 332 // if (customerProvider.controllerstime.text.trim().length > 0) {
312 // params['stime'] = customerProvider.controllerstime.text; 333 // params['stime'] = customerProvider.controllerstime.text;
@@ -357,16 +378,16 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -357,16 +378,16 @@ class _CustomerListPageState extends State<CustomerListPage>
357 } 378 }
358 } 379 }
359 print(customerProvider.filterManageList); 380 print(customerProvider.filterManageList);
360 - if (first) {  
361 - if (distribution) {  
362 - params['distribution'] = '1';  
363 - }  
364 - } else {  
365 - if (customerProvider.filterManageList.length > 0 &&  
366 - customerProvider.filterManageList[0].select) {  
367 - params['distribution'] = '1';  
368 - } 381 + // if (first) {
  382 + // if (distribution) {
  383 + // params['distribution'] = '1';
  384 + // }
  385 + // } else {
  386 + if (customerProvider.filterManageList.length > 0 &&
  387 + customerProvider.filterManageList[0].select) {
  388 + params['distribution'] = '1';
369 } 389 }
  390 + // }
370 391
371 await customerProvider.getCustomerBySeller(context, params, 392 await customerProvider.getCustomerBySeller(context, params,
372 showLoading: load); 393 showLoading: load);
@@ -377,9 +398,9 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -377,9 +398,9 @@ class _CustomerListPageState extends State<CustomerListPage>
377 // customerProvider.checkValue = false; 398 // customerProvider.checkValue = false;
378 // } 399 // }
379 // if (first || customerProvider.checkValue) { 400 // if (first || customerProvider.checkValue) {
380 - if (first) {  
381 - customerProvider.addAll();  
382 - } 401 + // if (first) {
  402 + // customerProvider.addAll();
  403 + // }
383 } 404 }
384 405
385 // ///选中的联系人widget 406 // ///选中的联系人widget
@@ -557,14 +578,14 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -557,14 +578,14 @@ class _CustomerListPageState extends State<CustomerListPage>
557 // _searchSellerLocation(); 578 // _searchSellerLocation();
558 // customerProvider.searchData(value); 579 // customerProvider.searchData(value);
559 page = 1; 580 page = 1;
560 - pageData = []; 581 + customerProvider.pageData = [];
561 _getContantData(showLoading: false); 582 _getContantData(showLoading: false);
562 }, 583 },
563 onEditingComplete: () { 584 onEditingComplete: () {
564 FocusScope.of(context) 585 FocusScope.of(context)
565 .requestFocus(FocusNode()); //点击空白处隐藏键盘 586 .requestFocus(FocusNode()); //点击空白处隐藏键盘
566 page = 1; 587 page = 1;
567 - pageData = []; 588 + customerProvider.pageData = [];
568 _getContantData(showLoading: false); 589 _getContantData(showLoading: false);
569 // contantShowModel.searchData( 590 // contantShowModel.searchData(
570 // contantShowModel.controller.text); 591 // contantShowModel.controller.text);
@@ -595,7 +616,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -595,7 +616,7 @@ class _CustomerListPageState extends State<CustomerListPage>
595 FocusScope.of(context) 616 FocusScope.of(context)
596 .requestFocus(FocusNode()); //点击空白处隐藏键盘 617 .requestFocus(FocusNode()); //点击空白处隐藏键盘
597 page = 1; 618 page = 1;
598 - pageData = []; 619 + customerProvider.pageData = [];
599 _getContantData(showLoading: false); 620 _getContantData(showLoading: false);
600 // customerProvider.searchData(''); 621 // customerProvider.searchData('');
601 })); 622 }));
@@ -780,7 +801,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -780,7 +801,7 @@ class _CustomerListPageState extends State<CustomerListPage>
780 showFilter = false; 801 showFilter = false;
781 }); 802 });
782 page = 1; 803 page = 1;
783 - pageData = []; 804 + customerProvider.pageData = [];
784 _getContantData(); 805 _getContantData();
785 }, tapWhiteBack: () { 806 }, tapWhiteBack: () {
786 Navigator.of(context).pop(); 807 Navigator.of(context).pop();
@@ -1631,7 +1652,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -1631,7 +1652,7 @@ class _CustomerListPageState extends State<CustomerListPage>
1631 model.pageState = PageState.Loading; 1652 model.pageState = PageState.Loading;
1632 model.notifyListeners(); 1653 model.notifyListeners();
1633 page = 1; 1654 page = 1;
1634 - pageData = []; 1655 + customerProvider.pageData = [];
1635 _getContantData(); 1656 _getContantData();
1636 }, 1657 },
1637 emptyMsg: "暂时没有客户哦", 1658 emptyMsg: "暂时没有客户哦",
@@ -89,6 +89,8 @@ class CustomerProvider extends ChangeNotifier { @@ -89,6 +89,8 @@ class CustomerProvider extends ChangeNotifier {
89 bool manageSelAll = false; 89 bool manageSelAll = false;
90 List<FilterBtnModel> filterManageList = []; //经理 90 List<FilterBtnModel> filterManageList = []; //经理
91 91
  92 + List pageData = [];
  93 + List pageDataMy = [];
92 //获取全选按钮的状态 true or false 94 //获取全选按钮的状态 true or false
93 getCheckhydSelAll() { 95 getCheckhydSelAll() {
94 bool temp = filterHydList.any((value) { 96 bool temp = filterHydList.any((value) {
@@ -390,12 +392,26 @@ class CustomerProvider extends ChangeNotifier { @@ -390,12 +392,26 @@ class CustomerProvider extends ChangeNotifier {
390 break; 392 break;
391 } 393 }
392 } 394 }
  395 + String page = params['page'];
  396 + int pageInt = int.parse(page) - 1;
  397 + if (pageDataMy.contains(pageInt)) {
  398 + pageDataMy.remove(pageInt);
  399 + }
  400 +
393 notifyListeners(); 401 notifyListeners();
394 }); 402 });
395 if (baseResp != null && baseResp.code == Constant.status_success) { 403 if (baseResp != null && baseResp.code == Constant.status_success) {
396 // userHistorys = CustomerListModel.fromJson(baseResp.responseData).data; 404 // userHistorys = CustomerListModel.fromJson(baseResp.responseData).data;
397 if (params['page'] == '1') { 405 if (params['page'] == '1') {
398 - userHistorys = CustomerListModel.fromJson(baseResp.responseData).data; 406 + // userHistorys = CustomerListModel.fromJson(baseResp.responseData).data;
  407 + selectCustomer = [];
  408 + List<CustomerListSunModel> temp =
  409 + CustomerListModel.fromJson(baseResp.responseData).data;
  410 + List<CustomerListSunModel> temp1 = await addDataSelectMy(temp);
  411 + userHistorys = temp1;
  412 +
  413 + getCheckValueMy();
  414 + labelsValueMy();
399 if (userHistorys.length == 0) { 415 if (userHistorys.length == 0) {
400 pageState = PageState.Empty; 416 pageState = PageState.Empty;
401 } else { 417 } else {
@@ -403,8 +419,15 @@ class CustomerProvider extends ChangeNotifier { @@ -403,8 +419,15 @@ class CustomerProvider extends ChangeNotifier {
403 } 419 }
404 } else { 420 } else {
405 pageState = PageState.Success; 421 pageState = PageState.Success;
406 - userHistorys  
407 - .addAll(CustomerListModel.fromJson(baseResp.responseData).data); 422 + // userHistorys
  423 + // .addAll(CustomerListModel.fromJson(baseResp.responseData).data);
  424 + List<CustomerListSunModel> temp =
  425 + CustomerListModel.fromJson(baseResp.responseData).data;
  426 + List<CustomerListSunModel> temp1 = await addDataSelectMy(temp);
  427 + userHistorys.addAll(temp1);
  428 +
  429 + getCheckValueMy();
  430 + labelsValueMy();
408 } 431 }
409 if (userHistorys.length > 0) { 432 if (userHistorys.length > 0) {
410 List<String> idList = []; 433 List<String> idList = [];
@@ -445,6 +468,12 @@ class CustomerProvider extends ChangeNotifier { @@ -445,6 +468,12 @@ class CustomerProvider extends ChangeNotifier {
445 myHandleList(userHistorys, needRefresh: true); 468 myHandleList(userHistorys, needRefresh: true);
446 } 469 }
447 notifyListeners(); 470 notifyListeners();
  471 + } else {
  472 + String page = params['page'];
  473 + int pageInt = int.parse(page) - 1;
  474 + if (pageDataMy.contains(pageInt)) {
  475 + pageDataMy.remove(pageInt);
  476 + }
448 } 477 }
449 // if (baseResp != null && baseResp.code == Constant.status_success) { 478 // if (baseResp != null && baseResp.code == Constant.status_success) {
450 // userHistorys = baseResp.data.map<CustomerListSunModel>((value) { 479 // userHistorys = baseResp.data.map<CustomerListSunModel>((value) {
@@ -907,6 +936,24 @@ class CustomerProvider extends ChangeNotifier { @@ -907,6 +936,24 @@ class CustomerProvider extends ChangeNotifier {
907 notifyListeners(); 936 notifyListeners();
908 } 937 }
909 938
  939 + Future<List<CustomerListSunModel>> addDataSelectMy(
  940 + List<CustomerListSunModel> data) async {
  941 + //把数据状态全部改成true,即选中状态
  942 + // selectCustomerSeller = [];
  943 + // for (var i = 0; i < data.length; i++) {
  944 + // if (data[i].gid != null) {
  945 + // data[i].select = true;
  946 + // selectCustomer.add(data[i]);
  947 + // }
  948 + // }
  949 + for (var i = 0; i < data.length; i++) {
  950 + data[i].select = true;
  951 + selectCustomer.add(data[i]);
  952 + }
  953 +
  954 + return data;
  955 + }
  956 +
910 labelsValueMy() { 957 labelsValueMy() {
911 List<String> tempLabel = []; 958 List<String> tempLabel = [];
912 for (CustomerListSunModel item in userHistorys) { 959 for (CustomerListSunModel item in userHistorys) {
@@ -1374,6 +1421,21 @@ class CustomerProvider extends ChangeNotifier { @@ -1374,6 +1421,21 @@ class CustomerProvider extends ChangeNotifier {
1374 notifyListeners(); 1421 notifyListeners();
1375 } 1422 }
1376 1423
  1424 + //
  1425 + Future<List<CustomerBySellerSunModel>> addDataSelect(
  1426 + List<CustomerBySellerSunModel> data) async {
  1427 + //把数据状态全部改成true,即选中状态
  1428 + // selectCustomerSeller = [];
  1429 + for (var i = 0; i < data.length; i++) {
  1430 + if (data[i].gid != null) {
  1431 + data[i].select = true;
  1432 + selectCustomerSeller.add(data[i]);
  1433 + }
  1434 + }
  1435 +
  1436 + return data;
  1437 + }
  1438 +
1377 labelsValue() { 1439 labelsValue() {
1378 List<String> tempLabel = []; 1440 List<String> tempLabel = [];
1379 for (CustomerBySellerSunModel item in customerBySellerList) { 1441 for (CustomerBySellerSunModel item in customerBySellerList) {
@@ -1456,12 +1518,24 @@ class CustomerProvider extends ChangeNotifier { @@ -1456,12 +1518,24 @@ class CustomerProvider extends ChangeNotifier {
1456 break; 1518 break;
1457 } 1519 }
1458 } 1520 }
  1521 + String page = params['page'];
  1522 + int pageInt = int.parse(page) - 1;
  1523 + if (pageData.contains(pageInt)) {
  1524 + pageData.remove(pageInt);
  1525 + }
  1526 +
1459 notifyListeners(); 1527 notifyListeners();
1460 }); 1528 });
1461 if (baseResp != null && baseResp.code == Constant.status_success) { 1529 if (baseResp != null && baseResp.code == Constant.status_success) {
1462 if (params['page'] == '1') { 1530 if (params['page'] == '1') {
1463 - customerBySellerList = 1531 + selectCustomerSeller = [];
  1532 + List<CustomerBySellerSunModel> temp =
1464 CustomerBySellerModel.fromJson(baseResp.responseData).data; 1533 CustomerBySellerModel.fromJson(baseResp.responseData).data;
  1534 + List<CustomerBySellerSunModel> temp1 = await addDataSelect(temp);
  1535 + customerBySellerList = temp1;
  1536 + getCheckValue();
  1537 + labelsValue();
  1538 + // notifyListeners();
1465 if (customerBySellerList.length == 0) { 1539 if (customerBySellerList.length == 0) {
1466 pageState = PageState.Empty; 1540 pageState = PageState.Empty;
1467 } else { 1541 } else {
@@ -1469,8 +1543,12 @@ class CustomerProvider extends ChangeNotifier { @@ -1469,8 +1543,12 @@ class CustomerProvider extends ChangeNotifier {
1469 } 1543 }
1470 } else { 1544 } else {
1471 pageState = PageState.Success; 1545 pageState = PageState.Success;
1472 - customerBySellerList  
1473 - .addAll(CustomerBySellerModel.fromJson(baseResp.responseData).data); 1546 + List<CustomerBySellerSunModel> temp =
  1547 + CustomerBySellerModel.fromJson(baseResp.responseData).data;
  1548 + List<CustomerBySellerSunModel> temp1 = await addDataSelect(temp);
  1549 + customerBySellerList.addAll(temp1);
  1550 + getCheckValue();
  1551 + labelsValue();
1474 } 1552 }
1475 1553
1476 if (customerBySellerList.length > 0) { 1554 if (customerBySellerList.length > 0) {
@@ -1539,6 +1617,12 @@ class CustomerProvider extends ChangeNotifier { @@ -1539,6 +1617,12 @@ class CustomerProvider extends ChangeNotifier {
1539 handleList(customerBySellerList, needRefresh: true); 1617 handleList(customerBySellerList, needRefresh: true);
1540 } 1618 }
1541 notifyListeners(); 1619 notifyListeners();
  1620 + } else {
  1621 + String page = params['page'];
  1622 + int pageInt = int.parse(page) - 1;
  1623 + if (pageData.contains(pageInt)) {
  1624 + pageData.remove(pageInt);
  1625 + }
1542 } 1626 }
1543 } 1627 }
1544 1628