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.
1137 lines
48 KiB
1137 lines
48 KiB
import 'package:dio/dio.dart'; |
|
import 'package:flutter/material.dart'; |
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
import 'package:huixiang/retrofit/data/business_store_list.dart'; |
|
import 'package:huixiang/view_widget/my_appbar.dart'; |
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
import '../../generated/l10n.dart'; |
|
import '../../retrofit/business_api.dart'; |
|
import '../../retrofit/data/base_data.dart'; |
|
import '../../utils/business_instance.dart'; |
|
import '../../utils/font_weight.dart'; |
|
|
|
class MerchantInfo extends StatefulWidget { |
|
final Map<String, dynamic> arguments; |
|
|
|
MerchantInfo({this.arguments}); |
|
|
|
@override |
|
State<StatefulWidget> createState() { |
|
return _MerchantInfo(); |
|
} |
|
} |
|
|
|
class _MerchantInfo extends State<MerchantInfo> { |
|
int platformIndex = 0; |
|
int useErpIndex = 0; |
|
int isEnableIndex = 0; |
|
BusinessApiService businessService; |
|
Records records; |
|
int tradeTypeIndex = 0; |
|
String posTypeCode; |
|
int shopTypeIndex = 0; |
|
String serviceType; |
|
TextEditingController shopNameController = TextEditingController(); |
|
TextEditingController telController = TextEditingController(); |
|
TextEditingController sortController = TextEditingController(); |
|
List<dynamic> image; |
|
String logo; |
|
String facade; |
|
|
|
@override |
|
void initState() { |
|
super.initState(); |
|
records = widget.arguments["records"]; |
|
} |
|
|
|
///保存店铺信息 |
|
saveInfo() async { |
|
EasyLoading.show( |
|
status: S.current.zhengzaijiazai, |
|
maskType: EasyLoadingMaskType.black); |
|
if (businessService == null) { |
|
businessService = BusinessApiService(Dio(), |
|
context: context, |
|
token: BusinessInstance.instance.businessToken, |
|
tenant: BusinessInstance.instance.businessTenant, |
|
storeId: widget.arguments["storeId"]); |
|
} |
|
BaseData baseData = await businessService.saveStoreInfo({ |
|
"id": widget.arguments["storeId"], |
|
"storeName": (shopNameController.text??"")== "" ? records.storeName: shopNameController.text, |
|
"posType": posTypeCode == null ? records.posType.code: tradeTypeCode(), |
|
"serviceType": serviceType == null ? records.serviceType : shopTypeCode(), |
|
"tel": telController.text ?? records.tel, |
|
"logo": logo, |
|
"facade": facade, |
|
"sort": (sortController.text??"")==""? records.sort :double.tryParse(sortController.text), |
|
"platformShow": platformIndex == 0 ? records.platformShow :(platformIndex == 1 ?true:false), |
|
"isEnable": isEnableIndex == 0 ? records.isEnable :(isEnableIndex == 1 ?true:false), |
|
"useErp": useErpIndex == 0 ? records.useErp :(useErpIndex == 1 ?true:false), |
|
"isAutoSendRefundAddress": 1 |
|
}).catchError((error) {}); |
|
if (baseData != null && baseData.isSuccess) { |
|
EasyLoading.dismiss(); |
|
SmartDialog.showToast("店铺设置修改成功", alignment: Alignment.center); |
|
Navigator.of(context).pop(); |
|
} else { |
|
EasyLoading.dismiss(); |
|
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
|
} |
|
} |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
return GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: () { |
|
FocusScope.of(context).unfocus(); |
|
}, |
|
child: Scaffold( |
|
resizeToAvoidBottomInset: false, |
|
backgroundColor: Color(0xFFF8F8FA), |
|
appBar: MyAppBar( |
|
title: "门店设置", |
|
titleColor: Colors.black, |
|
background: Colors.white, |
|
leadingColor: Colors.black, |
|
brightness: Brightness.dark, |
|
), |
|
body: Column( |
|
children: [ |
|
Container( |
|
margin: EdgeInsets.only(top: 16.h, left: 14.w, right: 14.w), |
|
decoration: BoxDecoration( |
|
color: Colors.white, |
|
borderRadius: BorderRadius.circular(8.w), |
|
), |
|
padding: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 17.h), |
|
child: Column( |
|
children: [ |
|
textItem("店铺名称", shopNameController, records.storeName ?? ""), |
|
Container( |
|
width: double.infinity, |
|
height: 1.h, |
|
color: Color(0xFFEBECEF), |
|
margin: EdgeInsets.only(top: 2.h, bottom: 16.h)), |
|
GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: () { |
|
showTradeType(); |
|
}, |
|
child: textItems("收单类型", |
|
posTypeCode == null ? tradeType() : posTypeCode), |
|
), |
|
Container( |
|
width: double.infinity, |
|
height: 1.h, |
|
color: Color(0xFFEBECEF), |
|
margin: EdgeInsets.only(top: 2.h, bottom: 16.h)), |
|
GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: () { |
|
showShopType(); |
|
}, |
|
child: textItems( |
|
"店铺类型", serviceType == null ? shopType()??"" : serviceType??""), |
|
), |
|
Container( |
|
width: double.infinity, |
|
height: 1.h, |
|
color: Color(0xFFEBECEF), |
|
margin: EdgeInsets.only(top: 2.h)), |
|
textItem("负责人电话", telController, records.tel ?? ""), |
|
Container( |
|
width: double.infinity, |
|
height: 1.h, |
|
color: Color(0xFFEBECEF), |
|
margin: EdgeInsets.only(top: 2.h, bottom: 16.h)), |
|
GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: () { |
|
Navigator.pushNamed(context, "/router/shop_image_info", |
|
arguments: { |
|
"logo": ((logo ?? "") != "") ? logo : records.logo, |
|
"facade": ((facade ??"") != "")?facade : records.facade, |
|
"storeId":widget.arguments["storeId"], |
|
}).then((value){ |
|
if(value != null) { |
|
image = value; |
|
logo = image[0]; |
|
facade = image[1]; |
|
} |
|
}); |
|
}, |
|
child: textItems("门店图片", "精美的图片更加吸引顾客"), |
|
), |
|
Container( |
|
width: double.infinity, |
|
height: 1.h, |
|
color: Color(0xFFEBECEF), |
|
margin: EdgeInsets.only(top: 2.h)), |
|
textItem( |
|
"排序", sortController, records.sort.toString() ?? ""), |
|
Container( |
|
width: double.infinity, |
|
height: 1.h, |
|
color: Color(0xFFEBECEF), |
|
margin: EdgeInsets.only(top: 2.h, bottom: 16.h)), |
|
Row( |
|
children: [ |
|
Expanded( |
|
child: Text( |
|
"是否在平台展示", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF0D0D0D), |
|
fontWeight: MyFontWeight.bold), |
|
)), |
|
GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: () { |
|
setState(() { |
|
platformIndex = 1; |
|
}); |
|
}, |
|
child: Row( |
|
children: [ |
|
Image.asset( |
|
(platformIndex == 0 ?(records.platformShow == true):(platformIndex==1)) |
|
? "assets/image/bs_check.webp" |
|
: "assets/image/bs_uncheck.webp", |
|
width: 16, |
|
height: 16, |
|
fit: BoxFit.cover, |
|
), |
|
SizedBox( |
|
width: 5.w, |
|
), |
|
Text( |
|
"是", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF1A1A1A), |
|
fontWeight: MyFontWeight.medium), |
|
), |
|
], |
|
), |
|
), |
|
SizedBox( |
|
width: 36.w, |
|
), |
|
GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: () { |
|
setState(() { |
|
platformIndex = 2; |
|
}); |
|
}, |
|
child: Row( |
|
children: [ |
|
Image.asset( |
|
(platformIndex == 0 ?(records.platformShow == false):(platformIndex==2)) |
|
? "assets/image/bs_check.webp" |
|
: "assets/image/bs_uncheck.webp", |
|
width: 16, |
|
height: 16, |
|
fit: BoxFit.cover, |
|
), |
|
SizedBox( |
|
width: 5.w, |
|
), |
|
Text( |
|
"否", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF1A1A1A), |
|
fontWeight: MyFontWeight.medium), |
|
) |
|
], |
|
), |
|
), |
|
], |
|
), |
|
Container( |
|
width: double.infinity, |
|
height: 1.h, |
|
color: Color(0xFFEBECEF), |
|
margin: EdgeInsets.symmetric(vertical: 16.h)), |
|
Row( |
|
children: [ |
|
Expanded( |
|
child: Text( |
|
"是否启用仓库管理", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF0D0D0D), |
|
fontWeight: MyFontWeight.bold), |
|
)), |
|
GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: () { |
|
setState(() { |
|
useErpIndex = 1; |
|
}); |
|
}, |
|
child: Row( |
|
children: [ |
|
Image.asset( |
|
(useErpIndex == 0 ?(records.useErp == true):(useErpIndex==1)) |
|
? "assets/image/bs_check.webp" |
|
: "assets/image/bs_uncheck.webp", |
|
width: 16, |
|
height: 16, |
|
fit: BoxFit.cover, |
|
), |
|
SizedBox( |
|
width: 5.w, |
|
), |
|
Text( |
|
"是", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF1A1A1A), |
|
fontWeight: MyFontWeight.medium), |
|
), |
|
], |
|
), |
|
), |
|
SizedBox( |
|
width: 36.w, |
|
), |
|
GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: () { |
|
setState(() { |
|
useErpIndex = 2; |
|
}); |
|
}, |
|
child: Row( |
|
children: [ |
|
Image.asset( |
|
(useErpIndex == 0 ?(records.useErp == false):(useErpIndex==2)) |
|
? "assets/image/bs_check.webp" |
|
: "assets/image/bs_uncheck.webp", |
|
width: 16, |
|
height: 16, |
|
fit: BoxFit.cover, |
|
), |
|
SizedBox( |
|
width: 5.w, |
|
), |
|
Text( |
|
"否", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF1A1A1A), |
|
fontWeight: MyFontWeight.medium), |
|
) |
|
], |
|
), |
|
), |
|
], |
|
), |
|
Container( |
|
width: double.infinity, |
|
height: 1.h, |
|
color: Color(0xFFEBECEF), |
|
margin: EdgeInsets.symmetric(vertical: 16.h)), |
|
Row( |
|
children: [ |
|
Expanded( |
|
child: Text( |
|
"是否启用门店", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF0D0D0D), |
|
fontWeight: MyFontWeight.bold), |
|
)), |
|
GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: () { |
|
setState(() { |
|
isEnableIndex = 1; |
|
}); |
|
}, |
|
child: Row( |
|
children: [ |
|
Image.asset( |
|
(isEnableIndex == 0 ?(records.isEnable == true):(isEnableIndex==1)) |
|
? "assets/image/bs_check.webp" |
|
: "assets/image/bs_uncheck.webp", |
|
width: 16, |
|
height: 16, |
|
fit: BoxFit.cover, |
|
), |
|
SizedBox( |
|
width: 5.w, |
|
), |
|
Text( |
|
"是", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF1A1A1A), |
|
fontWeight: MyFontWeight.medium), |
|
), |
|
], |
|
), |
|
), |
|
SizedBox( |
|
width: 36.w, |
|
), |
|
GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: () { |
|
setState(() { |
|
isEnableIndex = 2; |
|
}); |
|
}, |
|
child: Row( |
|
children: [ |
|
Image.asset( |
|
(isEnableIndex == 0 ?(records.isEnable == false):(isEnableIndex==2)) |
|
? "assets/image/bs_check.webp" |
|
: "assets/image/bs_uncheck.webp", |
|
width: 16, |
|
height: 16, |
|
fit: BoxFit.cover, |
|
), |
|
SizedBox( |
|
width: 5.w, |
|
), |
|
Text( |
|
"否", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF1A1A1A), |
|
fontWeight: MyFontWeight.medium), |
|
) |
|
], |
|
), |
|
), |
|
], |
|
), |
|
], |
|
), |
|
), |
|
Spacer(), |
|
GestureDetector( |
|
behavior: HitTestBehavior.opaque, |
|
onTap: (){ |
|
saveInfo(); |
|
}, |
|
child: Container( |
|
width: double.infinity, |
|
alignment: Alignment.center, |
|
margin: EdgeInsets.only(bottom: 55.h, left: 16.w, right: 16.w), |
|
padding: EdgeInsets.symmetric(vertical: 16.h), |
|
decoration: BoxDecoration( |
|
borderRadius: BorderRadius.circular(27), |
|
color: Color(0xFF30415B)), |
|
child: Text( |
|
S.of(context).baocun, |
|
style: TextStyle( |
|
fontWeight: MyFontWeight.semi_bold, |
|
fontSize: 16.sp, |
|
color: Colors.white, |
|
), |
|
), |
|
), |
|
) |
|
], |
|
), |
|
), |
|
); |
|
} |
|
|
|
Widget textItem(left, rightController, right) { |
|
return Container( |
|
child: Row( |
|
children: [ |
|
Expanded( |
|
child: Text( |
|
left, |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF0D0D0D), |
|
fontWeight: MyFontWeight.bold), |
|
), |
|
flex: 1, |
|
), |
|
Expanded( |
|
child: TextField( |
|
controller: rightController, |
|
decoration: InputDecoration( |
|
hintText: right ?? "", |
|
hintTextDirection: TextDirection.rtl, |
|
hintStyle: TextStyle( |
|
color: Color(0xFF7A797F), |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.regular, |
|
), |
|
border: InputBorder.none, |
|
), |
|
textAlign: TextAlign.right, |
|
style: TextStyle( |
|
color: Color(0xFF7A797F), |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.regular), |
|
), |
|
flex: 2, |
|
), |
|
], |
|
)); |
|
} |
|
|
|
Widget textItems(left, right) { |
|
return Container( |
|
padding: EdgeInsets.only(bottom: 16.h), |
|
child: Row( |
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
mainAxisAlignment: MainAxisAlignment.center, |
|
children: [ |
|
Expanded( |
|
child: Text( |
|
left, |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF0D0D0D), |
|
fontWeight: MyFontWeight.bold), |
|
)), |
|
Text( |
|
right, |
|
maxLines: 2, |
|
overflow: TextOverflow.ellipsis, |
|
textAlign: TextAlign.right, |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF7A797F), |
|
fontWeight: MyFontWeight.medium), |
|
), |
|
SizedBox( |
|
width: 4.w, |
|
), |
|
Image.asset( |
|
"assets/image/icon_right_z.webp", |
|
width: 16.h, |
|
height: 16.h, |
|
color: Color(0xFF7A797F), |
|
), |
|
], |
|
)); |
|
} |
|
|
|
///收单类型 |
|
String tradeType() { |
|
if (records.posType.code == "NORMALSTORE") { |
|
return "普通餐饮"; |
|
} else if (records.posType.code == "FASTSTORE") { |
|
return "快消餐饮"; |
|
} else if (records.posType.code == "RETAILSTORE") { |
|
return "零售店"; |
|
} else if (records.posType.code == "DIRECT") { |
|
return "直付商店"; |
|
} |
|
} |
|
|
|
///收单类型选择 |
|
String tradeTypeCode() { |
|
if (tradeTypeIndex == 0) { |
|
return "NORMALSTORE"; |
|
} else if (tradeTypeIndex == 1) { |
|
return "FASTSTORE"; |
|
} else if (tradeTypeIndex == 2) { |
|
return "RETAILSTORE"; |
|
} else if (tradeTypeIndex == 3) { |
|
return "DIRECT"; |
|
} |
|
} |
|
|
|
///收单类型弹窗选择 |
|
showTradeType() { |
|
showModalBottomSheet( |
|
context: context, |
|
backgroundColor: Colors.transparent, |
|
builder: (context) { |
|
return StatefulBuilder(builder: ( |
|
context, |
|
state, |
|
) { |
|
return Container( |
|
width: double.infinity, |
|
height: 420.h, |
|
decoration: BoxDecoration( |
|
color: Colors.white, |
|
borderRadius: BorderRadius.only( |
|
topLeft: Radius.circular(8), |
|
topRight: Radius.circular(8), |
|
), |
|
), |
|
child: Column( |
|
mainAxisAlignment: MainAxisAlignment.start, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Row( |
|
mainAxisAlignment: MainAxisAlignment.start, |
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
children: [ |
|
Expanded( |
|
child: Container( |
|
alignment: Alignment.center, |
|
margin: EdgeInsets.only( |
|
top: 12.h, bottom: 12.h, left: 41.w), |
|
child: Text( |
|
"选择收单类型", |
|
style: TextStyle( |
|
fontWeight: MyFontWeight.bold, |
|
fontSize: 16.sp, |
|
color: Color(0xFF1A1A1A), |
|
), |
|
), |
|
)), |
|
GestureDetector( |
|
onTap: () { |
|
state(() { |
|
Navigator.of(context).pop(); |
|
}); |
|
}, |
|
child: Padding( |
|
padding: EdgeInsets.only(right: 16.w), |
|
child: Image.asset( |
|
"assets/image/cancel.webp", |
|
width: 25.h, |
|
height: 25.h, |
|
), |
|
), |
|
), |
|
], |
|
), |
|
Padding( |
|
padding: EdgeInsets.symmetric(horizontal: 16.w), |
|
child: Column( |
|
children: [ |
|
GestureDetector( |
|
onTap: () { |
|
state(() { |
|
tradeTypeIndex = 0; |
|
posTypeCode = "普通餐饮"; |
|
}); |
|
}, |
|
child: Container( |
|
height: 52.h, |
|
margin: EdgeInsets.only(bottom: 12), |
|
child: Stack( |
|
alignment: Alignment.bottomRight, |
|
children: [ |
|
Container( |
|
height: 52.h, |
|
width: double.infinity, |
|
decoration: BoxDecoration( |
|
color: tradeTypeIndex == 0 |
|
? Color(0xFFEFF5FF) |
|
: Color(0xFFF7F7F7), |
|
borderRadius: BorderRadius.circular(4.w), |
|
border: Border.all( |
|
color: tradeTypeIndex == 0 |
|
? Color(0xFF30415B) |
|
: Colors.white, |
|
width: tradeTypeIndex == 0 ? 1.w : 0, |
|
), |
|
), |
|
padding: EdgeInsets.only( |
|
top: 16.h, |
|
bottom: 16.h, |
|
left: 16.w, |
|
right: 17.w), |
|
child: Text( |
|
"普通餐饮", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: tradeTypeIndex == 0 |
|
? Color(0xFF30415B) |
|
: Color(0xFF0D0D0D)), |
|
), |
|
), |
|
if (tradeTypeIndex == 0) |
|
Image.asset( |
|
"assets/image/bs_shop.webp", |
|
width: 20, |
|
height: 20, |
|
fit: BoxFit.fill, |
|
), |
|
], |
|
), |
|
)), |
|
GestureDetector( |
|
onTap: () { |
|
state(() { |
|
tradeTypeIndex = 1; |
|
posTypeCode = "快消餐饮"; |
|
}); |
|
}, |
|
child: Container( |
|
height: 52.h, |
|
margin: EdgeInsets.only(bottom: 12), |
|
child: Stack( |
|
alignment: Alignment.bottomRight, |
|
children: [ |
|
Container( |
|
height: 52.h, |
|
width: double.infinity, |
|
decoration: BoxDecoration( |
|
color: tradeTypeIndex == 1 |
|
? Color(0xFFEFF5FF) |
|
: Color(0xFFF7F7F7), |
|
borderRadius: BorderRadius.circular(4.w), |
|
border: Border.all( |
|
color: tradeTypeIndex == 1 |
|
? Color(0xFF30415B) |
|
: Colors.white, |
|
width: tradeTypeIndex == 1 ? 1.w : 0, |
|
), |
|
), |
|
padding: EdgeInsets.only( |
|
top: 16.h, |
|
bottom: 16.h, |
|
left: 16.w, |
|
right: 17.w), |
|
child: Text( |
|
"快消餐饮", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: tradeTypeIndex == 1 |
|
? Color(0xFF30415B) |
|
: Color(0xFF0D0D0D)), |
|
), |
|
), |
|
if (tradeTypeIndex == 1) |
|
Image.asset( |
|
"assets/image/bs_shop.webp", |
|
width: 20, |
|
height: 20, |
|
fit: BoxFit.fill, |
|
), |
|
], |
|
), |
|
)), |
|
GestureDetector( |
|
onTap: () { |
|
state(() { |
|
tradeTypeIndex = 2; |
|
posTypeCode = "零售店"; |
|
}); |
|
}, |
|
child: Container( |
|
height: 52.h, |
|
margin: EdgeInsets.only(bottom: 12), |
|
child: Stack( |
|
alignment: Alignment.bottomRight, |
|
children: [ |
|
Container( |
|
height: 52.h, |
|
width: double.infinity, |
|
decoration: BoxDecoration( |
|
color: tradeTypeIndex == 2 |
|
? Color(0xFFEFF5FF) |
|
: Color(0xFFF7F7F7), |
|
borderRadius: BorderRadius.circular(4.w), |
|
border: Border.all( |
|
color: tradeTypeIndex == 2 |
|
? Color(0xFF30415B) |
|
: Colors.white, |
|
width: tradeTypeIndex == 2 ? 1.w : 0, |
|
), |
|
), |
|
padding: EdgeInsets.only( |
|
top: 16.h, |
|
bottom: 16.h, |
|
left: 16.w, |
|
right: 17.w), |
|
child: Text( |
|
"零售店", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: tradeTypeIndex == 2 |
|
? Color(0xFF30415B) |
|
: Color(0xFF0D0D0D)), |
|
), |
|
), |
|
if (tradeTypeIndex == 2) |
|
Image.asset( |
|
"assets/image/bs_shop.webp", |
|
width: 20, |
|
height: 20, |
|
fit: BoxFit.fill, |
|
), |
|
], |
|
), |
|
)), |
|
GestureDetector( |
|
onTap: () { |
|
state(() { |
|
tradeTypeIndex = 3; |
|
posTypeCode = "直付商店"; |
|
}); |
|
}, |
|
child: Container( |
|
height: 52.h, |
|
margin: EdgeInsets.only(bottom: 12), |
|
child: Stack( |
|
alignment: Alignment.bottomRight, |
|
children: [ |
|
Container( |
|
height: 52.h, |
|
width: double.infinity, |
|
decoration: BoxDecoration( |
|
color: tradeTypeIndex == 3 |
|
? Color(0xFFEFF5FF) |
|
: Color(0xFFF7F7F7), |
|
borderRadius: BorderRadius.circular(4.w), |
|
border: Border.all( |
|
color: tradeTypeIndex == 3 |
|
? Color(0xFF30415B) |
|
: Colors.white, |
|
width: tradeTypeIndex == 3 ? 1.w : 0, |
|
), |
|
), |
|
padding: EdgeInsets.only( |
|
top: 16.h, |
|
bottom: 16.h, |
|
left: 16.w, |
|
right: 17.w), |
|
child: Text( |
|
"直付商店", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: tradeTypeIndex == 3 |
|
? Color(0xFF30415B) |
|
: Color(0xFF0D0D0D)), |
|
), |
|
), |
|
if (tradeTypeIndex == 3) |
|
Image.asset( |
|
"assets/image/bs_shop.webp", |
|
width: 20, |
|
height: 20, |
|
fit: BoxFit.fill, |
|
), |
|
], |
|
), |
|
)), |
|
GestureDetector( |
|
onTap: () { |
|
setState(() { |
|
Navigator.of(context).pop(posTypeCode); |
|
}); |
|
}, |
|
child: Container( |
|
width: double.infinity, |
|
alignment: Alignment.center, |
|
margin: EdgeInsets.only(top: 25.h), |
|
padding: EdgeInsets.symmetric(vertical: 16.h), |
|
decoration: BoxDecoration( |
|
borderRadius: BorderRadius.circular(27), |
|
color: Color(0xFF30415B)), |
|
child: Text( |
|
S.of(context).queding, |
|
style: TextStyle( |
|
fontWeight: MyFontWeight.semi_bold, |
|
fontSize: 16.sp, |
|
color: Colors.white, |
|
), |
|
), |
|
), |
|
) |
|
], |
|
), |
|
) |
|
], |
|
), |
|
); |
|
}); |
|
}); |
|
} |
|
|
|
///店铺类型 |
|
String shopType() { |
|
if (records.serviceType == "EATSTORE") { |
|
return "吃"; |
|
} else if (records.serviceType == "DRINKSTORE") { |
|
return "喝"; |
|
} else if (records.serviceType == "HAPPYSTORE") { |
|
return "玩"; |
|
} |
|
} |
|
|
|
///店铺类型选择 |
|
String shopTypeCode() { |
|
if (shopTypeIndex == 0) { |
|
return "EATSTORE"; |
|
} else if (shopTypeIndex == 1) { |
|
return "DRINKSTORE"; |
|
} else if (shopTypeIndex == 2) { |
|
return "HAPPYSTORE"; |
|
} |
|
} |
|
|
|
///店铺类型弹窗选择 |
|
showShopType() { |
|
showModalBottomSheet( |
|
context: context, |
|
backgroundColor: Colors.transparent, |
|
builder: (context) { |
|
return StatefulBuilder(builder: ( |
|
context, |
|
state, |
|
) { |
|
return Container( |
|
width: double.infinity, |
|
height: 360.h, |
|
decoration: BoxDecoration( |
|
color: Colors.white, |
|
borderRadius: BorderRadius.only( |
|
topLeft: Radius.circular(8), |
|
topRight: Radius.circular(8), |
|
), |
|
), |
|
child: Column( |
|
mainAxisAlignment: MainAxisAlignment.start, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Row( |
|
mainAxisAlignment: MainAxisAlignment.start, |
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
children: [ |
|
Expanded( |
|
child: Container( |
|
alignment: Alignment.center, |
|
margin: EdgeInsets.only( |
|
top: 12.h, bottom: 12.h, left: 41.w), |
|
child: Text( |
|
"选择店铺类型", |
|
style: TextStyle( |
|
fontWeight: MyFontWeight.bold, |
|
fontSize: 16.sp, |
|
color: Color(0xFF1A1A1A), |
|
), |
|
), |
|
)), |
|
GestureDetector( |
|
onTap: () { |
|
state(() { |
|
Navigator.of(context).pop(); |
|
}); |
|
}, |
|
child: Padding( |
|
padding: EdgeInsets.only(right: 16.w), |
|
child: Image.asset( |
|
"assets/image/cancel.webp", |
|
width: 25.h, |
|
height: 25.h, |
|
), |
|
), |
|
), |
|
], |
|
), |
|
Padding( |
|
padding: EdgeInsets.symmetric(horizontal: 16.w), |
|
child: Column( |
|
children: [ |
|
GestureDetector( |
|
onTap: () { |
|
state(() { |
|
shopTypeIndex = 0; |
|
serviceType = "吃"; |
|
}); |
|
}, |
|
child: Container( |
|
height: 52.h, |
|
margin: EdgeInsets.only(bottom: 12), |
|
child: Stack( |
|
alignment: Alignment.bottomRight, |
|
children: [ |
|
Container( |
|
height: 52.h, |
|
width: double.infinity, |
|
decoration: BoxDecoration( |
|
color: shopTypeIndex == 0 |
|
? Color(0xFFEFF5FF) |
|
: Color(0xFFF7F7F7), |
|
borderRadius: BorderRadius.circular(4.w), |
|
border: Border.all( |
|
color: shopTypeIndex == 0 |
|
? Color(0xFF30415B) |
|
: Colors.white, |
|
width: shopTypeIndex == 0 ? 1.w : 0, |
|
), |
|
), |
|
padding: EdgeInsets.only( |
|
top: 16.h, |
|
bottom: 16.h, |
|
left: 16.w, |
|
right: 17.w), |
|
child: Text( |
|
"吃", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: shopTypeIndex == 0 |
|
? Color(0xFF30415B) |
|
: Color(0xFF0D0D0D)), |
|
), |
|
), |
|
if (shopTypeIndex == 0) |
|
Image.asset( |
|
"assets/image/bs_shop.webp", |
|
width: 20, |
|
height: 20, |
|
fit: BoxFit.fill, |
|
), |
|
], |
|
), |
|
)), |
|
GestureDetector( |
|
onTap: () { |
|
state(() { |
|
shopTypeIndex = 1; |
|
serviceType = "喝"; |
|
}); |
|
}, |
|
child: Container( |
|
height: 52.h, |
|
margin: EdgeInsets.only(bottom: 12), |
|
child: Stack( |
|
alignment: Alignment.bottomRight, |
|
children: [ |
|
Container( |
|
height: 52.h, |
|
width: double.infinity, |
|
decoration: BoxDecoration( |
|
color: shopTypeIndex == 1 |
|
? Color(0xFFEFF5FF) |
|
: Color(0xFFF7F7F7), |
|
borderRadius: BorderRadius.circular(4.w), |
|
border: Border.all( |
|
color: shopTypeIndex == 1 |
|
? Color(0xFF30415B) |
|
: Colors.white, |
|
width: shopTypeIndex == 1 ? 1.w : 0, |
|
), |
|
), |
|
padding: EdgeInsets.only( |
|
top: 16.h, |
|
bottom: 16.h, |
|
left: 16.w, |
|
right: 17.w), |
|
child: Text( |
|
"喝", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: shopTypeIndex == 1 |
|
? Color(0xFF30415B) |
|
: Color(0xFF0D0D0D)), |
|
), |
|
), |
|
if (shopTypeIndex == 1) |
|
Image.asset( |
|
"assets/image/bs_shop.webp", |
|
width: 20, |
|
height: 20, |
|
fit: BoxFit.fill, |
|
), |
|
], |
|
), |
|
)), |
|
GestureDetector( |
|
onTap: () { |
|
state(() { |
|
shopTypeIndex = 2; |
|
serviceType = "玩"; |
|
}); |
|
}, |
|
child: Container( |
|
height: 52.h, |
|
margin: EdgeInsets.only(bottom: 12), |
|
child: Stack( |
|
alignment: Alignment.bottomRight, |
|
children: [ |
|
Container( |
|
height: 52.h, |
|
width: double.infinity, |
|
decoration: BoxDecoration( |
|
color: shopTypeIndex == 2 |
|
? Color(0xFFEFF5FF) |
|
: Color(0xFFF7F7F7), |
|
borderRadius: BorderRadius.circular(4.w), |
|
border: Border.all( |
|
color: shopTypeIndex == 2 |
|
? Color(0xFF30415B) |
|
: Colors.white, |
|
width: shopTypeIndex == 2 ? 1.w : 0, |
|
), |
|
), |
|
padding: EdgeInsets.only( |
|
top: 16.h, |
|
bottom: 16.h, |
|
left: 16.w, |
|
right: 17.w), |
|
child: Text( |
|
"玩", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: shopTypeIndex == 2 |
|
? Color(0xFF30415B) |
|
: Color(0xFF0D0D0D)), |
|
), |
|
), |
|
if (shopTypeIndex == 2) |
|
Image.asset( |
|
"assets/image/bs_shop.webp", |
|
width: 20, |
|
height: 20, |
|
fit: BoxFit.fill, |
|
), |
|
], |
|
), |
|
)), |
|
GestureDetector( |
|
onTap: () { |
|
setState(() { |
|
Navigator.of(context).pop(serviceType); |
|
}); |
|
}, |
|
child: Container( |
|
width: double.infinity, |
|
alignment: Alignment.center, |
|
margin: EdgeInsets.only(top: 25.h), |
|
padding: EdgeInsets.symmetric(vertical: 16.h), |
|
decoration: BoxDecoration( |
|
borderRadius: BorderRadius.circular(27), |
|
color: Color(0xFF30415B)), |
|
child: Text( |
|
S.of(context).queding, |
|
style: TextStyle( |
|
fontWeight: MyFontWeight.semi_bold, |
|
fontSize: 16.sp, |
|
color: Colors.white, |
|
), |
|
), |
|
), |
|
) |
|
], |
|
), |
|
) |
|
], |
|
), |
|
); |
|
}); |
|
}); |
|
} |
|
}
|
|
|