|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/models/out_wine_record_model.dart';
|
|
|
|
import 'package:one_key/models/wine_manage_model.dart';
|
|
...
|
...
|
@@ -65,11 +66,9 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> |
|
|
|
index = tabController.index;
|
|
|
|
|
|
|
|
if (index == 0) {
|
|
|
|
await storeWineProvider.getStoreWineBySeller(context,
|
|
|
|
showLoading: false);
|
|
|
|
await _getStoreWineBySeller(context, showLoading: false);
|
|
|
|
} else if (index == 1) {
|
|
|
|
await storeWineProvider.getStoreWineCheckList(context,
|
|
|
|
showLoading: false);
|
|
|
|
await _getStoreWineCheckList(context, showLoading: false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// _getContantData(first: true);
|
|
...
|
...
|
@@ -81,19 +80,18 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> |
|
|
|
// _getContantData(first: first);
|
|
|
|
await _getAuthUserLists(showLoading: true);
|
|
|
|
|
|
|
|
await storeWineProvider.getStoreWineBySeller(context, showLoading: true);
|
|
|
|
|
|
|
|
await storeWineProvider.getStoreWineCheckList(context, showLoading: true);
|
|
|
|
_getStoreWineBySeller(context, showLoading: true);
|
|
|
|
_getStoreWineCheckList(context, showLoading: true);
|
|
|
|
});
|
|
|
|
bus.on("refresh_wine_home_all_list", (arg) async {
|
|
|
|
await storeWineProvider.getStoreWineBySeller(context, showLoading: true);
|
|
|
|
_getStoreWineBySeller(context, showLoading: true);
|
|
|
|
});
|
|
|
|
bus.on("refresh_wine_home_list", (arg) async {
|
|
|
|
print(arg['index']);
|
|
|
|
tabController.index = arg['index'];
|
|
|
|
index = arg['index'];
|
|
|
|
await storeWineProvider.getStoreWineBySeller(context, showLoading: true);
|
|
|
|
await storeWineProvider.getStoreWineCheckList(context, showLoading: true);
|
|
|
|
_getStoreWineBySeller(context, showLoading: true);
|
|
|
|
_getStoreWineCheckList(context, showLoading: true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -104,6 +102,29 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> |
|
|
|
bus.off('refresh_wine_home_list');
|
|
|
|
}
|
|
|
|
|
|
|
|
_getStoreWineBySeller(BuildContext context, {bool showLoading = true}) async {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
Map<String, String> params = {"sid": userModel.user.sellerid};
|
|
|
|
|
|
|
|
if (searchC.text.trim().length > 0) {
|
|
|
|
params['keyword'] = searchC.text; //搜索手机号/姓名
|
|
|
|
}
|
|
|
|
await storeWineProvider.getStoreWineBySeller(context, params,
|
|
|
|
showLoading: showLoading);
|
|
|
|
}
|
|
|
|
|
|
|
|
_getStoreWineCheckList(BuildContext context,
|
|
|
|
{bool showLoading = true}) async {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
Map<String, String> params = {"sid": userModel.user.sellerid};
|
|
|
|
|
|
|
|
if (searchC.text.trim().length > 0) {
|
|
|
|
params['keyword'] = searchC.text; //搜索手机号/姓名
|
|
|
|
}
|
|
|
|
await storeWineProvider.getStoreWineCheckList(context, params,
|
|
|
|
showLoading: showLoading);
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取员工信息列表
|
|
|
|
_getAuthUserLists({bool showLoading = true}) async {
|
|
|
|
Map<String, String> params = {
|
|
...
|
...
|
@@ -220,12 +241,30 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> |
|
|
|
textInputAction: TextInputAction.done,
|
|
|
|
|
|
|
|
onChanged: (value) {
|
|
|
|
// _getContantData(showLoading: false);
|
|
|
|
// setState(() {});
|
|
|
|
// _searchSellerLocation();
|
|
|
|
// customerProvider.searchData(value);
|
|
|
|
|
|
|
|
if (tabController.index == 0) {
|
|
|
|
_getStoreWineBySeller(context, showLoading: false);
|
|
|
|
}
|
|
|
|
if (tabController.index == 1) {
|
|
|
|
_getStoreWineCheckList(context, showLoading: false);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
// _getContantData(showLoading: false);
|
|
|
|
if (tabController.index == 0) {
|
|
|
|
_getStoreWineBySeller(context, showLoading: false);
|
|
|
|
}
|
|
|
|
if (tabController.index == 1) {
|
|
|
|
_getStoreWineCheckList(context, showLoading: false);
|
|
|
|
}
|
|
|
|
// contantShowModel.searchData(
|
|
|
|
// contantShowModel.controller.text);
|
|
|
|
// _searchSellerLocation();
|
|
|
|
// _focusNode.unfocus();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
...
|
...
|
@@ -248,9 +287,15 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> |
|
|
|
onTap: () {
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback(((_) {
|
|
|
|
searchC.clear();
|
|
|
|
// customerProvider.searchData('');
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
// _getContantData(showLoading: false);
|
|
|
|
if (tabController.index == 0) {
|
|
|
|
_getStoreWineBySeller(context, showLoading: false);
|
|
|
|
}
|
|
|
|
if (tabController.index == 1) {
|
|
|
|
_getStoreWineCheckList(context, showLoading: false);
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
)),
|
|
...
|
...
|
@@ -331,7 +376,9 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> |
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
storeWineProvider = Provider.of<StoreWineProvider>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
return KeyboardDismissOnTap(
|
|
|
|
child: Scaffold(
|
|
|
|
resizeToAvoidBottomInset: false,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'存酒管理',
|
|
|
|
onTap: () {
|
|
...
|
...
|
@@ -389,7 +436,7 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> |
|
|
|
)
|
|
|
|
],
|
|
|
|
onRefresh: () async {
|
|
|
|
await storeWineProvider.getStoreWineBySeller(context,
|
|
|
|
await _getStoreWineBySeller(context,
|
|
|
|
showLoading: false);
|
|
|
|
// offset = 0;
|
|
|
|
// getMessage(typeid, showLoading: false);
|
|
...
|
...
|
@@ -421,7 +468,7 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> |
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageStateRecordHome,
|
|
|
|
callback: () async {
|
|
|
|
await storeWineProvider.getStoreWineCheckList(context,
|
|
|
|
await _getStoreWineCheckList(context,
|
|
|
|
showLoading: true);
|
|
|
|
// offset = 0;
|
|
|
|
// getMessage(showLoading: true);
|
|
...
|
...
|
@@ -455,7 +502,7 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> |
|
|
|
)
|
|
|
|
],
|
|
|
|
onRefresh: () async {
|
|
|
|
await storeWineProvider.getStoreWineCheckList(context,
|
|
|
|
await _getStoreWineCheckList(context,
|
|
|
|
showLoading: false);
|
|
|
|
// offset = 0;
|
|
|
|
// getMessage(typeid, showLoading: false);
|
|
...
|
...
|
@@ -552,6 +599,6 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> |
|
|
|
// ],
|
|
|
|
])),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|