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