|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/order_info.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/page.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart';
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_footer.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_tab.dart';
|
|
|
|
import 'package:huixiang/view_widget/no_data_view.dart';
|
|
|
|
import 'package:huixiang/view_widget/round_button.dart';
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
class OrderHistoryPage extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _OrderHistoryPage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _OrderHistoryPage extends State<OrderHistoryPage>
|
|
|
|
with SingleTickerProviderStateMixin {
|
|
|
|
List<Widget> _pages;
|
|
|
|
TabController tabcontroller;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void didChangeDependencies() {
|
|
|
|
super.didChangeDependencies();
|
|
|
|
if (tabcontroller == null)
|
|
|
|
tabcontroller = TabController(length: 4, vsync: this);
|
|
|
|
|
|
|
|
_pages = [
|
|
|
|
OrderHistoryList(0),
|
|
|
|
OrderHistoryList(1),
|
|
|
|
OrderHistoryList(2),
|
|
|
|
OrderHistoryList(3)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return DefaultTabController(
|
|
|
|
length: 3,
|
|
|
|
child: Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: Text(
|
|
|
|
S.of(context).dingdan,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 18.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
centerTitle: false,
|
|
|
|
backgroundColor: Color(0xFFFFFFFF),
|
|
|
|
elevation: 0,
|
|
|
|
leading: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
margin: EdgeInsets.only(left: 10.w),
|
|
|
|
padding: EdgeInsets.all(6),
|
|
|
|
child: Icon(
|
|
|
|
Icons.arrow_back_ios,
|
|
|
|
color: Colors.black,
|
|
|
|
size: 24,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
titleSpacing: 2.w,
|
|
|
|
leadingWidth: 56.w,
|
|
|
|
bottom: PreferredSize(
|
|
|
|
preferredSize: Size(double.infinity, 38.h),
|
|
|
|
child: TabBar(
|
|
|
|
controller: tabcontroller,
|
|
|
|
isScrollable: false,
|
|
|
|
indicatorWeight: 2.w,
|
|
|
|
indicatorSize: TabBarIndicatorSize.label,
|
|
|
|
indicatorColor: Color(0xFF39B54A),
|
|
|
|
indicatorPadding: EdgeInsets.only(top: 3.h),
|
|
|
|
unselectedLabelStyle: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
),
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
labelColor: Colors.black,
|
|
|
|
tabs: [
|
|
|
|
MyTab(
|
|
|
|
text: S.of(context).quanbu,
|
|
|
|
),
|
|
|
|
MyTab(
|
|
|
|
text: S.of(context).daifukuan,
|
|
|
|
),
|
|
|
|
MyTab(
|
|
|
|
text: S.of(context).weiwancheng,
|
|
|
|
),
|
|
|
|
MyTab(
|
|
|
|
text: S.of(context).yiwancheng,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: TabBarView(
|
|
|
|
children: _pages,
|
|
|
|
controller: tabcontroller,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class OrderHistoryList extends StatefulWidget {
|
|
|
|
final int orderStatus;
|
|
|
|
|
|
|
|
OrderHistoryList(this.orderStatus);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _OrderHistoryList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _OrderHistoryList extends State<OrderHistoryList>
|
|
|
|
with AutomaticKeepAliveClientMixin {
|
|
|
|
final RefreshController refreshController = RefreshController();
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
super.build(context);
|
|
|
|
return SmartRefresher(
|
|
|
|
controller: refreshController,
|
|
|
|
enablePullDown: true,
|
|
|
|
enablePullUp: true,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
header: MyHeader(),
|
|
|
|
footer: CustomFooter(
|
|
|
|
builder: (context, mode) {
|
|
|
|
return MyFooter(mode);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
onRefresh: _onRefresh,
|
|
|
|
onLoading: queryOrder,
|
|
|
|
child: (orderInfos != null && orderInfos.length > 0)
|
|
|
|
? ListView.builder(
|
|
|
|
itemCount: orderInfos != null ? orderInfos.length : 0,
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed('/router/order_details',
|
|
|
|
arguments: {"id": orderInfos[position].id});
|
|
|
|
},
|
|
|
|
child: orderItem(orderInfos[position]),
|
|
|
|
);
|
|
|
|
})
|
|
|
|
: NoDataView(
|
|
|
|
isShowBtn: false,
|
|
|
|
text: "还没有订单,快去下一单吧~",
|
|
|
|
fontSize: 16.sp,
|
|
|
|
margin: EdgeInsets.only(top: 120),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isRemake = true;
|
|
|
|
|
|
|
|
ApiService apiService;
|
|
|
|
int current = 1;
|
|
|
|
|
|
|
|
_onRefresh() {
|
|
|
|
current = 1;
|
|
|
|
queryOrder();
|
|
|
|
}
|
|
|
|
|
|
|
|
List<OrderInfo> orderInfos = [];
|
|
|
|
|
|
|
|
queryOrder() async {
|
|
|
|
BaseData baseData = await apiService.orderList({
|
|
|
|
"current": current,
|
|
|
|
"model": {"status": widget.orderStatus},
|
|
|
|
"order": "descending",
|
|
|
|
"size": 10,
|
|
|
|
"sort": "id"
|
|
|
|
}).catchError((onError) {
|
|
|
|
refreshController.refreshFailed();
|
|
|
|
refreshController.loadFailed();
|
|
|
|
});
|
|
|
|
|
|
|
|
if (baseData != null && baseData.isSuccess) {
|
|
|
|
PageInfo pageInfo = PageInfo.fromJson(baseData.data);
|
|
|
|
if (current == 1) {
|
|
|
|
orderInfos.clear();
|
|
|
|
}
|
|
|
|
orderInfos
|
|
|
|
.addAll(pageInfo.records.map((e) => OrderInfo.fromJson(e)).toList());
|
|
|
|
refreshController.refreshCompleted();
|
|
|
|
refreshController.loadComplete();
|
|
|
|
if (current * 10 > int.tryParse(pageInfo.total)) {
|
|
|
|
refreshController.loadNoData();
|
|
|
|
} else {
|
|
|
|
current += 1;
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
} else {
|
|
|
|
refreshController.refreshFailed();
|
|
|
|
refreshController.loadFailed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
SharedPreferences.getInstance().then((value) => {
|
|
|
|
apiService = ApiService(Dio(), token: value.getString("token")),
|
|
|
|
queryOrder(),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget orderItem(OrderInfo orderInfo) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h),
|
|
|
|
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: [
|
|
|
|
Container(
|
|
|
|
width: 19.w,
|
|
|
|
height: 19.h,
|
|
|
|
margin: EdgeInsets.only(left: 12.w, top: 12.h),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
(orderInfo != null && orderInfo.isTakeOut == 0) ? "自" : "外",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
margin: EdgeInsets.only(left: 6.w, top: 12.h),
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text(
|
|
|
|
(orderInfo != null) ? orderInfo.storeName : "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
flex: 1,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 12.h, right: 12.w),
|
|
|
|
child: Text(
|
|
|
|
(orderInfo != null &&
|
|
|
|
orderInfo.storeVO != null &&
|
|
|
|
orderInfo.storeVO.posType != null)
|
|
|
|
? statusText(
|
|
|
|
orderInfo.refundStatus,
|
|
|
|
orderInfo.orderStatus,
|
|
|
|
orderInfo.payStatus,
|
|
|
|
orderInfo.sendStatus,
|
|
|
|
orderInfo.isTakeOut)
|
|
|
|
: "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: (orderInfo == null)
|
|
|
|
? Color(0xFF32A060)
|
|
|
|
: (orderInfo.refundStatus == 1 ||
|
|
|
|
orderInfo.orderStatus >= 5)
|
|
|
|
? Colors.grey
|
|
|
|
: (orderInfo.orderStatus == 4)
|
|
|
|
? Color(0xFF32A060)
|
|
|
|
: Color(0xffFE951E),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(left: 37.w),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
S.of(context).xiadanshijian_(
|
|
|
|
(orderInfo != null) ? orderInfo.createTime : ""),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 10.sp,
|
|
|
|
color: Color(0xFF727272),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 8.h,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: goodsItem((orderInfo != null &&
|
|
|
|
orderInfo.productList != null)
|
|
|
|
? orderInfo.productList
|
|
|
|
: null),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
flex: 1,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.all(22.w),
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/icon_order_more.png",
|
|
|
|
width: 24.w,
|
|
|
|
height: 24.h,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 12.h,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(right: 12.w, bottom: 12.h),
|
|
|
|
child: Directionality(
|
|
|
|
textDirection: TextDirection.rtl,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: S.of(context).gong,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF868686),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: (orderInfo != null &&
|
|
|
|
orderInfo.productList != null)
|
|
|
|
? "${orderInfo.productList.length}"
|
|
|
|
: "0",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: S.of(context).jian,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF868686),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 4.w,
|
|
|
|
),
|
|
|
|
Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: S.of(context).heji,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF868686),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: totalPrice(orderInfo),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: S.of(context).yuan,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF868686),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 8.h,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: (orderInfo != null)
|
|
|
|
? statusBtn(
|
|
|
|
orderInfo.payStatus,
|
|
|
|
orderInfo.orderStatus,
|
|
|
|
orderInfo.isTakeOut,
|
|
|
|
orderInfo.sendStatus,
|
|
|
|
orderInfo.refundStatus,
|
|
|
|
orderInfo.dayFlowCode)
|
|
|
|
: [],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
String totalPrice(orderInfo) {
|
|
|
|
if (orderInfo == null) return "";
|
|
|
|
double totalPrice = (double.tryParse(orderInfo.orderSum) +
|
|
|
|
double.tryParse(orderInfo.postFee));
|
|
|
|
if (orderInfo.orderDetail != null &&
|
|
|
|
orderInfo.orderDetail.couponDTO != null) {
|
|
|
|
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money);
|
|
|
|
}
|
|
|
|
return "$totalPrice";
|
|
|
|
}
|
|
|
|
|
|
|
|
String statusText(
|
|
|
|
refundStatus, orderStatus, payStatus, sendStatus, isTakeOut) {
|
|
|
|
String statusText = "";
|
|
|
|
if (isTakeOut == 0) {
|
|
|
|
if (payStatus == 0) {
|
|
|
|
statusText = S.of(context).daizhifu;
|
|
|
|
} else {
|
|
|
|
statusText = S.of(context).yizhifu;
|
|
|
|
switch (orderStatus) {
|
|
|
|
case 2:
|
|
|
|
statusText = S.of(context).shangjiazhengzaipeican;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
statusText = S.of(context).daiqucan;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
statusText = S.of(context).yiwancheng;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (isTakeOut == 1) {
|
|
|
|
if (payStatus == 0) {
|
|
|
|
statusText = S.of(context).daizhifu;
|
|
|
|
} else {
|
|
|
|
statusText = S.of(context).yizhifu;
|
|
|
|
if (orderStatus < 4) {
|
|
|
|
switch (sendStatus) {
|
|
|
|
case 1:
|
|
|
|
statusText = S.of(context).zhengzaihujiaoqishou;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
statusText = S.of(context).quhuozhong;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
statusText = S.of(context).peisongzhong;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
statusText = S.of(context).yisongda;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (orderStatus) {
|
|
|
|
case 4:
|
|
|
|
statusText = S.of(context).yiwancheng;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (isTakeOut == 2) {
|
|
|
|
if (payStatus == 0) {
|
|
|
|
statusText = S.of(context).daizhifu;
|
|
|
|
} else {
|
|
|
|
statusText = S.of(context).yizhifu;
|
|
|
|
if (orderStatus < 4) {
|
|
|
|
switch (sendStatus) {
|
|
|
|
case 1:
|
|
|
|
statusText = S.of(context).yifahuo;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
statusText = S.of(context).yisongda;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (orderStatus) {
|
|
|
|
case 4:
|
|
|
|
statusText = S.of(context).yiwancheng;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (refundStatus == 1) {
|
|
|
|
statusText = S.of(context).yituikuan;
|
|
|
|
}
|
|
|
|
if (orderStatus == 5) {
|
|
|
|
statusText = S.of(context).yiquxiao;
|
|
|
|
}
|
|
|
|
return statusText;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> statusBtn(payStatus, orderStatus, isTakeOut, sendStatus,
|
|
|
|
refundStatus, dayFlowCode) {
|
|
|
|
if (refundStatus == 1) {
|
|
|
|
return [
|
|
|
|
RoundButton(
|
|
|
|
text: S.of(context).zailaiyidan,
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
radius: 2,
|
|
|
|
padding: EdgeInsets.fromLTRB(17.w, 4.h, 17.w, 4.h),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 10.w,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: 72.w,
|
|
|
|
height: 24.h,
|
|
|
|
margin: EdgeInsets.only(right: 10.w),
|
|
|
|
child: TextButton(
|
|
|
|
onPressed: () {},
|
|
|
|
style: ButtonStyle(
|
|
|
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
|
|
side: MaterialStateProperty.all(
|
|
|
|
BorderSide(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
width: 0.5,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
S.of(context).shanchudingdan,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
if (orderStatus > 4) {
|
|
|
|
return [
|
|
|
|
RoundButton(
|
|
|
|
text: S.of(context).zailaiyidan,
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
radius: 2,
|
|
|
|
padding: EdgeInsets.fromLTRB(17.w, 4.h, 17.w, 4.h),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 10.w,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: 72.w,
|
|
|
|
height: 24.h,
|
|
|
|
margin: EdgeInsets.only(right: 10.w),
|
|
|
|
child: TextButton(
|
|
|
|
onPressed: () {},
|
|
|
|
style: ButtonStyle(
|
|
|
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
|
|
side: MaterialStateProperty.all(
|
|
|
|
BorderSide(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
width: 0.5,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
S.of(context).shanchudingdan,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
} else {
|
|
|
|
if (payStatus == 0) {
|
|
|
|
return [
|
|
|
|
RoundButton(
|
|
|
|
text: S.of(context).quzhifu,
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
radius: 2,
|
|
|
|
padding: EdgeInsets.fromLTRB(17.w, 4.h, 17.w, 4.h),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 10.w,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: 72.w,
|
|
|
|
height: 24.h,
|
|
|
|
child: TextButton(
|
|
|
|
onPressed: () {},
|
|
|
|
style: ButtonStyle(
|
|
|
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
|
|
side: MaterialStateProperty.all(
|
|
|
|
BorderSide(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
width: 0.5,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
S.of(context).quxiaozhifu,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
} else {
|
|
|
|
if (orderStatus < 4) {
|
|
|
|
if (isTakeOut == 0) {
|
|
|
|
return [
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(left: 37.w),
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text(
|
|
|
|
S.of(context).qudanhao(dayFlowCode),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
} else if (isTakeOut == 1 || isTakeOut == 2) {
|
|
|
|
// } else if (isTakeOut == 2) {
|
|
|
|
if (sendStatus < 4) {
|
|
|
|
return [
|
|
|
|
RoundButton(
|
|
|
|
text: S.of(context).querenshouhuo,
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
radius: 2,
|
|
|
|
padding: EdgeInsets.fromLTRB(17.w, 4.h, 17.w, 4.h),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 10.w,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: 72.w,
|
|
|
|
height: 24.h,
|
|
|
|
margin: EdgeInsets.only(right: 10.w),
|
|
|
|
child: TextButton(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/logistics_information_page');
|
|
|
|
},
|
|
|
|
style: ButtonStyle(
|
|
|
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
|
|
side: MaterialStateProperty.all(
|
|
|
|
BorderSide(color: Color(0xff32A060), width: 0.5),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
S.of(context).chakanwuliu,
|
|
|
|
style:
|
|
|
|
TextStyle(color: Color(0xff32A060), fontSize: 12.sp),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
} else {
|
|
|
|
return [
|
|
|
|
RoundButton(
|
|
|
|
text: S.of(context).zailaiyidan,
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
radius: 2,
|
|
|
|
padding: EdgeInsets.fromLTRB(17.w, 4.h, 17.w, 4.h),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (orderStatus == 4) {
|
|
|
|
return [
|
|
|
|
RoundButton(
|
|
|
|
text: S.of(context).zailaiyidan,
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
radius: 2,
|
|
|
|
padding: EdgeInsets.fromLTRB(17.w, 4.h, 17.w, 4.h),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 10.w,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: 72.w,
|
|
|
|
height: 24.h,
|
|
|
|
margin: EdgeInsets.only(right: 10.w),
|
|
|
|
child: TextButton(
|
|
|
|
onPressed: () {},
|
|
|
|
style: ButtonStyle(
|
|
|
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
|
|
|
side: MaterialStateProperty.all(
|
|
|
|
BorderSide(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
width: 0.5,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
S.of(context).shanchudingdan,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> goodsItem(List<ProductList> products) {
|
|
|
|
if (products == null) return [];
|
|
|
|
if (products.length > 3) {
|
|
|
|
products = products.sublist(0, 3);
|
|
|
|
}
|
|
|
|
return products
|
|
|
|
.map(
|
|
|
|
(e) => Container(
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 2.w),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
MImage(
|
|
|
|
e.skuImg,
|
|
|
|
width: 75.w,
|
|
|
|
height: 75.h,
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
errorSrc: "assets/image/default_1.png",
|
|
|
|
fadeSrc: "assets/image/default_1.png",
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 4.h,
|
|
|
|
),
|
|
|
|
if (isRemake)
|
|
|
|
Container(
|
|
|
|
width: 75.w,
|
|
|
|
child: Text(
|
|
|
|
e.productName,
|
|
|
|
maxLines: 1,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 10.sp,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.toList();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool get wantKeepAlive => true;
|
|
|
|
}
|