|
|
@ -56,27 +56,26 @@ class _WelfareExchange extends State<WelfareExchange> |
|
|
|
super.initState(); |
|
|
|
super.initState(); |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
apiService = ApiService(Dio(), |
|
|
|
apiService = ApiService(Dio(), |
|
|
|
context: context, token: value.getString("token")), |
|
|
|
context: context, token: value.getString("token"), showLoading: false), |
|
|
|
creditGoods(), |
|
|
|
creditGoods(), |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
queryUser() async { |
|
|
|
queryUser() async { |
|
|
|
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); |
|
|
|
BaseData<UserInfo> baseData = |
|
|
|
BaseData<UserInfo> baseData = |
|
|
|
await apiService.queryInfo().catchError((onError) {}); |
|
|
|
await apiService.queryInfo().catchError((onError) {}); |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
userInfo = baseData.data; |
|
|
|
userInfo = baseData.data; |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
EasyLoading.dismiss(); |
|
|
|
value.setString('user', jsonEncode(baseData.data)), |
|
|
|
setState(() {}); |
|
|
|
}); |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
} |
|
|
|
value.setString('user', jsonEncode(baseData.data)), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
creditGoods() async { |
|
|
|
creditGoods({isLoading = true}) async { |
|
|
|
// EasyLoading.show(status: S.current.zhengzaijiazai); |
|
|
|
try{ |
|
|
|
|
|
|
|
if(isLoading) |
|
|
|
|
|
|
|
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); |
|
|
|
|
|
|
|
|
|
|
|
final SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
final SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
apiService = ApiService(Dio(), |
|
|
|
apiService = ApiService(Dio(), |
|
|
@ -99,7 +98,7 @@ class _WelfareExchange extends State<WelfareExchange> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BaseData<PageInfo<GoodsCategory>> dataCategory = |
|
|
|
BaseData<PageInfo<GoodsCategory>> dataCategory = |
|
|
|
await apiService.goodsCategory({ |
|
|
|
await apiService.goodsCategory({ |
|
|
|
"current": 1, |
|
|
|
"current": 1, |
|
|
|
"map": {}, |
|
|
|
"map": {}, |
|
|
|
"model": {"pageNum": 1, "pageSize": 20, "searchKey": ""}, |
|
|
|
"model": {"pageNum": 1, "pageSize": 20, "searchKey": ""}, |
|
|
@ -117,7 +116,9 @@ class _WelfareExchange extends State<WelfareExchange> |
|
|
|
dataCategory.data.records != null && |
|
|
|
dataCategory.data.records != null && |
|
|
|
dataCategory.data.records.length > 0) { |
|
|
|
dataCategory.data.records.length > 0) { |
|
|
|
gooodsCategorys.clear(); |
|
|
|
gooodsCategorys.clear(); |
|
|
|
gooodsCategorys.add(GoodsCategory(name: S.of(context).quanbu)); |
|
|
|
gooodsCategorys.add(GoodsCategory(name: S |
|
|
|
|
|
|
|
.of(context) |
|
|
|
|
|
|
|
.quanbu)); |
|
|
|
gooodsCategorys.addAll(dataCategory.data.records); |
|
|
|
gooodsCategorys.addAll(dataCategory.data.records); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -130,11 +131,10 @@ class _WelfareExchange extends State<WelfareExchange> |
|
|
|
"state": 1 |
|
|
|
"state": 1 |
|
|
|
}; |
|
|
|
}; |
|
|
|
BaseData<PageInfo<Goods>> pageGoods = |
|
|
|
BaseData<PageInfo<Goods>> pageGoods = |
|
|
|
await apiService.creditGoods(param).catchError((onError) { |
|
|
|
await apiService.creditGoods(param).catchError((onError) { |
|
|
|
refreshController.loadFailed(); |
|
|
|
refreshController.loadFailed(); |
|
|
|
refreshController.refreshFailed(); |
|
|
|
refreshController.refreshFailed(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
|
|
|
if (pageGoods != null && pageGoods.isSuccess) { |
|
|
|
if (pageGoods != null && pageGoods.isSuccess) { |
|
|
|
if (pageNum == 1) { |
|
|
|
if (pageNum == 1) { |
|
|
|
goods.clear(); |
|
|
|
goods.clear(); |
|
|
@ -151,11 +151,14 @@ class _WelfareExchange extends State<WelfareExchange> |
|
|
|
refreshController.loadFailed(); |
|
|
|
refreshController.loadFailed(); |
|
|
|
refreshController.refreshFailed(); |
|
|
|
refreshController.refreshFailed(); |
|
|
|
} |
|
|
|
} |
|
|
|
setState(() {}); |
|
|
|
}finally{ |
|
|
|
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
|
|
|
setState(() {}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_onRefresh() { |
|
|
|
_onRefresh() { |
|
|
|
creditGoods(); |
|
|
|
creditGoods(isLoading: false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
@ -248,7 +251,6 @@ class _WelfareExchange extends State<WelfareExchange> |
|
|
|
categoryId = gooodsCategorys[index].id; |
|
|
|
categoryId = gooodsCategorys[index].id; |
|
|
|
pageNum = 1; |
|
|
|
pageNum = 1; |
|
|
|
creditGoods(); |
|
|
|
creditGoods(); |
|
|
|
setState(() {}); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|