|
|
|
@ -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<CashierPage> {
|
|
|
|
|
List<dynamic> manualQueryInfo; |
|
|
|
|
bool isDisplayVipInfo = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///离开页面记着销毁和清除 |
|
|
|
|
@override |
|
|
|
|
void dispose() { |
|
|
|
@ -71,6 +71,8 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
if((widget?.arguments["phone"] ?? "")!= "") |
|
|
|
|
queryMemberPhoneInfo(widget?.arguments["phone"] ?? ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///根据手机号搜索用户信息 |
|
|
|
@ -99,6 +101,7 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
if (!mounted) return; |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
phoneQueryMemberInfo = baseData.data; |
|
|
|
|
isDisplayVipInfo = true; |
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
networkStatus = 1; |
|
|
|
@ -108,8 +111,7 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
} |
|
|
|
|
} finally { |
|
|
|
|
if (isShow) |
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
if (isShow) EasyLoading.dismiss(); |
|
|
|
|
setState(() {}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -143,9 +145,7 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
cashierOrderId = baseData.data; |
|
|
|
|
if (payChannel == 1 || payChannel == 2) { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/scan_code_page', |
|
|
|
|
arguments: { |
|
|
|
|
Navigator.of(context).pushNamed('/router/scan_code_page', arguments: { |
|
|
|
|
"storeId": widget.arguments["storeId"], |
|
|
|
|
"scanCodeType": "收银台支付", |
|
|
|
|
"mid": phoneQueryMemberInfo?.sid ?? "", |
|
|
|
@ -161,7 +161,8 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
await cashierPayOrder(cashierOrderId,payChannel,phoneQueryMemberInfo?.sid ?? ""); |
|
|
|
|
await cashierPayOrder( |
|
|
|
|
cashierOrderId, payChannel, phoneQueryMemberInfo?.sid ?? ""); |
|
|
|
|
} |
|
|
|
|
networkStatus = 1; |
|
|
|
|
setState(() {}); |
|
|
|
@ -197,7 +198,9 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
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( |
|
|
|
|
() {}, |
|
|
|
@ -214,8 +217,7 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
color: Color(0xFF30415B), |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
} finally { |
|
|
|
|
} |
|
|
|
|
} finally {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///手动查询充值订单状态 |
|
|
|
@ -231,7 +233,9 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
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; |
|
|
|
@ -271,8 +275,8 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
leadingColor: Colors.black, |
|
|
|
|
brightness: Brightness.dark, |
|
|
|
|
), |
|
|
|
|
body: Container( |
|
|
|
|
child: SmartRefresher( |
|
|
|
|
body:networkStatus == -1 |
|
|
|
|
? noNetwork() :SmartRefresher( |
|
|
|
|
enablePullDown: true, |
|
|
|
|
enablePullUp: false, |
|
|
|
|
header: MyHeader( |
|
|
|
@ -298,6 +302,7 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
child: Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
if (isDisplayVipInfo == false) |
|
|
|
|
Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
padding: EdgeInsets.only(top: 19.h, bottom: 13.h), |
|
|
|
@ -341,14 +346,14 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
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<CashierPage> {
|
|
|
|
|
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<CashierPage> {
|
|
|
|
|
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,24 +443,32 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
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, |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
errorSrc: "assets/image/default_1.webp", |
|
|
|
|
fadeSrc: "assets/image/default_1.webp", |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Column( |
|
|
|
|
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, |
|
|
|
@ -469,7 +484,43 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
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, |
|
|
|
|
), |
|
|
|
|
)) |
|
|
|
|
], |
|
|
|
|
)), |
|
|
|
|
)) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -543,7 +594,8 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
], |
|
|
|
|
)), |
|
|
|
|
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<CashierPage> {
|
|
|
|
|
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,14 +779,16 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
Container( |
|
|
|
|
height: 100.h, |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
flex: 2, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
color: Color(0xFF5A7092), |
|
|
|
|
padding: EdgeInsets.only(top: 32.h, bottom: 33.h), |
|
|
|
|
padding: EdgeInsets.only(top: 10.h, bottom: 10.h), |
|
|
|
|
child: Text( |
|
|
|
|
"¥${_displayTotal.toStringAsFixed(2)}", |
|
|
|
|
style: TextStyle( |
|
|
|
@ -755,24 +809,14 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
color: Color(0xFF30415B), |
|
|
|
|
)); |
|
|
|
|
} else { |
|
|
|
|
if(phoneQueryMemberInfo != null){ |
|
|
|
|
showPaySelectDialog(); |
|
|
|
|
}else { |
|
|
|
|
SmartDialog.show( |
|
|
|
|
widget: SettlementTips( |
|
|
|
|
() {}, |
|
|
|
|
text:"请输入会员手机号进行结账", |
|
|
|
|
color: Color(0xFF30415B), |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
color: Color(0xFF30415B), |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
top: 22.h, bottom: 25.h, left: 45.w, right: 33.w), |
|
|
|
|
top: 10.h, bottom: 10.h, left: 45.w, right: 33.w), |
|
|
|
|
child: Text( |
|
|
|
|
"结账", |
|
|
|
|
style: TextStyle( |
|
|
|
@ -783,6 +827,7 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -865,7 +910,7 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
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( |
|
|
|
@ -884,7 +929,8 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
Expanded( |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
margin: EdgeInsets.only(top: 12.h,bottom: 12.h,left: 41.w), |
|
|
|
|
margin: |
|
|
|
|
EdgeInsets.only(top: 12.h, bottom: 12.h, left: 41.w), |
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).zhifufangshi, |
|
|
|
|
style: TextStyle( |
|
|
|
@ -921,7 +967,8 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
showPayAmountDialog(0, "现金"); |
|
|
|
|
}, |
|
|
|
|
child: Padding(padding:EdgeInsets.only(left: 5.w), |
|
|
|
|
child: Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 5.w), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Image.asset( |
|
|
|
@ -941,7 +988,8 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
), |
|
|
|
|
)) |
|
|
|
|
], |
|
|
|
|
),), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
width: double.infinity, |
|
|
|
@ -953,8 +1001,10 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
showPayAmountDialog(1,"微信");}, |
|
|
|
|
child: Padding(padding:EdgeInsets.only(left: 5.w), |
|
|
|
|
showPayAmountDialog(1, "微信"); |
|
|
|
|
}, |
|
|
|
|
child: Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 5.w), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Image.asset( |
|
|
|
@ -974,7 +1024,8 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
), |
|
|
|
|
)) |
|
|
|
|
], |
|
|
|
|
),)), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
height: 1.h, |
|
|
|
@ -985,8 +1036,10 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
showPayAmountDialog(2,"支付宝");}, |
|
|
|
|
child: Padding(padding:EdgeInsets.only(left: 5.w), |
|
|
|
|
showPayAmountDialog(2, "支付宝"); |
|
|
|
|
}, |
|
|
|
|
child: Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 5.w), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Image.asset( |
|
|
|
@ -1006,19 +1059,24 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
), |
|
|
|
|
)) |
|
|
|
|
], |
|
|
|
|
),)), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
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), |
|
|
|
|
showPayAmountDialog(3, "商户余额"); |
|
|
|
|
}, |
|
|
|
|
child: Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 5.w), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Image.asset( |
|
|
|
@ -1038,7 +1096,8 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
), |
|
|
|
|
)) |
|
|
|
|
], |
|
|
|
|
),)), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
// Container( |
|
|
|
|
// width: double.infinity, |
|
|
|
|
// height: 1.h, |
|
|
|
@ -1308,4 +1367,53 @@ class _CashierPage extends State<CashierPage> {
|
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///网络错误 |
|
|
|
|
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), |
|
|
|
|
)), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|