Showing
10 changed files
with
359 additions
and
69 deletions
lib/models/get_deposit_model.dart
0 → 100644
| 1 | +class GetDepositModel { | ||
| 2 | + int ret; | ||
| 3 | + List<GetDepositSunModel> data; | ||
| 4 | + String msg; | ||
| 5 | + | ||
| 6 | + GetDepositModel({this.ret, this.data, this.msg}); | ||
| 7 | + | ||
| 8 | + GetDepositModel.fromJson(Map<String, dynamic> json) { | ||
| 9 | + ret = json['ret']; | ||
| 10 | + if (json['data'] != null) { | ||
| 11 | + data = <GetDepositSunModel>[]; | ||
| 12 | + json['data'].forEach((v) { | ||
| 13 | + data.add(new GetDepositSunModel.fromJson(v)); | ||
| 14 | + }); | ||
| 15 | + } | ||
| 16 | + msg = json['msg']; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + Map<String, dynamic> toJson() { | ||
| 20 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 21 | + data['ret'] = this.ret; | ||
| 22 | + if (this.data != null) { | ||
| 23 | + data['data'] = this.data.map((v) => v.toJson()).toList(); | ||
| 24 | + } | ||
| 25 | + data['msg'] = this.msg; | ||
| 26 | + return data; | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +class GetDepositSunModel { | ||
| 31 | + String id; | ||
| 32 | + String sid; | ||
| 33 | + String dname; | ||
| 34 | + String status; | ||
| 35 | + String cdate; | ||
| 36 | + | ||
| 37 | + GetDepositSunModel({this.id, this.sid, this.dname, this.status, this.cdate}); | ||
| 38 | + | ||
| 39 | + GetDepositSunModel.fromJson(Map<String, dynamic> json) { | ||
| 40 | + id = json['id']; | ||
| 41 | + sid = json['sid']; | ||
| 42 | + dname = json['dname']; | ||
| 43 | + status = json['status']; | ||
| 44 | + cdate = json['cdate']; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + Map<String, dynamic> toJson() { | ||
| 48 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 49 | + data['id'] = this.id; | ||
| 50 | + data['sid'] = this.sid; | ||
| 51 | + data['dname'] = this.dname; | ||
| 52 | + data['status'] = this.status; | ||
| 53 | + data['cdate'] = this.cdate; | ||
| 54 | + return data; | ||
| 55 | + } | ||
| 56 | +} |
| @@ -282,4 +282,13 @@ class HttpUrl { | @@ -282,4 +282,13 @@ class HttpUrl { | ||
| 282 | static const String set_banquet_conf = | 282 | static const String set_banquet_conf = |
| 283 | "?service=App.Banquet.SetBanquetConf"; // 商家宴会配置 | 283 | "?service=App.Banquet.SetBanquetConf"; // 商家宴会配置 |
| 284 | 284 | ||
| 285 | + static const String get_banquet_conf = | ||
| 286 | + "?service=App.Banquet.GetBanquetConf"; // 获取商家宴会配置 | ||
| 287 | + | ||
| 288 | + static const String get_deposit = | ||
| 289 | + "?service=App.Banquet.GetDeposit"; // 获取宴会定金 | ||
| 290 | + static const String set_deposit = | ||
| 291 | + "?service=App.Banquet.SetDeposit"; // 添加/修改宴会定金 | ||
| 292 | + static const String del_deposit = "?service=App.Banquet.DelDeposit"; // 删除宴会定金 | ||
| 293 | + | ||
| 285 | } | 294 | } |
| @@ -24,13 +24,19 @@ class FeastDepositManagePage extends StatefulWidget { | @@ -24,13 +24,19 @@ class FeastDepositManagePage extends StatefulWidget { | ||
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | class _FeastDepositManagePageState extends State<FeastDepositManagePage> { | 26 | class _FeastDepositManagePageState extends State<FeastDepositManagePage> { |
| 27 | - bool canrReturn = true; //是否可退 | ||
| 28 | FeastModel feastModel; | 27 | FeastModel feastModel; |
| 29 | 28 | ||
| 30 | @override | 29 | @override |
| 31 | void initState() { | 30 | void initState() { |
| 32 | super.initState(); | 31 | super.initState(); |
| 33 | Utils.changeStatusColor(color: MyColours.color_438E93); | 32 | Utils.changeStatusColor(color: MyColours.color_438E93); |
| 33 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 34 | + _getBanquetConf(); | ||
| 35 | + }); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + _getBanquetConf() async { | ||
| 39 | + await feastModel.getBanquetConf(context); | ||
| 34 | } | 40 | } |
| 35 | 41 | ||
| 36 | Widget feastManegeItem(String title, {GestureTapCallback onTap}) { | 42 | Widget feastManegeItem(String title, {GestureTapCallback onTap}) { |
| @@ -114,7 +120,8 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> { | @@ -114,7 +120,8 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> { | ||
| 114 | InkWell( | 120 | InkWell( |
| 115 | onTap: () async { | 121 | onTap: () async { |
| 116 | setState(() { | 122 | setState(() { |
| 117 | - canrReturn = !canrReturn; | 123 | + feastModel.isDepositBack = |
| 124 | + !feastModel.isDepositBack; | ||
| 118 | }); | 125 | }); |
| 119 | 126 | ||
| 120 | Map<String, String> pramas = { | 127 | Map<String, String> pramas = { |
| @@ -122,7 +129,8 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> { | @@ -122,7 +129,8 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> { | ||
| 122 | Provider.of<UserModel>(context, listen: false) | 129 | Provider.of<UserModel>(context, listen: false) |
| 123 | .user | 130 | .user |
| 124 | .sellerid, | 131 | .sellerid, |
| 125 | - 'is_deposit_back': canrReturn ? '1' : '0' | 132 | + 'is_deposit_back': |
| 133 | + feastModel.isDepositBack ? '1' : '0' | ||
| 126 | }; | 134 | }; |
| 127 | await feastModel.setBanquetConf(context, pramas); | 135 | await feastModel.setBanquetConf(context, pramas); |
| 128 | }, | 136 | }, |
| @@ -130,8 +138,9 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> { | @@ -130,8 +138,9 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> { | ||
| 130 | padding: | 138 | padding: |
| 131 | EdgeInsets.only(left: w(16), right: w(16)), | 139 | EdgeInsets.only(left: w(16), right: w(16)), |
| 132 | child: Image.asset( | 140 | child: Image.asset( |
| 133 | - Utils.getImgPath( | ||
| 134 | - canrReturn ? 'swich_on' : 'swich_off'), | 141 | + Utils.getImgPath(feastModel.isDepositBack |
| 142 | + ? 'swich_on' | ||
| 143 | + : 'swich_off'), | ||
| 135 | width: w(44), | 144 | width: w(44), |
| 136 | ))), | 145 | ))), |
| 137 | ], | 146 | ], |
| 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/models/get_deposit_model.dart'; | ||
| 4 | +import 'package:one_key/provider/feast_model.dart'; | ||
| 5 | +import 'package:provider/provider.dart'; | ||
| 3 | 6 | ||
| 7 | +import '../../../constant/state.dart'; | ||
| 8 | +import '../../../provider/user_model.dart'; | ||
| 4 | import '../../../res/colors.dart'; | 9 | import '../../../res/colors.dart'; |
| 5 | import '../../../utils/dialog_util.dart'; | 10 | import '../../../utils/dialog_util.dart'; |
| 11 | +import '../../../utils/event_bus.dart'; | ||
| 6 | import '../../../utils/screen_util.dart'; | 12 | import '../../../utils/screen_util.dart'; |
| 7 | import '../../../utils/utils.dart'; | 13 | import '../../../utils/utils.dart'; |
| 8 | import '../../../widgets/h_empty_view.dart'; | 14 | import '../../../widgets/h_empty_view.dart'; |
| 15 | +import '../../../widgets/page_exception.dart'; | ||
| 9 | import '../../../widgets/round_button.dart'; | 16 | import '../../../widgets/round_button.dart'; |
| 10 | import '../../../widgets/system_app_bar.dart'; | 17 | import '../../../widgets/system_app_bar.dart'; |
| 11 | 18 | ||
| @@ -21,10 +28,42 @@ class FeastDepositTypePage extends StatefulWidget { | @@ -21,10 +28,42 @@ class FeastDepositTypePage extends StatefulWidget { | ||
| 21 | } | 28 | } |
| 22 | 29 | ||
| 23 | class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | 30 | class _FeastDepositTypePageState extends State<FeastDepositTypePage> { |
| 31 | + FeastModel feastModel; | ||
| 24 | @override | 32 | @override |
| 25 | void initState() { | 33 | void initState() { |
| 26 | super.initState(); | 34 | super.initState(); |
| 27 | Utils.changeStatusColor(color: MyColours.color_438E93); | 35 | Utils.changeStatusColor(color: MyColours.color_438E93); |
| 36 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 37 | + _getDeposit(); | ||
| 38 | + // scrollController.jumpTo(scrollController.position.minScrollExtent); | ||
| 39 | + }); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + ///获取宴会分类 | ||
| 43 | + Future<bool> _getDeposit({bool isShowLoading = true}) async { | ||
| 44 | + await feastModel.getDeposit(context, isShowLoading: isShowLoading); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + _setDeposit(String dname, {String did}) async { | ||
| 48 | + Map<String, String> params = { | ||
| 49 | + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 50 | + 'dname': dname, | ||
| 51 | + }; | ||
| 52 | + if (did != null) { | ||
| 53 | + params['id'] = did; | ||
| 54 | + } | ||
| 55 | + bool success = await feastModel.setDeposit(context, params); | ||
| 56 | + if (success) { | ||
| 57 | + if (did != null) { | ||
| 58 | + Utils.showToast('修改成功'); | ||
| 59 | + } else { | ||
| 60 | + Utils.showToast('添加成功'); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + _getDeposit(); | ||
| 64 | + | ||
| 65 | + // _getWine(isShowLoading: true); | ||
| 66 | + } | ||
| 28 | } | 67 | } |
| 29 | 68 | ||
| 30 | Widget buildFeastTypeHeader() { | 69 | Widget buildFeastTypeHeader() { |
| @@ -37,6 +76,7 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | @@ -37,6 +76,7 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | ||
| 37 | lenghtLimit: false, | 76 | lenghtLimit: false, |
| 38 | toast: '请输入类型名称', rCallback: (name) { | 77 | toast: '请输入类型名称', rCallback: (name) { |
| 39 | // _addCookbookClass(name, showLoading: true); | 78 | // _addCookbookClass(name, showLoading: true); |
| 79 | + _setDeposit(name); | ||
| 40 | }); | 80 | }); |
| 41 | }, | 81 | }, |
| 42 | text: '添加一项', | 82 | text: '添加一项', |
| @@ -53,7 +93,7 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | @@ -53,7 +93,7 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | ||
| 53 | ); | 93 | ); |
| 54 | } | 94 | } |
| 55 | 95 | ||
| 56 | - Widget buildFeastTypeItem(String title) { | 96 | + Widget buildFeastTypeItem(GetDepositSunModel sunModel, int index) { |
| 57 | return Container( | 97 | return Container( |
| 58 | height: h(48), | 98 | height: h(48), |
| 59 | margin: EdgeInsets.only(top: w(12)), | 99 | margin: EdgeInsets.only(top: w(12)), |
| @@ -64,7 +104,7 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | @@ -64,7 +104,7 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | ||
| 64 | child: Row( | 104 | child: Row( |
| 65 | children: [ | 105 | children: [ |
| 66 | Text( | 106 | Text( |
| 67 | - title, | 107 | + sunModel.dname, |
| 68 | style: | 108 | style: |
| 69 | TextStyle(fontSize: font(16), color: MyColours.color_E6000000), | 109 | TextStyle(fontSize: font(16), color: MyColours.color_E6000000), |
| 70 | ), | 110 | ), |
| @@ -74,10 +114,11 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | @@ -74,10 +114,11 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | ||
| 74 | DialogUtil.textfeildAlertDialog(context, | 114 | DialogUtil.textfeildAlertDialog(context, |
| 75 | title: '输入类型名称', | 115 | title: '输入类型名称', |
| 76 | hintText: '请输入', | 116 | hintText: '请输入', |
| 77 | - text: '原来的内容', | 117 | + text: sunModel.dname, |
| 78 | lenghtLimit: true, | 118 | lenghtLimit: true, |
| 79 | toast: '请输入类型名称', rCallback: (name) { | 119 | toast: '请输入类型名称', rCallback: (name) { |
| 80 | // _addCookbookClass(name, showLoading: true); | 120 | // _addCookbookClass(name, showLoading: true); |
| 121 | + _setDeposit(name, did: sunModel.id); | ||
| 81 | }); | 122 | }); |
| 82 | }, | 123 | }, |
| 83 | child: Text( | 124 | child: Text( |
| @@ -95,15 +136,20 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | @@ -95,15 +136,20 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | ||
| 95 | DialogUtil.cupertinoAlertDialogFeast(context, | 136 | DialogUtil.cupertinoAlertDialogFeast(context, |
| 96 | rTitle: '删除', | 137 | rTitle: '删除', |
| 97 | title: "是否确认删除", | 138 | title: "是否确认删除", |
| 98 | - content: "酒水定金", lCallback: () { | 139 | + content: sunModel.dname, lCallback: () { |
| 99 | print("取消"); | 140 | print("取消"); |
| 100 | - }, rCallback: () { | 141 | + }, rCallback: () async { |
| 101 | print("确定"); | 142 | print("确定"); |
| 102 | - // widget.deleteCallback(index); | 143 | + Map<String, String> pramas = {'id': sunModel.id}; |
| 144 | + bool success = await feastModel.delDeposit(context, pramas); | ||
| 145 | + if (success) { | ||
| 146 | + Utils.showToast('删除成功'); | ||
| 147 | + _getDeposit(isShowLoading: true); | ||
| 148 | + } | ||
| 103 | }); | 149 | }); |
| 104 | }, | 150 | }, |
| 105 | child: Image.asset( | 151 | child: Image.asset( |
| 106 | - Utils.getImgPath(true ? 'f_delete_red_un' : 'f_delete_red'), | 152 | + Utils.getImgPath('f_delete_red'), |
| 107 | width: w(32), | 153 | width: w(32), |
| 108 | height: w(32), | 154 | height: w(32), |
| 109 | )), | 155 | )), |
| @@ -115,8 +161,12 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | @@ -115,8 +161,12 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | ||
| 115 | 161 | ||
| 116 | @override | 162 | @override |
| 117 | Widget build(BuildContext context) { | 163 | Widget build(BuildContext context) { |
| 164 | + feastModel = Provider.of<FeastModel>(context, listen: true); | ||
| 118 | return Scaffold( | 165 | return Scaffold( |
| 119 | backgroundColor: MyColours.color_ffffff, | 166 | backgroundColor: MyColours.color_ffffff, |
| 167 | + resizeToAvoidBottomInset: false, | ||
| 168 | + | ||
| 169 | + /// 这里必须禁止重绘 | ||
| 120 | appBar: SystemAppBar( | 170 | appBar: SystemAppBar( |
| 121 | '定金类型', | 171 | '定金类型', |
| 122 | needWhite: true, | 172 | needWhite: true, |
| @@ -144,12 +194,27 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | @@ -144,12 +194,27 @@ class _FeastDepositTypePageState extends State<FeastDepositTypePage> { | ||
| 144 | ) | 194 | ) |
| 145 | ]; | 195 | ]; |
| 146 | }, | 196 | }, |
| 147 | - body: ListView.builder( | ||
| 148 | - itemCount: 100, | ||
| 149 | - padding: EdgeInsets.only(left: w(16)), | ||
| 150 | - itemBuilder: (BuildContext context, int index) { | ||
| 151 | - return buildFeastTypeItem('酒水定金'); | ||
| 152 | - }), | 197 | + body: Consumer<FeastModel>(builder: (context, model, _) { |
| 198 | + if (model.pageStateDeposit != PageState.Success) { | ||
| 199 | + return ExceptionPage( | ||
| 200 | + pageState: model.pageStateDeposit, | ||
| 201 | + callback: () { | ||
| 202 | + _getDeposit(); | ||
| 203 | + }, | ||
| 204 | + emptyMsg: "暂时没有定金类型哦", | ||
| 205 | + emptyImg: "empty_search", | ||
| 206 | + showMsg: "加载中,请稍后...", | ||
| 207 | + ); | ||
| 208 | + } else { | ||
| 209 | + return ListView.builder( | ||
| 210 | + itemCount: feastModel.depositData.length, | ||
| 211 | + padding: EdgeInsets.only(left: w(16)), | ||
| 212 | + itemBuilder: (BuildContext context, int index) { | ||
| 213 | + GetDepositSunModel sunModel = feastModel.depositData[index]; | ||
| 214 | + return buildFeastTypeItem(sunModel, index); | ||
| 215 | + }); | ||
| 216 | + } | ||
| 217 | + }), | ||
| 153 | ), | 218 | ), |
| 154 | ); | 219 | ); |
| 155 | } | 220 | } |
| @@ -190,6 +190,9 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> { | @@ -190,6 +190,9 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> { | ||
| 190 | feastModel = Provider.of<FeastModel>(context, listen: true); | 190 | feastModel = Provider.of<FeastModel>(context, listen: true); |
| 191 | return Scaffold( | 191 | return Scaffold( |
| 192 | backgroundColor: MyColours.color_ffffff, | 192 | backgroundColor: MyColours.color_ffffff, |
| 193 | + resizeToAvoidBottomInset: false, | ||
| 194 | + | ||
| 195 | + /// 这里必须禁止重绘 | ||
| 193 | appBar: SystemAppBar( | 196 | appBar: SystemAppBar( |
| 194 | '其他配置管理', | 197 | '其他配置管理', |
| 195 | needWhite: true, | 198 | needWhite: true, |
| @@ -176,55 +176,59 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { | @@ -176,55 +176,59 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { | ||
| 176 | Widget build(BuildContext context) { | 176 | Widget build(BuildContext context) { |
| 177 | feastModel = Provider.of<FeastModel>(context, listen: true); | 177 | feastModel = Provider.of<FeastModel>(context, listen: true); |
| 178 | return Scaffold( | 178 | return Scaffold( |
| 179 | - backgroundColor: MyColours.color_ffffff, | ||
| 180 | - appBar: SystemAppBar( | ||
| 181 | - '套餐管理', | ||
| 182 | - needWhite: true, | ||
| 183 | - bgColor: MyColours.color_438E93, | ||
| 184 | - titleColor: MyColours.color_F6F6F6, | ||
| 185 | - onTap: () { | ||
| 186 | - Navigator.pop(context); | ||
| 187 | - }, | ||
| 188 | - ), | ||
| 189 | - body: NestedScrollView( | 179 | + backgroundColor: MyColours.color_ffffff, |
| 180 | + resizeToAvoidBottomInset: false, | ||
| 181 | + | ||
| 182 | + /// 这里必须禁止重绘 | ||
| 183 | + appBar: SystemAppBar( | ||
| 184 | + '套餐管理', | ||
| 185 | + needWhite: true, | ||
| 186 | + bgColor: MyColours.color_438E93, | ||
| 187 | + titleColor: MyColours.color_F6F6F6, | ||
| 188 | + onTap: () { | ||
| 189 | + Navigator.pop(context); | ||
| 190 | + }, | ||
| 191 | + ), | ||
| 192 | + body: NestedScrollView( | ||
| 190 | // controller: _scrollViewController, | 193 | // controller: _scrollViewController, |
| 191 | headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { | 194 | headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { |
| 192 | - return <Widget>[ | ||
| 193 | - SliverAppBar( | ||
| 194 | - pinned: true, | ||
| 195 | - floating: false, | ||
| 196 | - leading: null, | ||
| 197 | - backgroundColor: MyColours.color_ffffff, | ||
| 198 | - expandedHeight: ScreenUtil().setWidth(56 * 2), | ||
| 199 | - automaticallyImplyLeading: false, | ||
| 200 | - title: buildFeastTypeHeader(), | ||
| 201 | - // flexibleSpace: FlexibleSpaceBar( | ||
| 202 | - // collapseMode: CollapseMode.pin, | ||
| 203 | - // title: buildFeastTypeHeader()) | ||
| 204 | - ) | ||
| 205 | - ]; | ||
| 206 | - }, body: Consumer<FeastModel>(builder: (context, model, _) { | ||
| 207 | - if (model.pageStateSetmeal != PageState.Success) { | ||
| 208 | - return ExceptionPage( | ||
| 209 | - pageState: model.pageStateSetmeal, | ||
| 210 | - callback: () { | ||
| 211 | - _getSetmeal(); | ||
| 212 | - }, | ||
| 213 | - emptyMsg: "暂时没有套餐哦", | ||
| 214 | - emptyImg: "empty_search", | ||
| 215 | - showMsg: "加载中,请稍后...", | ||
| 216 | - ); | ||
| 217 | - } else { | ||
| 218 | - return ListView.builder( | ||
| 219 | - itemCount: model.setmealData.length, | ||
| 220 | - padding: EdgeInsets.only(left: w(16)), | ||
| 221 | - itemBuilder: (BuildContext context, int index) { | ||
| 222 | - SetMealSunModel data = model.setmealData[index]; | ||
| 223 | - return buildFeastTypeItem(data, index); | ||
| 224 | - // '1299套餐', '1499元 不可议价' | ||
| 225 | - }); | ||
| 226 | - } | ||
| 227 | - })), | ||
| 228 | - ); | 195 | + return <Widget>[ |
| 196 | + SliverAppBar( | ||
| 197 | + pinned: true, | ||
| 198 | + floating: false, | ||
| 199 | + leading: null, | ||
| 200 | + backgroundColor: MyColours.color_ffffff, | ||
| 201 | + expandedHeight: ScreenUtil().setWidth(56 * 2), | ||
| 202 | + automaticallyImplyLeading: false, | ||
| 203 | + title: buildFeastTypeHeader(), | ||
| 204 | + // flexibleSpace: FlexibleSpaceBar( | ||
| 205 | + // collapseMode: CollapseMode.pin, | ||
| 206 | + // title: buildFeastTypeHeader()) | ||
| 207 | + ) | ||
| 208 | + ]; | ||
| 209 | + }, | ||
| 210 | + body: Consumer<FeastModel>(builder: (context, model, _) { | ||
| 211 | + if (model.pageStateSetmeal != PageState.Success) { | ||
| 212 | + return ExceptionPage( | ||
| 213 | + pageState: model.pageStateSetmeal, | ||
| 214 | + callback: () { | ||
| 215 | + _getSetmeal(); | ||
| 216 | + }, | ||
| 217 | + emptyMsg: "暂时没有套餐哦", | ||
| 218 | + emptyImg: "empty_search", | ||
| 219 | + showMsg: "加载中,请稍后...", | ||
| 220 | + ); | ||
| 221 | + } else { | ||
| 222 | + return ListView.builder( | ||
| 223 | + itemCount: model.setmealData.length, | ||
| 224 | + padding: EdgeInsets.only(left: w(16)), | ||
| 225 | + itemBuilder: (BuildContext context, int index) { | ||
| 226 | + SetMealSunModel data = model.setmealData[index]; | ||
| 227 | + return buildFeastTypeItem(data, index); | ||
| 228 | + // '1299套餐', '1499元 不可议价' | ||
| 229 | + }); | ||
| 230 | + } | ||
| 231 | + }), | ||
| 232 | + )); | ||
| 229 | } | 233 | } |
| 230 | } | 234 | } |
| @@ -53,7 +53,12 @@ class _FeastTypePageState extends State<FeastTypePage> { | @@ -53,7 +53,12 @@ class _FeastTypePageState extends State<FeastTypePage> { | ||
| 53 | } | 53 | } |
| 54 | bool success = await feastModel.setClassify(context, params); | 54 | bool success = await feastModel.setClassify(context, params); |
| 55 | if (success) { | 55 | if (success) { |
| 56 | - Utils.showToast('添加成功'); | 56 | + if (idstr != null) { |
| 57 | + Utils.showToast('修改成功'); | ||
| 58 | + } else { | ||
| 59 | + Utils.showToast('添加成功'); | ||
| 60 | + } | ||
| 61 | + | ||
| 57 | _getClassify(isShowLoading: true); | 62 | _getClassify(isShowLoading: true); |
| 58 | } | 63 | } |
| 59 | } | 64 | } |
| @@ -158,6 +163,9 @@ class _FeastTypePageState extends State<FeastTypePage> { | @@ -158,6 +163,9 @@ class _FeastTypePageState extends State<FeastTypePage> { | ||
| 158 | feastModel = Provider.of<FeastModel>(context, listen: true); | 163 | feastModel = Provider.of<FeastModel>(context, listen: true); |
| 159 | return Scaffold( | 164 | return Scaffold( |
| 160 | backgroundColor: MyColours.color_ffffff, | 165 | backgroundColor: MyColours.color_ffffff, |
| 166 | + resizeToAvoidBottomInset: false, | ||
| 167 | + | ||
| 168 | + /// 这里必须禁止重绘 | ||
| 161 | appBar: SystemAppBar( | 169 | appBar: SystemAppBar( |
| 162 | '宴会类型', | 170 | '宴会类型', |
| 163 | needWhite: true, | 171 | needWhite: true, |
| @@ -192,6 +192,9 @@ class _FeastWineManagePageState extends State<FeastWineManagePage> { | @@ -192,6 +192,9 @@ class _FeastWineManagePageState extends State<FeastWineManagePage> { | ||
| 192 | feastModel = Provider.of<FeastModel>(context, listen: true); | 192 | feastModel = Provider.of<FeastModel>(context, listen: true); |
| 193 | return Scaffold( | 193 | return Scaffold( |
| 194 | backgroundColor: MyColours.color_ffffff, | 194 | backgroundColor: MyColours.color_ffffff, |
| 195 | + resizeToAvoidBottomInset: false, | ||
| 196 | + | ||
| 197 | + /// 这里必须禁止重绘 | ||
| 195 | appBar: SystemAppBar( | 198 | appBar: SystemAppBar( |
| 196 | '酒水管理', | 199 | '酒水管理', |
| 197 | needWhite: true, | 200 | needWhite: true, |
| @@ -8,6 +8,7 @@ import '../constant/constant.dart'; | @@ -8,6 +8,7 @@ import '../constant/constant.dart'; | ||
| 8 | import '../constant/error.dart'; | 8 | import '../constant/error.dart'; |
| 9 | import '../models/classify_model.dart'; | 9 | import '../models/classify_model.dart'; |
| 10 | import '../models/filter_btn_model.dart'; | 10 | import '../models/filter_btn_model.dart'; |
| 11 | +import '../models/get_deposit_model.dart'; | ||
| 11 | import '../models/get_seller_user_by_sellerid_model.dart'; | 12 | import '../models/get_seller_user_by_sellerid_model.dart'; |
| 12 | import '../models/get_setmeal_class_by_id_model.dart'; | 13 | import '../models/get_setmeal_class_by_id_model.dart'; |
| 13 | import '../models/get_staff_model.dart'; | 14 | import '../models/get_staff_model.dart'; |
| @@ -49,6 +50,10 @@ class FeastModel extends ChangeNotifier { | @@ -49,6 +50,10 @@ class FeastModel extends ChangeNotifier { | ||
| 49 | 50 | ||
| 50 | GetSetmealClassByIdSunModel setmealClassDetail; //菜品分类详情 | 51 | GetSetmealClassByIdSunModel setmealClassDetail; //菜品分类详情 |
| 51 | 52 | ||
| 53 | + bool isDepositBack = false; //定金是否可退 | ||
| 54 | + PageState pageStateDeposit = PageState.Loading; //其他配置 | ||
| 55 | + List<GetDepositSunModel> depositData = []; | ||
| 56 | + | ||
| 52 | /*** | 57 | /*** |
| 53 | * | 58 | * |
| 54 | * 宴会员工 | 59 | * 宴会员工 |
| @@ -835,7 +840,7 @@ class FeastModel extends ChangeNotifier { | @@ -835,7 +840,7 @@ class FeastModel extends ChangeNotifier { | ||
| 835 | * 定金 | 840 | * 定金 |
| 836 | */ | 841 | */ |
| 837 | 842 | ||
| 838 | - ///添加宴会套餐 | 843 | + ///添加宴会配置 |
| 839 | Future<dynamic> setBanquetConf( | 844 | Future<dynamic> setBanquetConf( |
| 840 | BuildContext context, Map<String, String> params, | 845 | BuildContext context, Map<String, String> params, |
| 841 | {isShowLoading = true}) async { | 846 | {isShowLoading = true}) async { |
| @@ -860,4 +865,132 @@ class FeastModel extends ChangeNotifier { | @@ -860,4 +865,132 @@ class FeastModel extends ChangeNotifier { | ||
| 860 | return false; | 865 | return false; |
| 861 | } | 866 | } |
| 862 | } | 867 | } |
| 868 | + | ||
| 869 | + ///获取宴会配置 | ||
| 870 | + getBanquetConf(BuildContext context, {isShowLoading = true}) async { | ||
| 871 | + Map<String, String> params = { | ||
| 872 | + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 873 | + }; | ||
| 874 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 875 | + .request<dynamic>(context, Method.get, HttpUrl.get_banquet_conf, | ||
| 876 | + data: params, showLoading: isShowLoading) | ||
| 877 | + .catchError((error) { | ||
| 878 | + print(error.toString()); | ||
| 879 | + if (error is MyError) {} | ||
| 880 | + }); | ||
| 881 | + if (baseResp.code == Constant.status_success) { | ||
| 882 | + if (baseResp.data == false) { | ||
| 883 | + isDepositBack = false; | ||
| 884 | + Map<String, String> pramas = { | ||
| 885 | + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 886 | + 'is_deposit_back': '0' | ||
| 887 | + }; | ||
| 888 | + await setBanquetConf(context, params); | ||
| 889 | + } else { | ||
| 890 | + isDepositBack = baseResp.data['is_deposit_back'] == '1' ? true : false; | ||
| 891 | + } | ||
| 892 | + notifyListeners(); | ||
| 893 | + } else { | ||
| 894 | + if (baseResp != null) { | ||
| 895 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 896 | + } | ||
| 897 | + } | ||
| 898 | + } | ||
| 899 | + | ||
| 900 | + ///添加宴会定金 | ||
| 901 | + Future<dynamic> setDeposit(BuildContext context, Map<String, String> params, | ||
| 902 | + {isShowLoading = true}) async { | ||
| 903 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 904 | + .request<dynamic>(context, Method.get, HttpUrl.set_deposit, | ||
| 905 | + data: params, showLoading: isShowLoading) | ||
| 906 | + .catchError((error) { | ||
| 907 | + print(error.toString()); | ||
| 908 | + if (error is MyError) {} | ||
| 909 | + return false; | ||
| 910 | + }); | ||
| 911 | + if (baseResp.code == Constant.status_success) { | ||
| 912 | + // if (baseResp.data == 1) { | ||
| 913 | + return true; | ||
| 914 | + // } else { | ||
| 915 | + // return false; | ||
| 916 | + // } | ||
| 917 | + } else { | ||
| 918 | + if (baseResp != null) { | ||
| 919 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 920 | + } | ||
| 921 | + return false; | ||
| 922 | + } | ||
| 923 | + } | ||
| 924 | + | ||
| 925 | + ///获取宴会定金 | ||
| 926 | + Future<bool> getDeposit(BuildContext context, {isShowLoading = true}) async { | ||
| 927 | + Map<String, String> params = { | ||
| 928 | + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 929 | + }; | ||
| 930 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 931 | + .request<dynamic>(context, Method.get, HttpUrl.get_deposit, | ||
| 932 | + data: params, showLoading: isShowLoading) | ||
| 933 | + .catchError((error) { | ||
| 934 | + print(error.toString()); | ||
| 935 | + if (error is MyError) { | ||
| 936 | + switch (error.type) { | ||
| 937 | + case 1: | ||
| 938 | + pageStateDeposit = PageState.ConnectivityError; | ||
| 939 | + break; | ||
| 940 | + case 2: | ||
| 941 | + pageStateDeposit = PageState.ConnectivityTimeOut; | ||
| 942 | + break; | ||
| 943 | + default: | ||
| 944 | + pageStateDeposit = PageState.ConnectivityError; | ||
| 945 | + break; | ||
| 946 | + } | ||
| 947 | + } | ||
| 948 | + notifyListeners(); | ||
| 949 | + return false; | ||
| 950 | + }); | ||
| 951 | + | ||
| 952 | + GetDepositModel getDepositModel = | ||
| 953 | + GetDepositModel.fromJson(baseResp.responseData); | ||
| 954 | + if (getDepositModel.ret == Constant.status_success) { | ||
| 955 | + depositData = getDepositModel.data; | ||
| 956 | + if (depositData.length == 0) { | ||
| 957 | + pageStateDeposit = PageState.Empty; | ||
| 958 | + } else { | ||
| 959 | + pageStateDeposit = PageState.Success; | ||
| 960 | + } | ||
| 961 | + | ||
| 962 | + notifyListeners(); | ||
| 963 | + return true; | ||
| 964 | + } else { | ||
| 965 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 966 | + pageStateDeposit = PageState.ConnectivityError; | ||
| 967 | + notifyListeners(); | ||
| 968 | + return false; | ||
| 969 | + } | ||
| 970 | + } | ||
| 971 | + | ||
| 972 | + ///删除宴会定金 | ||
| 973 | + Future<dynamic> delDeposit(BuildContext context, Map<String, String> params, | ||
| 974 | + {isShowLoading = true}) async { | ||
| 975 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 976 | + .request<dynamic>(context, Method.get, HttpUrl.del_deposit, | ||
| 977 | + data: params, showLoading: isShowLoading) | ||
| 978 | + .catchError((error) { | ||
| 979 | + print(error.toString()); | ||
| 980 | + if (error is MyError) {} | ||
| 981 | + return false; | ||
| 982 | + }); | ||
| 983 | + if (baseResp.code == Constant.status_success) { | ||
| 984 | + // if (baseResp.data == 1) { | ||
| 985 | + return true; | ||
| 986 | + // } else { | ||
| 987 | + // return false; | ||
| 988 | + // } | ||
| 989 | + } else { | ||
| 990 | + if (baseResp != null) { | ||
| 991 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 992 | + } | ||
| 993 | + return false; | ||
| 994 | + } | ||
| 995 | + } | ||
| 863 | } | 996 | } |
| @@ -724,7 +724,7 @@ class DialogUtil { | @@ -724,7 +724,7 @@ class DialogUtil { | ||
| 724 | shape: RoundedRectangleBorder( | 724 | shape: RoundedRectangleBorder( |
| 725 | borderRadius: BorderRadius.all( | 725 | borderRadius: BorderRadius.all( |
| 726 | Radius.circular(ScreenUtil().setWidth(10)))), //设置圆角 | 726 | Radius.circular(ScreenUtil().setWidth(10)))), //设置圆角 |
| 727 | - child: Container( | 727 | + child: Expanded( |
| 728 | child: Column( | 728 | child: Column( |
| 729 | children: [ | 729 | children: [ |
| 730 | VEmptyView(64), | 730 | VEmptyView(64), |
-
Please register or login to post a comment