Commit 0b80d8cdb3537174950e14b1dc449784f4bec3c6

Authored by wdn127929
1 parent 24d7aae5

客情列表分页

... ... @@ -16,17 +16,17 @@ if (flutterRoot == null) {
def flutterVersionCode = "494"
def flutterVersionCode = "495"
if (flutterVersionCode == null) {
flutterVersionCode = '494'
flutterVersionCode = '495'
}
def flutterVersionName = "4.9.4"
def flutterVersionName = "4.9.5"
if (flutterVersionName == null) {
flutterVersionName = '4.9.4'
flutterVersionName = '4.9.5'
}
... ...
... ... @@ -521,7 +521,7 @@ class MessageItemF extends StatelessWidget {
BorderRadius.circular(8)),
child: Text(
'${message.room_info}',
maxLines: 1,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_ffffff,
... ... @@ -542,7 +542,7 @@ class MessageItemF extends StatelessWidget {
BorderRadius.circular(8)),
child: Text(
'${message.room_demand}',
maxLines: 1,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_ffffff,
... ...
... ... @@ -109,7 +109,7 @@ class MessagePageState extends State<MessagePage>
super.dispose();
messageModel.pageStateUn = PageState.Loading;
messageModel.pageState = PageState.Loading;
messageModel.notifyListeners();
// messageModel.notifyListeners();
bus.off("refresh_untreated_num");
bus.off("remove_untreated_message");
}
... ...
... ... @@ -54,6 +54,9 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
List<String> timeTilte = ['等于', '小于', '大于'];
int filterHydIndex = 0;
List pageData = [];
int page = 1;
@override
void initState() {
_tabBarTitle = ['全部', '活跃', '沉睡', '流失'];
... ... @@ -83,7 +86,15 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
// 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);
}
});
... ... @@ -103,20 +114,48 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
// // item.select = false;
// }
// }
page = 1;
_getContantData(first: first);
_filterLabelList();
});
bus.on("refresh_guest_list_my", (arg) {
_getContantData();
});
bus.on("onload_guest_list_my", (arg) {
print(arg);
if (!pageData.contains(arg)) {
pageData.add(arg);
pageData.removeWhere((element) => element == 0);
_onload();
}
});
bus.on("onrefresh_guest_list_my", (arg) {
if (!pageData.contains(0)) {
_onrefresh();
}
});
}
@override
void dispose() {
bus.off('refresh_guest_list_my');
bus.off('onload_guest_list_my');
bus.off('onrefresh_guest_list_my');
super.dispose();
}
_onload() {
page++;
_getContantData(showLoading: false, load: true);
}
_onrefresh() {
page = 1;
pageData = [0];
_getContantData(showLoading: false);
}
_filterLabelList() async {
await customerProvider.getLabelBySellerid(context);
customerProvider.filterLabelList = [];
... ... @@ -137,13 +176,16 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
}
}
_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 = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
"page": page.toString(),
"offset": '10'
};
if (customerProvider.index != 0 && customerProvider.index != null) {
//1 活跃 2 沉睡 3 流失
... ... @@ -237,7 +279,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
// params['reserve_num'] 时间内预定次数
// params['reserve_sort'] 1 等于 2 小于 3 大于
await customerProvider.getCustomerList(context, params);
await customerProvider.getCustomerList(context, params, load: load);
print(first);
// if (customerProvider.userHistorys.length ==
... ... @@ -426,11 +468,15 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
// 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);
... ... @@ -461,6 +507,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
// customerProvider.searchData('');
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
page = 1;
pageData = [];
_getContantData(showLoading: false);
}));
},
... ... @@ -638,6 +686,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
setState(() {
showFilter = false;
});
page = 1;
pageData = [];
_getContantData();
}, tapWhiteBack: () {
Navigator.of(context).pop();
... ... @@ -1470,6 +1520,8 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
return ExceptionPage(
pageState: model.pageState,
callback: () {
page = 1;
pageData = [];
_getContantData();
},
emptyMsg: "暂时没有客户哦",
... ...
import 'package:azlistview/azlistview.dart';
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';
import 'package:one_key/models/customer_by_seller_model.dart';
... ... @@ -14,7 +15,9 @@ import 'package:one_key/widgets/common_button_flat.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../../../../utils/event_bus.dart';
import '../../../../utils/screen_util.dart';
class ContactListPage extends StatefulWidget {
... ... @@ -33,11 +36,49 @@ class ContactListPage extends StatefulWidget {
class _ContactListPageState extends State<ContactListPage> {
// List<contan> _contacts = [];
double susItemHeight = ScreenUtil().setWidth(10);
ItemScrollController controller = ItemScrollController();
ItemPositionsListener positon = ItemPositionsListener.create();
@override
void initState() {
super.initState();
widget.provider.handleList(widget.contacts);
positon.itemPositions.addListener(_itemPositonChanaged
// print('${positon.itemPositions.value.last.index}');
// // positon.itemPositions.value
// if (positon.itemPositions.value.last.index ==
// widget.contacts.length - 1) {
// //上拉加载方法
// bus.emit('onload_guest_list');
// }
);
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
positon.itemPositions.removeListener(_itemPositonChanaged);
}
_itemPositonChanaged() {
// ItemPosition itemPosition = positon.itemPositions.value.first;
print('${positon.itemPositions.value.last.index}');
// positon.itemPositions.value
if (positon.itemPositions.value.last.index == 1) {
bus.emit(
'onrefresh_guest_list',
);
}
if (positon.itemPositions.value.last.index == widget.contacts.length - 1) {
//上拉加载方法,最底部
bus.emit(
'onload_guest_list',
(widget.contacts.length / 10) < 1
? 1
: (widget.contacts.length / 10).toInt());
}
}
// void loadData() async {
... ... @@ -468,7 +509,8 @@ class _ContactListPageState extends State<ContactListPage> {
HEmptyView(20),
model.nickName == null
? SizedBox()
:Expanded(child: Text(
: Expanded(
child: Text(
'经理:${model.nickName}',
maxLines: 2,
overflow: TextOverflow.ellipsis,
... ... @@ -630,6 +672,8 @@ class _ContactListPageState extends State<ContactListPage> {
return AzListView(
indexBarItemHeight: w(12),
data: widget.contacts,
itemScrollController: controller,
itemPositionsListener: positon,
itemCount: widget.contacts.length,
itemBuilder: (BuildContext context, int index) {
// if (index == 0) return _buildHeader();
... ...
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(
... ...
... ... @@ -915,6 +915,7 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> {
horizontal: ScreenUtil().setWidth(64),
vertical: ScreenUtil().setWidth(14)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'消费金额',
... ... @@ -922,29 +923,30 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> {
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_515151),
),
Spacer(),
// Spacer(),
// HEmptyView(40),
Container(
width: ScreenUtil().setWidth(110),
height: ScreenUtil().setWidth(40),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_515151))),
alignment: Alignment.center,
child: Text(
_onlineCheckEditProvider.orderInfoSunModel != null
? '¥ ${_onlineCheckEditProvider.orderInfoSunModel.price}'
: '',
maxLines: 1,
// textAlign: TextAlign.center,
//输入文本的样式
style: TextStyle(
// decoration: TextDecoration.underline,
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_515151),
))
Expanded(
child: Container(
// width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(40),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// width: ScreenUtil().setWidth(2),
// color: MyColours.color_515151))),
alignment: Alignment.centerRight,
child: Text(
_onlineCheckEditProvider.orderInfoSunModel != null
? '¥ ${_onlineCheckEditProvider.orderInfoSunModel.price}'
: '',
maxLines: 1,
// textAlign: TextAlign.center,
//输入文本的样式
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_515151),
)))
],
),
);
... ...
... ... @@ -354,7 +354,12 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
Spacer(),
// HEmptyView(40),
Container(
width: ScreenUtil().setWidth(110),
// constraints: BoxConstraints(
// minWidth: ScreenUtil().setWidth(110),
// // maxWidth: ScreenUtil().setWidth(200),
// ),
width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(40),
decoration: BoxDecoration(
border: Border(
... ... @@ -364,7 +369,7 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> {
alignment: Alignment.center,
child: TextField(
maxLines: 1,
// textAlign: TextAlign.center,
textAlign: TextAlign.center,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
... ...
... ... @@ -370,10 +370,11 @@ class CustomerProvider extends ChangeNotifier {
// }
//我的客情 --- 用来获取客户列表
getCustomerList(BuildContext context, Map<String, String> params) async {
getCustomerList(BuildContext context, Map<String, String> params,
{bool load = false}) async {
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.get_customer_list,
data: params, showLoading: false)
data: params, showLoading: load)
.catchError((error) {
print(error.toString());
if (error is MyError) {
... ... @@ -392,11 +393,20 @@ class CustomerProvider extends ChangeNotifier {
notifyListeners();
});
if (baseResp != null && baseResp.code == Constant.status_success) {
userHistorys = CustomerListModel.fromJson(baseResp.responseData).data;
if (userHistorys.length == 0) {
pageState = PageState.Empty;
// userHistorys = CustomerListModel.fromJson(baseResp.responseData).data;
if (params['page'] == '1') {
userHistorys = CustomerListModel.fromJson(baseResp.responseData).data;
if (userHistorys.length == 0) {
pageState = PageState.Empty;
} else {
pageState = PageState.Success;
}
} else {
pageState = PageState.Success;
userHistorys
.addAll(CustomerListModel.fromJson(baseResp.responseData).data);
}
if (userHistorys.length > 0) {
List<String> idList = [];
for (int i = 0; i < userHistorys.length; i++) {
CustomerListSunModel item = userHistorys[i];
... ... @@ -1426,10 +1436,11 @@ class CustomerProvider extends ChangeNotifier {
}
//获取商家客户列表
getCustomerBySeller(BuildContext context, Map<String, String> params) async {
getCustomerBySeller(BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.get_customer_by_seller,
data: params, showLoading: false)
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {
... ... @@ -1448,12 +1459,21 @@ class CustomerProvider extends ChangeNotifier {
notifyListeners();
});
if (baseResp != null && baseResp.code == Constant.status_success) {
customerBySellerList =
CustomerBySellerModel.fromJson(baseResp.responseData).data;
if (customerBySellerList.length == 0) {
pageState = PageState.Empty;
if (params['page'] == '1') {
customerBySellerList =
CustomerBySellerModel.fromJson(baseResp.responseData).data;
if (customerBySellerList.length == 0) {
pageState = PageState.Empty;
} else {
pageState = PageState.Success;
}
} else {
pageState = PageState.Success;
customerBySellerList
.addAll(CustomerBySellerModel.fromJson(baseResp.responseData).data);
}
if (customerBySellerList.length > 0) {
List<String> idList = [];
for (int i = 0; i < customerBySellerList.length; i++) {
CustomerBySellerSunModel item = customerBySellerList[i];
... ...