Showing
9 changed files
with
253 additions
and
48 deletions
| @@ -16,17 +16,17 @@ if (flutterRoot == null) { | @@ -16,17 +16,17 @@ if (flutterRoot == null) { | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | -def flutterVersionCode = "494" | 19 | +def flutterVersionCode = "495" |
| 20 | if (flutterVersionCode == null) { | 20 | if (flutterVersionCode == null) { |
| 21 | - flutterVersionCode = '494' | 21 | + flutterVersionCode = '495' |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | -def flutterVersionName = "4.9.4" | 27 | +def flutterVersionName = "4.9.5" |
| 28 | if (flutterVersionName == null) { | 28 | if (flutterVersionName == null) { |
| 29 | - flutterVersionName = '4.9.4' | 29 | + flutterVersionName = '4.9.5' |
| 30 | 30 | ||
| 31 | } | 31 | } |
| 32 | 32 |
| @@ -521,7 +521,7 @@ class MessageItemF extends StatelessWidget { | @@ -521,7 +521,7 @@ class MessageItemF extends StatelessWidget { | ||
| 521 | BorderRadius.circular(8)), | 521 | BorderRadius.circular(8)), |
| 522 | child: Text( | 522 | child: Text( |
| 523 | '${message.room_info}', | 523 | '${message.room_info}', |
| 524 | - maxLines: 1, | 524 | + maxLines: 2, |
| 525 | overflow: TextOverflow.ellipsis, | 525 | overflow: TextOverflow.ellipsis, |
| 526 | style: TextStyle( | 526 | style: TextStyle( |
| 527 | color: MyColours.color_ffffff, | 527 | color: MyColours.color_ffffff, |
| @@ -542,7 +542,7 @@ class MessageItemF extends StatelessWidget { | @@ -542,7 +542,7 @@ class MessageItemF extends StatelessWidget { | ||
| 542 | BorderRadius.circular(8)), | 542 | BorderRadius.circular(8)), |
| 543 | child: Text( | 543 | child: Text( |
| 544 | '${message.room_demand}', | 544 | '${message.room_demand}', |
| 545 | - maxLines: 1, | 545 | + maxLines: 2, |
| 546 | overflow: TextOverflow.ellipsis, | 546 | overflow: TextOverflow.ellipsis, |
| 547 | style: TextStyle( | 547 | style: TextStyle( |
| 548 | color: MyColours.color_ffffff, | 548 | color: MyColours.color_ffffff, |
| @@ -109,7 +109,7 @@ class MessagePageState extends State<MessagePage> | @@ -109,7 +109,7 @@ class MessagePageState extends State<MessagePage> | ||
| 109 | super.dispose(); | 109 | super.dispose(); |
| 110 | messageModel.pageStateUn = PageState.Loading; | 110 | messageModel.pageStateUn = PageState.Loading; |
| 111 | messageModel.pageState = PageState.Loading; | 111 | messageModel.pageState = PageState.Loading; |
| 112 | - messageModel.notifyListeners(); | 112 | + // messageModel.notifyListeners(); |
| 113 | bus.off("refresh_untreated_num"); | 113 | bus.off("refresh_untreated_num"); |
| 114 | bus.off("remove_untreated_message"); | 114 | bus.off("remove_untreated_message"); |
| 115 | } | 115 | } |
| @@ -54,6 +54,9 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | @@ -54,6 +54,9 @@ 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; | ||
| 59 | + | ||
| 57 | @override | 60 | @override |
| 58 | void initState() { | 61 | void initState() { |
| 59 | _tabBarTitle = ['全部', '活跃', '沉睡', '流失']; | 62 | _tabBarTitle = ['全部', '活跃', '沉睡', '流失']; |
| @@ -83,7 +86,15 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | @@ -83,7 +86,15 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | ||
| 83 | // item.select = true; | 86 | // item.select = true; |
| 84 | // // item.select = false; | 87 | // // item.select = false; |
| 85 | // } | 88 | // } |
| 89 | + for (FilterBtnModel item in customerProvider.filterHydList) { | ||
| 90 | + item.select = false; | ||
| 91 | + // if (item.id == '${customerProvider.index}') { | ||
| 92 | + // item.select = true; | ||
| 93 | + // } | ||
| 94 | + } | ||
| 86 | } | 95 | } |
| 96 | + page = 1; | ||
| 97 | + pageData = []; | ||
| 87 | _getContantData(first: true); | 98 | _getContantData(first: true); |
| 88 | } | 99 | } |
| 89 | }); | 100 | }); |
| @@ -103,20 +114,48 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | @@ -103,20 +114,48 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | ||
| 103 | // // item.select = false; | 114 | // // item.select = false; |
| 104 | // } | 115 | // } |
| 105 | // } | 116 | // } |
| 117 | + page = 1; | ||
| 118 | + | ||
| 106 | _getContantData(first: first); | 119 | _getContantData(first: first); |
| 107 | _filterLabelList(); | 120 | _filterLabelList(); |
| 108 | }); | 121 | }); |
| 109 | bus.on("refresh_guest_list_my", (arg) { | 122 | bus.on("refresh_guest_list_my", (arg) { |
| 110 | _getContantData(); | 123 | _getContantData(); |
| 111 | }); | 124 | }); |
| 125 | + bus.on("onload_guest_list_my", (arg) { | ||
| 126 | + print(arg); | ||
| 127 | + if (!pageData.contains(arg)) { | ||
| 128 | + pageData.add(arg); | ||
| 129 | + pageData.removeWhere((element) => element == 0); | ||
| 130 | + _onload(); | ||
| 131 | + } | ||
| 132 | + }); | ||
| 133 | + bus.on("onrefresh_guest_list_my", (arg) { | ||
| 134 | + if (!pageData.contains(0)) { | ||
| 135 | + _onrefresh(); | ||
| 136 | + } | ||
| 137 | + }); | ||
| 112 | } | 138 | } |
| 113 | 139 | ||
| 114 | @override | 140 | @override |
| 115 | void dispose() { | 141 | void dispose() { |
| 116 | bus.off('refresh_guest_list_my'); | 142 | bus.off('refresh_guest_list_my'); |
| 143 | + bus.off('onload_guest_list_my'); | ||
| 144 | + bus.off('onrefresh_guest_list_my'); | ||
| 117 | super.dispose(); | 145 | super.dispose(); |
| 118 | } | 146 | } |
| 119 | 147 | ||
| 148 | + _onload() { | ||
| 149 | + page++; | ||
| 150 | + _getContantData(showLoading: false, load: true); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + _onrefresh() { | ||
| 154 | + page = 1; | ||
| 155 | + pageData = [0]; | ||
| 156 | + _getContantData(showLoading: false); | ||
| 157 | + } | ||
| 158 | + | ||
| 120 | _filterLabelList() async { | 159 | _filterLabelList() async { |
| 121 | await customerProvider.getLabelBySellerid(context); | 160 | await customerProvider.getLabelBySellerid(context); |
| 122 | customerProvider.filterLabelList = []; | 161 | customerProvider.filterLabelList = []; |
| @@ -137,13 +176,16 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | @@ -137,13 +176,16 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | ||
| 137 | } | 176 | } |
| 138 | } | 177 | } |
| 139 | 178 | ||
| 140 | - _getContantData({bool showLoading = true, bool first = false}) async { | 179 | + _getContantData( |
| 180 | + {bool showLoading = true, bool first = false, bool load = false}) async { | ||
| 141 | if (showLoading) { | 181 | if (showLoading) { |
| 142 | customerProvider.pageState = PageState.Loading; | 182 | customerProvider.pageState = PageState.Loading; |
| 143 | } | 183 | } |
| 144 | customerProvider.notifyListeners(); | 184 | customerProvider.notifyListeners(); |
| 145 | Map<String, String> params = { | 185 | Map<String, String> params = { |
| 146 | "uid": Provider.of<UserModel>(context, listen: false).user.openid, | 186 | "uid": Provider.of<UserModel>(context, listen: false).user.openid, |
| 187 | + "page": page.toString(), | ||
| 188 | + "offset": '10' | ||
| 147 | }; | 189 | }; |
| 148 | if (customerProvider.index != 0 && customerProvider.index != null) { | 190 | if (customerProvider.index != 0 && customerProvider.index != null) { |
| 149 | //1 活跃 2 沉睡 3 流失 | 191 | //1 活跃 2 沉睡 3 流失 |
| @@ -237,7 +279,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | @@ -237,7 +279,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | ||
| 237 | // params['reserve_num'] 时间内预定次数 | 279 | // params['reserve_num'] 时间内预定次数 |
| 238 | // params['reserve_sort'] 1 等于 2 小于 3 大于 | 280 | // params['reserve_sort'] 1 等于 2 小于 3 大于 |
| 239 | 281 | ||
| 240 | - await customerProvider.getCustomerList(context, params); | 282 | + await customerProvider.getCustomerList(context, params, load: load); |
| 241 | 283 | ||
| 242 | print(first); | 284 | print(first); |
| 243 | // if (customerProvider.userHistorys.length == | 285 | // if (customerProvider.userHistorys.length == |
| @@ -426,11 +468,15 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | @@ -426,11 +468,15 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | ||
| 426 | // setState(() {}); | 468 | // setState(() {}); |
| 427 | // _searchSellerLocation(); | 469 | // _searchSellerLocation(); |
| 428 | // customerProvider.searchData(value); | 470 | // customerProvider.searchData(value); |
| 471 | + page = 1; | ||
| 472 | + pageData = []; | ||
| 429 | _getContantData(showLoading: false); | 473 | _getContantData(showLoading: false); |
| 430 | }, | 474 | }, |
| 431 | onEditingComplete: () { | 475 | onEditingComplete: () { |
| 432 | FocusScope.of(context) | 476 | FocusScope.of(context) |
| 433 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 | 477 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 478 | + page = 1; | ||
| 479 | + pageData = []; | ||
| 434 | _getContantData(showLoading: false); | 480 | _getContantData(showLoading: false); |
| 435 | // contantShowModel.searchData( | 481 | // contantShowModel.searchData( |
| 436 | // contantShowModel.controller.text); | 482 | // contantShowModel.controller.text); |
| @@ -461,6 +507,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | @@ -461,6 +507,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | ||
| 461 | // customerProvider.searchData(''); | 507 | // customerProvider.searchData(''); |
| 462 | FocusScope.of(context) | 508 | FocusScope.of(context) |
| 463 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 | 509 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 510 | + page = 1; | ||
| 511 | + pageData = []; | ||
| 464 | _getContantData(showLoading: false); | 512 | _getContantData(showLoading: false); |
| 465 | })); | 513 | })); |
| 466 | }, | 514 | }, |
| @@ -638,6 +686,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | @@ -638,6 +686,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | ||
| 638 | setState(() { | 686 | setState(() { |
| 639 | showFilter = false; | 687 | showFilter = false; |
| 640 | }); | 688 | }); |
| 689 | + page = 1; | ||
| 690 | + pageData = []; | ||
| 641 | _getContantData(); | 691 | _getContantData(); |
| 642 | }, tapWhiteBack: () { | 692 | }, tapWhiteBack: () { |
| 643 | Navigator.of(context).pop(); | 693 | Navigator.of(context).pop(); |
| @@ -1470,6 +1520,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | @@ -1470,6 +1520,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage> | ||
| 1470 | return ExceptionPage( | 1520 | return ExceptionPage( |
| 1471 | pageState: model.pageState, | 1521 | pageState: model.pageState, |
| 1472 | callback: () { | 1522 | callback: () { |
| 1523 | + page = 1; | ||
| 1524 | + pageData = []; | ||
| 1473 | _getContantData(); | 1525 | _getContantData(); |
| 1474 | }, | 1526 | }, |
| 1475 | emptyMsg: "暂时没有客户哦", | 1527 | emptyMsg: "暂时没有客户哦", |
| 1 | import 'package:azlistview/azlistview.dart'; | 1 | import 'package:azlistview/azlistview.dart'; |
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | +import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | import 'package:one_key/constant/state.dart'; | 5 | import 'package:one_key/constant/state.dart'; |
| 5 | import 'package:one_key/models/customer_by_seller_model.dart'; | 6 | import 'package:one_key/models/customer_by_seller_model.dart'; |
| @@ -14,7 +15,9 @@ import 'package:one_key/widgets/common_button_flat.dart'; | @@ -14,7 +15,9 @@ import 'package:one_key/widgets/common_button_flat.dart'; | ||
| 14 | import 'package:one_key/widgets/h_empty_view.dart'; | 15 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 15 | import 'package:one_key/widgets/round_button.dart'; | 16 | import 'package:one_key/widgets/round_button.dart'; |
| 16 | import 'package:one_key/widgets/v_empty_view.dart'; | 17 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 18 | +import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; | ||
| 17 | 19 | ||
| 20 | +import '../../../../utils/event_bus.dart'; | ||
| 18 | import '../../../../utils/screen_util.dart'; | 21 | import '../../../../utils/screen_util.dart'; |
| 19 | 22 | ||
| 20 | class ContactListPage extends StatefulWidget { | 23 | class ContactListPage extends StatefulWidget { |
| @@ -33,11 +36,49 @@ class ContactListPage extends StatefulWidget { | @@ -33,11 +36,49 @@ class ContactListPage extends StatefulWidget { | ||
| 33 | class _ContactListPageState extends State<ContactListPage> { | 36 | class _ContactListPageState extends State<ContactListPage> { |
| 34 | // List<contan> _contacts = []; | 37 | // List<contan> _contacts = []; |
| 35 | double susItemHeight = ScreenUtil().setWidth(10); | 38 | double susItemHeight = ScreenUtil().setWidth(10); |
| 39 | + ItemScrollController controller = ItemScrollController(); | ||
| 40 | + ItemPositionsListener positon = ItemPositionsListener.create(); | ||
| 36 | 41 | ||
| 37 | @override | 42 | @override |
| 38 | void initState() { | 43 | void initState() { |
| 39 | super.initState(); | 44 | super.initState(); |
| 40 | widget.provider.handleList(widget.contacts); | 45 | widget.provider.handleList(widget.contacts); |
| 46 | + positon.itemPositions.addListener(_itemPositonChanaged | ||
| 47 | + // print('${positon.itemPositions.value.last.index}'); | ||
| 48 | + // // positon.itemPositions.value | ||
| 49 | + // if (positon.itemPositions.value.last.index == | ||
| 50 | + // widget.contacts.length - 1) { | ||
| 51 | + // //上拉加载方法 | ||
| 52 | + // bus.emit('onload_guest_list'); | ||
| 53 | + // } | ||
| 54 | + ); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @override | ||
| 58 | + void dispose() { | ||
| 59 | + // TODO: implement dispose | ||
| 60 | + super.dispose(); | ||
| 61 | + positon.itemPositions.removeListener(_itemPositonChanaged); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + _itemPositonChanaged() { | ||
| 65 | + // ItemPosition itemPosition = positon.itemPositions.value.first; | ||
| 66 | + print('${positon.itemPositions.value.last.index}'); | ||
| 67 | + // positon.itemPositions.value | ||
| 68 | + if (positon.itemPositions.value.last.index == 1) { | ||
| 69 | + bus.emit( | ||
| 70 | + 'onrefresh_guest_list', | ||
| 71 | + ); | ||
| 72 | + } | ||
| 73 | + if (positon.itemPositions.value.last.index == widget.contacts.length - 1) { | ||
| 74 | + //上拉加载方法,最底部 | ||
| 75 | + | ||
| 76 | + bus.emit( | ||
| 77 | + 'onload_guest_list', | ||
| 78 | + (widget.contacts.length / 10) < 1 | ||
| 79 | + ? 1 | ||
| 80 | + : (widget.contacts.length / 10).toInt()); | ||
| 81 | + } | ||
| 41 | } | 82 | } |
| 42 | 83 | ||
| 43 | // void loadData() async { | 84 | // void loadData() async { |
| @@ -468,7 +509,8 @@ class _ContactListPageState extends State<ContactListPage> { | @@ -468,7 +509,8 @@ class _ContactListPageState extends State<ContactListPage> { | ||
| 468 | HEmptyView(20), | 509 | HEmptyView(20), |
| 469 | model.nickName == null | 510 | model.nickName == null |
| 470 | ? SizedBox() | 511 | ? SizedBox() |
| 471 | - :Expanded(child: Text( | 512 | + : Expanded( |
| 513 | + child: Text( | ||
| 472 | '经理:${model.nickName}', | 514 | '经理:${model.nickName}', |
| 473 | maxLines: 2, | 515 | maxLines: 2, |
| 474 | overflow: TextOverflow.ellipsis, | 516 | overflow: TextOverflow.ellipsis, |
| @@ -630,6 +672,8 @@ class _ContactListPageState extends State<ContactListPage> { | @@ -630,6 +672,8 @@ class _ContactListPageState extends State<ContactListPage> { | ||
| 630 | return AzListView( | 672 | return AzListView( |
| 631 | indexBarItemHeight: w(12), | 673 | indexBarItemHeight: w(12), |
| 632 | data: widget.contacts, | 674 | data: widget.contacts, |
| 675 | + itemScrollController: controller, | ||
| 676 | + itemPositionsListener: positon, | ||
| 633 | itemCount: widget.contacts.length, | 677 | itemCount: widget.contacts.length, |
| 634 | itemBuilder: (BuildContext context, int index) { | 678 | itemBuilder: (BuildContext context, int index) { |
| 635 | // if (index == 0) return _buildHeader(); | 679 | // if (index == 0) return _buildHeader(); |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | +import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 2 | 3 | ||
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | import 'package:one_key/constant/state.dart'; | 5 | import 'package:one_key/constant/state.dart'; |
| @@ -61,6 +62,9 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -61,6 +62,9 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 61 | bool showDrop = true; | 62 | bool showDrop = true; |
| 62 | List<String> timeTilte = ['等于', '小于', '大于']; | 63 | List<String> timeTilte = ['等于', '小于', '大于']; |
| 63 | bool distribution = false; | 64 | bool distribution = false; |
| 65 | + int page = 1; | ||
| 66 | + | ||
| 67 | + List pageData = []; | ||
| 64 | 68 | ||
| 65 | @override | 69 | @override |
| 66 | void initState() { | 70 | void initState() { |
| @@ -91,7 +95,15 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -91,7 +95,15 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 91 | // item.select = true; | 95 | // item.select = true; |
| 92 | // // item.select = false; | 96 | // // item.select = false; |
| 93 | // } | 97 | // } |
| 98 | + for (FilterBtnModel item in customerProvider.filterHydList) { | ||
| 99 | + item.select = false; | ||
| 100 | + // if (item.id == '${customerProvider.index}') { | ||
| 101 | + // item.select = true; | ||
| 102 | + // } | ||
| 103 | + } | ||
| 94 | } | 104 | } |
| 105 | + page = 1; | ||
| 106 | + pageData = []; | ||
| 95 | _getContantData(first: true); | 107 | _getContantData(first: true); |
| 96 | } | 108 | } |
| 97 | }); | 109 | }); |
| @@ -114,6 +126,8 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -114,6 +126,8 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 114 | // // item.select = false; | 126 | // // item.select = false; |
| 115 | // } | 127 | // } |
| 116 | // } | 128 | // } |
| 129 | + page = 1; | ||
| 130 | + | ||
| 117 | _getContantData(first: first); | 131 | _getContantData(first: first); |
| 118 | _filterLabelList(); | 132 | _filterLabelList(); |
| 119 | _getSellerGuestManage(); | 133 | _getSellerGuestManage(); |
| @@ -122,14 +136,41 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -122,14 +136,41 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 122 | bus.on("refresh_guest_list", (arg) { | 136 | bus.on("refresh_guest_list", (arg) { |
| 123 | _getContantData(); | 137 | _getContantData(); |
| 124 | }); | 138 | }); |
| 139 | + | ||
| 140 | + bus.on("onload_guest_list", (arg) { | ||
| 141 | + print(arg); | ||
| 142 | + if (!pageData.contains(arg)) { | ||
| 143 | + pageData.add(arg); | ||
| 144 | + pageData.removeWhere((element) => element == 0); | ||
| 145 | + _onload(); | ||
| 146 | + } | ||
| 147 | + }); | ||
| 148 | + bus.on("onrefresh_guest_list", (arg) { | ||
| 149 | + if (!pageData.contains(0)) { | ||
| 150 | + _onrefresh(); | ||
| 151 | + } | ||
| 152 | + }); | ||
| 125 | } | 153 | } |
| 126 | 154 | ||
| 127 | @override | 155 | @override |
| 128 | void dispose() { | 156 | void dispose() { |
| 129 | bus.off('refresh_guest_list'); | 157 | bus.off('refresh_guest_list'); |
| 158 | + bus.off('onload_guest_list'); | ||
| 159 | + bus.off('onrefresh_guest_list'); | ||
| 130 | super.dispose(); | 160 | super.dispose(); |
| 131 | } | 161 | } |
| 132 | 162 | ||
| 163 | + _onload() { | ||
| 164 | + page++; | ||
| 165 | + _getContantData(showLoading: false, load: true); | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + _onrefresh() { | ||
| 169 | + page = 1; | ||
| 170 | + pageData = [0]; | ||
| 171 | + _getContantData(showLoading: false); | ||
| 172 | + } | ||
| 173 | + | ||
| 133 | // _getAuthUserLists() async { | 174 | // _getAuthUserLists() async { |
| 134 | // await customerProvider.getAuthUserLists(context); | 175 | // await customerProvider.getAuthUserLists(context); |
| 135 | // } | 176 | // } |
| @@ -189,13 +230,16 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -189,13 +230,16 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 189 | } | 230 | } |
| 190 | } | 231 | } |
| 191 | 232 | ||
| 192 | - _getContantData({bool showLoading = true, bool first = false}) async { | 233 | + _getContantData( |
| 234 | + {bool showLoading = true, bool first = false, bool load = false}) async { | ||
| 193 | if (showLoading) { | 235 | if (showLoading) { |
| 194 | customerProvider.pageState = PageState.Loading; | 236 | customerProvider.pageState = PageState.Loading; |
| 195 | } | 237 | } |
| 196 | customerProvider.notifyListeners(); | 238 | customerProvider.notifyListeners(); |
| 197 | Map<String, String> params = { | 239 | Map<String, String> params = { |
| 198 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 240 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 241 | + "page": page.toString(), | ||
| 242 | + "offset": '10' | ||
| 199 | }; | 243 | }; |
| 200 | 244 | ||
| 201 | if (customerProvider.index != 0 && customerProvider.index != null) { | 245 | if (customerProvider.index != 0 && customerProvider.index != null) { |
| @@ -324,7 +368,8 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -324,7 +368,8 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 324 | } | 368 | } |
| 325 | } | 369 | } |
| 326 | 370 | ||
| 327 | - await customerProvider.getCustomerBySeller(context, params); | 371 | + await customerProvider.getCustomerBySeller(context, params, |
| 372 | + showLoading: load); | ||
| 328 | print(first); // if (customerProvider.customerBySellerList.length == | 373 | print(first); // if (customerProvider.customerBySellerList.length == |
| 329 | // customerProvider.selectCustomerSeller.length) { | 374 | // customerProvider.selectCustomerSeller.length) { |
| 330 | // customerProvider.checkValue = true; | 375 | // customerProvider.checkValue = true; |
| @@ -511,11 +556,15 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -511,11 +556,15 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 511 | // setState(() {}); | 556 | // setState(() {}); |
| 512 | // _searchSellerLocation(); | 557 | // _searchSellerLocation(); |
| 513 | // customerProvider.searchData(value); | 558 | // customerProvider.searchData(value); |
| 559 | + page = 1; | ||
| 560 | + pageData = []; | ||
| 514 | _getContantData(showLoading: false); | 561 | _getContantData(showLoading: false); |
| 515 | }, | 562 | }, |
| 516 | onEditingComplete: () { | 563 | onEditingComplete: () { |
| 517 | FocusScope.of(context) | 564 | FocusScope.of(context) |
| 518 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 | 565 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 566 | + page = 1; | ||
| 567 | + pageData = []; | ||
| 519 | _getContantData(showLoading: false); | 568 | _getContantData(showLoading: false); |
| 520 | // contantShowModel.searchData( | 569 | // contantShowModel.searchData( |
| 521 | // contantShowModel.controller.text); | 570 | // contantShowModel.controller.text); |
| @@ -545,6 +594,8 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -545,6 +594,8 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 545 | customerProvider.controller.clear(); | 594 | customerProvider.controller.clear(); |
| 546 | FocusScope.of(context) | 595 | FocusScope.of(context) |
| 547 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 | 596 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 597 | + page = 1; | ||
| 598 | + pageData = []; | ||
| 548 | _getContantData(showLoading: false); | 599 | _getContantData(showLoading: false); |
| 549 | // customerProvider.searchData(''); | 600 | // customerProvider.searchData(''); |
| 550 | })); | 601 | })); |
| @@ -728,6 +779,8 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -728,6 +779,8 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 728 | setState(() { | 779 | setState(() { |
| 729 | showFilter = false; | 780 | showFilter = false; |
| 730 | }); | 781 | }); |
| 782 | + page = 1; | ||
| 783 | + pageData = []; | ||
| 731 | _getContantData(); | 784 | _getContantData(); |
| 732 | }, tapWhiteBack: () { | 785 | }, tapWhiteBack: () { |
| 733 | Navigator.of(context).pop(); | 786 | Navigator.of(context).pop(); |
| @@ -1577,6 +1630,8 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -1577,6 +1630,8 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 1577 | callback: () { | 1630 | callback: () { |
| 1578 | model.pageState = PageState.Loading; | 1631 | model.pageState = PageState.Loading; |
| 1579 | model.notifyListeners(); | 1632 | model.notifyListeners(); |
| 1633 | + page = 1; | ||
| 1634 | + pageData = []; | ||
| 1580 | _getContantData(); | 1635 | _getContantData(); |
| 1581 | }, | 1636 | }, |
| 1582 | emptyMsg: "暂时没有客户哦", | 1637 | emptyMsg: "暂时没有客户哦", |
| @@ -1586,11 +1641,38 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -1586,11 +1641,38 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 1586 | } else { | 1641 | } else { |
| 1587 | return Container( | 1642 | return Container( |
| 1588 | color: MyColours.color_f3f3f3, | 1643 | color: MyColours.color_f3f3f3, |
| 1644 | + // height: 500, | ||
| 1589 | child: ContactListPage( | 1645 | child: ContactListPage( |
| 1590 | contacts: model.customerBySellerList, | 1646 | contacts: model.customerBySellerList, |
| 1591 | provider: customerProvider, | 1647 | provider: customerProvider, |
| 1592 | fromPage: widget.fromPage), | 1648 | fromPage: widget.fromPage), |
| 1593 | ); | 1649 | ); |
| 1650 | + // EasyRefresh( | ||
| 1651 | + // onRefresh: () async { | ||
| 1652 | + // // page = 0; | ||
| 1653 | + // // _getContantData(showLoading: false); | ||
| 1654 | + // }, | ||
| 1655 | + // onLoad: () async { | ||
| 1656 | + // // page++; | ||
| 1657 | + // // _getContantData(showLoading: false); | ||
| 1658 | + // }, | ||
| 1659 | + // child: | ||
| 1660 | + | ||
| 1661 | + // SliverList( | ||
| 1662 | + // delegate: SliverChildBuilderDelegate( | ||
| 1663 | + // (BuildContext context, int index) { | ||
| 1664 | + // return Container( | ||
| 1665 | + // color: MyColours.color_f3f3f3, | ||
| 1666 | + // // height: 500, | ||
| 1667 | + // child: ContactListPage( | ||
| 1668 | + // contacts: model.customerBySellerList, | ||
| 1669 | + // provider: customerProvider, | ||
| 1670 | + // fromPage: widget.fromPage), | ||
| 1671 | + // ); | ||
| 1672 | + // }, childCount: 1), | ||
| 1673 | + // ) | ||
| 1674 | + // ], | ||
| 1675 | + | ||
| 1594 | } | 1676 | } |
| 1595 | })); | 1677 | })); |
| 1596 | } | 1678 | } |
| @@ -1618,7 +1700,7 @@ class _CustomerListPageState extends State<CustomerListPage> | @@ -1618,7 +1700,7 @@ class _CustomerListPageState extends State<CustomerListPage> | ||
| 1618 | }, | 1700 | }, |
| 1619 | ), | 1701 | ), |
| 1620 | body: SafeArea( | 1702 | body: SafeArea( |
| 1621 | - child: Column(children: [ | 1703 | + child: Column(mainAxisSize: MainAxisSize.min, children: [ |
| 1622 | _searchWidget(), _menuWidget(), | 1704 | _searchWidget(), _menuWidget(), |
| 1623 | 1705 | ||
| 1624 | Expanded( | 1706 | Expanded( |
| @@ -915,6 +915,7 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { | @@ -915,6 +915,7 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { | ||
| 915 | horizontal: ScreenUtil().setWidth(64), | 915 | horizontal: ScreenUtil().setWidth(64), |
| 916 | vertical: ScreenUtil().setWidth(14)), | 916 | vertical: ScreenUtil().setWidth(14)), |
| 917 | child: Row( | 917 | child: Row( |
| 918 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 918 | children: [ | 919 | children: [ |
| 919 | Text( | 920 | Text( |
| 920 | '消费金额', | 921 | '消费金额', |
| @@ -922,29 +923,30 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { | @@ -922,29 +923,30 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { | ||
| 922 | fontSize: ScreenUtil().setSp(24), | 923 | fontSize: ScreenUtil().setSp(24), |
| 923 | color: MyColours.color_515151), | 924 | color: MyColours.color_515151), |
| 924 | ), | 925 | ), |
| 925 | - Spacer(), | 926 | + // Spacer(), |
| 926 | // HEmptyView(40), | 927 | // HEmptyView(40), |
| 927 | - Container( | ||
| 928 | - width: ScreenUtil().setWidth(110), | ||
| 929 | - height: ScreenUtil().setWidth(40), | ||
| 930 | - decoration: BoxDecoration( | ||
| 931 | - border: Border( | ||
| 932 | - bottom: BorderSide( | ||
| 933 | - width: ScreenUtil().setWidth(2), | ||
| 934 | - color: MyColours.color_515151))), | ||
| 935 | - alignment: Alignment.center, | ||
| 936 | - child: Text( | ||
| 937 | - _onlineCheckEditProvider.orderInfoSunModel != null | ||
| 938 | - ? '¥ ${_onlineCheckEditProvider.orderInfoSunModel.price}' | ||
| 939 | - : '', | ||
| 940 | - maxLines: 1, | ||
| 941 | - // textAlign: TextAlign.center, | ||
| 942 | - //输入文本的样式 | ||
| 943 | - style: TextStyle( | ||
| 944 | - // decoration: TextDecoration.underline, | ||
| 945 | - fontSize: ScreenUtil().setSp(28), | ||
| 946 | - color: MyColours.color_515151), | ||
| 947 | - )) | 928 | + Expanded( |
| 929 | + child: Container( | ||
| 930 | + // width: ScreenUtil().setWidth(120), | ||
| 931 | + height: ScreenUtil().setWidth(40), | ||
| 932 | + // decoration: BoxDecoration( | ||
| 933 | + // border: Border( | ||
| 934 | + // bottom: BorderSide( | ||
| 935 | + // width: ScreenUtil().setWidth(2), | ||
| 936 | + // color: MyColours.color_515151))), | ||
| 937 | + alignment: Alignment.centerRight, | ||
| 938 | + child: Text( | ||
| 939 | + _onlineCheckEditProvider.orderInfoSunModel != null | ||
| 940 | + ? '¥ ${_onlineCheckEditProvider.orderInfoSunModel.price}' | ||
| 941 | + : '', | ||
| 942 | + maxLines: 1, | ||
| 943 | + // textAlign: TextAlign.center, | ||
| 944 | + //输入文本的样式 | ||
| 945 | + style: TextStyle( | ||
| 946 | + decoration: TextDecoration.underline, | ||
| 947 | + fontSize: ScreenUtil().setSp(28), | ||
| 948 | + color: MyColours.color_515151), | ||
| 949 | + ))) | ||
| 948 | ], | 950 | ], |
| 949 | ), | 951 | ), |
| 950 | ); | 952 | ); |
| @@ -354,7 +354,12 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { | @@ -354,7 +354,12 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { | ||
| 354 | Spacer(), | 354 | Spacer(), |
| 355 | // HEmptyView(40), | 355 | // HEmptyView(40), |
| 356 | Container( | 356 | Container( |
| 357 | - width: ScreenUtil().setWidth(110), | 357 | + // constraints: BoxConstraints( |
| 358 | + // minWidth: ScreenUtil().setWidth(110), | ||
| 359 | + // // maxWidth: ScreenUtil().setWidth(200), | ||
| 360 | + // ), | ||
| 361 | + | ||
| 362 | + width: ScreenUtil().setWidth(120), | ||
| 358 | height: ScreenUtil().setWidth(40), | 363 | height: ScreenUtil().setWidth(40), |
| 359 | decoration: BoxDecoration( | 364 | decoration: BoxDecoration( |
| 360 | border: Border( | 365 | border: Border( |
| @@ -364,7 +369,7 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { | @@ -364,7 +369,7 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { | ||
| 364 | alignment: Alignment.center, | 369 | alignment: Alignment.center, |
| 365 | child: TextField( | 370 | child: TextField( |
| 366 | maxLines: 1, | 371 | maxLines: 1, |
| 367 | - // textAlign: TextAlign.center, | 372 | + textAlign: TextAlign.center, |
| 368 | //输入文本的样式 | 373 | //输入文本的样式 |
| 369 | style: TextStyle( | 374 | style: TextStyle( |
| 370 | fontSize: ScreenUtil().setSp(28), | 375 | fontSize: ScreenUtil().setSp(28), |
| @@ -370,10 +370,11 @@ class CustomerProvider extends ChangeNotifier { | @@ -370,10 +370,11 @@ class CustomerProvider extends ChangeNotifier { | ||
| 370 | // } | 370 | // } |
| 371 | 371 | ||
| 372 | //我的客情 --- 用来获取客户列表 | 372 | //我的客情 --- 用来获取客户列表 |
| 373 | - getCustomerList(BuildContext context, Map<String, String> params) async { | 373 | + getCustomerList(BuildContext context, Map<String, String> params, |
| 374 | + {bool load = false}) async { | ||
| 374 | BaseResp<List> baseResp = await DioUtil() | 375 | BaseResp<List> baseResp = await DioUtil() |
| 375 | .request<List>(context, Method.get, HttpUrl.get_customer_list, | 376 | .request<List>(context, Method.get, HttpUrl.get_customer_list, |
| 376 | - data: params, showLoading: false) | 377 | + data: params, showLoading: load) |
| 377 | .catchError((error) { | 378 | .catchError((error) { |
| 378 | print(error.toString()); | 379 | print(error.toString()); |
| 379 | if (error is MyError) { | 380 | if (error is MyError) { |
| @@ -392,11 +393,20 @@ class CustomerProvider extends ChangeNotifier { | @@ -392,11 +393,20 @@ class CustomerProvider extends ChangeNotifier { | ||
| 392 | notifyListeners(); | 393 | notifyListeners(); |
| 393 | }); | 394 | }); |
| 394 | if (baseResp != null && baseResp.code == Constant.status_success) { | 395 | if (baseResp != null && baseResp.code == Constant.status_success) { |
| 395 | - userHistorys = CustomerListModel.fromJson(baseResp.responseData).data; | ||
| 396 | - if (userHistorys.length == 0) { | ||
| 397 | - pageState = PageState.Empty; | 396 | + // userHistorys = CustomerListModel.fromJson(baseResp.responseData).data; |
| 397 | + if (params['page'] == '1') { | ||
| 398 | + userHistorys = CustomerListModel.fromJson(baseResp.responseData).data; | ||
| 399 | + if (userHistorys.length == 0) { | ||
| 400 | + pageState = PageState.Empty; | ||
| 401 | + } else { | ||
| 402 | + pageState = PageState.Success; | ||
| 403 | + } | ||
| 398 | } else { | 404 | } else { |
| 399 | pageState = PageState.Success; | 405 | pageState = PageState.Success; |
| 406 | + userHistorys | ||
| 407 | + .addAll(CustomerListModel.fromJson(baseResp.responseData).data); | ||
| 408 | + } | ||
| 409 | + if (userHistorys.length > 0) { | ||
| 400 | List<String> idList = []; | 410 | List<String> idList = []; |
| 401 | for (int i = 0; i < userHistorys.length; i++) { | 411 | for (int i = 0; i < userHistorys.length; i++) { |
| 402 | CustomerListSunModel item = userHistorys[i]; | 412 | CustomerListSunModel item = userHistorys[i]; |
| @@ -1426,10 +1436,11 @@ class CustomerProvider extends ChangeNotifier { | @@ -1426,10 +1436,11 @@ class CustomerProvider extends ChangeNotifier { | ||
| 1426 | } | 1436 | } |
| 1427 | 1437 | ||
| 1428 | //获取商家客户列表 | 1438 | //获取商家客户列表 |
| 1429 | - getCustomerBySeller(BuildContext context, Map<String, String> params) async { | 1439 | + getCustomerBySeller(BuildContext context, Map<String, String> params, |
| 1440 | + {showLoading = false}) async { | ||
| 1430 | BaseResp<List> baseResp = await DioUtil() | 1441 | BaseResp<List> baseResp = await DioUtil() |
| 1431 | .request<List>(context, Method.get, HttpUrl.get_customer_by_seller, | 1442 | .request<List>(context, Method.get, HttpUrl.get_customer_by_seller, |
| 1432 | - data: params, showLoading: false) | 1443 | + data: params, showLoading: showLoading) |
| 1433 | .catchError((error) { | 1444 | .catchError((error) { |
| 1434 | print(error.toString()); | 1445 | print(error.toString()); |
| 1435 | if (error is MyError) { | 1446 | if (error is MyError) { |
| @@ -1448,12 +1459,21 @@ class CustomerProvider extends ChangeNotifier { | @@ -1448,12 +1459,21 @@ class CustomerProvider extends ChangeNotifier { | ||
| 1448 | notifyListeners(); | 1459 | notifyListeners(); |
| 1449 | }); | 1460 | }); |
| 1450 | if (baseResp != null && baseResp.code == Constant.status_success) { | 1461 | if (baseResp != null && baseResp.code == Constant.status_success) { |
| 1451 | - customerBySellerList = | ||
| 1452 | - CustomerBySellerModel.fromJson(baseResp.responseData).data; | ||
| 1453 | - if (customerBySellerList.length == 0) { | ||
| 1454 | - pageState = PageState.Empty; | 1462 | + if (params['page'] == '1') { |
| 1463 | + customerBySellerList = | ||
| 1464 | + CustomerBySellerModel.fromJson(baseResp.responseData).data; | ||
| 1465 | + if (customerBySellerList.length == 0) { | ||
| 1466 | + pageState = PageState.Empty; | ||
| 1467 | + } else { | ||
| 1468 | + pageState = PageState.Success; | ||
| 1469 | + } | ||
| 1455 | } else { | 1470 | } else { |
| 1456 | pageState = PageState.Success; | 1471 | pageState = PageState.Success; |
| 1472 | + customerBySellerList | ||
| 1473 | + .addAll(CustomerBySellerModel.fromJson(baseResp.responseData).data); | ||
| 1474 | + } | ||
| 1475 | + | ||
| 1476 | + if (customerBySellerList.length > 0) { | ||
| 1457 | List<String> idList = []; | 1477 | List<String> idList = []; |
| 1458 | for (int i = 0; i < customerBySellerList.length; i++) { | 1478 | for (int i = 0; i < customerBySellerList.length; i++) { |
| 1459 | CustomerBySellerSunModel item = customerBySellerList[i]; | 1479 | CustomerBySellerSunModel item = customerBySellerList[i]; |
-
Please register or login to post a comment