Browse Source

收银台ui调整,流程调整,数据接口调试完成;

wr_2023_new_business
wurong 1 year ago
parent
commit
44e8bcf22f
  1. BIN
      assets/image/2x/bus_cashier_switch.webp
  2. BIN
      assets/image/2x/bus_vip_cc.webp
  3. BIN
      assets/image/3x/bus_cashier_switch.webp
  4. BIN
      assets/image/3x/bus_vip_cc.webp
  5. BIN
      assets/image/bus_cashier_switch.webp
  6. BIN
      assets/image/bus_vip_cc.webp
  7. 278
      lib/business_system/home/cashier/cashier_page.dart

BIN
assets/image/2x/bus_cashier_switch.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

BIN
assets/image/2x/bus_vip_cc.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
assets/image/3x/bus_cashier_switch.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
assets/image/3x/bus_vip_cc.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
assets/image/bus_cashier_switch.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

BIN
assets/image/bus_vip_cc.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

278
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<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,9 +111,8 @@ class _CashierPage extends State<CashierPage> {
refreshController.loadFailed();
}
} finally {
if (isShow)
EasyLoading.dismiss();
setState((){});
if (isShow) EasyLoading.dismiss();
setState(() {});
}
}
@ -128,10 +130,10 @@ class _CashierPage extends State<CashierPage> {
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<CashierPage> {
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: {
if (payChannel == 1 || payChannel == 2) {
Navigator.of(context).pushNamed('/router/scan_code_page', arguments: {
"storeId": widget.arguments["storeId"],
"scanCodeType": "收银台支付",
"mid":phoneQueryMemberInfo?.sid ??"",
"mid": phoneQueryMemberInfo?.sid ?? "",
"orderId": cashierOrderId,
"payChannel":payChannel
"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<CashierPage> {
}
///
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<CashierPage> {
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,11 +198,13 @@ 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(
() {},
text: baseData.data ??"",
text: baseData.data ?? "",
color: Color(0xFF30415B),
));
networkStatus = 1;
@ -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;
@ -239,7 +243,7 @@ class _CashierPage extends State<CashierPage> {
SmartDialog.show(
widget: SettlementTips(
() {},
text: baseData.data ??"",
text: baseData.data ?? "",
color: Color(0xFF30415B),
));
} else {
@ -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(
@ -285,9 +289,9 @@ class _CashierPage extends State<CashierPage> {
),
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,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(
@ -747,32 +801,22 @@ class _CashierPage extends State<CashierPage> {
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if(_displayTotal.toStringAsFixed(2) == "0.00"){
if (_displayTotal.toStringAsFixed(2) == "0.00") {
SmartDialog.show(
widget: SettlementTips(
() {},
text:"订单支付金额小于或等于0,无法进行支付操作",
text: "订单支付金额小于或等于0,无法进行支付操作",
color: Color(0xFF30415B),
));
}else{
if(phoneQueryMemberInfo != null){
} else {
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(
@ -912,16 +958,17 @@ class _CashierPage extends State<CashierPage> {
],
),
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: Padding(
padding: EdgeInsets.only(left: 5.w),
child: Row(
children: [
Image.asset(
@ -941,20 +988,23 @@ class _CashierPage extends State<CashierPage> {
),
))
],
),),
),
),
),
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),
showPayAmountDialog(1, "微信");
},
child: Padding(
padding: EdgeInsets.only(left: 5.w),
child: Row(
children: [
Image.asset(
@ -974,19 +1024,22 @@ class _CashierPage extends State<CashierPage> {
),
))
],
),)),
),
)),
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(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),
margin: EdgeInsets.symmetric(vertical: 13.h),
),
if (phoneQueryMemberInfo != null)
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap:(){
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,
@ -1081,7 +1140,7 @@ class _CashierPage extends State<CashierPage> {
}
///
showPayAmountDialog(index,payText) {
showPayAmountDialog(index, payText) {
showDialog(
context: context,
builder: (context) {
@ -1113,7 +1172,7 @@ class _CashierPage extends State<CashierPage> {
),
),
SizedBox(
height:10.h,
height: 10.h,
),
Text(
"支付金额: ${_displayTotal.toStringAsFixed(2)}",
@ -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),
)),
)
],
),
);
}
}

Loading…
Cancel
Save