Showing
4 changed files
with
1448 additions
and
1144 deletions
| @@ -29,25 +29,31 @@ class NoteBookItemF extends StatefulWidget { | @@ -29,25 +29,31 @@ class NoteBookItemF extends StatefulWidget { | ||
| 29 | final num index; | 29 | final num index; |
| 30 | final NoteBookOnlySunModel notebook; | 30 | final NoteBookOnlySunModel notebook; |
| 31 | final bool sellerPreserve; | 31 | final bool sellerPreserve; |
| 32 | - final GestureTapCallback onTap; | ||
| 33 | 32 | ||
| 34 | - final String? cancelDay; | ||
| 35 | - final bool cancelShopowner; | ||
| 36 | - final bool cancelManager; | 33 | + // final String? cancelDay; |
| 34 | + // final bool cancelShopowner; | ||
| 35 | + // final bool cancelManager; | ||
| 37 | 36 | ||
| 38 | - final bool cancelOther; | ||
| 39 | - final bool isReserveCancel; | 37 | + // final bool cancelOther; |
| 38 | + // final bool isReserveCancel; | ||
| 39 | + final GestureTapCallback? onTapChange; | ||
| 40 | + final GestureTapCallback? onTapReach; | ||
| 41 | + final GestureTapCallback? onTapLeave; | ||
| 42 | + final GestureTapCallback? onTapCancel; | ||
| 40 | 43 | ||
| 41 | NoteBookItemF( | 44 | NoteBookItemF( |
| 42 | this.index, | 45 | this.index, |
| 43 | this.notebook, | 46 | this.notebook, |
| 44 | this.sellerPreserve, | 47 | this.sellerPreserve, |
| 45 | - this.onTap, | ||
| 46 | - this.cancelDay, | ||
| 47 | - this.cancelShopowner, | ||
| 48 | - this.cancelManager, | ||
| 49 | - this.cancelOther, | ||
| 50 | - this.isReserveCancel); | 48 | + // this.cancelDay, |
| 49 | + // this.cancelShopowner, | ||
| 50 | + // this.cancelManager, | ||
| 51 | + // this.cancelOther, | ||
| 52 | + // this.isReserveCancel, | ||
| 53 | + {this.onTapChange, | ||
| 54 | + this.onTapReach, | ||
| 55 | + this.onTapLeave, | ||
| 56 | + this.onTapCancel}); | ||
| 51 | 57 | ||
| 52 | @override | 58 | @override |
| 53 | State<StatefulWidget> createState() { | 59 | State<StatefulWidget> createState() { |
| @@ -60,71 +66,59 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -60,71 +66,59 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 60 | // with SingleTickerProviderStateMixin | 66 | // with SingleTickerProviderStateMixin |
| 61 | { | 67 | { |
| 62 | // bool _large = false; | 68 | // bool _large = false; |
| 63 | - List cancelReasonList = []; | 69 | + |
| 64 | bool isShowTF = false; | 70 | bool isShowTF = false; |
| 65 | // int paddingBottom; | 71 | // int paddingBottom; |
| 66 | int paddingTop = 138; | 72 | int paddingTop = 138; |
| 67 | - FocusNode _cancelNode = FocusNode(); | ||
| 68 | - TextEditingController _cancelController = TextEditingController(); | ||
| 69 | - StateSetter? _cancelState; | ||
| 70 | - | ||
| 71 | - ScrollController? _scrollController; | 73 | + |
| 74 | + // StateSetter? _cancelState; | ||
| 75 | + | ||
| 76 | + // ScrollController? _scrollController; | ||
| 77 | + | ||
| 78 | + // _onOperateClick() { | ||
| 79 | + // if (widget.notebook.operationText == "通知客户") { | ||
| 80 | + // // String _nameStr = ''; | ||
| 81 | + // // String _tid = ''; | ||
| 82 | + // // for (int i = 0; | ||
| 83 | + // // i < | ||
| 84 | + // // detailEntity | ||
| 85 | + // // .tables.length; | ||
| 86 | + // // i++) { | ||
| 87 | + // // _nameStr += | ||
| 88 | + // // '${detailEntity.tables[i].name},'; | ||
| 89 | + | ||
| 90 | + // // _tid += | ||
| 91 | + // // '${detailEntity.tables[i].id},'; | ||
| 92 | + // // } | ||
| 93 | + // // if (_tid.endsWith(',')) { | ||
| 94 | + // // _tid = _tid.substring( | ||
| 95 | + // // 0, _tid.length - 1); | ||
| 96 | + // // } | ||
| 97 | + // // if (_nameStr | ||
| 98 | + // // .endsWith(',')) { | ||
| 99 | + // // _nameStr = | ||
| 100 | + // // _nameStr.substring( | ||
| 101 | + // // 0, | ||
| 102 | + // // _nameStr.length - | ||
| 103 | + // // 1); | ||
| 104 | + // // } | ||
| 105 | + // NavigatorUtil.goInvicationPage( | ||
| 106 | + // context, | ||
| 107 | + // widget.notebook.id, | ||
| 108 | + // // widget.notebook.tableinfoStr, | ||
| 109 | + // // widget.notebook.ddate, | ||
| 110 | + // // widget.notebook.ddateStr, | ||
| 111 | + // // widget.notebook.phone, | ||
| 112 | + // // widget.notebook.ddate_solt, | ||
| 113 | + // // widget.notebook.rname == null ? '' : widget.notebook.rname, | ||
| 114 | + // // widget.notebook.sex == null ? '' : widget.notebook.sex, | ||
| 115 | + // // widget.notebook.cusdem, | ||
| 116 | + // // tid: widget.notebook.tid | ||
| 117 | + // ); | ||
| 118 | + // } | ||
| 119 | + // } | ||
| 72 | 120 | ||
| 73 | - _onOperateClick() { | ||
| 74 | - if (widget.notebook.operationText == "通知客户") { | ||
| 75 | - // String _nameStr = ''; | ||
| 76 | - // String _tid = ''; | ||
| 77 | - // for (int i = 0; | ||
| 78 | - // i < | ||
| 79 | - // detailEntity | ||
| 80 | - // .tables.length; | ||
| 81 | - // i++) { | ||
| 82 | - // _nameStr += | ||
| 83 | - // '${detailEntity.tables[i].name},'; | ||
| 84 | - | ||
| 85 | - // _tid += | ||
| 86 | - // '${detailEntity.tables[i].id},'; | ||
| 87 | - // } | ||
| 88 | - // if (_tid.endsWith(',')) { | ||
| 89 | - // _tid = _tid.substring( | ||
| 90 | - // 0, _tid.length - 1); | ||
| 91 | - // } | ||
| 92 | - // if (_nameStr | ||
| 93 | - // .endsWith(',')) { | ||
| 94 | - // _nameStr = | ||
| 95 | - // _nameStr.substring( | ||
| 96 | - // 0, | ||
| 97 | - // _nameStr.length - | ||
| 98 | - // 1); | ||
| 99 | - // } | ||
| 100 | - NavigatorUtil.goInvicationPage( | ||
| 101 | - context, | ||
| 102 | - widget.notebook.id, | ||
| 103 | - // widget.notebook.tableinfoStr, | ||
| 104 | - // widget.notebook.ddate, | ||
| 105 | - // widget.notebook.ddateStr, | ||
| 106 | - // widget.notebook.phone, | ||
| 107 | - // widget.notebook.ddate_solt, | ||
| 108 | - // widget.notebook.rname == null ? '' : widget.notebook.rname, | ||
| 109 | - // widget.notebook.sex == null ? '' : widget.notebook.sex, | ||
| 110 | - // widget.notebook.cusdem, | ||
| 111 | - // tid: widget.notebook.tid | ||
| 112 | - ); | ||
| 113 | - } | ||
| 114 | - } | ||
| 115 | 121 | ||
| 116 | - /// 初始化取消原因数据 | ||
| 117 | - _initCancel() { | ||
| 118 | - // isShowTF = false; | ||
| 119 | - // paddingBottom = ScreenUtil().screenHeight.ceil() - 138 - 340; | ||
| 120 | - cancelReasonList = [ | ||
| 121 | - {'title': '顾客取消', 'select': false}, | ||
| 122 | - {'title': '顾客行程有变', 'select': false}, | ||
| 123 | - {'title': '信息填写有误', 'select': false}, | ||
| 124 | - {'title': '操作失误', 'select': false}, | ||
| 125 | - {'title': '其他原因', 'select': false}, | ||
| 126 | - ]; | ||
| 127 | - } | ||
| 128 | 122 | ||
| 129 | _updateSize(bool cando) { | 123 | _updateSize(bool cando) { |
| 130 | if (!cando) { | 124 | if (!cando) { |
| @@ -135,362 +129,6 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -135,362 +129,6 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 135 | }); | 129 | }); |
| 136 | } | 130 | } |
| 137 | 131 | ||
| 138 | - ///处理在线预订 | ||
| 139 | - setReserveStatus(String status, {String? desc, String? phone}) async { | ||
| 140 | - // bus.emit("remove_untreated_message",widget.mid); | ||
| 141 | - UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 142 | - | ||
| 143 | - Map<String, String?> params = { | ||
| 144 | - "rid": widget.notebook.id, | ||
| 145 | - "status": status, //5安排包间 2:确认到店(到店),3:用餐完成(离店),4:取消预定,5:分配包间:6:拒单 | ||
| 146 | - // "uid": userModel.user.openid, | ||
| 147 | - 'uid': widget.notebook.uid | ||
| 148 | - }; | ||
| 149 | - if (status == '4') { | ||
| 150 | - Map<String, String?> causeMap = { | ||
| 151 | - "uid": userModel.user!.openid, | ||
| 152 | - "uname": userModel.user!.nickName, | ||
| 153 | - "desc": desc, | ||
| 154 | - }; | ||
| 155 | - params["cause"] = json.encode(causeMap); | ||
| 156 | - } | ||
| 157 | - params['note_name'] = userModel.user!.account; | ||
| 158 | - NotebookDetailModel detailModel = | ||
| 159 | - Provider.of<NotebookDetailModel>(context, listen: false); | ||
| 160 | - bool success = await detailModel.setReserveStatusOnly(context, params, | ||
| 161 | - ifPush: false, notebook: widget.notebook); | ||
| 162 | - if (success) { | ||
| 163 | - bus.emit("refresh_book_list"); | ||
| 164 | - if (status == "4" && phone != null && phone != '') { | ||
| 165 | - getDzSellerConf(widget.notebook.id); | ||
| 166 | - // //取消预订 | ||
| 167 | - // bus.emit("refresh_tablemanager"); //刷新桌位 | ||
| 168 | - } | ||
| 169 | - // if (status == "4") { | ||
| 170 | - // //取消预订 | ||
| 171 | - // bus.emit("refresh_tablemanager"); //刷新桌位 | ||
| 172 | - // } | ||
| 173 | - // _getReserveDetail(); | ||
| 174 | - } | ||
| 175 | - } | ||
| 176 | - | ||
| 177 | - getDzSellerConf(String? rid) async { | ||
| 178 | - MarketingCenterProvider marketingCenterProvider = | ||
| 179 | - Provider.of<MarketingCenterProvider>(context, listen: false); | ||
| 180 | - bool success = await marketingCenterProvider.getDzSellerConf(context); | ||
| 181 | - if (success && marketingCenterProvider.dzSellerConfModel != null) { | ||
| 182 | - bool selectSms = | ||
| 183 | - marketingCenterProvider.dzSellerConfModel!.isOpenCancel == '1' | ||
| 184 | - ? true | ||
| 185 | - : false; | ||
| 186 | - | ||
| 187 | - if (selectSms) { | ||
| 188 | - Map<String, String?> pramas = { | ||
| 189 | - 'rid': rid, | ||
| 190 | - 'sid': Provider.of<UserModel>(context, listen: false).user!.sellerid, | ||
| 191 | - }; | ||
| 192 | - NotebookDetailModel detailModel = | ||
| 193 | - Provider.of<NotebookDetailModel>(context, listen: false); | ||
| 194 | - detailModel.wxSendCancelSms(context, pramas); | ||
| 195 | - } | ||
| 196 | - } | ||
| 197 | - } | ||
| 198 | - | ||
| 199 | - ///取消预订弹框 | ||
| 200 | - _showCancelWidget(context, phone) { | ||
| 201 | - _scrollController = ScrollController(); | ||
| 202 | - _initCancel(); | ||
| 203 | - showGeneralDialog( | ||
| 204 | - context: context, | ||
| 205 | - barrierDismissible: false, | ||
| 206 | - barrierLabel: | ||
| 207 | - MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 208 | - transitionDuration: const Duration(milliseconds: 150), | ||
| 209 | - barrierColor: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 210 | - pageBuilder: (BuildContext context, Animation animation, | ||
| 211 | - Animation secondaryAnimation) { | ||
| 212 | - return Scaffold( | ||
| 213 | - backgroundColor: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 214 | - body: StatefulBuilder(builder: (context, state) { | ||
| 215 | - _cancelState = state; | ||
| 216 | - return GestureDetector( | ||
| 217 | - behavior: HitTestBehavior.opaque, | ||
| 218 | - // onTap: () { | ||
| 219 | - // Navigator.of(context).pop(); | ||
| 220 | - // }, | ||
| 221 | - child: Center( | ||
| 222 | - child: Container( | ||
| 223 | - margin: EdgeInsets.symmetric( | ||
| 224 | - horizontal: ScreenUtil().setWidth(28 * 2)), | ||
| 225 | - padding: EdgeInsets.symmetric( | ||
| 226 | - horizontal: ScreenUtil().setWidth(32)), | ||
| 227 | - decoration: BoxDecoration( | ||
| 228 | - color: Colors.white, | ||
| 229 | - borderRadius: | ||
| 230 | - BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 231 | - ), | ||
| 232 | - height: ScreenUtil().setWidth(355 * 2), | ||
| 233 | - child: Column( | ||
| 234 | - // mainAxisSize: MainAxisSize.min, | ||
| 235 | - children: [ | ||
| 236 | - // Stack( | ||
| 237 | - // children: [ | ||
| 238 | - VEmptyView(48), | ||
| 239 | - Container( | ||
| 240 | - height: ScreenUtil().setWidth(48), | ||
| 241 | - child: Text( | ||
| 242 | - '是否确定取消预订', | ||
| 243 | - style: TextStyle( | ||
| 244 | - fontSize: ScreenUtil().setSp(32), | ||
| 245 | - fontWeight: FontWeight.bold, | ||
| 246 | - decoration: TextDecoration.none, | ||
| 247 | - color: Color.fromRGBO(0, 0, 0, 0.9)), | ||
| 248 | - ), | ||
| 249 | - ), | ||
| 250 | - // Positioned( | ||
| 251 | - // top: ScreenUtil().setWidth(8), | ||
| 252 | - // right: ScreenUtil().setWidth(0), | ||
| 253 | - // child: GestureDetector( | ||
| 254 | - // onTap: () { | ||
| 255 | - // _initCancel(); | ||
| 256 | - // Navigator.of(context).pop(); | ||
| 257 | - // }, | ||
| 258 | - // child: Container( | ||
| 259 | - // padding: EdgeInsets.only(left: 20), | ||
| 260 | - // child: Image.asset( | ||
| 261 | - // 'assets/close.png', | ||
| 262 | - // width: ScreenUtil().setWidth(32), | ||
| 263 | - // height: ScreenUtil().setWidth(32), | ||
| 264 | - // ), | ||
| 265 | - // ))) | ||
| 266 | - // ], | ||
| 267 | - // ), | ||
| 268 | - VEmptyView(40), | ||
| 269 | - Container( | ||
| 270 | - child: Column( | ||
| 271 | - // mainAxisSize: MainAxisSize.min, | ||
| 272 | - children: cancelReasonList.map((value) { | ||
| 273 | - return value['title'] == '其他原因' | ||
| 274 | - ? SizedBox() | ||
| 275 | - : GestureDetector( | ||
| 276 | - onTap: () { | ||
| 277 | - for (var item in cancelReasonList) { | ||
| 278 | - item['select'] = false; | ||
| 279 | - // isShowTF = false; | ||
| 280 | - // paddingBottom = | ||
| 281 | - // ScreenUtil().screenHeight.ceil() - | ||
| 282 | - // 138 - | ||
| 283 | - // 340; | ||
| 284 | - if (item['title'] == | ||
| 285 | - value['title']) { | ||
| 286 | - item['select'] = true; | ||
| 287 | - // if (item['title'] == '其他原因') { | ||
| 288 | - // // isShowTF = true; | ||
| 289 | - // // paddingBottom = 130; | ||
| 290 | - // // paddingBottom = | ||
| 291 | - // // ScreenUtil().screenHeight.ceil() - | ||
| 292 | - // // 138 - | ||
| 293 | - // // 340 - | ||
| 294 | - // // 46; | ||
| 295 | - // } | ||
| 296 | - } | ||
| 297 | - } | ||
| 298 | - state(() {}); | ||
| 299 | - }, | ||
| 300 | - child: Container( | ||
| 301 | - height: ScreenUtil().setWidth(48), | ||
| 302 | - margin: EdgeInsets.only( | ||
| 303 | - bottom: | ||
| 304 | - ScreenUtil().setWidth(40)), | ||
| 305 | - child: Row( | ||
| 306 | - children: [ | ||
| 307 | - Image.asset( | ||
| 308 | - value['select'] | ||
| 309 | - ? 'assets/select.png' | ||
| 310 | - : 'assets/unselect.png', | ||
| 311 | - width: ScreenUtil() | ||
| 312 | - .setWidth(42)), | ||
| 313 | - HEmptyView(20), | ||
| 314 | - Container( | ||
| 315 | - child: Text(value['title'], | ||
| 316 | - style: TextStyle( | ||
| 317 | - fontSize: ScreenUtil() | ||
| 318 | - .setSp(32), | ||
| 319 | - fontWeight: | ||
| 320 | - FontWeight.normal, | ||
| 321 | - decoration: | ||
| 322 | - TextDecoration | ||
| 323 | - .none, | ||
| 324 | - color: MyColours | ||
| 325 | - .color_333333))) | ||
| 326 | - ], | ||
| 327 | - ), | ||
| 328 | - ), | ||
| 329 | - ); | ||
| 330 | - }).toList(), | ||
| 331 | - )), | ||
| 332 | - Material( | ||
| 333 | - child: Container( | ||
| 334 | - color: Colors.white, | ||
| 335 | - height: ScreenUtil().setWidth(42 * 2), | ||
| 336 | - child: Row(children: [ | ||
| 337 | - InkWell( | ||
| 338 | - onTap: () { | ||
| 339 | - for (var item in cancelReasonList) { | ||
| 340 | - item['select'] = false; | ||
| 341 | - } | ||
| 342 | - cancelReasonList[4]['select'] = | ||
| 343 | - true; | ||
| 344 | - state(() {}); | ||
| 345 | - }, | ||
| 346 | - child: Padding( | ||
| 347 | - padding: EdgeInsets.only( | ||
| 348 | - right: ScreenUtil() | ||
| 349 | - .setWidth(20)), | ||
| 350 | - child: Image.asset( | ||
| 351 | - cancelReasonList[4]['select'] | ||
| 352 | - ? 'assets/select.png' | ||
| 353 | - : 'assets/unselect.png', | ||
| 354 | - width: ScreenUtil() | ||
| 355 | - .setWidth(44)))), | ||
| 356 | - Expanded( | ||
| 357 | - child: Container( | ||
| 358 | - decoration: BoxDecoration( | ||
| 359 | - color: Color.fromRGBO( | ||
| 360 | - 240, 240, 240, 1), | ||
| 361 | - borderRadius: BorderRadius.circular( | ||
| 362 | - ScreenUtil().setWidth(8))), | ||
| 363 | - // height: ScreenUtil().setWidth(42 * 2), | ||
| 364 | - padding: EdgeInsets.symmetric( | ||
| 365 | - horizontal: | ||
| 366 | - ScreenUtil().setWidth(16)), | ||
| 367 | - child: TextField( | ||
| 368 | - maxLines: 1, | ||
| 369 | - controller: _cancelController, | ||
| 370 | - focusNode: _cancelNode, | ||
| 371 | - style: TextStyle( | ||
| 372 | - textBaseline: | ||
| 373 | - TextBaseline.alphabetic), | ||
| 374 | - textAlignVertical: | ||
| 375 | - TextAlignVertical.center, | ||
| 376 | - decoration: InputDecoration( | ||
| 377 | - contentPadding: EdgeInsets.zero, | ||
| 378 | - hintText: "其他", | ||
| 379 | - // focusColor: Color.fromRGBO(0, 0, 0, 0.4), | ||
| 380 | - hintStyle: TextStyle( | ||
| 381 | - color: | ||
| 382 | - Color.fromRGBO(0, 0, 0, 0.4), | ||
| 383 | - fontSize: ScreenUtil().setSp(32), | ||
| 384 | - ), | ||
| 385 | - enabledBorder: OutlineInputBorder( | ||
| 386 | - borderSide: BorderSide( | ||
| 387 | - width: 0, | ||
| 388 | - color: Colors.transparent)), | ||
| 389 | - border: OutlineInputBorder( | ||
| 390 | - borderSide: BorderSide( | ||
| 391 | - width: 0, | ||
| 392 | - color: Colors.transparent)), | ||
| 393 | - focusedBorder: OutlineInputBorder( | ||
| 394 | - borderSide: BorderSide( | ||
| 395 | - width: 0, | ||
| 396 | - color: Colors.transparent)), | ||
| 397 | - ), | ||
| 398 | - | ||
| 399 | - // border: InputBorder.none, | ||
| 400 | - | ||
| 401 | - onChanged: (_) { | ||
| 402 | - setState(() {}); | ||
| 403 | - }, | ||
| 404 | - onEditingComplete: () { | ||
| 405 | - print('fff'); | ||
| 406 | - _cancelNode.unfocus(); | ||
| 407 | - }, | ||
| 408 | - // keyboardType: TextInputType.numberWithOptions(decimal: true), | ||
| 409 | - ), | ||
| 410 | - )) | ||
| 411 | - ]))), | ||
| 412 | - | ||
| 413 | - VEmptyView(15), | ||
| 414 | - Material( | ||
| 415 | - child: RoundButton( | ||
| 416 | - onPressed: () { | ||
| 417 | - String? desc = ''; | ||
| 418 | - for (var value in cancelReasonList) { | ||
| 419 | - if (value['select'] == true) { | ||
| 420 | - desc = value['title']; | ||
| 421 | - if (value['title'] == '其他原因') { | ||
| 422 | - desc = _cancelController.text.trim(); | ||
| 423 | - if (desc.isEmpty) { | ||
| 424 | - Utils.showToast("请填写原因"); | ||
| 425 | - return; | ||
| 426 | - } | ||
| 427 | - } | ||
| 428 | - } | ||
| 429 | - } | ||
| 430 | - | ||
| 431 | - if (desc == '') { | ||
| 432 | - Utils.showToast('请选择原因'); | ||
| 433 | - return; | ||
| 434 | - } | ||
| 435 | - | ||
| 436 | - Navigator.of(context).pop(); | ||
| 437 | - Loading.showLoading(context); | ||
| 438 | - | ||
| 439 | - setReserveStatus('4', | ||
| 440 | - desc: desc, phone: phone); | ||
| 441 | - }, | ||
| 442 | - text: '确认', | ||
| 443 | - height: ScreenUtil().setWidth(80), | ||
| 444 | - width: ScreenUtil().setWidth(300), | ||
| 445 | - radius: ScreenUtil().setWidth(10), | ||
| 446 | - ), | ||
| 447 | - ) | ||
| 448 | - ], | ||
| 449 | - ), | ||
| 450 | - ), | ||
| 451 | - )); | ||
| 452 | - })); | ||
| 453 | - }); | ||
| 454 | - } | ||
| 455 | - | ||
| 456 | - _getIsReserveCancel(bool isReserveCancel) { | ||
| 457 | - //判断时间是否可变更 | ||
| 458 | - | ||
| 459 | - bool reserveCancel = true; //默认允许变更过去餐段订单的时间 | ||
| 460 | - //如果不允许变更过去餐段订单的时间,则开始判断 | ||
| 461 | - //连个条件同时成立: 1.订单的时间是过去 2. 时间改变 | ||
| 462 | - if (!isReserveCancel) { | ||
| 463 | - //找到当前餐段对应的时间段 | ||
| 464 | - String? times = widget.notebook.mdate ?? '00:00-00:00'; | ||
| 465 | - | ||
| 466 | - //组装时间戳 | ||
| 467 | - List<String> datas = times.split('-'); | ||
| 468 | - // DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' + | ||
| 469 | - // '-' + | ||
| 470 | - // '${dateTimeSelect.month}' + | ||
| 471 | - // '-' + | ||
| 472 | - // '${dateTimeSelect.day}' + | ||
| 473 | - // ' ${datas[0]}:00'); //选中餐段开始时间戳 | ||
| 474 | - DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | ||
| 475 | - int.parse(widget.notebook.ddate!) * 1000); | ||
| 476 | - DateTime selectEtime = DateTime.parse('${dateTime.year}' + | ||
| 477 | - '-' + | ||
| 478 | - Utils.addZeroNumber(dateTime.month) + | ||
| 479 | - '-' + | ||
| 480 | - Utils.addZeroNumber(dateTime.day) + | ||
| 481 | - ' ${datas[1]}:00'); //选中餐段结束时间戳 | ||
| 482 | - // 过去的餐段界定 | ||
| 483 | - if (selectEtime.isBefore(DateTime.now())) { | ||
| 484 | -// 属于过去餐段 | ||
| 485 | - reserveCancel = false; | ||
| 486 | - } else { | ||
| 487 | - // 属于未来餐段 | ||
| 488 | - reserveCancel = true; | ||
| 489 | - } | ||
| 490 | - } | ||
| 491 | - return reserveCancel; | ||
| 492 | - } | ||
| 493 | - | ||
| 494 | @override | 132 | @override |
| 495 | Widget build(BuildContext context) { | 133 | Widget build(BuildContext context) { |
| 496 | // TODO: implement build | 134 | // TODO: implement build |
| @@ -588,7 +226,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -588,7 +226,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 588 | child: Row( | 226 | child: Row( |
| 589 | children: [ | 227 | children: [ |
| 590 | InkWell( | 228 | InkWell( |
| 591 | - onTap: widget.onTap, | 229 | + onTap: widget.onTapChange, |
| 592 | child: Column( | 230 | child: Column( |
| 593 | crossAxisAlignment: CrossAxisAlignment.center, | 231 | crossAxisAlignment: CrossAxisAlignment.center, |
| 594 | children: [ | 232 | children: [ |
| @@ -915,11 +553,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -915,11 +553,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 915 | fontSize: 28, | 553 | fontSize: 28, |
| 916 | radius: | 554 | radius: |
| 917 | ScreenUtil().setWidth(8), | 555 | ScreenUtil().setWidth(8), |
| 918 | - onPressed: () { | ||
| 919 | - Loading.showLoading( | ||
| 920 | - context); | ||
| 921 | - setReserveStatus('2'); | ||
| 922 | - }, | 556 | + onPressed: widget.onTapReach, |
| 923 | ), | 557 | ), |
| 924 | notebook.status == '2' | 558 | notebook.status == '2' |
| 925 | ? SizedBox() | 559 | ? SizedBox() |
| @@ -937,10 +571,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -937,10 +571,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 937 | isBold: true, | 571 | isBold: true, |
| 938 | fontSize: 28, | 572 | fontSize: 28, |
| 939 | radius: ScreenUtil().setWidth(8), | 573 | radius: ScreenUtil().setWidth(8), |
| 940 | - onPressed: () { | ||
| 941 | - Loading.showLoading(context); | ||
| 942 | - setReserveStatus('3'); | ||
| 943 | - }, | 574 | + onPressed: widget.onTapLeave, |
| 944 | ), | 575 | ), |
| 945 | if (notebook.status != '2' && | 576 | if (notebook.status != '2' && |
| 946 | Utils.getAuthority( | 577 | Utils.getAuthority( |
| @@ -958,137 +589,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -958,137 +589,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 958 | notebook.uid == | 589 | notebook.uid == |
| 959 | userModel.user!.openid)) | 590 | userModel.user!.openid)) |
| 960 | InkWell( | 591 | InkWell( |
| 961 | - onTap: () { | ||
| 962 | - bool isReserveCancel = | ||
| 963 | - _getIsReserveCancel(widget | ||
| 964 | - .isReserveCancel); | ||
| 965 | - | ||
| 966 | - if (isReserveCancel) { | ||
| 967 | - bool cancelCan = false; | ||
| 968 | - DateTime dateTime = DateTime | ||
| 969 | - .fromMillisecondsSinceEpoch( | ||
| 970 | - int.parse(widget | ||
| 971 | - .notebook | ||
| 972 | - .ddate!) * | ||
| 973 | - 1000); | ||
| 974 | - String roleName = | ||
| 975 | - Provider.of<UserModel>( | ||
| 976 | - context, | ||
| 977 | - listen: | ||
| 978 | - false) | ||
| 979 | - .user! | ||
| 980 | - .role_name ?? | ||
| 981 | - ''; | ||
| 982 | - | ||
| 983 | - if (roleName == '管理员' || | ||
| 984 | - roleName == '前台') { | ||
| 985 | - cancelCan = true; | ||
| 986 | - } else if (roleName == | ||
| 987 | - '店长') { | ||
| 988 | - if (widget | ||
| 989 | - .cancelShopowner) { | ||
| 990 | - cancelCan = true; | ||
| 991 | - } else { | ||
| 992 | - //临餐不可以取消 | ||
| 993 | - | ||
| 994 | - //比较相差的天数 | ||
| 995 | - | ||
| 996 | - int differenceSeconds = | ||
| 997 | - dateTime | ||
| 998 | - .difference( | ||
| 999 | - DateTime | ||
| 1000 | - .now()) | ||
| 1001 | - .inSeconds; | ||
| 1002 | - | ||
| 1003 | - if (int.parse(widget | ||
| 1004 | - .cancelDay!) != | ||
| 1005 | - 0 && | ||
| 1006 | - differenceSeconds < | ||
| 1007 | - int.parse(widget | ||
| 1008 | - .cancelDay!) * | ||
| 1009 | - 24 * | ||
| 1010 | - 60 * | ||
| 1011 | - 60) { | ||
| 1012 | - // 临餐时间内 | ||
| 1013 | - cancelCan = false; | ||
| 1014 | - } else { | ||
| 1015 | - cancelCan = true; | ||
| 1016 | - } | ||
| 1017 | - } | ||
| 1018 | - } else if (roleName == | ||
| 1019 | - '客户经理') { | ||
| 1020 | - if (widget | ||
| 1021 | - .cancelManager) { | ||
| 1022 | - cancelCan = true; | ||
| 1023 | - } else { | ||
| 1024 | - //临餐不可以取消 | ||
| 1025 | - | ||
| 1026 | - //比较相差的天数 | ||
| 1027 | - int differenceSeconds = | ||
| 1028 | - dateTime | ||
| 1029 | - .difference( | ||
| 1030 | - DateTime | ||
| 1031 | - .now()) | ||
| 1032 | - .inSeconds; | ||
| 1033 | - | ||
| 1034 | - if (int.parse(widget | ||
| 1035 | - .cancelDay!) != | ||
| 1036 | - 0 && | ||
| 1037 | - differenceSeconds < | ||
| 1038 | - int.parse(widget | ||
| 1039 | - .cancelDay!) * | ||
| 1040 | - 24 * | ||
| 1041 | - 60 * | ||
| 1042 | - 60) { | ||
| 1043 | - // 临餐时间内 | ||
| 1044 | - cancelCan = false; | ||
| 1045 | - } else { | ||
| 1046 | - cancelCan = true; | ||
| 1047 | - } | ||
| 1048 | - } | ||
| 1049 | - } else { | ||
| 1050 | - if (widget.cancelOther) { | ||
| 1051 | - cancelCan = true; | ||
| 1052 | - } else { | ||
| 1053 | - //临餐不可以取消 | ||
| 1054 | - | ||
| 1055 | - //比较相差的天数 | ||
| 1056 | - | ||
| 1057 | - int differenceSeconds = | ||
| 1058 | - dateTime | ||
| 1059 | - .difference( | ||
| 1060 | - DateTime | ||
| 1061 | - .now()) | ||
| 1062 | - .inSeconds; | ||
| 1063 | - | ||
| 1064 | - if (int.parse(widget | ||
| 1065 | - .cancelDay!) != | ||
| 1066 | - 0 && | ||
| 1067 | - differenceSeconds < | ||
| 1068 | - int.parse(widget | ||
| 1069 | - .cancelDay!) * | ||
| 1070 | - 24 * | ||
| 1071 | - 60 * | ||
| 1072 | - 60) { | ||
| 1073 | - // 临餐时间内 | ||
| 1074 | - cancelCan = false; | ||
| 1075 | - } else { | ||
| 1076 | - cancelCan = true; | ||
| 1077 | - } | ||
| 1078 | - } | ||
| 1079 | - } | ||
| 1080 | - if (cancelCan) { | ||
| 1081 | - _showCancelWidget(context, | ||
| 1082 | - notebook.phone); | ||
| 1083 | - } else { | ||
| 1084 | - Utils.showToast( | ||
| 1085 | - '临餐不可取消预订!请与前台联系取消。'); | ||
| 1086 | - } | ||
| 1087 | - } else { | ||
| 1088 | - Utils.showToast( | ||
| 1089 | - '过去餐段的订单不可取消预订!请与前台联系取消。'); | ||
| 1090 | - } | ||
| 1091 | - }, | 592 | + onTap: widget.onTapCancel, |
| 1092 | child: Text( | 593 | child: Text( |
| 1093 | '取消预订', | 594 | '取消预订', |
| 1094 | style: TextStyle( | 595 | style: TextStyle( |
| @@ -41,24 +41,22 @@ class NoteBookItemSimple extends StatefulWidget { | @@ -41,24 +41,22 @@ class NoteBookItemSimple extends StatefulWidget { | ||
| 41 | final num index; | 41 | final num index; |
| 42 | final NoteBookOnlySunModel notebook; | 42 | final NoteBookOnlySunModel notebook; |
| 43 | 43 | ||
| 44 | - final GestureTapCallback onTap; | ||
| 45 | 44 | ||
| 46 | - final String? cancelDay; | ||
| 47 | - final bool cancelShopowner; | ||
| 48 | - final bool cancelManager; | ||
| 49 | 45 | ||
| 50 | - final bool cancelOther; | ||
| 51 | - final bool isReserveCancel; | 46 | + |
| 47 | + final GestureTapCallback? onTapChange; | ||
| 48 | + final GestureTapCallback? onTapReach; | ||
| 49 | + final GestureTapCallback? onTapLeave; | ||
| 50 | + final GestureTapCallback? onTapCancel; | ||
| 52 | 51 | ||
| 53 | NoteBookItemSimple( | 52 | NoteBookItemSimple( |
| 54 | this.index, | 53 | this.index, |
| 55 | this.notebook, | 54 | this.notebook, |
| 56 | - this.onTap, | ||
| 57 | - this.cancelDay, | ||
| 58 | - this.cancelShopowner, | ||
| 59 | - this.cancelManager, | ||
| 60 | - this.cancelOther, | ||
| 61 | - this.isReserveCancel); | 55 | + {this.onTapChange, |
| 56 | + this.onTapReach, | ||
| 57 | + this.onTapLeave, | ||
| 58 | + this.onTapCancel} | ||
| 59 | + ); | ||
| 62 | 60 | ||
| 63 | @override | 61 | @override |
| 64 | State<StatefulWidget> createState() { | 62 | State<StatefulWidget> createState() { |
| @@ -75,67 +73,67 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -75,67 +73,67 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 75 | bool isShowTF = false; | 73 | bool isShowTF = false; |
| 76 | // int paddingBottom; | 74 | // int paddingBottom; |
| 77 | int paddingTop = 138; | 75 | int paddingTop = 138; |
| 78 | - FocusNode _cancelNode = FocusNode(); | ||
| 79 | - TextEditingController _cancelController = TextEditingController(); | ||
| 80 | - StateSetter? _cancelState; | 76 | + // FocusNode _cancelNode = FocusNode(); |
| 77 | + // TextEditingController _cancelController = TextEditingController(); | ||
| 78 | + // StateSetter? _cancelState; | ||
| 81 | 79 | ||
| 82 | - ScrollController? _scrollController; | 80 | + // ScrollController? _scrollController; |
| 83 | 81 | ||
| 84 | - _onOperateClick() { | ||
| 85 | - if (widget.notebook.operationText == "通知客户") { | ||
| 86 | - // String _nameStr = ''; | ||
| 87 | - // String _tid = ''; | ||
| 88 | - // for (int i = 0; | ||
| 89 | - // i < | ||
| 90 | - // detailEntity | ||
| 91 | - // .tables.length; | ||
| 92 | - // i++) { | ||
| 93 | - // _nameStr += | ||
| 94 | - // '${detailEntity.tables[i].name},'; | 82 | + // _onOperateClick() { |
| 83 | + // if (widget.notebook.operationText == "通知客户") { | ||
| 84 | + // // String _nameStr = ''; | ||
| 85 | + // // String _tid = ''; | ||
| 86 | + // // for (int i = 0; | ||
| 87 | + // // i < | ||
| 88 | + // // detailEntity | ||
| 89 | + // // .tables.length; | ||
| 90 | + // // i++) { | ||
| 91 | + // // _nameStr += | ||
| 92 | + // // '${detailEntity.tables[i].name},'; | ||
| 95 | 93 | ||
| 96 | - // _tid += | ||
| 97 | - // '${detailEntity.tables[i].id},'; | ||
| 98 | - // } | ||
| 99 | - // if (_tid.endsWith(',')) { | ||
| 100 | - // _tid = _tid.substring( | ||
| 101 | - // 0, _tid.length - 1); | ||
| 102 | - // } | ||
| 103 | - // if (_nameStr | ||
| 104 | - // .endsWith(',')) { | ||
| 105 | - // _nameStr = | ||
| 106 | - // _nameStr.substring( | ||
| 107 | - // 0, | ||
| 108 | - // _nameStr.length - | ||
| 109 | - // 1); | ||
| 110 | - // } | ||
| 111 | - NavigatorUtil.goInvicationPage( | ||
| 112 | - context, | ||
| 113 | - widget.notebook.id, | ||
| 114 | - // widget.notebook.tableinfoStr, | ||
| 115 | - // widget.notebook.ddate, | ||
| 116 | - // widget.notebook.ddateStr, | ||
| 117 | - // widget.notebook.phone, | ||
| 118 | - // widget.notebook.ddate_solt, | ||
| 119 | - // widget.notebook.rname == null ? '' : widget.notebook.rname, | ||
| 120 | - // widget.notebook.sex == null ? '' : widget.notebook.sex, | ||
| 121 | - // widget.notebook.cusdem, | ||
| 122 | - // tid: widget.notebook.tid | ||
| 123 | - ); | ||
| 124 | - } | ||
| 125 | - } | 94 | + // // _tid += |
| 95 | + // // '${detailEntity.tables[i].id},'; | ||
| 96 | + // // } | ||
| 97 | + // // if (_tid.endsWith(',')) { | ||
| 98 | + // // _tid = _tid.substring( | ||
| 99 | + // // 0, _tid.length - 1); | ||
| 100 | + // // } | ||
| 101 | + // // if (_nameStr | ||
| 102 | + // // .endsWith(',')) { | ||
| 103 | + // // _nameStr = | ||
| 104 | + // // _nameStr.substring( | ||
| 105 | + // // 0, | ||
| 106 | + // // _nameStr.length - | ||
| 107 | + // // 1); | ||
| 108 | + // // } | ||
| 109 | + // NavigatorUtil.goInvicationPage( | ||
| 110 | + // context, | ||
| 111 | + // widget.notebook.id, | ||
| 112 | + // // widget.notebook.tableinfoStr, | ||
| 113 | + // // widget.notebook.ddate, | ||
| 114 | + // // widget.notebook.ddateStr, | ||
| 115 | + // // widget.notebook.phone, | ||
| 116 | + // // widget.notebook.ddate_solt, | ||
| 117 | + // // widget.notebook.rname == null ? '' : widget.notebook.rname, | ||
| 118 | + // // widget.notebook.sex == null ? '' : widget.notebook.sex, | ||
| 119 | + // // widget.notebook.cusdem, | ||
| 120 | + // // tid: widget.notebook.tid | ||
| 121 | + // ); | ||
| 122 | + // } | ||
| 123 | + // } | ||
| 126 | 124 | ||
| 127 | - /// 初始化取消原因数据 | ||
| 128 | - _initCancel() { | ||
| 129 | - // isShowTF = false; | ||
| 130 | - // paddingBottom = ScreenUtil().screenHeight.ceil() - 138 - 340; | ||
| 131 | - cancelReasonList = [ | ||
| 132 | - {'title': '顾客取消', 'select': false}, | ||
| 133 | - {'title': '顾客行程有变', 'select': false}, | ||
| 134 | - {'title': '信息填写有误', 'select': false}, | ||
| 135 | - {'title': '操作失误', 'select': false}, | ||
| 136 | - {'title': '其他原因', 'select': false}, | ||
| 137 | - ]; | ||
| 138 | - } | 125 | + // /// 初始化取消原因数据 |
| 126 | + // _initCancel() { | ||
| 127 | + // // isShowTF = false; | ||
| 128 | + // // paddingBottom = ScreenUtil().screenHeight.ceil() - 138 - 340; | ||
| 129 | + // cancelReasonList = [ | ||
| 130 | + // {'title': '顾客取消', 'select': false}, | ||
| 131 | + // {'title': '顾客行程有变', 'select': false}, | ||
| 132 | + // {'title': '信息填写有误', 'select': false}, | ||
| 133 | + // {'title': '操作失误', 'select': false}, | ||
| 134 | + // {'title': '其他原因', 'select': false}, | ||
| 135 | + // ]; | ||
| 136 | + // } | ||
| 139 | 137 | ||
| 140 | _updateSize(bool cando) { | 138 | _updateSize(bool cando) { |
| 141 | if (!cando) { | 139 | if (!cando) { |
| @@ -146,360 +144,360 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -146,360 +144,360 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 146 | }); | 144 | }); |
| 147 | } | 145 | } |
| 148 | 146 | ||
| 149 | - ///处理在线预订 | ||
| 150 | - setReserveStatus(String status, {String? desc, String? phone}) async { | ||
| 151 | - // bus.emit("remove_untreated_message",widget.mid); | ||
| 152 | - UserModel userModel = Provider.of<UserModel>(context, listen: false); | 147 | +// ///处理在线预订 |
| 148 | +// setReserveStatus(String status, {String? desc, String? phone}) async { | ||
| 149 | +// // bus.emit("remove_untreated_message",widget.mid); | ||
| 150 | +// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 153 | 151 | ||
| 154 | - Map<String, String?> params = { | ||
| 155 | - "rid": widget.notebook.id, | ||
| 156 | - "status": status, //5安排包间 2:确认到店(到店),3:用餐完成(离店),4:取消预定,5:分配包间:6:拒单 | ||
| 157 | - // "uid": userModel.user.openid, | ||
| 158 | - 'uid': widget.notebook.uid | ||
| 159 | - }; | ||
| 160 | - if (status == '4') { | ||
| 161 | - Map<String, String?> causeMap = { | ||
| 162 | - "uid": userModel.user!.openid, | ||
| 163 | - "uname": userModel.user!.nickName, | ||
| 164 | - "desc": desc, | ||
| 165 | - }; | ||
| 166 | - params["cause"] = json.encode(causeMap); | ||
| 167 | - } | ||
| 168 | - params['note_name'] = userModel.user!.account; | ||
| 169 | - NotebookDetailModel detailModel = | ||
| 170 | - Provider.of<NotebookDetailModel>(context, listen: false); | ||
| 171 | - bool success = await detailModel.setReserveStatusOnly(context, params, | ||
| 172 | - ifPush: false, notebook: widget.notebook); | ||
| 173 | - if (success) { | ||
| 174 | - bus.emit("refresh_book_list"); | ||
| 175 | - if (status == "4" && phone != null && phone != '') { | ||
| 176 | - //取消预订 | ||
| 177 | - getDzSellerConf(widget.notebook.id); | ||
| 178 | - } | ||
| 179 | - // if (status == "4") { | ||
| 180 | - // //取消预订 | ||
| 181 | - // bus.emit("refresh_tablemanager"); //刷新桌位 | ||
| 182 | - // } | ||
| 183 | - // _getReserveDetail(); | ||
| 184 | - } | ||
| 185 | - } | 152 | +// Map<String, String?> params = { |
| 153 | +// "rid": widget.notebook.id, | ||
| 154 | +// "status": status, //5安排包间 2:确认到店(到店),3:用餐完成(离店),4:取消预定,5:分配包间:6:拒单 | ||
| 155 | +// // "uid": userModel.user.openid, | ||
| 156 | +// 'uid': widget.notebook.uid | ||
| 157 | +// }; | ||
| 158 | +// if (status == '4') { | ||
| 159 | +// Map<String, String?> causeMap = { | ||
| 160 | +// "uid": userModel.user!.openid, | ||
| 161 | +// "uname": userModel.user!.nickName, | ||
| 162 | +// "desc": desc, | ||
| 163 | +// }; | ||
| 164 | +// params["cause"] = json.encode(causeMap); | ||
| 165 | +// } | ||
| 166 | +// params['note_name'] = userModel.user!.account; | ||
| 167 | +// NotebookDetailModel detailModel = | ||
| 168 | +// Provider.of<NotebookDetailModel>(context, listen: false); | ||
| 169 | +// bool success = await detailModel.setReserveStatusOnly(context, params, | ||
| 170 | +// ifPush: false, notebook: widget.notebook); | ||
| 171 | +// if (success) { | ||
| 172 | +// bus.emit("refresh_book_list"); | ||
| 173 | +// if (status == "4" && phone != null && phone != '') { | ||
| 174 | +// //取消预订 | ||
| 175 | +// getDzSellerConf(widget.notebook.id); | ||
| 176 | +// } | ||
| 177 | +// // if (status == "4") { | ||
| 178 | +// // //取消预订 | ||
| 179 | +// // bus.emit("refresh_tablemanager"); //刷新桌位 | ||
| 180 | +// // } | ||
| 181 | +// // _getReserveDetail(); | ||
| 182 | +// } | ||
| 183 | +// } | ||
| 186 | 184 | ||
| 187 | - getDzSellerConf(String? rid) async { | ||
| 188 | - MarketingCenterProvider marketingCenterProvider = | ||
| 189 | - Provider.of<MarketingCenterProvider>(context, listen: false); | ||
| 190 | - bool success = await marketingCenterProvider.getDzSellerConf(context); | ||
| 191 | - if (success && marketingCenterProvider.dzSellerConfModel != null) { | ||
| 192 | - bool selectSms = | ||
| 193 | - marketingCenterProvider.dzSellerConfModel!.isOpenCancel == '1' | ||
| 194 | - ? true | ||
| 195 | - : false; | 185 | +// getDzSellerConf(String? rid) async { |
| 186 | +// MarketingCenterProvider marketingCenterProvider = | ||
| 187 | +// Provider.of<MarketingCenterProvider>(context, listen: false); | ||
| 188 | +// bool success = await marketingCenterProvider.getDzSellerConf(context); | ||
| 189 | +// if (success && marketingCenterProvider.dzSellerConfModel != null) { | ||
| 190 | +// bool selectSms = | ||
| 191 | +// marketingCenterProvider.dzSellerConfModel!.isOpenCancel == '1' | ||
| 192 | +// ? true | ||
| 193 | +// : false; | ||
| 196 | 194 | ||
| 197 | - if (selectSms) { | ||
| 198 | - Map<String, String?> pramas = { | ||
| 199 | - 'rid': rid, | ||
| 200 | - 'sid': Provider.of<UserModel>(context, listen: false).user!.sellerid, | ||
| 201 | - }; | ||
| 202 | - NotebookDetailModel detailModel = | ||
| 203 | - Provider.of<NotebookDetailModel>(context, listen: false); | ||
| 204 | - detailModel.wxSendCancelSms(context, pramas); | ||
| 205 | - } | ||
| 206 | - } | ||
| 207 | - } | 195 | +// if (selectSms) { |
| 196 | +// Map<String, String?> pramas = { | ||
| 197 | +// 'rid': rid, | ||
| 198 | +// 'sid': Provider.of<UserModel>(context, listen: false).user!.sellerid, | ||
| 199 | +// }; | ||
| 200 | +// NotebookDetailModel detailModel = | ||
| 201 | +// Provider.of<NotebookDetailModel>(context, listen: false); | ||
| 202 | +// detailModel.wxSendCancelSms(context, pramas); | ||
| 203 | +// } | ||
| 204 | +// } | ||
| 205 | +// } | ||
| 208 | 206 | ||
| 209 | - ///取消预订弹框 | ||
| 210 | - _showCancelWidget(context, phone) { | ||
| 211 | - _scrollController = ScrollController(); | ||
| 212 | - _initCancel(); | ||
| 213 | - showGeneralDialog( | ||
| 214 | - context: context, | ||
| 215 | - barrierDismissible: false, | ||
| 216 | - barrierLabel: | ||
| 217 | - MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 218 | - transitionDuration: const Duration(milliseconds: 150), | ||
| 219 | - barrierColor: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 220 | - pageBuilder: (BuildContext context, Animation animation, | ||
| 221 | - Animation secondaryAnimation) { | ||
| 222 | - return Scaffold( | ||
| 223 | - backgroundColor: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 224 | - body: StatefulBuilder(builder: (context, state) { | ||
| 225 | - _cancelState = state; | ||
| 226 | - return GestureDetector( | ||
| 227 | - behavior: HitTestBehavior.opaque, | ||
| 228 | - // onTap: () { | ||
| 229 | - // Navigator.of(context).pop(); | ||
| 230 | - // }, | ||
| 231 | - child: Center( | ||
| 232 | - child: Container( | ||
| 233 | - margin: EdgeInsets.symmetric( | ||
| 234 | - horizontal: ScreenUtil().setWidth(28 * 2)), | ||
| 235 | - padding: EdgeInsets.symmetric( | ||
| 236 | - horizontal: ScreenUtil().setWidth(32)), | ||
| 237 | - decoration: BoxDecoration( | ||
| 238 | - color: Colors.white, | ||
| 239 | - borderRadius: | ||
| 240 | - BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 241 | - ), | ||
| 242 | - height: ScreenUtil().setWidth(355 * 2), | ||
| 243 | - child: Column( | ||
| 244 | - // mainAxisSize: MainAxisSize.min, | ||
| 245 | - children: [ | ||
| 246 | - // Stack( | ||
| 247 | - // children: [ | ||
| 248 | - VEmptyView(48), | ||
| 249 | - Container( | ||
| 250 | - height: ScreenUtil().setWidth(48), | ||
| 251 | - child: Text( | ||
| 252 | - '是否确定取消预订', | ||
| 253 | - style: TextStyle( | ||
| 254 | - fontSize: ScreenUtil().setSp(32), | ||
| 255 | - fontWeight: FontWeight.bold, | ||
| 256 | - decoration: TextDecoration.none, | ||
| 257 | - color: Color.fromRGBO(0, 0, 0, 0.9)), | ||
| 258 | - ), | ||
| 259 | - ), | ||
| 260 | - // Positioned( | ||
| 261 | - // top: ScreenUtil().setWidth(8), | ||
| 262 | - // right: ScreenUtil().setWidth(0), | ||
| 263 | - // child: GestureDetector( | ||
| 264 | - // onTap: () { | ||
| 265 | - // _initCancel(); | ||
| 266 | - // Navigator.of(context).pop(); | ||
| 267 | - // }, | ||
| 268 | - // child: Container( | ||
| 269 | - // padding: EdgeInsets.only(left: 20), | ||
| 270 | - // child: Image.asset( | ||
| 271 | - // 'assets/close.png', | ||
| 272 | - // width: ScreenUtil().setWidth(32), | ||
| 273 | - // height: ScreenUtil().setWidth(32), | ||
| 274 | - // ), | ||
| 275 | - // ))) | ||
| 276 | - // ], | ||
| 277 | - // ), | ||
| 278 | - VEmptyView(40), | ||
| 279 | - Container( | ||
| 280 | - child: Column( | ||
| 281 | - // mainAxisSize: MainAxisSize.min, | ||
| 282 | - children: cancelReasonList.map((value) { | ||
| 283 | - return value['title'] == '其他原因' | ||
| 284 | - ? SizedBox() | ||
| 285 | - : GestureDetector( | ||
| 286 | - onTap: () { | ||
| 287 | - for (var item in cancelReasonList) { | ||
| 288 | - item['select'] = false; | ||
| 289 | - // isShowTF = false; | ||
| 290 | - // paddingBottom = | ||
| 291 | - // ScreenUtil().screenHeight.ceil() - | ||
| 292 | - // 138 - | ||
| 293 | - // 340; | ||
| 294 | - if (item['title'] == | ||
| 295 | - value['title']) { | ||
| 296 | - item['select'] = true; | ||
| 297 | - // if (item['title'] == '其他原因') { | ||
| 298 | - // // isShowTF = true; | ||
| 299 | - // // paddingBottom = 130; | ||
| 300 | - // // paddingBottom = | ||
| 301 | - // // ScreenUtil().screenHeight.ceil() - | ||
| 302 | - // // 138 - | ||
| 303 | - // // 340 - | ||
| 304 | - // // 46; | ||
| 305 | - // } | ||
| 306 | - } | ||
| 307 | - } | ||
| 308 | - state(() {}); | ||
| 309 | - }, | ||
| 310 | - child: Container( | ||
| 311 | - height: ScreenUtil().setWidth(48), | ||
| 312 | - margin: EdgeInsets.only( | ||
| 313 | - bottom: | ||
| 314 | - ScreenUtil().setWidth(40)), | ||
| 315 | - child: Row( | ||
| 316 | - children: [ | ||
| 317 | - Image.asset( | ||
| 318 | - value['select'] | ||
| 319 | - ? 'assets/select.png' | ||
| 320 | - : 'assets/unselect.png', | ||
| 321 | - width: ScreenUtil() | ||
| 322 | - .setWidth(42)), | ||
| 323 | - HEmptyView(20), | ||
| 324 | - Container( | ||
| 325 | - child: Text(value['title'], | ||
| 326 | - style: TextStyle( | ||
| 327 | - fontSize: ScreenUtil() | ||
| 328 | - .setSp(32), | ||
| 329 | - fontWeight: | ||
| 330 | - FontWeight.normal, | ||
| 331 | - decoration: | ||
| 332 | - TextDecoration | ||
| 333 | - .none, | ||
| 334 | - color: MyColours | ||
| 335 | - .color_333333))) | ||
| 336 | - ], | ||
| 337 | - ), | ||
| 338 | - ), | ||
| 339 | - ); | ||
| 340 | - }).toList(), | ||
| 341 | - )), | ||
| 342 | - Material( | ||
| 343 | - child: Container( | ||
| 344 | - color: Colors.white, | ||
| 345 | - height: ScreenUtil().setWidth(42 * 2), | ||
| 346 | - child: Row(children: [ | ||
| 347 | - InkWell( | ||
| 348 | - onTap: () { | ||
| 349 | - for (var item in cancelReasonList) { | ||
| 350 | - item['select'] = false; | ||
| 351 | - } | ||
| 352 | - cancelReasonList[4]['select'] = | ||
| 353 | - true; | ||
| 354 | - state(() {}); | ||
| 355 | - }, | ||
| 356 | - child: Padding( | ||
| 357 | - padding: EdgeInsets.only( | ||
| 358 | - right: ScreenUtil() | ||
| 359 | - .setWidth(20)), | ||
| 360 | - child: Image.asset( | ||
| 361 | - cancelReasonList[4]['select'] | ||
| 362 | - ? 'assets/select.png' | ||
| 363 | - : 'assets/unselect.png', | ||
| 364 | - width: ScreenUtil() | ||
| 365 | - .setWidth(44)))), | ||
| 366 | - Expanded( | ||
| 367 | - child: Container( | ||
| 368 | - decoration: BoxDecoration( | ||
| 369 | - color: Color.fromRGBO( | ||
| 370 | - 240, 240, 240, 1), | ||
| 371 | - borderRadius: BorderRadius.circular( | ||
| 372 | - ScreenUtil().setWidth(8))), | ||
| 373 | - // height: ScreenUtil().setWidth(42 * 2), | ||
| 374 | - padding: EdgeInsets.symmetric( | ||
| 375 | - horizontal: | ||
| 376 | - ScreenUtil().setWidth(16)), | ||
| 377 | - child: TextField( | ||
| 378 | - maxLines: 1, | ||
| 379 | - controller: _cancelController, | ||
| 380 | - focusNode: _cancelNode, | ||
| 381 | - style: TextStyle( | ||
| 382 | - textBaseline: | ||
| 383 | - TextBaseline.alphabetic), | ||
| 384 | - textAlignVertical: | ||
| 385 | - TextAlignVertical.center, | ||
| 386 | - decoration: InputDecoration( | ||
| 387 | - contentPadding: EdgeInsets.zero, | ||
| 388 | - hintText: "其他", | ||
| 389 | - // focusColor: Color.fromRGBO(0, 0, 0, 0.4), | ||
| 390 | - hintStyle: TextStyle( | ||
| 391 | - color: | ||
| 392 | - Color.fromRGBO(0, 0, 0, 0.4), | ||
| 393 | - fontSize: ScreenUtil().setSp(32), | ||
| 394 | - ), | ||
| 395 | - enabledBorder: OutlineInputBorder( | ||
| 396 | - borderSide: BorderSide( | ||
| 397 | - width: 0, | ||
| 398 | - color: Colors.transparent)), | ||
| 399 | - border: OutlineInputBorder( | ||
| 400 | - borderSide: BorderSide( | ||
| 401 | - width: 0, | ||
| 402 | - color: Colors.transparent)), | ||
| 403 | - focusedBorder: OutlineInputBorder( | ||
| 404 | - borderSide: BorderSide( | ||
| 405 | - width: 0, | ||
| 406 | - color: Colors.transparent)), | ||
| 407 | - ), | 207 | +// ///取消预订弹框 |
| 208 | +// _showCancelWidget(context, phone) { | ||
| 209 | +// _scrollController = ScrollController(); | ||
| 210 | +// _initCancel(); | ||
| 211 | +// showGeneralDialog( | ||
| 212 | +// context: context, | ||
| 213 | +// barrierDismissible: false, | ||
| 214 | +// barrierLabel: | ||
| 215 | +// MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 216 | +// transitionDuration: const Duration(milliseconds: 150), | ||
| 217 | +// barrierColor: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 218 | +// pageBuilder: (BuildContext context, Animation animation, | ||
| 219 | +// Animation secondaryAnimation) { | ||
| 220 | +// return Scaffold( | ||
| 221 | +// backgroundColor: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 222 | +// body: StatefulBuilder(builder: (context, state) { | ||
| 223 | +// _cancelState = state; | ||
| 224 | +// return GestureDetector( | ||
| 225 | +// behavior: HitTestBehavior.opaque, | ||
| 226 | +// // onTap: () { | ||
| 227 | +// // Navigator.of(context).pop(); | ||
| 228 | +// // }, | ||
| 229 | +// child: Center( | ||
| 230 | +// child: Container( | ||
| 231 | +// margin: EdgeInsets.symmetric( | ||
| 232 | +// horizontal: ScreenUtil().setWidth(28 * 2)), | ||
| 233 | +// padding: EdgeInsets.symmetric( | ||
| 234 | +// horizontal: ScreenUtil().setWidth(32)), | ||
| 235 | +// decoration: BoxDecoration( | ||
| 236 | +// color: Colors.white, | ||
| 237 | +// borderRadius: | ||
| 238 | +// BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 239 | +// ), | ||
| 240 | +// height: ScreenUtil().setWidth(355 * 2), | ||
| 241 | +// child: Column( | ||
| 242 | +// // mainAxisSize: MainAxisSize.min, | ||
| 243 | +// children: [ | ||
| 244 | +// // Stack( | ||
| 245 | +// // children: [ | ||
| 246 | +// VEmptyView(48), | ||
| 247 | +// Container( | ||
| 248 | +// height: ScreenUtil().setWidth(48), | ||
| 249 | +// child: Text( | ||
| 250 | +// '是否确定取消预订', | ||
| 251 | +// style: TextStyle( | ||
| 252 | +// fontSize: ScreenUtil().setSp(32), | ||
| 253 | +// fontWeight: FontWeight.bold, | ||
| 254 | +// decoration: TextDecoration.none, | ||
| 255 | +// color: Color.fromRGBO(0, 0, 0, 0.9)), | ||
| 256 | +// ), | ||
| 257 | +// ), | ||
| 258 | +// // Positioned( | ||
| 259 | +// // top: ScreenUtil().setWidth(8), | ||
| 260 | +// // right: ScreenUtil().setWidth(0), | ||
| 261 | +// // child: GestureDetector( | ||
| 262 | +// // onTap: () { | ||
| 263 | +// // _initCancel(); | ||
| 264 | +// // Navigator.of(context).pop(); | ||
| 265 | +// // }, | ||
| 266 | +// // child: Container( | ||
| 267 | +// // padding: EdgeInsets.only(left: 20), | ||
| 268 | +// // child: Image.asset( | ||
| 269 | +// // 'assets/close.png', | ||
| 270 | +// // width: ScreenUtil().setWidth(32), | ||
| 271 | +// // height: ScreenUtil().setWidth(32), | ||
| 272 | +// // ), | ||
| 273 | +// // ))) | ||
| 274 | +// // ], | ||
| 275 | +// // ), | ||
| 276 | +// VEmptyView(40), | ||
| 277 | +// Container( | ||
| 278 | +// child: Column( | ||
| 279 | +// // mainAxisSize: MainAxisSize.min, | ||
| 280 | +// children: cancelReasonList.map((value) { | ||
| 281 | +// return value['title'] == '其他原因' | ||
| 282 | +// ? SizedBox() | ||
| 283 | +// : GestureDetector( | ||
| 284 | +// onTap: () { | ||
| 285 | +// for (var item in cancelReasonList) { | ||
| 286 | +// item['select'] = false; | ||
| 287 | +// // isShowTF = false; | ||
| 288 | +// // paddingBottom = | ||
| 289 | +// // ScreenUtil().screenHeight.ceil() - | ||
| 290 | +// // 138 - | ||
| 291 | +// // 340; | ||
| 292 | +// if (item['title'] == | ||
| 293 | +// value['title']) { | ||
| 294 | +// item['select'] = true; | ||
| 295 | +// // if (item['title'] == '其他原因') { | ||
| 296 | +// // // isShowTF = true; | ||
| 297 | +// // // paddingBottom = 130; | ||
| 298 | +// // // paddingBottom = | ||
| 299 | +// // // ScreenUtil().screenHeight.ceil() - | ||
| 300 | +// // // 138 - | ||
| 301 | +// // // 340 - | ||
| 302 | +// // // 46; | ||
| 303 | +// // } | ||
| 304 | +// } | ||
| 305 | +// } | ||
| 306 | +// state(() {}); | ||
| 307 | +// }, | ||
| 308 | +// child: Container( | ||
| 309 | +// height: ScreenUtil().setWidth(48), | ||
| 310 | +// margin: EdgeInsets.only( | ||
| 311 | +// bottom: | ||
| 312 | +// ScreenUtil().setWidth(40)), | ||
| 313 | +// child: Row( | ||
| 314 | +// children: [ | ||
| 315 | +// Image.asset( | ||
| 316 | +// value['select'] | ||
| 317 | +// ? 'assets/select.png' | ||
| 318 | +// : 'assets/unselect.png', | ||
| 319 | +// width: ScreenUtil() | ||
| 320 | +// .setWidth(42)), | ||
| 321 | +// HEmptyView(20), | ||
| 322 | +// Container( | ||
| 323 | +// child: Text(value['title'], | ||
| 324 | +// style: TextStyle( | ||
| 325 | +// fontSize: ScreenUtil() | ||
| 326 | +// .setSp(32), | ||
| 327 | +// fontWeight: | ||
| 328 | +// FontWeight.normal, | ||
| 329 | +// decoration: | ||
| 330 | +// TextDecoration | ||
| 331 | +// .none, | ||
| 332 | +// color: MyColours | ||
| 333 | +// .color_333333))) | ||
| 334 | +// ], | ||
| 335 | +// ), | ||
| 336 | +// ), | ||
| 337 | +// ); | ||
| 338 | +// }).toList(), | ||
| 339 | +// )), | ||
| 340 | +// Material( | ||
| 341 | +// child: Container( | ||
| 342 | +// color: Colors.white, | ||
| 343 | +// height: ScreenUtil().setWidth(42 * 2), | ||
| 344 | +// child: Row(children: [ | ||
| 345 | +// InkWell( | ||
| 346 | +// onTap: () { | ||
| 347 | +// for (var item in cancelReasonList) { | ||
| 348 | +// item['select'] = false; | ||
| 349 | +// } | ||
| 350 | +// cancelReasonList[4]['select'] = | ||
| 351 | +// true; | ||
| 352 | +// state(() {}); | ||
| 353 | +// }, | ||
| 354 | +// child: Padding( | ||
| 355 | +// padding: EdgeInsets.only( | ||
| 356 | +// right: ScreenUtil() | ||
| 357 | +// .setWidth(20)), | ||
| 358 | +// child: Image.asset( | ||
| 359 | +// cancelReasonList[4]['select'] | ||
| 360 | +// ? 'assets/select.png' | ||
| 361 | +// : 'assets/unselect.png', | ||
| 362 | +// width: ScreenUtil() | ||
| 363 | +// .setWidth(44)))), | ||
| 364 | +// Expanded( | ||
| 365 | +// child: Container( | ||
| 366 | +// decoration: BoxDecoration( | ||
| 367 | +// color: Color.fromRGBO( | ||
| 368 | +// 240, 240, 240, 1), | ||
| 369 | +// borderRadius: BorderRadius.circular( | ||
| 370 | +// ScreenUtil().setWidth(8))), | ||
| 371 | +// // height: ScreenUtil().setWidth(42 * 2), | ||
| 372 | +// padding: EdgeInsets.symmetric( | ||
| 373 | +// horizontal: | ||
| 374 | +// ScreenUtil().setWidth(16)), | ||
| 375 | +// child: TextField( | ||
| 376 | +// maxLines: 1, | ||
| 377 | +// controller: _cancelController, | ||
| 378 | +// focusNode: _cancelNode, | ||
| 379 | +// style: TextStyle( | ||
| 380 | +// textBaseline: | ||
| 381 | +// TextBaseline.alphabetic), | ||
| 382 | +// textAlignVertical: | ||
| 383 | +// TextAlignVertical.center, | ||
| 384 | +// decoration: InputDecoration( | ||
| 385 | +// contentPadding: EdgeInsets.zero, | ||
| 386 | +// hintText: "其他", | ||
| 387 | +// // focusColor: Color.fromRGBO(0, 0, 0, 0.4), | ||
| 388 | +// hintStyle: TextStyle( | ||
| 389 | +// color: | ||
| 390 | +// Color.fromRGBO(0, 0, 0, 0.4), | ||
| 391 | +// fontSize: ScreenUtil().setSp(32), | ||
| 392 | +// ), | ||
| 393 | +// enabledBorder: OutlineInputBorder( | ||
| 394 | +// borderSide: BorderSide( | ||
| 395 | +// width: 0, | ||
| 396 | +// color: Colors.transparent)), | ||
| 397 | +// border: OutlineInputBorder( | ||
| 398 | +// borderSide: BorderSide( | ||
| 399 | +// width: 0, | ||
| 400 | +// color: Colors.transparent)), | ||
| 401 | +// focusedBorder: OutlineInputBorder( | ||
| 402 | +// borderSide: BorderSide( | ||
| 403 | +// width: 0, | ||
| 404 | +// color: Colors.transparent)), | ||
| 405 | +// ), | ||
| 408 | 406 | ||
| 409 | - // border: InputBorder.none, | 407 | +// // border: InputBorder.none, |
| 410 | 408 | ||
| 411 | - onChanged: (_) { | ||
| 412 | - setState(() {}); | ||
| 413 | - }, | ||
| 414 | - onEditingComplete: () { | ||
| 415 | - print('fff'); | ||
| 416 | - _cancelNode.unfocus(); | ||
| 417 | - }, | ||
| 418 | - // keyboardType: TextInputType.numberWithOptions(decimal: true), | ||
| 419 | - ), | ||
| 420 | - )) | ||
| 421 | - ]))), | 409 | +// onChanged: (_) { |
| 410 | +// setState(() {}); | ||
| 411 | +// }, | ||
| 412 | +// onEditingComplete: () { | ||
| 413 | +// print('fff'); | ||
| 414 | +// _cancelNode.unfocus(); | ||
| 415 | +// }, | ||
| 416 | +// // keyboardType: TextInputType.numberWithOptions(decimal: true), | ||
| 417 | +// ), | ||
| 418 | +// )) | ||
| 419 | +// ]))), | ||
| 422 | 420 | ||
| 423 | - VEmptyView(15), | ||
| 424 | - Material( | ||
| 425 | - child: RoundButton( | ||
| 426 | - onPressed: () { | ||
| 427 | - String? desc = ''; | ||
| 428 | - for (var value in cancelReasonList) { | ||
| 429 | - if (value['select'] == true) { | ||
| 430 | - desc = value['title']; | ||
| 431 | - if (value['title'] == '其他原因') { | ||
| 432 | - desc = _cancelController.text.trim(); | ||
| 433 | - if (desc.isEmpty) { | ||
| 434 | - Utils.showToast("请填写原因"); | ||
| 435 | - return; | ||
| 436 | - } | ||
| 437 | - } | ||
| 438 | - } | ||
| 439 | - } | 421 | +// VEmptyView(15), |
| 422 | +// Material( | ||
| 423 | +// child: RoundButton( | ||
| 424 | +// onPressed: () { | ||
| 425 | +// String? desc = ''; | ||
| 426 | +// for (var value in cancelReasonList) { | ||
| 427 | +// if (value['select'] == true) { | ||
| 428 | +// desc = value['title']; | ||
| 429 | +// if (value['title'] == '其他原因') { | ||
| 430 | +// desc = _cancelController.text.trim(); | ||
| 431 | +// if (desc.isEmpty) { | ||
| 432 | +// Utils.showToast("请填写原因"); | ||
| 433 | +// return; | ||
| 434 | +// } | ||
| 435 | +// } | ||
| 436 | +// } | ||
| 437 | +// } | ||
| 440 | 438 | ||
| 441 | - if (desc == '') { | ||
| 442 | - Utils.showToast('请选择原因'); | ||
| 443 | - return; | ||
| 444 | - } | 439 | +// if (desc == '') { |
| 440 | +// Utils.showToast('请选择原因'); | ||
| 441 | +// return; | ||
| 442 | +// } | ||
| 445 | 443 | ||
| 446 | - Navigator.of(context).pop(); | ||
| 447 | - Loading.showLoading(context); | 444 | +// Navigator.of(context).pop(); |
| 445 | +// Loading.showLoading(context); | ||
| 448 | 446 | ||
| 449 | - setReserveStatus('4', | ||
| 450 | - desc: desc, phone: phone); | ||
| 451 | - }, | ||
| 452 | - text: '确认', | ||
| 453 | - height: ScreenUtil().setWidth(80), | ||
| 454 | - width: ScreenUtil().setWidth(300), | ||
| 455 | - radius: ScreenUtil().setWidth(10), | ||
| 456 | - ), | ||
| 457 | - ) | ||
| 458 | - ], | ||
| 459 | - ), | ||
| 460 | - ), | ||
| 461 | - )); | ||
| 462 | - })); | ||
| 463 | - }); | ||
| 464 | - } | 447 | +// setReserveStatus('4', |
| 448 | +// desc: desc, phone: phone); | ||
| 449 | +// }, | ||
| 450 | +// text: '确认', | ||
| 451 | +// height: ScreenUtil().setWidth(80), | ||
| 452 | +// width: ScreenUtil().setWidth(300), | ||
| 453 | +// radius: ScreenUtil().setWidth(10), | ||
| 454 | +// ), | ||
| 455 | +// ) | ||
| 456 | +// ], | ||
| 457 | +// ), | ||
| 458 | +// ), | ||
| 459 | +// )); | ||
| 460 | +// })); | ||
| 461 | +// }); | ||
| 462 | +// } | ||
| 465 | 463 | ||
| 466 | - _getIsReserveCancel(bool isReserveCancel) { | ||
| 467 | - //判断时间是否可变更 | 464 | +// _getIsReserveCancel(bool isReserveCancel) { |
| 465 | +// //判断时间是否可变更 | ||
| 468 | 466 | ||
| 469 | - bool reserveCancel = true; //默认允许变更过去餐段订单的时间 | ||
| 470 | - //如果不允许变更过去餐段订单的时间,则开始判断 | ||
| 471 | - //连个条件同时成立: 1.订单的时间是过去 2. 时间改变 | ||
| 472 | - if (!isReserveCancel) { | ||
| 473 | - //找到当前餐段对应的时间段 | ||
| 474 | - String? times = widget.notebook.mdate ?? '00:00-00:00'; | 467 | +// bool reserveCancel = true; //默认允许变更过去餐段订单的时间 |
| 468 | +// //如果不允许变更过去餐段订单的时间,则开始判断 | ||
| 469 | +// //连个条件同时成立: 1.订单的时间是过去 2. 时间改变 | ||
| 470 | +// if (!isReserveCancel) { | ||
| 471 | +// //找到当前餐段对应的时间段 | ||
| 472 | +// String? times = widget.notebook.mdate ?? '00:00-00:00'; | ||
| 475 | 473 | ||
| 476 | - //组装时间戳 | ||
| 477 | - List<String> datas = times.split('-'); | ||
| 478 | - // DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' + | ||
| 479 | - // '-' + | ||
| 480 | - // '${dateTimeSelect.month}' + | ||
| 481 | - // '-' + | ||
| 482 | - // '${dateTimeSelect.day}' + | ||
| 483 | - // ' ${datas[0]}:00'); //选中餐段开始时间戳 | ||
| 484 | - DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | ||
| 485 | - int.parse(widget.notebook.ddate!) * 1000); | ||
| 486 | - DateTime selectEtime = DateTime.parse('${dateTime.year}' + | ||
| 487 | - '-' + | ||
| 488 | - Utils.addZeroNumber(dateTime.month) + | ||
| 489 | - '-' + | ||
| 490 | - Utils.addZeroNumber(dateTime.day) + | ||
| 491 | - ' ${datas[1]}:00'); //选中餐段结束时间戳 | ||
| 492 | - // 过去的餐段界定 | ||
| 493 | - if (selectEtime.isBefore(DateTime.now())) { | ||
| 494 | -// 属于过去餐段 | ||
| 495 | - reserveCancel = false; | ||
| 496 | - } else { | ||
| 497 | - // 属于未来餐段 | ||
| 498 | - reserveCancel = true; | ||
| 499 | - } | ||
| 500 | - } | ||
| 501 | - return reserveCancel; | ||
| 502 | - } | 474 | +// //组装时间戳 |
| 475 | +// List<String> datas = times.split('-'); | ||
| 476 | +// // DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' + | ||
| 477 | +// // '-' + | ||
| 478 | +// // '${dateTimeSelect.month}' + | ||
| 479 | +// // '-' + | ||
| 480 | +// // '${dateTimeSelect.day}' + | ||
| 481 | +// // ' ${datas[0]}:00'); //选中餐段开始时间戳 | ||
| 482 | +// DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | ||
| 483 | +// int.parse(widget.notebook.ddate!) * 1000); | ||
| 484 | +// DateTime selectEtime = DateTime.parse('${dateTime.year}' + | ||
| 485 | +// '-' + | ||
| 486 | +// Utils.addZeroNumber(dateTime.month) + | ||
| 487 | +// '-' + | ||
| 488 | +// Utils.addZeroNumber(dateTime.day) + | ||
| 489 | +// ' ${datas[1]}:00'); //选中餐段结束时间戳 | ||
| 490 | +// // 过去的餐段界定 | ||
| 491 | +// if (selectEtime.isBefore(DateTime.now())) { | ||
| 492 | +// // 属于过去餐段 | ||
| 493 | +// reserveCancel = false; | ||
| 494 | +// } else { | ||
| 495 | +// // 属于未来餐段 | ||
| 496 | +// reserveCancel = true; | ||
| 497 | +// } | ||
| 498 | +// } | ||
| 499 | +// return reserveCancel; | ||
| 500 | +// } | ||
| 503 | 501 | ||
| 504 | @override | 502 | @override |
| 505 | Widget build(BuildContext context) { | 503 | Widget build(BuildContext context) { |
| @@ -598,7 +596,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -598,7 +596,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 598 | child: Row( | 596 | child: Row( |
| 599 | children: [ | 597 | children: [ |
| 600 | InkWell( | 598 | InkWell( |
| 601 | - onTap: widget.onTap, | 599 | + onTap: widget.onTapChange, |
| 602 | child: Column( | 600 | child: Column( |
| 603 | crossAxisAlignment: CrossAxisAlignment.center, | 601 | crossAxisAlignment: CrossAxisAlignment.center, |
| 604 | children: [ | 602 | children: [ |
| @@ -878,11 +876,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -878,11 +876,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 878 | fontSize: 28, | 876 | fontSize: 28, |
| 879 | radius: | 877 | radius: |
| 880 | ScreenUtil().setWidth(8), | 878 | ScreenUtil().setWidth(8), |
| 881 | - onPressed: () { | ||
| 882 | - Loading.showLoading( | ||
| 883 | - context); | ||
| 884 | - setReserveStatus('2'); | ||
| 885 | - }, | 879 | + onPressed: widget.onTapReach |
| 886 | ), | 880 | ), |
| 887 | notebook.status == '2' | 881 | notebook.status == '2' |
| 888 | ? SizedBox() | 882 | ? SizedBox() |
| @@ -900,10 +894,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -900,10 +894,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 900 | isBold: true, | 894 | isBold: true, |
| 901 | fontSize: 28, | 895 | fontSize: 28, |
| 902 | radius: ScreenUtil().setWidth(8), | 896 | radius: ScreenUtil().setWidth(8), |
| 903 | - onPressed: () { | ||
| 904 | - Loading.showLoading(context); | ||
| 905 | - setReserveStatus('3'); | ||
| 906 | - }, | 897 | + onPressed: widget.onTapLeave, |
| 907 | ), | 898 | ), |
| 908 | if (notebook.status != '2' && | 899 | if (notebook.status != '2' && |
| 909 | Utils.getAuthority( | 900 | Utils.getAuthority( |
| @@ -921,137 +912,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -921,137 +912,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 921 | notebook.uid == | 912 | notebook.uid == |
| 922 | userModel.user!.openid)) | 913 | userModel.user!.openid)) |
| 923 | InkWell( | 914 | InkWell( |
| 924 | - onTap: () { | ||
| 925 | - bool isReserveCancel = | ||
| 926 | - _getIsReserveCancel(widget | ||
| 927 | - .isReserveCancel); | ||
| 928 | - | ||
| 929 | - if (isReserveCancel) { | ||
| 930 | - bool cancelCan = false; | ||
| 931 | - DateTime dateTime = DateTime | ||
| 932 | - .fromMillisecondsSinceEpoch( | ||
| 933 | - int.parse(widget | ||
| 934 | - .notebook | ||
| 935 | - .ddate!) * | ||
| 936 | - 1000); | ||
| 937 | - String roleName = | ||
| 938 | - Provider.of<UserModel>( | ||
| 939 | - context, | ||
| 940 | - listen: | ||
| 941 | - false) | ||
| 942 | - .user! | ||
| 943 | - .role_name ?? | ||
| 944 | - ''; | ||
| 945 | - | ||
| 946 | - if (roleName == '管理员' || | ||
| 947 | - roleName == '前台') { | ||
| 948 | - cancelCan = true; | ||
| 949 | - } else if (roleName == | ||
| 950 | - '店长') { | ||
| 951 | - if (widget | ||
| 952 | - .cancelShopowner) { | ||
| 953 | - cancelCan = true; | ||
| 954 | - } else { | ||
| 955 | - //临餐不可以取消 | ||
| 956 | - | ||
| 957 | - //比较相差的天数 | ||
| 958 | - | ||
| 959 | - int differenceSeconds = | ||
| 960 | - dateTime | ||
| 961 | - .difference( | ||
| 962 | - DateTime | ||
| 963 | - .now()) | ||
| 964 | - .inSeconds; | ||
| 965 | - | ||
| 966 | - if (int.parse(widget | ||
| 967 | - .cancelDay!) != | ||
| 968 | - 0 && | ||
| 969 | - differenceSeconds < | ||
| 970 | - int.parse(widget | ||
| 971 | - .cancelDay!) * | ||
| 972 | - 24 * | ||
| 973 | - 60 * | ||
| 974 | - 60) { | ||
| 975 | - // 临餐时间内 | ||
| 976 | - cancelCan = false; | ||
| 977 | - } else { | ||
| 978 | - cancelCan = true; | ||
| 979 | - } | ||
| 980 | - } | ||
| 981 | - } else if (roleName == | ||
| 982 | - '客户经理') { | ||
| 983 | - if (widget | ||
| 984 | - .cancelManager) { | ||
| 985 | - cancelCan = true; | ||
| 986 | - } else { | ||
| 987 | - //临餐不可以取消 | ||
| 988 | - | ||
| 989 | - //比较相差的天数 | ||
| 990 | - int differenceSeconds = | ||
| 991 | - dateTime | ||
| 992 | - .difference( | ||
| 993 | - DateTime | ||
| 994 | - .now()) | ||
| 995 | - .inSeconds; | ||
| 996 | - | ||
| 997 | - if (int.parse(widget | ||
| 998 | - .cancelDay!) != | ||
| 999 | - 0 && | ||
| 1000 | - differenceSeconds < | ||
| 1001 | - int.parse(widget | ||
| 1002 | - .cancelDay!) * | ||
| 1003 | - 24 * | ||
| 1004 | - 60 * | ||
| 1005 | - 60) { | ||
| 1006 | - // 临餐时间内 | ||
| 1007 | - cancelCan = false; | ||
| 1008 | - } else { | ||
| 1009 | - cancelCan = true; | ||
| 1010 | - } | ||
| 1011 | - } | ||
| 1012 | - } else { | ||
| 1013 | - if (widget.cancelOther) { | ||
| 1014 | - cancelCan = true; | ||
| 1015 | - } else { | ||
| 1016 | - //临餐不可以取消 | ||
| 1017 | - | ||
| 1018 | - //比较相差的天数 | ||
| 1019 | - | ||
| 1020 | - int differenceSeconds = | ||
| 1021 | - dateTime | ||
| 1022 | - .difference( | ||
| 1023 | - DateTime | ||
| 1024 | - .now()) | ||
| 1025 | - .inSeconds; | ||
| 1026 | - | ||
| 1027 | - if (int.parse(widget | ||
| 1028 | - .cancelDay!) != | ||
| 1029 | - 0 && | ||
| 1030 | - differenceSeconds < | ||
| 1031 | - int.parse(widget | ||
| 1032 | - .cancelDay!) * | ||
| 1033 | - 24 * | ||
| 1034 | - 60 * | ||
| 1035 | - 60) { | ||
| 1036 | - // 临餐时间内 | ||
| 1037 | - cancelCan = false; | ||
| 1038 | - } else { | ||
| 1039 | - cancelCan = true; | ||
| 1040 | - } | ||
| 1041 | - } | ||
| 1042 | - } | ||
| 1043 | - if (cancelCan) { | ||
| 1044 | - _showCancelWidget(context, | ||
| 1045 | - notebook.phone); | ||
| 1046 | - } else { | ||
| 1047 | - Utils.showToast( | ||
| 1048 | - '临餐不可取消预订!请与前台联系取消。'); | ||
| 1049 | - } | ||
| 1050 | - } else { | ||
| 1051 | - Utils.showToast( | ||
| 1052 | - '过去餐段的订单不可取消预订!请与前台联系取消。'); | ||
| 1053 | - } | ||
| 1054 | - }, | 915 | + onTap: widget.onTapCancel, |
| 1055 | child: Text( | 916 | child: Text( |
| 1056 | '取消预订', | 917 | '取消预订', |
| 1057 | style: TextStyle( | 918 | style: TextStyle( |
| 1 | +import 'dart:convert'; | ||
| 2 | + | ||
| 1 | import 'package:common_utils/common_utils.dart'; | 3 | import 'package:common_utils/common_utils.dart'; |
| 2 | 4 | ||
| 3 | import 'package:flutter/material.dart'; | 5 | import 'package:flutter/material.dart'; |
| @@ -5,6 +7,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; | @@ -5,6 +7,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 7 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 6 | import 'package:one_key/app.dart'; | 8 | import 'package:one_key/app.dart'; |
| 7 | import 'package:one_key/constant/state.dart'; | 9 | import 'package:one_key/constant/state.dart'; |
| 10 | +import 'package:one_key/models/meal_day_date_model.dart'; | ||
| 8 | 11 | ||
| 9 | import 'package:one_key/pages/notebook/notebook_item_f.dart'; | 12 | import 'package:one_key/pages/notebook/notebook_item_f.dart'; |
| 10 | import 'package:one_key/pages/notebook/notebook_item_f_simple.dart'; | 13 | import 'package:one_key/pages/notebook/notebook_item_f_simple.dart'; |
| @@ -28,11 +31,17 @@ import 'package:provider/provider.dart'; | @@ -28,11 +31,17 @@ import 'package:provider/provider.dart'; | ||
| 28 | import 'package:table_calendar/table_calendar.dart'; | 31 | import 'package:table_calendar/table_calendar.dart'; |
| 29 | 32 | ||
| 30 | import '../../models/note_book_only_model.dart'; | 33 | import '../../models/note_book_only_model.dart'; |
| 34 | +import '../../models/reserve_deposit_model.dart'; | ||
| 31 | import '../../provider/collect_store_provider.dart'; | 35 | import '../../provider/collect_store_provider.dart'; |
| 32 | import '../../provider/marketing_center_provider.dart'; | 36 | import '../../provider/marketing_center_provider.dart'; |
| 37 | +import '../../provider/notebook_detail_model.dart'; | ||
| 33 | import '../../provider/store_base_info_provider.dart'; | 38 | import '../../provider/store_base_info_provider.dart'; |
| 34 | import '../../provider/table_manage_model.dart'; | 39 | import '../../provider/table_manage_model.dart'; |
| 35 | import '../../utils/screen_util.dart'; | 40 | import '../../utils/screen_util.dart'; |
| 41 | +import '../../widgets/loading.dart'; | ||
| 42 | +import '../../widgets/round_button.dart'; | ||
| 43 | + | ||
| 44 | +typedef void CancelCallback(String reseon); | ||
| 36 | 45 | ||
| 37 | class NoteBookPage extends StatefulWidget { | 46 | class NoteBookPage extends StatefulWidget { |
| 38 | final int tabIndex; | 47 | final int tabIndex; |
| @@ -88,7 +97,9 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -88,7 +97,9 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 88 | DateTime? date; | 97 | DateTime? date; |
| 89 | 98 | ||
| 90 | String? solt; | 99 | String? solt; |
| 91 | - | 100 | + late StateSetter _cancelState; |
| 101 | + late NotebookDetailModel detailModel | ||
| 102 | + ; | ||
| 92 | 103 | ||
| 93 | // String? roleName = | 104 | // String? roleName = |
| 94 | // Provider.of<UserModel>(context, listen: false).user!.role_name; | 105 | // Provider.of<UserModel>(context, listen: false).user!.role_name; |
| @@ -98,12 +109,8 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -98,12 +109,8 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 98 | // TODO: implement initState | 109 | // TODO: implement initState |
| 99 | super.initState(); | 110 | super.initState(); |
| 100 | 111 | ||
| 101 | - | ||
| 102 | - date = widget.date; | 112 | + date = widget.date; |
| 103 | solt = widget.solt; | 113 | solt = widget.solt; |
| 104 | - | ||
| 105 | - | ||
| 106 | - | ||
| 107 | 114 | ||
| 108 | // tabIndex = widget.tabIndex; | 115 | // tabIndex = widget.tabIndex; |
| 109 | if (widget.tabIndex == 1) { | 116 | if (widget.tabIndex == 1) { |
| @@ -184,8 +191,6 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -184,8 +191,6 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 184 | super.dispose(); | 191 | super.dispose(); |
| 185 | bus.off("refresh_book_list"); | 192 | bus.off("refresh_book_list"); |
| 186 | 193 | ||
| 187 | - | ||
| 188 | - | ||
| 189 | // _calendarController.dispose(); | 194 | // _calendarController.dispose(); |
| 190 | } | 195 | } |
| 191 | 196 | ||
| @@ -669,6 +674,823 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -669,6 +674,823 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 669 | getCheckValue(); | 674 | getCheckValue(); |
| 670 | } | 675 | } |
| 671 | 676 | ||
| 677 | + ///处理在线预订 | ||
| 678 | + setReserveStatus(String status, NoteBookOnlySunModel notebook, | ||
| 679 | + {String? desc}) async { | ||
| 680 | + // bus.emit("remove_untreated_message",widget.mid); | ||
| 681 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 682 | + | ||
| 683 | + Map<String, String?> params = { | ||
| 684 | + "rid": notebook.id, | ||
| 685 | + "status": status, //5安排包间 2:确认到店(到店),3:用餐完成(离店),4:取消预定,5:分配包间:6:拒单 | ||
| 686 | + // "uid": userModel.user.openid, | ||
| 687 | + 'uid': notebook.uid | ||
| 688 | + }; | ||
| 689 | + if (status == '4') { | ||
| 690 | + Map<String, String?> causeMap = { | ||
| 691 | + "uid": userModel.user!.openid, | ||
| 692 | + "uname": userModel.user!.nickName, | ||
| 693 | + "desc": desc, | ||
| 694 | + }; | ||
| 695 | + params["cause"] = json.encode(causeMap); | ||
| 696 | + } | ||
| 697 | + params['note_name'] = userModel.user!.account; | ||
| 698 | + | ||
| 699 | + bool success = await detailModel.setReserveStatusOnly(context, params, | ||
| 700 | + ifPush: false, notebook: notebook); | ||
| 701 | + if (success) { | ||
| 702 | + bus.emit("refresh_book_list"); | ||
| 703 | + if (status == "4" && notebook.phone != null && notebook.phone != '') { | ||
| 704 | + getDzSellerConf(notebook.id); | ||
| 705 | + // //取消预订 | ||
| 706 | + // bus.emit("refresh_tablemanager"); //刷新桌位 | ||
| 707 | + } | ||
| 708 | + // if (status == "4") { | ||
| 709 | + // //取消预订 | ||
| 710 | + // bus.emit("refresh_tablemanager"); //刷新桌位 | ||
| 711 | + // } | ||
| 712 | + // _getReserveDetail(); | ||
| 713 | + } | ||
| 714 | + } | ||
| 715 | + | ||
| 716 | + getDzSellerConf(String? rid) async { | ||
| 717 | + MarketingCenterProvider marketingCenterProvider = | ||
| 718 | + Provider.of<MarketingCenterProvider>(context, listen: false); | ||
| 719 | + bool success = await marketingCenterProvider.getDzSellerConf(context); | ||
| 720 | + if (success && marketingCenterProvider.dzSellerConfModel != null) { | ||
| 721 | + bool selectSms = | ||
| 722 | + marketingCenterProvider.dzSellerConfModel!.isOpenCancel == '1' | ||
| 723 | + ? true | ||
| 724 | + : false; | ||
| 725 | + | ||
| 726 | + if (selectSms) { | ||
| 727 | + Map<String, String?> pramas = { | ||
| 728 | + 'rid': rid, | ||
| 729 | + 'sid': Provider.of<UserModel>(context, listen: false).user!.sellerid, | ||
| 730 | + }; | ||
| 731 | + | ||
| 732 | + detailModel.wxSendCancelSms(context, pramas); | ||
| 733 | + } | ||
| 734 | + } | ||
| 735 | + } | ||
| 736 | + | ||
| 737 | + Widget _depositWidget( | ||
| 738 | + List<ReserveDepositSunModel> reserveDepositList, | ||
| 739 | + List<Map<String, dynamic>> depositReasonList, | ||
| 740 | + FocusNode _depositNode, | ||
| 741 | + TextEditingController _depositController, | ||
| 742 | + CancelCallback callback) { | ||
| 743 | + return Column( | ||
| 744 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 745 | + children: [ | ||
| 746 | + Container( | ||
| 747 | + padding: EdgeInsets.symmetric(horizontal: w(24)), | ||
| 748 | + height: ScreenUtil().setWidth(48), | ||
| 749 | + child: Text( | ||
| 750 | + '请选择预订订金走向', | ||
| 751 | + style: TextStyle( | ||
| 752 | + fontSize: ScreenUtil().setSp(32), | ||
| 753 | + fontWeight: FontWeight.bold, | ||
| 754 | + decoration: TextDecoration.none, | ||
| 755 | + color: MyColours.color_E5000000), | ||
| 756 | + ), | ||
| 757 | + ), | ||
| 758 | + VEmptyView(40), | ||
| 759 | + Container( | ||
| 760 | + padding: EdgeInsets.symmetric(horizontal: w(24)), | ||
| 761 | + child: Wrap( | ||
| 762 | + runSpacing: w(20), | ||
| 763 | + // mainAxisSize: MainAxisSize.min, | ||
| 764 | + children: depositReasonList.map((value) { | ||
| 765 | + return GestureDetector( | ||
| 766 | + onTap: () { | ||
| 767 | + FocusScope.of(context).requestFocus(new FocusNode()); | ||
| 768 | + for (var item in depositReasonList) { | ||
| 769 | + item['select'] = false; | ||
| 770 | + // isShowTF = false; | ||
| 771 | + | ||
| 772 | + if (item['title'] == value['title']) { | ||
| 773 | + item['select'] = true; | ||
| 774 | + callback(item['title']); | ||
| 775 | + } | ||
| 776 | + } | ||
| 777 | + _cancelState(() {}); | ||
| 778 | + }, | ||
| 779 | + child: Row( | ||
| 780 | + mainAxisSize: MainAxisSize.min, | ||
| 781 | + children: [ | ||
| 782 | + Image.asset( | ||
| 783 | + value['select'] | ||
| 784 | + ? 'assets/select.png' | ||
| 785 | + : 'assets/unselect.png', | ||
| 786 | + width: ScreenUtil().setWidth(48)), | ||
| 787 | + HEmptyView(16), | ||
| 788 | + value['title'] == '其他原因' | ||
| 789 | + ? Expanded( | ||
| 790 | + child: Container( | ||
| 791 | + // height: w(42), | ||
| 792 | + | ||
| 793 | + decoration: BoxDecoration( | ||
| 794 | + color: MyColours.color_f3f3f3, | ||
| 795 | + borderRadius: BorderRadius.circular(r(4))), | ||
| 796 | + padding: EdgeInsets.only( | ||
| 797 | + left: w(8), top: w(10), bottom: w(10)), | ||
| 798 | + child: TextField( | ||
| 799 | + maxLines: 1, | ||
| 800 | + controller: _depositController, | ||
| 801 | + focusNode: _depositNode, | ||
| 802 | + | ||
| 803 | + // textAlignVertical: | ||
| 804 | + // TextAlignVertical | ||
| 805 | + // .bottom, | ||
| 806 | + | ||
| 807 | + decoration: InputDecoration( | ||
| 808 | + isCollapsed: true, | ||
| 809 | + contentPadding: EdgeInsets.zero, | ||
| 810 | + hintText: "其他", | ||
| 811 | + hintStyle: TextStyle( | ||
| 812 | + color: MyColours.color_999999, | ||
| 813 | + fontSize: ScreenUtil().setSp(30), | ||
| 814 | + ), | ||
| 815 | + border: InputBorder.none, | ||
| 816 | + ), | ||
| 817 | + onChanged: (value) { | ||
| 818 | + // if (depositReasonList[4]['select']) { | ||
| 819 | + // callback(value); | ||
| 820 | + // } | ||
| 821 | + }, | ||
| 822 | + onEditingComplete: () { | ||
| 823 | + print('fff'); | ||
| 824 | + _depositNode.unfocus(); | ||
| 825 | + }, | ||
| 826 | + // keyboardType: TextInputType.numberWithOptions(decimal: true), | ||
| 827 | + ), | ||
| 828 | + )) | ||
| 829 | + : Container( | ||
| 830 | + width: w(100), | ||
| 831 | + child: Text(value['title'], | ||
| 832 | + style: TextStyle( | ||
| 833 | + overflow: TextOverflow.ellipsis, | ||
| 834 | + fontSize: ScreenUtil().setSp(32), | ||
| 835 | + fontWeight: FontWeight.normal, | ||
| 836 | + decoration: TextDecoration.none, | ||
| 837 | + color: MyColours.color_E5000000))) | ||
| 838 | + ], | ||
| 839 | + ), | ||
| 840 | + ); | ||
| 841 | + }).toList(), | ||
| 842 | + )), | ||
| 843 | + VEmptyView(34), | ||
| 844 | + // MyDivider(double.infinity, w(1), color: MyColours.color_E7E7E7) | ||
| 845 | + ], | ||
| 846 | + ); | ||
| 847 | + } | ||
| 848 | + | ||
| 849 | + ///取消预订弹框 | ||
| 850 | + _showCancelWidget(context, NoteBookOnlySunModel notebook, | ||
| 851 | + List<ReserveDepositSunModel> reserveDepositList) { | ||
| 852 | + List<Map<String, dynamic>> cancelReasonList = [ | ||
| 853 | + {'title': '顾客取消', 'select': false}, | ||
| 854 | + {'title': '顾客行程有变', 'select': false}, | ||
| 855 | + {'title': '操作失误', 'select': false}, | ||
| 856 | + {'title': '信息填写有误', 'select': false}, | ||
| 857 | + {'title': '其他原因', 'select': false}, | ||
| 858 | + ]; | ||
| 859 | + List<Map<String, dynamic>> depositReasonList = [ | ||
| 860 | + {'title': '订金已退', 'select': false}, | ||
| 861 | + {'title': '充入会员卡', 'select': false}, | ||
| 862 | + {'title': '留下次使用', 'select': false}, | ||
| 863 | + {'title': '抵做餐费用', 'select': false}, | ||
| 864 | + {'title': '其他原因', 'select': false}, | ||
| 865 | + ]; | ||
| 866 | + FocusNode _depositNode = FocusNode(); | ||
| 867 | + TextEditingController _depositController = TextEditingController(); | ||
| 868 | + ScrollController _scrollController = ScrollController(); | ||
| 869 | + | ||
| 870 | + FocusNode _cancelNode = FocusNode(); | ||
| 871 | + TextEditingController _cancelController = TextEditingController(); | ||
| 872 | + String? desc2 = ''; | ||
| 873 | + showGeneralDialog( | ||
| 874 | + context: context, | ||
| 875 | + barrierDismissible: false, | ||
| 876 | + barrierLabel: | ||
| 877 | + MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 878 | + transitionDuration: const Duration(milliseconds: 150), | ||
| 879 | + pageBuilder: (BuildContext context, Animation animation, | ||
| 880 | + Animation secondaryAnimation) { | ||
| 881 | + return StatefulBuilder(builder: (context, state) { | ||
| 882 | + _cancelState = state; | ||
| 883 | + return Scaffold( | ||
| 884 | + backgroundColor: Colors.transparent, | ||
| 885 | + body: Center( | ||
| 886 | + child: Container( | ||
| 887 | + padding: EdgeInsets.symmetric( | ||
| 888 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 889 | + // height: ScreenUtil().setWidth(421 * 2), | ||
| 890 | + decoration: BoxDecoration( | ||
| 891 | + borderRadius: | ||
| 892 | + BorderRadius.circular(ScreenUtil().setWidth(16))), | ||
| 893 | + child: SingleChildScrollView( | ||
| 894 | + child: Card( | ||
| 895 | + shape: RoundedRectangleBorder( | ||
| 896 | + borderRadius: BorderRadius.all(Radius.circular( | ||
| 897 | + ScreenUtil().setWidth(10)))), //设置圆角 | ||
| 898 | + child: Container( | ||
| 899 | + child: Column( | ||
| 900 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 901 | + mainAxisSize: MainAxisSize.min, | ||
| 902 | + children: [ | ||
| 903 | + VEmptyView(48), | ||
| 904 | + // Stack( | ||
| 905 | + // children: [ | ||
| 906 | + | ||
| 907 | + // VEmptyView(40), | ||
| 908 | + SingleChildScrollView( | ||
| 909 | + controller: _scrollController, | ||
| 910 | + child: Column( | ||
| 911 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 912 | + children: [ | ||
| 913 | + Container( | ||
| 914 | + padding: EdgeInsets.symmetric( | ||
| 915 | + horizontal: w(24)), | ||
| 916 | + height: ScreenUtil().setWidth(48), | ||
| 917 | + child: Text( | ||
| 918 | + '请选择取消原因', | ||
| 919 | + style: TextStyle( | ||
| 920 | + fontSize: ScreenUtil().setSp(32), | ||
| 921 | + fontWeight: FontWeight.bold, | ||
| 922 | + decoration: TextDecoration.none, | ||
| 923 | + color: MyColours.color_E5000000), | ||
| 924 | + ), | ||
| 925 | + ), | ||
| 926 | + VEmptyView(40), | ||
| 927 | + Container( | ||
| 928 | + padding: EdgeInsets.symmetric( | ||
| 929 | + horizontal: w(24)), | ||
| 930 | + child: Wrap( | ||
| 931 | + runSpacing: w(20), | ||
| 932 | + // mainAxisSize: MainAxisSize.min, | ||
| 933 | + children: | ||
| 934 | + cancelReasonList.map((value) { | ||
| 935 | + return GestureDetector( | ||
| 936 | + onTap: () { | ||
| 937 | + FocusScope.of(context) | ||
| 938 | + .requestFocus( | ||
| 939 | + new FocusNode()); | ||
| 940 | + for (var item | ||
| 941 | + in cancelReasonList) { | ||
| 942 | + item['select'] = false; | ||
| 943 | + // isShowTF = false; | ||
| 944 | + | ||
| 945 | + if (item['title'] == | ||
| 946 | + value['title']) { | ||
| 947 | + item['select'] = true; | ||
| 948 | + // if (item['title'] == | ||
| 949 | + // '其他原因') { | ||
| 950 | + // isShowTF = true; | ||
| 951 | + // } | ||
| 952 | + } | ||
| 953 | + } | ||
| 954 | + state(() {}); | ||
| 955 | + }, | ||
| 956 | + child: Row( | ||
| 957 | + mainAxisSize: MainAxisSize.min, | ||
| 958 | + children: [ | ||
| 959 | + Image.asset( | ||
| 960 | + value['select'] | ||
| 961 | + ? 'assets/select.png' | ||
| 962 | + : 'assets/unselect.png', | ||
| 963 | + width: ScreenUtil() | ||
| 964 | + .setWidth(48)), | ||
| 965 | + HEmptyView(16), | ||
| 966 | + value['title'] == '其他原因' | ||
| 967 | + ? Expanded( | ||
| 968 | + child: Container( | ||
| 969 | + // height: w(42), | ||
| 970 | + | ||
| 971 | + decoration: BoxDecoration( | ||
| 972 | + color: MyColours | ||
| 973 | + .color_f3f3f3, | ||
| 974 | + borderRadius: | ||
| 975 | + BorderRadius | ||
| 976 | + .circular( | ||
| 977 | + r(4))), | ||
| 978 | + padding: | ||
| 979 | + EdgeInsets.only( | ||
| 980 | + left: w(8), | ||
| 981 | + top: w(10), | ||
| 982 | + bottom: | ||
| 983 | + w(10)), | ||
| 984 | + child: TextField( | ||
| 985 | + maxLines: 1, | ||
| 986 | + controller: | ||
| 987 | + _cancelController, | ||
| 988 | + focusNode: | ||
| 989 | + _cancelNode, | ||
| 990 | + | ||
| 991 | + // textAlignVertical: | ||
| 992 | + // TextAlignVertical | ||
| 993 | + // .bottom, | ||
| 994 | + | ||
| 995 | + decoration: | ||
| 996 | + InputDecoration( | ||
| 997 | + isCollapsed: true, | ||
| 998 | + contentPadding: | ||
| 999 | + EdgeInsets | ||
| 1000 | + .zero, | ||
| 1001 | + hintText: "其他", | ||
| 1002 | + hintStyle: | ||
| 1003 | + TextStyle( | ||
| 1004 | + color: MyColours | ||
| 1005 | + .color_999999, | ||
| 1006 | + fontSize: | ||
| 1007 | + ScreenUtil() | ||
| 1008 | + .setSp( | ||
| 1009 | + 30), | ||
| 1010 | + ), | ||
| 1011 | + border: | ||
| 1012 | + InputBorder | ||
| 1013 | + .none, | ||
| 1014 | + ), | ||
| 1015 | + onChanged: (_) {}, | ||
| 1016 | + onEditingComplete: | ||
| 1017 | + () { | ||
| 1018 | + print('fff'); | ||
| 1019 | + _cancelNode | ||
| 1020 | + .unfocus(); | ||
| 1021 | + }, | ||
| 1022 | + // keyboardType: TextInputType.numberWithOptions(decimal: true), | ||
| 1023 | + ), | ||
| 1024 | + )) | ||
| 1025 | + : Container( | ||
| 1026 | + width: w(100), | ||
| 1027 | + child: Text( | ||
| 1028 | + value['title'], | ||
| 1029 | + style: TextStyle( | ||
| 1030 | + overflow: | ||
| 1031 | + TextOverflow | ||
| 1032 | + .ellipsis, | ||
| 1033 | + fontSize: | ||
| 1034 | + ScreenUtil() | ||
| 1035 | + .setSp( | ||
| 1036 | + 32), | ||
| 1037 | + fontWeight: | ||
| 1038 | + FontWeight | ||
| 1039 | + .normal, | ||
| 1040 | + decoration: | ||
| 1041 | + TextDecoration | ||
| 1042 | + .none, | ||
| 1043 | + color: MyColours | ||
| 1044 | + .color_E5000000))) | ||
| 1045 | + ], | ||
| 1046 | + ), | ||
| 1047 | + ); | ||
| 1048 | + }).toList(), | ||
| 1049 | + )), | ||
| 1050 | + VEmptyView(34), | ||
| 1051 | + if (reserveDepositList.length > 0) | ||
| 1052 | + _depositWidget( | ||
| 1053 | + reserveDepositList, | ||
| 1054 | + depositReasonList, | ||
| 1055 | + _depositNode, | ||
| 1056 | + _depositController, (value) { | ||
| 1057 | + //定金走向 | ||
| 1058 | + desc2 = value; | ||
| 1059 | + }), | ||
| 1060 | + MyDivider(double.infinity, w(1), | ||
| 1061 | + color: MyColours.color_E7E7E7) | ||
| 1062 | + ], | ||
| 1063 | + )), | ||
| 1064 | + // VEmptyView(15), | ||
| 1065 | + | ||
| 1066 | + Row( | ||
| 1067 | + // mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 1068 | + children: [ | ||
| 1069 | + RoundButton( | ||
| 1070 | + text: '取消', | ||
| 1071 | + width: (ScreenUtil().screenWidth - | ||
| 1072 | + ScreenUtil().setWidth(62) * 2) / | ||
| 1073 | + 2, | ||
| 1074 | + height: ScreenUtil().setWidth(112), | ||
| 1075 | + // radius: ScreenUtil().setWidth(10), | ||
| 1076 | + gradientStart: Colors.transparent, | ||
| 1077 | + gradientEnd: Colors.transparent, | ||
| 1078 | + textColor: MyColours.color_E6000000, | ||
| 1079 | + isBold: false, | ||
| 1080 | + fontSize: 34, | ||
| 1081 | + onPressed: () { | ||
| 1082 | + Navigator.of(context).pop(); | ||
| 1083 | + }), | ||
| 1084 | + MyDivider(ScreenUtil().setWidth(2), | ||
| 1085 | + ScreenUtil().setWidth(112), | ||
| 1086 | + color: MyColours.color_DBDBDB), | ||
| 1087 | + RoundButton( | ||
| 1088 | + text: '确定', | ||
| 1089 | + width: (ScreenUtil().screenWidth - | ||
| 1090 | + ScreenUtil().setWidth(62) * 2) / | ||
| 1091 | + 2, | ||
| 1092 | + height: ScreenUtil().setWidth(112), | ||
| 1093 | + // radius: ScreenUtil().setWidth(10), | ||
| 1094 | + gradientStart: Colors.transparent, | ||
| 1095 | + gradientEnd: Colors.transparent, | ||
| 1096 | + textColor: MyColours.color_438E93, | ||
| 1097 | + fontSize: 34, | ||
| 1098 | + onPressed: () async { | ||
| 1099 | + String? desc = ''; | ||
| 1100 | + for (var value in cancelReasonList) { | ||
| 1101 | + if (value['select'] == true) { | ||
| 1102 | + desc = value['title']; | ||
| 1103 | + if (value['title'] == '其他原因') { | ||
| 1104 | + desc = | ||
| 1105 | + _cancelController.text.trim(); | ||
| 1106 | + if (desc.isEmpty) { | ||
| 1107 | + Utils.showToast("请填写取消原因"); | ||
| 1108 | + return; | ||
| 1109 | + } | ||
| 1110 | + } | ||
| 1111 | + } | ||
| 1112 | + } | ||
| 1113 | + | ||
| 1114 | + if (desc == '') { | ||
| 1115 | + Utils.showToast('请选择取消原因'); | ||
| 1116 | + return; | ||
| 1117 | + } | ||
| 1118 | + | ||
| 1119 | + if (reserveDepositList.length > 0) { | ||
| 1120 | + // for (var value in depositReasonList) { | ||
| 1121 | + // if (value['select'] == true) { | ||
| 1122 | + // desc2 = value['title']; | ||
| 1123 | + // if (value['title'] == '其他原因') { | ||
| 1124 | + // desc2 = _depositController.text | ||
| 1125 | + // .trim(); | ||
| 1126 | + // if (desc2.isEmpty) { | ||
| 1127 | + // Utils.showToast("请填写预订订金走向"); | ||
| 1128 | + // return; | ||
| 1129 | + // } | ||
| 1130 | + // } | ||
| 1131 | + // } | ||
| 1132 | + // } | ||
| 1133 | + | ||
| 1134 | + if (desc2 == '') { | ||
| 1135 | + Utils.showToast('请选择预订订金走向'); | ||
| 1136 | + return; | ||
| 1137 | + } else if (desc2 == '其他原因' && | ||
| 1138 | + _depositController.text | ||
| 1139 | + .trim() | ||
| 1140 | + .length == | ||
| 1141 | + 0) { | ||
| 1142 | + Utils.showToast('请填写预订订金走向'); | ||
| 1143 | + return; | ||
| 1144 | + } | ||
| 1145 | + } | ||
| 1146 | + | ||
| 1147 | + Navigator.of(context).pop(); | ||
| 1148 | + Loading.showLoading(context); | ||
| 1149 | + | ||
| 1150 | + await setReserveStatus( | ||
| 1151 | + '4', | ||
| 1152 | + notebook, | ||
| 1153 | + desc: desc, | ||
| 1154 | + ); | ||
| 1155 | + | ||
| 1156 | + if (reserveDepositList.length > 0) { | ||
| 1157 | + Map<String, String?> pramas = { | ||
| 1158 | + 'rid': notebook.id, | ||
| 1159 | + 'cancel': desc2 == '其他原因' | ||
| 1160 | + ? _depositController.text | ||
| 1161 | + : desc2 | ||
| 1162 | + }; | ||
| 1163 | + | ||
| 1164 | + await detailModel.setReserveDeposit( | ||
| 1165 | + context, pramas); | ||
| 1166 | + } | ||
| 1167 | + }), | ||
| 1168 | + ], | ||
| 1169 | + ), | ||
| 1170 | + ], | ||
| 1171 | + ), | ||
| 1172 | + ), | ||
| 1173 | + )), | ||
| 1174 | + ), | ||
| 1175 | + )); | ||
| 1176 | + }); | ||
| 1177 | + }); | ||
| 1178 | + } | ||
| 1179 | + | ||
| 1180 | + // ///取消预订弹框 | ||
| 1181 | + // _showCancelWidget(context, NoteBookOnlySunModel notebook) { | ||
| 1182 | + // // _scrollController = ScrollController(); | ||
| 1183 | + // FocusNode _cancelNode = FocusNode(); | ||
| 1184 | + // TextEditingController _cancelController = TextEditingController(); | ||
| 1185 | + | ||
| 1186 | + // /// 初始化取消原因数据 | ||
| 1187 | + // List cancelReasonList = []; | ||
| 1188 | + // cancelReasonList = [ | ||
| 1189 | + // {'title': '顾客取消', 'select': false}, | ||
| 1190 | + // {'title': '顾客行程有变', 'select': false}, | ||
| 1191 | + // {'title': '信息填写有误', 'select': false}, | ||
| 1192 | + // {'title': '操作失误', 'select': false}, | ||
| 1193 | + // {'title': '其他原因', 'select': false}, | ||
| 1194 | + // ]; | ||
| 1195 | + // showGeneralDialog( | ||
| 1196 | + // context: context, | ||
| 1197 | + // barrierDismissible: false, | ||
| 1198 | + // barrierLabel: | ||
| 1199 | + // MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 1200 | + // transitionDuration: const Duration(milliseconds: 150), | ||
| 1201 | + // barrierColor: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 1202 | + // pageBuilder: (BuildContext context, Animation animation, | ||
| 1203 | + // Animation secondaryAnimation) { | ||
| 1204 | + // return Scaffold( | ||
| 1205 | + // backgroundColor: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 1206 | + // body: StatefulBuilder(builder: (context, state) { | ||
| 1207 | + // // _cancelState = state; | ||
| 1208 | + // return GestureDetector( | ||
| 1209 | + // behavior: HitTestBehavior.opaque, | ||
| 1210 | + // // onTap: () { | ||
| 1211 | + // // Navigator.of(context).pop(); | ||
| 1212 | + // // }, | ||
| 1213 | + // child: Center( | ||
| 1214 | + // child: Container( | ||
| 1215 | + // margin: EdgeInsets.symmetric( | ||
| 1216 | + // horizontal: ScreenUtil().setWidth(28 * 2)), | ||
| 1217 | + // padding: EdgeInsets.symmetric( | ||
| 1218 | + // horizontal: ScreenUtil().setWidth(32)), | ||
| 1219 | + // decoration: BoxDecoration( | ||
| 1220 | + // color: Colors.white, | ||
| 1221 | + // borderRadius: | ||
| 1222 | + // BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 1223 | + // ), | ||
| 1224 | + // height: ScreenUtil().setWidth(355 * 2), | ||
| 1225 | + // child: Column( | ||
| 1226 | + // // mainAxisSize: MainAxisSize.min, | ||
| 1227 | + // children: [ | ||
| 1228 | + // // Stack( | ||
| 1229 | + // // children: [ | ||
| 1230 | + // VEmptyView(48), | ||
| 1231 | + // Container( | ||
| 1232 | + // height: ScreenUtil().setWidth(48), | ||
| 1233 | + // child: Text( | ||
| 1234 | + // '是否确定取消预订', | ||
| 1235 | + // style: TextStyle( | ||
| 1236 | + // fontSize: ScreenUtil().setSp(32), | ||
| 1237 | + // fontWeight: FontWeight.bold, | ||
| 1238 | + // decoration: TextDecoration.none, | ||
| 1239 | + // color: Color.fromRGBO(0, 0, 0, 0.9)), | ||
| 1240 | + // ), | ||
| 1241 | + // ), | ||
| 1242 | + // // Positioned( | ||
| 1243 | + // // top: ScreenUtil().setWidth(8), | ||
| 1244 | + // // right: ScreenUtil().setWidth(0), | ||
| 1245 | + // // child: GestureDetector( | ||
| 1246 | + // // onTap: () { | ||
| 1247 | + // // _initCancel(); | ||
| 1248 | + // // Navigator.of(context).pop(); | ||
| 1249 | + // // }, | ||
| 1250 | + // // child: Container( | ||
| 1251 | + // // padding: EdgeInsets.only(left: 20), | ||
| 1252 | + // // child: Image.asset( | ||
| 1253 | + // // 'assets/close.png', | ||
| 1254 | + // // width: ScreenUtil().setWidth(32), | ||
| 1255 | + // // height: ScreenUtil().setWidth(32), | ||
| 1256 | + // // ), | ||
| 1257 | + // // ))) | ||
| 1258 | + // // ], | ||
| 1259 | + // // ), | ||
| 1260 | + // VEmptyView(40), | ||
| 1261 | + // Container( | ||
| 1262 | + // child: Column( | ||
| 1263 | + // // mainAxisSize: MainAxisSize.min, | ||
| 1264 | + // children: cancelReasonList.map((value) { | ||
| 1265 | + // return value['title'] == '其他原因' | ||
| 1266 | + // ? SizedBox() | ||
| 1267 | + // : GestureDetector( | ||
| 1268 | + // onTap: () { | ||
| 1269 | + // for (var item in cancelReasonList) { | ||
| 1270 | + // item['select'] = false; | ||
| 1271 | + // // isShowTF = false; | ||
| 1272 | + // // paddingBottom = | ||
| 1273 | + // // ScreenUtil().screenHeight.ceil() - | ||
| 1274 | + // // 138 - | ||
| 1275 | + // // 340; | ||
| 1276 | + // if (item['title'] == | ||
| 1277 | + // value['title']) { | ||
| 1278 | + // item['select'] = true; | ||
| 1279 | + // // if (item['title'] == '其他原因') { | ||
| 1280 | + // // // isShowTF = true; | ||
| 1281 | + // // // paddingBottom = 130; | ||
| 1282 | + // // // paddingBottom = | ||
| 1283 | + // // // ScreenUtil().screenHeight.ceil() - | ||
| 1284 | + // // // 138 - | ||
| 1285 | + // // // 340 - | ||
| 1286 | + // // // 46; | ||
| 1287 | + // // } | ||
| 1288 | + // } | ||
| 1289 | + // } | ||
| 1290 | + // state(() {}); | ||
| 1291 | + // }, | ||
| 1292 | + // child: Container( | ||
| 1293 | + // height: ScreenUtil().setWidth(48), | ||
| 1294 | + // margin: EdgeInsets.only( | ||
| 1295 | + // bottom: | ||
| 1296 | + // ScreenUtil().setWidth(40)), | ||
| 1297 | + // child: Row( | ||
| 1298 | + // children: [ | ||
| 1299 | + // Image.asset( | ||
| 1300 | + // value['select'] | ||
| 1301 | + // ? 'assets/select.png' | ||
| 1302 | + // : 'assets/unselect.png', | ||
| 1303 | + // width: ScreenUtil() | ||
| 1304 | + // .setWidth(42)), | ||
| 1305 | + // HEmptyView(20), | ||
| 1306 | + // Container( | ||
| 1307 | + // child: Text(value['title'], | ||
| 1308 | + // style: TextStyle( | ||
| 1309 | + // fontSize: ScreenUtil() | ||
| 1310 | + // .setSp(32), | ||
| 1311 | + // fontWeight: | ||
| 1312 | + // FontWeight.normal, | ||
| 1313 | + // decoration: | ||
| 1314 | + // TextDecoration | ||
| 1315 | + // .none, | ||
| 1316 | + // color: MyColours | ||
| 1317 | + // .color_333333))) | ||
| 1318 | + // ], | ||
| 1319 | + // ), | ||
| 1320 | + // ), | ||
| 1321 | + // ); | ||
| 1322 | + // }).toList(), | ||
| 1323 | + // )), | ||
| 1324 | + // Material( | ||
| 1325 | + // child: Container( | ||
| 1326 | + // color: Colors.white, | ||
| 1327 | + // height: ScreenUtil().setWidth(42 * 2), | ||
| 1328 | + // child: Row(children: [ | ||
| 1329 | + // InkWell( | ||
| 1330 | + // onTap: () { | ||
| 1331 | + // for (var item in cancelReasonList) { | ||
| 1332 | + // item['select'] = false; | ||
| 1333 | + // } | ||
| 1334 | + // cancelReasonList[4]['select'] = | ||
| 1335 | + // true; | ||
| 1336 | + // state(() {}); | ||
| 1337 | + // }, | ||
| 1338 | + // child: Padding( | ||
| 1339 | + // padding: EdgeInsets.only( | ||
| 1340 | + // right: ScreenUtil() | ||
| 1341 | + // .setWidth(20)), | ||
| 1342 | + // child: Image.asset( | ||
| 1343 | + // cancelReasonList[4]['select'] | ||
| 1344 | + // ? 'assets/select.png' | ||
| 1345 | + // : 'assets/unselect.png', | ||
| 1346 | + // width: ScreenUtil() | ||
| 1347 | + // .setWidth(44)))), | ||
| 1348 | + // Expanded( | ||
| 1349 | + // child: Container( | ||
| 1350 | + // decoration: BoxDecoration( | ||
| 1351 | + // color: Color.fromRGBO( | ||
| 1352 | + // 240, 240, 240, 1), | ||
| 1353 | + // borderRadius: BorderRadius.circular( | ||
| 1354 | + // ScreenUtil().setWidth(8))), | ||
| 1355 | + // // height: ScreenUtil().setWidth(42 * 2), | ||
| 1356 | + // padding: EdgeInsets.symmetric( | ||
| 1357 | + // horizontal: | ||
| 1358 | + // ScreenUtil().setWidth(16)), | ||
| 1359 | + // child: TextField( | ||
| 1360 | + // maxLines: 1, | ||
| 1361 | + // controller: _cancelController, | ||
| 1362 | + // focusNode: _cancelNode, | ||
| 1363 | + // style: TextStyle( | ||
| 1364 | + // textBaseline: | ||
| 1365 | + // TextBaseline.alphabetic), | ||
| 1366 | + // textAlignVertical: | ||
| 1367 | + // TextAlignVertical.center, | ||
| 1368 | + // decoration: InputDecoration( | ||
| 1369 | + // contentPadding: EdgeInsets.zero, | ||
| 1370 | + // hintText: "其他", | ||
| 1371 | + // // focusColor: Color.fromRGBO(0, 0, 0, 0.4), | ||
| 1372 | + // hintStyle: TextStyle( | ||
| 1373 | + // color: | ||
| 1374 | + // Color.fromRGBO(0, 0, 0, 0.4), | ||
| 1375 | + // fontSize: ScreenUtil().setSp(32), | ||
| 1376 | + // ), | ||
| 1377 | + // enabledBorder: OutlineInputBorder( | ||
| 1378 | + // borderSide: BorderSide( | ||
| 1379 | + // width: 0, | ||
| 1380 | + // color: Colors.transparent)), | ||
| 1381 | + // border: OutlineInputBorder( | ||
| 1382 | + // borderSide: BorderSide( | ||
| 1383 | + // width: 0, | ||
| 1384 | + // color: Colors.transparent)), | ||
| 1385 | + // focusedBorder: OutlineInputBorder( | ||
| 1386 | + // borderSide: BorderSide( | ||
| 1387 | + // width: 0, | ||
| 1388 | + // color: Colors.transparent)), | ||
| 1389 | + // ), | ||
| 1390 | + | ||
| 1391 | + // // border: InputBorder.none, | ||
| 1392 | + | ||
| 1393 | + // onChanged: (_) { | ||
| 1394 | + // setState(() {}); | ||
| 1395 | + // }, | ||
| 1396 | + // onEditingComplete: () { | ||
| 1397 | + // print('fff'); | ||
| 1398 | + // _cancelNode.unfocus(); | ||
| 1399 | + // }, | ||
| 1400 | + // // keyboardType: TextInputType.numberWithOptions(decimal: true), | ||
| 1401 | + // ), | ||
| 1402 | + // )) | ||
| 1403 | + // ]))), | ||
| 1404 | + | ||
| 1405 | + // VEmptyView(15), | ||
| 1406 | + // Material( | ||
| 1407 | + // child: RoundButton( | ||
| 1408 | + // onPressed: () { | ||
| 1409 | + // String? desc = ''; | ||
| 1410 | + // for (var value in cancelReasonList) { | ||
| 1411 | + // if (value['select'] == true) { | ||
| 1412 | + // desc = value['title']; | ||
| 1413 | + // if (value['title'] == '其他原因') { | ||
| 1414 | + // desc = _cancelController.text.trim(); | ||
| 1415 | + // if (desc.isEmpty) { | ||
| 1416 | + // Utils.showToast("请填写原因"); | ||
| 1417 | + // return; | ||
| 1418 | + // } | ||
| 1419 | + // } | ||
| 1420 | + // } | ||
| 1421 | + // } | ||
| 1422 | + | ||
| 1423 | + // if (desc == '') { | ||
| 1424 | + // Utils.showToast('请选择原因'); | ||
| 1425 | + // return; | ||
| 1426 | + // } | ||
| 1427 | + | ||
| 1428 | + // Navigator.of(context).pop(); | ||
| 1429 | + // Loading.showLoading(context); | ||
| 1430 | + | ||
| 1431 | + // setReserveStatus( | ||
| 1432 | + // '4', | ||
| 1433 | + // notebook, | ||
| 1434 | + // desc: desc, | ||
| 1435 | + // ); | ||
| 1436 | + // }, | ||
| 1437 | + // text: '确认', | ||
| 1438 | + // height: ScreenUtil().setWidth(80), | ||
| 1439 | + // width: ScreenUtil().setWidth(300), | ||
| 1440 | + // radius: ScreenUtil().setWidth(10), | ||
| 1441 | + // ), | ||
| 1442 | + // ) | ||
| 1443 | + // ], | ||
| 1444 | + // ), | ||
| 1445 | + // ), | ||
| 1446 | + // )); | ||
| 1447 | + // })); | ||
| 1448 | + // }); | ||
| 1449 | + // } | ||
| 1450 | + | ||
| 1451 | + _getIsReserveCancel(bool isCancel, NoteBookOnlySunModel notebook) { | ||
| 1452 | + //判断时间是否可变更 | ||
| 1453 | + | ||
| 1454 | + bool reserveCancel = true; //默认允许变更过去餐段订单的时间 | ||
| 1455 | + //如果不允许变更过去餐段订单的时间,则开始判断 | ||
| 1456 | + //连个条件同时成立: 1.订单的时间是过去 2. 时间改变 | ||
| 1457 | + if (!isCancel) { | ||
| 1458 | + //找到当前餐段对应的时间段 | ||
| 1459 | + | ||
| 1460 | + String? times = storeBaseIndoProvider.dayDateData! | ||
| 1461 | + .where((element) => element.ddateSolt == notebook.ddateSolt) | ||
| 1462 | + .first | ||
| 1463 | + .mdate ?? | ||
| 1464 | + '00:00-23:59'; | ||
| 1465 | + | ||
| 1466 | + //组装时间戳 | ||
| 1467 | + List<String> datas = times.split('-'); | ||
| 1468 | + // DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' + | ||
| 1469 | + // '-' + | ||
| 1470 | + // '${dateTimeSelect.month}' + | ||
| 1471 | + // '-' + | ||
| 1472 | + // '${dateTimeSelect.day}' + | ||
| 1473 | + // ' ${datas[0]}:00'); //选中餐段开始时间戳 | ||
| 1474 | + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | ||
| 1475 | + int.parse(notebook.ddate!) * 1000); | ||
| 1476 | + DateTime selectEtime = DateTime.parse('${dateTime.year}' + | ||
| 1477 | + '-' + | ||
| 1478 | + Utils.addZeroNumber(dateTime.month) + | ||
| 1479 | + '-' + | ||
| 1480 | + Utils.addZeroNumber(dateTime.day) + | ||
| 1481 | + ' ${datas[1]}:00'); //选中餐段结束时间戳 | ||
| 1482 | + // 过去的餐段界定 | ||
| 1483 | + if (selectEtime.isBefore(DateTime.now())) { | ||
| 1484 | +// 属于过去餐段 | ||
| 1485 | + reserveCancel = false; | ||
| 1486 | + } else { | ||
| 1487 | + // 属于未来餐段 | ||
| 1488 | + reserveCancel = true; | ||
| 1489 | + } | ||
| 1490 | + } | ||
| 1491 | + return reserveCancel; | ||
| 1492 | + } | ||
| 1493 | + | ||
| 672 | List<Widget> dsoltWidget() { | 1494 | List<Widget> dsoltWidget() { |
| 673 | List<Widget> data = []; | 1495 | List<Widget> data = []; |
| 674 | storeBaseIndoProvider.dayDateData!.forEach((element) { | 1496 | storeBaseIndoProvider.dayDateData!.forEach((element) { |
| @@ -747,6 +1569,105 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -747,6 +1569,105 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 747 | return data; | 1569 | return data; |
| 748 | } | 1570 | } |
| 749 | 1571 | ||
| 1572 | + /// 通过预订ID查收订金详情 | ||
| 1573 | + _getReserveDepositByRid(String rid) async { | ||
| 1574 | + | ||
| 1575 | + Map<String, String> params = { | ||
| 1576 | + 'rid': rid, | ||
| 1577 | + }; | ||
| 1578 | + | ||
| 1579 | + await detailModel.getReserveDepositByRid(context, params, | ||
| 1580 | + showLoading: true); | ||
| 1581 | + List<ReserveDepositSunModel> reserveDepositList = []; | ||
| 1582 | + detailModel.reserveDepositList!.forEach((element) { | ||
| 1583 | + if (element.payType != '微信预订通知') { | ||
| 1584 | + reserveDepositList.add(element); | ||
| 1585 | + } else if (element.payType == '微信预订通知' && | ||
| 1586 | + element.tradeState == 'SUCCESS') { | ||
| 1587 | + reserveDepositList.add(element); | ||
| 1588 | + } | ||
| 1589 | + }); | ||
| 1590 | + return reserveDepositList; | ||
| 1591 | + } | ||
| 1592 | + | ||
| 1593 | + _cancelReaserve(NoteBookOnlySunModel notebook) async { | ||
| 1594 | + bool isCancel = _getIsReserveCancel(isReserveCancel, notebook); | ||
| 1595 | + | ||
| 1596 | + if (isCancel) { | ||
| 1597 | + bool cancelCan = false; | ||
| 1598 | + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | ||
| 1599 | + int.parse(notebook.ddate!) * 1000); | ||
| 1600 | + String roleName = | ||
| 1601 | + Provider.of<UserModel>(context, listen: false).user!.role_name ?? ''; | ||
| 1602 | + | ||
| 1603 | + if (roleName == '管理员' || roleName == '前台') { | ||
| 1604 | + cancelCan = true; | ||
| 1605 | + } else if (roleName == '店长') { | ||
| 1606 | + if (cancelShopowner) { | ||
| 1607 | + cancelCan = true; | ||
| 1608 | + } else { | ||
| 1609 | + //临餐不可以取消 | ||
| 1610 | + | ||
| 1611 | + //比较相差的天数 | ||
| 1612 | + | ||
| 1613 | + int differenceSeconds = dateTime.difference(DateTime.now()).inSeconds; | ||
| 1614 | + | ||
| 1615 | + if (int.parse(cancelDay!) != 0 && | ||
| 1616 | + differenceSeconds < int.parse(cancelDay!) * 24 * 60 * 60) { | ||
| 1617 | + // 临餐时间内 | ||
| 1618 | + cancelCan = false; | ||
| 1619 | + } else { | ||
| 1620 | + cancelCan = true; | ||
| 1621 | + } | ||
| 1622 | + } | ||
| 1623 | + } else if (roleName == '客户经理') { | ||
| 1624 | + if (cancelManager) { | ||
| 1625 | + cancelCan = true; | ||
| 1626 | + } else { | ||
| 1627 | + //临餐不可以取消 | ||
| 1628 | + | ||
| 1629 | + //比较相差的天数 | ||
| 1630 | + int differenceSeconds = dateTime.difference(DateTime.now()).inSeconds; | ||
| 1631 | + | ||
| 1632 | + if (int.parse(cancelDay!) != 0 && | ||
| 1633 | + differenceSeconds < int.parse(cancelDay!) * 24 * 60 * 60) { | ||
| 1634 | + // 临餐时间内 | ||
| 1635 | + cancelCan = false; | ||
| 1636 | + } else { | ||
| 1637 | + cancelCan = true; | ||
| 1638 | + } | ||
| 1639 | + } | ||
| 1640 | + } else { | ||
| 1641 | + if (cancelOther) { | ||
| 1642 | + cancelCan = true; | ||
| 1643 | + } else { | ||
| 1644 | + //临餐不可以取消 | ||
| 1645 | + | ||
| 1646 | + //比较相差的天数 | ||
| 1647 | + | ||
| 1648 | + int differenceSeconds = dateTime.difference(DateTime.now()).inSeconds; | ||
| 1649 | + | ||
| 1650 | + if (int.parse(cancelDay!) != 0 && | ||
| 1651 | + differenceSeconds < int.parse(cancelDay!) * 24 * 60 * 60) { | ||
| 1652 | + // 临餐时间内 | ||
| 1653 | + cancelCan = false; | ||
| 1654 | + } else { | ||
| 1655 | + cancelCan = true; | ||
| 1656 | + } | ||
| 1657 | + } | ||
| 1658 | + } | ||
| 1659 | + if (cancelCan) { | ||
| 1660 | + List<ReserveDepositSunModel> reserveDepositList = | ||
| 1661 | + await _getReserveDepositByRid(notebook.id!); | ||
| 1662 | + _showCancelWidget(context, notebook, reserveDepositList); | ||
| 1663 | + } else { | ||
| 1664 | + Utils.showToast('临餐不可取消预订!请与前台联系取消。'); | ||
| 1665 | + } | ||
| 1666 | + } else { | ||
| 1667 | + Utils.showToast('过去餐段的订单不可取消预订!请与前台联系取消。'); | ||
| 1668 | + } | ||
| 1669 | + } | ||
| 1670 | + | ||
| 750 | @override | 1671 | @override |
| 751 | Widget build(BuildContext context) { | 1672 | Widget build(BuildContext context) { |
| 752 | // TODO: implement build | 1673 | // TODO: implement build |
| @@ -756,6 +1677,8 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -756,6 +1677,8 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 756 | Provider.of<StoreBaseIndoProvider>(context, listen: true); | 1677 | Provider.of<StoreBaseIndoProvider>(context, listen: true); |
| 757 | collectStoreProvider = | 1678 | collectStoreProvider = |
| 758 | Provider.of<CollectStoreProvider>(context, listen: true); | 1679 | Provider.of<CollectStoreProvider>(context, listen: true); |
| 1680 | + | ||
| 1681 | + detailModel = Provider.of<NotebookDetailModel>(context, listen: true); | ||
| 759 | // int sum = 3; | 1682 | // int sum = 3; |
| 760 | // int hide = 0; | 1683 | // int hide = 0; |
| 761 | // int btnNum = 0; | 1684 | // int btnNum = 0; |
| @@ -1303,28 +2226,47 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -1303,28 +2226,47 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 1303 | child: model.notebooksSort![index].issimple | 2226 | child: model.notebooksSort![index].issimple |
| 1304 | ? NoteBookItemSimple( | 2227 | ? NoteBookItemSimple( |
| 1305 | index, model.notebooksSort![index], | 2228 | index, model.notebooksSort![index], |
| 1306 | - () { | 2229 | + onTapChange: () { |
| 1307 | _itemChangeSimple( | 2230 | _itemChangeSimple( |
| 1308 | model.notebooksSort![index]); | 2231 | model.notebooksSort![index]); |
| 1309 | - }, | ||
| 1310 | - cancelDay, | ||
| 1311 | - cancelShopowner, | ||
| 1312 | - cancelManager, | ||
| 1313 | - cancelOther, | ||
| 1314 | - isReserveCancel) | 2232 | + }, onTapLeave: () { |
| 2233 | + Loading.showLoading(context); | ||
| 2234 | + setReserveStatus( | ||
| 2235 | + '3', model.notebooksSort![index]); | ||
| 2236 | + }, onTapReach: () { | ||
| 2237 | + Loading.showLoading(context); | ||
| 2238 | + setReserveStatus( | ||
| 2239 | + '2', model.notebooksSort![index]); | ||
| 2240 | + }, onTapCancel: () { | ||
| 2241 | + _cancelReaserve( | ||
| 2242 | + model.notebooksSort![index]); | ||
| 2243 | + }) | ||
| 1315 | : NoteBookItemF( | 2244 | : NoteBookItemF( |
| 1316 | index, | 2245 | index, |
| 1317 | model.notebooksSort![index], | 2246 | model.notebooksSort![index], |
| 1318 | collectStoreProvider.sellerPreserve, | 2247 | collectStoreProvider.sellerPreserve, |
| 1319 | - () { | 2248 | + onTapChange: () { |
| 1320 | _itemChangeSimple( | 2249 | _itemChangeSimple( |
| 1321 | model.notebooksSort![index]); | 2250 | model.notebooksSort![index]); |
| 1322 | - }, | ||
| 1323 | - cancelDay, | ||
| 1324 | - cancelShopowner, | ||
| 1325 | - cancelManager, | ||
| 1326 | - cancelOther, | ||
| 1327 | - isReserveCancel), | 2251 | + }, onTapLeave: () { |
| 2252 | + Loading.showLoading(context); | ||
| 2253 | + setReserveStatus( | ||
| 2254 | + '3', model.notebooksSort![index]); | ||
| 2255 | + }, onTapReach: () { | ||
| 2256 | + Loading.showLoading(context); | ||
| 2257 | + setReserveStatus( | ||
| 2258 | + '2', model.notebooksSort![index]); | ||
| 2259 | + }, onTapCancel: () { | ||
| 2260 | + _cancelReaserve( | ||
| 2261 | + model.notebooksSort![index]); | ||
| 2262 | + } | ||
| 2263 | + | ||
| 2264 | + // cancelDay, | ||
| 2265 | + // cancelShopowner, | ||
| 2266 | + // cancelManager, | ||
| 2267 | + // cancelOther, | ||
| 2268 | + // isReserveCancel | ||
| 2269 | + ), | ||
| 1328 | ); | 2270 | ); |
| 1329 | }, childCount: model.notebooksSort!.length), | 2271 | }, childCount: model.notebooksSort!.length), |
| 1330 | // itemExtent: ScreenUtil().setWidth(112), | 2272 | // itemExtent: ScreenUtil().setWidth(112), |
| @@ -352,11 +352,11 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -352,11 +352,11 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 352 | 352 | ||
| 353 | /// 通过预订ID查收订金详情 | 353 | /// 通过预订ID查收订金详情 |
| 354 | Future<List<ReserveDepositSunModel>?> getReserveDepositByRid( | 354 | Future<List<ReserveDepositSunModel>?> getReserveDepositByRid( |
| 355 | - BuildContext context, Map<String, String> params) async { | 355 | + BuildContext context, Map<String, String> params,{bool showLoading=false}) async { |
| 356 | try { | 356 | try { |
| 357 | BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>( | 357 | BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>( |
| 358 | context, Method.post, HttpUrl.get_reserve_deposit_by_rid, | 358 | context, Method.post, HttpUrl.get_reserve_deposit_by_rid, |
| 359 | - data: params, showLoading: false); | 359 | + data: params, showLoading: showLoading); |
| 360 | if (baseResp.code == Constant.status_success) { | 360 | if (baseResp.code == Constant.status_success) { |
| 361 | reserveDepositList = ReserveDepositModel.fromJson( | 361 | reserveDepositList = ReserveDepositModel.fromJson( |
| 362 | baseResp.responseData as Map<String, dynamic>) | 362 | baseResp.responseData as Map<String, dynamic>) |
-
Please register or login to post a comment