|
|
@ -9,7 +9,6 @@ import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/order_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/order_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/order_product_vo.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/order_product_vo.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/page.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/page.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/product.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/min_api.dart'; |
|
|
|
import 'package:huixiang/retrofit/min_api.dart'; |
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
import 'package:huixiang/store/scan.dart'; |
|
|
|
import 'package:huixiang/store/scan.dart'; |
|
|
@ -24,6 +23,7 @@ import 'package:huixiang/view_widget/tips_dialog.dart'; |
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
|
|
|
import 'package:shimmer/shimmer.dart'; |
|
|
|
|
|
|
|
|
|
|
|
import '../retrofit/data/user_info.dart'; |
|
|
|
import '../retrofit/data/user_info.dart'; |
|
|
|
|
|
|
|
|
|
|
@ -139,12 +139,14 @@ class _OrderHistoryList extends State<OrderHistoryList> |
|
|
|
int current = 1; |
|
|
|
int current = 1; |
|
|
|
List<OrderInfo> orderInfos = []; |
|
|
|
List<OrderInfo> orderInfos = []; |
|
|
|
UserInfo userInfo; |
|
|
|
UserInfo userInfo; |
|
|
|
|
|
|
|
int networkStatus = 0; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
super.initState(); |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
apiService = ApiService(Dio(), |
|
|
|
apiService = ApiService(Dio(), |
|
|
|
showLoading: true, |
|
|
|
// showLoading: true, |
|
|
|
context: context, |
|
|
|
context: context, |
|
|
|
token: value.getString("token")), |
|
|
|
token: value.getString("token")), |
|
|
|
queryOrder(), |
|
|
|
queryOrder(), |
|
|
@ -157,7 +159,10 @@ class _OrderHistoryList extends State<OrderHistoryList> |
|
|
|
queryOrder(); |
|
|
|
queryOrder(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
queryOrder() async { |
|
|
|
queryOrder({bool isLoading = true}) async { |
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
if(isLoading) |
|
|
|
|
|
|
|
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); |
|
|
|
BaseData<PageInfo<OrderInfo>> baseData = await apiService.orderList({ |
|
|
|
BaseData<PageInfo<OrderInfo>> baseData = await apiService.orderList({ |
|
|
|
"current": current, |
|
|
|
"current": current, |
|
|
|
"model": {"status": widget.orderStatus}, |
|
|
|
"model": {"status": widget.orderStatus}, |
|
|
@ -165,6 +170,7 @@ class _OrderHistoryList extends State<OrderHistoryList> |
|
|
|
"size": 10, |
|
|
|
"size": 10, |
|
|
|
"sort": "id" |
|
|
|
"sort": "id" |
|
|
|
}).catchError((onError) { |
|
|
|
}).catchError((onError) { |
|
|
|
|
|
|
|
networkStatus = -1; |
|
|
|
refreshController.refreshFailed(); |
|
|
|
refreshController.refreshFailed(); |
|
|
|
refreshController.loadFailed(); |
|
|
|
refreshController.loadFailed(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -186,11 +192,14 @@ class _OrderHistoryList extends State<OrderHistoryList> |
|
|
|
current += 1; |
|
|
|
current += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
setState(() {}); |
|
|
|
setState(() {}); |
|
|
|
|
|
|
|
networkStatus = 1; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if((baseData?.msg ?? "") != "") |
|
|
|
if((baseData?.msg ?? "") != "") |
|
|
|
SmartDialog.showToast(baseData.msg,alignment: Alignment.center); |
|
|
|
SmartDialog.showToast(baseData.msg,alignment: Alignment.center); |
|
|
|
refreshController.refreshFailed(); |
|
|
|
refreshController.refreshFailed(); |
|
|
|
refreshController.loadFailed(); |
|
|
|
refreshController.loadFailed(); |
|
|
|
|
|
|
|
}}finally{ |
|
|
|
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -333,8 +342,20 @@ class _OrderHistoryList extends State<OrderHistoryList> |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
onRefresh: _onRefresh, |
|
|
|
onRefresh: _onRefresh, |
|
|
|
onLoading: queryOrder, |
|
|
|
onLoading: (){ |
|
|
|
child: (orderInfos != null && orderInfos.length > 0) |
|
|
|
queryOrder(isLoading: false); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
child: networkStatus == 0 ? ListView.builder( |
|
|
|
|
|
|
|
itemCount: 10, |
|
|
|
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
|
|
|
shrinkWrap: true, |
|
|
|
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
|
|
|
return GestureDetector( |
|
|
|
|
|
|
|
onTap: () {}, |
|
|
|
|
|
|
|
child: orderItemSm(), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
) : ((orderInfos != null && orderInfos.length > 0) |
|
|
|
? ListView.builder( |
|
|
|
? ListView.builder( |
|
|
|
itemCount: orderInfos != null ? orderInfos.length : 0, |
|
|
|
itemCount: orderInfos != null ? orderInfos.length : 0, |
|
|
|
itemBuilder: (context, position) { |
|
|
|
itemBuilder: (context, position) { |
|
|
@ -352,7 +373,7 @@ class _OrderHistoryList extends State<OrderHistoryList> |
|
|
|
text: "目前暂无订单,快去下一单吧~", |
|
|
|
text: "目前暂无订单,快去下一单吧~", |
|
|
|
fontSize: 16.sp, |
|
|
|
fontSize: 16.sp, |
|
|
|
margin: EdgeInsets.only(top: 120), |
|
|
|
margin: EdgeInsets.only(top: 120), |
|
|
|
), |
|
|
|
)), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -714,6 +735,194 @@ class _OrderHistoryList extends State<OrderHistoryList> |
|
|
|
.toList(); |
|
|
|
.toList(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget orderItemSm() { |
|
|
|
|
|
|
|
return Container( |
|
|
|
|
|
|
|
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), |
|
|
|
|
|
|
|
padding: EdgeInsets.only(top: 12,bottom: 13.h,left: 13.w), |
|
|
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
|
|
color: Colors.white, |
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(4), |
|
|
|
|
|
|
|
boxShadow: [ |
|
|
|
|
|
|
|
BoxShadow( |
|
|
|
|
|
|
|
color: Colors.black.withAlpha(25), |
|
|
|
|
|
|
|
offset: Offset(0, 1), |
|
|
|
|
|
|
|
blurRadius: 12, |
|
|
|
|
|
|
|
spreadRadius: 0, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
child: Column( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Row( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Shimmer.fromColors( |
|
|
|
|
|
|
|
baseColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
highlightColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
color: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
width:213.w, |
|
|
|
|
|
|
|
height: 20.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Padding( |
|
|
|
|
|
|
|
padding: EdgeInsets.only(right: 12.w), |
|
|
|
|
|
|
|
child: Shimmer.fromColors( |
|
|
|
|
|
|
|
baseColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
highlightColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
color: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
width:44.w, |
|
|
|
|
|
|
|
height: 20.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Container( |
|
|
|
|
|
|
|
margin: EdgeInsets.only(top:5.h), |
|
|
|
|
|
|
|
child: Column( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Shimmer.fromColors( |
|
|
|
|
|
|
|
baseColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
highlightColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
color: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
width:160.w, |
|
|
|
|
|
|
|
height: 16.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox( |
|
|
|
|
|
|
|
height: 8.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Row( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
child: goodsItemSm(), |
|
|
|
|
|
|
|
flex: 1, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Padding( |
|
|
|
|
|
|
|
padding: EdgeInsets.all(22.w), |
|
|
|
|
|
|
|
child: Image.asset( |
|
|
|
|
|
|
|
"assets/image/icon_order_more.webp", |
|
|
|
|
|
|
|
width: 24, |
|
|
|
|
|
|
|
height: 24, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox( |
|
|
|
|
|
|
|
height: 12.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Container( |
|
|
|
|
|
|
|
alignment: Alignment.centerRight, |
|
|
|
|
|
|
|
margin: EdgeInsets.only(right: 12.w, bottom: 12.h), |
|
|
|
|
|
|
|
child: Directionality( |
|
|
|
|
|
|
|
textDirection: TextDirection.rtl, |
|
|
|
|
|
|
|
child: Column( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Row( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Shimmer.fromColors( |
|
|
|
|
|
|
|
baseColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
highlightColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
color: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
width:75.w, |
|
|
|
|
|
|
|
height: 20.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox( |
|
|
|
|
|
|
|
width: 4.w, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Shimmer.fromColors( |
|
|
|
|
|
|
|
baseColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
highlightColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
color: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
width:33.w, |
|
|
|
|
|
|
|
height: 17.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox( |
|
|
|
|
|
|
|
height: 8.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Shimmer.fromColors( |
|
|
|
|
|
|
|
baseColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
highlightColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
|
|
color: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(10), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
width:72.w, |
|
|
|
|
|
|
|
height: 25.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget goodsItemSm(){ |
|
|
|
|
|
|
|
return Container( |
|
|
|
|
|
|
|
child: Row( |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Shimmer.fromColors( |
|
|
|
|
|
|
|
baseColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
highlightColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
color: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
width:75.w, |
|
|
|
|
|
|
|
height: 75.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox(width: 8.w), |
|
|
|
|
|
|
|
Shimmer.fromColors( |
|
|
|
|
|
|
|
baseColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
highlightColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
color: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
width:75.w, |
|
|
|
|
|
|
|
height: 75.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox(width: 8.w), |
|
|
|
|
|
|
|
Shimmer.fromColors( |
|
|
|
|
|
|
|
baseColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
highlightColor: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
child: Container( |
|
|
|
|
|
|
|
color: Color(0XFFD8D8D8), |
|
|
|
|
|
|
|
width:75.w, |
|
|
|
|
|
|
|
height: 75.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
bool get wantKeepAlive => true; |
|
|
|
bool get wantKeepAlive => true; |
|
|
|
} |
|
|
|
} |
|
|
|