|
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
|
} |