Showing
14 changed files
with
502 additions
and
171 deletions
assets/coupon_select_type_store.png
0 → 100755
3.17 KB
assets/coupon_select_type_store_un.png
0 → 100755
4.04 KB
assets/coupon_select_type_user.png
0 → 100755
2.7 KB
assets/coupon_select_type_user_un.png
0 → 100755
3.32 KB
assets/quan_down_f.png
0 → 100755
1.19 KB
assets/quan_up_f.png
0 → 100755
1.17 KB
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; | ||
| 3 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 4 | +import 'package:one_key/res/colors.dart'; | ||
| 5 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 6 | +import 'package:one_key/utils/utils.dart'; | ||
| 7 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 8 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 9 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 10 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 11 | + | ||
| 12 | +class CouponCreateSelectTypePage extends StatefulWidget { | ||
| 13 | + CouponCreateSelectTypePage({Key key}) : super(key: key); | ||
| 14 | + | ||
| 15 | + @override | ||
| 16 | + _CouponCreateSelectTypePageState createState() => | ||
| 17 | + _CouponCreateSelectTypePageState(); | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +class _CouponCreateSelectTypePageState | ||
| 21 | + extends State<CouponCreateSelectTypePage> { | ||
| 22 | + bool selectF = true; | ||
| 23 | + @override | ||
| 24 | + Widget build(BuildContext context) { | ||
| 25 | + return Scaffold( | ||
| 26 | + backgroundColor: MyColours.color_ffffff, | ||
| 27 | + appBar: SystemAppBar( | ||
| 28 | + '选择优惠券类型', | ||
| 29 | + onTap: () { | ||
| 30 | + Navigator.pop(context); | ||
| 31 | + }, | ||
| 32 | + ), | ||
| 33 | + body: SingleChildScrollView( | ||
| 34 | + child: Column( | ||
| 35 | + children: [ | ||
| 36 | + VEmptyView(98), | ||
| 37 | + InkWell( | ||
| 38 | + onTap: () { | ||
| 39 | + if (!selectF) { | ||
| 40 | + setState(() { | ||
| 41 | + selectF = !selectF; | ||
| 42 | + }); | ||
| 43 | + } | ||
| 44 | + }, | ||
| 45 | + child: Container( | ||
| 46 | + padding: EdgeInsets.symmetric( | ||
| 47 | + horizontal: ScreenUtil().setWidth(60)), | ||
| 48 | + margin: EdgeInsets.symmetric( | ||
| 49 | + horizontal: ScreenUtil().setWidth(60)), | ||
| 50 | + height: ScreenUtil().setWidth(106 * 2), | ||
| 51 | + decoration: BoxDecoration( | ||
| 52 | + boxShadow: [ | ||
| 53 | + BoxShadow( | ||
| 54 | + offset: Offset(0, ScreenUtil().setWidth(4)), | ||
| 55 | + blurRadius: ScreenUtil().setWidth(20), | ||
| 56 | + spreadRadius: ScreenUtil().setWidth(2), | ||
| 57 | + color: Color.fromRGBO(32, 109, 114, 0.2)) | ||
| 58 | + ], | ||
| 59 | + color: selectF | ||
| 60 | + ? MyColours.color_438E93 | ||
| 61 | + : MyColours.color_ffffff, | ||
| 62 | + borderRadius: | ||
| 63 | + BorderRadius.circular(ScreenUtil().setWidth(24))), | ||
| 64 | + child: Row( | ||
| 65 | + children: [ | ||
| 66 | + Image.asset( | ||
| 67 | + Utils.getImgPath(selectF | ||
| 68 | + ? 'coupon_select_type_user' | ||
| 69 | + : 'coupon_select_type_user_un'), | ||
| 70 | + width: ScreenUtil().setWidth(70 * 2), | ||
| 71 | + ), | ||
| 72 | + HEmptyView(70), | ||
| 73 | + Column( | ||
| 74 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 75 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 76 | + children: [ | ||
| 77 | + Text( | ||
| 78 | + '仅为我创建', | ||
| 79 | + style: TextStyle( | ||
| 80 | + fontWeight: FontWeight.bold, | ||
| 81 | + fontSize: ScreenUtil().setSp(36), | ||
| 82 | + color: selectF | ||
| 83 | + ? MyColours.color_ffffff | ||
| 84 | + : MyColours.color_999999), | ||
| 85 | + ), | ||
| 86 | + VEmptyView(16), | ||
| 87 | + Text( | ||
| 88 | + '创建后仅我可发放该优惠券', | ||
| 89 | + style: TextStyle( | ||
| 90 | + fontSize: ScreenUtil().setSp(24), | ||
| 91 | + color: selectF | ||
| 92 | + ? MyColours.color_ffffff | ||
| 93 | + : MyColours.color_BFC4D4), | ||
| 94 | + ), | ||
| 95 | + ], | ||
| 96 | + ), | ||
| 97 | + ], | ||
| 98 | + ), | ||
| 99 | + )), | ||
| 100 | + VEmptyView(94), | ||
| 101 | + InkWell( | ||
| 102 | + onTap: () { | ||
| 103 | + if (selectF) { | ||
| 104 | + setState(() { | ||
| 105 | + selectF = !selectF; | ||
| 106 | + }); | ||
| 107 | + } | ||
| 108 | + }, | ||
| 109 | + child: Container( | ||
| 110 | + padding: EdgeInsets.symmetric( | ||
| 111 | + horizontal: ScreenUtil().setWidth(60)), | ||
| 112 | + margin: EdgeInsets.symmetric( | ||
| 113 | + horizontal: ScreenUtil().setWidth(60)), | ||
| 114 | + height: ScreenUtil().setWidth(106 * 2), | ||
| 115 | + decoration: BoxDecoration( | ||
| 116 | + boxShadow: [ | ||
| 117 | + BoxShadow( | ||
| 118 | + offset: Offset(0, ScreenUtil().setWidth(4)), | ||
| 119 | + blurRadius: ScreenUtil().setWidth(20), | ||
| 120 | + spreadRadius: ScreenUtil().setWidth(2), | ||
| 121 | + color: Color.fromRGBO(0, 0, 0, 0.1)) | ||
| 122 | + ], | ||
| 123 | + color: !selectF | ||
| 124 | + ? MyColours.color_438E93 | ||
| 125 | + : MyColours.color_ffffff, | ||
| 126 | + borderRadius: | ||
| 127 | + BorderRadius.circular(ScreenUtil().setWidth(24))), | ||
| 128 | + child: Row( | ||
| 129 | + children: [ | ||
| 130 | + Image.asset( | ||
| 131 | + Utils.getImgPath(!selectF | ||
| 132 | + ? 'coupon_select_type_store' | ||
| 133 | + : 'coupon_select_type_store_un'), | ||
| 134 | + width: ScreenUtil().setWidth(75 * 2), | ||
| 135 | + ), | ||
| 136 | + HEmptyView(60), | ||
| 137 | + Expanded( | ||
| 138 | + child: Column( | ||
| 139 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 140 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 141 | + children: [ | ||
| 142 | + Text( | ||
| 143 | + '为全店创建', | ||
| 144 | + style: TextStyle( | ||
| 145 | + fontWeight: FontWeight.bold, | ||
| 146 | + fontSize: ScreenUtil().setSp(36), | ||
| 147 | + color: !selectF | ||
| 148 | + ? MyColours.color_ffffff | ||
| 149 | + : MyColours.color_999999), | ||
| 150 | + ), | ||
| 151 | + VEmptyView(16), | ||
| 152 | + Text( | ||
| 153 | + '创建后所有员工均可发放该优惠券', | ||
| 154 | + style: TextStyle( | ||
| 155 | + fontSize: ScreenUtil().setSp(24), | ||
| 156 | + color: !selectF | ||
| 157 | + ? MyColours.color_ffffff | ||
| 158 | + : MyColours.color_BFC4D4), | ||
| 159 | + ), | ||
| 160 | + ], | ||
| 161 | + )), | ||
| 162 | + ], | ||
| 163 | + ), | ||
| 164 | + )), | ||
| 165 | + VEmptyView(112), | ||
| 166 | + RoundButton( | ||
| 167 | + text: '立即创建', | ||
| 168 | + gradientStart: MyColours.color_ffffff, | ||
| 169 | + gradientEnd: MyColours.color_ffffff, | ||
| 170 | + borderColor: MyColours.color_438E93, | ||
| 171 | + width: ScreenUtil().setWidth(130 * 2), | ||
| 172 | + height: ScreenUtil().setWidth(37 * 2), | ||
| 173 | + textColor: MyColours.color_438E93, | ||
| 174 | + fontSize: 24, | ||
| 175 | + isBold: true, | ||
| 176 | + radius: ScreenUtil().setWidth(22), | ||
| 177 | + onPressed: () async { | ||
| 178 | + bool needRefresh = await NavigatorUtil.goCouponEditPage(context, | ||
| 179 | + isMine: selectF); | ||
| 180 | + print(needRefresh); | ||
| 181 | + if (needRefresh != null && needRefresh) { | ||
| 182 | + //刷新页面数据 | ||
| 183 | + // _controller.callRefresh(); | ||
| 184 | + // _couponNetworkData(); | ||
| 185 | + } | ||
| 186 | + }, | ||
| 187 | + ) | ||
| 188 | + ], | ||
| 189 | + ), | ||
| 190 | + ), | ||
| 191 | + ); | ||
| 192 | + } | ||
| 193 | +} |
| @@ -22,7 +22,8 @@ import 'package:provider/provider.dart'; | @@ -22,7 +22,8 @@ import 'package:provider/provider.dart'; | ||
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | class CouponEidtPage extends StatefulWidget { | 24 | class CouponEidtPage extends StatefulWidget { |
| 25 | - CouponEidtPage({Key key}) : super(key: key); | 25 | + final bool isMine; |
| 26 | + CouponEidtPage({Key key, this.isMine = true}) : super(key: key); | ||
| 26 | 27 | ||
| 27 | @override | 28 | @override |
| 28 | _CouponEidtPageState createState() => _CouponEidtPageState(); | 29 | _CouponEidtPageState createState() => _CouponEidtPageState(); |
| @@ -33,7 +34,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -33,7 +34,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 33 | TextEditingController _couponNameEditControl = TextEditingController(); | 34 | TextEditingController _couponNameEditControl = TextEditingController(); |
| 34 | TextEditingController _couponRequireEditControl = TextEditingController(); | 35 | TextEditingController _couponRequireEditControl = TextEditingController(); |
| 35 | TextEditingController _couponExplainEditControl = TextEditingController(); | 36 | TextEditingController _couponExplainEditControl = TextEditingController(); |
| 36 | - final heightCell = ScreenUtil().setWidth(48); | 37 | + final heightCell = ScreenUtil().setWidth(48 * 2); |
| 37 | bool swichState = true; //默认启用 开关状态 | 38 | bool swichState = true; //默认启用 开关状态 |
| 38 | final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); | 39 | final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); |
| 39 | String fromDate = '点击选择'; //有效期开始时间 | 40 | String fromDate = '点击选择'; //有效期开始时间 |
| @@ -42,6 +43,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -42,6 +43,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 42 | FocusNode _requireFocusNode = FocusNode(); | 43 | FocusNode _requireFocusNode = FocusNode(); |
| 43 | bool showDateSelWidget = false; | 44 | bool showDateSelWidget = false; |
| 44 | CouponProvider couponProvider; | 45 | CouponProvider couponProvider; |
| 46 | + bool swichHexiao = true; //默认启用 核销状态 | ||
| 45 | 47 | ||
| 46 | @override | 48 | @override |
| 47 | void initState() { | 49 | void initState() { |
| @@ -87,8 +89,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -87,8 +89,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 87 | : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}', | 89 | : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}', |
| 88 | "explain": _couponExplainEditControl.text, | 90 | "explain": _couponExplainEditControl.text, |
| 89 | "is_open": swichState ? "1" : "0", | 91 | "is_open": swichState ? "1" : "0", |
| 90 | - "status": swichState ? "1" : "0" | 92 | + "status": swichState ? "1" : "0", |
| 93 | + 'is_type': widget.isMine ? "2" : "1" | ||
| 91 | }; | 94 | }; |
| 95 | + if (!widget.isMine) { | ||
| 96 | + params['is_examine'] = swichHexiao ? "1" : "0"; | ||
| 97 | + params['uid_list'] = ''; | ||
| 98 | + } | ||
| 92 | bool isSuccess = | 99 | bool isSuccess = |
| 93 | await couponProvider.createCustomerActivity(context, params); | 100 | await couponProvider.createCustomerActivity(context, params); |
| 94 | if (isSuccess) { | 101 | if (isSuccess) { |
| @@ -108,9 +115,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -108,9 +115,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 108 | child: Text( | 115 | child: Text( |
| 109 | title, | 116 | title, |
| 110 | style: TextStyle( | 117 | style: TextStyle( |
| 111 | - color: MyColours.color_333333, | 118 | + color: Color.fromRGBO(0, 0, 0, 0.9), |
| 112 | fontWeight: FontWeight.bold, | 119 | fontWeight: FontWeight.bold, |
| 113 | - fontSize: ScreenUtil().setSp(34)), | 120 | + fontSize: ScreenUtil().setSp(32)), |
| 114 | ), | 121 | ), |
| 115 | ), | 122 | ), |
| 116 | HEmptyView(80), | 123 | HEmptyView(80), |
| @@ -128,6 +135,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -128,6 +135,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 128 | // widget.isSelect ? Colors.white : MyColours.color_199095, | 135 | // widget.isSelect ? Colors.white : MyColours.color_199095, |
| 129 | //输入文本的样式 | 136 | //输入文本的样式 |
| 130 | style: TextStyle( | 137 | style: TextStyle( |
| 138 | + color: MyColours.color_515151, | ||
| 131 | fontSize: ScreenUtil().setSp(32), | 139 | fontSize: ScreenUtil().setSp(32), |
| 132 | ), | 140 | ), |
| 133 | focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode, | 141 | focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode, |
| @@ -151,51 +159,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -151,51 +159,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 151 | }, | 159 | }, |
| 152 | keyboardType: TextInputType.text, | 160 | keyboardType: TextInputType.text, |
| 153 | ), | 161 | ), |
| 154 | - ) | 162 | + ), |
| 163 | + HEmptyView(32) | ||
| 155 | ], | 164 | ], |
| 156 | ), | 165 | ), |
| 157 | ); | 166 | ); |
| 158 | } | 167 | } |
| 159 | 168 | ||
| 160 | ///时间选择 | 169 | ///时间选择 |
| 161 | - Widget _select(String title, String hintText) { | 170 | + Widget _select(String title, String hintText, GestureTapCallback onTap) { |
| 162 | return InkWell( | 171 | return InkWell( |
| 163 | - onTap: () { | ||
| 164 | - FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 165 | - //弹出时间选择器 | ||
| 166 | - // showPickerDateTime(context); | ||
| 167 | - showDateSelWidget = true; | ||
| 168 | - DialogUtil.showPickerDateTime24( | ||
| 169 | - context, | ||
| 170 | - scaffoldKey, | ||
| 171 | - (value) { | ||
| 172 | - // {'text': picker.adapter.text, 'select': selecteds} | ||
| 173 | - if (value != null) { | ||
| 174 | - if (title == '有效期从') { | ||
| 175 | - setState(() { | ||
| 176 | - print(value); | ||
| 177 | - fromDate = | ||
| 178 | - DateUtil.formatDateStr(value, format: DateFormats.full); | ||
| 179 | - }); | ||
| 180 | - } else if (title == '有效期至') { | ||
| 181 | - setState(() { | ||
| 182 | - print(value); | ||
| 183 | - endDate = | ||
| 184 | - DateUtil.formatDateStr(value, format: DateFormats.full); | ||
| 185 | - }); | ||
| 186 | - } | ||
| 187 | - } | ||
| 188 | - showDateSelWidget = false; | ||
| 189 | - }, | ||
| 190 | - dateTime: title == '有效期从' | ||
| 191 | - ? DateUtil.getDateTime(fromDate) | ||
| 192 | - : DateUtil.getDateTime(endDate), | ||
| 193 | - onCancel: () { | ||
| 194 | - showDateSelWidget = false; | ||
| 195 | - }); | ||
| 196 | - }, | 172 | + onTap: onTap, |
| 197 | child: Container( | 173 | child: Container( |
| 198 | - height: heightCell, | 174 | + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)), |
| 199 | child: Row( | 175 | child: Row( |
| 200 | crossAxisAlignment: CrossAxisAlignment.center, | 176 | crossAxisAlignment: CrossAxisAlignment.center, |
| 201 | mainAxisAlignment: MainAxisAlignment.center, | 177 | mainAxisAlignment: MainAxisAlignment.center, |
| @@ -206,8 +182,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -206,8 +182,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 206 | child: Text( | 182 | child: Text( |
| 207 | title, | 183 | title, |
| 208 | style: TextStyle( | 184 | style: TextStyle( |
| 185 | + color: Color.fromRGBO(0, 0, 0, 0.9), | ||
| 209 | fontWeight: FontWeight.bold, | 186 | fontWeight: FontWeight.bold, |
| 210 | - fontSize: ScreenUtil().setSp(30)), | 187 | + fontSize: ScreenUtil().setSp(32)), |
| 211 | ), | 188 | ), |
| 212 | ), | 189 | ), |
| 213 | HEmptyView(20), | 190 | HEmptyView(20), |
| @@ -216,15 +193,15 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -216,15 +193,15 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 216 | style: TextStyle( | 193 | style: TextStyle( |
| 217 | color: hintText == '点击选择' | 194 | color: hintText == '点击选择' |
| 218 | ? MyColours.color_999999 | 195 | ? MyColours.color_999999 |
| 219 | - : MyColours.color_333333, | 196 | + : MyColours.color_515151, |
| 220 | fontSize: ScreenUtil().setSp(32), | 197 | fontSize: ScreenUtil().setSp(32), |
| 221 | )), | 198 | )), |
| 222 | HEmptyView(20), | 199 | HEmptyView(20), |
| 223 | Image.asset( | 200 | Image.asset( |
| 224 | - Utils.getImgPath('arr_right_gray'), | ||
| 225 | - width: ScreenUtil().setWidth(12), | ||
| 226 | - height: ScreenUtil().setWidth(22), | ||
| 227 | - ) | 201 | + Utils.getImgPath('arrow_right_new'), |
| 202 | + width: ScreenUtil().setWidth(20), | ||
| 203 | + ), | ||
| 204 | + HEmptyView(32), | ||
| 228 | ], | 205 | ], |
| 229 | ), | 206 | ), |
| 230 | ), | 207 | ), |
| @@ -235,6 +212,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -235,6 +212,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 235 | Widget _explain(String title, String hintText) { | 212 | Widget _explain(String title, String hintText) { |
| 236 | return Container( | 213 | return Container( |
| 237 | // height: ScreenUtil().setWidth(380), | 214 | // height: ScreenUtil().setWidth(380), |
| 215 | + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)), | ||
| 238 | child: Column( | 216 | child: Column( |
| 239 | crossAxisAlignment: CrossAxisAlignment.start, | 217 | crossAxisAlignment: CrossAxisAlignment.start, |
| 240 | children: [ | 218 | children: [ |
| @@ -244,15 +222,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -244,15 +222,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 244 | title, | 222 | title, |
| 245 | textAlign: TextAlign.left, | 223 | textAlign: TextAlign.left, |
| 246 | style: TextStyle( | 224 | style: TextStyle( |
| 247 | - color: MyColours.color_333333, | 225 | + color: Color.fromRGBO(0, 0, 0, 0.9), |
| 248 | fontWeight: FontWeight.bold, | 226 | fontWeight: FontWeight.bold, |
| 249 | - fontSize: ScreenUtil().setSp(34)), | 227 | + fontSize: ScreenUtil().setSp(32)), |
| 250 | )), | 228 | )), |
| 251 | - VEmptyView(30), | 229 | + VEmptyView(26), |
| 230 | + Container( | ||
| 231 | + height: ScreenUtil().setWidth(2), | ||
| 232 | + color: MyColours.color_E7E7E7, | ||
| 233 | + ), | ||
| 252 | TextField( | 234 | TextField( |
| 253 | controller: _couponExplainEditControl, | 235 | controller: _couponExplainEditControl, |
| 254 | // keyboardType: TextInputType.number, //键盘类型,数字键盘 | 236 | // keyboardType: TextInputType.number, //键盘类型,数字键盘 |
| 255 | - maxLines: 6, | 237 | + maxLines: 3, |
| 256 | maxLength: 50, | 238 | maxLength: 50, |
| 257 | 239 | ||
| 258 | // maxLengthEnforced: true, | 240 | // maxLengthEnforced: true, |
| @@ -266,23 +248,33 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -266,23 +248,33 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 266 | color: MyColours.color_999999, | 248 | color: MyColours.color_999999, |
| 267 | fontSize: ScreenUtil().setSp(32), | 249 | fontSize: ScreenUtil().setSp(32), |
| 268 | ), | 250 | ), |
| 269 | - fillColor: MyColours.color_F9F9F9, | ||
| 270 | - // fillColor: Colors.red, | ||
| 271 | - filled: true, | ||
| 272 | - enabledBorder: OutlineInputBorder( | ||
| 273 | - //未选中时候的颜色 | ||
| 274 | - borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)), | ||
| 275 | - borderSide: BorderSide( | ||
| 276 | - color: MyColours.color_cccccc, | ||
| 277 | - width: ScreenUtil().setWidth(2)), | 251 | + |
| 252 | + border: OutlineInputBorder(borderSide: BorderSide.none), | ||
| 253 | + | ||
| 254 | + enabledBorder: new UnderlineInputBorder( | ||
| 255 | + borderSide: BorderSide.none, | ||
| 278 | ), | 256 | ), |
| 279 | - focusedBorder: OutlineInputBorder( | ||
| 280 | - //选中时外边框颜色 | ||
| 281 | - borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)), | ||
| 282 | - borderSide: BorderSide( | ||
| 283 | - color: MyColours.app_main, | ||
| 284 | - ), | 257 | + focusedBorder: new UnderlineInputBorder( |
| 258 | + borderSide: BorderSide.none, | ||
| 285 | ), | 259 | ), |
| 260 | + | ||
| 261 | + // fillColor: MyColours.color_F9F9F9, | ||
| 262 | + // // fillColor: Colors.red, | ||
| 263 | + // filled: true, | ||
| 264 | + // enabledBorder: OutlineInputBorder( | ||
| 265 | + // //未选中时候的颜色 | ||
| 266 | + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)), | ||
| 267 | + // borderSide: BorderSide( | ||
| 268 | + // color: MyColours.color_cccccc, | ||
| 269 | + // width: ScreenUtil().setWidth(2)), | ||
| 270 | + // ), | ||
| 271 | + // focusedBorder: OutlineInputBorder( | ||
| 272 | + // //选中时外边框颜色 | ||
| 273 | + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)), | ||
| 274 | + // borderSide: BorderSide( | ||
| 275 | + // color: MyColours.app_main, | ||
| 276 | + // ), | ||
| 277 | + // ), | ||
| 286 | // border: OutlineInputBorder( | 278 | // border: OutlineInputBorder( |
| 287 | // borderRadius: | 279 | // borderRadius: |
| 288 | // BorderRadius.circular(ScreenUtil().setWidth(20)), | 280 | // BorderRadius.circular(ScreenUtil().setWidth(20)), |
| @@ -297,16 +289,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -297,16 +289,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 297 | } | 289 | } |
| 298 | 290 | ||
| 299 | ///是否立即启用 | 291 | ///是否立即启用 |
| 300 | - Widget _canUse(String title) { | 292 | + Widget _canUse(String title, bool swich, GestureTapCallback onTap) { |
| 301 | return InkWell( | 293 | return InkWell( |
| 302 | - onTap: () { | ||
| 303 | - setState(() { | ||
| 304 | - swichState = !swichState; | ||
| 305 | - }); | ||
| 306 | - }, | 294 | + onTap: onTap, |
| 307 | child: Container( | 295 | child: Container( |
| 308 | - padding: EdgeInsets.only(top: ScreenUtil().setWidth(30)), | ||
| 309 | - // height: heightCell, | 296 | + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)), |
| 297 | + margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)), | ||
| 310 | child: Row( | 298 | child: Row( |
| 311 | crossAxisAlignment: CrossAxisAlignment.center, | 299 | crossAxisAlignment: CrossAxisAlignment.center, |
| 312 | mainAxisAlignment: MainAxisAlignment.center, | 300 | mainAxisAlignment: MainAxisAlignment.center, |
| @@ -317,18 +305,17 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -317,18 +305,17 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 317 | child: Text( | 305 | child: Text( |
| 318 | title, | 306 | title, |
| 319 | style: TextStyle( | 307 | style: TextStyle( |
| 320 | - color: MyColours.color_333333, | 308 | + color: Color.fromRGBO(0, 0, 0, 0.9), |
| 321 | fontWeight: FontWeight.bold, | 309 | fontWeight: FontWeight.bold, |
| 322 | - fontSize: ScreenUtil().setSp(34)), | 310 | + fontSize: ScreenUtil().setSp(32)), |
| 323 | ), | 311 | ), |
| 324 | ), | 312 | ), |
| 325 | Spacer(), | 313 | Spacer(), |
| 326 | Image.asset( | 314 | Image.asset( |
| 327 | - swichState | 315 | + swich |
| 328 | ? Utils.getImgPath('swich_on') | 316 | ? Utils.getImgPath('swich_on') |
| 329 | : Utils.getImgPath('swich_off'), | 317 | : Utils.getImgPath('swich_off'), |
| 330 | - width: ScreenUtil().setWidth(122), | ||
| 331 | - height: ScreenUtil().setWidth(82), | 318 | + width: ScreenUtil().setWidth(44 * 2), |
| 332 | ) | 319 | ) |
| 333 | ], | 320 | ], |
| 334 | ), | 321 | ), |
| @@ -336,6 +323,41 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -336,6 +323,41 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 336 | ); | 323 | ); |
| 337 | } | 324 | } |
| 338 | 325 | ||
| 326 | + /// | ||
| 327 | + Widget _item(String title, String subTitle) { | ||
| 328 | + return Container( | ||
| 329 | + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)), | ||
| 330 | + margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)), | ||
| 331 | + child: Row( | ||
| 332 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 333 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 334 | + children: [ | ||
| 335 | + Container( | ||
| 336 | + child: Text( | ||
| 337 | + title, | ||
| 338 | + style: TextStyle( | ||
| 339 | + color: Color.fromRGBO(0, 0, 0, 0.9), | ||
| 340 | + fontWeight: FontWeight.bold, | ||
| 341 | + fontSize: ScreenUtil().setSp(32)), | ||
| 342 | + ), | ||
| 343 | + ), | ||
| 344 | + HEmptyView(60), | ||
| 345 | + Expanded( | ||
| 346 | + child: Text( | ||
| 347 | + subTitle, | ||
| 348 | + maxLines: 20, | ||
| 349 | + textAlign: TextAlign.right, | ||
| 350 | + overflow: TextOverflow.ellipsis, | ||
| 351 | + style: TextStyle( | ||
| 352 | + color: Color.fromRGBO(0, 0, 0, 0.4), | ||
| 353 | + fontSize: ScreenUtil().setSp(32), | ||
| 354 | + ), | ||
| 355 | + )) | ||
| 356 | + ], | ||
| 357 | + ), | ||
| 358 | + ); | ||
| 359 | + } | ||
| 360 | + | ||
| 339 | @override | 361 | @override |
| 340 | Widget build(BuildContext context) { | 362 | Widget build(BuildContext context) { |
| 341 | couponProvider = Provider.of<CouponProvider>(context, listen: true); | 363 | couponProvider = Provider.of<CouponProvider>(context, listen: true); |
| @@ -343,7 +365,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -343,7 +365,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 343 | backgroundColor: MyColours.color_ffffff, | 365 | backgroundColor: MyColours.color_ffffff, |
| 344 | key: scaffoldKey, | 366 | key: scaffoldKey, |
| 345 | appBar: SystemAppBar( | 367 | appBar: SystemAppBar( |
| 346 | - '创建新券', | 368 | + '优惠券详情', |
| 347 | onTap: () { | 369 | onTap: () { |
| 348 | Navigator.pop(context, false); | 370 | Navigator.pop(context, false); |
| 349 | }, | 371 | }, |
| @@ -358,98 +380,165 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -358,98 +380,165 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 358 | controller: controller, | 380 | controller: controller, |
| 359 | physics: BouncingScrollPhysics(), | 381 | physics: BouncingScrollPhysics(), |
| 360 | child: Padding( | 382 | child: Padding( |
| 361 | - padding: EdgeInsets.symmetric( | ||
| 362 | - horizontal: ScreenUtil().setWidth(40)), | 383 | + padding: EdgeInsets.only(left: ScreenUtil().setWidth(32)), |
| 363 | child: Column( | 384 | child: Column( |
| 364 | children: [ | 385 | children: [ |
| 365 | - VEmptyView(40), | 386 | + VEmptyView(56), |
| 387 | + _item('券类型', widget.isMine ? '我的优惠券' : '店铺优惠券'), | ||
| 388 | + Container( | ||
| 389 | + height: ScreenUtil().setWidth(2), | ||
| 390 | + color: MyColours.color_E7E7E7, | ||
| 391 | + ), | ||
| 392 | + VEmptyView(24), | ||
| 393 | + widget.isMine | ||
| 394 | + ? SizedBox() | ||
| 395 | + : _canUse('是否核销', swichHexiao, () { | ||
| 396 | + setState(() { | ||
| 397 | + swichHexiao = !swichHexiao; | ||
| 398 | + }); | ||
| 399 | + }), | ||
| 400 | + widget.isMine | ||
| 401 | + ? SizedBox() | ||
| 402 | + : Container( | ||
| 403 | + height: ScreenUtil().setWidth(2), | ||
| 404 | + color: MyColours.color_E7E7E7, | ||
| 405 | + ), | ||
| 406 | + widget.isMine ? SizedBox() : VEmptyView(24), | ||
| 366 | _textfield('券名称', '例:9折券/200元代金券/菜品券'), | 407 | _textfield('券名称', '例:9折券/200元代金券/菜品券'), |
| 367 | - VEmptyView(22), | ||
| 368 | Container( | 408 | Container( |
| 369 | height: ScreenUtil().setWidth(2), | 409 | height: ScreenUtil().setWidth(2), |
| 370 | - color: MyColours.color_efefef, | ||
| 371 | - margin: EdgeInsets.only( | ||
| 372 | - left: ScreenUtil().setWidth(108 * 2)), | 410 | + color: MyColours.color_E7E7E7, |
| 373 | ), | 411 | ), |
| 374 | - VEmptyView(30), | 412 | + VEmptyView(24), |
| 375 | _textfield('券要求', '例:无门槛/满2000元'), | 413 | _textfield('券要求', '例:无门槛/满2000元'), |
| 376 | - VEmptyView(22), | ||
| 377 | Container( | 414 | Container( |
| 378 | height: ScreenUtil().setWidth(2), | 415 | height: ScreenUtil().setWidth(2), |
| 379 | - color: MyColours.color_efefef, | ||
| 380 | - margin: EdgeInsets.only( | ||
| 381 | - left: ScreenUtil().setWidth(108 * 2)), | 416 | + color: MyColours.color_E7E7E7, |
| 382 | ), | 417 | ), |
| 383 | - VEmptyView(30), | ||
| 384 | - _select('有效期从', fromDate), | ||
| 385 | - VEmptyView(30), | 418 | + VEmptyView(24), |
| 419 | + _select('有效期从', fromDate, () { | ||
| 420 | + FocusScope.of(context) | ||
| 421 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 422 | + //弹出时间选择器 | ||
| 423 | + // showPickerDateTime(context); | ||
| 424 | + showDateSelWidget = true; | ||
| 425 | + DialogUtil.showPickerDateTime24( | ||
| 426 | + context, | ||
| 427 | + scaffoldKey, | ||
| 428 | + (value) { | ||
| 429 | + // {'text': picker.adapter.text, 'select': selecteds} | ||
| 430 | + if (value != null) { | ||
| 431 | + setState(() { | ||
| 432 | + print(value); | ||
| 433 | + fromDate = DateUtil.formatDateStr(value, | ||
| 434 | + format: DateFormats.full); | ||
| 435 | + }); | ||
| 436 | + } | ||
| 437 | + showDateSelWidget = false; | ||
| 438 | + }, | ||
| 439 | + dateTime: DateUtil.getDateTime(fromDate), | ||
| 440 | + onCancel: () { | ||
| 441 | + showDateSelWidget = false; | ||
| 442 | + }); | ||
| 443 | + }), | ||
| 386 | Container( | 444 | Container( |
| 387 | height: ScreenUtil().setWidth(2), | 445 | height: ScreenUtil().setWidth(2), |
| 388 | - color: MyColours.color_efefef, | ||
| 389 | - margin: EdgeInsets.only( | ||
| 390 | - left: ScreenUtil().setWidth(108 * 2)), | 446 | + color: MyColours.color_E7E7E7, |
| 391 | ), | 447 | ), |
| 392 | - VEmptyView(30), | ||
| 393 | - _select('有效期至', endDate), | ||
| 394 | - VEmptyView(30), | 448 | + VEmptyView(24), |
| 449 | + _select('有效期至', endDate, () { | ||
| 450 | + FocusScope.of(context) | ||
| 451 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 452 | + //弹出时间选择器 | ||
| 453 | + // showPickerDateTime(context); | ||
| 454 | + showDateSelWidget = true; | ||
| 455 | + DialogUtil.showPickerDateTime24( | ||
| 456 | + context, | ||
| 457 | + scaffoldKey, | ||
| 458 | + (value) { | ||
| 459 | + // {'text': picker.adapter.text, 'select': selecteds} | ||
| 460 | + if (value != null) { | ||
| 461 | + setState(() { | ||
| 462 | + print(value); | ||
| 463 | + endDate = DateUtil.formatDateStr(value, | ||
| 464 | + format: DateFormats.full); | ||
| 465 | + }); | ||
| 466 | + } | ||
| 467 | + showDateSelWidget = false; | ||
| 468 | + }, | ||
| 469 | + dateTime: DateUtil.getDateTime(endDate), | ||
| 470 | + onCancel: () { | ||
| 471 | + showDateSelWidget = false; | ||
| 472 | + }); | ||
| 473 | + }), | ||
| 395 | Container( | 474 | Container( |
| 396 | height: ScreenUtil().setWidth(2), | 475 | height: ScreenUtil().setWidth(2), |
| 397 | - color: MyColours.color_efefef, | ||
| 398 | - margin: EdgeInsets.only( | ||
| 399 | - left: ScreenUtil().setWidth(108 * 2)), | 476 | + color: MyColours.color_E7E7E7, |
| 400 | ), | 477 | ), |
| 401 | - VEmptyView(30), | 478 | + VEmptyView(24), |
| 479 | + widget.isMine | ||
| 480 | + ? SizedBox() | ||
| 481 | + : _select('谁可以发放', '编辑', () {}), | ||
| 482 | + widget.isMine | ||
| 483 | + ? SizedBox() | ||
| 484 | + : Container( | ||
| 485 | + height: ScreenUtil().setWidth(2), | ||
| 486 | + color: MyColours.color_E7E7E7, | ||
| 487 | + ), | ||
| 488 | + widget.isMine ? SizedBox() : VEmptyView(24), | ||
| 402 | _explain('券说明', '例:可用包间,停车免费,不与店内其他活动共享等'), | 489 | _explain('券说明', '例:可用包间,停车免费,不与店内其他活动共享等'), |
| 403 | - // VEmptyView(20), | ||
| 404 | - _canUse('是否立即启用'), | 490 | + VEmptyView(20), |
| 491 | + _canUse('立即启用', swichState, () { | ||
| 492 | + setState(() { | ||
| 493 | + swichState = !swichState; | ||
| 494 | + }); | ||
| 495 | + }), | ||
| 405 | VEmptyView(30), | 496 | VEmptyView(30), |
| 406 | ], | 497 | ], |
| 407 | ))), | 498 | ))), |
| 408 | ), | 499 | ), |
| 409 | VEmptyView(20), | 500 | VEmptyView(20), |
| 410 | - Padding( | ||
| 411 | - padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0, | ||
| 412 | - ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), | ||
| 413 | - child: RoundButton( | ||
| 414 | - onPressed: () { | ||
| 415 | - if (_couponNameEditControl.text.trim().length == 0) { | ||
| 416 | - Utils.showToast('请填写券名称'); | ||
| 417 | - return; | ||
| 418 | - } | ||
| 419 | - if (_couponRequireEditControl.text.trim().length == 0) { | ||
| 420 | - Utils.showToast('请填写券要求'); | ||
| 421 | - return; | ||
| 422 | - } | ||
| 423 | - if (fromDate == '点击选择') { | ||
| 424 | - Utils.showToast('请选择有效期起始时间'); | ||
| 425 | - return; | ||
| 426 | - } | ||
| 427 | - if (endDate == '点击选择') { | ||
| 428 | - Utils.showToast('请选择有效期结束时间'); | ||
| 429 | - return; | ||
| 430 | - } | ||
| 431 | - if (DateUtil.getDateTime(endDate) | ||
| 432 | - .compareTo(DateUtil.getDateTime(fromDate)) < | ||
| 433 | - 0) { | ||
| 434 | - Utils.showToast('有效期结束时间不能早于起始时间'); | ||
| 435 | - return; | ||
| 436 | - } | ||
| 437 | - // ***参数*** | ||
| 438 | - // _couponNameEditControl.text | ||
| 439 | - // _couponRequireEditControl.text | ||
| 440 | - // fromDate | ||
| 441 | - // endDate | ||
| 442 | - // _couponExplainEditControl.text | ||
| 443 | - // swichState | ||
| 444 | - _createNewCoupon(); | ||
| 445 | - }, | ||
| 446 | - text: '保存', | ||
| 447 | - fontSize: 34, | ||
| 448 | - isBold: false, | ||
| 449 | - height: ScreenUtil().setWidth(80), | ||
| 450 | - width: double.infinity, | ||
| 451 | - radius: ScreenUtil().setWidth(10), | ||
| 452 | - )) | 501 | + RoundButton( |
| 502 | + onPressed: () { | ||
| 503 | + if (_couponNameEditControl.text.trim().length == 0) { | ||
| 504 | + Utils.showToast('请填写券名称'); | ||
| 505 | + return; | ||
| 506 | + } | ||
| 507 | + if (_couponRequireEditControl.text.trim().length == 0) { | ||
| 508 | + Utils.showToast('请填写券要求'); | ||
| 509 | + return; | ||
| 510 | + } | ||
| 511 | + if (fromDate == '点击选择') { | ||
| 512 | + Utils.showToast('请选择有效期起始时间'); | ||
| 513 | + return; | ||
| 514 | + } | ||
| 515 | + if (endDate == '点击选择') { | ||
| 516 | + Utils.showToast('请选择有效期结束时间'); | ||
| 517 | + return; | ||
| 518 | + } | ||
| 519 | + if (DateUtil.getDateTime(endDate) | ||
| 520 | + .compareTo(DateUtil.getDateTime(fromDate)) < | ||
| 521 | + 0) { | ||
| 522 | + Utils.showToast('有效期结束时间不能早于起始时间'); | ||
| 523 | + return; | ||
| 524 | + } | ||
| 525 | + // ***参数*** | ||
| 526 | + // _couponNameEditControl.text | ||
| 527 | + // _couponRequireEditControl.text | ||
| 528 | + // fromDate | ||
| 529 | + // endDate | ||
| 530 | + // _couponExplainEditControl.text | ||
| 531 | + // swichState | ||
| 532 | + _createNewCoupon(); | ||
| 533 | + }, | ||
| 534 | + text: '立即创建', | ||
| 535 | + fontSize: 24, | ||
| 536 | + isBold: false, | ||
| 537 | + height: ScreenUtil().setWidth(37 * 2), | ||
| 538 | + width: ScreenUtil().setWidth(130 * 2), | ||
| 539 | + radius: ScreenUtil().setWidth(22), | ||
| 540 | + ), | ||
| 541 | + VEmptyView(32) | ||
| 453 | ])), | 542 | ])), |
| 454 | ); | 543 | ); |
| 455 | } | 544 | } |
| @@ -47,9 +47,11 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -47,9 +47,11 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 47 | if (ObjectUtil.isNotEmpty(sunModel.explain)) { | 47 | if (ObjectUtil.isNotEmpty(sunModel.explain)) { |
| 48 | explainH = Utils.calculateTextHeight( | 48 | explainH = Utils.calculateTextHeight( |
| 49 | '说明:${sunModel.explain}', | 49 | '说明:${sunModel.explain}', |
| 50 | - ScreenUtil().setSp(24), | 50 | + ScreenUtil().setSp(20), |
| 51 | FontWeight.normal, | 51 | FontWeight.normal, |
| 52 | - ScreenUtil.screenWidthDp - ScreenUtil().setWidth(92 * 2), | 52 | + ScreenUtil.screenWidthDp - |
| 53 | + ScreenUtil().setWidth(92 * 2) + | ||
| 54 | + ScreenUtil().setWidth(20), | ||
| 53 | 5, | 55 | 5, |
| 54 | context); | 56 | context); |
| 55 | } | 57 | } |
| @@ -116,7 +118,7 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -116,7 +118,7 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 116 | ), | 118 | ), |
| 117 | Container( | 119 | Container( |
| 118 | padding: EdgeInsets.fromLTRB( | 120 | padding: EdgeInsets.fromLTRB( |
| 119 | - ScreenUtil().setWidth(30), | 121 | + ScreenUtil().setWidth(24 * 2), |
| 120 | ScreenUtil().setWidth(9 * 2), | 122 | ScreenUtil().setWidth(9 * 2), |
| 121 | ScreenUtil().setWidth(10), | 123 | ScreenUtil().setWidth(10), |
| 122 | ScreenUtil().setWidth(20)), | 124 | ScreenUtil().setWidth(20)), |
| @@ -184,8 +186,7 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -184,8 +186,7 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 184 | // : Container() | 186 | // : Container() |
| 185 | // : | 187 | // : |
| 186 | ), | 188 | ), |
| 187 | - const MySeparator( | ||
| 188 | - width: 3, color: MyColours.color_f3f3f3), | 189 | + const MySeparator(width: 3, color: MyColours.color_f3f3f3), |
| 189 | ObjectUtil.isNotEmpty(sunModel.explain) | 190 | ObjectUtil.isNotEmpty(sunModel.explain) |
| 190 | ? InkWell( | 191 | ? InkWell( |
| 191 | onTap: () { | 192 | onTap: () { |
| @@ -213,7 +214,7 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -213,7 +214,7 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 213 | widget.couponSonModel.showText | 214 | widget.couponSonModel.showText |
| 214 | ? Container( | 215 | ? Container( |
| 215 | padding: EdgeInsets.fromLTRB( | 216 | padding: EdgeInsets.fromLTRB( |
| 216 | - ScreenUtil().setWidth(30), | 217 | + ScreenUtil().setWidth(24 * 2), |
| 217 | ScreenUtil().setWidth(14), | 218 | ScreenUtil().setWidth(14), |
| 218 | ScreenUtil().setWidth(0), | 219 | ScreenUtil().setWidth(0), |
| 219 | ScreenUtil().setWidth(14)), | 220 | ScreenUtil().setWidth(14)), |
| @@ -228,7 +229,7 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -228,7 +229,7 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 228 | ) | 229 | ) |
| 229 | : Container( | 230 | : Container( |
| 230 | padding: EdgeInsets.fromLTRB( | 231 | padding: EdgeInsets.fromLTRB( |
| 231 | - ScreenUtil().setWidth(30), | 232 | + ScreenUtil().setWidth(24 * 2), |
| 232 | ScreenUtil().setWidth(14), | 233 | ScreenUtil().setWidth(14), |
| 233 | ScreenUtil().setWidth(0), | 234 | ScreenUtil().setWidth(0), |
| 234 | ScreenUtil().setWidth(14)), | 235 | ScreenUtil().setWidth(14)), |
| @@ -248,13 +249,15 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -248,13 +249,15 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 248 | explainH > 19 | 249 | explainH > 19 |
| 249 | ? Container( | 250 | ? Container( |
| 250 | margin: EdgeInsets.only( | 251 | margin: EdgeInsets.only( |
| 251 | - top: ScreenUtil().setWidth(12)), | 252 | + top: ScreenUtil().setWidth(10), |
| 253 | + right: ScreenUtil().setWidth(16)), | ||
| 252 | child: Image.asset( | 254 | child: Image.asset( |
| 253 | !widget.couponSonModel.showText | 255 | !widget.couponSonModel.showText |
| 254 | - ? Utils.getImgPath('quan_down') | ||
| 255 | - : Utils.getImgPath('quan_up'), | ||
| 256 | - width: ScreenUtil().setWidth(68), | ||
| 257 | - height: ScreenUtil().setWidth(44)), | 256 | + ? Utils.getImgPath( |
| 257 | + 'quan_down_f') | ||
| 258 | + : Utils.getImgPath('quan_up_f'), | ||
| 259 | + width: ScreenUtil().setWidth(28), | ||
| 260 | + height: ScreenUtil().setWidth(28)), | ||
| 258 | ) | 261 | ) |
| 259 | : Container(), | 262 | : Container(), |
| 260 | HEmptyView(14) | 263 | HEmptyView(14) |
| @@ -148,7 +148,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -148,7 +148,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 148 | fontSize: ScreenUtil().setSp(24), | 148 | fontSize: ScreenUtil().setSp(24), |
| 149 | ), | 149 | ), |
| 150 | )), | 150 | )), |
| 151 | - VEmptyView(11), | 151 | + VEmptyView(32), |
| 152 | Expanded( | 152 | Expanded( |
| 153 | child: TabBarView(controller: tabController, children: [ | 153 | child: TabBarView(controller: tabController, children: [ |
| 154 | Consumer<CouponProvider>(builder: (context, model, _) { | 154 | Consumer<CouponProvider>(builder: (context, model, _) { |
| @@ -243,7 +243,23 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | @@ -243,7 +243,23 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { | ||
| 243 | radius: ScreenUtil().setWidth(14), | 243 | radius: ScreenUtil().setWidth(14), |
| 244 | isBold: false, | 244 | isBold: false, |
| 245 | fontSize: 28, | 245 | fontSize: 28, |
| 246 | - onPressed: () {}, | 246 | + onPressed: () async{ |
| 247 | + UserModel userModel = | ||
| 248 | + Provider.of<UserModel>(context, listen: false); | ||
| 249 | + if (userModel.user.role_name == '管理员' || | ||
| 250 | + userModel.user.role_name == '店长') { | ||
| 251 | + NavigatorUtil.goCouponCreateSelectTypePage(context); | ||
| 252 | + }else{ | ||
| 253 | + bool needRefresh = | ||
| 254 | + await NavigatorUtil.goCouponEditPage(context); | ||
| 255 | + print(needRefresh); | ||
| 256 | + if (needRefresh != null && needRefresh) { | ||
| 257 | + //刷新页面数据 | ||
| 258 | + // _controller.callRefresh(); | ||
| 259 | + _couponNetworkData(); | ||
| 260 | + } | ||
| 261 | + } | ||
| 262 | + }, | ||
| 247 | ), | 263 | ), |
| 248 | ) | 264 | ) |
| 249 | ], | 265 | ], |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | 2 | ||
| 3 | class MyColours { | 3 | class MyColours { |
| 4 | + | ||
| 5 | + | ||
| 4 | static const Color color_DBDBDB = Color(0xffDBDBDB); | 6 | static const Color color_DBDBDB = Color(0xffDBDBDB); |
| 5 | static const Color color_F8F9FD = Color(0xffF8F9FD); | 7 | static const Color color_F8F9FD = Color(0xffF8F9FD); |
| 6 | static const Color color_5F7292 = Color(0xff5F7292); | 8 | static const Color color_5F7292 = Color(0xff5F7292); |
| @@ -264,8 +264,9 @@ class NavigatorUtil { | @@ -264,8 +264,9 @@ class NavigatorUtil { | ||
| 264 | 264 | ||
| 265 | /// 创建优惠券 | 265 | /// 创建优惠券 |
| 266 | static Future<dynamic> goCouponEditPage(BuildContext context, | 266 | static Future<dynamic> goCouponEditPage(BuildContext context, |
| 267 | - {replace = false}) { | ||
| 268 | - return _navigateTo(context, "${Routes.coupon_edit}", replace: replace); | 267 | + {replace = false, bool isMine = true}) { |
| 268 | + return _navigateTo(context, "${Routes.coupon_edit}?isMine=${isMine}", | ||
| 269 | + replace: replace); | ||
| 269 | } | 270 | } |
| 270 | 271 | ||
| 271 | /// 选择优惠券 | 272 | /// 选择优惠券 |
| @@ -831,4 +832,13 @@ class NavigatorUtil { | @@ -831,4 +832,13 @@ class NavigatorUtil { | ||
| 831 | return _navigateTo(context, "${Routes.my_area_manage_page}?", | 832 | return _navigateTo(context, "${Routes.my_area_manage_page}?", |
| 832 | replace: replace); | 833 | replace: replace); |
| 833 | } | 834 | } |
| 835 | + | ||
| 836 | + ///优惠券选择页面 | ||
| 837 | + static Future<dynamic> goCouponCreateSelectTypePage( | ||
| 838 | + BuildContext context, { | ||
| 839 | + replace = false, | ||
| 840 | + }) { | ||
| 841 | + return _navigateTo(context, "${Routes.coupon_create_select_type_page}?", | ||
| 842 | + replace: replace); | ||
| 843 | + } | ||
| 834 | } | 844 | } |
| @@ -18,6 +18,7 @@ import 'package:one_key/models/sms_info.dart'; | @@ -18,6 +18,7 @@ import 'package:one_key/models/sms_info.dart'; | ||
| 18 | import 'package:one_key/models/statics_model.dart'; | 18 | import 'package:one_key/models/statics_model.dart'; |
| 19 | import 'package:one_key/models/table_list.dart'; | 19 | import 'package:one_key/models/table_list.dart'; |
| 20 | import 'package:one_key/models/user_history_entity.dart'; | 20 | import 'package:one_key/models/user_history_entity.dart'; |
| 21 | +import 'package:one_key/pages/coupon/coupon_create_select_type_page.dart'; | ||
| 21 | import 'package:one_key/pages/coupon/coupon_detail_page.dart'; | 22 | import 'package:one_key/pages/coupon/coupon_detail_page.dart'; |
| 22 | import 'package:one_key/pages/coupon/coupon_edit_page.dart'; | 23 | import 'package:one_key/pages/coupon/coupon_edit_page.dart'; |
| 23 | import 'package:one_key/pages/coupon/coupon_history_page.dart'; | 24 | import 'package:one_key/pages/coupon/coupon_history_page.dart'; |
| @@ -473,8 +474,10 @@ var handleCouponHistoryPageHandler = new Handler( | @@ -473,8 +474,10 @@ var handleCouponHistoryPageHandler = new Handler( | ||
| 473 | var handleCouponEditPageHandler = new Handler( | 474 | var handleCouponEditPageHandler = new Handler( |
| 474 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | 475 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { |
| 475 | // String rid = params["rid"].first; | 476 | // String rid = params["rid"].first; |
| 476 | - // bool fromNotify = FluroConvertUtils.string2bool(params["fromNotify"].first); | ||
| 477 | - return CouponEidtPage(); | 477 | + bool isMine = FluroConvertUtils.string2bool(params["isMine"].first); |
| 478 | + return CouponEidtPage( | ||
| 479 | + isMine: isMine, | ||
| 480 | + ); | ||
| 478 | }); | 481 | }); |
| 479 | 482 | ||
| 480 | ///选择优惠券 | 483 | ///选择优惠券 |
| @@ -1281,3 +1284,14 @@ var myAreaManagePageHandle = new Handler( | @@ -1281,3 +1284,14 @@ var myAreaManagePageHandle = new Handler( | ||
| 1281 | child: MyAreaManagePage(), | 1284 | child: MyAreaManagePage(), |
| 1282 | ); | 1285 | ); |
| 1283 | }); | 1286 | }); |
| 1287 | + | ||
| 1288 | +///选择优惠券类型 | ||
| 1289 | +var couponCreateSelectTypePageHandle = new Handler( | ||
| 1290 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 1291 | + // Guest guest = Guest.fromJson(json | ||
| 1292 | + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["guest"].first))); | ||
| 1293 | + // UserHistoryEntity userHistoryEntity = UserHistoryEntity.fromJson(json.decode( | ||
| 1294 | + // FluroConvertUtils.fluroCnParamsDecode( | ||
| 1295 | + // params["userHistoryEntity"].first))); | ||
| 1296 | + return CouponCreateSelectTypePage(); | ||
| 1297 | +}); |
| @@ -111,6 +111,8 @@ class Routes { | @@ -111,6 +111,8 @@ class Routes { | ||
| 111 | static String my_area_manage_page = "/my_area_manage_page"; //我的---区域管理 | 111 | static String my_area_manage_page = "/my_area_manage_page"; //我的---区域管理 |
| 112 | static String base_info_personnal_page = | 112 | static String base_info_personnal_page = |
| 113 | "/base_info_personnal_page"; //员工管理---个人资料 | 113 | "/base_info_personnal_page"; //员工管理---个人资料 |
| 114 | + static String coupon_create_select_type_page = | ||
| 115 | + "/coupon_create_select_type_page"; //选择优惠券类型 | ||
| 114 | 116 | ||
| 115 | static void configureRoutes(FluroRouter router) { | 117 | static void configureRoutes(FluroRouter router) { |
| 116 | router.notFoundHandler = new Handler( | 118 | router.notFoundHandler = new Handler( |
| @@ -223,7 +225,9 @@ class Routes { | @@ -223,7 +225,9 @@ class Routes { | ||
| 223 | router.define(my_table_manager_home_page, | 225 | router.define(my_table_manager_home_page, |
| 224 | handler: myTableManagerHomePageHandle); | 226 | handler: myTableManagerHomePageHandle); |
| 225 | router.define(my_area_manage_page, handler: myAreaManagePageHandle); | 227 | router.define(my_area_manage_page, handler: myAreaManagePageHandle); |
| 226 | - router.define(base_info_personnal_page, handler: baseInfoPersonnalPageHandle); | ||
| 227 | - | 228 | + router.define(base_info_personnal_page, |
| 229 | + handler: baseInfoPersonnalPageHandle); | ||
| 230 | + router.define(coupon_create_select_type_page, | ||
| 231 | + handler: couponCreateSelectTypePageHandle); | ||
| 228 | } | 232 | } |
| 229 | } | 233 | } |
-
Please register or login to post a comment