Browse Source

兑换历史页面优化更改;

明细页面优化更改;
福利兑换页面优化更改;
dev
wurong 1 year ago
parent
commit
1faf237205
  1. 22
      lib/home/welfare_exchange.dart
  2. 11
      lib/integral/integral_detailed_page.dart
  3. 26
      lib/order/exchange_history_page.dart

22
lib/home/welfare_exchange.dart

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

11
lib/integral/integral_detailed_page.dart

@ -32,6 +32,11 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
List<Widget> _tabs;
TabController tabController;
ApiService apiService;
UserInfo userInfo;
int current = 1;
List<UserBill> userBill = [];
RefreshController refreshController = RefreshController();
@override
void didChangeDependencies() {
@ -55,8 +60,6 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
});
}
ApiService apiService;
UserInfo userInfo;
@override
void dispose() {
@ -75,9 +78,6 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
});
}
int current = 1;
List<UserBill> userBill = [];
queryDetail(category,type) async {
BaseData<PageInfo<UserBill>> baseData = await apiService.queryBillInfo({
"current": current,
@ -106,7 +106,6 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
}
}
RefreshController refreshController = RefreshController();
_onRefresh() {
current = 1;

26
lib/order/exchange_history_page.dart

@ -1,6 +1,7 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/exchange_order.dart';
@ -125,25 +126,25 @@ class ExchangeHistoryList extends StatefulWidget {
class _ExchangeHistoryList extends State<ExchangeHistoryList>
with AutomaticKeepAliveClientMixin{
ApiService apiService;
RefreshController _refreshController =
RefreshController(initialRefresh: false);
RefreshController _refreshController = RefreshController(initialRefresh: false);
int pageNum = 1;
List<ExchangeOrder> orders = [];
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(),
showLoading: true,
showLoading: false,
context: context, token: value.getString('token')),
queryHistory(),
});
}
int pageNum = 1;
List<ExchangeOrder> orders = [];
queryHistory() async {
queryHistory({isLoading = true}) async {
try{
if(isLoading)
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
var map = {
"pageNum": pageNum,
"pageSize": 10,
@ -162,7 +163,6 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
orders.clear();
}
orders.addAll(baseData.data.list);
setState(() {
_refreshController.loadComplete();
_refreshController.refreshCompleted();
if (baseData.data.pages == baseData.data.pageNum) {
@ -170,16 +170,18 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
} else {
pageNum += 1;
}
});
} else {
_refreshController.refreshFailed();
_refreshController.loadFailed();
}}finally{
EasyLoading.dismiss();
setState(() {});
}
}
_refresh() {
pageNum = 1;
queryHistory();
queryHistory(isLoading: false);
}
@override
@ -531,7 +533,6 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
Navigator.of(context).pushNamed(
'/router/logistics_information_page',
arguments: {
@ -541,7 +542,6 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
"productNum": exchangeOrder.creditOrderDetailList[0].goodsNumber,
"skuImg":exchangeOrder.creditOrderDetailList[0].goodsMainImg
});
});
},
child: buildBtnStatusTow(exchangeOrder.sendStatus),
))

Loading…
Cancel
Save