|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/constant/state.dart';
|
|
...
|
...
|
@@ -61,6 +62,9 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
bool showDrop = true;
|
|
|
|
List<String> timeTilte = ['等于', '小于', '大于'];
|
|
|
|
bool distribution = false;
|
|
|
|
int page = 1;
|
|
|
|
|
|
|
|
List pageData = [];
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -91,7 +95,15 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
// item.select = true;
|
|
|
|
// // item.select = false;
|
|
|
|
// }
|
|
|
|
for (FilterBtnModel item in customerProvider.filterHydList) {
|
|
|
|
item.select = false;
|
|
|
|
// if (item.id == '${customerProvider.index}') {
|
|
|
|
// item.select = true;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
page = 1;
|
|
|
|
pageData = [];
|
|
|
|
_getContantData(first: true);
|
|
|
|
}
|
|
|
|
});
|
|
...
|
...
|
@@ -114,6 +126,8 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
// // item.select = false;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
page = 1;
|
|
|
|
|
|
|
|
_getContantData(first: first);
|
|
|
|
_filterLabelList();
|
|
|
|
_getSellerGuestManage();
|
|
...
|
...
|
@@ -122,14 +136,41 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
bus.on("refresh_guest_list", (arg) {
|
|
|
|
_getContantData();
|
|
|
|
});
|
|
|
|
|
|
|
|
bus.on("onload_guest_list", (arg) {
|
|
|
|
print(arg);
|
|
|
|
if (!pageData.contains(arg)) {
|
|
|
|
pageData.add(arg);
|
|
|
|
pageData.removeWhere((element) => element == 0);
|
|
|
|
_onload();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
bus.on("onrefresh_guest_list", (arg) {
|
|
|
|
if (!pageData.contains(0)) {
|
|
|
|
_onrefresh();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
bus.off('refresh_guest_list');
|
|
|
|
bus.off('onload_guest_list');
|
|
|
|
bus.off('onrefresh_guest_list');
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
_onload() {
|
|
|
|
page++;
|
|
|
|
_getContantData(showLoading: false, load: true);
|
|
|
|
}
|
|
|
|
|
|
|
|
_onrefresh() {
|
|
|
|
page = 1;
|
|
|
|
pageData = [0];
|
|
|
|
_getContantData(showLoading: false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// _getAuthUserLists() async {
|
|
|
|
// await customerProvider.getAuthUserLists(context);
|
|
|
|
// }
|
|
...
|
...
|
@@ -189,13 +230,16 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_getContantData({bool showLoading = true, bool first = false}) async {
|
|
|
|
_getContantData(
|
|
|
|
{bool showLoading = true, bool first = false, bool load = false}) async {
|
|
|
|
if (showLoading) {
|
|
|
|
customerProvider.pageState = PageState.Loading;
|
|
|
|
}
|
|
|
|
customerProvider.notifyListeners();
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
|
|
|
|
"page": page.toString(),
|
|
|
|
"offset": '10'
|
|
|
|
};
|
|
|
|
|
|
|
|
if (customerProvider.index != 0 && customerProvider.index != null) {
|
|
...
|
...
|
@@ -324,7 +368,8 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
await customerProvider.getCustomerBySeller(context, params);
|
|
|
|
await customerProvider.getCustomerBySeller(context, params,
|
|
|
|
showLoading: load);
|
|
|
|
print(first); // if (customerProvider.customerBySellerList.length ==
|
|
|
|
// customerProvider.selectCustomerSeller.length) {
|
|
|
|
// customerProvider.checkValue = true;
|
|
...
|
...
|
@@ -511,11 +556,15 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
// setState(() {});
|
|
|
|
// _searchSellerLocation();
|
|
|
|
// customerProvider.searchData(value);
|
|
|
|
page = 1;
|
|
|
|
pageData = [];
|
|
|
|
_getContantData(showLoading: false);
|
|
|
|
},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
page = 1;
|
|
|
|
pageData = [];
|
|
|
|
_getContantData(showLoading: false);
|
|
|
|
// contantShowModel.searchData(
|
|
|
|
// contantShowModel.controller.text);
|
|
...
|
...
|
@@ -545,6 +594,8 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
customerProvider.controller.clear();
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
page = 1;
|
|
|
|
pageData = [];
|
|
|
|
_getContantData(showLoading: false);
|
|
|
|
// customerProvider.searchData('');
|
|
|
|
}));
|
|
...
|
...
|
@@ -728,6 +779,8 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
setState(() {
|
|
|
|
showFilter = false;
|
|
|
|
});
|
|
|
|
page = 1;
|
|
|
|
pageData = [];
|
|
|
|
_getContantData();
|
|
|
|
}, tapWhiteBack: () {
|
|
|
|
Navigator.of(context).pop();
|
|
...
|
...
|
@@ -1577,6 +1630,8 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
callback: () {
|
|
|
|
model.pageState = PageState.Loading;
|
|
|
|
model.notifyListeners();
|
|
|
|
page = 1;
|
|
|
|
pageData = [];
|
|
|
|
_getContantData();
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有客户哦",
|
|
...
|
...
|
@@ -1586,11 +1641,38 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
} else {
|
|
|
|
return Container(
|
|
|
|
color: MyColours.color_f3f3f3,
|
|
|
|
// height: 500,
|
|
|
|
child: ContactListPage(
|
|
|
|
contacts: model.customerBySellerList,
|
|
|
|
provider: customerProvider,
|
|
|
|
fromPage: widget.fromPage),
|
|
|
|
);
|
|
|
|
// EasyRefresh(
|
|
|
|
// onRefresh: () async {
|
|
|
|
// // page = 0;
|
|
|
|
// // _getContantData(showLoading: false);
|
|
|
|
// },
|
|
|
|
// onLoad: () async {
|
|
|
|
// // page++;
|
|
|
|
// // _getContantData(showLoading: false);
|
|
|
|
// },
|
|
|
|
// child:
|
|
|
|
|
|
|
|
// SliverList(
|
|
|
|
// delegate: SliverChildBuilderDelegate(
|
|
|
|
// (BuildContext context, int index) {
|
|
|
|
// return Container(
|
|
|
|
// color: MyColours.color_f3f3f3,
|
|
|
|
// // height: 500,
|
|
|
|
// child: ContactListPage(
|
|
|
|
// contacts: model.customerBySellerList,
|
|
|
|
// provider: customerProvider,
|
|
|
|
// fromPage: widget.fromPage),
|
|
|
|
// );
|
|
|
|
// }, childCount: 1),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}
|
|
...
|
...
|
@@ -1618,7 +1700,7 @@ class _CustomerListPageState extends State<CustomerListPage> |
|
|
|
},
|
|
|
|
),
|
|
|
|
body: SafeArea(
|
|
|
|
child: Column(children: [
|
|
|
|
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
|
|
|
_searchWidget(), _menuWidget(),
|
|
|
|
|
|
|
|
Expanded(
|
...
|
...
|
|