diff --git a/assets/image/2x/bus_cashier_switch.webp b/assets/image/2x/bus_cashier_switch.webp new file mode 100644 index 00000000..e24b9245 Binary files /dev/null and b/assets/image/2x/bus_cashier_switch.webp differ diff --git a/assets/image/2x/bus_vip_cc.webp b/assets/image/2x/bus_vip_cc.webp new file mode 100644 index 00000000..7144c199 Binary files /dev/null and b/assets/image/2x/bus_vip_cc.webp differ diff --git a/assets/image/3x/bus_cashier_switch.webp b/assets/image/3x/bus_cashier_switch.webp new file mode 100644 index 00000000..6d393b69 Binary files /dev/null and b/assets/image/3x/bus_cashier_switch.webp differ diff --git a/assets/image/3x/bus_vip_cc.webp b/assets/image/3x/bus_vip_cc.webp new file mode 100644 index 00000000..76b1048c Binary files /dev/null and b/assets/image/3x/bus_vip_cc.webp differ diff --git a/assets/image/bus_cashier_switch.webp b/assets/image/bus_cashier_switch.webp new file mode 100644 index 00000000..50370e52 Binary files /dev/null and b/assets/image/bus_cashier_switch.webp differ diff --git a/assets/image/bus_vip_cc.webp b/assets/image/bus_vip_cc.webp new file mode 100644 index 00000000..47a104f6 Binary files /dev/null and b/assets/image/bus_vip_cc.webp differ diff --git a/lib/business_system/home/cashier/cashier_page.dart b/lib/business_system/home/cashier/cashier_page.dart index a2403d22..af574575 100644 --- a/lib/business_system/home/cashier/cashier_page.dart +++ b/lib/business_system/home/cashier/cashier_page.dart @@ -15,6 +15,7 @@ import '../../../utils/business_instance.dart'; import '../../../utils/flutter_utils.dart'; import '../../../view_widget/border_text.dart'; import '../../../view_widget/classic_header.dart'; +import '../../../view_widget/custom_image.dart'; import '../../../view_widget/my_footer.dart'; import '../../../view_widget/round_button.dart'; import '../../../view_widget/settlement_tips_dialog.dart'; @@ -45,7 +46,6 @@ class _CashierPage extends State { List manualQueryInfo; bool isDisplayVipInfo = false; - ///离开页面记着销毁和清除 @override void dispose() { @@ -71,6 +71,8 @@ class _CashierPage extends State { } }); }); + if((widget?.arguments["phone"] ?? "")!= "") + queryMemberPhoneInfo(widget?.arguments["phone"] ?? ""); } ///根据手机号搜索用户信息 @@ -89,7 +91,7 @@ class _CashierPage extends State { } BaseData baseData = await businessService .queryMemberInfo( - {"phoneNum": phoneNum, "isNewUser": false}).catchError((error) { + {"phoneNum": phoneNum, "isNewUser": false}).catchError((error) { networkError = AppUtils.dioErrorTypeToString(error.type); networkStatus = -1; setState(() {}); @@ -99,6 +101,7 @@ class _CashierPage extends State { if (!mounted) return; if (baseData != null && baseData.isSuccess) { phoneQueryMemberInfo = baseData.data; + isDisplayVipInfo = true; refreshController.loadComplete(); refreshController.refreshCompleted(); networkStatus = 1; @@ -108,9 +111,8 @@ class _CashierPage extends State { refreshController.loadFailed(); } } finally { - if (isShow) - EasyLoading.dismiss(); - setState((){}); + if (isShow) EasyLoading.dismiss(); + setState(() {}); } } @@ -128,10 +130,10 @@ class _CashierPage extends State { storeId: widget.arguments["storeId"]); } BaseData baseData = await businessService.createOrder({ - "createOrderType": "DIRECT",// 创建订单类型 DIRECT 直接下单 ASSIGN 指定商品下单 + "createOrderType": "DIRECT", // 创建订单类型 DIRECT 直接下单 ASSIGN 指定商品下单 "orderAmount": _displayTotal.toStringAsFixed(2), - "virtualProductId":-2, - "mid":phoneQueryMemberInfo?.sid ?? "" + "virtualProductId": -2, + "mid": phoneQueryMemberInfo?.sid ?? "" }).catchError((error) { networkError = AppUtils.dioErrorTypeToString(error.type); networkStatus = -1; @@ -142,26 +144,25 @@ class _CashierPage extends State { if (!mounted) return; if (baseData != null && baseData.isSuccess) { cashierOrderId = baseData.data; - if(payChannel == 1|| payChannel == 2){ - Navigator.of(context).pushNamed( - '/router/scan_code_page', - arguments: { - "storeId": widget.arguments["storeId"], - "scanCodeType": "收银台支付", - "mid":phoneQueryMemberInfo?.sid ??"", - "orderId": cashierOrderId, - "payChannel":payChannel - }).then((value) { + if (payChannel == 1 || payChannel == 2) { + Navigator.of(context).pushNamed('/router/scan_code_page', arguments: { + "storeId": widget.arguments["storeId"], + "scanCodeType": "收银台支付", + "mid": phoneQueryMemberInfo?.sid ?? "", + "orderId": cashierOrderId, + "payChannel": payChannel + }).then((value) { if (value == 1) { _display = ""; _displayTotal = 0; - }else{ + } else { manualQueryInfo = value; showPayQueryDialog(manualQueryInfo[0], manualQueryInfo[1]); } }); - }else{ - await cashierPayOrder(cashierOrderId,payChannel,phoneQueryMemberInfo?.sid ?? ""); + } else { + await cashierPayOrder( + cashierOrderId, payChannel, phoneQueryMemberInfo?.sid ?? ""); } networkStatus = 1; setState(() {}); @@ -172,7 +173,7 @@ class _CashierPage extends State { } ///支付接口 - cashierPayOrder(orderId, payChannel,mid) async { + cashierPayOrder(orderId, payChannel, mid) async { try { if (businessService == null) { businessService = BusinessApiService(Dio(), @@ -184,8 +185,8 @@ class _CashierPage extends State { BaseData baseData = await businessService.prePayOrder({ "orderId": orderId, "payChannel": payChannel, - "mid":mid, - "authCode":(payChannel ==1 || payChannel == 2) ?"": null, + "mid": mid, + "authCode": (payChannel == 1 || payChannel == 2) ? "" : null, }).catchError((error) { networkError = AppUtils.dioErrorTypeToString(error.type); networkStatus = -1; @@ -197,25 +198,26 @@ class _CashierPage extends State { if (baseData != null && baseData.isSuccess) { _display = ""; _displayTotal = 0; - await queryMemberPhoneInfo(editingController?.text ?? "",isShow: false); + if (phoneQueryMemberInfo != null) + await queryMemberPhoneInfo(editingController?.text ?? "", + isShow: false); SmartDialog.show( widget: SettlementTips( - () {}, - text: baseData.data ??"", - color: Color(0xFF30415B), - )); + () {}, + text: baseData.data ?? "", + color: Color(0xFF30415B), + )); networkStatus = 1; setState(() {}); } else { SmartDialog.show( widget: SettlementTips( - () {}, - text: baseData.msg, - color: Color(0xFF30415B), - )); + () {}, + text: baseData.msg, + color: Color(0xFF30415B), + )); } - } finally { - } + } finally {} } ///手动查询充值订单状态 @@ -231,25 +233,27 @@ class _CashierPage extends State { tenant: BusinessInstance.instance.businessTenant, storeId: widget.arguments["storeId"]); } - BaseData baseData = await businessService.queryCashierOrder(cashierOrderId,true).catchError((error) {}); + BaseData baseData = await businessService + .queryCashierOrder(cashierOrderId, true) + .catchError((error) {}); if (baseData != null && baseData.isSuccess) { _display = ""; _displayTotal = 0; Navigator.of(context).pop(); SmartDialog.show( widget: SettlementTips( - () {}, - text: baseData.data ??"", - color: Color(0xFF30415B), - )); + () {}, + text: baseData.data ?? "", + color: Color(0xFF30415B), + )); } else { if (baseData.msg != "需要用户输入支付密码") Navigator.of(context).pop(); SmartDialog.show( widget: SettlementTips( - () {}, - text: baseData.msg, - color: Color(0xFF30415B), - )); + () {}, + text: baseData.msg, + color: Color(0xFF30415B), + )); } } finally { EasyLoading.dismiss(); @@ -271,8 +275,8 @@ class _CashierPage extends State { leadingColor: Colors.black, brightness: Brightness.dark, ), - body: Container( - child: SmartRefresher( + body:networkStatus == -1 + ? noNetwork() :SmartRefresher( enablePullDown: true, enablePullUp: false, header: MyHeader( @@ -285,9 +289,9 @@ class _CashierPage extends State { ), controller: refreshController, onRefresh: () { - if(editingController.text != "") - queryMemberPhoneInfo(editingController.text ?? "",isShow: false); - else{ + if (editingController.text != "") + queryMemberPhoneInfo(editingController.text ?? "", isShow: false); + else { refreshController.loadComplete(); refreshController.refreshCompleted(); } @@ -298,57 +302,58 @@ class _CashierPage extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 19.h, bottom: 13.h), - decoration: BoxDecoration( - color: Colors.white, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 16.w), - child: Text( - "快速收银", - style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.bold, - color: Color(0xFF0D0D0D), + if (isDisplayVipInfo == false) + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 19.h, bottom: 13.h), + decoration: BoxDecoration( + color: Colors.white, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 16.w), + child: Text( + "快速收银", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.bold, + color: Color(0xFF0D0D0D), + ), ), ), - ), - Stack( - children: [ - Container( - width: double.infinity, - height: 2.h, - margin: EdgeInsets.only(top: 5.h), - color: Color(0xFFD8D8D8), - ), - Container( - width: 44.w, - height: 1.5.h, - margin: EdgeInsets.only(top: 5.h, left: 24.w), - color: Color(0xFF30415B), - ), - ], - ), - SizedBox( - height: 13.h, - ), - vipUserSearch(), - ], + Stack( + children: [ + Container( + width: double.infinity, + height: 2.h, + margin: EdgeInsets.only(top: 5.h), + color: Color(0xFFD8D8D8), + ), + Container( + width: 44.w, + height: 1.5.h, + margin: EdgeInsets.only(top: 5.h, left: 24.w), + color: Color(0xFF30415B), + ), + ], + ), + SizedBox( + height: 13.h, + ), + vipUserSearch(), + ], + ), ), - ), - phoneQueryMemberInfo != null? - vipPlate(): - SizedBox(height:103.h), + (phoneQueryMemberInfo != null && isDisplayVipInfo == true) + ? vipPlate() + : SizedBox(height: 103.h), calculator() ], ), ), - )), + ), ), ); } @@ -420,7 +425,7 @@ class _CashierPage extends State { children: [ Container( width: double.infinity, - padding: EdgeInsets.only(top: 13.h, left: 16.w, bottom: 33.h), + padding: EdgeInsets.only(left: 16.w, bottom: 33.h), margin: EdgeInsets.only(bottom: 10.h), decoration: BoxDecoration( color: Colors.white, @@ -428,7 +433,9 @@ class _CashierPage extends State { begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [Color(0xFF30415B), Color(0xFF5171A4)]), - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.vertical( + top: Radius.circular(8), + ), ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -436,40 +443,84 @@ class _CashierPage extends State { Container( width: 52.h, height: 52.h, - margin: EdgeInsets.only(right: 15.w), + margin: EdgeInsets.only(right: 15.w, top: 13.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), ), - child: Image.asset( - "assets/image/bs_mine_heading.webp", + child:MImage( + (phoneQueryMemberInfo?.headimg ?? + ""), width: double.infinity, - height: double.infinity, - fit: BoxFit.fill, + height: double.infinity, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", ), ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 8.h), - child: Text( - "会员名称:${phoneQueryMemberInfo?.nickName ?? ""}", + Expanded( + child: Container( + padding: EdgeInsets.only(top: 13.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 8.h), + child: Text( + "会员名称:${phoneQueryMemberInfo?.nickName ?? ""}", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + )), + Text( + "手机号:${phoneQueryMemberInfo?.phoneNum ?? ""}", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, color: Colors.white, ), - )), - Text( - "手机号:${phoneQueryMemberInfo?.phoneNum ?? ""}", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.white, - ), - ) - ], - ) + ) + ], + ), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + isDisplayVipInfo = false; + editingController.text = ""; + }); + }, + child: Container( + padding: + EdgeInsets.only(right: 19.w, top: 13.h, bottom: 13.h), + child: Column( + children: [ + Image.asset( + "assets/image/bus_cashier_switch.webp", + width: 17.w, + height: 15.h, + color: Colors.white, + fit: BoxFit.fill, + ), + Padding( + padding: EdgeInsets.only(top: 5.h), + child: Text( + "切换会员", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + )) + ], + )), + )) ], ), ), @@ -505,7 +556,7 @@ class _CashierPage extends State { ], )), Text( - "${double.tryParse(phoneQueryMemberInfo?.balance ?? 0)}", + "${double.tryParse(phoneQueryMemberInfo?.balance ?? 0)}", style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.medium, @@ -543,7 +594,8 @@ class _CashierPage extends State { ], )), Text( - (phoneQueryMemberInfo?.useableConponList?.length ?? 0).toString(), + (phoneQueryMemberInfo?.useableConponList?.length ?? 0) + .toString(), style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.medium, @@ -563,7 +615,7 @@ class _CashierPage extends State { Widget calculator() { return Container( color: Colors.white, - margin: EdgeInsets.only(top: 15.h), + margin: EdgeInsets.only(top: isDisplayVipInfo == false ? 15.h : 45.h), alignment: Alignment.bottomCenter, child: Column( crossAxisAlignment: CrossAxisAlignment.end, @@ -727,62 +779,55 @@ class _CashierPage extends State { ), ], ), - Row( - children: [ - Expanded( - flex: 2, - child: Container( - alignment: Alignment.center, - color: Color(0xFF5A7092), - padding: EdgeInsets.only(top: 32.h, bottom: 33.h), - child: Text( - "¥${_displayTotal.toStringAsFixed(2)}", - style: TextStyle( - fontSize: 24.sp, - fontWeight: MyFontWeight.bold, - color: Colors.white, + Container( + height: 100.h, + child: Row( + children: [ + Expanded( + flex: 2, + child: Container( + alignment: Alignment.center, + color: Color(0xFF5A7092), + padding: EdgeInsets.only(top: 10.h, bottom: 10.h), + child: Text( + "¥${_displayTotal.toStringAsFixed(2)}", + style: TextStyle( + fontSize: 24.sp, + fontWeight: MyFontWeight.bold, + color: Colors.white, + ), ), - ), - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if(_displayTotal.toStringAsFixed(2) == "0.00"){ - SmartDialog.show( - widget: SettlementTips( - () {}, - text:"订单支付金额小于或等于0,无法进行支付操作", - color: Color(0xFF30415B), - )); - }else{ - if(phoneQueryMemberInfo != null){ - showPaySelectDialog(); - }else { + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (_displayTotal.toStringAsFixed(2) == "0.00") { SmartDialog.show( widget: SettlementTips( - () {}, - text:"请输入会员手机号进行结账", - color: Color(0xFF30415B), - )); + () {}, + text: "订单支付金额小于或等于0,无法进行支付操作", + color: Color(0xFF30415B), + )); + } else { + showPaySelectDialog(); } - } - - }, - child: Container( - alignment: Alignment.center, - color: Color(0xFF30415B), - padding: EdgeInsets.only( - top: 22.h, bottom: 25.h, left: 45.w, right: 33.w), - child: Text( - "结账", - style: TextStyle( - fontSize: 36.sp, - fontWeight: MyFontWeight.bold, - color: Colors.white, + }, + child: Container( + alignment: Alignment.center, + color: Color(0xFF30415B), + padding: EdgeInsets.only( + top: 10.h, bottom: 10.h, left: 45.w, right: 33.w), + child: Text( + "结账", + style: TextStyle( + fontSize: 36.sp, + fontWeight: MyFontWeight.bold, + color: Colors.white, + ), ), - ), - )), - ], + )), + ], + ), ) ], ), @@ -865,7 +910,7 @@ class _CashierPage extends State { builder: (context) { return Container( width: double.infinity, - height: 280.h, + height: phoneQueryMemberInfo != null ? 280.h : 220.h, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( @@ -883,17 +928,18 @@ class _CashierPage extends State { children: [ Expanded( child: Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 12.h,bottom: 12.h,left: 41.w), - child: Text( - S.of(context).zhifufangshi, - style: TextStyle( - fontWeight: MyFontWeight.bold, - fontSize: 17.sp, - color: Color(0xFF1A1A1A), - ), - ), - )), + alignment: Alignment.center, + margin: + EdgeInsets.only(top: 12.h, bottom: 12.h, left: 41.w), + child: Text( + S.of(context).zhifufangshi, + style: TextStyle( + fontWeight: MyFontWeight.bold, + fontSize: 17.sp, + color: Color(0xFF1A1A1A), + ), + ), + )), GestureDetector( onTap: () { setState(() { @@ -912,133 +958,146 @@ class _CashierPage extends State { ], ), Padding( - padding: EdgeInsets.only(left: 23.w,right: 9.w), - child:Column( + padding: EdgeInsets.only(left: 23.w, right: 9.w), + child: Column( children: [ GestureDetector( behavior: HitTestBehavior.opaque, - onTap:(){ + onTap: () { Navigator.of(context).pop(); - showPayAmountDialog(0,"现金"); + showPayAmountDialog(0, "现金"); }, - child: Padding(padding:EdgeInsets.only(left: 5.w), - child: Row( - children: [ - Image.asset( - "assets/image/bus_cashier_xj.webp", - width: 31.w, - height: 22.h, + child: Padding( + padding: EdgeInsets.only(left: 5.w), + child: Row( + children: [ + Image.asset( + "assets/image/bus_cashier_xj.webp", + width: 31.w, + height: 22.h, + ), + Padding( + padding: EdgeInsets.only(left: 14.w), + child: Text( + "现金支付", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], ), - Padding( - padding: EdgeInsets.only(left: 14.w), - child: Text( - "现金支付", - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xFF1A1A1A), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - ), - )) - ], - ),), + ), ), Container( width: double.infinity, height: 1.h, color: Color(0xFFEBEBEB), - margin: EdgeInsets.symmetric(vertical:13.h), + margin: EdgeInsets.symmetric(vertical: 13.h), ), GestureDetector( behavior: HitTestBehavior.opaque, - onTap:(){ + onTap: () { Navigator.of(context).pop(); - showPayAmountDialog(1,"微信");}, - child: Padding(padding:EdgeInsets.only(left: 5.w), - child: Row( - children: [ - Image.asset( - "assets/image/bus_vip_wx.webp", - width: 29.w, - height: 26.h, - ), - Padding( - padding: EdgeInsets.only(left: 14.w), - child: Text( - "微信", - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xFF1A1A1A), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - ), - )) - ], - ),)), - Container( - width: double.infinity, - height: 1.h, - color: Color(0xFFEBEBEB), - margin: EdgeInsets.symmetric(vertical:13.h), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap:(){ - Navigator.of(context).pop(); - showPayAmountDialog(2,"支付宝");}, - child: Padding(padding:EdgeInsets.only(left: 5.w), - child: Row( - children: [ - Image.asset( - "assets/image/bus_vip_alipay.webp", - width: 29.h, - height: 29.h, + showPayAmountDialog(1, "微信"); + }, + child: Padding( + padding: EdgeInsets.only(left: 5.w), + child: Row( + children: [ + Image.asset( + "assets/image/bus_vip_wx.webp", + width: 29.w, + height: 26.h, + ), + Padding( + padding: EdgeInsets.only(left: 14.w), + child: Text( + "微信", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], ), - Padding( - padding: EdgeInsets.only(left: 14.w), - child: Text( - "支付宝", - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xFF1A1A1A), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - ), - )) - ], - ),)), + )), Container( width: double.infinity, height: 1.h, color: Color(0xFFEBEBEB), - margin: EdgeInsets.symmetric(vertical:13.h), + margin: EdgeInsets.symmetric(vertical: 13.h), ), GestureDetector( behavior: HitTestBehavior.opaque, - onTap:(){ + onTap: () { Navigator.of(context).pop(); - showPayAmountDialog(3,"商户余额");}, - child: Padding(padding:EdgeInsets.only(left: 5.w), - child: Row( - children: [ - Image.asset( - "assets/image/bus_cashier_balance.webp", - width: 27.h, - height: 27.h, + showPayAmountDialog(2, "支付宝"); + }, + child: Padding( + padding: EdgeInsets.only(left: 5.w), + child: Row( + children: [ + Image.asset( + "assets/image/bus_vip_alipay.webp", + width: 29.h, + height: 29.h, + ), + Padding( + padding: EdgeInsets.only(left: 14.w), + child: Text( + "支付宝", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], ), - Padding( - padding: EdgeInsets.only(left: 14.w), - child: Text( - "商户余额", - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xFF1A1A1A), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, + )), + if (phoneQueryMemberInfo != null) + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFFEBEBEB), + margin: EdgeInsets.symmetric(vertical: 13.h), + ), + if (phoneQueryMemberInfo != null) + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pop(); + showPayAmountDialog(3, "商户余额"); + }, + child: Padding( + padding: EdgeInsets.only(left: 5.w), + child: Row( + children: [ + Image.asset( + "assets/image/bus_cashier_balance.webp", + width: 27.h, + height: 27.h, ), - )) - ], - ),)), + Padding( + padding: EdgeInsets.only(left: 14.w), + child: Text( + "商户余额", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + )) + ], + ), + )), // Container( // width: double.infinity, // height: 1.h, @@ -1081,7 +1140,7 @@ class _CashierPage extends State { } ///确认支付金额提示 - showPayAmountDialog(index,payText) { + showPayAmountDialog(index, payText) { showDialog( context: context, builder: (context) { @@ -1113,7 +1172,7 @@ class _CashierPage extends State { ), ), SizedBox( - height:10.h, + height: 10.h, ), Text( "支付金额: ${_displayTotal.toStringAsFixed(2)}元", @@ -1163,7 +1222,7 @@ class _CashierPage extends State { onTap: () { setState(() { Navigator.of(context).pop(); - cashierCreateOrder(index); + cashierCreateOrder(index); }); }, ), @@ -1202,7 +1261,7 @@ class _CashierPage extends State { child: Container( alignment: Alignment.topRight, padding: - EdgeInsets.symmetric(horizontal: 5.w, vertical: 10.h), + EdgeInsets.symmetric(horizontal: 5.w, vertical: 10.h), child: Image.asset( "assets/image/cancel.webp", width: 24.h, @@ -1211,7 +1270,7 @@ class _CashierPage extends State { ), Padding( padding: - EdgeInsets.only(bottom: 20.h, left: 14.w, right: 14.w), + EdgeInsets.only(bottom: 20.h, left: 14.w, right: 14.w), child: Text( queryDialog, style: TextStyle( @@ -1223,7 +1282,7 @@ class _CashierPage extends State { ), Padding( padding: - EdgeInsets.only(bottom: 20.h, left: 14.w, right: 14.w), + EdgeInsets.only(bottom: 20.h, left: 14.w, right: 14.w), child: Text.rich( TextSpan( children: [ @@ -1308,4 +1367,53 @@ class _CashierPage extends State { }, ); } + + ///网络错误 + Widget noNetwork() { + return Container( + color: Colors.white, + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0, networkError.indexOf(",")), + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF0D0D0D), + fontWeight: MyFontWeight.bold), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 10.h), + child: Text( + "请检查网络设置或稍后重试", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF7A797F), + fontWeight: MyFontWeight.regular), + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + queryMemberPhoneInfo(widget?.arguments["phoneNum"] ?? ""); + }, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(15), + ), + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h), + child: Text( + "重试", + style: TextStyle( + fontSize: 14.sp, + color: Colors.white, + fontWeight: MyFontWeight.regular), + )), + ) + ], + ), + ); + } }