Commit bb2bc43219a940dfbe306dfaf3f18423cc7ef740
1 parent
d1c56710
UI ----- 店铺信息、包间类型、添加包间类型、选择关联其他包间桌位
Showing
14 changed files
with
1775 additions
and
98 deletions
| @@ -11,14 +11,14 @@ if (flutterRoot == null) { | @@ -11,14 +11,14 @@ if (flutterRoot == null) { | ||
| 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | -def flutterVersionCode = "296" | 14 | +def flutterVersionCode = "300" |
| 15 | if (flutterVersionCode == null) { | 15 | if (flutterVersionCode == null) { |
| 16 | - flutterVersionCode = '296' | 16 | + flutterVersionCode = '300' |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | -def flutterVersionName = "2.9.6" | 19 | +def flutterVersionName = "3.0.0" |
| 20 | if (flutterVersionName == null) { | 20 | if (flutterVersionName == null) { |
| 21 | - flutterVersionName = '2.9.6' | 21 | + flutterVersionName = '3.0.0' |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | apply plugin: 'com.android.application' | 24 | apply plugin: 'com.android.application' |
| @@ -368,7 +368,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> { | @@ -368,7 +368,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> { | ||
| 368 | return Scaffold( | 368 | return Scaffold( |
| 369 | backgroundColor: MyColours.color_fefefe, | 369 | backgroundColor: MyColours.color_fefefe, |
| 370 | appBar: SystemAppBar( | 370 | appBar: SystemAppBar( |
| 371 | - '填写信息', | 371 | + '个人信息', |
| 372 | onTap: () { | 372 | onTap: () { |
| 373 | EventBus().emit('changeStatusColor'); | 373 | EventBus().emit('changeStatusColor'); |
| 374 | Navigator.of(context).pop(); | 374 | Navigator.of(context).pop(); |
| @@ -222,7 +222,25 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -222,7 +222,25 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 222 | )), | 222 | )), |
| 223 | Positioned( | 223 | Positioned( |
| 224 | right: ScreenUtil().setWidth(40), | 224 | right: ScreenUtil().setWidth(40), |
| 225 | - bottom: ScreenUtil().setWidth(120), | 225 | + bottom: ScreenUtil().setWidth(190), |
| 226 | + child: RoundButton( | ||
| 227 | + image: Utils.getImgPath('edit'), | ||
| 228 | + text: '店铺信息', | ||
| 229 | + gradientStart: Color.fromRGBO(255, 255, 255, 0.1), | ||
| 230 | + gradientEnd: Color.fromRGBO(255, 255, 255, 0.1), | ||
| 231 | + borderColor: Color.fromRGBO(255, 255, 255, 0.2), | ||
| 232 | + width: ScreenUtil().setWidth(195), | ||
| 233 | + height: ScreenUtil().setWidth(60), | ||
| 234 | + fontSize: 28, | ||
| 235 | + isBold: false, | ||
| 236 | + imgWidth: 26, | ||
| 237 | + onPressed: () { | ||
| 238 | + NavigatorUtil.goStoreBaseInfoPage(context); | ||
| 239 | + }, | ||
| 240 | + )), | ||
| 241 | + Positioned( | ||
| 242 | + right: ScreenUtil().setWidth(40), | ||
| 243 | + bottom: ScreenUtil().setWidth(110), | ||
| 226 | child: RoundButton( | 244 | child: RoundButton( |
| 227 | image: Utils.getImgPath('edit'), | 245 | image: Utils.getImgPath('edit'), |
| 228 | text: '个人信息', | 246 | text: '个人信息', |
| @@ -326,6 +344,18 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -326,6 +344,18 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 326 | color: MyColours.color_f3f3f3, | 344 | color: MyColours.color_f3f3f3, |
| 327 | ), | 345 | ), |
| 328 | MyItem( | 346 | MyItem( |
| 347 | + title: "包间类型", | ||
| 348 | + content: "", | ||
| 349 | + callback: () { | ||
| 350 | + NavigatorUtil.goRoomTypeManagePage(context); | ||
| 351 | + }, | ||
| 352 | + ), | ||
| 353 | + MyDivider( | ||
| 354 | + double.infinity, | ||
| 355 | + ScreenUtil().setHeight(1), | ||
| 356 | + color: MyColours.color_f3f3f3, | ||
| 357 | + ), | ||
| 358 | + MyItem( | ||
| 329 | title: "包间类型置满管理", | 359 | title: "包间类型置满管理", |
| 330 | content: "", | 360 | content: "", |
| 331 | callback: () { | 361 | callback: () { |
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter/services.dart'; | ||
| 3 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 4 | +import 'package:one_key/models/table_list.dart'; | ||
| 5 | +import 'package:one_key/res/colors.dart'; | ||
| 6 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 7 | +import 'package:one_key/utils/utils.dart'; | ||
| 8 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 9 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 10 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 11 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 12 | + | ||
| 13 | +class RoomTypeCreatePage extends StatefulWidget { | ||
| 14 | + RoomTypeCreatePage({Key key}) : super(key: key); | ||
| 15 | + | ||
| 16 | + @override | ||
| 17 | + _RoomTypeCreatePageState createState() => _RoomTypeCreatePageState(); | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | ||
| 21 | + ScrollController _scrollController = ScrollController(); | ||
| 22 | + TextEditingController _nameController = TextEditingController(); | ||
| 23 | + TextEditingController _norNumController = TextEditingController(); | ||
| 24 | + TextEditingController _maxNumController = TextEditingController(); | ||
| 25 | + TextEditingController _minMoneyController = TextEditingController(); | ||
| 26 | + | ||
| 27 | + FocusNode _nameFocusNode = FocusNode(); | ||
| 28 | + FocusNode _norNumFocusNode = FocusNode(); | ||
| 29 | + FocusNode _maxNumFocusNode = FocusNode(); | ||
| 30 | + FocusNode _minMoneyFocusNode = FocusNode(); | ||
| 31 | + List<TableList> tableListSel = []; | ||
| 32 | + | ||
| 33 | + @override | ||
| 34 | + void initState() { | ||
| 35 | + super.initState(); | ||
| 36 | + tableListSel = []; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + ///输入框 | ||
| 40 | + Widget _textfield( | ||
| 41 | + String title, | ||
| 42 | + String hintText, | ||
| 43 | + TextEditingController editingController, | ||
| 44 | + FocusNode focusNode, | ||
| 45 | + String subTitle, | ||
| 46 | + {bool needStar = true, | ||
| 47 | + TextInputType inputType = TextInputType.number}) { | ||
| 48 | + return Container( | ||
| 49 | + child: Row( | ||
| 50 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 51 | + children: [ | ||
| 52 | + Container( | ||
| 53 | + child: Text( | ||
| 54 | + title, | ||
| 55 | + style: TextStyle( | ||
| 56 | + color: MyColours.color_333333, | ||
| 57 | + fontWeight: FontWeight.bold, | ||
| 58 | + fontSize: ScreenUtil().setSp(34)), | ||
| 59 | + ), | ||
| 60 | + ), | ||
| 61 | + HEmptyView(20), | ||
| 62 | + needStar | ||
| 63 | + ? Container( | ||
| 64 | + child: Text( | ||
| 65 | + '*', | ||
| 66 | + style: TextStyle( | ||
| 67 | + color: MyColours.color_199095, | ||
| 68 | + fontWeight: FontWeight.bold, | ||
| 69 | + ), | ||
| 70 | + ), | ||
| 71 | + ) | ||
| 72 | + : SizedBox(), | ||
| 73 | + // Spacer(), | ||
| 74 | + Expanded( | ||
| 75 | + child: Container( | ||
| 76 | + // height: ScreenUtil().setHeight(120), | ||
| 77 | + padding: EdgeInsets.only( | ||
| 78 | + left: ScreenUtil().setWidth(20), | ||
| 79 | + right: ScreenUtil().setWidth(10), | ||
| 80 | + top: ScreenUtil().setWidth(8)), | ||
| 81 | + child: TextField( | ||
| 82 | + controller: editingController, | ||
| 83 | + textAlign: TextAlign.right, | ||
| 84 | + // textAlignVertical: TextAlignVertical.bottom, | ||
| 85 | + maxLines: 1, | ||
| 86 | + inputFormatters: [], | ||
| 87 | + | ||
| 88 | + // //光标颜色 | ||
| 89 | + // cursorColor: | ||
| 90 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 91 | + //输入文本的样式 | ||
| 92 | + style: TextStyle( | ||
| 93 | + fontSize: ScreenUtil().setSp(32), | ||
| 94 | + ), | ||
| 95 | + focusNode: focusNode, | ||
| 96 | + decoration: InputDecoration( | ||
| 97 | + border: OutlineInputBorder(borderSide: BorderSide.none), | ||
| 98 | + hintText: hintText, | ||
| 99 | + hintStyle: TextStyle( | ||
| 100 | + color: MyColours.color_999999, | ||
| 101 | + fontSize: ScreenUtil().setSp(32), | ||
| 102 | + ), | ||
| 103 | + enabledBorder: new UnderlineInputBorder( | ||
| 104 | + borderSide: BorderSide.none, | ||
| 105 | + ), | ||
| 106 | + focusedBorder: new UnderlineInputBorder( | ||
| 107 | + borderSide: BorderSide.none, | ||
| 108 | + ), | ||
| 109 | + contentPadding: EdgeInsets.zero, | ||
| 110 | + ), | ||
| 111 | + onChanged: (value) {}, | ||
| 112 | + onEditingComplete: () { | ||
| 113 | + FocusScope.of(context) | ||
| 114 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 115 | + }, | ||
| 116 | + keyboardType: inputType, | ||
| 117 | + )), | ||
| 118 | + ), | ||
| 119 | + Container( | ||
| 120 | + child: Text( | ||
| 121 | + subTitle, | ||
| 122 | + style: TextStyle( | ||
| 123 | + color: MyColours.color_333333, | ||
| 124 | + fontWeight: FontWeight.bold, | ||
| 125 | + fontSize: ScreenUtil().setSp(32)), | ||
| 126 | + ), | ||
| 127 | + ), | ||
| 128 | + ], | ||
| 129 | + ), | ||
| 130 | + ); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + ///关联包间选择 | ||
| 134 | + Widget _select(String title, String hintText) { | ||
| 135 | + return InkWell( | ||
| 136 | + onTap: () async { | ||
| 137 | + Map temp = await NavigatorUtil.goRoomTypeSelectTablePage( | ||
| 138 | + context, | ||
| 139 | + "", | ||
| 140 | + DateTime.now().millisecondsSinceEpoch, | ||
| 141 | + "1", | ||
| 142 | + canChoose: true, | ||
| 143 | + object: {'object': tableListSel}, | ||
| 144 | + ); | ||
| 145 | + if (temp != null && temp['tid'] != '') { | ||
| 146 | + print(temp['tid']); | ||
| 147 | + print(temp['tname']); | ||
| 148 | + String tname = temp['tname']; | ||
| 149 | + String tid = temp['tid']; | ||
| 150 | + tableListSel = temp['object']; | ||
| 151 | + setState(() {}); | ||
| 152 | + // _getTablePhoto(context, temp['tid'], showLoading: true); | ||
| 153 | + } | ||
| 154 | + }, | ||
| 155 | + child: Container( | ||
| 156 | + child: Row( | ||
| 157 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 158 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 159 | + children: [ | ||
| 160 | + Container( | ||
| 161 | + child: Text( | ||
| 162 | + title, | ||
| 163 | + style: TextStyle( | ||
| 164 | + color: MyColours.color_333333, | ||
| 165 | + fontWeight: FontWeight.bold, | ||
| 166 | + fontSize: ScreenUtil().setSp(34)), | ||
| 167 | + ), | ||
| 168 | + ), | ||
| 169 | + HEmptyView(20), | ||
| 170 | + Spacer(), | ||
| 171 | + Text(hintText, | ||
| 172 | + style: TextStyle( | ||
| 173 | + color: hintText == '选择包间' | ||
| 174 | + ? MyColours.color_999999 | ||
| 175 | + : MyColours.color_333333, | ||
| 176 | + fontWeight: | ||
| 177 | + hintText == '选择包间' ? FontWeight.normal : FontWeight.bold, | ||
| 178 | + fontSize: ScreenUtil().setSp(32), | ||
| 179 | + )), | ||
| 180 | + HEmptyView(20), | ||
| 181 | + Image.asset( | ||
| 182 | + Utils.getImgPath('arr_right_gray'), | ||
| 183 | + width: ScreenUtil().setWidth(12), | ||
| 184 | + height: ScreenUtil().setWidth(22), | ||
| 185 | + ) | ||
| 186 | + ], | ||
| 187 | + ), | ||
| 188 | + ), | ||
| 189 | + ); | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + @override | ||
| 193 | + Widget build(BuildContext context) { | ||
| 194 | + return Material( | ||
| 195 | + child: InkWell( | ||
| 196 | + onTap: () { | ||
| 197 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 198 | + }, | ||
| 199 | + child: Scaffold( | ||
| 200 | + backgroundColor: MyColours.color_fefefe, | ||
| 201 | + appBar: SystemAppBar( | ||
| 202 | + '创建包间类型', | ||
| 203 | + onTap: () { | ||
| 204 | + Navigator.of(context).pop(); | ||
| 205 | + }, | ||
| 206 | + ), | ||
| 207 | + body: Column(children: [ | ||
| 208 | + Expanded( | ||
| 209 | + child: SingleChildScrollView( | ||
| 210 | + controller: _scrollController, | ||
| 211 | + physics: BouncingScrollPhysics(), | ||
| 212 | + child: Column( | ||
| 213 | + children: [ | ||
| 214 | + Padding( | ||
| 215 | + padding: EdgeInsets.symmetric( | ||
| 216 | + horizontal: ScreenUtil().setWidth(40), | ||
| 217 | + ), | ||
| 218 | + child: _textfield('类型名称', '例如:6人间', | ||
| 219 | + _nameController, _nameFocusNode, '', | ||
| 220 | + inputType: TextInputType.text)), | ||
| 221 | + VEmptyView(10), | ||
| 222 | + Container( | ||
| 223 | + height: ScreenUtil().setWidth(2), | ||
| 224 | + color: MyColours.color_efefef, | ||
| 225 | + margin: EdgeInsets.only( | ||
| 226 | + left: ScreenUtil().setWidth(40), | ||
| 227 | + right: ScreenUtil().setWidth(40)), | ||
| 228 | + ), | ||
| 229 | + VEmptyView(10), | ||
| 230 | + Padding( | ||
| 231 | + padding: EdgeInsets.symmetric( | ||
| 232 | + horizontal: ScreenUtil().setWidth(40), | ||
| 233 | + ), | ||
| 234 | + child: _textfield('标准可坐人数', '例如:6', | ||
| 235 | + _norNumController, _norNumFocusNode, '人')), | ||
| 236 | + VEmptyView(10), | ||
| 237 | + Container( | ||
| 238 | + height: ScreenUtil().setWidth(2), | ||
| 239 | + color: MyColours.color_efefef, | ||
| 240 | + margin: EdgeInsets.only( | ||
| 241 | + left: ScreenUtil().setWidth(40), | ||
| 242 | + right: ScreenUtil().setWidth(40)), | ||
| 243 | + ), | ||
| 244 | + VEmptyView(10), | ||
| 245 | + Padding( | ||
| 246 | + padding: EdgeInsets.symmetric( | ||
| 247 | + horizontal: ScreenUtil().setWidth(40), | ||
| 248 | + ), | ||
| 249 | + child: _textfield('最多可做人数', '例如:6', | ||
| 250 | + _maxNumController, _maxNumFocusNode, '人', | ||
| 251 | + needStar: false)), | ||
| 252 | + VEmptyView(10), | ||
| 253 | + Container( | ||
| 254 | + height: ScreenUtil().setWidth(2), | ||
| 255 | + color: MyColours.color_efefef, | ||
| 256 | + margin: EdgeInsets.only( | ||
| 257 | + left: ScreenUtil().setWidth(40), | ||
| 258 | + right: ScreenUtil().setWidth(40)), | ||
| 259 | + ), | ||
| 260 | + VEmptyView(10), | ||
| 261 | + Padding( | ||
| 262 | + padding: EdgeInsets.symmetric( | ||
| 263 | + horizontal: ScreenUtil().setWidth(40), | ||
| 264 | + ), | ||
| 265 | + child: _textfield( | ||
| 266 | + '最低消费', | ||
| 267 | + '例如:1000', | ||
| 268 | + _minMoneyController, | ||
| 269 | + _minMoneyFocusNode, | ||
| 270 | + '元', | ||
| 271 | + needStar: false)), | ||
| 272 | + VEmptyView(10), | ||
| 273 | + Container( | ||
| 274 | + height: ScreenUtil().setWidth(2), | ||
| 275 | + color: MyColours.color_efefef, | ||
| 276 | + margin: EdgeInsets.only( | ||
| 277 | + left: ScreenUtil().setWidth(40), | ||
| 278 | + right: ScreenUtil().setWidth(40)), | ||
| 279 | + ), | ||
| 280 | + VEmptyView(10), | ||
| 281 | + Padding( | ||
| 282 | + padding: EdgeInsets.symmetric( | ||
| 283 | + horizontal: ScreenUtil().setWidth(40), | ||
| 284 | + vertical: ScreenUtil().setWidth(40), | ||
| 285 | + ), | ||
| 286 | + child: _select( | ||
| 287 | + '关联包间', | ||
| 288 | + tableListSel.length == 0 | ||
| 289 | + ? '选择包间' | ||
| 290 | + : '查看包间')), | ||
| 291 | + VEmptyView(10), | ||
| 292 | + Container( | ||
| 293 | + height: ScreenUtil().setWidth(2), | ||
| 294 | + color: MyColours.color_efefef, | ||
| 295 | + margin: EdgeInsets.only( | ||
| 296 | + left: ScreenUtil().setWidth(40), | ||
| 297 | + right: ScreenUtil().setWidth(40)), | ||
| 298 | + ), | ||
| 299 | + VEmptyView(10), | ||
| 300 | + ], | ||
| 301 | + )), | ||
| 302 | + ), | ||
| 303 | + VEmptyView(20), | ||
| 304 | + Padding( | ||
| 305 | + padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0, | ||
| 306 | + ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), | ||
| 307 | + child: RoundButton( | ||
| 308 | + onPressed: () { | ||
| 309 | + //接口 | ||
| 310 | + // _setStoreBaseinfo(); | ||
| 311 | + }, | ||
| 312 | + text: '保存', | ||
| 313 | + fontSize: 34, | ||
| 314 | + isBold: false, | ||
| 315 | + height: ScreenUtil().setWidth(80), | ||
| 316 | + width: double.infinity, | ||
| 317 | + radius: ScreenUtil().setWidth(10), | ||
| 318 | + )) | ||
| 319 | + ])))); | ||
| 320 | + } | ||
| 321 | +} |
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 3 | +import 'package:one_key/models/seller_table_class_entity.dart'; | ||
| 4 | +import 'package:one_key/provider/store_detail_model.dart'; | ||
| 5 | +import 'package:one_key/provider/user_model.dart'; | ||
| 6 | +import 'package:one_key/res/colors.dart'; | ||
| 7 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 8 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 9 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 10 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 11 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 12 | +import 'package:provider/provider.dart'; | ||
| 13 | + | ||
| 14 | +class RoomTypeManagePage extends StatefulWidget { | ||
| 15 | + RoomTypeManagePage({Key key}) : super(key: key); | ||
| 16 | + | ||
| 17 | + @override | ||
| 18 | + _RoomTypeManagePageState createState() => _RoomTypeManagePageState(); | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +class _RoomTypeManagePageState extends State<RoomTypeManagePage> { | ||
| 22 | + //包间 | ||
| 23 | + List<SellerTableClassEntity> tables = []; | ||
| 24 | + @override | ||
| 25 | + void initState() { | ||
| 26 | + super.initState(); | ||
| 27 | + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | ||
| 28 | + _getSellerTableClass(); | ||
| 29 | + }); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + //获取商家包间类型 | ||
| 33 | + _getSellerTableClass() async { | ||
| 34 | + Map<String, String> params = { | ||
| 35 | + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 36 | + }; | ||
| 37 | + StoreDetailModel detailModel = | ||
| 38 | + Provider.of<StoreDetailModel>(context, listen: false); | ||
| 39 | + tables = await detailModel.getSellerTableClass(context, params); | ||
| 40 | + | ||
| 41 | + // tables.any((element) => element.isFull == 1); | ||
| 42 | + // rooms.clear(); | ||
| 43 | + setState(() {}); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @override | ||
| 47 | + Widget build(BuildContext context) { | ||
| 48 | + return Scaffold( | ||
| 49 | + backgroundColor: MyColours.color_ffffff, | ||
| 50 | + appBar: SystemAppBar( | ||
| 51 | + '包间类型', | ||
| 52 | + onTap: () { | ||
| 53 | + EventBus().emit('changeStatusColor'); | ||
| 54 | + Navigator.of(context).pop(); | ||
| 55 | + }, | ||
| 56 | + ), | ||
| 57 | + body: WillPopScope( | ||
| 58 | + onWillPop: () { | ||
| 59 | + EventBus().emit('changeStatusColor'); | ||
| 60 | + Navigator.of(context).pop(); | ||
| 61 | + }, | ||
| 62 | + child: Container( | ||
| 63 | + width: double.infinity, | ||
| 64 | + padding: EdgeInsets.only( | ||
| 65 | + left: ScreenUtil().setWidth(30), | ||
| 66 | + top: ScreenUtil().setWidth(20), | ||
| 67 | + right: ScreenUtil().setWidth(30)), | ||
| 68 | + child: Column( | ||
| 69 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 70 | + children: <Widget>[ | ||
| 71 | + Expanded( | ||
| 72 | + child: SingleChildScrollView( | ||
| 73 | + child: Column( | ||
| 74 | + children: [ | ||
| 75 | + VEmptyView(20), | ||
| 76 | + Selector<StoreDetailModel, | ||
| 77 | + List<SellerTableClassEntity>>( | ||
| 78 | + shouldRebuild: (pre, next) => true, | ||
| 79 | + selector: (context, model) => model.tables, | ||
| 80 | + builder: (context, tables, child) { | ||
| 81 | + return GridView.builder( | ||
| 82 | + gridDelegate: | ||
| 83 | + SliverGridDelegateWithFixedCrossAxisCount( | ||
| 84 | + crossAxisCount: 2, | ||
| 85 | + mainAxisSpacing: | ||
| 86 | + ScreenUtil().setWidth(20), | ||
| 87 | + crossAxisSpacing: | ||
| 88 | + ScreenUtil().setWidth(30), | ||
| 89 | + childAspectRatio: 2.4), | ||
| 90 | + itemBuilder: (context, index) { | ||
| 91 | + return GestureDetector( | ||
| 92 | + onTap: () async {}, | ||
| 93 | + child: Container( | ||
| 94 | + height: ScreenUtil().setWidth(140), | ||
| 95 | + padding: EdgeInsets.only( | ||
| 96 | + left: ScreenUtil().setWidth(30)), | ||
| 97 | + decoration: BoxDecoration( | ||
| 98 | + color: MyColours.color_A9E3E6, | ||
| 99 | + borderRadius: BorderRadius.circular( | ||
| 100 | + ScreenUtil().setWidth(10)), | ||
| 101 | + border: Border.all( | ||
| 102 | + color: MyColours.color_2AB5B7, | ||
| 103 | + width: ScreenUtil().setWidth(2)), | ||
| 104 | + ), | ||
| 105 | + alignment: Alignment.centerLeft, | ||
| 106 | + child: Column( | ||
| 107 | + mainAxisSize: MainAxisSize.min, | ||
| 108 | + mainAxisAlignment: | ||
| 109 | + MainAxisAlignment.center, | ||
| 110 | + crossAxisAlignment: | ||
| 111 | + CrossAxisAlignment.start, | ||
| 112 | + children: <Widget>[ | ||
| 113 | + Text("${tables[index].name}", | ||
| 114 | + style: TextStyle( | ||
| 115 | + fontSize: | ||
| 116 | + ScreenUtil().setSp(30), | ||
| 117 | + color: MyColours.color_333333, | ||
| 118 | + fontWeight: FontWeight.bold)), | ||
| 119 | + VEmptyView(10), | ||
| 120 | + int.parse(tables[index].max ?? "0") > 0 | ||
| 121 | + ? Text( | ||
| 122 | + "最多可坐${tables[index].max}人", | ||
| 123 | + style: TextStyle( | ||
| 124 | + fontSize: | ||
| 125 | + ScreenUtil().setSp(24), | ||
| 126 | + color: | ||
| 127 | + MyColours.color_333333, | ||
| 128 | + fontWeight: | ||
| 129 | + FontWeight.normal), | ||
| 130 | + ) | ||
| 131 | + : Container(), | ||
| 132 | + int.parse(tables[index].low ?? "0") > 0 | ||
| 133 | + ? Text( | ||
| 134 | + "最低消费${tables[index].low}元", | ||
| 135 | + style: TextStyle( | ||
| 136 | + fontSize: | ||
| 137 | + ScreenUtil().setSp(20), | ||
| 138 | + color: | ||
| 139 | + MyColours.color_199095, | ||
| 140 | + fontWeight: | ||
| 141 | + FontWeight.normal), | ||
| 142 | + ) | ||
| 143 | + : Container() | ||
| 144 | + ], | ||
| 145 | + ), | ||
| 146 | + ), | ||
| 147 | + ); | ||
| 148 | + }, | ||
| 149 | + itemCount: tables.length, | ||
| 150 | + shrinkWrap: true, | ||
| 151 | + physics: new NeverScrollableScrollPhysics(), | ||
| 152 | + ); | ||
| 153 | + }, | ||
| 154 | + ) | ||
| 155 | + ], | ||
| 156 | + )), | ||
| 157 | + ), | ||
| 158 | + Padding( | ||
| 159 | + padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0, | ||
| 160 | + ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), | ||
| 161 | + child: RoundButton( | ||
| 162 | + onPressed: () async { | ||
| 163 | + NavigatorUtil.goRoomTypeCreatePage(context); | ||
| 164 | + }, | ||
| 165 | + text: '添加类型', | ||
| 166 | + fontSize: 34, | ||
| 167 | + isBold: false, | ||
| 168 | + height: ScreenUtil().setWidth(80), | ||
| 169 | + width: double.infinity, | ||
| 170 | + radius: ScreenUtil().setWidth(10), | ||
| 171 | + )) | ||
| 172 | + ], | ||
| 173 | + ), | ||
| 174 | + ))); | ||
| 175 | + } | ||
| 176 | +} |
| 1 | +import 'dart:ffi'; | ||
| 2 | + | ||
| 3 | +import 'package:dotted_border/dotted_border.dart'; | ||
| 4 | +import 'package:flutter/material.dart'; | ||
| 5 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 6 | +import 'package:one_key/constant/state.dart'; | ||
| 7 | +import 'package:one_key/models/area.dart'; | ||
| 8 | +import 'package:one_key/models/notebook.dart'; | ||
| 9 | +import 'package:one_key/models/tableOuter.dart'; | ||
| 10 | +import 'package:one_key/models/table_list.dart'; | ||
| 11 | +import 'package:one_key/provider/choose_table_model.dart'; | ||
| 12 | +import 'package:one_key/provider/notebook_detail_change_model.dart'; | ||
| 13 | +import 'package:one_key/provider/notebook_model.dart'; | ||
| 14 | +import 'package:one_key/provider/user_model.dart'; | ||
| 15 | +import 'package:one_key/res/colors.dart'; | ||
| 16 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 17 | +import 'package:one_key/utils/utils.dart'; | ||
| 18 | +import 'package:one_key/widgets/app_bar.dart'; | ||
| 19 | +import 'package:one_key/widgets/area_item.dart'; | ||
| 20 | +import 'package:one_key/widgets/common_button.dart'; | ||
| 21 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 22 | +import 'package:one_key/widgets/table_item.dart'; | ||
| 23 | +import 'package:one_key/models/table.dart' as t; | ||
| 24 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 25 | +import 'package:provider/provider.dart'; | ||
| 26 | +import 'dart:convert' as convert; | ||
| 27 | + | ||
| 28 | +class RoomTypeSelectTablePage extends StatefulWidget { | ||
| 29 | + final String rid; //预订id | ||
| 30 | + final DateTime dateTime; //日期 | ||
| 31 | + final String ddate_slot; //时段 | ||
| 32 | + final bool canChoose; //变更预订可以取消原来已预订的选中状态 | ||
| 33 | + final List<TableList> tableList; | ||
| 34 | + final String fromPage; | ||
| 35 | + final String tid; | ||
| 36 | + | ||
| 37 | + RoomTypeSelectTablePage(this.rid, this.dateTime, this.ddate_slot, | ||
| 38 | + {this.canChoose = false, this.tableList, this.fromPage, this.tid}); | ||
| 39 | + | ||
| 40 | + @override | ||
| 41 | + State<StatefulWidget> createState() { | ||
| 42 | + // TODO: implement createState | ||
| 43 | + return new RoomTypeSelectTablePageState(); | ||
| 44 | + } | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | ||
| 48 | + List<Area> areas = []; //区域列表 | ||
| 49 | + List<t.Table> selectTables = []; //选择的桌位 | ||
| 50 | + | ||
| 51 | + List<TableOuter> tableOuterList = []; //区域-桌位列表 | ||
| 52 | + | ||
| 53 | + Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map | ||
| 54 | + | ||
| 55 | + ChooseTableModel _chooseTableModel; | ||
| 56 | + | ||
| 57 | + Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单 | ||
| 58 | + | ||
| 59 | + String currentArea; //当前选中区域 | ||
| 60 | + List<String> personNumList = []; | ||
| 61 | + | ||
| 62 | + int selectNum = 0; | ||
| 63 | + | ||
| 64 | + @override | ||
| 65 | + void initState() { | ||
| 66 | + // TODO: implement initState | ||
| 67 | + super.initState(); | ||
| 68 | + for (int i = 1; i < 31; i++) { | ||
| 69 | + personNumList.add(i.toString()); | ||
| 70 | + } | ||
| 71 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 72 | + getTableList(); | ||
| 73 | + }); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + //获取桌位列表 | ||
| 77 | + getTableList({needLoading = true}) async { | ||
| 78 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 79 | + Map<String, String> params = {"sellerid": userModel.user.sellerid}; | ||
| 80 | + tableOuterList = await _chooseTableModel.getTableList(context, params, | ||
| 81 | + needLoading: needLoading); | ||
| 82 | + for (TableOuter item in tableOuterList) { | ||
| 83 | + // if (item.name == "推荐") { | ||
| 84 | + // itemModelList.remove(item); | ||
| 85 | + // } | ||
| 86 | + for (var item in item.list) { | ||
| 87 | + for (var table in widget.tableList) { | ||
| 88 | + if (item.id == table.id) { | ||
| 89 | + item.selected = true; | ||
| 90 | + selectNum++; | ||
| 91 | + // if (!tableList.contains(item)) { | ||
| 92 | + // tableList.add(item); | ||
| 93 | + // } | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + // if (tableOuterList.isEmpty) { | ||
| 99 | + // _chooseTableModel.pageState = PageState.Success; | ||
| 100 | + // _chooseTableModel.notifyListeners(); | ||
| 101 | + // } | ||
| 102 | + | ||
| 103 | + // else { | ||
| 104 | + // _getReserveList(userModel.user.sellerid, needLoading: needLoading); | ||
| 105 | + // } | ||
| 106 | + // if (_chooseTableModel.pageState == PageState.Success) { | ||
| 107 | + | ||
| 108 | + // } | ||
| 109 | + if (needLoading) { | ||
| 110 | + initData(); | ||
| 111 | + } else { | ||
| 112 | + initData(needRetain: true); | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + refreshTable(context) async { | ||
| 117 | + await getTableList(needLoading: false); | ||
| 118 | + // if (temp.length > 0) { | ||
| 119 | + // _getReserveList(context, needLoading: false); | ||
| 120 | + // } else { | ||
| 121 | + // // pageState = PageState.Empty; | ||
| 122 | + // _chooseTableModel.pageState = PageState.Success; | ||
| 123 | + // _chooseTableModel.notifyListeners(); | ||
| 124 | + // } | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + //获取已预订列表 | ||
| 128 | + _getReserveList(String sid, {needLoading = true}) async { | ||
| 129 | + NoteBookModel model = new NoteBookModel(); | ||
| 130 | + Map<String, String> params = { | ||
| 131 | + "sid": sid, | ||
| 132 | + "rdate": _getRdate(), | ||
| 133 | + "ddate_solt": widget.ddate_slot, | ||
| 134 | + "y": "200", | ||
| 135 | + "x": "1", | ||
| 136 | + "keywords": "", | ||
| 137 | + "sort": "1" | ||
| 138 | + }; | ||
| 139 | + List<Notebook> noteBooks = | ||
| 140 | + await model.getReserveList(context, params, needLoading: needLoading); | ||
| 141 | + for (Notebook notebook in noteBooks) { | ||
| 142 | + if (notebook.tid.isEmpty) continue; | ||
| 143 | + if (notebook.status == "1" || | ||
| 144 | + notebook.status == "2" || | ||
| 145 | + notebook.status == "5") { | ||
| 146 | + //已预订,用餐中,已安排 | ||
| 147 | + List<String> tids = notebook.tid.split(","); | ||
| 148 | + for (String tid in tids) { | ||
| 149 | + tableMap["$tid"] = notebook; | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + print(tableMap); | ||
| 154 | + if (needLoading) { | ||
| 155 | + initData(); | ||
| 156 | + } else { | ||
| 157 | + initData(needRetain: true); | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + //初始桌位数据 | ||
| 162 | + initData({bool needRetain = false}) { | ||
| 163 | + areas.clear(); | ||
| 164 | + areaTableMap.clear(); | ||
| 165 | + for (TableOuter outer in tableOuterList) { | ||
| 166 | + int count = 0; | ||
| 167 | + for (t.Table table in outer.list) { | ||
| 168 | + if (widget.tid != '' && table.id == widget.tid) { | ||
| 169 | + table.selected = true; | ||
| 170 | + currentArea = outer.name; | ||
| 171 | + } | ||
| 172 | + if (table.tablestatus == "0") { | ||
| 173 | + //没有用餐中 | ||
| 174 | + if (tableMap["${table.id}"] != null) { | ||
| 175 | + Notebook notebook = tableMap["${table.id}"]; | ||
| 176 | + table.sign = notebook.status; | ||
| 177 | + table.notebookId = notebook.id; | ||
| 178 | + table.reserver = notebook.rnameStr; | ||
| 179 | + } else { | ||
| 180 | + table.sign = ""; | ||
| 181 | + table.notebookId = ""; | ||
| 182 | + if (table.enable == "1") { | ||
| 183 | + count++; | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + } else { | ||
| 187 | + table.sign = "2"; | ||
| 188 | + table.notebookId = ""; | ||
| 189 | + } | ||
| 190 | + } | ||
| 191 | + areaTableMap["${outer.name}"] = outer.list; | ||
| 192 | + Area area = Area(); | ||
| 193 | + area.name = outer.name; | ||
| 194 | + area.count = count; | ||
| 195 | + area.rid = outer.list.length == 0 ? outer.rid : outer.list[0].rid; | ||
| 196 | + areas.add(area); | ||
| 197 | + } | ||
| 198 | + if (widget.tid == '') { | ||
| 199 | + if (!needRetain) { | ||
| 200 | + currentArea = areaTableMap.keys.first; | ||
| 201 | + } | ||
| 202 | + if (areas.length == 1) { | ||
| 203 | + currentArea = areaTableMap.keys.first; | ||
| 204 | + } | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + _chooseTableModel.pageState = PageState.Success; | ||
| 208 | + _chooseTableModel.notifyListeners(); | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + //获取一天开始-结束时间字符串 | ||
| 212 | + String _getRdate() { | ||
| 213 | + //一天开始时间 | ||
| 214 | + double startDay = (DateTime.parse((widget.dateTime.year.toString() + | ||
| 215 | + "-" + | ||
| 216 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 217 | + "-" + | ||
| 218 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 219 | + " 00:00:00")) | ||
| 220 | + .millisecondsSinceEpoch) / | ||
| 221 | + 1000; | ||
| 222 | + //一天结束时间 | ||
| 223 | + double endDay = (DateTime.parse((widget.dateTime.year.toString() + | ||
| 224 | + "-" + | ||
| 225 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 226 | + "-" + | ||
| 227 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 228 | + " 23:59:59")) | ||
| 229 | + .millisecondsSinceEpoch) / | ||
| 230 | + 1000; | ||
| 231 | + return startDay.floor().toString() + "-" + endDay.floor().toString(); | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + @override | ||
| 235 | + Widget build(BuildContext context) { | ||
| 236 | + _chooseTableModel = Provider.of<ChooseTableModel>(context); | ||
| 237 | + return Scaffold( | ||
| 238 | + body: SafeArea( | ||
| 239 | + child: Column( | ||
| 240 | + children: <Widget>[ | ||
| 241 | + MyAppBar( | ||
| 242 | + "选择桌位", | ||
| 243 | + showBack: true, | ||
| 244 | + ), | ||
| 245 | + Expanded( | ||
| 246 | + child: Consumer<ChooseTableModel>(builder: (context, model, _) { | ||
| 247 | + if (model.pageState != PageState.Success) { | ||
| 248 | + return ExceptionPage( | ||
| 249 | + pageState: model.pageState, | ||
| 250 | + callback: () { | ||
| 251 | + getTableList(); | ||
| 252 | + }, | ||
| 253 | + emptyMsg: "暂时没有桌位哦", | ||
| 254 | + emptyImg: "empty_search", | ||
| 255 | + showMsg: "加载中,请稍后...", | ||
| 256 | + ); | ||
| 257 | + } else { | ||
| 258 | + return Container( | ||
| 259 | + color: MyColours.color_ffffff, | ||
| 260 | + child: Row( | ||
| 261 | + children: <Widget>[ | ||
| 262 | + Container( | ||
| 263 | + width: ScreenUtil().setWidth(170), | ||
| 264 | + height: double.infinity, | ||
| 265 | + color: MyColours.color_f1f1f1, | ||
| 266 | + child: ListView.builder( | ||
| 267 | + itemBuilder: (context, index) { | ||
| 268 | + return AreaItem(areas[index], currentArea, (area) { | ||
| 269 | + setState(() { | ||
| 270 | + currentArea = (area as Area).name; | ||
| 271 | + }); | ||
| 272 | + }, need: false); | ||
| 273 | + }, | ||
| 274 | + itemExtent: ScreenUtil().setHeight(207), | ||
| 275 | + itemCount: areas.length, | ||
| 276 | + ), | ||
| 277 | + ), | ||
| 278 | + Expanded( | ||
| 279 | + child: Padding( | ||
| 280 | + padding: EdgeInsets.symmetric( | ||
| 281 | + vertical: ScreenUtil().setHeight(10), | ||
| 282 | + horizontal: ScreenUtil().setWidth(9)), | ||
| 283 | + child: Column( | ||
| 284 | + children: [ | ||
| 285 | + Expanded( | ||
| 286 | + child: GridView.builder( | ||
| 287 | + gridDelegate: | ||
| 288 | + SliverGridDelegateWithFixedCrossAxisCount( | ||
| 289 | + crossAxisCount: 3, | ||
| 290 | + childAspectRatio: 8 / 9), | ||
| 291 | + itemBuilder: (context, index) { | ||
| 292 | + return TableItem( | ||
| 293 | + areaTableMap[currentArea][index], | ||
| 294 | + need: false, | ||
| 295 | + onSelected: (t.Table table) { | ||
| 296 | + if (widget.fromPage == 'tablePhoto') { | ||
| 297 | + for (String item in areaTableMap.keys) { | ||
| 298 | + for (t.Table item | ||
| 299 | + in areaTableMap[item]) { | ||
| 300 | + item.selected = false; | ||
| 301 | + selectNum = 0; | ||
| 302 | + if (table.id == item.id) { | ||
| 303 | + item.selected = true; | ||
| 304 | + selectTables = []; | ||
| 305 | + selectNum++; | ||
| 306 | + selectTables.add(table); | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + } | ||
| 310 | + setState(() {}); | ||
| 311 | + } else { | ||
| 312 | + if ((table as t.Table).selected) { | ||
| 313 | + selectTables.add(table); | ||
| 314 | + | ||
| 315 | + selectNum++; | ||
| 316 | + | ||
| 317 | + widget.tableList | ||
| 318 | + .add(tableToTableList(table)); | ||
| 319 | + } else { | ||
| 320 | + widget.tableList.removeWhere( | ||
| 321 | + (t) => t.id == table.id); | ||
| 322 | + | ||
| 323 | + selectNum--; | ||
| 324 | + | ||
| 325 | + selectTables.removeWhere( | ||
| 326 | + (t) => t.id == table.id); | ||
| 327 | + } | ||
| 328 | + setState(() {}); | ||
| 329 | + } | ||
| 330 | + }, | ||
| 331 | + canSelected: true, | ||
| 332 | + fromPage: widget.fromPage, | ||
| 333 | + tableMap: tableMap, | ||
| 334 | + rid: widget.rid); | ||
| 335 | + }, | ||
| 336 | + itemCount: currentArea == null | ||
| 337 | + ? 0 | ||
| 338 | + : areaTableMap[currentArea].length, | ||
| 339 | + )), | ||
| 340 | + Container( | ||
| 341 | + width: double.infinity, | ||
| 342 | + height: ScreenUtil().setHeight(84), | ||
| 343 | + margin: EdgeInsets.only( | ||
| 344 | + bottom: ScreenUtil().setWidth(50)), | ||
| 345 | + padding: EdgeInsets.symmetric( | ||
| 346 | + horizontal: ScreenUtil().setWidth(31)), | ||
| 347 | + alignment: Alignment.center, | ||
| 348 | + color: MyColours.color_ffffff, | ||
| 349 | + child: CommonButton( | ||
| 350 | + content: widget.fromPage == 'tablePhoto' | ||
| 351 | + ? '确定' | ||
| 352 | + : "已选${selectNum}个 确定", | ||
| 353 | + width: 500, | ||
| 354 | + height: 84, | ||
| 355 | + fontSize: 34, | ||
| 356 | + state: 1, | ||
| 357 | + onPress: () { | ||
| 358 | + if (widget.fromPage == "tablePhoto") { | ||
| 359 | + Map temp = { | ||
| 360 | + 'tid': selectTables.length > 0 | ||
| 361 | + ? selectTables[0].id | ||
| 362 | + : '', | ||
| 363 | + 'tname': selectTables.length > 0 | ||
| 364 | + ? selectTables[0].name | ||
| 365 | + : '' | ||
| 366 | + }; | ||
| 367 | + Navigator.of(context).pop(temp); | ||
| 368 | + } else { | ||
| 369 | + if (widget.canChoose) { | ||
| 370 | + // if (widget.tableList.length > 0) { | ||
| 371 | + String tid = ""; | ||
| 372 | + for (TableList table | ||
| 373 | + in widget.tableList) { | ||
| 374 | + tid += table.id + ","; | ||
| 375 | + } | ||
| 376 | + if (widget.tableList.length > 0) { | ||
| 377 | + tid = tid.substring( | ||
| 378 | + 0, tid.length - 1); | ||
| 379 | + } | ||
| 380 | + | ||
| 381 | + Map temp = { | ||
| 382 | + 'object': widget.tableList, | ||
| 383 | + 'tid': tid | ||
| 384 | + }; | ||
| 385 | + Navigator.of(context).pop(temp); | ||
| 386 | + // } | ||
| 387 | + } else { | ||
| 388 | + if (selectTables.length > 0) { | ||
| 389 | + String tid = ""; | ||
| 390 | + for (t.Table table | ||
| 391 | + in selectTables) { | ||
| 392 | + tid += table.id + ","; | ||
| 393 | + } | ||
| 394 | + if (selectTables.length > 0) { | ||
| 395 | + tid = tid.substring( | ||
| 396 | + 0, tid.length - 1); | ||
| 397 | + } | ||
| 398 | + | ||
| 399 | + Map temp = { | ||
| 400 | + 'object': widget.tableList, | ||
| 401 | + 'tid': tid | ||
| 402 | + }; | ||
| 403 | + Navigator.of(context).pop(temp); | ||
| 404 | + } | ||
| 405 | + } | ||
| 406 | + } | ||
| 407 | + }, | ||
| 408 | + )), | ||
| 409 | + ], | ||
| 410 | + )), | ||
| 411 | + ) | ||
| 412 | + ], | ||
| 413 | + ), | ||
| 414 | + ); | ||
| 415 | + } | ||
| 416 | + }), | ||
| 417 | + ), | ||
| 418 | + ], | ||
| 419 | + ), | ||
| 420 | + )); | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + tableToTableList(t.Table table) { | ||
| 424 | + TableList _tableList = TableList( | ||
| 425 | + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); | ||
| 426 | + _tableList.id = table.id; | ||
| 427 | + _tableList.rid = table.rid; | ||
| 428 | + _tableList.tid = table.tid; | ||
| 429 | + _tableList.name = table.name; | ||
| 430 | + _tableList.tablePnum = table.table_pnum; | ||
| 431 | + _tableList.sellerid = null; | ||
| 432 | + _tableList.qrcode = null; | ||
| 433 | + _tableList.mostPnum = table.most_pnum; | ||
| 434 | + _tableList.hot = null; | ||
| 435 | + _tableList.orderO = table.order_o; | ||
| 436 | + _tableList.status = table.status; | ||
| 437 | + _tableList.enable = table.enable; | ||
| 438 | + _tableList.spell = table.spell; | ||
| 439 | + _tableList.cdate = null; | ||
| 440 | + _tableList.rname = table.rname; | ||
| 441 | + _tableList.regionName = table.rname; | ||
| 442 | + _tableList.selected = true; | ||
| 443 | + return _tableList; | ||
| 444 | + } | ||
| 445 | +} |
lib/pages/my/store_base_info_page.dart
0 → 100644
| 1 | +import 'dart:io'; | ||
| 2 | + | ||
| 3 | +import 'package:cached_network_image/cached_network_image.dart'; | ||
| 4 | +import 'package:flutter/material.dart'; | ||
| 5 | +import 'package:flutter/services.dart'; | ||
| 6 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 7 | +import 'package:one_key/models/upload_img_model.dart'; | ||
| 8 | +import 'package:one_key/models/user.dart'; | ||
| 9 | +import 'package:one_key/pages/online_check/photo_view_wiget.dart'; | ||
| 10 | +import 'package:one_key/pages/online_check/progress.dart'; | ||
| 11 | +import 'package:one_key/provider/base_info_provider.dart'; | ||
| 12 | +import 'package:one_key/provider/upload_img_provider.dart'; | ||
| 13 | +import 'package:one_key/provider/user_model.dart'; | ||
| 14 | +import 'package:one_key/res/colors.dart'; | ||
| 15 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 16 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 17 | +import 'package:one_key/utils/upload_image_util.dart'; | ||
| 18 | +import 'package:one_key/utils/utils.dart'; | ||
| 19 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 20 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 21 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 22 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 23 | +import 'package:image_picker/image_picker.dart'; | ||
| 24 | +import 'package:permission_handler/permission_handler.dart'; | ||
| 25 | +import 'package:provider/provider.dart'; | ||
| 26 | + | ||
| 27 | +class StoreBaseInfoPage extends StatefulWidget { | ||
| 28 | + StoreBaseInfoPage({Key key}) : super(key: key); | ||
| 29 | + | ||
| 30 | + @override | ||
| 31 | + _StoreBaseInfoPageState createState() => _StoreBaseInfoPageState(); | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { | ||
| 35 | + ScrollController _scrollController; | ||
| 36 | + TextEditingController _nameController = TextEditingController(); | ||
| 37 | + TextEditingController _phoneController = TextEditingController(); | ||
| 38 | + TextEditingController _timeController = TextEditingController(); | ||
| 39 | + TextEditingController _addressController = TextEditingController(); | ||
| 40 | + TextEditingController _introductionController = TextEditingController(); | ||
| 41 | + FocusNode _nameFocusNode = FocusNode(); | ||
| 42 | + FocusNode _phoneFocusNode = FocusNode(); | ||
| 43 | + FocusNode _timeFocusNode = FocusNode(); | ||
| 44 | + FocusNode _addressFocusNode = FocusNode(); | ||
| 45 | + FocusNode _introductionFocusNode = FocusNode(); | ||
| 46 | + String storeAddress; | ||
| 47 | + | ||
| 48 | + final picker = ImagePicker(); | ||
| 49 | + // OnlineCheckEditProvider _onlineCheckEditProvider; | ||
| 50 | + UploadImageProvider _uploadImageProvider; | ||
| 51 | + BaseIndoProvider _baseIndoProvider; | ||
| 52 | + | ||
| 53 | + @override | ||
| 54 | + void initState() { | ||
| 55 | + super.initState(); | ||
| 56 | + _scrollController = ScrollController(); | ||
| 57 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 58 | + _uploadImageProvider.mentou.process = 0.01; | ||
| 59 | + _uploadImageProvider.mentou.qiniuUrl = ''; | ||
| 60 | + _uploadImageProvider.imgSizeMenTou = 64; | ||
| 61 | + _getQiniuInfo(); | ||
| 62 | + _getStoreBaseinfo(); | ||
| 63 | + }); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + ///获取店铺信息 | ||
| 67 | + _getStoreBaseinfo() async { | ||
| 68 | + Map<String, String> params = { | ||
| 69 | + 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 70 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 71 | + }; | ||
| 72 | + bool success = | ||
| 73 | + await _baseIndoProvider.getCustomerActivityBaseinfo(context, params); | ||
| 74 | + if (success) { | ||
| 75 | + _nameController.text = _baseIndoProvider.baseInfoSunModel.name; | ||
| 76 | + _uploadImageProvider.touxiang.qiniuUrl = | ||
| 77 | + _baseIndoProvider.baseInfoSunModel.photo; | ||
| 78 | + _uploadImageProvider.erweima.qiniuUrl = | ||
| 79 | + _baseIndoProvider.baseInfoSunModel.qrcode; | ||
| 80 | + _phoneController.text = _baseIndoProvider.baseInfoSunModel.phone; | ||
| 81 | + // _positionController.text = _baseIndoProvider.baseInfoSunModel.position; | ||
| 82 | + _uploadImageProvider.imgSizeErweima = 64; | ||
| 83 | + // setState(() {}); | ||
| 84 | + _uploadImageProvider.notifyListeners(); | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + ///获取七牛云token | ||
| 89 | + /// | ||
| 90 | + _getQiniuInfo() async { | ||
| 91 | + await _uploadImageProvider.getQiniuInfo(context, {}); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + /// 修改店铺基本信息 | ||
| 95 | + _setStoreBaseinfo() async { | ||
| 96 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 97 | + | ||
| 98 | + User user = Provider.of<UserModel>(context, listen: false).user; | ||
| 99 | + Map<String, String> params = { | ||
| 100 | + 'sellerid': user.sellerid, | ||
| 101 | + "uid": user.openid, | ||
| 102 | + "name": _nameController.text.trim().length == 0 | ||
| 103 | + ? user.sellername | ||
| 104 | + : _nameController.text.trim(), | ||
| 105 | + "photo": _uploadImageProvider.touxiang.qiniuUrl.trim().length == 0 | ||
| 106 | + ? 'http://nosqn.colorcun.com/yd_person.png' | ||
| 107 | + : _uploadImageProvider.touxiang.qiniuUrl, | ||
| 108 | + // "position": _positionController.text.trim().length == 0 | ||
| 109 | + // ? '经理' | ||
| 110 | + // : _positionController.text, | ||
| 111 | + }; | ||
| 112 | + if (_phoneController.text.trim().length == 0) { | ||
| 113 | + if (user.userphone != null) { | ||
| 114 | + params['phone'] = user.userphone; | ||
| 115 | + } | ||
| 116 | + } else { | ||
| 117 | + params['phone'] = _phoneController.text.trim(); | ||
| 118 | + } | ||
| 119 | + if (_uploadImageProvider.erweima.qiniuUrl != null && | ||
| 120 | + _uploadImageProvider.erweima.qiniuUrl != '') { | ||
| 121 | + params['qrcode'] = _uploadImageProvider.erweima.qiniuUrl; | ||
| 122 | + } | ||
| 123 | + if (_baseIndoProvider.baseInfoSunModel != null) { | ||
| 124 | + params['id'] = _baseIndoProvider.baseInfoSunModel.id; | ||
| 125 | + } | ||
| 126 | + bool isSuccess = | ||
| 127 | + await _baseIndoProvider.setCustomerActivityBaseinfo(context, params); | ||
| 128 | + // _baseIndoProvider.baseInfoSunModel = null; | ||
| 129 | + if (isSuccess) { | ||
| 130 | + _uploadImageProvider.touxiang.file = null; | ||
| 131 | + _uploadImageProvider.erweima.file = null; | ||
| 132 | + //成功之后跳回前一个页面 | ||
| 133 | + // bus.emit('refresh_coupon_list'); | ||
| 134 | + Utils.showToast('保存成功'); | ||
| 135 | + EventBus().emit('changeStatusColor'); | ||
| 136 | + Navigator.pop(context, true); | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + ///输入框 | ||
| 141 | + Widget _textfield(String title, String hintText, | ||
| 142 | + TextEditingController editingController, FocusNode focusNode) { | ||
| 143 | + return Container( | ||
| 144 | + child: Row( | ||
| 145 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 146 | + children: [ | ||
| 147 | + Container( | ||
| 148 | + child: Text( | ||
| 149 | + title, | ||
| 150 | + style: TextStyle( | ||
| 151 | + color: MyColours.color_333333, | ||
| 152 | + fontWeight: FontWeight.bold, | ||
| 153 | + fontSize: ScreenUtil().setSp(34)), | ||
| 154 | + ), | ||
| 155 | + ), | ||
| 156 | + HEmptyView(20), | ||
| 157 | + Spacer(), | ||
| 158 | + Container( | ||
| 159 | + width: ScreenUtil().setWidth(231 * 2), | ||
| 160 | + child: TextField( | ||
| 161 | + controller: editingController, | ||
| 162 | + textAlign: TextAlign.right, | ||
| 163 | + textAlignVertical: TextAlignVertical.bottom, | ||
| 164 | + maxLines: 1, | ||
| 165 | + inputFormatters: title == '详细地址' | ||
| 166 | + ? [ | ||
| 167 | + LengthLimitingTextInputFormatter(20), | ||
| 168 | + // WhitelistingTextInputFormatter.digitsOnly | ||
| 169 | + ] | ||
| 170 | + : [], | ||
| 171 | + | ||
| 172 | + // //光标颜色 | ||
| 173 | + // cursorColor: | ||
| 174 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 175 | + //输入文本的样式 | ||
| 176 | + style: TextStyle( | ||
| 177 | + fontSize: ScreenUtil().setSp(32), | ||
| 178 | + ), | ||
| 179 | + focusNode: focusNode, | ||
| 180 | + decoration: InputDecoration( | ||
| 181 | + border: OutlineInputBorder(borderSide: BorderSide.none), | ||
| 182 | + hintText: hintText, | ||
| 183 | + hintStyle: TextStyle( | ||
| 184 | + color: MyColours.color_999999, | ||
| 185 | + fontSize: ScreenUtil().setSp(32), | ||
| 186 | + ), | ||
| 187 | + enabledBorder: new UnderlineInputBorder( | ||
| 188 | + borderSide: BorderSide.none, | ||
| 189 | + ), | ||
| 190 | + focusedBorder: new UnderlineInputBorder( | ||
| 191 | + borderSide: BorderSide.none, | ||
| 192 | + ), | ||
| 193 | + ), | ||
| 194 | + onChanged: (value) {}, | ||
| 195 | + onEditingComplete: () { | ||
| 196 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 197 | + }, | ||
| 198 | + keyboardType: TextInputType.text, | ||
| 199 | + ), | ||
| 200 | + ) | ||
| 201 | + ], | ||
| 202 | + ), | ||
| 203 | + ); | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + //查看大图 | ||
| 207 | + _showPhotoView(BuildContext context, int index, List imgs, | ||
| 208 | + {isShow = false, List dashName}) async { | ||
| 209 | + // if (imgs.length == 1 && | ||
| 210 | + // imgs[0] == | ||
| 211 | + // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') { | ||
| 212 | + // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png'; | ||
| 213 | + // } | ||
| 214 | + Utils.setBarStatus(false, color: Colors.black); | ||
| 215 | + dynamic result = await showGeneralDialog( | ||
| 216 | + context: context, | ||
| 217 | + barrierDismissible: false, | ||
| 218 | + // barrierColor: Colors.red, | ||
| 219 | + barrierLabel: | ||
| 220 | + MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 221 | + transitionDuration: const Duration(milliseconds: 150), | ||
| 222 | + pageBuilder: (BuildContext context, Animation animation, | ||
| 223 | + Animation secondaryAnimation) { | ||
| 224 | + Widget child = Stack( | ||
| 225 | + children: <Widget>[ | ||
| 226 | + PhotoPreview( | ||
| 227 | + initialIndex: index, | ||
| 228 | + photoList: imgs, | ||
| 229 | + isShow: isShow, | ||
| 230 | + dashName: dashName) | ||
| 231 | + ], | ||
| 232 | + ); | ||
| 233 | + return child; | ||
| 234 | + }); | ||
| 235 | + Utils.setBarStatus(true, color: Colors.white); | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + ///#相机拍照,单图选择 | ||
| 239 | + Future _getFromPictureOrCamera( | ||
| 240 | + String title, UploadImgModel imgModel, imageSource) async { | ||
| 241 | + final pickedFile = await picker.getImage(source: imageSource); | ||
| 242 | + setState(() { | ||
| 243 | + if (pickedFile != null) { | ||
| 244 | + imgModel.file = File(pickedFile.path); | ||
| 245 | + imgModel.process = 0.01; | ||
| 246 | + } else { | ||
| 247 | + print('No image selected.'); | ||
| 248 | + } | ||
| 249 | + }); | ||
| 250 | + if (pickedFile != null) { | ||
| 251 | + if (title == '头像') { | ||
| 252 | + _uploadImageProvider.imgSizeTouxiang = 64; | ||
| 253 | + _uploadImageProvider.touxiang.qiniuUrl = null; | ||
| 254 | + } else { | ||
| 255 | + _uploadImageProvider.imgSizeErweima = 64; | ||
| 256 | + _uploadImageProvider.erweima.qiniuUrl = null; | ||
| 257 | + } | ||
| 258 | + UploadImageUtil().startUploadOnly(context, File(pickedFile.path), | ||
| 259 | + title == '头像' ? 0 : 1, true, _uploadImageProvider); | ||
| 260 | + } | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + ///图片 头像和二维码 | ||
| 264 | + Widget _imageWidget( | ||
| 265 | + String title, UploadImgModel model, double imgSize, double radius) { | ||
| 266 | + return InkWell( | ||
| 267 | + onTap: () { | ||
| 268 | + Utils.getPickPermission(context, () { | ||
| 269 | + _getFromPictureOrCamera(title, model, ImageSource.gallery); | ||
| 270 | + }, Platform.isAndroid ? Permission.storage : Permission.photos); | ||
| 271 | + }, | ||
| 272 | + child: Container( | ||
| 273 | + margin: EdgeInsets.only( | ||
| 274 | + top: ScreenUtil().setWidth(40), | ||
| 275 | + left: ScreenUtil().setWidth(40), | ||
| 276 | + right: ScreenUtil().setWidth(40)), | ||
| 277 | + height: ScreenUtil().setWidth(imgSize * 2), | ||
| 278 | + child: Row( | ||
| 279 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 280 | + children: [ | ||
| 281 | + Text( | ||
| 282 | + title, | ||
| 283 | + textAlign: TextAlign.left, | ||
| 284 | + style: TextStyle( | ||
| 285 | + color: MyColours.color_333333, | ||
| 286 | + fontWeight: FontWeight.bold, | ||
| 287 | + fontSize: ScreenUtil().setSp(34)), | ||
| 288 | + ), | ||
| 289 | + Spacer(), | ||
| 290 | + Stack( | ||
| 291 | + children: [ | ||
| 292 | + InkWell( | ||
| 293 | + onTap: () { | ||
| 294 | + double process; | ||
| 295 | + String qiniuUrl; | ||
| 296 | + List<String> tempList = []; | ||
| 297 | + | ||
| 298 | + process = _uploadImageProvider.mentou.process; | ||
| 299 | + qiniuUrl = _uploadImageProvider.mentou.qiniuUrl; | ||
| 300 | + | ||
| 301 | + if (qiniuUrl != null && qiniuUrl != '') { | ||
| 302 | + tempList.add(qiniuUrl); | ||
| 303 | + | ||
| 304 | + ///没有上传完成的不可以点击 | ||
| 305 | + _showPhotoView(context, 0, tempList); | ||
| 306 | + } else { | ||
| 307 | + Utils.getPickPermission(context, () { | ||
| 308 | + _getFromPictureOrCamera( | ||
| 309 | + title, model, ImageSource.gallery); | ||
| 310 | + }, | ||
| 311 | + Platform.isAndroid | ||
| 312 | + ? Permission.storage | ||
| 313 | + : Permission.photos); | ||
| 314 | + } | ||
| 315 | + }, | ||
| 316 | + child: ClipRRect( | ||
| 317 | + borderRadius: | ||
| 318 | + BorderRadius.circular(ScreenUtil().setWidth(radius)), | ||
| 319 | + child: model.file == null | ||
| 320 | + ? model.qiniuUrl != null && model.qiniuUrl != '' | ||
| 321 | + ? Image.network( | ||
| 322 | + model.qiniuUrl, | ||
| 323 | + fit: BoxFit.cover, | ||
| 324 | + width: ScreenUtil().setWidth(imgSize * 2), | ||
| 325 | + height: ScreenUtil().setWidth(imgSize * 2), | ||
| 326 | + ) | ||
| 327 | + : Image.asset( | ||
| 328 | + Utils.getImgPath('no_image'), | ||
| 329 | + fit: BoxFit.cover, | ||
| 330 | + width: ScreenUtil().setWidth(imgSize * 2), | ||
| 331 | + height: ScreenUtil().setWidth(imgSize * 2), | ||
| 332 | + ) | ||
| 333 | + : Image.file( | ||
| 334 | + model.file, | ||
| 335 | + fit: BoxFit.cover, | ||
| 336 | + width: ScreenUtil().setWidth(imgSize * 2), | ||
| 337 | + height: ScreenUtil().setWidth(imgSize * 2), | ||
| 338 | + ), | ||
| 339 | + ), | ||
| 340 | + ), | ||
| 341 | + (model.file != null) && | ||
| 342 | + model.process != 1 && | ||
| 343 | + model.process != 0.01 | ||
| 344 | + ? Container( | ||
| 345 | + width: ScreenUtil().setWidth(imgSize * 2), | ||
| 346 | + height: ScreenUtil().setWidth(imgSize * 2), | ||
| 347 | + decoration: BoxDecoration( | ||
| 348 | + borderRadius: BorderRadius.circular(radius), | ||
| 349 | + color: Color.fromRGBO(0, 0, 0, 0.6)), | ||
| 350 | + child: Center( | ||
| 351 | + child: Text('上传中', | ||
| 352 | + style: | ||
| 353 | + TextStyle(color: MyColours.color_999999)), | ||
| 354 | + ), | ||
| 355 | + ) | ||
| 356 | + : Container(), | ||
| 357 | + ], | ||
| 358 | + ), | ||
| 359 | + HEmptyView(30), | ||
| 360 | + Image.asset( | ||
| 361 | + "assets/arr_right_gray.png", | ||
| 362 | + width: ScreenUtil().setWidth(14), | ||
| 363 | + height: ScreenUtil().setWidth(22), | ||
| 364 | + ) | ||
| 365 | + ], | ||
| 366 | + ), | ||
| 367 | + )); | ||
| 368 | + } | ||
| 369 | + | ||
| 370 | + ///地图地址选择 | ||
| 371 | + Widget _select(String title, String hintText) { | ||
| 372 | + return InkWell( | ||
| 373 | + onTap: () { | ||
| 374 | + Utils.getPickPermission(context, () async { | ||
| 375 | + Map address = await NavigatorUtil.goMapChoicePointPage(context); | ||
| 376 | + if (address != null) { | ||
| 377 | + setState(() { | ||
| 378 | + storeAddress = address['address']; | ||
| 379 | + // createStoreModel.storeInfo?.address = storeAddress; | ||
| 380 | + // createStoreModel.storeInfo?.lat = address['lat']; | ||
| 381 | + // createStoreModel.storeInfo?.lng = address['lng']; | ||
| 382 | + }); | ||
| 383 | + } | ||
| 384 | + }, Permission.location); | ||
| 385 | + }, | ||
| 386 | + child: Container( | ||
| 387 | + child: Row( | ||
| 388 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 389 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 390 | + children: [ | ||
| 391 | + Container( | ||
| 392 | + child: Text( | ||
| 393 | + title, | ||
| 394 | + style: TextStyle( | ||
| 395 | + color: MyColours.color_333333, | ||
| 396 | + fontWeight: FontWeight.bold, | ||
| 397 | + fontSize: ScreenUtil().setSp(34)), | ||
| 398 | + ), | ||
| 399 | + ), | ||
| 400 | + HEmptyView(20), | ||
| 401 | + Spacer(), | ||
| 402 | + Text(hintText, | ||
| 403 | + style: TextStyle( | ||
| 404 | + color: hintText == '点击选择' | ||
| 405 | + ? MyColours.color_999999 | ||
| 406 | + : MyColours.color_333333, | ||
| 407 | + fontSize: ScreenUtil().setSp(32), | ||
| 408 | + )), | ||
| 409 | + HEmptyView(20), | ||
| 410 | + Image.asset( | ||
| 411 | + Utils.getImgPath('arr_right_gray'), | ||
| 412 | + width: ScreenUtil().setWidth(12), | ||
| 413 | + height: ScreenUtil().setWidth(22), | ||
| 414 | + ) | ||
| 415 | + ], | ||
| 416 | + ), | ||
| 417 | + ), | ||
| 418 | + ); | ||
| 419 | + } | ||
| 420 | + | ||
| 421 | + @override | ||
| 422 | + Widget build(BuildContext context) { | ||
| 423 | + _uploadImageProvider = | ||
| 424 | + Provider.of<UploadImageProvider>(context, listen: true); | ||
| 425 | + _baseIndoProvider = Provider.of<BaseIndoProvider>(context, listen: true); | ||
| 426 | + return Scaffold( | ||
| 427 | + backgroundColor: MyColours.color_fefefe, | ||
| 428 | + appBar: SystemAppBar( | ||
| 429 | + '店铺信息', | ||
| 430 | + onTap: () { | ||
| 431 | + EventBus().emit('changeStatusColor'); | ||
| 432 | + Navigator.of(context).pop(); | ||
| 433 | + }, | ||
| 434 | + ), | ||
| 435 | + body: WillPopScope( | ||
| 436 | + onWillPop: () { | ||
| 437 | + EventBus().emit('changeStatusColor'); | ||
| 438 | + Navigator.of(context).pop(); | ||
| 439 | + }, | ||
| 440 | + child: InkWell( | ||
| 441 | + onTap: () { | ||
| 442 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 443 | + }, | ||
| 444 | + child: Column(children: [ | ||
| 445 | + Expanded( | ||
| 446 | + child: SingleChildScrollView( | ||
| 447 | + controller: _scrollController, | ||
| 448 | + physics: BouncingScrollPhysics(), | ||
| 449 | + child: Column( | ||
| 450 | + children: [ | ||
| 451 | + Padding( | ||
| 452 | + padding: EdgeInsets.symmetric( | ||
| 453 | + horizontal: ScreenUtil().setWidth(40), | ||
| 454 | + ), | ||
| 455 | + child: _textfield('店铺名称', '请填写店铺名称', | ||
| 456 | + _nameController, _nameFocusNode)), | ||
| 457 | + VEmptyView(10), | ||
| 458 | + _imageWidget('门头照片', _uploadImageProvider.mentou, | ||
| 459 | + _uploadImageProvider.imgSizeMenTou, 64), | ||
| 460 | + VEmptyView(30), | ||
| 461 | + Container( | ||
| 462 | + height: ScreenUtil().setWidth(2), | ||
| 463 | + color: MyColours.color_efefef, | ||
| 464 | + margin: EdgeInsets.only( | ||
| 465 | + left: ScreenUtil().setWidth(108 * 2), | ||
| 466 | + right: ScreenUtil().setWidth(40)), | ||
| 467 | + ), | ||
| 468 | + VEmptyView(10), | ||
| 469 | + Padding( | ||
| 470 | + padding: EdgeInsets.symmetric( | ||
| 471 | + horizontal: ScreenUtil().setWidth(40), | ||
| 472 | + ), | ||
| 473 | + child: _textfield('店铺电话', '请填写店铺电话', | ||
| 474 | + _phoneController, _phoneFocusNode)), | ||
| 475 | + VEmptyView(10), | ||
| 476 | + Container( | ||
| 477 | + height: ScreenUtil().setWidth(2), | ||
| 478 | + color: MyColours.color_efefef, | ||
| 479 | + margin: EdgeInsets.only( | ||
| 480 | + left: ScreenUtil().setWidth(108 * 2), | ||
| 481 | + right: ScreenUtil().setWidth(40)), | ||
| 482 | + ), | ||
| 483 | + VEmptyView(10), | ||
| 484 | + Padding( | ||
| 485 | + padding: EdgeInsets.symmetric( | ||
| 486 | + horizontal: ScreenUtil().setWidth(40), | ||
| 487 | + ), | ||
| 488 | + child: _textfield( | ||
| 489 | + '营业时间', | ||
| 490 | + '请填写营业时间,如09:00-23:00', | ||
| 491 | + _timeController, | ||
| 492 | + _timeFocusNode)), | ||
| 493 | + VEmptyView(10), | ||
| 494 | + Container( | ||
| 495 | + height: ScreenUtil().setWidth(2), | ||
| 496 | + color: MyColours.color_efefef, | ||
| 497 | + margin: EdgeInsets.only( | ||
| 498 | + left: ScreenUtil().setWidth(108 * 2), | ||
| 499 | + right: ScreenUtil().setWidth(40)), | ||
| 500 | + ), | ||
| 501 | + VEmptyView(10), | ||
| 502 | + Padding( | ||
| 503 | + padding: EdgeInsets.symmetric( | ||
| 504 | + horizontal: ScreenUtil().setWidth(40), | ||
| 505 | + vertical: ScreenUtil().setWidth(40), | ||
| 506 | + ), | ||
| 507 | + child: _select('地图地址', '点击选择')), | ||
| 508 | + VEmptyView(10), | ||
| 509 | + Container( | ||
| 510 | + height: ScreenUtil().setWidth(2), | ||
| 511 | + color: MyColours.color_efefef, | ||
| 512 | + margin: EdgeInsets.only( | ||
| 513 | + left: ScreenUtil().setWidth(108 * 2), | ||
| 514 | + right: ScreenUtil().setWidth(40)), | ||
| 515 | + ), | ||
| 516 | + VEmptyView(10), | ||
| 517 | + Padding( | ||
| 518 | + padding: EdgeInsets.symmetric( | ||
| 519 | + horizontal: ScreenUtil().setWidth(40), | ||
| 520 | + ), | ||
| 521 | + child: _textfield('详细地址', '请填写店铺详细地址', | ||
| 522 | + _addressController, _addressFocusNode)), | ||
| 523 | + VEmptyView(10), | ||
| 524 | + Container( | ||
| 525 | + height: ScreenUtil().setWidth(2), | ||
| 526 | + color: MyColours.color_efefef, | ||
| 527 | + margin: EdgeInsets.only( | ||
| 528 | + left: ScreenUtil().setWidth(108 * 2), | ||
| 529 | + right: ScreenUtil().setWidth(40)), | ||
| 530 | + ), | ||
| 531 | + VEmptyView(10), | ||
| 532 | + Padding( | ||
| 533 | + padding: EdgeInsets.symmetric( | ||
| 534 | + horizontal: ScreenUtil().setWidth(40), | ||
| 535 | + ), | ||
| 536 | + child: _textfield( | ||
| 537 | + '店铺简介', | ||
| 538 | + '请填写店铺简介', | ||
| 539 | + _introductionController, | ||
| 540 | + _introductionFocusNode)), | ||
| 541 | + VEmptyView(10), | ||
| 542 | + ], | ||
| 543 | + )), | ||
| 544 | + ), | ||
| 545 | + VEmptyView(20), | ||
| 546 | + Padding( | ||
| 547 | + padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0, | ||
| 548 | + ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), | ||
| 549 | + child: RoundButton( | ||
| 550 | + onPressed: () { | ||
| 551 | + //接口 | ||
| 552 | + _setStoreBaseinfo(); | ||
| 553 | + }, | ||
| 554 | + text: '保存', | ||
| 555 | + fontSize: 34, | ||
| 556 | + isBold: false, | ||
| 557 | + height: ScreenUtil().setWidth(80), | ||
| 558 | + width: double.infinity, | ||
| 559 | + radius: ScreenUtil().setWidth(10), | ||
| 560 | + )) | ||
| 561 | + ])))); | ||
| 562 | + } | ||
| 563 | +} |
| @@ -12,8 +12,6 @@ import 'package:one_key/utils/utils.dart'; | @@ -12,8 +12,6 @@ import 'package:one_key/utils/utils.dart'; | ||
| 12 | */ | 12 | */ |
| 13 | class StoreDetailModel with ChangeNotifier { | 13 | class StoreDetailModel with ChangeNotifier { |
| 14 | List<SellerTableClassEntity> tables = []; //商家包间类型 | 14 | List<SellerTableClassEntity> tables = []; //商家包间类型 |
| 15 | - int _money; | ||
| 16 | - int get money => _money; | ||
| 17 | 15 | ||
| 18 | //获取商家包间类型 | 16 | //获取商家包间类型 |
| 19 | Future<List<SellerTableClassEntity>> getSellerTableClass( | 17 | Future<List<SellerTableClassEntity>> getSellerTableClass( |
| @@ -17,8 +17,10 @@ class UploadImageProvider extends ChangeNotifier { | @@ -17,8 +17,10 @@ class UploadImageProvider extends ChangeNotifier { | ||
| 17 | QiniuInfoSunModel qiniuInfoSunModel; | 17 | QiniuInfoSunModel qiniuInfoSunModel; |
| 18 | UploadImgModel touxiang = UploadImgModel(); //头像 | 18 | UploadImgModel touxiang = UploadImgModel(); //头像 |
| 19 | UploadImgModel erweima = UploadImgModel(); //二维码 | 19 | UploadImgModel erweima = UploadImgModel(); //二维码 |
| 20 | + UploadImgModel mentou = UploadImgModel(); //店铺信息----门头照片 | ||
| 20 | double imgSizeTouxiang = 64; | 21 | double imgSizeTouxiang = 64; |
| 21 | double imgSizeErweima = 22; | 22 | double imgSizeErweima = 22; |
| 23 | + double imgSizeMenTou = 64; | ||
| 22 | List<UploadImgModel> imageListDenvironment = []; //环境信息列表 | 24 | List<UploadImgModel> imageListDenvironment = []; //环境信息列表 |
| 23 | List<UploadImgModel> imageListFront = []; //门头信息列表 | 25 | List<UploadImgModel> imageListFront = []; //门头信息列表 |
| 24 | List<UploadImgModel> tableImageList = []; //桌子管理图片信息列表 | 26 | List<UploadImgModel> tableImageList = []; //桌子管理图片信息列表 |
| @@ -358,4 +358,41 @@ class NavigatorUtil { | @@ -358,4 +358,41 @@ class NavigatorUtil { | ||
| 358 | "${Routes.sms_recharge_page}?smsInfoData=${FluroConvertUtils.object2string(smsInfoData)}", | 358 | "${Routes.sms_recharge_page}?smsInfoData=${FluroConvertUtils.object2string(smsInfoData)}", |
| 359 | replace: replace); | 359 | replace: replace); |
| 360 | } | 360 | } |
| 361 | + | ||
| 362 | + /// 店铺信息 | ||
| 363 | + static Future<dynamic> goStoreBaseInfoPage(BuildContext context, | ||
| 364 | + {replace = false, SmsInfoData smsInfoData}) { | ||
| 365 | + return _navigateTo(context, "${Routes.store_base_info_page}", | ||
| 366 | + replace: replace); | ||
| 367 | + } | ||
| 368 | + | ||
| 369 | + /// 包间类型管理 | ||
| 370 | + static Future<dynamic> goRoomTypeManagePage(BuildContext context, | ||
| 371 | + {replace = false, SmsInfoData smsInfoData}) { | ||
| 372 | + return _navigateTo(context, "${Routes.room_type_manage_page}", | ||
| 373 | + replace: replace); | ||
| 374 | + } | ||
| 375 | + | ||
| 376 | + /// 包间类型创建 | ||
| 377 | + static Future<dynamic> goRoomTypeCreatePage(BuildContext context, | ||
| 378 | + {replace = false, SmsInfoData smsInfoData}) { | ||
| 379 | + return _navigateTo(context, "${Routes.room_type_create_page}", | ||
| 380 | + replace: replace); | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + ///包间管理中 ------ 选择桌位 | ||
| 384 | + static Future goRoomTypeSelectTablePage( | ||
| 385 | + BuildContext context, String rid, int dateTime, String ddate_slot, | ||
| 386 | + {bool canChoose = false, | ||
| 387 | + Map object, | ||
| 388 | + String fromPage = 'change', | ||
| 389 | + String tid = ''}) { | ||
| 390 | + if (object != null) { | ||
| 391 | + return _navigateTo(context, | ||
| 392 | + "${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}"); | ||
| 393 | + } | ||
| 394 | + // object = {'object': [], "tid": ''}; | ||
| 395 | + return _navigateTo(context, | ||
| 396 | + "${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose"); | ||
| 397 | + } | ||
| 361 | } | 398 | } |
| @@ -40,8 +40,12 @@ import 'package:one_key/pages/my/contant_page.dart'; | @@ -40,8 +40,12 @@ import 'package:one_key/pages/my/contant_page.dart'; | ||
| 40 | import 'package:one_key/pages/my/my_integral_page.dart'; | 40 | import 'package:one_key/pages/my/my_integral_page.dart'; |
| 41 | import 'package:one_key/pages/my/receive_orders_time_set.dart'; | 41 | import 'package:one_key/pages/my/receive_orders_time_set.dart'; |
| 42 | import 'package:one_key/pages/my/remark_manager_page.dart'; | 42 | import 'package:one_key/pages/my/remark_manager_page.dart'; |
| 43 | +import 'package:one_key/pages/my/room_type/room_type_create_page.dart'; | ||
| 44 | +import 'package:one_key/pages/my/room_type/room_type_manage_page.dart'; | ||
| 45 | +import 'package:one_key/pages/my/room_type/room_type_select_table_page.dart'; | ||
| 43 | import 'package:one_key/pages/my/sms_manager.dart'; | 46 | import 'package:one_key/pages/my/sms_manager.dart'; |
| 44 | import 'package:one_key/pages/my/sms_recharge_page.dart'; | 47 | import 'package:one_key/pages/my/sms_recharge_page.dart'; |
| 48 | +import 'package:one_key/pages/my/store_base_info_page.dart'; | ||
| 45 | import 'package:one_key/pages/my/store_type_fill_manage_page.dart'; | 49 | import 'package:one_key/pages/my/store_type_fill_manage_page.dart'; |
| 46 | import 'package:one_key/pages/notebook/statistics_page.dart'; | 50 | import 'package:one_key/pages/notebook/statistics_page.dart'; |
| 47 | import 'package:one_key/pages/notebook/statistics_sms_page.dart'; | 51 | import 'package:one_key/pages/notebook/statistics_sms_page.dart'; |
| @@ -545,7 +549,68 @@ var smsRechargePageHandler = new Handler( | @@ -545,7 +549,68 @@ var smsRechargePageHandler = new Handler( | ||
| 545 | SmsInfoData data = SmsInfoData.fromJson(json.decode( | 549 | SmsInfoData data = SmsInfoData.fromJson(json.decode( |
| 546 | FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first))); | 550 | FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first))); |
| 547 | return ChangeNotifierProvider<SmsRechargeModel>( | 551 | return ChangeNotifierProvider<SmsRechargeModel>( |
| 548 | - create: (_) => SmsRechargeModel(), child: SmsRechargePage(infoData: data)); | 552 | + create: (_) => SmsRechargeModel(), |
| 553 | + child: SmsRechargePage(infoData: data)); | ||
| 549 | // return ChangeNotifierProvider<UploadImageProvider>( | 554 | // return ChangeNotifierProvider<UploadImageProvider>( |
| 550 | // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); | 555 | // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); |
| 551 | }); | 556 | }); |
| 557 | + | ||
| 558 | +///店铺信息 | ||
| 559 | +var storeBaseInfoPageHandler = new Handler( | ||
| 560 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 561 | + // SmsInfoData data = SmsInfoData.fromJson(json.decode( | ||
| 562 | + // FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first))); | ||
| 563 | + return ChangeNotifierProvider<BaseIndoProvider>( | ||
| 564 | + create: (_) => BaseIndoProvider(), child: StoreBaseInfoPage()); | ||
| 565 | + // return ChangeNotifierProvider<UploadImageProvider>( | ||
| 566 | + // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); | ||
| 567 | +}); | ||
| 568 | + | ||
| 569 | +///包间类型管理 | ||
| 570 | +var roomTypeManagePageHandler = new Handler( | ||
| 571 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 572 | + // SmsInfoData data = SmsInfoData.fromJson(json.decode( | ||
| 573 | + // FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first))); | ||
| 574 | + return ChangeNotifierProvider<StoreDetailModel>( | ||
| 575 | + create: (_) => StoreDetailModel(), child: RoomTypeManagePage()); | ||
| 576 | + // return ChangeNotifierProvider<UploadImageProvider>( | ||
| 577 | + // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); | ||
| 578 | +}); | ||
| 579 | + | ||
| 580 | +///包间类型创建 | ||
| 581 | +var roomTypeCreatePageHandler = new Handler( | ||
| 582 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 583 | + // SmsInfoData data = SmsInfoData.fromJson(json.decode( | ||
| 584 | + // FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first))); | ||
| 585 | + return ChangeNotifierProvider<StoreDetailModel>( | ||
| 586 | + create: (_) => StoreDetailModel(), child: RoomTypeCreatePage()); | ||
| 587 | + // return ChangeNotifierProvider<UploadImageProvider>( | ||
| 588 | + // create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage()); | ||
| 589 | +}); | ||
| 590 | + | ||
| 591 | +// 跳转到包间管理中的选择桌位 | ||
| 592 | +var roomTypeSelectTablePageHandler = new Handler( | ||
| 593 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 594 | + String rid = params['rid'].first; | ||
| 595 | + String tid = params['tid'].first; | ||
| 596 | + DateTime dateTime = | ||
| 597 | + DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first)); | ||
| 598 | + String ddate_slot = params["ddate_slot"].first; | ||
| 599 | + String fromPage = params["fromPage"].first; | ||
| 600 | + bool canChoose = params["canChoose"].first == "true" ? true : false; | ||
| 601 | + List<TableList> res = []; | ||
| 602 | + if (params.keys.contains('object')) { | ||
| 603 | + Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 604 | + List temp = object['object']; | ||
| 605 | + | ||
| 606 | + for (var item in temp) { | ||
| 607 | + res.add(TableList.fromJson(item)); | ||
| 608 | + } | ||
| 609 | + } | ||
| 610 | + | ||
| 611 | + // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose); | ||
| 612 | + return ChangeNotifierProvider<ChooseTableModel>( | ||
| 613 | + create: (_) => ChooseTableModel(), | ||
| 614 | + child: RoomTypeSelectTablePage(rid, dateTime, ddate_slot, | ||
| 615 | + canChoose: canChoose, tableList: res, fromPage: fromPage, tid: tid)); | ||
| 616 | +}); |
| @@ -50,6 +50,11 @@ class Routes { | @@ -50,6 +50,11 @@ class Routes { | ||
| 50 | "/store_type_fill_manage_page"; //包间置满管理 | 50 | "/store_type_fill_manage_page"; //包间置满管理 |
| 51 | static String sms_manager_page = "/sms_manager_page"; //短信充值 | 51 | static String sms_manager_page = "/sms_manager_page"; //短信充值 |
| 52 | static String sms_recharge_page = "/sms_recharge_page"; //短信充值 | 52 | static String sms_recharge_page = "/sms_recharge_page"; //短信充值 |
| 53 | + static String store_base_info_page = "/store_base_info_page"; //店铺信息 | ||
| 54 | + static String room_type_manage_page = "/room_type_manage_page"; //包间类型管理 | ||
| 55 | + static String room_type_create_page = "/room_type_create_page"; //包间类型创建 | ||
| 56 | + static String room_type_select_table_page = | ||
| 57 | + "/room_type_select_table_page"; //包间管理中桌位选择页面 | ||
| 53 | 58 | ||
| 54 | static void configureRoutes(FluroRouter router) { | 59 | static void configureRoutes(FluroRouter router) { |
| 55 | router.notFoundHandler = new Handler( | 60 | router.notFoundHandler = new Handler( |
| @@ -107,5 +112,10 @@ class Routes { | @@ -107,5 +112,10 @@ class Routes { | ||
| 107 | handler: storeTypeFillManagePageHandler); | 112 | handler: storeTypeFillManagePageHandler); |
| 108 | router.define(sms_manager_page, handler: smsManagerPageHandler); | 113 | router.define(sms_manager_page, handler: smsManagerPageHandler); |
| 109 | router.define(sms_recharge_page, handler: smsRechargePageHandler); | 114 | router.define(sms_recharge_page, handler: smsRechargePageHandler); |
| 115 | + router.define(store_base_info_page, handler: storeBaseInfoPageHandler); | ||
| 116 | + router.define(room_type_manage_page, handler: roomTypeManagePageHandler); | ||
| 117 | + router.define(room_type_create_page, handler: roomTypeCreatePageHandler); | ||
| 118 | + router.define(room_type_select_table_page, | ||
| 119 | + handler: roomTypeSelectTablePageHandler); | ||
| 110 | } | 120 | } |
| 111 | } | 121 | } |
| @@ -3,14 +3,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -3,14 +3,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | import 'package:one_key/models/area.dart'; | 3 | import 'package:one_key/models/area.dart'; |
| 4 | import 'package:one_key/res/colors.dart'; | 4 | import 'package:one_key/res/colors.dart'; |
| 5 | 5 | ||
| 6 | -class AreaItem extends StatefulWidget{ | ||
| 7 | - | ||
| 8 | - final String currentArea;//当前选中区域名称 | 6 | +class AreaItem extends StatefulWidget { |
| 7 | + final String currentArea; //当前选中区域名称 | ||
| 9 | final Area area; | 8 | final Area area; |
| 10 | final ValueChanged selectCallback; | 9 | final ValueChanged selectCallback; |
| 11 | - | ||
| 12 | - AreaItem(this.area,this.currentArea,this.selectCallback); | ||
| 13 | - | 10 | + final bool need; |
| 11 | + | ||
| 12 | + AreaItem(this.area, this.currentArea, this.selectCallback, | ||
| 13 | + {this.need = true}); | ||
| 14 | + | ||
| 14 | @override | 15 | @override |
| 15 | State<StatefulWidget> createState() { | 16 | State<StatefulWidget> createState() { |
| 16 | // TODO: implement createState | 17 | // TODO: implement createState |
| @@ -18,16 +19,15 @@ class AreaItem extends StatefulWidget{ | @@ -18,16 +19,15 @@ class AreaItem extends StatefulWidget{ | ||
| 18 | } | 19 | } |
| 19 | } | 20 | } |
| 20 | 21 | ||
| 21 | -class AreaItemState extends State<AreaItem>{ | ||
| 22 | - | 22 | +class AreaItemState extends State<AreaItem> { |
| 23 | @override | 23 | @override |
| 24 | Widget build(BuildContext context) { | 24 | Widget build(BuildContext context) { |
| 25 | // TODO: implement build | 25 | // TODO: implement build |
| 26 | - Area area=widget.area; | ||
| 27 | - bool isSelected=area.name==widget.currentArea; | 26 | + Area area = widget.area; |
| 27 | + bool isSelected = area.name == widget.currentArea; | ||
| 28 | return GestureDetector( | 28 | return GestureDetector( |
| 29 | - onTap: (){ | ||
| 30 | - if(widget.selectCallback!=null){ | 29 | + onTap: () { |
| 30 | + if (widget.selectCallback != null) { | ||
| 31 | widget.selectCallback(widget.area); | 31 | widget.selectCallback(widget.area); |
| 32 | } | 32 | } |
| 33 | }, | 33 | }, |
| @@ -38,27 +38,51 @@ class AreaItemState extends State<AreaItem>{ | @@ -38,27 +38,51 @@ class AreaItemState extends State<AreaItem>{ | ||
| 38 | height: ScreenUtil().setHeight(207), | 38 | height: ScreenUtil().setHeight(207), |
| 39 | alignment: Alignment.center, | 39 | alignment: Alignment.center, |
| 40 | decoration: BoxDecoration( | 40 | decoration: BoxDecoration( |
| 41 | - color: isSelected?MyColours.color_ffffff:MyColours.color_f1f1f1, | ||
| 42 | - border: Border(bottom: BorderSide(color: MyColours.color_ffffff,width: ScreenUtil().setHeight(1))) | ||
| 43 | - ), | ||
| 44 | - child: Text(area.name,style: TextStyle(color: isSelected?MyColours.color_2bb5b7:MyColours.color_828282,fontSize: ScreenUtil().setSp(32),decoration: TextDecoration.none,fontWeight: FontWeight.normal),), | ||
| 45 | - ), | ||
| 46 | - Positioned( | ||
| 47 | - left: 0, | ||
| 48 | - top: 0, | ||
| 49 | - child: Container( | ||
| 50 | - width: ScreenUtil().setWidth(73), | ||
| 51 | - height: ScreenUtil().setHeight(37), | ||
| 52 | - alignment: Alignment.center, | ||
| 53 | - decoration: BoxDecoration( | ||
| 54 | - color: area.count<=0?MyColours.color_999999:MyColours.color_63a6d1, | ||
| 55 | - borderRadius: BorderRadius.only(topRight: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8))) | ||
| 56 | - ), | ||
| 57 | - child: Text(area.count<=0?"满座":"余${area.count}",style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none,fontWeight: FontWeight.normal)), | 41 | + color: isSelected |
| 42 | + ? MyColours.color_ffffff | ||
| 43 | + : MyColours.color_f1f1f1, | ||
| 44 | + border: Border( | ||
| 45 | + bottom: BorderSide( | ||
| 46 | + color: MyColours.color_ffffff, | ||
| 47 | + width: ScreenUtil().setHeight(1)))), | ||
| 48 | + child: Text( | ||
| 49 | + area.name, | ||
| 50 | + style: TextStyle( | ||
| 51 | + color: isSelected | ||
| 52 | + ? MyColours.color_2bb5b7 | ||
| 53 | + : MyColours.color_828282, | ||
| 54 | + fontSize: ScreenUtil().setSp(32), | ||
| 55 | + decoration: TextDecoration.none, | ||
| 56 | + fontWeight: FontWeight.normal), | ||
| 58 | ), | 57 | ), |
| 59 | ), | 58 | ), |
| 59 | + widget.need | ||
| 60 | + ? Positioned( | ||
| 61 | + left: 0, | ||
| 62 | + top: 0, | ||
| 63 | + child: Container( | ||
| 64 | + width: ScreenUtil().setWidth(73), | ||
| 65 | + height: ScreenUtil().setHeight(37), | ||
| 66 | + alignment: Alignment.center, | ||
| 67 | + decoration: BoxDecoration( | ||
| 68 | + color: area.count <= 0 | ||
| 69 | + ? MyColours.color_999999 | ||
| 70 | + : MyColours.color_63a6d1, | ||
| 71 | + borderRadius: BorderRadius.only( | ||
| 72 | + topRight: Radius.circular(ScreenUtil().setWidth(8)), | ||
| 73 | + bottomRight: | ||
| 74 | + Radius.circular(ScreenUtil().setWidth(8)))), | ||
| 75 | + child: Text(area.count <= 0 ? "满座" : "余${area.count}", | ||
| 76 | + style: TextStyle( | ||
| 77 | + color: MyColours.color_ffffff, | ||
| 78 | + fontSize: ScreenUtil().setSp(26), | ||
| 79 | + decoration: TextDecoration.none, | ||
| 80 | + fontWeight: FontWeight.normal)), | ||
| 81 | + ), | ||
| 82 | + ) | ||
| 83 | + : SizedBox(), | ||
| 60 | ], | 84 | ], |
| 61 | ), | 85 | ), |
| 62 | ); | 86 | ); |
| 63 | } | 87 | } |
| 64 | -} | ||
| 88 | +} |
| @@ -15,6 +15,7 @@ class TableItem extends StatefulWidget { | @@ -15,6 +15,7 @@ class TableItem extends StatefulWidget { | ||
| 15 | final Map<String, Notebook> tableMap; //记录已预订桌位对应的订单 | 15 | final Map<String, Notebook> tableMap; //记录已预订桌位对应的订单 |
| 16 | 16 | ||
| 17 | final int height; //高度 | 17 | final int height; //高度 |
| 18 | + final bool need; | ||
| 18 | 19 | ||
| 19 | TableItem(this.table, | 20 | TableItem(this.table, |
| 20 | {this.onSelected, | 21 | {this.onSelected, |
| @@ -22,7 +23,8 @@ class TableItem extends StatefulWidget { | @@ -22,7 +23,8 @@ class TableItem extends StatefulWidget { | ||
| 22 | this.height = 185, | 23 | this.height = 185, |
| 23 | this.fromPage = 'new', | 24 | this.fromPage = 'new', |
| 24 | this.rid, | 25 | this.rid, |
| 25 | - this.tableMap}); | 26 | + this.tableMap, |
| 27 | + this.need = true}); | ||
| 26 | 28 | ||
| 27 | @override | 29 | @override |
| 28 | State<StatefulWidget> createState() { | 30 | State<StatefulWidget> createState() { |
| @@ -209,53 +211,55 @@ class TableItemState extends State<TableItem> { | @@ -209,53 +211,55 @@ class TableItemState extends State<TableItem> { | ||
| 209 | ], | 211 | ], |
| 210 | ), | 212 | ), |
| 211 | ), | 213 | ), |
| 212 | - Positioned( | ||
| 213 | - bottom: 0, | ||
| 214 | - left: 0, | ||
| 215 | - right: 0, | ||
| 216 | - child: signStr.isEmpty | ||
| 217 | - ? Container() | ||
| 218 | - : Stack( | ||
| 219 | - alignment: Alignment.center, | ||
| 220 | - children: [ | ||
| 221 | - Container( | ||
| 222 | - width: ScreenUtil().setWidth(160), | ||
| 223 | - height: ScreenUtil().setWidth(40), | ||
| 224 | - alignment: Alignment.center, | ||
| 225 | - decoration: BoxDecoration( | ||
| 226 | - color: signStr == '已停用' | ||
| 227 | - ? MyColours.color_777777 | ||
| 228 | - : signStr == '已买单' | ||
| 229 | - ? MyColours.color_F59A23 | ||
| 230 | - : MyColours.color_E95750, | ||
| 231 | - borderRadius: BorderRadius.only( | ||
| 232 | - bottomLeft: Radius.circular( | ||
| 233 | - ScreenUtil().setWidth(8)), | ||
| 234 | - bottomRight: Radius.circular( | ||
| 235 | - ScreenUtil().setWidth(8)))), | ||
| 236 | - child: Text( | ||
| 237 | - signStr, | ||
| 238 | - style: TextStyle( | ||
| 239 | - color: MyColours.color_ffffff, | ||
| 240 | - fontSize: ScreenUtil().setSp(24), | ||
| 241 | - decoration: TextDecoration.none, | ||
| 242 | - fontWeight: FontWeight.normal), | 214 | + widget.need |
| 215 | + ? Positioned( | ||
| 216 | + bottom: 0, | ||
| 217 | + left: 0, | ||
| 218 | + right: 0, | ||
| 219 | + child: signStr.isEmpty | ||
| 220 | + ? Container() | ||
| 221 | + : Stack( | ||
| 222 | + alignment: Alignment.center, | ||
| 223 | + children: [ | ||
| 224 | + Container( | ||
| 225 | + width: ScreenUtil().setWidth(160), | ||
| 226 | + height: ScreenUtil().setWidth(40), | ||
| 227 | + alignment: Alignment.center, | ||
| 228 | + decoration: BoxDecoration( | ||
| 229 | + color: signStr == '已停用' | ||
| 230 | + ? MyColours.color_777777 | ||
| 231 | + : signStr == '已买单' | ||
| 232 | + ? MyColours.color_F59A23 | ||
| 233 | + : MyColours.color_E95750, | ||
| 234 | + borderRadius: BorderRadius.only( | ||
| 235 | + bottomLeft: Radius.circular( | ||
| 236 | + ScreenUtil().setWidth(8)), | ||
| 237 | + bottomRight: Radius.circular( | ||
| 238 | + ScreenUtil().setWidth(8)))), | ||
| 239 | + child: Text( | ||
| 240 | + signStr, | ||
| 241 | + style: TextStyle( | ||
| 242 | + color: MyColours.color_ffffff, | ||
| 243 | + fontSize: ScreenUtil().setSp(24), | ||
| 244 | + decoration: TextDecoration.none, | ||
| 245 | + fontWeight: FontWeight.normal), | ||
| 246 | + ), | ||
| 247 | + ), | ||
| 248 | + Positioned( | ||
| 249 | + left: 0, | ||
| 250 | + bottom: 0, | ||
| 251 | + top: 0, | ||
| 252 | + child: table.isPhoto == 1 | ||
| 253 | + ? Image.asset( | ||
| 254 | + "assets/photo.png", | ||
| 255 | + width: ScreenUtil().setWidth(40), | ||
| 256 | + // height: ScreenUtil().setWidth(40), | ||
| 257 | + ) | ||
| 258 | + : Container()) | ||
| 259 | + ], | ||
| 243 | ), | 260 | ), |
| 244 | - ), | ||
| 245 | - Positioned( | ||
| 246 | - left: 0, | ||
| 247 | - bottom: 0, | ||
| 248 | - top: 0, | ||
| 249 | - child: table.isPhoto == 1 | ||
| 250 | - ? Image.asset( | ||
| 251 | - "assets/photo.png", | ||
| 252 | - width: ScreenUtil().setWidth(40), | ||
| 253 | - // height: ScreenUtil().setWidth(40), | ||
| 254 | - ) | ||
| 255 | - : Container()) | ||
| 256 | - ], | ||
| 257 | - ), | ||
| 258 | - ), | 261 | + ) |
| 262 | + : SizedBox(), | ||
| 259 | ], | 263 | ], |
| 260 | ), | 264 | ), |
| 261 | ), | 265 | ), |
| @@ -269,18 +273,20 @@ class TableItemState extends State<TableItem> { | @@ -269,18 +273,20 @@ class TableItemState extends State<TableItem> { | ||
| 269 | height: ScreenUtil().setWidth(40), | 273 | height: ScreenUtil().setWidth(40), |
| 270 | ) | 274 | ) |
| 271 | : Container()), | 275 | : Container()), |
| 272 | - signStr.isEmpty | ||
| 273 | - ? Positioned( | ||
| 274 | - left: ScreenUtil().setWidth(8), | ||
| 275 | - bottom: ScreenUtil().setWidth(16), | ||
| 276 | - child: table.isPhoto == 1 | ||
| 277 | - ? Image.asset( | ||
| 278 | - "assets/photo.png", | ||
| 279 | - width: ScreenUtil().setWidth(40), | ||
| 280 | - height: ScreenUtil().setWidth(40), | ||
| 281 | - ) | ||
| 282 | - : Container()) | ||
| 283 | - : Container() | 276 | + widget.need |
| 277 | + ? signStr.isEmpty | ||
| 278 | + ? Positioned( | ||
| 279 | + left: ScreenUtil().setWidth(8), | ||
| 280 | + bottom: ScreenUtil().setWidth(16), | ||
| 281 | + child: table.isPhoto == 1 | ||
| 282 | + ? Image.asset( | ||
| 283 | + "assets/photo.png", | ||
| 284 | + width: ScreenUtil().setWidth(40), | ||
| 285 | + height: ScreenUtil().setWidth(40), | ||
| 286 | + ) | ||
| 287 | + : Container()) | ||
| 288 | + : Container() | ||
| 289 | + : SizedBox() | ||
| 284 | ], | 290 | ], |
| 285 | ), | 291 | ), |
| 286 | ); | 292 | ); |
-
Please register or login to post a comment