You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

296 lines
9.0 KiB

4 years ago
import 'package:flutter/material.dart';
4 years ago
import 'package:huixiang/generated/l10n.dart';
4 years ago
import 'package:huixiang/view_widget/round_button.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
4 years ago
4 years ago
class StatusUtils {
static String statusText(
context, refundStatus, orderStatus, payStatus, sendStatus, isTakeOut) {
4 years ago
String statusText = "";
if (isTakeOut == 0 || isTakeOut == 3 || isTakeOut == 4) {
if (payStatus == 0 && orderStatus != -1) {
4 years ago
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 || orderStatus == -1) {
4 years ago
statusText = S.of(context).yiquxiao;
}
return statusText;
}
3 years ago
///click(type): type: 0 再来一单, 1 确认收货 2取消支付 3去支付 4 查看物流
static List<Widget> statusBtn(
context,
payStatus,
payChannel,
orderStatus,
isTakeOut,
sendStatus,
refundStatus,
dayFlowCode,
3 years ago
Function(int type) click) {
4 years ago
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),
3 years ago
callback: () {
click(0);
},
4 years ago
),
];
}
if (orderStatus > 4 || orderStatus == -1) {
4 years ago
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),
3 years ago
callback: () {
click(0);
},
4 years ago
),
];
} else {
if (payStatus == 0 && orderStatus != -1) {
4 years ago
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),
3 years ago
callback: () {
click(3);
},
4 years ago
),
SizedBox(
width: 10.w,
),
Container(
width: 72.w,
height: 24.h,
child: TextButton(
3 years ago
onPressed: () {
click(2);
},
4 years ago
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 || isTakeOut == 3 || isTakeOut == 4) {
4 years ago
return [
Expanded(
flex: 1,
child: Container(
2 years ago
margin: EdgeInsets.only(left: 20.w),
4 years ago
alignment: Alignment.centerLeft,
child: Text(
S.of(context).qudanhao(dayFlowCode),
style: TextStyle(
fontSize: 16.sp,
fontFamily: 'JDZhengHT',
4 years ago
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),
3 years ago
callback: () {
click(1);
},
4 years ago
),
SizedBox(
width: 10.w,
),
Container(
width: 72.w,
height: 24.h,
margin: EdgeInsets.only(right: 10.w),
child: TextButton(
onPressed: () {
3 years ago
click(4);
4 years ago
},
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),
3 years ago
callback: () {
click(0);
},
4 years ago
),
];
}
}
} 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),
3 years ago
callback: () {
click(0);
},
), SizedBox(
width: 10.w,
4 years ago
),
///因接口问题,列表不展示开票入口,统一从发票助手进入
// if(payChannel == 0 || payChannel == 1 || payChannel == 2)
// Container(
// width: 72.w,
// height: 24.h,
// child: TextButton(
// onPressed: () {
// Navigator.of(context).pushNamed('/router/invoices_manage_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,
// ),
// ),
// ),
// ),
4 years ago
];
}
}
}
4 years ago
return [Container()];
4 years ago
}
4 years ago
}