|
...
|
...
|
@@ -46,8 +46,12 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; |
|
|
|
import 'package:one_key/models/table_list.dart' as table;
|
|
|
|
|
|
|
|
import '../../app.dart';
|
|
|
|
import '../../models/remark.dart';
|
|
|
|
import '../../provider/remark_manager_model.dart';
|
|
|
|
import '../../utils/screen_util.dart';
|
|
|
|
import '../../widgets/loading.dart';
|
|
|
|
import '../../widgets/special_text/my_extended_text_selection_controls.dart';
|
|
|
|
import '../detail/notebook_detail_change_page_f.dart';
|
|
|
|
|
|
|
|
const scrollDuration = Duration(microseconds: 500);
|
|
|
|
|
|
...
|
...
|
@@ -113,6 +117,13 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
|
|
|
|
TextEditingController pnumController = TextEditingController();
|
|
|
|
|
|
|
|
TextEditingController customController = TextEditingController();
|
|
|
|
FocusNode _cusdemNode = FocusNode();
|
|
|
|
|
|
|
|
String currentRemark = '';
|
|
|
|
RemarkManagerModel remarkManagerModel;
|
|
|
|
String oldRemarkBtn = '';
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
...
|
...
|
@@ -149,6 +160,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
tableManagerModel.initTime(context);
|
|
|
|
_couponNetworkData(selfDismiss: true);
|
|
|
|
_getSmsInfo(context);
|
|
|
|
_getRemark();
|
|
|
|
|
|
|
|
EventBus().on("refresh_tablemanager", (arg) {
|
|
|
|
//订座-完成预订 刷新管理桌位
|
|
...
|
...
|
@@ -176,6 +188,14 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
EventBus().off("refresh_table_m_coupon");
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取备注信息
|
|
|
|
_getRemark() async {
|
|
|
|
Map<String, String> params = {
|
|
|
|
"uid": Provider.of<UserModel>(context, listen: false).user.openid
|
|
|
|
};
|
|
|
|
await remarkManagerModel.getRemarks(context, params);
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取短信余量
|
|
|
|
_getSmsInfo(context) async {
|
|
|
|
smsInfoData = await myModel.getSmsInfo(context, selfDismiss: true);
|
|
...
|
...
|
@@ -1328,6 +1348,164 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
|
|
|
_listWidget(List<Remark> remarks, CustomCallBack callback) {
|
|
|
|
List<Widget> lists = remarks.map((item) {
|
|
|
|
return remarkButton(
|
|
|
|
content: item.custom,
|
|
|
|
isSelect: item.selected,
|
|
|
|
onPress: () {
|
|
|
|
setState(() {
|
|
|
|
item.selected = !item.selected;
|
|
|
|
});
|
|
|
|
callback(item);
|
|
|
|
});
|
|
|
|
}).toList();
|
|
|
|
return lists;
|
|
|
|
}
|
|
|
|
|
|
|
|
_refreshRemark(List<Remark> remark, int index) {
|
|
|
|
if (remark[index].selected) {
|
|
|
|
if (currentRemark.length == 0) {
|
|
|
|
currentRemark += '${remark[index].custom}';
|
|
|
|
} else {
|
|
|
|
if (!currentRemark.contains(remark[index].custom)) {
|
|
|
|
if (currentRemark.endsWith('、')) {
|
|
|
|
currentRemark += '${remark[index].custom}';
|
|
|
|
} else {
|
|
|
|
currentRemark += '、${remark[index].custom}';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (currentRemark.contains(remark[index].custom)) {
|
|
|
|
int start = currentRemark.indexOf(remark[index].custom);
|
|
|
|
int end = start + remark[index].custom.length;
|
|
|
|
currentRemark = currentRemark.replaceRange(start, end, '');
|
|
|
|
if (currentRemark.endsWith('、')) {
|
|
|
|
currentRemark = currentRemark.substring(0, currentRemark.length - 1);
|
|
|
|
}
|
|
|
|
if (currentRemark.startsWith('、')) {
|
|
|
|
currentRemark = currentRemark.substring(1, currentRemark.length);
|
|
|
|
}
|
|
|
|
if (currentRemark.contains('、、')) {
|
|
|
|
currentRemark = currentRemark.replaceRange(
|
|
|
|
currentRemark.indexOf('、、'),
|
|
|
|
currentRemark.indexOf('、、') + 2,
|
|
|
|
'、');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (currentRemark.length > 100) {
|
|
|
|
currentRemark = currentRemark.substring(0, 100);
|
|
|
|
}
|
|
|
|
setState(() {
|
|
|
|
customController.text = currentRemark;
|
|
|
|
});
|
|
|
|
|
|
|
|
// setState(() {
|
|
|
|
// // _notebookDetailChangeModel.customController.text = currentRemark;
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _remarkWidget() {
|
|
|
|
return Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
//输入框
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: ScreenUtil().setWidth(34 * 2),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(16),
|
|
|
|
),
|
|
|
|
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(12))),
|
|
|
|
child: TextField(
|
|
|
|
controller: customController,
|
|
|
|
focusNode: _cusdemNode,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
textBaseline: TextBaseline.alphabetic),
|
|
|
|
textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 1,
|
|
|
|
// maxLength: 100,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "备注",
|
|
|
|
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 ?? "";
|
|
|
|
});
|
|
|
|
// if (value.length < currRemark.length &&
|
|
|
|
// currRemark.substring(value.length) != ',') {
|
|
|
|
// setState(() {
|
|
|
|
// currRemark = value ?? "";
|
|
|
|
// });
|
|
|
|
// if (sum == 0) {
|
|
|
|
// for (int i = 0; i < remarks.length; i++) {
|
|
|
|
// if (remarks[i].isSelect &&
|
|
|
|
// remarks[i].remark == selectItem.last) {
|
|
|
|
// setState(() {
|
|
|
|
// remarks[i].isSelect = false;
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// sum++;
|
|
|
|
// if (sum == selectItem.last.length ||
|
|
|
|
// selectItem.length == 1 ||
|
|
|
|
// selectItem.length == 0) {
|
|
|
|
// selectItem.removeLast();
|
|
|
|
// sum = 0;
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// setState(() {
|
|
|
|
// currRemark = value ?? "";
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
VEmptyView(34),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(40)),
|
|
|
|
child: Wrap(
|
|
|
|
alignment: WrapAlignment.start,
|
|
|
|
crossAxisAlignment: WrapCrossAlignment.start,
|
|
|
|
children: _listWidget(remarkManagerModel.ofenRemarks, (item) {
|
|
|
|
Remark object = item;
|
|
|
|
oldRemarkBtn = object.custom;
|
|
|
|
int index = remarkManagerModel.ofenRemarks.indexOf(item);
|
|
|
|
_refreshRemark(remarkManagerModel.ofenRemarks, index);
|
|
|
|
// _showConfirmWidget(needRemark: true);
|
|
|
|
}),
|
|
|
|
spacing: ScreenUtil().setWidth(20),
|
|
|
|
runSpacing: ScreenUtil().setWidth(20),
|
|
|
|
// alignment: WrapAlignment.start,
|
|
|
|
// runAlignment: WrapAlignment.end,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
///优惠券选择
|
|
|
|
Widget _couponWidget() {
|
|
|
|
return Padding(
|
|
...
|
...
|
@@ -1825,6 +2003,16 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
couponSelectIndex = 0;
|
|
|
|
tableManagerModel.selectTables = [];
|
|
|
|
wechatNotification = true;
|
|
|
|
showPhoneHistory = false; //显示客户历史记录
|
|
|
|
|
|
|
|
currentRemark = '';
|
|
|
|
|
|
|
|
oldRemarkBtn = '';
|
|
|
|
customController.text = '';
|
|
|
|
|
|
|
|
remarkManagerModel.ofenRemarks.forEach((element) {
|
|
|
|
element.selected = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
if (showErro != '短信余额不足,请充值短信条数') {
|
|
|
|
showErro = '';
|
|
...
|
...
|
@@ -1993,10 +2181,11 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
Column(children: [
|
|
|
|
_customerInfoWidget(),
|
|
|
|
VEmptyView(44),
|
|
|
|
_couponWidget(),
|
|
|
|
_remarkWidget()
|
|
|
|
// _couponWidget(),
|
|
|
|
]),
|
|
|
|
|
|
|
|
VEmptyView(50),
|
|
|
|
VEmptyView(20),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(36)),
|
|
...
|
...
|
@@ -2116,10 +2305,15 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
if (pnumController.text != '') {
|
|
|
|
pnum = pnumController.text;
|
|
|
|
}
|
|
|
|
String cusdem;
|
|
|
|
if (customController.text.trim().length > 0) {
|
|
|
|
cusdem = customController.text;
|
|
|
|
}
|
|
|
|
SunReserveInfoModel _model =
|
|
|
|
await tableManagerModel.setReserveInfo(context,
|
|
|
|
needKeep: true,
|
|
|
|
pnum: pnum,
|
|
|
|
cusdem: cusdem,
|
|
|
|
tempTime: ddateHm == '选填' ? null : ddateHm,
|
|
|
|
guest: widget.guest == null
|
|
|
|
? guest
|
|
...
|
...
|
@@ -2749,6 +2943,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
_baseIndoProvider = Provider.of<BaseIndoProvider>(context, listen: true);
|
|
|
|
couponProvider = Provider.of<CouponProvider>(context, listen: true);
|
|
|
|
myModel = Provider.of<MyModel>(context, listen: true);
|
|
|
|
remarkManagerModel = Provider.of<RemarkManagerModel>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
resizeToAvoidBottomInset: false,
|
|
|
|
appBar: widget.guest == null
|
...
|
...
|
|