|
|
@ -1,10 +1,14 @@ |
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/data/activity.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/activity_order_list.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/activity_order_list.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/data/store_info.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/utils/font_weight.dart'; |
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:huixiang/view_widget/classic_header.dart'; |
|
|
|
import 'package:huixiang/view_widget/classic_header.dart'; |
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
@ -61,9 +65,9 @@ class _BargainGroupOrder extends State<BargainGroupOrder> |
|
|
|
]; |
|
|
|
]; |
|
|
|
_pages = [ |
|
|
|
_pages = [ |
|
|
|
ExchangeHistoryList(0,type), |
|
|
|
ExchangeHistoryList(0,type), |
|
|
|
ExchangeHistoryList(1,type), |
|
|
|
|
|
|
|
ExchangeHistoryList(2,type), |
|
|
|
ExchangeHistoryList(2,type), |
|
|
|
ExchangeHistoryList(3,type) |
|
|
|
ExchangeHistoryList(3,type), |
|
|
|
|
|
|
|
ExchangeHistoryList(4,type) |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -124,8 +128,11 @@ class ExchangeHistoryList extends StatefulWidget { |
|
|
|
class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
MinApiService minService; |
|
|
|
MinApiService minService; |
|
|
|
List<ActivityOrderList> activityOrderList = []; |
|
|
|
List<ActivityOrderList> activityOrderList = []; |
|
|
|
RefreshController _refreshController = |
|
|
|
RefreshController _refreshController = RefreshController(initialRefresh: false); |
|
|
|
RefreshController(initialRefresh: false); |
|
|
|
ApiService apiService; |
|
|
|
|
|
|
|
StoreInfo storeInfo; |
|
|
|
|
|
|
|
List<Activity> activitys; |
|
|
|
|
|
|
|
String storeId; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
@ -140,6 +147,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
token: minToken, |
|
|
|
token: minToken, |
|
|
|
tenant: tenant, |
|
|
|
tenant: tenant, |
|
|
|
storeId: storeId, |
|
|
|
storeId: storeId, |
|
|
|
|
|
|
|
showLoading: true |
|
|
|
); |
|
|
|
); |
|
|
|
queryShowMyActList(); |
|
|
|
queryShowMyActList(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -149,7 +157,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
queryShowMyActList() async { |
|
|
|
queryShowMyActList() async { |
|
|
|
BaseData<List<ActivityOrderList>> baseData = |
|
|
|
BaseData<List<ActivityOrderList>> baseData = |
|
|
|
await minService.showMyActList({ |
|
|
|
await minService.showMyActList({ |
|
|
|
"state":0, |
|
|
|
"state":widget.orderStatus, |
|
|
|
"type" :widget.type, |
|
|
|
"type" :widget.type, |
|
|
|
}).catchError((error) { |
|
|
|
}).catchError((error) { |
|
|
|
_refreshController.loadFailed(); |
|
|
|
_refreshController.loadFailed(); |
|
|
@ -161,6 +169,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
activityOrderList.clear(); |
|
|
|
activityOrderList.clear(); |
|
|
|
if(baseData.data.length > 0) |
|
|
|
if(baseData.data.length > 0) |
|
|
|
activityOrderList.addAll(baseData.data); |
|
|
|
activityOrderList.addAll(baseData.data); |
|
|
|
|
|
|
|
queryStoreInfo(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
_refreshController.refreshFailed(); |
|
|
|
_refreshController.refreshFailed(); |
|
|
@ -168,6 +177,32 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// 查询店铺信息 |
|
|
|
|
|
|
|
queryStoreInfo() async { |
|
|
|
|
|
|
|
if (apiService == null) { |
|
|
|
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
|
|
|
|
apiService = ApiService( |
|
|
|
|
|
|
|
Dio(), |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
token: value.getString("token"), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BaseData baseData = |
|
|
|
|
|
|
|
await apiService.queryStoreInfo(activityOrderList[0].storeId).catchError((error) { |
|
|
|
|
|
|
|
debugPrint(error.toString()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
|
|
|
storeInfo = StoreInfo.fromJson(baseData.data); |
|
|
|
|
|
|
|
activitys = storeInfo.informationVOPageVO.list |
|
|
|
|
|
|
|
.map((e) => Activity.fromJson(e)) |
|
|
|
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
if (mounted) { |
|
|
|
|
|
|
|
setState(() {}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_refresh() { |
|
|
|
_refresh() { |
|
|
|
queryShowMyActList(); |
|
|
|
queryShowMyActList(); |
|
|
|
} |
|
|
|
} |
|
|
@ -198,7 +233,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
return bargainOrder(activityOrderList[position]); |
|
|
|
return bargainOrder(activityOrderList[position]); |
|
|
|
}, |
|
|
|
}, |
|
|
|
):NoDataView( |
|
|
|
):NoDataView( |
|
|
|
src: "assets/image/icon_empty.png", |
|
|
|
src: "assets/image/ding_dan.png", |
|
|
|
isShowBtn: false, |
|
|
|
isShowBtn: false, |
|
|
|
text: "还没有订单,快去下一单吧~", |
|
|
|
text: "还没有订单,快去下一单吧~", |
|
|
|
fontSize: 16.sp, |
|
|
|
fontSize: 16.sp, |
|
|
@ -257,8 +292,8 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
// borderRadius: BorderRadius.circular(2), |
|
|
|
// borderRadius: BorderRadius.circular(2), |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// child: Text( |
|
|
|
// child: Text( |
|
|
|
// // (orderInfo != null && orderInfo.isTakeOut == 0) ? "自" : "外", |
|
|
|
// (orderInfo != null && orderInfo.isTakeOut == 0) ? "自" : "外", |
|
|
|
// "自", |
|
|
|
// // "自", |
|
|
|
// style: TextStyle( |
|
|
|
// style: TextStyle( |
|
|
|
// fontSize: 12.sp, |
|
|
|
// fontSize: 12.sp, |
|
|
|
// fontWeight: FontWeight.bold, |
|
|
|
// fontWeight: FontWeight.bold, |
|
|
@ -285,32 +320,12 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
Padding( |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.only(top: 12.h, right: 12.w), |
|
|
|
padding: EdgeInsets.only(top: 12.h, right: 12.w), |
|
|
|
child:Text( |
|
|
|
child:Text( |
|
|
|
// (orderInfo != null && |
|
|
|
(widget.type == 1)?(widget.orderStatus == 4 ? "拼团失败" :(activityOrderList.howManyMore != 0 ? "还差${activityOrderList?.howManyMore ?? 0}人拼团成功" : "拼团成功")) |
|
|
|
// orderInfo.storeVO != null && |
|
|
|
:(widget.orderStatus == 4 ? "砍价失败" : (activityOrderList.howManyMoney != "0.00" ? "还差¥${activityOrderList?.howManyMoney ?? 0}砍价成功" : "砍价成功")), |
|
|
|
// orderInfo.storeVO.posType != null) |
|
|
|
|
|
|
|
// ? StatusUtils.statusText( |
|
|
|
|
|
|
|
// context, |
|
|
|
|
|
|
|
// orderInfo.refundStatus, |
|
|
|
|
|
|
|
// orderInfo.orderStatus, |
|
|
|
|
|
|
|
// orderInfo.payStatus, |
|
|
|
|
|
|
|
// orderInfo.sendStatus, |
|
|
|
|
|
|
|
// orderInfo.isTakeOut) |
|
|
|
|
|
|
|
// : "", |
|
|
|
|
|
|
|
(widget.type == 1)?(activityOrderList.howManyMore != 0 ? "还差${activityOrderList?.howManyMore ?? 0}人拼团成功" : "拼团成功") |
|
|
|
|
|
|
|
:(activityOrderList.howManyMoney != 0 ? "还差¥${activityOrderList?.howManyMoney ?? 0}砍价成功" : "成功"), |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
color: |
|
|
|
color: widget.orderStatus == 4 ? Color(0xff32A060) : Color(0xffFE951E), |
|
|
|
// (orderInfo == null) |
|
|
|
|
|
|
|
// ? Color(0xFF32A060) |
|
|
|
|
|
|
|
// : (orderInfo.refundStatus == 1 || |
|
|
|
|
|
|
|
// orderInfo.orderStatus >= 5) |
|
|
|
|
|
|
|
// ? Colors.grey |
|
|
|
|
|
|
|
// : (orderInfo.orderStatus == 4) |
|
|
|
|
|
|
|
// ? Color(0xFF32A060) |
|
|
|
|
|
|
|
// : |
|
|
|
|
|
|
|
Color(0xffFE951E), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -448,6 +463,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
.pushNamed('/router/bargain_details',arguments: { |
|
|
|
.pushNamed('/router/bargain_details',arguments: { |
|
|
|
"actRecordId": activityOrderList.actRecordId, |
|
|
|
"actRecordId": activityOrderList.actRecordId, |
|
|
|
"limitNumber":activityOrderList.successNumber, |
|
|
|
"limitNumber":activityOrderList.successNumber, |
|
|
|
|
|
|
|
"storeInfo":storeInfo, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -461,20 +477,6 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> { |
|
|
|
padding: EdgeInsets.fromLTRB(17.w,0, 17.w,0), |
|
|
|
padding: EdgeInsets.fromLTRB(17.w,0, 17.w,0), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
// GestureDetector( |
|
|
|
|
|
|
|
// onTap: () { |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
// child:RoundButton( |
|
|
|
|
|
|
|
// height: 25.h, |
|
|
|
|
|
|
|
// padding: EdgeInsets.fromLTRB(8, 4, 8, 4), |
|
|
|
|
|
|
|
// text: S.of(context).chakanxiangqing, |
|
|
|
|
|
|
|
// textColor: Colors.white, |
|
|
|
|
|
|
|
// fontSize: 12, |
|
|
|
|
|
|
|
// backgroup: Color(0xFF32A060), |
|
|
|
|
|
|
|
// radius: 2, |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|