|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:fluttertoast/fluttertoast.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/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,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
centerTitle: false,
|
|
|
|
backgroundColor: Color(0xFFFFFFFF),
|
|
|
|
elevation: 0,
|
|
|
|
leading: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
margin: EdgeInsets.only(left: 10),
|
|
|
|
padding: EdgeInsets.all(6),
|
|
|
|
child: Icon(
|
|
|
|
Icons.arrow_back_ios,
|
|
|
|
color: Colors.black,
|
|
|
|
size: 24,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
titleSpacing: 2,
|
|
|
|
leadingWidth: 56,
|
|
|
|
bottom: PreferredSize(
|
|
|
|
preferredSize: Size(double.infinity, 38),
|
|
|
|
child: TabBar(
|
|
|
|
controller: tabcontroller,
|
|
|
|
isScrollable: false,
|
|
|
|
indicatorWeight: 2,
|
|
|
|
indicatorSize: TabBarIndicatorSize.label,
|
|
|
|
indicatorColor: Color(0xFF39B54A),
|
|
|
|
indicatorPadding: EdgeInsets.only(top: 3),
|
|
|
|
unselectedLabelStyle: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
),
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 16,
|
|
|
|
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) {
|
|
|
|
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: 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]),
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
Fluttertoast.showToast(msg: baseData.msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@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.storeVO.posType.code,
|
|
|
|
orderInfo.orderStatus,
|
|
|
|
orderInfo.payStatus,
|
|
|
|
orderInfo.sendStatus,
|
|
|
|
orderInfo.isTakeOut)
|
|
|
|
: "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: (orderInfo != null && 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.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Row(
|
|
|
|
children: goodsItem((orderInfo != null &&
|
|
|
|
orderInfo.detailDTO != null &&
|
|
|
|
orderInfo.detailDTO.orderProductList !=
|
|
|
|
null)
|
|
|
|
? orderInfo.detailDTO.orderProductList
|
|
|
|
: 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: "共",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF868686),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: (orderInfo != null &&
|
|
|
|
orderInfo.detailDTO != null &&
|
|
|
|
orderInfo.detailDTO.orderProductList !=
|
|
|
|
null)
|
|
|
|
? "${orderInfo.detailDTO.orderProductList.length}"
|
|
|
|
: "0",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: "件",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF868686),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 4.w,
|
|
|
|
),
|
|
|
|
Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: "合计:",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF868686),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: S.of(context).yuan(orderInfo != null
|
|
|
|
? orderInfo.finalPayPrice
|
|
|
|
: "0"),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: "元",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Color(0xFF868686),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 8.h,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: statusBtn(
|
|
|
|
orderInfo != null ? orderInfo.orderStatus : 0),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
String statusText(storeType, status, payStatus, sendStatus, isTakeOut) {
|
|
|
|
String statusText = "";
|
|
|
|
switch (storeType) {
|
|
|
|
case "NORMALSTORE":
|
|
|
|
switch (status) {
|
|
|
|
case -1:
|
|
|
|
statusText =
|
|
|
|
payStatus == 0 ? S.of(context).daizhifu : S.of(context).yizhifu;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
statusText =
|
|
|
|
payStatus == 0 ? S.of(context).daizhifu : S.of(context).yizhifu;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
statusText = payStatus == 1
|
|
|
|
? S.of(context).daiqueren
|
|
|
|
: S.of(context).yizhifu;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
statusText = payStatus == 1
|
|
|
|
? S.of(context).shangjiaqueren
|
|
|
|
: S.of(context).yizhifu;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
statusText = S.of(context).yizhifu;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
statusText = S.of(context).yiquxiao;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
statusText = S.of(context).qingzhuo;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
statusText = S.of(context).tuikuan;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "FASTSTORE":
|
|
|
|
switch (status) {
|
|
|
|
case 1:
|
|
|
|
statusText =
|
|
|
|
payStatus == 1 ? S.of(context).yizhifu : S.of(context).daizhifu;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
statusText = payStatus == 1
|
|
|
|
? S.of(context).daizhizuo
|
|
|
|
: S.of(context).daizhifu;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
statusText = payStatus == 1
|
|
|
|
? S.of(context).zhizuowancheng
|
|
|
|
: S.of(context).daizhifu;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (isTakeOut == 0) {
|
|
|
|
statusText = S.of(context).yiwancheng;
|
|
|
|
} else if (isTakeOut == 1) {
|
|
|
|
switch (sendStatus) {
|
|
|
|
case 0:
|
|
|
|
statusText = S.of(context).daipeisong;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
statusText = S.of(context).yihujiaoqishou;
|
|
|
|
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 if (isTakeOut == 2) {
|
|
|
|
if (sendStatus == 1) {
|
|
|
|
statusText = S.of(context).yifahuo;
|
|
|
|
} else if (sendStatus == 4) {
|
|
|
|
statusText = S.of(context).yisongda;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
statusText = S.of(context).yiquxiao;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "RETAILSTORE":
|
|
|
|
switch (status) {
|
|
|
|
case 1:
|
|
|
|
statusText = S.of(context).daizhifu;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
statusText = S.of(context).yizhifu;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (isTakeOut == 0) {
|
|
|
|
statusText = S.of(context).yiwancheng;
|
|
|
|
} else if (isTakeOut == 1) {
|
|
|
|
switch (sendStatus) {
|
|
|
|
case 0:
|
|
|
|
statusText = S.of(context).daipeisong;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
statusText = S.of(context).yihujiaoqishou;
|
|
|
|
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 if (isTakeOut == 2) {
|
|
|
|
if (sendStatus == 1) {
|
|
|
|
statusText = S.of(context).yifahuo;
|
|
|
|
} else if (sendStatus == 4) {
|
|
|
|
statusText = S.of(context).yisongda;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
statusText = S.of(context).yiquxiao;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
statusText = S.of(context).tuikuan;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return statusText;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> statusBtn(orderStatus) {
|
|
|
|
return [
|
|
|
|
if (orderStatus == 2)
|
|
|
|
RoundButton(
|
|
|
|
text: "确认收货",
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
radius: 2,
|
|
|
|
padding: EdgeInsets.fromLTRB(17.w, 4.h, 17.w, 4.h),
|
|
|
|
),
|
|
|
|
if (orderStatus == 2)
|
|
|
|
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(
|
|
|
|
"查看物流",
|
|
|
|
style: TextStyle(color: Color(0xff32A060), fontSize: 12.sp),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (orderStatus == 3)
|
|
|
|
RoundButton(
|
|
|
|
text: "再来一单",
|
|
|
|
textColor: Colors.white,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
backgroup: Color(0xFF32A060),
|
|
|
|
radius: 2,
|
|
|
|
padding: EdgeInsets.fromLTRB(17.w, 4.h, 17.w, 4.h),
|
|
|
|
),
|
|
|
|
if (orderStatus == 3)
|
|
|
|
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(
|
|
|
|
"删除一单",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (orderStatus == 0 || orderStatus == 1)
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
if (orderStatus == 0 || orderStatus == 1)
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (orderStatus == 3)
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(left: 37.w),
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text(
|
|
|
|
"取单号 201",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> goodsItem(List<OrderProductList> products) {
|
|
|
|
if (products == null) return [];
|
|
|
|
return products
|
|
|
|
.map((e) => 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)
|
|
|
|
Text(
|
|
|
|
e.productName,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 10.sp,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
))
|
|
|
|
.toList();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool get wantKeepAlive => true;
|
|
|
|
}
|