|
|
|
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:io';
|
|
...
|
...
|
@@ -109,7 +108,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
FocusNode _phoneNode = FocusNode();
|
|
|
|
bool showPhoneHistory = false; //显示客户历史记录
|
|
|
|
// EasyContactPicker _contactPicker = EasyContactPicker();
|
|
|
|
final FlutterNativeContactPicker _contactPicker =
|
|
|
|
final FlutterNativeContactPicker _contactPicker =
|
|
|
|
FlutterNativeContactPicker();
|
|
|
|
late BaseIndoProvider _baseIndoProvider;
|
|
|
|
int sexSelectIndex = 0;
|
|
...
|
...
|
@@ -242,7 +241,8 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
sexStr = widget.guest!.sexStr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_baseIndoProvider.phoneController.text = widget.guest!.phone??""; //预订人电话
|
|
|
|
_baseIndoProvider.phoneController.text =
|
|
|
|
widget.guest!.phone ?? ""; //预订人电话
|
|
|
|
nameStr = widget.guest!.rname;
|
|
|
|
// _homeEnterModel.nameController.text = fullName + _nameSuffix();
|
|
|
|
_addNameSuffix(nameStr, sexStr);
|
|
...
|
...
|
@@ -290,14 +290,7 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
":00"))) {
|
|
|
|
//过了早市,未过午市
|
|
|
|
currTimeIndex = 2;
|
|
|
|
} else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
noon!.split("-")[1] +
|
|
|
|
":00")) &&
|
|
|
|
} 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) +
|
|
...
|
...
|
@@ -308,14 +301,7 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
":00"))) {
|
|
|
|
//过了午市,未过晚市
|
|
|
|
currTimeIndex = 3;
|
|
|
|
} else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
night!.split("-")[1] +
|
|
|
|
":00")) &&
|
|
|
|
} else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() + "-" + Utils.addZeroNumber(dateTime.month) + "-" + Utils.addZeroNumber(dateTime.day) + " " + night!.split("-")[1] + ":00")) &&
|
|
|
|
dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
...
|
...
|
@@ -334,14 +320,7 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
" " +
|
|
|
|
meal1!.split("-")[1] +
|
|
|
|
":00")) &&
|
|
|
|
dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
meal2!.split("-")[1] +
|
|
|
|
":00"))) {
|
|
|
|
dateTime.isBefore(DateTime.parse(dateTime.year.toString() + "-" + Utils.addZeroNumber(dateTime.month) + "-" + Utils.addZeroNumber(dateTime.day) + " " + meal2!.split("-")[1] + ":00"))) {
|
|
|
|
//过了午市,未过晚市
|
|
|
|
currTimeIndex = 5;
|
|
|
|
} else {
|
|
...
|
...
|
@@ -490,7 +469,7 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
// _initTimeDdate(currTimeIndex, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
getSpTableList() {
|
|
|
|
getSpTableList() {
|
|
|
|
String? tableList = App.sp!.getString('table_list_or_reserve');
|
|
|
|
if (tableList == null) {
|
|
|
|
tableManagerModel!.pageStateOrReserve = PageState.Loading;
|
|
...
|
...
|
@@ -599,8 +578,8 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
|
|
|
|
//获取登陆人类型 只订不服
|
|
|
|
getUserAccountTypeById({bool showLoading = false}) async {
|
|
|
|
String accountType = await tableManagerModel!.getUserAccountTypeById(context,
|
|
|
|
showLoading: showLoading);
|
|
|
|
String accountType = await tableManagerModel!
|
|
|
|
.getUserAccountTypeById(context, showLoading: showLoading);
|
|
|
|
if (accountType == '3') {
|
|
|
|
_saveUser(Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user!
|
|
...
|
...
|
@@ -652,24 +631,26 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
smsContent = await Provider.of<SmsModel>(context, listen: false)
|
|
|
|
.getSmsContent(context, params);
|
|
|
|
// bool sucess = await Sendsms.onSendSMS(phone, smsContent);
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
try {
|
|
|
|
// if (Platform.isIOS) {
|
|
|
|
try {
|
|
|
|
if (phone != null) {
|
|
|
|
String _result =
|
|
|
|
await sendSMS(message: smsContent!, recipients: [phone!]);
|
|
|
|
await sendSMS(message: smsContent!, recipients: [phone]);
|
|
|
|
print(_result);
|
|
|
|
} catch (error) {
|
|
|
|
print(error.toString());
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
print('确定发送');
|
|
|
|
// String phoneNumber = "18161963378;18729572142";
|
|
|
|
} catch (error) {
|
|
|
|
print(error.toString());
|
|
|
|
}
|
|
|
|
// } else {
|
|
|
|
// print('确定发送');
|
|
|
|
// // String phoneNumber = "18161963378;18729572142";
|
|
|
|
|
|
|
|
// await Sendsms.onGetPermission();
|
|
|
|
// // await Sendsms.onGetPermission();
|
|
|
|
|
|
|
|
// if (await Sendsms.hasPermission()) {
|
|
|
|
bool suceess = await Sendsms.onSendSMS(phone!, smsContent!);
|
|
|
|
print(suceess);
|
|
|
|
}
|
|
|
|
// // if (await Sendsms.hasPermission()) {
|
|
|
|
// bool suceess = await Sendsms.onSendSMS(phone!, smsContent!);
|
|
|
|
// print(suceess);
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取短信余量
|
|
...
|
...
|
@@ -757,8 +738,8 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
|
|
|
|
///刷新图片显示
|
|
|
|
_refreshTablePhoto() async {
|
|
|
|
await tableManagerModel!.getTableListOrReserve(
|
|
|
|
context, currTimeIndex, dateTime, selectNumber);
|
|
|
|
await tableManagerModel!
|
|
|
|
.getTableListOrReserve(context, currTimeIndex, dateTime, selectNumber);
|
|
|
|
tableManagerModel!.notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -844,7 +825,8 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
vertical: ScreenUtil().setWidth(20),
|
|
|
|
horizontal: ScreenUtil().setWidth(10)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: tableManagerModel!.tablesOrReserveDataShow![i].tableList!.length,
|
|
|
|
itemCount:
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow![i].tableList!.length,
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
childAspectRatio: 1,
|
|
...
|
...
|
@@ -885,7 +867,8 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
} else {
|
|
|
|
if (table.selected) {
|
|
|
|
tableManagerModel!.selectTablesOrReserve.add(table);
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow!.forEach((element) {
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow!
|
|
|
|
.forEach((element) {
|
|
|
|
element.tableList!.forEach((element1) {
|
|
|
|
if (element1.id == table.id) {
|
|
|
|
element1.selected = true;
|
|
...
|
...
|
@@ -895,7 +878,8 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
} else {
|
|
|
|
tableManagerModel!.selectTablesOrReserve
|
|
|
|
.removeWhere((t) => t.id == table.id);
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow!.forEach((element) {
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow!
|
|
|
|
.forEach((element) {
|
|
|
|
element.tableList!.forEach((element1) {
|
|
|
|
if (element1.id == table.id) {
|
|
|
|
element1.selected = false;
|
|
...
|
...
|
@@ -1098,11 +1082,11 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(30),
|
|
|
|
Text(title ,
|
|
|
|
Text(title,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16), color: MyColours.color_515151)),
|
|
|
|
Expanded(
|
|
|
|
child: Text(stateStr ,
|
|
|
|
child: Text(stateStr,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16),
|
|
|
|
color: MyColours.color_26000000))),
|
|
...
|
...
|
@@ -1110,7 +1094,7 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(right: w(15)),
|
|
|
|
child: Text(sunString ,
|
|
|
|
child: Text(sunString,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16), color: MyColours.color_515151)))
|
|
|
|
],
|
|
...
|
...
|
@@ -1206,40 +1190,41 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
// }
|
|
|
|
|
|
|
|
_getContactData() async {
|
|
|
|
Contact? contact = await _contactPicker.selectPhoneNumber();
|
|
|
|
if (contact != null) {
|
|
|
|
Contact? contact = await _contactPicker.selectPhoneNumber();
|
|
|
|
if (contact != null) {
|
|
|
|
setState(() {
|
|
|
|
String? fullName =
|
|
|
|
contact.fullName?.replaceAll(new RegExp(r"\s+\b|\b\s"), "")??"";
|
|
|
|
// String? phone =
|
|
|
|
// contact.phoneNumbers![0].replaceAll(new RegExp(r"\s+\b|\b\s"), "");
|
|
|
|
// if (fullName.compareTo(phone) == 0) {
|
|
|
|
// fullName = '';
|
|
|
|
// } else {
|
|
|
|
// fullName = contact.fullName!;
|
|
|
|
// }
|
|
|
|
_baseIndoProvider.phoneController.text =
|
|
|
|
contact.selectedPhoneNumber?.replaceAll(new RegExp(r"\s+"), "")??"";
|
|
|
|
nameStr = fullName;
|
|
|
|
// _homeEnterModel.nameController.text = fullName + _nameSuffix();
|
|
|
|
_addNameSuffix(fullName, _nameSuffix());
|
|
|
|
});
|
|
|
|
// setState(() {
|
|
|
|
// String fullName =
|
|
|
|
// contact?.fullName!.replaceAll(new RegExp(r"\s+\b|\b\s"), "");
|
|
|
|
// String phone =
|
|
|
|
// contact[0].phoneNumbers![0].replaceAll(new RegExp(r"\s+\b|\b\s"), "");
|
|
|
|
// if (fullName.compareTo(phone) == 0) {
|
|
|
|
// fullName = '';
|
|
|
|
// } else {
|
|
|
|
// fullName = contact[0].fullName!;
|
|
|
|
// }
|
|
|
|
// _baseIndoProvider.phoneController.text =
|
|
|
|
// contact[0].phoneNumbers![0].replaceAll(new RegExp(r"\s+"), "");
|
|
|
|
// nameStr = fullName;
|
|
|
|
// // _homeEnterModel.nameController.text = fullName + _nameSuffix();
|
|
|
|
// _addNameSuffix(fullName, _nameSuffix());
|
|
|
|
// });
|
|
|
|
String? fullName =
|
|
|
|
contact.fullName?.replaceAll(new RegExp(r"\s+\b|\b\s"), "") ?? "";
|
|
|
|
// String? phone =
|
|
|
|
// contact.phoneNumbers![0].replaceAll(new RegExp(r"\s+\b|\b\s"), "");
|
|
|
|
// if (fullName.compareTo(phone) == 0) {
|
|
|
|
// fullName = '';
|
|
|
|
// } else {
|
|
|
|
// fullName = contact.fullName!;
|
|
|
|
// }
|
|
|
|
_baseIndoProvider.phoneController.text =
|
|
|
|
contact.selectedPhoneNumber?.replaceAll(new RegExp(r"\s+"), "") ??
|
|
|
|
"";
|
|
|
|
nameStr = fullName;
|
|
|
|
// _homeEnterModel.nameController.text = fullName + _nameSuffix();
|
|
|
|
_addNameSuffix(fullName, _nameSuffix());
|
|
|
|
});
|
|
|
|
// setState(() {
|
|
|
|
// String fullName =
|
|
|
|
// contact?.fullName!.replaceAll(new RegExp(r"\s+\b|\b\s"), "");
|
|
|
|
// String phone =
|
|
|
|
// contact[0].phoneNumbers![0].replaceAll(new RegExp(r"\s+\b|\b\s"), "");
|
|
|
|
// if (fullName.compareTo(phone) == 0) {
|
|
|
|
// fullName = '';
|
|
|
|
// } else {
|
|
|
|
// fullName = contact[0].fullName!;
|
|
|
|
// }
|
|
|
|
// _baseIndoProvider.phoneController.text =
|
|
|
|
// contact[0].phoneNumbers![0].replaceAll(new RegExp(r"\s+"), "");
|
|
|
|
// nameStr = fullName;
|
|
|
|
// // _homeEnterModel.nameController.text = fullName + _nameSuffix();
|
|
|
|
// _addNameSuffix(fullName, _nameSuffix());
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -2099,7 +2084,7 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
"uid": userModel.user!.openid
|
|
|
|
};
|
|
|
|
|
|
|
|
bool success = await couponProvider.addForwardAsReserve(context, params) ;
|
|
|
|
bool success = await couponProvider.addForwardAsReserve(context, params);
|
|
|
|
if (success) {
|
|
|
|
print('yes');
|
|
|
|
}
|
|
...
|
...
|
@@ -2245,7 +2230,7 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {
|
|
|
|
currentRemark = value ;
|
|
|
|
currentRemark = value;
|
|
|
|
});
|
|
|
|
// if (value.length < currRemark.length &&
|
|
|
|
// currRemark.substring(value.length) != ',') {
|
|
...
|
...
|
@@ -3599,7 +3584,6 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
}
|
|
|
|
guest.rname = nameStr; //预订人姓名
|
|
|
|
guest.sex = sex; //预订人性别:1:男 2:女
|
|
|
|
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
String? pnum;
|
|
...
|
...
|
@@ -3640,7 +3624,7 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
"rid": _model.row!.id,
|
|
|
|
"aid": '${couponProvider.couponListSelect![couponSelectIndex].id}'
|
|
|
|
};
|
|
|
|
bool isSuc = await couponProvider.setActivityAsReserve(context, params) ;
|
|
|
|
bool isSuc = await couponProvider.setActivityAsReserve(context, params);
|
|
|
|
if (isSuc) {
|
|
|
|
couponProvider.hasModify = true;
|
|
|
|
//发短信操作
|
|
...
|
...
|
@@ -3936,9 +3920,10 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
right: BorderSide(
|
|
|
|
color: index == storeBaseIndoProvider.dayDateData!.length - 1
|
|
|
|
? Colors.transparent
|
|
|
|
: MyColours.color_438E93,
|
|
|
|
color:
|
|
|
|
index == storeBaseIndoProvider.dayDateData!.length - 1
|
|
|
|
? Colors.transparent
|
|
|
|
: MyColours.color_438E93,
|
|
|
|
width: w(1),
|
|
|
|
))),
|
|
|
|
child: Text(
|
|
...
|
...
|
@@ -4010,7 +3995,8 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
.then((day) async {
|
|
|
|
if (day != null) {
|
|
|
|
isRealAddOver = _getAddOrder(day, currTimeIndex);
|
|
|
|
if (tableManagerModel!.selectTablesOrReserve.length >
|
|
|
|
if (tableManagerModel!
|
|
|
|
.selectTablesOrReserve.length >
|
|
|
|
0) {
|
|
|
|
if (!isRealAddOver) {
|
|
|
|
Utils.showToast('不允许新建过去餐段的订单!');
|
|
...
|
...
|
@@ -4345,7 +4331,6 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
});
|
|
|
|
setState(() {});
|
|
|
|
} else {
|
|
|
|
|
|
|
|
await tableManagerModel!
|
|
|
|
.getTableListOrReserve(
|
|
|
|
context,
|
|
...
|
...
|
@@ -4430,7 +4415,8 @@ final FlutterNativeContactPicker _contactPicker = |
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (tableManagerModel!.tablesOrReserveDataShow !=
|
|
|
|
if (tableManagerModel!
|
|
|
|
.tablesOrReserveDataShow !=
|
|
|
|
null &&
|
|
|
|
tableManagerModel!
|
|
|
|
.tablesOrReserveDataShow!.length >
|
...
|
...
|
|