Browse Source

兑换列表,福利兑换优化更改;

dev
wurong 1 year ago
parent
commit
10de196448
  1. 2
      lib/home/welfare_exchange.dart
  2. 397
      lib/order/exchange_history_page.dart

2
lib/home/welfare_exchange.dart

@ -72,7 +72,7 @@ class _WelfareExchange extends State<WelfareExchange>
} }
} }
creditGoods({isLoading = true}) async { creditGoods({bool isLoading = true}) async {
try{ try{
if(isLoading) if(isLoading)
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);

397
lib/order/exchange_history_page.dart

@ -85,22 +85,22 @@ class _ExchangeHistoryPage extends State<ExchangeHistoryPage>
highlightColor: Colors.transparent, // highlightColor: Colors.transparent, //
), ),
child: TabBar( child: TabBar(
controller: tabcontroller, controller: tabcontroller,
indicatorWeight: 2, indicatorWeight: 2,
indicatorColor: Color(0xFF39B54A), indicatorColor: Color(0xFF39B54A),
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
indicatorPadding: EdgeInsets.only(top: 3), indicatorPadding: EdgeInsets.only(top: 3),
unselectedLabelStyle: TextStyle( unselectedLabelStyle: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
labelStyle: TextStyle( labelStyle: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold), fontWeight: MyFontWeight.semi_bold),
labelColor: Colors.black, labelColor: Colors.black,
tabs: tabs, tabs: tabs,
)), )),
), ),
), ),
body: TabBarView( body: TabBarView(
@ -124,9 +124,10 @@ class ExchangeHistoryList extends StatefulWidget {
} }
class _ExchangeHistoryList extends State<ExchangeHistoryList> class _ExchangeHistoryList extends State<ExchangeHistoryList>
with AutomaticKeepAliveClientMixin{ with AutomaticKeepAliveClientMixin {
ApiService apiService; ApiService apiService;
RefreshController _refreshController = RefreshController(initialRefresh: false); RefreshController _refreshController =
RefreshController(initialRefresh: false);
int pageNum = 1; int pageNum = 1;
List<ExchangeOrder> orders = []; List<ExchangeOrder> orders = [];
@ -136,33 +137,36 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(), apiService = ApiService(Dio(),
showLoading: false, showLoading: false,
context: context, token: value.getString('token')), context: context,
token: value.getString('token')),
queryHistory(), queryHistory(),
}); });
} }
queryHistory({isLoading = true}) async { queryHistory({bool isLoading = true}) async {
try{ try {
if(isLoading) if (isLoading)
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); EasyLoading.show(
var map = { status: S.current.zhengzaijiazai,
"pageNum": pageNum, maskType: EasyLoadingMaskType.black);
"pageSize": 10, var map = {
// "state": widget.orderStatus "pageNum": pageNum,
}; "pageSize": 10,
if (widget.orderStatus != 0) { // "state": widget.orderStatus
map["state"] = widget.orderStatus; };
} if (widget.orderStatus != 0) {
BaseData<PageInfo<ExchangeOrder>> baseData = map["state"] = widget.orderStatus;
await apiService.creditOrderList(map).catchError((error) {
_refreshController.loadFailed();
_refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
if (pageNum == 1) {
orders.clear();
} }
orders.addAll(baseData.data.list); BaseData<PageInfo<ExchangeOrder>> baseData =
await apiService.creditOrderList(map).catchError((error) {
_refreshController.loadFailed();
_refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
if (pageNum == 1) {
orders.clear();
}
orders.addAll(baseData.data.list);
_refreshController.loadComplete(); _refreshController.loadComplete();
_refreshController.refreshCompleted(); _refreshController.refreshCompleted();
if (baseData.data.pages == baseData.data.pageNum) { if (baseData.data.pages == baseData.data.pageNum) {
@ -170,10 +174,11 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
} else { } else {
pageNum += 1; pageNum += 1;
} }
} else { } else {
_refreshController.refreshFailed(); _refreshController.refreshFailed();
_refreshController.loadFailed(); _refreshController.loadFailed();
}}finally{ }
} finally {
EasyLoading.dismiss(); EasyLoading.dismiss();
setState(() {}); setState(() {});
} }
@ -197,14 +202,16 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
), ),
controller: _refreshController, controller: _refreshController,
onRefresh: _refresh, onRefresh: _refresh,
onLoading: queryHistory, onLoading: () {
queryHistory(isLoading: false);
},
child: orders == null || orders.length == 0 child: orders == null || orders.length == 0
? NoDataView( ? NoDataView(
src: "assets/image/ding_dan.webp", src: "assets/image/ding_dan.webp",
isShowBtn: false, isShowBtn: false,
text: "目前暂无记录,手上那么多积分要赶紧用掉哦~", text: "目前暂无记录,手上那么多积分要赶紧用掉哦~",
fontSize: 16.sp, fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h,left: 72,right: 72), margin: EdgeInsets.only(top: 120.h, left: 72, right: 72),
) )
: ListView.builder( : ListView.builder(
itemCount: orders == null ? 0 : orders.length, itemCount: orders == null ? 0 : orders.length,
@ -261,11 +268,16 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
), ),
), ),
Text( Text(
exchangeOrder.payStatus != 1 ? "未支付": exchangeOrder.payStatus != 1
((exchangeOrder.useTyped ==1)?((exchangeOrder.sendStatus==3 || exchangeOrder.sendStatus == 9)?"已自提":"待提货") ? "未支付"
:(exchangeOrder.useTyped == 2 ?((exchangeOrder.sendStatus==1)?"待发货" : ((exchangeOrder.useTyped == 1)
:"已发货") ? ((exchangeOrder.sendStatus == 3 ||
:orderStatus(exchangeOrder.state))), exchangeOrder.sendStatus == 9)
? "已自提"
: "待提货")
: (exchangeOrder.useTyped == 2
? ((exchangeOrder.sendStatus == 1) ? "待发货" : "已发货")
: orderStatus(exchangeOrder.state))),
style: TextStyle( style: TextStyle(
color: Color(0xFFFE951E), color: Color(0xFFFE951E),
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -277,86 +289,117 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
SizedBox( SizedBox(
height: 16.h, height: 16.h,
), ),
exchangeOrder.useTyped == 1 ? exchangeOrder.useTyped == 1
Container( ? Container(
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"自提门店" + " :", "自提门店" + " :",
style: TextStyle( style: TextStyle(
color: Color(0xFF353535), color: Color(0xFF353535),
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
fontSize: 12.sp, fontSize: 12.sp,
),
),
SizedBox(
width: 8.w,
),
Expanded(
child: Text(
exchangeOrder.storeName ?? "",
style: TextStyle(
color: Colors.black,
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
)
],
), ),
), SizedBox(
SizedBox( height: 8.h,
width: 8.w,
),
Expanded(
child: Text(
exchangeOrder.storeName ?? "",
style: TextStyle(
color: Colors.black,
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
), ),
) Row(
], mainAxisAlignment: MainAxisAlignment.start,
), crossAxisAlignment: CrossAxisAlignment.start,
SizedBox( children: [
height: 8.h, Text(
), S.of(context).zitidizhi + " :",
Row( style: TextStyle(
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
SizedBox(
width: 8.w,
),
Expanded(
child: Text(
exchangeOrder.address ?? "",
style: TextStyle(
color: Colors.black,
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
)
],
),
SizedBox(
height: 8.h,
),
Row(
children: [
Text(
S.of(context).zitishijian + " :",
style: TextStyle(
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
SizedBox(
width: 8.h,
),
Expanded(
child: Text(
S.of(context).duihuanhouwugegongzuori,
style: TextStyle(
color: Colors.black,
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
)
],
),
],
),
)
: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( if (exchangeOrder.useTyped != 3)
S.of(context).zitidizhi + " :", Text(
style: TextStyle( S.of(context).shouhuodi + " :",
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
SizedBox(
width: 8.w,
),
Expanded(
child: Text(
exchangeOrder.address ?? "",
style: TextStyle( style: TextStyle(
color: Colors.black, color: Color(0xFF353535),
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
fontSize: 12.sp, fontSize: 12.sp,
), ),
), ),
)
],
),
SizedBox(
height: 8.h,
),
Row(
children: [
Text(
S.of(context).zitishijian + " :",
style: TextStyle(
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
SizedBox( SizedBox(
width: 8.h, width: 8.w,
), ),
Expanded( Expanded(
child: Text( child: Text(
S.of(context).duihuanhouwugegongzuori, exchangeOrder.recAddress ?? "",
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -366,37 +409,6 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
) )
], ],
), ),
],
),
):
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if(exchangeOrder.useTyped != 3)
Text(
S.of(context).shouhuodi + " :",
style: TextStyle(
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
SizedBox(
width: 8.w,
),
Expanded(
child: Text(
exchangeOrder.recAddress ?? "",
style: TextStyle(
color: Colors.black,
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
)
],
),
SizedBox( SizedBox(
height: 16.h, height: 16.h,
), ),
@ -480,12 +492,16 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
Text( Text(
exchangeOrder?.amount == null || exchangeOrder.amount == "0" exchangeOrder?.amount == null || exchangeOrder.amount == "0"
? "" ? ""
: exchangeOrder.payType == 2 ? "实付印章 ${exchangeOrder.amount}印章":(S.of(context).shifujifen(exchangeOrder.amount) + : exchangeOrder.payType == 2
( exchangeOrder?.creditOrderDetailList[0]?.money == null || ? "实付印章 ${exchangeOrder.amount}印章"
exchangeOrder?.creditOrderDetailList[0]?.money == : (S.of(context).shifujifen(exchangeOrder.amount) +
"0.00" (exchangeOrder?.creditOrderDetailList[0]?.money ==
? "" null ||
: " + ${double.parse(exchangeOrder?.creditOrderDetailList[0]?.money.toString()) * exchangeOrder?.creditOrderDetailList[0].goodsNumber}")), exchangeOrder
?.creditOrderDetailList[0]?.money ==
"0.00"
? ""
: " + ${double.parse(exchangeOrder?.creditOrderDetailList[0]?.money.toString()) * exchangeOrder?.creditOrderDetailList[0].goodsNumber}")),
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -511,40 +527,43 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
color: Color(0xFF353535), color: Color(0xFF353535),
), ),
), ),
if(exchangeOrder.useTyped != 3) if (exchangeOrder.useTyped != 3)
(exchangeOrder.useTyped == 1 ? (exchangeOrder.useTyped == 1
GestureDetector( ? GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
// if (exchangeOrder.state == 1) { // if (exchangeOrder.state == 1) {
// receive2Card(exchangeOrder.id); // receive2Card(exchangeOrder.id);
// } else { // } else {
// Navigator.of(context) // Navigator.of(context)
// .pushNamed('/router/write_off_page', arguments: {}); // .pushNamed('/router/write_off_page', arguments: {});
// } // }
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/exchange_write_offPage', '/router/exchange_write_offPage',
arguments: { arguments: {
"exchangeOrder": exchangeOrder.toJson(), "exchangeOrder": exchangeOrder.toJson(),
}); });
}, },
child: buildBtnStatus(exchangeOrder.state), child: buildBtnStatus(exchangeOrder.state),
): )
GestureDetector( : GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/logistics_information_page', '/router/logistics_information_page',
arguments: { arguments: {
"orderId": exchangeOrder.creditOrderDetailList[0].orderId, "orderId": exchangeOrder
"logisticsNum": "", .creditOrderDetailList[0].orderId,
"logisticsName": "", "logisticsNum": "",
"productNum": exchangeOrder.creditOrderDetailList[0].goodsNumber, "logisticsName": "",
"skuImg":exchangeOrder.creditOrderDetailList[0].goodsMainImg "productNum": exchangeOrder
}); .creditOrderDetailList[0].goodsNumber,
}, "skuImg": exchangeOrder
child: buildBtnStatusTow(exchangeOrder.sendStatus), .creditOrderDetailList[0].goodsMainImg
)) });
},
child: buildBtnStatusTow(exchangeOrder.sendStatus),
))
], ],
) )
], ],
@ -560,7 +579,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList>
} }
Widget buildBtnStatus(state) { Widget buildBtnStatus(state) {
if (state ==1) { if (state == 1) {
return RoundButton( return RoundButton(
padding: EdgeInsets.fromLTRB(8, 4, 8, 4), padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
text: S.of(context).chakanhexiaoma, text: S.of(context).chakanhexiaoma,

Loading…
Cancel
Save