|
|
|
@ -2,9 +2,11 @@ import 'package:dio/dio.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/activity_order_list.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/exchange_order.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/page.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/min_api.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart'; |
|
|
|
@ -37,6 +39,9 @@ class _BargainGroupOrder extends State<BargainGroupOrder>
|
|
|
|
|
super.initState(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///查看我的拼团、砍价、列表 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void didChangeDependencies() { |
|
|
|
|
super.didChangeDependencies(); |
|
|
|
@ -118,24 +123,55 @@ class ExchangeHistoryList extends StatefulWidget {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
|
ApiService apiService; |
|
|
|
|
|
|
|
|
|
MinApiService minService; |
|
|
|
|
List<ActivityOrderList> activityOrderList = []; |
|
|
|
|
RefreshController _refreshController = |
|
|
|
|
RefreshController(initialRefresh: false); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
|
apiService = ApiService(Dio(), |
|
|
|
|
context: context, token: value.getString('token')), |
|
|
|
|
}); |
|
|
|
|
SharedPreferences.getInstance().then((value) { |
|
|
|
|
String minToken = value.getString("minToken"); |
|
|
|
|
String tenant = value.getString("tenant"); |
|
|
|
|
String storeId = value.getString("storeId"); |
|
|
|
|
minService = MinApiService( |
|
|
|
|
Dio(), |
|
|
|
|
context: context, |
|
|
|
|
token: minToken, |
|
|
|
|
tenant: tenant, |
|
|
|
|
storeId: storeId, |
|
|
|
|
); |
|
|
|
|
queryShowMyActList(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryShowMyActList() async { |
|
|
|
|
BaseData<List<ActivityOrderList>> baseData = |
|
|
|
|
await minService.showMyActList({ |
|
|
|
|
"state":0, |
|
|
|
|
"type" :1, |
|
|
|
|
}).catchError((error) { |
|
|
|
|
_refreshController.loadFailed(); |
|
|
|
|
_refreshController.refreshFailed(); |
|
|
|
|
}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
_refreshController.refreshCompleted(); |
|
|
|
|
setState(() { |
|
|
|
|
activityOrderList.clear(); |
|
|
|
|
if(baseData.data.length > 0) |
|
|
|
|
activityOrderList.addAll(baseData.data); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
_refreshController.refreshFailed(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int pageNum = 1; |
|
|
|
|
// int pageNum = 1; |
|
|
|
|
|
|
|
|
|
_refresh() { |
|
|
|
|
pageNum = 1; |
|
|
|
|
// pageNum = 1; |
|
|
|
|
queryShowMyActList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@ -151,21 +187,20 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
|
|
|
|
), |
|
|
|
|
controller: _refreshController, |
|
|
|
|
onRefresh: _refresh, |
|
|
|
|
// onLoading: queryHistory, |
|
|
|
|
onLoading: queryShowMyActList, |
|
|
|
|
child: |
|
|
|
|
// orders == null || orders.length == 0 |
|
|
|
|
// ? NoDataView( |
|
|
|
|
// isShowBtn: false, |
|
|
|
|
// text: "还没有订单,快去下一单吧~", |
|
|
|
|
// fontSize: 16.sp, |
|
|
|
|
// margin: EdgeInsets.only(top: 120.h), |
|
|
|
|
// ) |
|
|
|
|
// : |
|
|
|
|
(activityOrderList?.length ?? 0) < 0 |
|
|
|
|
? NoDataView( |
|
|
|
|
isShowBtn: false, |
|
|
|
|
text: "还没有订单,快去下一单吧~", |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
margin: EdgeInsets.only(top: 120.h), |
|
|
|
|
) |
|
|
|
|
: |
|
|
|
|
ListView.builder( |
|
|
|
|
// itemCount: orders == null ? 0 : orders.length, |
|
|
|
|
itemCount: 5, |
|
|
|
|
itemCount: activityOrderList?.length ?? 0, |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return bargainOrder(); |
|
|
|
|
return bargainOrder(activityOrderList[position]); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
@ -187,7 +222,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
|
|
|
|
return orderStatus; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget bargainOrder() { |
|
|
|
|
Widget bargainOrder(ActivityOrderList activityOrderList) { |
|
|
|
|
return Container( |
|
|
|
|
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
@ -235,8 +270,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
|
|
|
|
margin: EdgeInsets.only(left: 6.w, top: 12.h), |
|
|
|
|
alignment: Alignment.centerLeft, |
|
|
|
|
child: Text( |
|
|
|
|
// (orderInfo != null) ? orderInfo.storeName : "", |
|
|
|
|
"一心回乡商城", |
|
|
|
|
activityOrderList?.storeName ?? "", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
@ -260,7 +294,8 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
|
|
|
|
// orderInfo.sendStatus, |
|
|
|
|
// orderInfo.isTakeOut) |
|
|
|
|
// : "", |
|
|
|
|
"还差¥23.4砍价成功", |
|
|
|
|
// "还差¥{activityOrderList?.howManyMoney ?? ""}砍价成功", |
|
|
|
|
"还差${activityOrderList?.howManyMore ?? 0}人拼团成功", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
@ -286,7 +321,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
S.of(context).xiadanshijian_("下单时间:2020.01.20 10:50:22"), |
|
|
|
|
S.of(context).xiadanshijian_(activityOrderList?.joinTime ?? ""), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
color: Color(0xFF727272), |
|
|
|
@ -302,18 +337,13 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
// MImage( |
|
|
|
|
// "", |
|
|
|
|
// width: 81.w, |
|
|
|
|
// height: 81.h, |
|
|
|
|
// fit: BoxFit.cover, |
|
|
|
|
// errorSrc: "assets/image/default_1.png", |
|
|
|
|
// fadeSrc: "assets/image/default_1.png", |
|
|
|
|
// ), |
|
|
|
|
Image.asset( |
|
|
|
|
"assets/image/icon_story_td.png", |
|
|
|
|
width: 81, |
|
|
|
|
height: 81, |
|
|
|
|
MImage( |
|
|
|
|
activityOrderList?.productImg ?? "", |
|
|
|
|
width: 81.w, |
|
|
|
|
height: 81.h, |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
errorSrc: "assets/image/default_1.png", |
|
|
|
|
fadeSrc: "assets/image/default_1.png", |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 10, |
|
|
|
@ -324,7 +354,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
"[生态小农]山林放养鸡蛋30枚/盒", |
|
|
|
|
activityOrderList?.storeName ?? "", |
|
|
|
|
maxLines: 2, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
@ -334,7 +364,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"套盒装", |
|
|
|
|
activityOrderList?.productSkuName ?? "", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
@ -357,7 +387,8 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: "已砍至:", |
|
|
|
|
// text: "已砍至:", |
|
|
|
|
text: S.of(context).heji, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
@ -365,7 +396,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "58.2", |
|
|
|
|
text:activityOrderList?.orderSum ?? "0", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|