|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/MyDivider.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../../../models/get_seller_info_model.dart';
|
|
|
|
import '../../../../provider/marketing_center_provider.dart';
|
|
|
|
import '../../../../provider/store_base_info_provider.dart';
|
|
|
|
import '../../../../provider/user_model.dart';
|
|
|
|
import '../../../../res/colors.dart';
|
|
|
|
import '../../../../utils/screen_util.dart';
|
|
|
|
import '../../../../widgets/round_button.dart';
|
|
|
|
import '../../personnel_type/base_info_personnal_page.dart';
|
|
|
|
|
|
|
|
/***
|
|
|
|
*
|
|
|
|
* 预订信息模块
|
|
|
|
*/
|
|
|
|
|
|
|
|
class BookInfoPage extends StatefulWidget {
|
|
|
|
BookInfoPage({Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_BookInfoPageState createState() => _BookInfoPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _BookInfoPageState extends State<BookInfoPage> {
|
|
|
|
TextEditingController parkingIncoC = TextEditingController();
|
|
|
|
FocusNode parkingIncoNode = FocusNode();
|
|
|
|
|
|
|
|
String date; //日期
|
|
|
|
String dsolt; //餐段
|
|
|
|
String pnum; //人数
|
|
|
|
String address; //地址
|
|
|
|
String sellername; //店铺名称
|
|
|
|
String sellerphone; //商家联系电话
|
|
|
|
String userphone; //联系电话
|
|
|
|
String username; //昵称
|
|
|
|
MarketingCenterProvider marketingCenterProvider;
|
|
|
|
String tableInfo; //包间信息
|
|
|
|
|
|
|
|
StoreBaseIndoProvider _baseIndoProvider;
|
|
|
|
bool addManager = false;
|
|
|
|
bool addParking = false;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
_initData(context);
|
|
|
|
|
|
|
|
await marketingCenterProvider.getTableList(context);
|
|
|
|
await _getStoreBaseinfo();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _item(String title, {bool select, GestureTapCallback onTap}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
color: MyColours.color_E7E7E7, width: w(0.5)))),
|
|
|
|
margin: EdgeInsets.only(left: w(16)),
|
|
|
|
padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(16)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setWidth(32)),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Container(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: w(7), vertical: w(4)),
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(select ? 'swich_on' : 'swich_off'),
|
|
|
|
width: w(44),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
|
|
|
//初始化时间
|
|
|
|
_initData(BuildContext context) async {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
sellername = userModel.user.sellername;
|
|
|
|
address = userModel.user.sellerAddr;
|
|
|
|
userphone = userModel.user.userphone;
|
|
|
|
sellerphone = userModel.user.sellerphone;
|
|
|
|
username = userModel.user.nickName ?? userModel.user.account;
|
|
|
|
|
|
|
|
DateTime dateTime = DateTime.now();
|
|
|
|
|
|
|
|
date = Utils.returnYMDandLunarCalendar(DateTime.now(), context);
|
|
|
|
|
|
|
|
String morning =
|
|
|
|
userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
|
|
|
|
String noon =
|
|
|
|
userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
|
|
|
|
String night =
|
|
|
|
userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
|
|
|
|
|
|
|
|
if (dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
morning.split("-")[1] +
|
|
|
|
":00"))) {
|
|
|
|
//未过早市
|
|
|
|
dsolt = '午餐';
|
|
|
|
} else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
morning.split("-")[1] +
|
|
|
|
":00")) &&
|
|
|
|
dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
noon.split("-")[1] +
|
|
|
|
":00"))) {
|
|
|
|
//过了早市,未过午市
|
|
|
|
dsolt = '晚餐';
|
|
|
|
} else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
noon.split("-")[1] +
|
|
|
|
":00")) &&
|
|
|
|
dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
night.split("-")[1] +
|
|
|
|
":00"))) {
|
|
|
|
//过了午市,未过晚市
|
|
|
|
dsolt = '早餐';
|
|
|
|
|
|
|
|
//日期增加一天
|
|
|
|
date = Utils.returnYMDandLunarCalendar(
|
|
|
|
dateTime.add(Duration(days: 1)), context);
|
|
|
|
} else {
|
|
|
|
//过了晚市
|
|
|
|
dsolt = '早餐';
|
|
|
|
//日期增加一天
|
|
|
|
date = Utils.returnYMDandLunarCalendar(
|
|
|
|
dateTime.add(Duration(days: 1)), context);
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取店铺信息
|
|
|
|
_getStoreBaseinfo() async {
|
|
|
|
GetSellerInfoSunModel itemModel =
|
|
|
|
await _baseIndoProvider.getSellerById(context);
|
|
|
|
if (itemModel != null) {
|
|
|
|
address = itemModel.data.mapAddress + itemModel.data.realAddress;
|
|
|
|
setState(() {});
|
|
|
|
// _introductionController.text = itemModel.data.sellerdesc;
|
|
|
|
|
|
|
|
// // _uploadImageProvider.notifyListeners();
|
|
|
|
// _countName = _nameController.text.trim().length;
|
|
|
|
// _countAddress = _addressController.text.trim().length;
|
|
|
|
// if (itemModel.data.sellerTel.contains(',')) {
|
|
|
|
// List<String> list = itemModel.data.sellerTel.split(',');
|
|
|
|
// if (list.length == 2) {
|
|
|
|
// _phoneController.text = list[0];
|
|
|
|
// _phoneController2.text = list[1];
|
|
|
|
// onePhone = false;
|
|
|
|
// } else {
|
|
|
|
// _phoneController.text = '';
|
|
|
|
// _phoneController2.text = '';
|
|
|
|
// onePhone = true;
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// _phoneController.text = itemModel.data.sellerTel;
|
|
|
|
// onePhone = true;
|
|
|
|
// }
|
|
|
|
// mapAddress = {
|
|
|
|
// "address": itemModel.data.mapAddress,
|
|
|
|
// 'lat': itemModel.data.lat,
|
|
|
|
// 'lng': itemModel.data.long,
|
|
|
|
// };
|
|
|
|
// setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_itemTitleAndSubTtile(String title, String subtitle) {
|
|
|
|
return Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text('【${title}】',
|
|
|
|
style:
|
|
|
|
TextStyle(color: MyColours.color_000000, fontSize: font(14))),
|
|
|
|
HEmptyView(10),
|
|
|
|
Expanded(
|
|
|
|
child: Text('${subtitle}',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_000000, fontSize: font(14)))),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
marketingCenterProvider =
|
|
|
|
Provider.of<MarketingCenterProvider>(context, listen: true);
|
|
|
|
_baseIndoProvider =
|
|
|
|
Provider.of<StoreBaseIndoProvider>(context, listen: false);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'预订信息展示',
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
body: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(children: [
|
|
|
|
_item('附加餐厅经理名片', select: addManager, onTap: () {
|
|
|
|
setState(() {
|
|
|
|
addManager = !addManager;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('附加停车信息', select: addParking, onTap: () {
|
|
|
|
setState(() {
|
|
|
|
addParking = !addParking;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
VEmptyView(24),
|
|
|
|
//输入框
|
|
|
|
addParking
|
|
|
|
? Container(
|
|
|
|
width: double.infinity,
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40)),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
vertical: ScreenUtil().setWidth(20)),
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_DBDBDB,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(20))),
|
|
|
|
child: TextField(
|
|
|
|
controller: parkingIncoC,
|
|
|
|
focusNode: parkingIncoNode,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
textBaseline: TextBaseline.alphabetic),
|
|
|
|
textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 5,
|
|
|
|
maxLength: 38,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "点击录入停车信息,最多38个汉字。",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
),
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
border:
|
|
|
|
OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
),
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
// currentRemark = value ?? "";
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
addParking ? VEmptyView(24) : SizedBox(),
|
|
|
|
addParking
|
|
|
|
? Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(20)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_DBDBDB,
|
|
|
|
))
|
|
|
|
: SizedBox(),
|
|
|
|
VEmptyView(24),
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(16), top: w(12), bottom: w(12), right: w(16)),
|
|
|
|
child: Text(
|
|
|
|
'效果预览',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setWidth(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: w(10)),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(8)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
left: BorderSide(
|
|
|
|
width: w(2), color: MyColours.color_EEAE74))),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'尊敬的贵宾,您好!',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_000000, fontSize: font(14)),
|
|
|
|
),
|
|
|
|
VEmptyView(10),
|
|
|
|
Text('非常感谢您选择【${sellername}】!',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_000000, fontSize: font(14))),
|
|
|
|
VEmptyView(30),
|
|
|
|
_itemTitleAndSubTtile('日期', '${date}'),
|
|
|
|
VEmptyView(10),
|
|
|
|
_itemTitleAndSubTtile('餐段', '${dsolt}'),
|
|
|
|
VEmptyView(10),
|
|
|
|
marketingCenterProvider.tableOuterList.length > 0 &&
|
|
|
|
marketingCenterProvider
|
|
|
|
.tableOuterList[0].list.length >
|
|
|
|
0
|
|
|
|
? _itemTitleAndSubTtile('包间',
|
|
|
|
'${marketingCenterProvider.tableOuterList[0].name}${marketingCenterProvider.tableOuterList[0].list[0].name}}')
|
|
|
|
: SizedBox(),
|
|
|
|
VEmptyView(10),
|
|
|
|
marketingCenterProvider.tableOuterList.length > 0 &&
|
|
|
|
marketingCenterProvider
|
|
|
|
.tableOuterList[0].list.length >
|
|
|
|
0
|
|
|
|
? _itemTitleAndSubTtile('人数',
|
|
|
|
'${marketingCenterProvider.tableOuterList[0].list[0].tableNum}')
|
|
|
|
: SizedBox(),
|
|
|
|
VEmptyView(10),
|
|
|
|
_itemTitleAndSubTtile('地址', '${address}'),
|
|
|
|
VEmptyView(10),
|
|
|
|
addParking
|
|
|
|
? _itemTitleAndSubTtile('停车', '${parkingIncoC.text}')
|
|
|
|
: SizedBox(),
|
|
|
|
addParking ? VEmptyView(10) : SizedBox(),
|
|
|
|
_itemTitleAndSubTtile('联系', '${sellerphone}'),
|
|
|
|
VEmptyView(20),
|
|
|
|
addManager
|
|
|
|
? Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(72),
|
|
|
|
ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(r(35)),
|
|
|
|
child: Image.network(
|
|
|
|
'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg',
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: w(70),
|
|
|
|
height: w(70),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'专属服务:${username}',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: font(12)),
|
|
|
|
),
|
|
|
|
VEmptyView(16),
|
|
|
|
Text(
|
|
|
|
'专属服务:${userphone}',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: font(12)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
HEmptyView(6),
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
RoundButton(
|
|
|
|
width: w(72),
|
|
|
|
height: w(22),
|
|
|
|
text: '拨打电话',
|
|
|
|
gradientStart: MyColours.color_ffffff,
|
|
|
|
gradientEnd: MyColours.color_ffffff,
|
|
|
|
borderColor: MyColours.color_0143A3,
|
|
|
|
textColor: MyColours.color_0143A3,
|
|
|
|
radius: r(11),
|
|
|
|
fontSize: 24,
|
|
|
|
isBold: true,
|
|
|
|
onPressed: () {},
|
|
|
|
),
|
|
|
|
VEmptyView(16),
|
|
|
|
RoundButton(
|
|
|
|
width: w(72),
|
|
|
|
height: w(22),
|
|
|
|
text: '复制微信号',
|
|
|
|
gradientStart: MyColours.color_ffffff,
|
|
|
|
gradientEnd: MyColours.color_ffffff,
|
|
|
|
borderColor: MyColours.color_0143A3,
|
|
|
|
textColor: MyColours.color_0143A3,
|
|
|
|
radius: r(11),
|
|
|
|
fontSize: 24,
|
|
|
|
isBold: true,
|
|
|
|
onPressed: () {},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
addManager ? VEmptyView(10) : SizedBox(),
|
|
|
|
Text('欢迎垂询,恭候光临!',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_000000, fontSize: font(14))),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: w(20)),
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: w(15), vertical: w(12)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_d9d9d9,
|
|
|
|
borderRadius: BorderRadius.circular(r(5))),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('location_blue'),
|
|
|
|
width: w(26),
|
|
|
|
),
|
|
|
|
HEmptyView(28),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text('${sellername}',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_000000,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: font(14))),
|
|
|
|
VEmptyView(10),
|
|
|
|
Text('${address}',
|
|
|
|
style: TextStyle(
|
|
|
|
height: 1.3,
|
|
|
|
color: MyColours.color_000000,
|
|
|
|
fontSize: font(14))),
|
|
|
|
],
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(16)
|
|
|
|
]),
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(45), right: w(45), top: w(12), bottom: w(25)),
|
|
|
|
child: RoundButton(
|
|
|
|
text: '保存',
|
|
|
|
gradientStart: MyColours.color_199095,
|
|
|
|
gradientEnd: MyColours.color_199095,
|
|
|
|
// borderColor: MyColours.color_999999,
|
|
|
|
radius: r(5),
|
|
|
|
fontSize: 34,
|
|
|
|
height: w(40),
|
|
|
|
isBold: true,
|
|
|
|
onPressed: () {},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|