Commit 8eede8876b29ab04e9c88b59d614ed194866cbf7

Authored by wdn127929
1 parent 74b92374

搜索

@@ -37,6 +37,11 @@ class _ApplyOutStorePageState extends State<ApplyOutStorePage> { @@ -37,6 +37,11 @@ class _ApplyOutStorePageState extends State<ApplyOutStorePage> {
37 void initState() { 37 void initState() {
38 // TODO: implement initState 38 // TODO: implement initState
39 super.initState(); 39 super.initState();
  40 +
  41 + widget.wineManageDetail.wineDataMove.forEach((element) {
  42 + element.wineNumC.text = element.wineAmount; //出库数量初始化剩余库存量
  43 + element.checkAmount = element.wineAmount; //出库数量初始化剩余库存量
  44 + });
40 } 45 }
41 46
42 Widget _textItemWidget( 47 Widget _textItemWidget(
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_easyrefresh/easy_refresh.dart'; 2 import 'package:flutter_easyrefresh/easy_refresh.dart';
  3 +import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
3 import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 import 'package:one_key/models/out_wine_record_model.dart'; 5 import 'package:one_key/models/out_wine_record_model.dart';
5 import 'package:one_key/models/wine_manage_model.dart'; 6 import 'package:one_key/models/wine_manage_model.dart';
@@ -65,11 +66,9 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -65,11 +66,9 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
65 index = tabController.index; 66 index = tabController.index;
66 67
67 if (index == 0) { 68 if (index == 0) {
68 - await storeWineProvider.getStoreWineBySeller(context,  
69 - showLoading: false); 69 + await _getStoreWineBySeller(context, showLoading: false);
70 } else if (index == 1) { 70 } else if (index == 1) {
71 - await storeWineProvider.getStoreWineCheckList(context,  
72 - showLoading: false); 71 + await _getStoreWineCheckList(context, showLoading: false);
73 } 72 }
74 73
75 // _getContantData(first: true); 74 // _getContantData(first: true);
@@ -81,19 +80,18 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -81,19 +80,18 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
81 // _getContantData(first: first); 80 // _getContantData(first: first);
82 await _getAuthUserLists(showLoading: true); 81 await _getAuthUserLists(showLoading: true);
83 82
84 - await storeWineProvider.getStoreWineBySeller(context, showLoading: true);  
85 -  
86 - await storeWineProvider.getStoreWineCheckList(context, showLoading: true); 83 + _getStoreWineBySeller(context, showLoading: true);
  84 + _getStoreWineCheckList(context, showLoading: true);
87 }); 85 });
88 bus.on("refresh_wine_home_all_list", (arg) async { 86 bus.on("refresh_wine_home_all_list", (arg) async {
89 - await storeWineProvider.getStoreWineBySeller(context, showLoading: true); 87 + _getStoreWineBySeller(context, showLoading: true);
90 }); 88 });
91 bus.on("refresh_wine_home_list", (arg) async { 89 bus.on("refresh_wine_home_list", (arg) async {
92 print(arg['index']); 90 print(arg['index']);
93 tabController.index = arg['index']; 91 tabController.index = arg['index'];
94 index = arg['index']; 92 index = arg['index'];
95 - await storeWineProvider.getStoreWineBySeller(context, showLoading: true);  
96 - await storeWineProvider.getStoreWineCheckList(context, showLoading: true); 93 + _getStoreWineBySeller(context, showLoading: true);
  94 + _getStoreWineCheckList(context, showLoading: true);
97 }); 95 });
98 } 96 }
99 97
@@ -104,6 +102,29 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -104,6 +102,29 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
104 bus.off('refresh_wine_home_list'); 102 bus.off('refresh_wine_home_list');
105 } 103 }
106 104
  105 + _getStoreWineBySeller(BuildContext context, {bool showLoading = true}) async {
  106 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  107 + Map<String, String> params = {"sid": userModel.user.sellerid};
  108 +
  109 + if (searchC.text.trim().length > 0) {
  110 + params['keyword'] = searchC.text; //搜索手机号/姓名
  111 + }
  112 + await storeWineProvider.getStoreWineBySeller(context, params,
  113 + showLoading: showLoading);
  114 + }
  115 +
  116 + _getStoreWineCheckList(BuildContext context,
  117 + {bool showLoading = true}) async {
  118 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  119 + Map<String, String> params = {"sid": userModel.user.sellerid};
  120 +
  121 + if (searchC.text.trim().length > 0) {
  122 + params['keyword'] = searchC.text; //搜索手机号/姓名
  123 + }
  124 + await storeWineProvider.getStoreWineCheckList(context, params,
  125 + showLoading: showLoading);
  126 + }
  127 +
