Commit 8d11270f166d20cbc27bcf7bf12f74dd7ca17d4c

Authored by weixin_45529955
1 parent bb48e780

客情筛选UI确定按钮逻辑错误

1 -  
2 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
3 2
4 import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -51,8 +50,7 @@ class MyCustomerListPage extends StatefulWidget { @@ -51,8 +50,7 @@ class MyCustomerListPage extends StatefulWidget {
51 } 50 }
52 51
53 class _MyCustomerListPageState extends State<MyCustomerListPage> 52 class _MyCustomerListPageState extends State<MyCustomerListPage>
54 - with TickerProviderStateMixin  
55 - { 53 + with TickerProviderStateMixin {
56 late List _tabBarTitle; 54 late List _tabBarTitle;
57 TabController? tabController; 55 TabController? tabController;
58 56
@@ -127,7 +125,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -127,7 +125,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
127 bool first = true; 125 bool first = true;
128 customerProvider!.index = tabController!.index; 126 customerProvider!.index = tabController!.index;
129 if (widget.fromPage == FromPage.FromPageMakeRecord) { 127 if (widget.fromPage == FromPage.FromPageMakeRecord) {
130 - customerProvider!.selectCustomer = customerMakingProvider.selectCustomer; 128 + customerProvider!.selectCustomer =
  129 + customerMakingProvider.selectCustomer;
131 customerProvider!.labels = customerMakingProvider.labels; 130 customerProvider!.labels = customerMakingProvider.labels;
132 first = false; 131 first = false;
133 } 132 }
@@ -350,8 +349,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -350,8 +349,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
350 // params['reserve_num'] 时间内预定次数 349 // params['reserve_num'] 时间内预定次数
351 // params['reserve_sort'] 1 等于 2 小于 3 大于 350 // params['reserve_sort'] 1 等于 2 小于 3 大于
352 351
353 - await customerProvider!.getCustomerList(context, params,  
354 - load: load, labels: widget.labels); 352 + await customerProvider!
  353 + .getCustomerList(context, params, load: load, labels: widget.labels);
355 354
356 print(first); 355 print(first);
357 // if (customerProvider.userHistorys.length == 356 // if (customerProvider.userHistorys.length ==
@@ -618,53 +617,51 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -618,53 +617,51 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
618 // )) 617 // ))
619 ]))); 618 ])));
620 } 619 }
621 - _filterMethod(){  
622 - Navigator.of(context).pop();  
623 - if (customerProvider!.hydSelAll) {  
624 - //全选,默认全部  
625 - tabController!.index = 0;  
626 - customerProvider!.index = 0;  
627 - } else {  
628 - int tag = 0; //有几个选中的项目  
629 - for (FilterBtnModel value  
630 - in customerProvider!.filterHydList) {  
631 - if (value.select!) {  
632 - tag++;  
633 - }  
634 - }  
635 - if (tag == 0) {  
636 - //全不选,默认全部  
637 - tabController!.index = 0;  
638 - customerProvider!.index = 0;  
639 - } else if (tag == 1) {  
640 - for (FilterBtnModel value  
641 - in customerProvider!.filterHydList) {  
642 - if (value.select!) {  
643 - if (value.title == '活跃') {  
644 - tabController!.index = 1;  
645 - customerProvider!.index = 1;  
646 - } else if (value.title == '沉睡') {  
647 - tabController!.index = 2;  
648 - customerProvider!.index = 2;  
649 - } else if (value.title == '流失') {  
650 - tabController!.index = 3;  
651 - customerProvider!.index = 3;  
652 - }  
653 - }  
654 - }  
655 - } else if (tag == 2) {  
656 - //选中2个的,默认全部  
657 - tabController!.index = 0;  
658 - customerProvider!.index = 0;  
659 - }  
660 - }  
661 - setState(() {  
662 - showFilter = false;  
663 - });  
664 - page = 1;  
665 - customerProvider!.pageDataMy = [];  
666 - _getContantData();  
667 - 620 +
  621 + _filterMethod() {
  622 + Navigator.of(context).pop();
  623 + if (customerProvider!.hydSelAll) {
  624 + //全选,默认全部
  625 + tabController!.index = 0;
  626 + customerProvider!.index = 0;
  627 + } else {
  628 + int tag = 0; //有几个选中的项目
  629 + for (FilterBtnModel value in customerProvider!.filterHydList) {
  630 + if (value.select!) {
  631 + tag++;
  632 + }
  633 + }
  634 + if (tag == 0) {
  635 + //全不选,默认全部
  636 + tabController!.index = 0;
  637 + customerProvider!.index = 0;
  638 + } else if (tag == 1) {
  639 + for (FilterBtnModel value in customerProvider!.filterHydList) {
  640 + if (value.select!) {
  641 + if (value.title == '活跃') {
  642 + tabController!.index = 1;
  643 + customerProvider!.index = 1;
  644 + } else if (value.title == '沉睡') {
  645 + tabController!.index = 2;
  646 + customerProvider!.index = 2;
  647 + } else if (value.title == '流失') {
  648 + tabController!.index = 3;
  649 + customerProvider!.index = 3;
  650 + }
  651 + }
  652 + }
  653 + } else if (tag == 2) {
  654 + //选中2个的,默认全部
  655 + tabController!.index = 0;
  656 + customerProvider!.index = 0;
  657 + }
  658 + }
  659 + setState(() {
  660 + showFilter = false;
  661 + });
  662 + page = 1;
  663 + customerProvider!.pageDataMy = [];
  664 + _getContantData();
668 } 665 }
669 666
670 Widget _menuWidget() { 667 Widget _menuWidget() {
@@ -774,7 +771,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -774,7 +771,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
774 // return; 771 // return;
775 // } 772 // }
776 // } 773 // }
777 - bool temp = customerProvider!.filterDayList.any((value) { 774 + bool temp = customerProvider!.filterDayList.any((value) {
778 return value.select == true; 775 return value.select == true;
779 }); 776 });
780 if (customerProvider!.controllerstime.text.trim().length > 777 if (customerProvider!.controllerstime.text.trim().length >
@@ -791,7 +788,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -791,7 +788,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
791 Utils.showToast('请输入开始天数'); 788 Utils.showToast('请输入开始天数');
792 return; 789 return;
793 } 790 }
794 - bool isGet = false; 791 +
795 if (temp == true || 792 if (temp == true ||
796 (customerProvider!.controllerstime.text.trim().length > 793 (customerProvider!.controllerstime.text.trim().length >
797 0 && 794 0 &&
@@ -799,7 +796,6 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -799,7 +796,6 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
799 .trim() 796 .trim()
800 .length > 797 .length >
801 0)) { 798 0)) {
802 - isGet = true;  
803 //选择了天数,则必须选择次数 799 //选择了天数,则必须选择次数
804 if (customerProvider!.controllernum.text.trim().length == 800 if (customerProvider!.controllernum.text.trim().length ==
805 0) { 801 0) {
@@ -809,8 +805,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -809,8 +805,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
809 // 请求筛选 805 // 请求筛选
810 _filterMethod(); 806 _filterMethod();
811 } 807 }
812 - }  
813 - if (!isGet) { 808 + } else {
814 if (customerProvider!.controllernum.text.trim().length > 809 if (customerProvider!.controllernum.text.trim().length >
815 0) { 810 0) {
816 //选择了预定次数 811 //选择了预定次数
@@ -829,6 +824,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -829,6 +824,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
829 Utils.showToast('请选择时间'); 824 Utils.showToast('请选择时间');
830 return; 825 return;
831 } 826 }
  827 + } else {
  828 + _filterMethod();
832 } 829 }
833 // if (customerProvider.controllernum.text.trim().length > 830 // if (customerProvider.controllernum.text.trim().length >
834 // 0) { 831 // 0) {
@@ -836,7 +833,6 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -836,7 +833,6 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
836 // return; 833 // return;
837 // } 834 // }
838 } 835 }
839 -  
840 }, tapWhiteBack: () { 836 }, tapWhiteBack: () {
841 Navigator.of(context).pop(); 837 Navigator.of(context).pop();
842 setState(() { 838 setState(() {
@@ -1275,7 +1271,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -1275,7 +1271,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
1275 Expanded( 1271 Expanded(
1276 child: _textFeildWidget(customerProvider!.controllerstime, 1272 child: _textFeildWidget(customerProvider!.controllerstime,
1277 customerProvider!.stimeFocus, state, (value) { 1273 customerProvider!.stimeFocus, state, (value) {
1278 - for (FilterBtnModel value in customerProvider!.filterDayList) { 1274 + for (FilterBtnModel value
  1275 + in customerProvider!.filterDayList) {
1279 value.select = false; 1276 value.select = false;
1280 } 1277 }
1281 // customerProvider.controllernum.text = ''; 1278 // customerProvider.controllernum.text = '';
@@ -1291,7 +1288,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> @@ -1291,7 +1288,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
1291 Expanded( 1288 Expanded(
1292 child: _textFeildWidget(customerProvider!.controlleretime, 1289 child: _textFeildWidget(customerProvider!.controlleretime,
1293 customerProvider!.etimeFocus, state, (value) { 1290 customerProvider!.etimeFocus, state, (value) {
1294 - for (FilterBtnModel value in customerProvider!.filterDayList) { 1291 + for (FilterBtnModel value
  1292 + in customerProvider!.filterDayList) {
1295 value.select = false; 1293 value.select = false;
1296 } 1294 }
1297 // customerProvider.controllernum.text = ''; 1295 // customerProvider.controllernum.text = '';
1 -  
2 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
3 import 'package:flutter_easyrefresh/easy_refresh.dart'; 2 import 'package:flutter_easyrefresh/easy_refresh.dart';
4 3
@@ -58,8 +57,7 @@ class CustomerListPage extends StatefulWidget { @@ -58,8 +57,7 @@ class CustomerListPage extends StatefulWidget {
58 } 57 }
59 58
60 class _CustomerListPageState extends State<CustomerListPage> 59 class _CustomerListPageState extends State<CustomerListPage>
61 - with TickerProviderStateMixin  
62 - { 60 + with TickerProviderStateMixin {
63 late List _tabBarTitle; 61 late List _tabBarTitle;
64 TabController? tabController; 62 TabController? tabController;
65 63
@@ -85,7 +83,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -85,7 +83,7 @@ class _CustomerListPageState extends State<CustomerListPage>
85 _tabBarTitle = ['全部', '活跃', '沉睡', '流失']; 83 _tabBarTitle = ['全部', '活跃', '沉睡', '流失'];
86 // timeTilte = ['大于', '等于', '小于']; 84 // timeTilte = ['大于', '等于', '小于'];
87 super.initState(); 85 super.initState();
88 - tabController = TabController(length: 4,vsync: this); 86 + tabController = TabController(length: 4, vsync: this);
89 tabController!.index = int.parse(widget.index!); 87 tabController!.index = int.parse(widget.index!);
90 tabController!.addListener(() { 88 tabController!.addListener(() {
91 if (tabController!.index == tabController!.animation!.value) { 89 if (tabController!.index == tabController!.animation!.value) {
@@ -416,8 +414,8 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -416,8 +414,8 @@ class _CustomerListPageState extends State<CustomerListPage>
416 } 414 }
417 // } 415 // }
418 416
419 - await customerProvider!.getCustomerBySeller(context, params,  
420 - showLoading: load); 417 + await customerProvider!
  418 + .getCustomerBySeller(context, params, showLoading: load);
421 print(first); // if (customerProvider.customerBySellerList.length == 419 print(first); // if (customerProvider.customerBySellerList.length ==
422 // customerProvider.selectCustomerSeller.length) { 420 // customerProvider.selectCustomerSeller.length) {
423 // customerProvider.checkValue = true; 421 // customerProvider.checkValue = true;
@@ -829,7 +827,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -829,7 +827,7 @@ class _CustomerListPageState extends State<CustomerListPage>
829 Utils.showToast('请输入开始天数'); 827 Utils.showToast('请输入开始天数');
830 return; 828 return;
831 } 829 }
832 - bool isGet = false; 830 +
833 if (temp == true || 831 if (temp == true ||
834 (customerProvider!.controllerstime.text.trim().length > 832 (customerProvider!.controllerstime.text.trim().length >
835 0 && 833 0 &&
@@ -837,7 +835,8 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -837,7 +835,8 @@ class _CustomerListPageState extends State<CustomerListPage>
837 .trim() 835 .trim()
838 .length > 836 .length >
839 0)) { 837 0)) {
840 - isGet = true; 838 + //选择了自定义时间
  839 +
841 //选择了天数,则必须选择次数 840 //选择了天数,则必须选择次数
842 if (customerProvider!.controllernum.text.trim().length == 841 if (customerProvider!.controllernum.text.trim().length ==
843 0) { 842 0) {
@@ -847,8 +846,7 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -847,8 +846,7 @@ class _CustomerListPageState extends State<CustomerListPage>
847 // 请求筛选 846 // 请求筛选
848 _filterMethod(); 847 _filterMethod();
849 } 848 }
850 - }  
851 - if (!isGet) { 849 + } else {
852 if (customerProvider!.controllernum.text.trim().length > 850 if (customerProvider!.controllernum.text.trim().length >
853 0) { 851 0) {
854 //选择了预定次数 852 //选择了预定次数
@@ -867,6 +865,8 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -867,6 +865,8 @@ class _CustomerListPageState extends State<CustomerListPage>
867 Utils.showToast('请选择时间'); 865 Utils.showToast('请选择时间');
868 return; 866 return;
869 } 867 }
  868 + } else {
  869 + _filterMethod();
870 } 870 }
871 // if (customerProvider.controllernum.text.trim().length > 871 // if (customerProvider.controllernum.text.trim().length >
872 // 0) { 872 // 0) {
@@ -1359,7 +1359,8 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -1359,7 +1359,8 @@ class _CustomerListPageState extends State<CustomerListPage>
1359 Expanded( 1359 Expanded(
1360 child: _textFeildWidget(customerProvider!.controllerstime, 1360 child: _textFeildWidget(customerProvider!.controllerstime,
1361 customerProvider!.stimeFocus, state, (value) { 1361 customerProvider!.stimeFocus, state, (value) {
1362 - for (FilterBtnModel value in customerProvider!.filterDayList) { 1362 + for (FilterBtnModel value
  1363 + in customerProvider!.filterDayList) {
1363 value.select = false; 1364 value.select = false;
1364 } 1365 }
1365 // customerProvider.controllernum.text = ''; 1366 // customerProvider.controllernum.text = '';
@@ -1374,7 +1375,8 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -1374,7 +1375,8 @@ class _CustomerListPageState extends State<CustomerListPage>
1374 Expanded( 1375 Expanded(
1375 child: _textFeildWidget(customerProvider!.controlleretime, 1376 child: _textFeildWidget(customerProvider!.controlleretime,
1376 customerProvider!.etimeFocus, state, (value) { 1377 customerProvider!.etimeFocus, state, (value) {
1377 - for (FilterBtnModel value in customerProvider!.filterDayList) { 1378 + for (FilterBtnModel value
  1379 + in customerProvider!.filterDayList) {
1378 value.select = false; 1380 value.select = false;
1379 } 1381 }
1380 // customerProvider.controllernum.text = ''; 1382 // customerProvider.controllernum.text = '';
@@ -1907,7 +1909,6 @@ class _CustomerListPageState extends State<CustomerListPage> @@ -1907,7 +1909,6 @@ class _CustomerListPageState extends State<CustomerListPage>
1907 // }, childCount: 1), 1909 // }, childCount: 1),
1908 // ) 1910 // )
1909 // ], 1911 // ],
1910 -  
1911 } 1912 }
1912 })); 1913 }));
1913 } 1914 }