Showing
7 changed files
with
482 additions
and
242 deletions
| @@ -503,5 +503,7 @@ class HttpUrl { | @@ -503,5 +503,7 @@ class HttpUrl { | ||
| 503 | 503 | ||
| 504 | static const String get_sai_you_yun_list = | 504 | static const String get_sai_you_yun_list = |
| 505 | "?service=App.SaiYouYun.GetSaiYouYunList"; // 获取赛邮云短信模板列表 | 505 | "?service=App.SaiYouYun.GetSaiYouYunList"; // 获取赛邮云短信模板列表 |
| 506 | + static const String sort_by_region = | ||
| 507 | + "?service=App.Tables.SortByRegion"; // 区域排序 | ||
| 506 | 508 | ||
| 507 | } | 509 | } |
| @@ -410,20 +410,29 @@ class _EditReserverPageState extends State<EditReserverPage> { | @@ -410,20 +410,29 @@ class _EditReserverPageState extends State<EditReserverPage> { | ||
| 410 | } else { | 410 | } else { |
| 411 | nameStr = value; | 411 | nameStr = value; |
| 412 | } | 412 | } |
| 413 | - setState(() { | ||
| 414 | - showPhoneHistory = true; | ||
| 415 | - }); | ||
| 416 | - Map<String, String> params = { | ||
| 417 | - "keywords": value, | ||
| 418 | - "sid": Provider.of<UserModel>(context, | ||
| 419 | - listen: false) | ||
| 420 | - .user | ||
| 421 | - .sellerid, | ||
| 422 | - }; | ||
| 423 | - JhCommonUtils.debounce(() => | ||
| 424 | - detailModel.getUserHistorys( | ||
| 425 | - context, params)); | ||
| 426 | - | 413 | + |
| 414 | + if (detailModel.phoneController.text | ||
| 415 | + .length == | ||
| 416 | + 0 && | ||
| 417 | + value.length > 0) { | ||
| 418 | + detailModel.userHistorys = []; | ||
| 419 | + setState(() { | ||
| 420 | + showPhoneHistory = true; | ||
| 421 | + }); | ||
| 422 | + Map<String, String> params = { | ||
| 423 | + "keywords": value, | ||
| 424 | + "sid": Provider.of<UserModel>(context, | ||
| 425 | + listen: false) | ||
| 426 | + .user | ||
| 427 | + .sellerid, | ||
| 428 | + }; | ||
| 429 | + JhCommonUtils.debounce(() => detailModel | ||
| 430 | + .getUserHistorys(context, params)); | ||
| 431 | + } else { | ||
| 432 | + setState(() { | ||
| 433 | + showPhoneHistory = false; | ||
| 434 | + }); | ||
| 435 | + } | ||
| 427 | }, | 436 | }, |
| 428 | onEditingComplete: () { | 437 | onEditingComplete: () { |
| 429 | print('fff'); | 438 | print('fff'); |
| @@ -518,27 +527,36 @@ class _EditReserverPageState extends State<EditReserverPage> { | @@ -518,27 +527,36 @@ class _EditReserverPageState extends State<EditReserverPage> { | ||
| 518 | }); | 527 | }); |
| 519 | return; | 528 | return; |
| 520 | } | 529 | } |
| 521 | - setState(() { | ||
| 522 | - showPhoneHistory = true; | ||
| 523 | - }); | ||
| 524 | - Map<String, String> params = { | ||
| 525 | - "keywords": value, | ||
| 526 | - "sid": Provider.of<UserModel>(context, | ||
| 527 | - listen: false) | ||
| 528 | - .user | ||
| 529 | - .sellerid, | ||
| 530 | - }; | ||
| 531 | - JhCommonUtils.debounce(() => | ||
| 532 | - detailModel.getUserHistorys( | ||
| 533 | - context, params)); | 530 | + |
| 531 | + if (value.isEmpty || value.length > 0) { | ||
| 532 | + detailModel.userHistorys = []; | ||
| 533 | + setState(() { | ||
| 534 | + showPhoneHistory = true; | ||
| 535 | + }); | ||
| 536 | + Map<String, String> params = { | ||
| 537 | + "keywords": value, | ||
| 538 | + "sid": Provider.of<UserModel>( | ||
| 539 | + context, | ||
| 540 | + listen: false) | ||
| 541 | + .user | ||
| 542 | + .sellerid, | ||
| 543 | + }; | ||
| 544 | + JhCommonUtils.debounce(() => | ||
| 545 | + detailModel.getUserHistorys( | ||
| 546 | + context, params)); | ||
| 547 | + } else { | ||
| 548 | + setState(() { | ||
| 549 | + showPhoneHistory = false; | ||
| 550 | + }); | ||
| 551 | + } | ||
| 534 | }, | 552 | }, |
| 535 | onEditingComplete: () { | 553 | onEditingComplete: () { |
| 536 | _phoneNode.unfocus(); | 554 | _phoneNode.unfocus(); |
| 537 | }, | 555 | }, |
| 538 | onTap: () { | 556 | onTap: () { |
| 539 | - setState(() { | ||
| 540 | - showPhoneHistory = true; | ||
| 541 | - }); | 557 | + // setState(() { |
| 558 | + // showPhoneHistory = true; | ||
| 559 | + // }); | ||
| 542 | // Future.delayed(Duration(milliseconds: 300), () { | 560 | // Future.delayed(Duration(milliseconds: 300), () { |
| 543 | // _controller.jumpTo(_controller.position.maxScrollExtent); | 561 | // _controller.jumpTo(_controller.position.maxScrollExtent); |
| 544 | // }); | 562 | // }); |
| @@ -1737,23 +1737,38 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | @@ -1737,23 +1737,38 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | ||
| 1737 | } else { | 1737 | } else { |
| 1738 | nameStr = value; | 1738 | nameStr = value; |
| 1739 | } | 1739 | } |
| 1740 | - Map<String, String> params = { | ||
| 1741 | - "keywords": value, | ||
| 1742 | - "sid": Provider.of<UserModel>( | ||
| 1743 | - context, | ||
| 1744 | - listen: false) | ||
| 1745 | - .user | ||
| 1746 | - .sellerid, | ||
| 1747 | - }; | ||
| 1748 | - JhCommonUtils.debounce(() => | ||
| 1749 | - _notebookDetailChangeModel | ||
| 1750 | - .getUserHistorys( | ||
| 1751 | - context, params)); | 1740 | + |
| 1741 | + if (_notebookDetailChangeModel | ||
| 1742 | + .phoneController | ||
| 1743 | + .text | ||
| 1744 | + .length == | ||
| 1745 | + 0 && | ||
| 1746 | + value.length > 0) { | ||
| 1747 | + setState(() { | ||
| 1748 | + showPhoneHistory = true; | ||
| 1749 | + }); | ||
| 1750 | + Map<String, String> params = { | ||
| 1751 | + "keywords": value, | ||
| 1752 | + "sid": Provider.of<UserModel>( | ||
| 1753 | + context, | ||
| 1754 | + listen: false) | ||
| 1755 | + .user | ||
| 1756 | + .sellerid, | ||
| 1757 | + }; | ||
| 1758 | + JhCommonUtils.debounce(() => | ||
| 1759 | + _notebookDetailChangeModel | ||
| 1760 | + .getUserHistorys( | ||
| 1761 | + context, params)); | ||
| 1762 | + } else { | ||
| 1763 | + setState(() { | ||
| 1764 | + showPhoneHistory = false; | ||
| 1765 | + }); | ||
| 1766 | + } | ||
| 1752 | }, | 1767 | }, |
| 1753 | onTap: () { | 1768 | onTap: () { |
| 1754 | - setState(() { | ||
| 1755 | - showPhoneHistory = true; | ||
| 1756 | - }); | 1769 | + // setState(() { |
| 1770 | + // showPhoneHistory = true; | ||
| 1771 | + // }); | ||
| 1757 | // Future.delayed(Duration(milliseconds: 300), () { | 1772 | // Future.delayed(Duration(milliseconds: 300), () { |
| 1758 | // _controller.jumpTo(_controller.position.maxScrollExtent); | 1773 | // _controller.jumpTo(_controller.position.maxScrollExtent); |
| 1759 | // }); | 1774 | // }); |
| @@ -1869,28 +1884,38 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | @@ -1869,28 +1884,38 @@ class _NoteBookChangeFPageState extends State<NoteBookChangeFPage> { | ||
| 1869 | }); | 1884 | }); |
| 1870 | return; | 1885 | return; |
| 1871 | } | 1886 | } |
| 1872 | - Map<String, String> params = { | ||
| 1873 | - "keywords": value, | ||
| 1874 | - "sid": Provider.of<UserModel>( | ||
| 1875 | - context, | ||
| 1876 | - listen: false) | ||
| 1877 | - .user | ||
| 1878 | - .sellerid, | ||
| 1879 | - }; | ||
| 1880 | - | ||
| 1881 | 1887 | ||
| 1882 | - JhCommonUtils.debounce(() => | ||
| 1883 | - _notebookDetailChangeModel | ||
| 1884 | - .getUserHistorys( | ||
| 1885 | - context, params)); | 1888 | + if (value.isEmpty || |
| 1889 | + value.length > 0) { | ||
| 1890 | + setState(() { | ||
| 1891 | + showPhoneHistory = true; | ||
| 1892 | + }); | ||
| 1893 | + Map<String, String> params = { | ||
| 1894 | + "keywords": value, | ||
| 1895 | + "sid": Provider.of<UserModel>( | ||
| 1896 | + context, | ||
| 1897 | + listen: false) | ||
| 1898 | + .user | ||
| 1899 | + .sellerid, | ||
| 1900 | + }; | ||
| 1901 | + | ||
| 1902 | + JhCommonUtils.debounce(() => | ||
| 1903 | + _notebookDetailChangeModel | ||
| 1904 | + .getUserHistorys( | ||
| 1905 | + context, params)); | ||
| 1906 | + } else { | ||
| 1907 | + setState(() { | ||
| 1908 | + showPhoneHistory = false; | ||
| 1909 | + }); | ||
| 1910 | + } | ||
| 1886 | }, | 1911 | }, |
| 1887 | onEditingComplete: () { | 1912 | onEditingComplete: () { |
| 1888 | _phoneNode.unfocus(); | 1913 | _phoneNode.unfocus(); |
| 1889 | }, | 1914 | }, |
| 1890 | onTap: () { | 1915 | onTap: () { |
| 1891 | - setState(() { | ||
| 1892 | - showPhoneHistory = true; | ||
| 1893 | - }); | 1916 | + // setState(() { |
| 1917 | + // showPhoneHistory = true; | ||
| 1918 | + // }); | ||
| 1894 | // Future.delayed(Duration(milliseconds: 300), () { | 1919 | // Future.delayed(Duration(milliseconds: 300), () { |
| 1895 | // _controller.jumpTo(_controller.position.maxScrollExtent); | 1920 | // _controller.jumpTo(_controller.position.maxScrollExtent); |
| 1896 | // }); | 1921 | // }); |
| @@ -139,7 +139,7 @@ class InvicationPageState extends State<InvicationPage> | @@ -139,7 +139,7 @@ class InvicationPageState extends State<InvicationPage> | ||
| 139 | bool needWechat = false; | 139 | bool needWechat = false; |
| 140 | 140 | ||
| 141 | String youhui = '选择优惠'; | 141 | String youhui = '选择优惠'; |
| 142 | - final GlobalKey botGlobalKey = GlobalKey(); | 142 | + static final GlobalKey botGlobalKey = GlobalKey(); |
| 143 | int sexSelectIndex = 0; | 143 | int sexSelectIndex = 0; |
| 144 | String sexStr = '先生'; | 144 | String sexStr = '先生'; |
| 145 | List sexList = []; | 145 | List sexList = []; |
| @@ -232,7 +232,7 @@ class InvicationPageState extends State<InvicationPage> | @@ -232,7 +232,7 @@ class InvicationPageState extends State<InvicationPage> | ||
| 232 | if (_phoneNode.hasFocus) { | 232 | if (_phoneNode.hasFocus) { |
| 233 | showOverlay(context); | 233 | showOverlay(context); |
| 234 | setState(() {}); | 234 | setState(() {}); |
| 235 | - Scrollable.ensureVisible(botGlobalKey.currentContext); | 235 | + // Scrollable.ensureVisible(botGlobalKey.currentContext); |
| 236 | } else { | 236 | } else { |
| 237 | if (!needBack && | 237 | if (!needBack && |
| 238 | !needBlack && | 238 | !needBlack && |
| @@ -251,7 +251,7 @@ class InvicationPageState extends State<InvicationPage> | @@ -251,7 +251,7 @@ class InvicationPageState extends State<InvicationPage> | ||
| 251 | if (_pnumNode.hasFocus) { | 251 | if (_pnumNode.hasFocus) { |
| 252 | showOverlay(context); | 252 | showOverlay(context); |
| 253 | setState(() {}); | 253 | setState(() {}); |
| 254 | - Scrollable.ensureVisible(botGlobalKey.currentContext); | 254 | + // Scrollable.ensureVisible(botGlobalKey.currentContext); |
| 255 | } else { | 255 | } else { |
| 256 | if (!needBack && | 256 | if (!needBack && |
| 257 | !needBlack && | 257 | !needBlack && |
| @@ -429,6 +429,8 @@ class InvicationPageState extends State<InvicationPage> | @@ -429,6 +429,8 @@ class InvicationPageState extends State<InvicationPage> | ||
| 429 | _timer.cancel(); | 429 | _timer.cancel(); |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | + _baseIndoProvider.nameController.dispose(); | ||
| 433 | + | ||
| 432 | super.dispose(); | 434 | super.dispose(); |
| 433 | } | 435 | } |
| 434 | 436 | ||
| @@ -2146,15 +2148,24 @@ class InvicationPageState extends State<InvicationPage> | @@ -2146,15 +2148,24 @@ class InvicationPageState extends State<InvicationPage> | ||
| 2146 | setState(() {}); | 2148 | setState(() {}); |
| 2147 | } | 2149 | } |
| 2148 | 2150 | ||
| 2149 | - JhCommonUtils.debounce(() => _searchMethod(value)); | 2151 | + if (value.isEmpty || value.length > 0) { |
| 2152 | + setState(() { | ||
| 2153 | + showPhoneHistory = true; | ||
| 2154 | + }); | ||
| 2155 | + JhCommonUtils.debounce(() => _searchMethod(value)); | ||
| 2156 | + } else { | ||
| 2157 | + setState(() { | ||
| 2158 | + showPhoneHistory = false; | ||
| 2159 | + }); | ||
| 2160 | + } | ||
| 2150 | }, | 2161 | }, |
| 2151 | onEditingComplete: () { | 2162 | onEditingComplete: () { |
| 2152 | - _phoneNode.unfocus(); | 2163 | + _phoneNode.nextFocus(); |
| 2153 | }, | 2164 | }, |
| 2154 | onTap: () { | 2165 | onTap: () { |
| 2155 | - setState(() { | ||
| 2156 | - showPhoneHistory = true; | ||
| 2157 | - }); | 2166 | + // setState(() { |
| 2167 | + // showPhoneHistory = true; | ||
| 2168 | + // }); | ||
| 2158 | // Future.delayed(Duration(milliseconds: 300), () { | 2169 | // Future.delayed(Duration(milliseconds: 300), () { |
| 2159 | // _controller.jumpTo(_controller.position.maxScrollExtent); | 2170 | // _controller.jumpTo(_controller.position.maxScrollExtent); |
| 2160 | // }); | 2171 | // }); |
| @@ -2267,21 +2278,34 @@ class InvicationPageState extends State<InvicationPage> | @@ -2267,21 +2278,34 @@ class InvicationPageState extends State<InvicationPage> | ||
| 2267 | print('ggg'); | 2278 | print('ggg'); |
| 2268 | 2279 | ||
| 2269 | nameStr = value; | 2280 | nameStr = value; |
| 2270 | - Map<String, String> params = { | ||
| 2271 | - "keywords": value.trim(), | ||
| 2272 | - "sid": Provider.of<UserModel>(context, | ||
| 2273 | - listen: false) | ||
| 2274 | - .user | ||
| 2275 | - .sellerid, | ||
| 2276 | - }; | ||
| 2277 | 2281 | ||
| 2278 | - JhCommonUtils.debounce(() => _baseIndoProvider | ||
| 2279 | - .getUserHistorys(context, params)); | 2282 | + if (_baseIndoProvider |
| 2283 | + .phoneController.text.length == | ||
| 2284 | + 0 && | ||
| 2285 | + value.length > 0) { | ||
| 2286 | + setState(() { | ||
| 2287 | + showPhoneHistory = true; | ||
| 2288 | + }); | ||
| 2289 | + Map<String, String> params = { | ||
| 2290 | + "keywords": value.trim(), | ||
| 2291 | + "sid": Provider.of<UserModel>(context, | ||
| 2292 | + listen: false) | ||
| 2293 | + .user | ||
| 2294 | + .sellerid, | ||
| 2295 | + }; | ||
| 2296 | + | ||
| 2297 | + JhCommonUtils.debounce(() => _baseIndoProvider | ||
| 2298 | + .getUserHistorys(context, params)); | ||
| 2299 | + } else { | ||
| 2300 | + setState(() { | ||
| 2301 | + showPhoneHistory = false; | ||
| 2302 | + }); | ||
| 2303 | + } | ||
| 2280 | }, | 2304 | }, |
| 2281 | onTap: () { | 2305 | onTap: () { |
| 2282 | - setState(() { | ||
| 2283 | - showPhoneHistory = true; | ||
| 2284 | - }); | 2306 | + // setState(() { |
| 2307 | + // showPhoneHistory = true; | ||
| 2308 | + // }); | ||
| 2285 | // Future.delayed(Duration(milliseconds: 300), () { | 2309 | // Future.delayed(Duration(milliseconds: 300), () { |
| 2286 | // _controller.jumpTo(_controller.position.maxScrollExtent); | 2310 | // _controller.jumpTo(_controller.position.maxScrollExtent); |
| 2287 | // }); | 2311 | // }); |
| @@ -2464,8 +2488,8 @@ class InvicationPageState extends State<InvicationPage> | @@ -2464,8 +2488,8 @@ class InvicationPageState extends State<InvicationPage> | ||
| 2464 | style: TextStyle( | 2488 | style: TextStyle( |
| 2465 | fontSize: ScreenUtil().setSp(28), | 2489 | fontSize: ScreenUtil().setSp(28), |
| 2466 | color: MyColours.color_353535), | 2490 | color: MyColours.color_353535), |
| 2467 | - controller: _baseIndoProvider.nameController, | ||
| 2468 | - focusNode: _nameNode, | 2491 | + // controller: _baseIndoProvider.nameController, |
| 2492 | + // focusNode: _nameNode, | ||
| 2469 | // textAlignVertical: TextAlignVertical.top, | 2493 | // textAlignVertical: TextAlignVertical.top, |
| 2470 | decoration: InputDecoration( | 2494 | decoration: InputDecoration( |
| 2471 | hintText: "用餐类型", | 2495 | hintText: "用餐类型", |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | import 'package:one_key/constant/state.dart'; | 3 | import 'package:one_key/constant/state.dart'; |
| 4 | +import 'package:one_key/models/area.dart'; | ||
| 4 | import 'package:one_key/provider/my_table_manage_home_model.dart'; | 5 | import 'package:one_key/provider/my_table_manage_home_model.dart'; |
| 5 | import 'package:one_key/provider/user_model.dart'; | 6 | import 'package:one_key/provider/user_model.dart'; |
| 6 | import 'package:one_key/res/colors.dart'; | 7 | import 'package:one_key/res/colors.dart'; |
| @@ -75,140 +76,273 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> { | @@ -75,140 +76,273 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> { | ||
| 75 | emptyImg: "table_manage_empty", | 76 | emptyImg: "table_manage_empty", |
| 76 | showMsg: "加载中,请稍后...", | 77 | showMsg: "加载中,请稍后...", |
| 77 | ) | 78 | ) |
| 78 | - : ListView.builder( | ||
| 79 | - padding: EdgeInsets.symmetric( | ||
| 80 | - horizontal: ScreenUtil().setWidth(32), | ||
| 81 | - vertical: ScreenUtil().setWidth(54)), | ||
| 82 | - itemCount: tableManagerModel.areas.length, | ||
| 83 | - shrinkWrap: true, | ||
| 84 | - // scrollDirection: Axis.horizontal, | ||
| 85 | - itemBuilder: (BuildContext contxt, int index) { | ||
| 86 | - return Container( | ||
| 87 | - padding: EdgeInsets.symmetric( | ||
| 88 | - horizontal: ScreenUtil().setWidth(16), | ||
| 89 | - vertical: ScreenUtil().setWidth(30)), | ||
| 90 | - decoration: BoxDecoration( | ||
| 91 | - border: Border( | ||
| 92 | - bottom: BorderSide( | ||
| 93 | - width: ScreenUtil().setWidth(2), | ||
| 94 | - color: MyColours.color_E7E7E7))), | ||
| 95 | - child: Row( | ||
| 96 | - mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 97 | - children: [ | ||
| 98 | - Expanded( | ||
| 99 | - child: InkWell( | ||
| 100 | - onTap: () async { | ||
| 101 | - //修改区域弹框 | ||
| 102 | - await DialogUtil | ||
| 103 | - .openTableManageCreateAreaDialog( | ||
| 104 | - context, | ||
| 105 | - title: '修改区域', | ||
| 106 | - content: tableManagerModel | ||
| 107 | - .areas[index] | ||
| 108 | - .name, onTap: (value) async { | ||
| 109 | - print(value); | ||
| 110 | - //添加区域 | ||
| 111 | - bool success = await tableManagerModel | ||
| 112 | - .setTableRegionById( | 79 | + : ReorderableListView( |
| 80 | + children: <Widget>[ | ||
| 81 | + for (Area item in tableManagerModel.areas) | ||
| 82 | + Container( | ||
| 83 | + padding: EdgeInsets.symmetric( | ||
| 84 | + horizontal: ScreenUtil().setWidth(16), | ||
| 85 | + vertical: ScreenUtil().setWidth(30)), | ||
| 86 | + decoration: BoxDecoration( | ||
| 87 | + border: Border( | ||
| 88 | + bottom: BorderSide( | ||
| 89 | + width: ScreenUtil().setWidth(2), | ||
| 90 | + color: MyColours.color_E7E7E7))), | ||
| 91 | + child: Row( | ||
| 92 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 93 | + children: [ | ||
| 94 | + Expanded( | ||
| 95 | + child: InkWell( | ||
| 96 | + onTap: () async { | ||
| 97 | + //修改区域弹框 | ||
| 98 | + await DialogUtil | ||
| 99 | + .openTableManageCreateAreaDialog( | ||
| 113 | context, | 100 | context, |
| 114 | - value, | ||
| 115 | - tableManagerModel | ||
| 116 | - .areas[index].rid); | ||
| 117 | - print(success); | ||
| 118 | - if (success) { | ||
| 119 | - Utils.showToast('修改成功!'); | ||
| 120 | - tableManagerModel.currentArea = value; | ||
| 121 | - | ||
| 122 | - // TableManagerModel tableManagerModel1 = | ||
| 123 | - // Provider.of<TableManagerModel>( | ||
| 124 | - // context, | ||
| 125 | - // listen: false); | ||
| 126 | - // tableManagerModel1.getTableList( | ||
| 127 | - // context, | ||
| 128 | - // needLoading: false, | ||
| 129 | - // ); | ||
| 130 | - | ||
| 131 | - await tableManagerModel | ||
| 132 | - .refreshTable(context); | ||
| 133 | - EventBus().emit("refresh_table_area"); | ||
| 134 | - // await tableManagerModel | ||
| 135 | - // .getTableList(context, | ||
| 136 | - // needLoading: false); | ||
| 137 | - // tableManagerModel.initData(); | ||
| 138 | - | ||
| 139 | - // setState(() { | ||
| 140 | - // updateMenu(); | ||
| 141 | - // }); | ||
| 142 | - // _scrollToIndex(widget | ||
| 143 | - // .tableManagerModel | ||
| 144 | - // .areas | ||
| 145 | - // .length); | ||
| 146 | - | ||
| 147 | - } | ||
| 148 | - }); | ||
| 149 | - }, | ||
| 150 | - child: Text( | ||
| 151 | - tableManagerModel.areas[index].name, | ||
| 152 | - style: TextStyle( | ||
| 153 | - color: MyColours.color_000000, | ||
| 154 | - fontSize: ScreenUtil().setSp(32))))), | ||
| 155 | - InkWell( | ||
| 156 | - onTap: () { | ||
| 157 | - DialogUtil.cupertinoAlertDialog(context, | ||
| 158 | - title: "", | ||
| 159 | - content: "是否确定删除该区域", | ||
| 160 | - lTitle: "取消", | ||
| 161 | - rTitle: "确认删除", | ||
| 162 | - isBold: true, | ||
| 163 | - isBoldContent: true, | ||
| 164 | - rColor: MyColours.color_E34D59, | ||
| 165 | - lCallback: () { | ||
| 166 | - print("取消"); | ||
| 167 | - }, rCallback: () async { | ||
| 168 | - bool success = | ||
| 169 | - await tableManagerModel.delTableRegion( | ||
| 170 | - context, | ||
| 171 | - tableManagerModel.areas[index].rid); | ||
| 172 | - print(success); | ||
| 173 | - if (success) { | ||
| 174 | - Utils.showToast('删除成功!'); | ||
| 175 | - // TableOuter tableOuter = TableOuter(); | ||
| 176 | - // tableOuter.name = value; | ||
| 177 | - // tableOuter.list = []; | ||
| 178 | - // tableManagerModel.tableOuterList.add(tableOuter); | ||
| 179 | - // tableManagerModel.initData(); | ||
| 180 | - // Timer( | ||
| 181 | - // Duration(milliseconds: 500), | ||
| 182 | - // () => _areaController.jumpTo( | ||
| 183 | - // _areaController.position.maxScrollExtent)); | ||
| 184 | - | ||
| 185 | - // await tableManagerModel | ||
| 186 | - // .getTableList(context); | ||
| 187 | - // await tableManagerModel | ||
| 188 | - // .initData(); | ||
| 189 | - // TableManagerModel tableManagerModel = | ||
| 190 | - // Provider.of<TableManagerModel>(context, | ||
| 191 | - // listen: false); | ||
| 192 | - // tableManagerModel.getTableList( | ||
| 193 | - // context, | ||
| 194 | - // needLoading: false, | ||
| 195 | - // ); | ||
| 196 | - | ||
| 197 | - await tableManagerModel | ||
| 198 | - .refreshTable(context); | ||
| 199 | - EventBus().emit("refresh_table_area"); | ||
| 200 | - } | ||
| 201 | - }); | ||
| 202 | - }, | ||
| 203 | - child: Text('删除', | ||
| 204 | - style: TextStyle( | ||
| 205 | - color: MyColours.color_438E93, | ||
| 206 | - decoration: TextDecoration.underline, | ||
| 207 | - fontSize: ScreenUtil().setSp(32)))) | ||
| 208 | - ], | ||
| 209 | - ), | ||
| 210 | - ); | ||
| 211 | - }); | 101 | + title: '修改区域', |
| 102 | + content: item.name, | ||
| 103 | + onTap: (value) async { | ||
| 104 | + print(value); | ||
| 105 | + //添加区域 | ||
| 106 | + bool success = await tableManagerModel | ||
| 107 | + .setTableRegionById( | ||
| 108 | + context, value, item.rid); | ||
| 109 | + print(success); | ||
| 110 | + if (success) { | ||
| 111 | + Utils.showToast('修改成功!'); | ||
| 112 | + tableManagerModel.currentArea = value; | ||
| 113 | + | ||
| 114 | + // TableManagerModel tableManagerModel1 = | ||
| 115 | + // Provider.of<TableManagerModel>( | ||
| 116 | + // context, | ||
| 117 | + // listen: false); | ||
| 118 | + // tableManagerModel1.getTableList( | ||
| 119 | + // context, | ||
| 120 | + // needLoading: false, | ||
| 121 | + // ); | ||
| 122 | + | ||
| 123 | + await tableManagerModel | ||
| 124 | + .refreshTable(context); | ||
| 125 | + EventBus().emit("refresh_table_area"); | ||
| 126 | + // await tableManagerModel | ||
| 127 | + // .getTableList(context, | ||
| 128 | + // needLoading: false); | ||
| 129 | + // tableManagerModel.initData(); | ||
| 130 | + | ||
| 131 | + // setState(() { | ||
| 132 | + // updateMenu(); | ||
| 133 | + // }); | ||
| 134 | + // _scrollToIndex(widget | ||
| 135 | + // .tableManagerModel | ||
| 136 | + // .areas | ||
| 137 | + // .length); | ||
| 138 | + | ||
| 139 | + } | ||
| 140 | + }); | ||
| 141 | + }, | ||
| 142 | + child: Text(item.name, | ||
| 143 | + style: TextStyle( | ||
| 144 | + color: MyColours.color_000000, | ||
| 145 | + fontSize: | ||
| 146 | + ScreenUtil().setSp(32))))), | ||
| 147 | + InkWell( | ||
| 148 | + onTap: () { | ||
| 149 | + DialogUtil.cupertinoAlertDialog(context, | ||
| 150 | + title: "", | ||
| 151 | + content: "是否确定删除该区域", | ||
| 152 | + lTitle: "取消", | ||
| 153 | + rTitle: "确认删除", | ||
| 154 | + isBold: true, | ||
| 155 | + isBoldContent: true, | ||
| 156 | + rColor: MyColours.color_E34D59, | ||
| 157 | + lCallback: () { | ||
| 158 | + print("取消"); | ||
| 159 | + }, rCallback: () async { | ||
| 160 | + bool success = await tableManagerModel | ||
| 161 | + .delTableRegion(context, item.rid); | ||
| 162 | + print(success); | ||
| 163 | + if (success) { | ||
| 164 | + Utils.showToast('删除成功!'); | ||
| 165 | + // TableOuter tableOuter = TableOuter(); | ||
| 166 | + // tableOuter.name = value; | ||
| 167 | + // tableOuter.list = []; | ||
| 168 | + // tableManagerModel.tableOuterList.add(tableOuter); | ||
| 169 | + // tableManagerModel.initData(); | ||
| 170 | + // Timer( | ||
| 171 | + // Duration(milliseconds: 500), | ||
| 172 | + // () => _areaController.jumpTo( | ||
| 173 | + // _areaController.position.maxScrollExtent)); | ||
| 174 | + | ||
| 175 | + // await tableManagerModel | ||
| 176 | + // .getTableList(context); | ||
| 177 | + // await tableManagerModel | ||
| 178 | + // .initData(); | ||
| 179 | + // TableManagerModel tableManagerModel = | ||
| 180 | + // Provider.of<TableManagerModel>(context, | ||
| 181 | + // listen: false); | ||
| 182 | + // tableManagerModel.getTableList( | ||
| 183 | + // context, | ||
| 184 | + // needLoading: false, | ||
| 185 | + // ); | ||
| 186 | + | ||
| 187 | + await tableManagerModel | ||
| 188 | + .refreshTable(context); | ||
| 189 | + EventBus().emit("refresh_table_area"); | ||
| 190 | + } | ||
| 191 | + }); | ||
| 192 | + }, | ||
| 193 | + child: Text('删除', | ||
| 194 | + style: TextStyle( | ||
| 195 | + color: MyColours.color_438E93, | ||
| 196 | + decoration: TextDecoration.underline, | ||
| 197 | + fontSize: ScreenUtil().setSp(32)))) | ||
| 198 | + ], | ||
| 199 | + ), | ||
| 200 | + ) | ||
| 201 | + ], | ||
| 202 | + onReorder: (int oldIndex, int newIndex) { | ||
| 203 | + if (oldIndex < newIndex) { | ||
| 204 | + newIndex -= 1; | ||
| 205 | + } | ||
| 206 | + var child = tableManagerModel.areas.removeAt(oldIndex); | ||
| 207 | + tableManagerModel.areas.insert(newIndex, child); | ||
| 208 | + setState(() {}); | ||
| 209 | + }, | ||
| 210 | + ); | ||
| 211 | + | ||
| 212 | + // ListView.builder( | ||
| 213 | + // padding: EdgeInsets.symmetric( | ||
| 214 | + // horizontal: ScreenUtil().setWidth(32), | ||
| 215 | + // vertical: ScreenUtil().setWidth(54)), | ||
| 216 | + // itemCount: tableManagerModel.areas.length, | ||
| 217 | + // shrinkWrap: true, | ||
| 218 | + // // scrollDirection: Axis.horizontal, | ||
| 219 | + // itemBuilder: (BuildContext contxt, int index) { | ||
| 220 | + // return Container( | ||
| 221 | + // padding: EdgeInsets.symmetric( | ||
| 222 | + // horizontal: ScreenUtil().setWidth(16), | ||
| 223 | + // vertical: ScreenUtil().setWidth(30)), | ||
| 224 | + // decoration: BoxDecoration( | ||
| 225 | + // border: Border( | ||
| 226 | + // bottom: BorderSide( | ||
| 227 | + // width: ScreenUtil().setWidth(2), | ||
| 228 | + // color: MyColours.color_E7E7E7))), | ||
| 229 | + // child: Row( | ||
| 230 | + // mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 231 | + // children: [ | ||
| 232 | + // Expanded( | ||
| 233 | + // child: InkWell( | ||
| 234 | + // onTap: () async { | ||
| 235 | + // //修改区域弹框 | ||
| 236 | + // await DialogUtil | ||
| 237 | + // .openTableManageCreateAreaDialog( | ||
| 238 | + // context, | ||
| 239 | + // title: '修改区域', | ||
| 240 | + // content: tableManagerModel | ||
| 241 | + // .areas[index] | ||
| 242 | + // .name, onTap: (value) async { | ||
| 243 | + // print(value); | ||
| 244 | + // //添加区域 | ||
| 245 | + // bool success = await tableManagerModel | ||
| 246 | + // .setTableRegionById( | ||
| 247 | + // context, | ||
| 248 | + // value, | ||
| 249 | + // tableManagerModel | ||
| 250 | + // .areas[index].rid); | ||
| 251 | + // print(success); | ||
| 252 | + // if (success) { | ||
| 253 | + // Utils.showToast('修改成功!'); | ||
| 254 | + // tableManagerModel.currentArea = value; | ||
| 255 | + | ||
| 256 | + // // TableManagerModel tableManagerModel1 = | ||
| 257 | + // // Provider.of<TableManagerModel>( | ||
| 258 | + // // context, | ||
| 259 | + // // listen: false); | ||
| 260 | + // // tableManagerModel1.getTableList( | ||
| 261 | + // // context, | ||
| 262 | + // // needLoading: false, | ||
| 263 | + // // ); | ||
| 264 | + | ||
| 265 | + // await tableManagerModel | ||
| 266 | + // .refreshTable(context); | ||
| 267 | + // EventBus().emit("refresh_table_area"); | ||
| 268 | + // // await tableManagerModel | ||
| 269 | + // // .getTableList(context, | ||
| 270 | + // // needLoading: false); | ||
| 271 | + // // tableManagerModel.initData(); | ||
| 272 | + | ||
| 273 | + // // setState(() { | ||
| 274 | + // // updateMenu(); | ||
| 275 | + // // }); | ||
| 276 | + // // _scrollToIndex(widget | ||
| 277 | + // // .tableManagerModel | ||
| 278 | + // // .areas | ||
| 279 | + // // .length); | ||
| 280 | + | ||
| 281 | + // } | ||
| 282 | + // }); | ||
| 283 | + // }, | ||
| 284 | + // child: Text( | ||
| 285 | + // tableManagerModel.areas[index].name, | ||
| 286 | + // style: TextStyle( | ||
| 287 | + // color: MyColours.color_000000, | ||
| 288 | + // fontSize: ScreenUtil().setSp(32))))), | ||
| 289 | + // InkWell( | ||
| 290 | + // onTap: () { | ||
| 291 | + // DialogUtil.cupertinoAlertDialog(context, | ||
| 292 | + // title: "", | ||
| 293 | + // content: "是否确定删除该区域", | ||
| 294 | + // lTitle: "取消", | ||
| 295 | + // rTitle: "确认删除", | ||
| 296 | + // isBold: true, | ||
| 297 | + // isBoldContent: true, | ||
| 298 | + // rColor: MyColours.color_E34D59, | ||
| 299 | + // lCallback: () { | ||
| 300 | + // print("取消"); | ||
| 301 | + // }, rCallback: () async { | ||
| 302 | + // bool success = | ||
| 303 | + // await tableManagerModel.delTableRegion( | ||
| 304 | + // context, | ||
| 305 | + // tableManagerModel.areas[index].rid); | ||
| 306 | + // print(success); | ||
| 307 | + // if (success) { | ||
| 308 | + // Utils.showToast('删除成功!'); | ||
| 309 | + // // TableOuter tableOuter = TableOuter(); | ||
| 310 | + // // tableOuter.name = value; | ||
| 311 | + // // tableOuter.list = []; | ||
| 312 | + // // tableManagerModel.tableOuterList.add(tableOuter); | ||
| 313 | + // // tableManagerModel.initData(); | ||
| 314 | + // // Timer( | ||
| 315 | + // // Duration(milliseconds: 500), | ||
| 316 | + // // () => _areaController.jumpTo( | ||
| 317 | + // // _areaController.position.maxScrollExtent)); | ||
| 318 | + | ||
| 319 | + // // await tableManagerModel | ||
| 320 | + // // .getTableList(context); | ||
| 321 | + // // await tableManagerModel | ||
| 322 | + // // .initData(); | ||
| 323 | + // // TableManagerModel tableManagerModel = | ||
| 324 | + // // Provider.of<TableManagerModel>(context, | ||
| 325 | + // // listen: false); | ||
| 326 | + // // tableManagerModel.getTableList( | ||
| 327 | + // // context, | ||
| 328 | + // // needLoading: false, | ||
| 329 | + // // ); | ||
| 330 | + | ||
| 331 | + // await tableManagerModel | ||
| 332 | + // .refreshTable(context); | ||
| 333 | + // EventBus().emit("refresh_table_area"); | ||
| 334 | + // } | ||
| 335 | + // }); | ||
| 336 | + // }, | ||
| 337 | + // child: Text('删除', | ||
| 338 | + // style: TextStyle( | ||
| 339 | + // color: MyColours.color_438E93, | ||
| 340 | + // decoration: TextDecoration.underline, | ||
| 341 | + // fontSize: ScreenUtil().setSp(32)))) | ||
| 342 | + // ], | ||
| 343 | + // ), | ||
| 344 | + // ); | ||
| 345 | + // }); | ||
| 212 | }))); | 346 | }))); |
| 213 | } | 347 | } |
| 214 | } | 348 | } |
| @@ -1056,18 +1056,26 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -1056,18 +1056,26 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 1056 | }); | 1056 | }); |
| 1057 | return; | 1057 | return; |
| 1058 | } | 1058 | } |
| 1059 | - setState(() { | ||
| 1060 | - showPhoneHistory = true; | ||
| 1061 | - }); | ||
| 1062 | - Map<String, String> params = { | ||
| 1063 | - "keywords": value, | ||
| 1064 | - "sid": Provider.of<UserModel>(context, listen: false) | ||
| 1065 | - .user | ||
| 1066 | - .sellerid, | ||
| 1067 | - }; | ||
| 1068 | - JhCommonUtils.debounce(() => | ||
| 1069 | - _baseIndoProvider.getUserHistorys(context, params)); | ||
| 1070 | - // _baseIndoProvider.getUserHistorys(context, params); | 1059 | + |
| 1060 | + if (value.isEmpty || value.length > 0) { | ||
| 1061 | + setState(() { | ||
| 1062 | + showPhoneHistory = true; | ||
| 1063 | + }); | ||
| 1064 | + Map<String, String> params = { | ||
| 1065 | + "keywords": value, | ||
| 1066 | + "sid": | ||
| 1067 | + Provider.of<UserModel>(context, listen: false) | ||
| 1068 | + .user | ||
| 1069 | + .sellerid, | ||
| 1070 | + }; | ||
| 1071 | + JhCommonUtils.debounce(() => _baseIndoProvider | ||
| 1072 | + .getUserHistorys(context, params)); | ||
| 1073 | + // _baseIndoProvider.getUserHistorys(context, params); | ||
| 1074 | + } else { | ||
| 1075 | + setState(() { | ||
| 1076 | + showPhoneHistory = false; | ||
| 1077 | + }); | ||
| 1078 | + } | ||
| 1071 | }, | 1079 | }, |
| 1072 | onEditingComplete: () { | 1080 | onEditingComplete: () { |
| 1073 | _phoneNode.unfocus(); | 1081 | _phoneNode.unfocus(); |
| @@ -1178,20 +1186,32 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -1178,20 +1186,32 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 1178 | print('ggg'); | 1186 | print('ggg'); |
| 1179 | 1187 | ||
| 1180 | nameStr = value; | 1188 | nameStr = value; |
| 1181 | - setState(() { | ||
| 1182 | - showPhoneHistory = true; | ||
| 1183 | - }); | ||
| 1184 | - Map<String, String> params = { | ||
| 1185 | - "keywords": value, | ||
| 1186 | - "sid": Provider.of<UserModel>(context, | ||
| 1187 | - listen: false) | ||
| 1188 | - .user | ||
| 1189 | - .sellerid, | ||
| 1190 | - }; | ||
| 1191 | - // _baseIndoProvider.getUserHistorys( | ||
| 1192 | - // context, params); | ||
| 1193 | - JhCommonUtils.debounce(() => _baseIndoProvider | ||
| 1194 | - .getUserHistorys(context, params)); | 1189 | + |
| 1190 | + if (_baseIndoProvider | ||
| 1191 | + .phoneController.text.length == | ||
| 1192 | + 0 && | ||
| 1193 | + value.length > 0) { | ||
| 1194 | + _baseIndoProvider.userHistorys = []; | ||
| 1195 | + setState(() { | ||
| 1196 | + showPhoneHistory = true; | ||
| 1197 | + }); | ||
| 1198 | + Map<String, String> params = { | ||
| 1199 | + "keywords": value, | ||
| 1200 | + "sid": Provider.of<UserModel>(context, | ||
| 1201 | + listen: false) | ||
| 1202 | + .user | ||
| 1203 | + .sellerid, | ||
| 1204 | + }; | ||
| 1205 | + // _baseIndoProvider.getUserHistorys( | ||
| 1206 | + // context, params); | ||
| 1207 | + JhCommonUtils.debounce(() => | ||
| 1208 | + _baseIndoProvider.getUserHistorys( | ||
| 1209 | + context, params)); | ||
| 1210 | + } else { | ||
| 1211 | + setState(() { | ||
| 1212 | + showPhoneHistory = false; | ||
| 1213 | + }); | ||
| 1214 | + } | ||
| 1195 | }, | 1215 | }, |
| 1196 | onEditingComplete: () { | 1216 | onEditingComplete: () { |
| 1197 | print('fff'); | 1217 | print('fff'); |
| @@ -224,6 +224,23 @@ class MyTableManageHomeModel with ChangeNotifier { | @@ -224,6 +224,23 @@ class MyTableManageHomeModel with ChangeNotifier { | ||
| 224 | } | 224 | } |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | + // 区域排序 | ||
| 228 | + Future<dynamic> sortByRegion( | ||
| 229 | + BuildContext context, Map<String, String> params) async { | ||
| 230 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 231 | + .request<dynamic>(context, Method.get, HttpUrl.sort_by_region, | ||
| 232 | + data: params, showLoading: true) | ||
| 233 | + .catchError((error) { | ||
| 234 | + print(error.toString()); | ||
| 235 | + }); | ||
| 236 | + if (baseResp == null) return null; | ||
| 237 | + if (baseResp.code == Constant.status_success) { | ||
| 238 | + return baseResp.data; | ||
| 239 | + } else { | ||
| 240 | + Utils.showToast(baseResp.msg); | ||
| 241 | + } | ||
| 242 | + } | ||
| 243 | + | ||
| 227 | //添加商家桌位区域 | 244 | //添加商家桌位区域 |
| 228 | Future<bool> addTableAreas(BuildContext context, String name) async { | 245 | Future<bool> addTableAreas(BuildContext context, String name) async { |
| 229 | Map<String, String> params = { | 246 | Map<String, String> params = { |
-
Please register or login to post a comment