107 //获取员工信息列表 128 //获取员工信息列表
108 _getAuthUserLists({bool showLoading = true}) async { 129 _getAuthUserLists({bool showLoading = true}) async {
109 Map<String, String> params = { 130 Map<String, String> params = {
@@ -220,12 +241,30 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -220,12 +241,30 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
220 textInputAction: TextInputAction.done, 241 textInputAction: TextInputAction.done,
221 242
222 onChanged: (value) { 243 onChanged: (value) {
223 - // _getContantData(showLoading: false); 244 + // setState(() {});
  245 + // _searchSellerLocation();
  246 + // customerProvider.searchData(value);
  247 +
  248 + if (tabController.index == 0) {
  249 + _getStoreWineBySeller(context, showLoading: false);
  250 + }
  251 + if (tabController.index == 1) {
  252 + _getStoreWineCheckList(context, showLoading: false);
  253 + }
224 }, 254 },
225 onEditingComplete: () { 255 onEditingComplete: () {
226 FocusScope.of(context) 256 FocusScope.of(context)
227 .requestFocus(FocusNode()); //点击空白处隐藏键盘 257 .requestFocus(FocusNode()); //点击空白处隐藏键盘
228 - // _getContantData(showLoading: false); 258 + if (tabController.index == 0) {
  259 + _getStoreWineBySeller(context, showLoading: false);
  260 + }
  261 + if (tabController.index == 1) {
  262 + _getStoreWineCheckList(context, showLoading: false);
  263 + }
  264 + // contantShowModel.searchData(
  265 + // contantShowModel.controller.text);
  266 + // _searchSellerLocation();
  267 + // _focusNode.unfocus();
229 }, 268 },
230 ), 269 ),
231 ), 270 ),
@@ -248,9 +287,15 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -248,9 +287,15 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
248 onTap: () { 287 onTap: () {
249 WidgetsBinding.instance.addPostFrameCallback(((_) { 288 WidgetsBinding.instance.addPostFrameCallback(((_) {
250 searchC.clear(); 289 searchC.clear();
  290 + // customerProvider.searchData('');
251 FocusScope.of(context) 291 FocusScope.of(context)
252 .requestFocus(FocusNode()); //点击空白处隐藏键盘 292 .requestFocus(FocusNode()); //点击空白处隐藏键盘
253 - // _getContantData(showLoading: false); 293 + if (tabController.index == 0) {
  294 + _getStoreWineBySeller(context, showLoading: false);
  295 + }
  296 + if (tabController.index == 1) {
  297 + _getStoreWineCheckList(context, showLoading: false);
  298 + }
254 })); 299 }));
255 }, 300 },
256 )), 301 )),
@@ -331,7 +376,9 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -331,7 +376,9 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
331 @override 376 @override
332 Widget build(BuildContext context) { 377 Widget build(BuildContext context) {
333 storeWineProvider = Provider.of<StoreWineProvider>(context, listen: true); 378 storeWineProvider = Provider.of<StoreWineProvider>(context, listen: true);
334 - return Scaffold( 379 + return KeyboardDismissOnTap(
  380 + child: Scaffold(
  381 + resizeToAvoidBottomInset: false,
335 appBar: SystemAppBar( 382 appBar: SystemAppBar(
336 '存酒管理', 383 '存酒管理',
337 onTap: () { 384 onTap: () {
@@ -389,7 +436,7 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -389,7 +436,7 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
389 ) 436 )
390 ], 437 ],
391 onRefresh: () async { 438 onRefresh: () async {
392 - await storeWineProvider.getStoreWineBySeller(context, 439 + await _getStoreWineBySeller(context,
393 showLoading: false); 440 showLoading: false);
394 // offset = 0; 441 // offset = 0;
395 // getMessage(typeid, showLoading: false); 442 // getMessage(typeid, showLoading: false);
@@ -421,7 +468,7 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -421,7 +468,7 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
421 return ExceptionPage( 468 return ExceptionPage(
422 pageState: model.pageStateRecordHome, 469 pageState: model.pageStateRecordHome,
423 callback: () async { 470 callback: () async {
424 - await storeWineProvider.getStoreWineCheckList(context, 471 + await _getStoreWineCheckList(context,
425 showLoading: true); 472 showLoading: true);
426 // offset = 0; 473 // offset = 0;
427 // getMessage(showLoading: true); 474 // getMessage(showLoading: true);
@@ -455,7 +502,7 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -455,7 +502,7 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
455 ) 502 )
456 ], 503 ],
457 onRefresh: () async { 504 onRefresh: () async {
458 - await storeWineProvider.getStoreWineCheckList(context, 505 + await _getStoreWineCheckList(context,
459 showLoading: false); 506 showLoading: false);
460 // offset = 0; 507 // offset = 0;
461 // getMessage(typeid, showLoading: false); 508 // getMessage(typeid, showLoading: false);
@@ -552,6 +599,6 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage> @@ -552,6 +599,6 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
552 // ], 599 // ],
553 ])), 600 ])),
554 ), 601 ),
555 - ); 602 + ));
556 } 603 }
557 } 604 }
@@ -20,7 +20,7 @@ class StoreWineProvider with ChangeNotifier { @@ -20,7 +20,7 @@ class StoreWineProvider with ChangeNotifier {
20 PageState pageStateRecord = PageState.Loading; //取酒记录单个存酒 20 PageState pageStateRecord = PageState.Loading; //取酒记录单个存酒
21 PageState pageStateDetail = PageState.Loading; //存酒详情 21 PageState pageStateDetail = PageState.Loading; //存酒详情
22 PageState pageStateDetailRecord = PageState.Success; //出库记录列表详情 22 PageState pageStateDetailRecord = PageState.Success; //出库记录列表详情
23 - PageState pageStateRecordHome = PageState.Loading; //取酒记录首页 23 + PageState pageStateRecordHome = PageState.Loading; //取酒记录首页
24 List<WineManageModel> wineManageList; //存酒列表数据 24 List<WineManageModel> wineManageList; //存酒列表数据
25 25
26 WineManageModel wineManageDetail; //存酒详情数据 26 WineManageModel wineManageDetail; //存酒详情数据
@@ -104,10 +104,9 @@ class StoreWineProvider with ChangeNotifier { @@ -104,10 +104,9 @@ class StoreWineProvider with ChangeNotifier {
104 } 104 }
105 105
106 // 获取存酒列表 106 // 获取存酒列表
107 - Future<bool> getStoreWineBySeller(BuildContext context, 107 + Future<bool> getStoreWineBySeller(
  108 + BuildContext context, Map<String, String> params,
108 {bool showLoading = true}) async { 109 {bool showLoading = true}) async {
109 - UserModel userModel = Provider.of<UserModel>(context, listen: false);  
110 - Map<String, String> params = {"sid": userModel.user.sellerid};  
111 BaseResp<dynamic> baseResp = await DioUtil() 110 BaseResp<dynamic> baseResp = await DioUtil()
112 .request<dynamic>(context, Method.get, HttpUrl.get_store_wine_by_seller, 111 .request<dynamic>(context, Method.get, HttpUrl.get_store_wine_by_seller,
113 data: params, showLoading: showLoading) 112 data: params, showLoading: showLoading)
@@ -226,10 +225,9 @@ class StoreWineProvider with ChangeNotifier { @@ -226,10 +225,9 @@ class StoreWineProvider with ChangeNotifier {
226 } 225 }
227 226
228 // 获取取酒记录 227 // 获取取酒记录
229 - Future<bool> getStoreWineCheckList(BuildContext context, 228 + Future<bool> getStoreWineCheckList(
  229 + BuildContext context, Map<String, String> params,
230 {bool showLoading = true}) async { 230 {bool showLoading = true}) async {
231 - UserModel userModel = Provider.of<UserModel>(context, listen: false);  
232 - Map<String, String> params = {"sid": userModel.user.sellerid};  
233 BaseResp<dynamic> baseResp = await DioUtil() 231 BaseResp<dynamic> baseResp = await DioUtil()
234 .request<dynamic>( 232 .request<dynamic>(
235 context, Method.get, HttpUrl.get_store_wine_check_list, 233 context, Method.get, HttpUrl.get_store_wine_check_list,