Showing
13 changed files
with
2227 additions
and
299 deletions
| @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 4 | import 'package:one_key/models/coupon_model.dart'; | 4 | import 'package:one_key/models/coupon_model.dart'; |
| 5 | import 'package:one_key/provider/coupon_provider.dart'; | 5 | import 'package:one_key/provider/coupon_provider.dart'; |
| 6 | import 'package:one_key/res/colors.dart'; | 6 | import 'package:one_key/res/colors.dart'; |
| 7 | +import 'package:one_key/utils/screen_util.dart'; | ||
| 7 | import 'package:one_key/utils/utils.dart'; | 8 | import 'package:one_key/utils/utils.dart'; |
| 8 | import 'package:one_key/widgets/dashed_line_widget.dart'; | 9 | import 'package:one_key/widgets/dashed_line_widget.dart'; |
| 9 | import 'package:one_key/widgets/h_empty_view.dart'; | 10 | import 'package:one_key/widgets/h_empty_view.dart'; |
| @@ -55,276 +56,301 @@ class _CouponItemFState extends State<CouponItemF> { | @@ -55,276 +56,301 @@ class _CouponItemFState extends State<CouponItemF> { | ||
| 55 | 5, | 56 | 5, |
| 56 | context); | 57 | context); |
| 57 | } | 58 | } |
| 58 | - return Stack(children: [ | ||
| 59 | - InkWell( | ||
| 60 | - onTap: widget.onPressed, | ||
| 61 | - child: Container( | ||
| 62 | - // width: ScreenUtil().setWidth(610), | ||
| 63 | - margin: EdgeInsets.fromLTRB( | ||
| 64 | - ScreenUtil().setWidth(40), | ||
| 65 | - ScreenUtil().setWidth(0), | ||
| 66 | - ScreenUtil().setWidth(40), | ||
| 67 | - ScreenUtil().setWidth(32)), | ||
| 68 | - decoration: BoxDecoration( | ||
| 69 | - color: MyColours.color_ffffff, | ||
| 70 | - boxShadow: [ | ||
| 71 | - BoxShadow( | ||
| 72 | - spreadRadius: ScreenUtil().setWidth(2), | ||
| 73 | - color: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 74 | - offset: Offset(0, ScreenUtil().setWidth(8)), | ||
| 75 | - blurRadius: ScreenUtil().setWidth(8)) | ||
| 76 | - ], | ||
| 77 | - borderRadius: BorderRadius.all( | ||
| 78 | - Radius.circular(ScreenUtil().setWidth(16)), | ||
| 79 | - ), | ||
| 80 | - ), | ||
| 81 | - child: Column( | ||
| 82 | - mainAxisSize: MainAxisSize.min, | ||
| 83 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 84 | - children: [ | ||
| 85 | - Container( | ||
| 86 | - height: ScreenUtil().setWidth(40), | ||
| 87 | - padding: EdgeInsets.symmetric( | ||
| 88 | - horizontal: ScreenUtil().setWidth(24)), | ||
| 89 | - decoration: BoxDecoration( | ||
| 90 | - color: widget.from == 'history' | ||
| 91 | - ? MyColours.color_BFC4D4 | ||
| 92 | - : notSelect | ||
| 93 | - ? sunModel.isType == '1' | ||
| 94 | - ? MyColours.color_438E93 | ||
| 95 | - : MyColours.color_ED7B2F | ||
| 96 | - : MyColours.color_999999, | ||
| 97 | - borderRadius: BorderRadius.only( | ||
| 98 | - topLeft: Radius.circular(ScreenUtil().setWidth(16)), | ||
| 99 | - topRight: | ||
| 100 | - Radius.circular(ScreenUtil().setWidth(16)))), | ||
| 101 | - child: Row( | ||
| 102 | - mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 103 | - children: [ | ||
| 104 | - Text( | ||
| 105 | - sunModel.isType == '1' | ||
| 106 | - ? sunModel.isExamine == '1' | ||
| 107 | - ? '店铺优惠券(核销)' | ||
| 108 | - : '店铺优惠券' | ||
| 109 | - : '我的优惠券', | ||
| 110 | - style: TextStyle( | ||
| 111 | - color: MyColours.color_ffffff, | ||
| 112 | - fontSize: ScreenUtil().setSp(24)), | ||
| 113 | - ), | ||
| 114 | - InkWell( | ||
| 115 | - onTap: widget.onPressedSwich, | ||
| 116 | - child: Text( | 59 | + return Stack( |
| 60 | + alignment: widget.from == 'select' | ||
| 61 | + ? Alignment.centerLeft | ||
| 62 | + : AlignmentDirectional.topStart, | ||
| 63 | + children: [ | ||
| 64 | + InkWell( | ||
| 65 | + onTap: widget.onPressed, | ||
| 66 | + child: Container( | ||
| 67 | + // width: ScreenUtil().setWidth(610), | ||
| 68 | + margin: EdgeInsets.fromLTRB( | ||
| 69 | + ScreenUtil().setWidth(40), | ||
| 70 | + ScreenUtil().setWidth(0), | ||
| 71 | + ScreenUtil().setWidth(40), | ||
| 72 | + ScreenUtil().setWidth(32)), | ||
| 73 | + decoration: BoxDecoration( | ||
| 74 | + color: MyColours.color_ffffff, | ||
| 75 | + boxShadow: [ | ||
| 76 | + BoxShadow( | ||
| 77 | + spreadRadius: ScreenUtil().setWidth(2), | ||
| 78 | + color: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 79 | + offset: Offset(0, ScreenUtil().setWidth(8)), | ||
| 80 | + blurRadius: ScreenUtil().setWidth(8)) | ||
| 81 | + ], | ||
| 82 | + borderRadius: BorderRadius.all( | ||
| 83 | + Radius.circular(ScreenUtil().setWidth(16)), | ||
| 84 | + ), | ||
| 85 | + ), | ||
| 86 | + child: Column( | ||
| 87 | + mainAxisSize: MainAxisSize.min, | ||
| 88 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 89 | + children: [ | ||
| 90 | + Container( | ||
| 91 | + height: ScreenUtil().setWidth(40), | ||
| 92 | + padding: EdgeInsets.symmetric( | ||
| 93 | + horizontal: ScreenUtil().setWidth(24)), | ||
| 94 | + decoration: BoxDecoration( | ||
| 95 | + color: widget.from == 'history' | ||
| 96 | + ? MyColours.color_BFC4D4 | ||
| 97 | + : notSelect | ||
| 98 | + ? sunModel.isType == '1' | ||
| 99 | + ? MyColours.color_438E93 | ||
| 100 | + : MyColours.color_ED7B2F | ||
| 101 | + : MyColours.color_999999, | ||
| 102 | + borderRadius: BorderRadius.only( | ||
| 103 | + topLeft: | ||
| 104 | + Radius.circular(ScreenUtil().setWidth(16)), | ||
| 105 | + topRight: | ||
| 106 | + Radius.circular(ScreenUtil().setWidth(16)))), | ||
| 107 | + child: Row( | ||
| 108 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 109 | + children: [ | ||
| 110 | + Text( | ||
| 117 | sunModel.isType == '1' | 111 | sunModel.isType == '1' |
| 118 | ? sunModel.isExamine == '1' | 112 | ? sunModel.isExamine == '1' |
| 119 | - ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张' | ||
| 120 | - : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张' | ||
| 121 | - : '被领取:${sunModel.receiveNum}张', | ||
| 122 | - maxLines: 1, | ||
| 123 | - overflow: TextOverflow.ellipsis, | 113 | + ? '店铺优惠券(核销)' |
| 114 | + : '店铺优惠券' | ||
| 115 | + : '我的优惠券', | ||
| 124 | style: TextStyle( | 116 | style: TextStyle( |
| 125 | color: MyColours.color_ffffff, | 117 | color: MyColours.color_ffffff, |
| 126 | - fontSize: ScreenUtil().setSp(20))), | ||
| 127 | - ), | ||
| 128 | - ], | ||
| 129 | - ), | ||
| 130 | - ), | ||
| 131 | - Container( | ||
| 132 | - padding: EdgeInsets.fromLTRB( | ||
| 133 | - ScreenUtil().setWidth(24 * 2), | ||
| 134 | - ScreenUtil().setWidth(9 * 2), | ||
| 135 | - ScreenUtil().setWidth(10), | ||
| 136 | - ScreenUtil().setWidth(20)), | ||
| 137 | - child: Column( | ||
| 138 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 139 | - children: [ | ||
| 140 | - Container( | ||
| 141 | - width: ScreenUtil().setWidth(232 * 2), | ||
| 142 | - child: Container( | ||
| 143 | - height: ScreenUtil().setWidth(25 * 2), | ||
| 144 | - constraints: BoxConstraints( | ||
| 145 | - maxWidth: ScreenUtil().setWidth(190)), | 118 | + fontSize: ScreenUtil().setSp(24)), |
| 119 | + ), | ||
| 120 | + InkWell( | ||
| 121 | + onTap: widget.onPressedSwich, | ||
| 146 | child: Text( | 122 | child: Text( |
| 147 | - sunModel.aname, | ||
| 148 | - maxLines: 2, | ||
| 149 | - overflow: TextOverflow.ellipsis, | ||
| 150 | - style: TextStyle( | 123 | + sunModel.isType == '1' |
| 124 | + ? sunModel.isExamine == '1' | ||
| 125 | + ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张' | ||
| 126 | + : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张' | ||
| 127 | + : '被领取:${sunModel.receiveNum}张', | ||
| 128 | + maxLines: 1, | ||
| 129 | + overflow: TextOverflow.ellipsis, | ||
| 130 | + style: TextStyle( | ||
| 131 | + color: MyColours.color_ffffff, | ||
| 132 | + fontSize: ScreenUtil().setSp(20))), | ||
| 133 | + ), | ||
| 134 | + ], | ||
| 135 | + ), | ||
| 136 | + ), | ||
| 137 | + Container( | ||
| 138 | + padding: EdgeInsets.fromLTRB( | ||
| 139 | + ScreenUtil().setWidth(24 * 2), | ||
| 140 | + ScreenUtil().setWidth(9 * 2), | ||
| 141 | + ScreenUtil().setWidth(10), | ||
| 142 | + ScreenUtil().setWidth(20)), | ||
| 143 | + child: Column( | ||
| 144 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 145 | + children: [ | ||
| 146 | + Container( | ||
| 147 | + width: ScreenUtil().setWidth(232 * 2), | ||
| 148 | + child: Container( | ||
| 149 | + height: ScreenUtil().setWidth(25 * 2), | ||
| 150 | + constraints: BoxConstraints( | ||
| 151 | + maxWidth: ScreenUtil().setWidth(190)), | ||
| 152 | + child: Text( | ||
| 153 | + sunModel.aname, | ||
| 154 | + maxLines: 2, | ||
| 155 | + overflow: TextOverflow.ellipsis, | ||
| 156 | + style: TextStyle( | ||
| 157 | + color: widget.from == 'history' | ||
| 158 | + ? MyColours.color_BFC4D4 | ||
| 159 | + : notSelect | ||
| 160 | + ? MyColours.color_515151 | ||
| 161 | + : MyColours.color_999999, | ||
| 162 | + fontSize: ScreenUtil().setSp(36), | ||
| 163 | + fontWeight: FontWeight.bold), | ||
| 164 | + ), | ||
| 165 | + )), | ||
| 166 | + Container( | ||
| 167 | + height: ScreenUtil().setWidth(14 * 2), | ||
| 168 | + width: ScreenUtil().setWidth(232 * 2), | ||
| 169 | + child: Text('${sunModel.desc}', | ||
| 170 | + maxLines: 1, | ||
| 171 | + overflow: TextOverflow.ellipsis, | ||
| 172 | + style: TextStyle( | ||
| 151 | color: widget.from == 'history' | 173 | color: widget.from == 'history' |
| 152 | ? MyColours.color_BFC4D4 | 174 | ? MyColours.color_BFC4D4 |
| 153 | : notSelect | 175 | : notSelect |
| 154 | ? MyColours.color_515151 | 176 | ? MyColours.color_515151 |
| 155 | : MyColours.color_999999, | 177 | : MyColours.color_999999, |
| 156 | - fontSize: ScreenUtil().setSp(36), | ||
| 157 | - fontWeight: FontWeight.bold), | ||
| 158 | - ), | ||
| 159 | - )), | ||
| 160 | - Container( | ||
| 161 | - height: ScreenUtil().setWidth(14 * 2), | ||
| 162 | - width: ScreenUtil().setWidth(232 * 2), | ||
| 163 | - child: Text('${sunModel.desc}', | ||
| 164 | - maxLines: 1, | ||
| 165 | - overflow: TextOverflow.ellipsis, | ||
| 166 | - style: TextStyle( | ||
| 167 | - color: widget.from == 'history' | ||
| 168 | - ? MyColours.color_BFC4D4 | ||
| 169 | - : notSelect | ||
| 170 | - ? MyColours.color_515151 | ||
| 171 | - : MyColours.color_999999, | ||
| 172 | - fontSize: ScreenUtil().setSp(20), | ||
| 173 | - )), | 178 | + fontSize: ScreenUtil().setSp(20), |
| 179 | + )), | ||
| 180 | + ), | ||
| 181 | + VEmptyView(16), | ||
| 182 | + (ObjectUtil.isNotEmpty(sunModel.stime) && | ||
| 183 | + sunModel.stime != '0') || | ||
| 184 | + (ObjectUtil.isNotEmpty(sunModel.etime) && | ||
| 185 | + sunModel.etime != '0') | ||
| 186 | + ? Container( | ||
| 187 | + child: Text( | ||
| 188 | + '使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}', | ||
| 189 | + style: TextStyle( | ||
| 190 | + color: widget.from == 'history' | ||
| 191 | + ? MyColours.color_BFC4D4 | ||
| 192 | + : MyColours.color_999999, | ||
| 193 | + fontSize: ScreenUtil().setSp(20))), | ||
| 194 | + ) | ||
| 195 | + : Container(), | ||
| 196 | + ], | ||
| 174 | ), | 197 | ), |
| 175 | - VEmptyView(16), | ||
| 176 | - (ObjectUtil.isNotEmpty(sunModel.stime) && | ||
| 177 | - sunModel.stime != '0') || | ||
| 178 | - (ObjectUtil.isNotEmpty(sunModel.etime) && | ||
| 179 | - sunModel.etime != '0') | ||
| 180 | - ? Container( | ||
| 181 | - child: Text( | ||
| 182 | - '使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}', | ||
| 183 | - style: TextStyle( | ||
| 184 | - color: widget.from == 'history' | ||
| 185 | - ? MyColours.color_BFC4D4 | ||
| 186 | - : MyColours.color_999999, | ||
| 187 | - fontSize: ScreenUtil().setSp(20))), | ||
| 188 | - ) | ||
| 189 | - : Container(), | ||
| 190 | - ], | ||
| 191 | - ), | ||
| 192 | - // widget.from == 'select' | ||
| 193 | - // ? widget.showCheck | ||
| 194 | - // ? Positioned( | ||
| 195 | - // right: 0, | ||
| 196 | - // top: ScreenUtil().setWidth(20), | ||
| 197 | - // child: Image.asset( | ||
| 198 | - // Utils.getImgPath(widget.couponSonModel.isCheck | ||
| 199 | - // ? 'check_r' | ||
| 200 | - // : 'check_un'), | ||
| 201 | - // width: ScreenUtil().setWidth(40), | ||
| 202 | - // height: ScreenUtil().setWidth(40), | ||
| 203 | - // )) | ||
| 204 | - // : Container() | ||
| 205 | - // : | ||
| 206 | - ), | ||
| 207 | - ObjectUtil.isNotEmpty(sunModel.explain) | ||
| 208 | - ? const MySeparator(width: 3, color: MyColours.color_f3f3f3) | ||
| 209 | - : SizedBox(), | ||
| 210 | - ObjectUtil.isNotEmpty(sunModel.explain) | ||
| 211 | - ? InkWell( | ||
| 212 | - onTap: () { | ||
| 213 | - if (explainH > 19) { | ||
| 214 | - setState(() { | ||
| 215 | - widget.couponSonModel.showText = | ||
| 216 | - !widget.couponSonModel.showText; | ||
| 217 | - }); | ||
| 218 | - } | ||
| 219 | - }, | ||
| 220 | - child: Container( | ||
| 221 | - width: double.infinity, | ||
| 222 | - decoration: BoxDecoration( | ||
| 223 | - color: widget.from == 'history' | ||
| 224 | - ? MyColours.color_ffffff | ||
| 225 | - : notSelect | 198 | + // widget.from == 'select' |
| 199 | + // ? widget.showCheck | ||
| 200 | + // ? Positioned( | ||
| 201 | + // right: 0, | ||
| 202 | + // top: ScreenUtil().setWidth(20), | ||
| 203 | + // child: Image.asset( | ||
| 204 | + // Utils.getImgPath(widget.couponSonModel.isCheck | ||
| 205 | + // ? 'check_r' | ||
| 206 | + // : 'check_un'), | ||
| 207 | + // width: ScreenUtil().setWidth(40), | ||
| 208 | + // height: ScreenUtil().setWidth(40), | ||
| 209 | + // )) | ||
| 210 | + // : Container() | ||
| 211 | + // : | ||
| 212 | + ), | ||
| 213 | + ObjectUtil.isNotEmpty(sunModel.explain) | ||
| 214 | + ? const MySeparator( | ||
| 215 | + width: 3, color: MyColours.color_f3f3f3) | ||
| 216 | + : SizedBox(), | ||
| 217 | + ObjectUtil.isNotEmpty(sunModel.explain) | ||
| 218 | + ? InkWell( | ||
| 219 | + onTap: () { | ||
| 220 | + if (explainH > 19) { | ||
| 221 | + setState(() { | ||
| 222 | + widget.couponSonModel.showText = | ||
| 223 | + !widget.couponSonModel.showText; | ||
| 224 | + }); | ||
| 225 | + } | ||
| 226 | + }, | ||
| 227 | + child: Container( | ||
| 228 | + width: double.infinity, | ||
| 229 | + decoration: BoxDecoration( | ||
| 230 | + color: widget.from == 'history' | ||
| 226 | ? MyColours.color_ffffff | 231 | ? MyColours.color_ffffff |
| 227 | - : MyColours.color_FAFAFA, | ||
| 228 | - borderRadius: BorderRadius.only( | ||
| 229 | - bottomLeft: Radius.circular( | ||
| 230 | - ScreenUtil().setWidth(20)), | ||
| 231 | - bottomRight: Radius.circular( | ||
| 232 | - ScreenUtil().setWidth(20)))), | ||
| 233 | - child: Row( | ||
| 234 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 235 | - children: [ | ||
| 236 | - widget.couponSonModel.showText | ||
| 237 | - ? Container( | ||
| 238 | - padding: EdgeInsets.fromLTRB( | ||
| 239 | - ScreenUtil().setWidth(24 * 2), | ||
| 240 | - ScreenUtil().setWidth(14), | ||
| 241 | - ScreenUtil().setWidth(0), | ||
| 242 | - ScreenUtil().setWidth(14)), | ||
| 243 | - width: ScreenUtil().screenWidth - | ||
| 244 | - ScreenUtil().setWidth(92 * 2), | ||
| 245 | - child: Text('说明:${sunModel.explain}', | ||
| 246 | - maxLines: 5, | ||
| 247 | - style: TextStyle( | ||
| 248 | - color: widget.from == 'history' | ||
| 249 | - ? MyColours.color_BFC4D4 | ||
| 250 | - : MyColours.color_999999, | ||
| 251 | - fontSize: | ||
| 252 | - ScreenUtil().setSp(20))), | ||
| 253 | - ) | ||
| 254 | - : Container( | ||
| 255 | - padding: EdgeInsets.fromLTRB( | ||
| 256 | - ScreenUtil().setWidth(24 * 2), | ||
| 257 | - ScreenUtil().setWidth(14), | ||
| 258 | - ScreenUtil().setWidth(0), | ||
| 259 | - ScreenUtil().setWidth(14)), | ||
| 260 | - width: ScreenUtil().screenWidth - | ||
| 261 | - ScreenUtil().setWidth(92 * 2) + | ||
| 262 | - ScreenUtil().setWidth(20), | ||
| 263 | - child: Text('说明:${sunModel.explain}', | ||
| 264 | - maxLines: 1, | ||
| 265 | - overflow: TextOverflow.fade, | ||
| 266 | - softWrap: false, | ||
| 267 | - style: TextStyle( | ||
| 268 | - color: widget.from == 'history' | ||
| 269 | - ? MyColours.color_BFC4D4 | ||
| 270 | - : MyColours.color_999999, | ||
| 271 | - fontSize: | ||
| 272 | - ScreenUtil().setSp(20))), | ||
| 273 | - ), | ||
| 274 | - Spacer(), | ||
| 275 | - explainH > 19 | ||
| 276 | - ? Container( | ||
| 277 | - margin: EdgeInsets.only( | ||
| 278 | - top: ScreenUtil().setWidth(10), | ||
| 279 | - right: ScreenUtil().setWidth(16)), | ||
| 280 | - child: Image.asset( | ||
| 281 | - !widget.couponSonModel.showText | ||
| 282 | - ? Utils.getImgPath( | ||
| 283 | - 'quan_down_f') | ||
| 284 | - : Utils.getImgPath('quan_up_f'), | ||
| 285 | - width: ScreenUtil().setWidth(28), | ||
| 286 | - height: ScreenUtil().setWidth(28)), | ||
| 287 | - ) | ||
| 288 | - : Container(), | ||
| 289 | - HEmptyView(14) | ||
| 290 | - ], | ||
| 291 | - )), | ||
| 292 | - ) | ||
| 293 | - : Container(), | ||
| 294 | - ], | ||
| 295 | - ), | ||
| 296 | - )), | ||
| 297 | - Positioned( | ||
| 298 | - right: ScreenUtil().setWidth(100), | ||
| 299 | - top: ScreenUtil().setWidth(37 * 2), | ||
| 300 | - child: widget.showBtn | ||
| 301 | - ? RoundButton( | ||
| 302 | - width: widget.from == 'history' | ||
| 303 | - ? ScreenUtil().setWidth(44 * 2) | ||
| 304 | - : ScreenUtil().setWidth(32 * 2), | ||
| 305 | - height: ScreenUtil().setWidth(21 * 2), | ||
| 306 | - radius: ScreenUtil().setWidth(10), | ||
| 307 | - text: widget.from == 'history' | ||
| 308 | - ? '已过期' | ||
| 309 | - : notSelect | ||
| 310 | - ? '停用' | ||
| 311 | - : '启用', | ||
| 312 | - fontSize: 24, | ||
| 313 | - textColor: widget.from == 'history' | ||
| 314 | - ? MyColours.color_BFC4D4 | ||
| 315 | - : notSelect | ||
| 316 | - ? MyColours.color_438E93 | ||
| 317 | - : MyColours.color_999999, | ||
| 318 | - gradientStart: MyColours.color_ffffff, | ||
| 319 | - gradientEnd: MyColours.color_ffffff, | ||
| 320 | - borderColor: widget.from == 'history' | ||
| 321 | - ? MyColours.color_BFC4D4 | ||
| 322 | - : notSelect | ||
| 323 | - ? MyColours.color_438E93 | ||
| 324 | - : MyColours.color_999999, | ||
| 325 | - onPressed: widget.onPressedSwich, | ||
| 326 | - ) | ||
| 327 | - : Container()) | ||
| 328 | - ]); | 232 | + : notSelect |
| 233 | + ? MyColours.color_ffffff | ||
| 234 | + : MyColours.color_FAFAFA, | ||
| 235 | + borderRadius: BorderRadius.only( | ||
| 236 | + bottomLeft: Radius.circular( | ||
| 237 | + ScreenUtil().setWidth(20)), | ||
| 238 | + bottomRight: Radius.circular( | ||
| 239 | + ScreenUtil().setWidth(20)))), | ||
| 240 | + child: Row( | ||
| 241 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 242 | + children: [ | ||
| 243 | + widget.couponSonModel.showText | ||
| 244 | + ? Container( | ||
| 245 | + padding: EdgeInsets.fromLTRB( | ||
| 246 | + ScreenUtil().setWidth(24 * 2), | ||
| 247 | + ScreenUtil().setWidth(14), | ||
| 248 | + ScreenUtil().setWidth(0), | ||
| 249 | + ScreenUtil().setWidth(14)), | ||
| 250 | + width: ScreenUtil().screenWidth - | ||
| 251 | + ScreenUtil().setWidth(92 * 2), | ||
| 252 | + child: Text( | ||
| 253 | + '说明:${sunModel.explain}', | ||
| 254 | + maxLines: 5, | ||
| 255 | + style: TextStyle( | ||
| 256 | + color: widget.from == | ||
| 257 | + 'history' | ||
| 258 | + ? MyColours.color_BFC4D4 | ||
| 259 | + : MyColours | ||
| 260 | + .color_999999, | ||
| 261 | + fontSize: ScreenUtil() | ||
| 262 | + .setSp(20))), | ||
| 263 | + ) | ||
| 264 | + : Container( | ||
| 265 | + padding: EdgeInsets.fromLTRB( | ||
| 266 | + ScreenUtil().setWidth(24 * 2), | ||
| 267 | + ScreenUtil().setWidth(14), | ||
| 268 | + ScreenUtil().setWidth(0), | ||
| 269 | + ScreenUtil().setWidth(14)), | ||
| 270 | + width: ScreenUtil().screenWidth - | ||
| 271 | + ScreenUtil().setWidth(92 * 2) + | ||
| 272 | + ScreenUtil().setWidth(20), | ||
| 273 | + child: Text( | ||
| 274 | + '说明:${sunModel.explain}', | ||
| 275 | + maxLines: 1, | ||
| 276 | + overflow: TextOverflow.fade, | ||
| 277 | + softWrap: false, | ||
| 278 | + style: TextStyle( | ||
| 279 | + color: widget.from == | ||
| 280 | + 'history' | ||
| 281 | + ? MyColours.color_BFC4D4 | ||
| 282 | + : MyColours | ||
| 283 | + .color_999999, | ||
| 284 | + fontSize: ScreenUtil() | ||
| 285 | + .setSp(20))), | ||
| 286 | + ), | ||
| 287 | + Spacer(), | ||
| 288 | + explainH > 19 | ||
| 289 | + ? Container( | ||
| 290 | + margin: EdgeInsets.only( | ||
| 291 | + top: ScreenUtil().setWidth(10), | ||
| 292 | + right: | ||
| 293 | + ScreenUtil().setWidth(16)), | ||
| 294 | + child: Image.asset( | ||
| 295 | + !widget.couponSonModel.showText | ||
| 296 | + ? Utils.getImgPath( | ||
| 297 | + 'quan_down_f') | ||
| 298 | + : Utils.getImgPath( | ||
| 299 | + 'quan_up_f'), | ||
| 300 | + width: | ||
| 301 | + ScreenUtil().setWidth(28), | ||
| 302 | + height: | ||
| 303 | + ScreenUtil().setWidth(28)), | ||
| 304 | + ) | ||
| 305 | + : Container(), | ||
| 306 | + HEmptyView(14) | ||
| 307 | + ], | ||
| 308 | + )), | ||
| 309 | + ) | ||
| 310 | + : Container(), | ||
| 311 | + ], | ||
| 312 | + ), | ||
| 313 | + )), | ||
| 314 | + Positioned( | ||
| 315 | + left: ScreenUtil().setWidth(21), | ||
| 316 | + child: widget.from == 'select' | ||
| 317 | + ? Image.asset( | ||
| 318 | + Utils.getImgPath( | ||
| 319 | + sunModel.isCheck ? 'c_mul_select' : 'c_not_edit'), | ||
| 320 | + width: w(21), | ||
| 321 | + ) | ||
| 322 | + : Container()), | ||
| 323 | + Positioned( | ||
| 324 | + right: ScreenUtil().setWidth(100), | ||
| 325 | + top: ScreenUtil().setWidth(37 * 2), | ||
| 326 | + child: widget.showBtn | ||
| 327 | + ? RoundButton( | ||
| 328 | + width: widget.from == 'history' | ||
| 329 | + ? ScreenUtil().setWidth(44 * 2) | ||
| 330 | + : ScreenUtil().setWidth(32 * 2), | ||
| 331 | + height: ScreenUtil().setWidth(21 * 2), | ||
| 332 | + radius: ScreenUtil().setWidth(10), | ||
| 333 | + text: widget.from == 'history' | ||
| 334 | + ? '已过期' | ||
| 335 | + : notSelect | ||
| 336 | + ? '停用' | ||
| 337 | + : '启用', | ||
| 338 | + fontSize: 24, | ||
| 339 | + textColor: widget.from == 'history' | ||
| 340 | + ? MyColours.color_BFC4D4 | ||
| 341 | + : notSelect | ||
| 342 | + ? MyColours.color_438E93 | ||
| 343 | + : MyColours.color_999999, | ||
| 344 | + gradientStart: MyColours.color_ffffff, | ||
| 345 | + gradientEnd: MyColours.color_ffffff, | ||
| 346 | + borderColor: widget.from == 'history' | ||
| 347 | + ? MyColours.color_BFC4D4 | ||
| 348 | + : notSelect | ||
| 349 | + ? MyColours.color_438E93 | ||
| 350 | + : MyColours.color_999999, | ||
| 351 | + onPressed: widget.onPressedSwich, | ||
| 352 | + ) | ||
| 353 | + : Container()) | ||
| 354 | + ]); | ||
| 329 | } | 355 | } |
| 330 | } | 356 | } |
| @@ -107,42 +107,41 @@ class _MarketingCenterHomePageState extends State<MarketingCenterHomePage> { | @@ -107,42 +107,41 @@ class _MarketingCenterHomePageState extends State<MarketingCenterHomePage> { | ||
| 107 | child: SingleChildScrollView( | 107 | child: SingleChildScrollView( |
| 108 | child: Column( | 108 | child: Column( |
| 109 | children: [ | 109 | children: [ |
| 110 | - // InkWell( | ||
| 111 | - // onTap: () { | ||
| 112 | - // // NavigatorUtil.goWebPage(context, '隐私政策', "zc", | ||
| 113 | - // // need: true); | ||
| 114 | - // }, | ||
| 115 | - // child: Padding( | ||
| 116 | - // padding: EdgeInsets.only( | ||
| 117 | - // left: w(16), | ||
| 118 | - // top: w(12), | ||
| 119 | - // bottom: w(12), | ||
| 120 | - // right: w(12)), | ||
| 121 | - // child: Row( | ||
| 122 | - // children: [ | ||
| 123 | - // Text( | ||
| 124 | - // '会员充值优惠活动', | ||
| 125 | - // style: TextStyle( | ||
| 126 | - // color: MyColours.color_515151, | ||
| 127 | - // fontSize: ScreenUtil().setWidth(32)), | ||
| 128 | - // ), | ||
| 129 | - // Spacer(), | ||
| 130 | - // Container( | ||
| 131 | - // padding: EdgeInsets.symmetric( | ||
| 132 | - // horizontal: w(7), vertical: w(4)), | ||
| 133 | - // child: Image.asset( | ||
| 134 | - // "assets/arrow_right_new.png", | ||
| 135 | - // width: ScreenUtil().setWidth(18), | ||
| 136 | - // height: ScreenUtil().setWidth(32), | ||
| 137 | - // ), | ||
| 138 | - // ) | ||
| 139 | - // ], | ||
| 140 | - // ))), | ||
| 141 | - // Padding( | ||
| 142 | - // padding: EdgeInsets.only(left: w(16)), | ||
| 143 | - // child: MyDivider(double.infinity, w(0.5), | ||
| 144 | - // color: MyColours.color_E7E7E7)), | ||
| 145 | - // VEmptyView(24), | 110 | + InkWell( |
| 111 | + onTap: () { | ||
| 112 | + NavigatorUtil.goRechargeHomePage(context); | ||
| 113 | + }, | ||
| 114 | + child: Padding( | ||
| 115 | + padding: EdgeInsets.only( | ||
| 116 | + left: w(16), | ||
| 117 | + top: w(12), | ||
| 118 | + bottom: w(12), | ||
| 119 | + right: w(12)), | ||
| 120 | + child: Row( | ||
| 121 | + children: [ | ||
| 122 | + Text( | ||
| 123 | + '会员充值优惠活动', | ||
| 124 | + style: TextStyle( | ||
| 125 | + color: MyColours.color_515151, | ||
| 126 | + fontSize: ScreenUtil().setWidth(32)), | ||
| 127 | + ), | ||
| 128 | + Spacer(), | ||
| 129 | + Container( | ||
| 130 | + padding: EdgeInsets.symmetric( | ||
| 131 | + horizontal: w(7), vertical: w(4)), | ||
| 132 | + child: Image.asset( | ||
| 133 | + "assets/arrow_right_new.png", | ||
| 134 | + width: ScreenUtil().setWidth(18), | ||
| 135 | + height: ScreenUtil().setWidth(32), | ||
| 136 | + ), | ||
| 137 | + ) | ||
| 138 | + ], | ||
| 139 | + ))), | ||
| 140 | + Padding( | ||
| 141 | + padding: EdgeInsets.only(left: w(16)), | ||
| 142 | + child: MyDivider(double.infinity, w(0.5), | ||
| 143 | + color: MyColours.color_E7E7E7)), | ||
| 144 | + VEmptyView(24), | ||
| 146 | InkWell( | 145 | InkWell( |
| 147 | onTap: () { | 146 | onTap: () { |
| 148 | setState(() { | 147 | setState(() { |
| 1 | +import 'package:common_utils/common_utils.dart'; | ||
| 2 | +import 'package:flutter/material.dart'; | ||
| 3 | +import 'package:flutter_picker/Picker.dart'; | ||
| 4 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 5 | +import 'package:one_key/models/coupon_model.dart'; | ||
| 6 | +import 'package:one_key/models/filter_btn_model.dart'; | ||
| 7 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 8 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 9 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 10 | + | ||
| 11 | +import '../../../../res/colors.dart'; | ||
| 12 | +import '../../../../utils/dialog_util.dart'; | ||
| 13 | +import '../../../../utils/screen_util.dart'; | ||
| 14 | +import '../../../../utils/utils.dart'; | ||
| 15 | +import '../../../../widgets/h_empty_view.dart'; | ||
| 16 | +import '../../../../widgets/round_button.dart'; | ||
| 17 | +import '../../../../widgets/v_empty_view.dart'; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * | ||
| 21 | + * 新建优惠券 | ||
| 22 | + */ | ||
| 23 | + | ||
| 24 | +class RechargeEditPage extends StatefulWidget { | ||
| 25 | + RechargeEditPage({Key key}) : super(key: key); | ||
| 26 | + | ||
| 27 | + @override | ||
| 28 | + _RechargeEditPageState createState() => _RechargeEditPageState(); | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 32 | + TextEditingController nameC = TextEditingController(); | ||
| 33 | + TextEditingController priceminC = TextEditingController(); | ||
| 34 | + TextEditingController givePriceC = TextEditingController(); //赠送金额 | ||
| 35 | + TextEditingController giveScoreC = TextEditingController(); //积分 | ||
| 36 | + TextEditingController remarkC = TextEditingController(); //备注 | ||
| 37 | + | ||
| 38 | + FocusNode nameF = FocusNode(); | ||
| 39 | + FocusNode priceminF = FocusNode(); | ||
| 40 | + FocusNode givePricF = FocusNode(); | ||
| 41 | + FocusNode giveScoreF = FocusNode(); | ||
| 42 | + FocusNode remarkF = FocusNode(); | ||
| 43 | + bool fixdate = true; | ||
| 44 | + bool weekly = false; | ||
| 45 | + bool birthday = false; | ||
| 46 | + final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); | ||
| 47 | + | ||
| 48 | + bool showDateSelWidget = false; | ||
| 49 | + String fromDate = '点击设置开始日期'; //有效期开始时间 | ||
| 50 | + String endDate = '点击设置结束日期'; //有效期结束时间 | ||
| 51 | + | ||
| 52 | + List<FilterBtnModel> weekData = []; | ||
| 53 | + | ||
| 54 | + String weekShow = '点击设置可用日期'; | ||
| 55 | + bool canUse = false; | ||
| 56 | + List<String> coupons = []; | ||
| 57 | + | ||
| 58 | + List<String> selectIDs = []; | ||
| 59 | + | ||
| 60 | + @override | ||
| 61 | + void initState() { | ||
| 62 | + super.initState(); | ||
| 63 | + | ||
| 64 | + _initWeekData(); | ||
| 65 | + | ||
| 66 | + nameF.addListener(() { | ||
| 67 | + if (nameF.hasFocus) { | ||
| 68 | + //有焦点 | ||
| 69 | + if (showDateSelWidget) { | ||
| 70 | + Navigator.pop(context); | ||
| 71 | + showDateSelWidget = false; | ||
| 72 | + } | ||
| 73 | + } else { | ||
| 74 | + //失去焦点 | ||
| 75 | + // _editingController.text = ''; | ||
| 76 | + } | ||
| 77 | + }); | ||
| 78 | + priceminF.addListener(() { | ||
| 79 | + if (priceminF.hasFocus) { | ||
| 80 | + //有焦点 | ||
| 81 | + if (showDateSelWidget) { | ||
| 82 | + Navigator.pop(context); | ||
| 83 | + showDateSelWidget = false; | ||
| 84 | + } | ||
| 85 | + } else { | ||
| 86 | + //失去焦点 | ||
| 87 | + // _editingController.text = ''; | ||
| 88 | + } | ||
| 89 | + }); | ||
| 90 | + givePricF.addListener(() { | ||
| 91 | + if (givePricF.hasFocus) { | ||
| 92 | + //有焦点 | ||
| 93 | + if (showDateSelWidget) { | ||
| 94 | + Navigator.pop(context); | ||
| 95 | + showDateSelWidget = false; | ||
| 96 | + } | ||
| 97 | + } else { | ||
| 98 | + //失去焦点 | ||
| 99 | + // _editingController.text = ''; | ||
| 100 | + } | ||
| 101 | + }); | ||
| 102 | + giveScoreF.addListener(() { | ||
| 103 | + if (giveScoreF.hasFocus) { | ||
| 104 | + //有焦点 | ||
| 105 | + if (showDateSelWidget) { | ||
| 106 | + Navigator.pop(context); | ||
| 107 | + showDateSelWidget = false; | ||
| 108 | + } | ||
| 109 | + } else { | ||
| 110 | + //失去焦点 | ||
| 111 | + // _editingController.text = ''; | ||
| 112 | + } | ||
| 113 | + }); | ||
| 114 | + remarkF.addListener(() { | ||
| 115 | + if (remarkF.hasFocus) { | ||
| 116 | + //有焦点 | ||
| 117 | + if (showDateSelWidget) { | ||
| 118 | + Navigator.pop(context); | ||
| 119 | + showDateSelWidget = false; | ||
| 120 | + } | ||
| 121 | + } else { | ||
| 122 | + //失去焦点 | ||
| 123 | + // _editingController.text = ''; | ||
| 124 | + } | ||
| 125 | + }); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + _initWeekData() { | ||
| 129 | + FilterBtnModel filterBtnModel = FilterBtnModel(); | ||
| 130 | + filterBtnModel.select = false; | ||
| 131 | + filterBtnModel.title = '周日'; | ||
| 132 | + weekData.add(filterBtnModel); | ||
| 133 | + for (int i = 1; i < 7; i++) { | ||
| 134 | + FilterBtnModel filterBtnModel = FilterBtnModel(); | ||
| 135 | + filterBtnModel.select = false; | ||
| 136 | + filterBtnModel.title = '周${Utils.formatWeekDayNum(i)}'; | ||
| 137 | + weekData.add(filterBtnModel); | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + ///输入框 | ||
| 142 | + Widget _textfield(String title, String hintText, | ||
| 143 | + TextEditingController controller, FocusNode node, | ||
| 144 | + {TextInputType textInputStyle = TextInputType.text}) { | ||
| 145 | + return Container( | ||
| 146 | + child: Row( | ||
| 147 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 148 | + children: [ | ||
| 149 | + Container( | ||
| 150 | + child: Text( | ||
| 151 | + title, | ||
| 152 | + style: TextStyle( | ||
| 153 | + color: MyColours.color_515151, | ||
| 154 | + fontSize: ScreenUtil().setSp(32)), | ||
| 155 | + ), | ||
| 156 | + ), | ||
| 157 | + HEmptyView(80), | ||
| 158 | + Expanded( | ||
| 159 | + child: TextField( | ||
| 160 | + controller: controller, | ||
| 161 | + focusNode: node, | ||
| 162 | + textAlign: TextAlign.right, | ||
| 163 | + textAlignVertical: TextAlignVertical.bottom, | ||
| 164 | + maxLines: 1, | ||
| 165 | + // //光标颜色 | ||
| 166 | + // cursorColor: | ||
| 167 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 168 | + //输入文本的样式 | ||
| 169 | + style: TextStyle( | ||
| 170 | + color: MyColours.color_515151, | ||
| 171 | + fontSize: ScreenUtil().setSp(32), | ||
| 172 | + ), | ||
| 173 | + // focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode, | ||
| 174 | + decoration: InputDecoration( | ||
| 175 | + border: OutlineInputBorder(borderSide: BorderSide.none), | ||
| 176 | + hintText: hintText, | ||
| 177 | + hintStyle: TextStyle( | ||
| 178 | + color: MyColours.color_999999, | ||
| 179 | + fontSize: ScreenUtil().setSp(32), | ||
| 180 | + ), | ||
| 181 | + enabledBorder: new UnderlineInputBorder( | ||
| 182 | + borderSide: BorderSide.none, | ||
| 183 | + ), | ||
| 184 | + focusedBorder: new UnderlineInputBorder( | ||
| 185 | + borderSide: BorderSide.none, | ||
| 186 | + ), | ||
| 187 | + ), | ||
| 188 | + onChanged: (value) {}, | ||
| 189 | + onEditingComplete: () { | ||
| 190 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 191 | + }, | ||
| 192 | + keyboardType: textInputStyle, | ||
| 193 | + ), | ||
| 194 | + ), | ||
| 195 | + HEmptyView(32) | ||
| 196 | + ], | ||
| 197 | + ), | ||
| 198 | + ); | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + ///时间选择 | ||
| 202 | + Widget _select(String title, String hintText, GestureTapCallback onTap) { | ||
| 203 | + return InkWell( | ||
| 204 | + onTap: onTap, | ||
| 205 | + child: Container( | ||
| 206 | + padding: EdgeInsets.only(left: ScreenUtil().setWidth(32)), | ||
| 207 | + child: Row( | ||
| 208 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 209 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 210 | + children: [ | ||
| 211 | + Container( | ||
| 212 | + // height: ScreenUtil().setWidth(40), | ||
| 213 | + // color: Colors.red, | ||
| 214 | + child: Text( | ||
| 215 | + title, | ||
| 216 | + style: TextStyle( | ||
| 217 | + color: title == '点击设置可用日期' | ||
| 218 | + ? MyColours.color_999999 | ||
| 219 | + : MyColours.color_515151, | ||
| 220 | + fontSize: ScreenUtil().setSp(32)), | ||
| 221 | + ), | ||
| 222 | + ), | ||
| 223 | + HEmptyView(20), | ||
| 224 | + Spacer(), | ||
| 225 | + Text(hintText, | ||
| 226 | + style: TextStyle( | ||
| 227 | + color: hintText == '点击设置开始日期' || hintText == '点击设置结束日期' | ||
| 228 | + ? MyColours.color_999999 | ||
| 229 | + : MyColours.color_515151, | ||
| 230 | + fontSize: ScreenUtil().setSp(32), | ||
| 231 | + )), | ||
| 232 | + HEmptyView(20), | ||
| 233 | + Image.asset( | ||
| 234 | + Utils.getImgPath('arrow_right_new'), | ||
| 235 | + width: ScreenUtil().setWidth(18), | ||
| 236 | + ), | ||
| 237 | + HEmptyView(32), | ||
| 238 | + ], | ||
| 239 | + ), | ||
| 240 | + ), | ||
| 241 | + ); | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + ///券说明 | ||
| 245 | + Widget _explain(String title, String hintText, | ||
| 246 | + TextEditingController controller, FocusNode node) { | ||
| 247 | + return Container( | ||
| 248 | + // height: ScreenUtil().setWidth(380), | ||
| 249 | + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)), | ||
| 250 | + child: Column( | ||
| 251 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 252 | + children: [ | ||
| 253 | + Align( | ||
| 254 | + alignment: Alignment.centerLeft, | ||
| 255 | + child: Text( | ||
| 256 | + title, | ||
| 257 | + textAlign: TextAlign.left, | ||
| 258 | + style: TextStyle( | ||
| 259 | + color: MyColours.color_515151, | ||
| 260 | + fontSize: ScreenUtil().setSp(32)), | ||
| 261 | + )), | ||
| 262 | + VEmptyView(26), | ||
| 263 | + Container( | ||
| 264 | + height: ScreenUtil().setWidth(2), | ||
| 265 | + color: MyColours.color_E7E7E7, | ||
| 266 | + ), | ||
| 267 | + TextField( | ||
| 268 | + controller: controller, | ||
| 269 | + focusNode: node, | ||
| 270 | + // keyboardType: TextInputType.number, //键盘类型,数字键盘 | ||
| 271 | + maxLines: 3, | ||
| 272 | + maxLength: 50, | ||
| 273 | + | ||
| 274 | + // maxLengthEnforced: true, | ||
| 275 | + style: TextStyle( | ||
| 276 | + fontSize: ScreenUtil().setSp(32), | ||
| 277 | + color: MyColours.color_333333), //输入文本的样式 | ||
| 278 | + decoration: InputDecoration( | ||
| 279 | + contentPadding: EdgeInsets.all(ScreenUtil().setWidth(30)), | ||
| 280 | + hintText: hintText, | ||
| 281 | + hintStyle: TextStyle( | ||
| 282 | + color: MyColours.color_999999, | ||
| 283 | + fontSize: ScreenUtil().setSp(32), | ||
| 284 | + ), | ||
| 285 | + | ||
| 286 | + border: OutlineInputBorder(borderSide: BorderSide.none), | ||
| 287 | + | ||
| 288 | + enabledBorder: new UnderlineInputBorder( | ||
| 289 | + borderSide: BorderSide.none, | ||
| 290 | + ), | ||
| 291 | + focusedBorder: new UnderlineInputBorder( | ||
| 292 | + borderSide: BorderSide.none, | ||
| 293 | + ), | ||
| 294 | + | ||
| 295 | + // fillColor: MyColours.color_F9F9F9, | ||
| 296 | + // // fillColor: Colors.red, | ||
| 297 | + // filled: true, | ||
| 298 | + // enabledBorder: OutlineInputBorder( | ||
| 299 | + // //未选中时候的颜色 | ||
| 300 | + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)), | ||
| 301 | + // borderSide: BorderSide( | ||
| 302 | + // color: MyColours.color_cccccc, | ||
| 303 | + // width: ScreenUtil().setWidth(2)), | ||
| 304 | + // ), | ||
| 305 | + // focusedBorder: OutlineInputBorder( | ||
| 306 | + // //选中时外边框颜色 | ||
| 307 | + // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)), | ||
| 308 | + // borderSide: BorderSide( | ||
| 309 | + // color: MyColours.app_main, | ||
| 310 | + // ), | ||
| 311 | + // ), | ||
| 312 | + // border: OutlineInputBorder( | ||
| 313 | + // borderRadius: | ||
| 314 | + // BorderRadius.circular(ScreenUtil().setWidth(20)), | ||
| 315 | + // borderSide: BorderSide( | ||
| 316 | + // color: Colors.red, width: ScreenUtil().setWidth(2))), | ||
| 317 | + ), | ||
| 318 | + onChanged: (value) {}, | ||
| 319 | + ), | ||
| 320 | + ], | ||
| 321 | + ), | ||
| 322 | + ); | ||
| 323 | + } | ||
| 324 | + | ||
| 325 | + _itemRadioWidget(bool select, String title, {GestureTapCallback onTap}) { | ||
| 326 | + return InkWell( | ||
| 327 | + onTap: onTap, | ||
| 328 | + child: Row(children: [ | ||
| 329 | + Image.asset( | ||
| 330 | + Utils.getImgPath( | ||
| 331 | + select ? 'plan_dish_select' : 'plan_dish_unselect'), | ||
| 332 | + width: w(20), | ||
| 333 | + ), | ||
| 334 | + HEmptyView(6), | ||
| 335 | + Text( | ||
| 336 | + title, | ||
| 337 | + style: TextStyle( | ||
| 338 | + color: MyColours.color_515151, | ||
| 339 | + fontSize: ScreenUtil().setSp(32)), | ||
| 340 | + ), | ||
| 341 | + ])); | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + ///是否立即启用 | ||
| 345 | + Widget _canUse(String title, bool swich, GestureTapCallback onTap) { | ||
| 346 | + return InkWell( | ||
| 347 | + onTap: onTap, | ||
| 348 | + child: Container( | ||
| 349 | + padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)), | ||
| 350 | + margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)), | ||
| 351 | + child: Row( | ||
| 352 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 353 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 354 | + children: [ | ||
| 355 | + Container( | ||
| 356 | + // height: ScreenUtil().setWidth(40), | ||
| 357 | + // color: Colors.red, | ||
| 358 | + child: Text( | ||
| 359 | + title, | ||
| 360 | + style: TextStyle( | ||
| 361 | + color: MyColours.color_515151, | ||
| 362 | + fontSize: ScreenUtil().setSp(32)), | ||
| 363 | + ), | ||
| 364 | + ), | ||
| 365 | + Spacer(), | ||
| 366 | + Image.asset( | ||
| 367 | + swich | ||
| 368 | + ? Utils.getImgPath('swich_on') | ||
| 369 | + : Utils.getImgPath('swich_off'), | ||
| 370 | + width: ScreenUtil().setWidth(44 * 2), | ||
| 371 | + ) | ||
| 372 | + ], | ||
| 373 | + ), | ||
| 374 | + ), | ||
| 375 | + ); | ||
| 376 | + } | ||
| 377 | + | ||
| 378 | + @override | ||
| 379 | + Widget build(BuildContext context) { | ||
| 380 | + return Scaffold( | ||
| 381 | + key: scaffoldKey, | ||
| 382 | + backgroundColor: MyColours.color_ffffff, | ||
| 383 | + appBar: SystemAppBar('充值优惠详情'), | ||
| 384 | + body: Column( | ||
| 385 | + children: [ | ||
| 386 | + Expanded( | ||
| 387 | + child: SingleChildScrollView( | ||
| 388 | + child: Padding( | ||
| 389 | + padding: EdgeInsets.only(left: w(32)), | ||
| 390 | + child: Column( | ||
| 391 | + children: [ | ||
| 392 | + _textfield('活动名称', '点击输入活动名称', nameC, nameF), | ||
| 393 | + MyDivider( | ||
| 394 | + double.infinity, | ||
| 395 | + w(1), | ||
| 396 | + color: MyColours.color_E7E7E7, | ||
| 397 | + ), | ||
| 398 | + VEmptyView(24), | ||
| 399 | + _textfield('充值满', '点击输入充值金额门槛', priceminC, priceminF, | ||
| 400 | + textInputStyle: TextInputType.numberWithOptions()), | ||
| 401 | + MyDivider( | ||
| 402 | + double.infinity, | ||
| 403 | + w(1), | ||
| 404 | + color: MyColours.color_E7E7E7, | ||
| 405 | + ), | ||
| 406 | + VEmptyView(48), | ||
| 407 | + Container( | ||
| 408 | + alignment: Alignment.centerLeft, | ||
| 409 | + child: Text( | ||
| 410 | + '优惠活动', | ||
| 411 | + style: TextStyle( | ||
| 412 | + color: MyColours.color_515151, | ||
| 413 | + fontSize: ScreenUtil().setSp(32)), | ||
| 414 | + ), | ||
| 415 | + ), | ||
| 416 | + VEmptyView(26), | ||
| 417 | + Padding( | ||
| 418 | + padding: EdgeInsets.only( | ||
| 419 | + left: w(16), | ||
| 420 | + ), | ||
| 421 | + child: Column( | ||
| 422 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 423 | + children: [ | ||
| 424 | + Row( | ||
| 425 | + children: [ | ||
| 426 | + Image.asset( | ||
| 427 | + Utils.getImgPath( | ||
| 428 | + true ? 'f_select' : 'f_select_not'), | ||
| 429 | + width: w(20), | ||
| 430 | + ), | ||
| 431 | + HEmptyView(16), | ||
| 432 | + Text( | ||
| 433 | + '赠送', | ||
| 434 | + style: TextStyle( | ||
| 435 | + color: MyColours.color_515151, | ||
| 436 | + fontSize: ScreenUtil().setSp(32)), | ||
| 437 | + ), | ||
| 438 | + HEmptyView(16), | ||
| 439 | + Container( | ||
| 440 | + width: w(140), | ||
| 441 | + height: w(28), | ||
| 442 | + alignment: Alignment.center, | ||
| 443 | + decoration: BoxDecoration( | ||
| 444 | + border: Border.all( | ||
| 445 | + width: w(1), | ||
| 446 | + color: MyColours.color_DBDBDB)), | ||
| 447 | + child: TextField( | ||
| 448 | + controller: givePriceC, | ||
| 449 | + focusNode: givePricF, | ||
| 450 | + textAlign: TextAlign.center, | ||
| 451 | + // textAlignVertical: TextAlignVertical.bottom, | ||
| 452 | + maxLines: 1, | ||
| 453 | + | ||
| 454 | + // //光标颜色 | ||
| 455 | + // cursorColor: | ||
| 456 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 457 | + //输入文本的样式 | ||
| 458 | + style: TextStyle( | ||
| 459 | + color: MyColours.color_515151, | ||
| 460 | + fontSize: ScreenUtil().setSp(32), | ||
| 461 | + ), | ||
| 462 | + // focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode, | ||
| 463 | + decoration: InputDecoration( | ||
| 464 | + isCollapsed: | ||
| 465 | + true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度 | ||
| 466 | + border: OutlineInputBorder( | ||
| 467 | + borderSide: BorderSide.none), | ||
| 468 | + hintText: '', | ||
| 469 | + hintStyle: TextStyle( | ||
| 470 | + color: MyColours.color_999999, | ||
| 471 | + fontSize: ScreenUtil().setSp(32), | ||
| 472 | + ), | ||
| 473 | + enabledBorder: new UnderlineInputBorder( | ||
| 474 | + borderSide: BorderSide.none, | ||
| 475 | + ), | ||
| 476 | + contentPadding: EdgeInsets.zero, | ||
| 477 | + focusedBorder: new UnderlineInputBorder( | ||
| 478 | + borderSide: BorderSide.none, | ||
| 479 | + ), | ||
| 480 | + ), | ||
| 481 | + onChanged: (value) {}, | ||
| 482 | + onEditingComplete: () { | ||
| 483 | + FocusScope.of(context).requestFocus( | ||
| 484 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 485 | + }, | ||
| 486 | + keyboardType: | ||
| 487 | + TextInputType.numberWithOptions(), | ||
| 488 | + ), | ||
| 489 | + ), | ||
| 490 | + HEmptyView(16), | ||
| 491 | + Text( | ||
| 492 | + '元余额', | ||
| 493 | + style: TextStyle( | ||
| 494 | + color: MyColours.color_515151, | ||
| 495 | + fontSize: ScreenUtil().setSp(32)), | ||
| 496 | + ), | ||
| 497 | + ], | ||
| 498 | + ), | ||
| 499 | + VEmptyView(20), | ||
| 500 | + Row( | ||
| 501 | + children: [ | ||
| 502 | + Image.asset( | ||
| 503 | + Utils.getImgPath( | ||
| 504 | + true ? 'f_select' : 'f_select_not'), | ||
| 505 | + width: w(20), | ||
| 506 | + ), | ||
| 507 | + HEmptyView(16), | ||
| 508 | + Text( | ||
| 509 | + '赠送', | ||
| 510 | + style: TextStyle( | ||
| 511 | + color: MyColours.color_515151, | ||
| 512 | + fontSize: ScreenUtil().setSp(32)), | ||
| 513 | + ), | ||
| 514 | + HEmptyView(16), | ||
| 515 | + Container( | ||
| 516 | + width: w(140), | ||
| 517 | + height: w(28), | ||
| 518 | + alignment: Alignment.center, | ||
| 519 | + decoration: BoxDecoration( | ||
| 520 | + border: Border.all( | ||
| 521 | + width: w(1), | ||
| 522 | + color: MyColours.color_DBDBDB)), | ||
| 523 | + child: TextField( | ||
| 524 | + controller: giveScoreC, | ||
| 525 | + focusNode: giveScoreF, | ||
| 526 | + textAlign: TextAlign.center, | ||
| 527 | + // textAlignVertical: TextAlignVertical.bottom, | ||
| 528 | + maxLines: 1, | ||
| 529 | + | ||
| 530 | + // //光标颜色 | ||
| 531 | + // cursorColor: | ||
| 532 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 533 | + //输入文本的样式 | ||
| 534 | + style: TextStyle( | ||
| 535 | + color: MyColours.color_515151, | ||
| 536 | + fontSize: ScreenUtil().setSp(32), | ||
| 537 | + ), | ||
| 538 | + // focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode, | ||
| 539 | + decoration: InputDecoration( | ||
| 540 | + isCollapsed: | ||
| 541 | + true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度 | ||
| 542 | + border: OutlineInputBorder( | ||
| 543 | + borderSide: BorderSide.none), | ||
| 544 | + hintText: '', | ||
| 545 | + hintStyle: TextStyle( | ||
| 546 | + color: MyColours.color_999999, | ||
| 547 | + fontSize: ScreenUtil().setSp(32), | ||
| 548 | + ), | ||
| 549 | + enabledBorder: new UnderlineInputBorder( | ||
| 550 | + borderSide: BorderSide.none, | ||
| 551 | + ), | ||
| 552 | + contentPadding: EdgeInsets.zero, | ||
| 553 | + focusedBorder: new UnderlineInputBorder( | ||
| 554 | + borderSide: BorderSide.none, | ||
| 555 | + ), | ||
| 556 | + ), | ||
| 557 | + onChanged: (value) {}, | ||
| 558 | + onEditingComplete: () { | ||
| 559 | + FocusScope.of(context).requestFocus( | ||
| 560 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 561 | + }, | ||
| 562 | + keyboardType: | ||
| 563 | + TextInputType.numberWithOptions(), | ||
| 564 | + ), | ||
| 565 | + ), | ||
| 566 | + HEmptyView(16), | ||
| 567 | + Text( | ||
| 568 | + '积分', | ||
| 569 | + style: TextStyle( | ||
| 570 | + color: MyColours.color_515151, | ||
| 571 | + fontSize: ScreenUtil().setSp(32)), | ||
| 572 | + ), | ||
| 573 | + ], | ||
| 574 | + ), | ||
| 575 | + VEmptyView(20), | ||
| 576 | + Row( | ||
| 577 | + children: [ | ||
| 578 | + Image.asset( | ||
| 579 | + Utils.getImgPath( | ||
| 580 | + true ? 'f_select' : 'f_select_not'), | ||
| 581 | + width: w(20), | ||
| 582 | + ), | ||
| 583 | + HEmptyView(16), | ||
| 584 | + Text( | ||
| 585 | + '赠送优惠券', | ||
| 586 | + style: TextStyle( | ||
| 587 | + color: MyColours.color_515151, | ||
| 588 | + fontSize: ScreenUtil().setSp(32)), | ||
| 589 | + ), | ||
| 590 | + HEmptyView(60), | ||
| 591 | + InkWell( | ||
| 592 | + onTap: () async { | ||
| 593 | + Map object = await NavigatorUtil | ||
| 594 | + .goRechargeSelectStoreCouponPage( | ||
| 595 | + context, selectIDs.join(',')); | ||
| 596 | + print(object); | ||
| 597 | + if (object != null && | ||
| 598 | + object['couponsid'] != null) { | ||
| 599 | + List<CouponSunModel> data = | ||
| 600 | + object['couponsdata']; | ||
| 601 | + // | ||
| 602 | + selectIDs = object['couponsid']; | ||
| 603 | + coupons = []; | ||
| 604 | + data.forEach((element) { | ||
| 605 | + if (element.isCheck) { | ||
| 606 | + coupons.add(element.aname); | ||
| 607 | + } | ||
| 608 | + }); | ||
| 609 | + setState(() {}); | ||
| 610 | + } | ||
| 611 | + }, | ||
| 612 | + child: Text( | ||
| 613 | + '选择优惠券', | ||
| 614 | + style: TextStyle( | ||
| 615 | + color: MyColours.color_438E93, | ||
| 616 | + fontSize: ScreenUtil().setSp(32)), | ||
| 617 | + )), | ||
| 618 | + ], | ||
| 619 | + ), | ||
| 620 | + VEmptyView(20), | ||
| 621 | + Wrap( | ||
| 622 | + spacing: w(9), | ||
| 623 | + runSpacing: w(9), | ||
| 624 | + alignment: WrapAlignment.start, | ||
| 625 | + runAlignment: WrapAlignment.start, | ||
| 626 | + children: coupons.map((e) { | ||
| 627 | + return Text( | ||
| 628 | + e, | ||
| 629 | + style: TextStyle( | ||
| 630 | + color: MyColours.color_515151, | ||
| 631 | + fontSize: ScreenUtil().setSp(32)), | ||
| 632 | + ); | ||
| 633 | + }).toList()), | ||
| 634 | + VEmptyView(20), | ||
| 635 | + ], | ||
| 636 | + )), | ||
| 637 | + MyDivider( | ||
| 638 | + double.infinity, | ||
| 639 | + w(1), | ||
| 640 | + color: MyColours.color_E7E7E7, | ||
| 641 | + ), | ||
| 642 | + VEmptyView(48), | ||
| 643 | + Container( | ||
| 644 | + alignment: Alignment.centerLeft, | ||
| 645 | + child: Text( | ||
| 646 | + '有效期:', | ||
| 647 | + style: TextStyle( | ||
| 648 | + color: MyColours.color_515151, | ||
| 649 | + fontSize: ScreenUtil().setSp(32)), | ||
| 650 | + ), | ||
| 651 | + ), | ||
| 652 | + VEmptyView(24), | ||
| 653 | + Row( | ||
| 654 | + children: [ | ||
| 655 | + HEmptyView(30), | ||
| 656 | + _itemRadioWidget(fixdate, '固定时间段', onTap: () { | ||
| 657 | + if (!fixdate) { | ||
| 658 | + setState(() { | ||
| 659 | + fixdate = true; | ||
| 660 | + weekly = false; | ||
| 661 | + birthday = false; | ||
| 662 | + }); | ||
| 663 | + } | ||
| 664 | + }), | ||
| 665 | + Spacer(), | ||
| 666 | + _itemRadioWidget(weekly, '每周', onTap: () { | ||
| 667 | + if (!weekly) { | ||
| 668 | + setState(() { | ||
| 669 | + weekly = true; | ||
| 670 | + fixdate = false; | ||
| 671 | + birthday = false; | ||
| 672 | + }); | ||
| 673 | + } | ||
| 674 | + }), | ||
| 675 | + Spacer(), | ||
| 676 | + _itemRadioWidget(birthday, '会员生日当天', onTap: () { | ||
| 677 | + if (!birthday) { | ||
| 678 | + setState(() { | ||
| 679 | + birthday = true; | ||
| 680 | + weekly = false; | ||
| 681 | + fixdate = false; | ||
| 682 | + }); | ||
| 683 | + } | ||
| 684 | + }), | ||
| 685 | + HEmptyView(30), | ||
| 686 | + ], | ||
| 687 | + ), | ||
| 688 | + birthday ? SizedBox() : VEmptyView(24), | ||
| 689 | + fixdate | ||
| 690 | + ? Column( | ||
| 691 | + children: [ | ||
| 692 | + _select('有效期从', fromDate, () { | ||
| 693 | + FocusScope.of(context) | ||
| 694 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 695 | + //弹出时间选择器 | ||
| 696 | + // showPickerDateTime(context); | ||
| 697 | + showDateSelWidget = true; | ||
| 698 | + DialogUtil.showPickerDateTime24( | ||
| 699 | + context, | ||
| 700 | + scaffoldKey, | ||
| 701 | + (value) { | ||
| 702 | + // {'text': picker.adapter.text, 'select': selecteds} | ||
| 703 | + if (value != null) { | ||
| 704 | + setState(() { | ||
| 705 | + print(value); | ||
| 706 | + fromDate = DateUtil.formatDateStr( | ||
| 707 | + value, | ||
| 708 | + format: DateFormats.y_mo_d); | ||
| 709 | + }); | ||
| 710 | + } | ||
| 711 | + showDateSelWidget = false; | ||
| 712 | + }, | ||
| 713 | + dateTime: DateUtil.getDateTime(fromDate), | ||
| 714 | + pickerDateTimeType: PickerDateTimeType.kYMD, | ||
| 715 | + onCancel: () { | ||
| 716 | + showDateSelWidget = false; | ||
| 717 | + }); | ||
| 718 | + }), | ||
| 719 | + VEmptyView(24), | ||
| 720 | + _select('有效期至', endDate, () { | ||
| 721 | + FocusScope.of(context) | ||
| 722 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 723 | + //弹出时间选择器 | ||
| 724 | + // showPickerDateTime(context); | ||
| 725 | + showDateSelWidget = true; | ||
| 726 | + DialogUtil.showPickerDateTime24( | ||
| 727 | + context, | ||
| 728 | + scaffoldKey, | ||
| 729 | + (value) { | ||
| 730 | + // {'text': picker.adapter.text, 'select': selecteds} | ||
| 731 | + if (value != null) { | ||
| 732 | + setState(() { | ||
| 733 | + print(value); | ||
| 734 | + endDate = DateUtil.formatDateStr( | ||
| 735 | + value, | ||
| 736 | + format: DateFormats.y_mo_d); | ||
| 737 | + }); | ||
| 738 | + } | ||
| 739 | + showDateSelWidget = false; | ||
| 740 | + }, | ||
| 741 | + dateTime: DateUtil.getDateTime(endDate), | ||
| 742 | + pickerDateTimeType: PickerDateTimeType.kYMD, | ||
| 743 | + onCancel: () { | ||
| 744 | + showDateSelWidget = false; | ||
| 745 | + }); | ||
| 746 | + }) | ||
| 747 | + ], | ||
| 748 | + ) | ||
| 749 | + : SizedBox(), | ||
| 750 | + weekly | ||
| 751 | + ? _select(weekShow, '', () async { | ||
| 752 | + FocusScope.of(context) | ||
| 753 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 754 | + //弹出时间选择器 | ||
| 755 | + // showPickerDateTime(context); | ||
| 756 | + showDateSelWidget = false; | ||
| 757 | + | ||
| 758 | + List<FilterBtnModel> data = | ||
| 759 | + await DialogUtil.openWeekSelectModalBottomSheet( | ||
| 760 | + context, weekData); | ||
| 761 | + if (data != null) { | ||
| 762 | + //改变了 | ||
| 763 | + weekData = []; | ||
| 764 | + weekData.addAll(data); | ||
| 765 | + weekShow = ''; | ||
| 766 | + | ||
| 767 | + weekData.forEach((element) { | ||
| 768 | + if (element.select) { | ||
| 769 | + weekShow += '${element.title} '; | ||
| 770 | + } | ||
| 771 | + }); | ||
| 772 | + if (weekShow.endsWith(' ')) { | ||
| 773 | + weekShow = | ||
| 774 | + weekShow.substring(0, weekShow.length - 1); | ||
| 775 | + } | ||
| 776 | + if (weekShow == '') { | ||
| 777 | + weekShow = '点击设置可用日期'; | ||
| 778 | + } | ||
| 779 | + | ||
| 780 | + setState(() {}); | ||
| 781 | + } | ||
| 782 | + }) | ||
| 783 | + : SizedBox(), | ||
| 784 | + VEmptyView(24), | ||
| 785 | + MyDivider( | ||
| 786 | + double.infinity, | ||
| 787 | + w(1), | ||
| 788 | + color: MyColours.color_E7E7E7, | ||
| 789 | + ), | ||
| 790 | + VEmptyView(48), | ||
| 791 | + _explain('备注', '请输入备注信息', remarkC, remarkF), | ||
| 792 | + VEmptyView(72), | ||
| 793 | + _canUse('立即启用', canUse, () { | ||
| 794 | + setState(() { | ||
| 795 | + canUse = !canUse; | ||
| 796 | + }); | ||
| 797 | + }) | ||
| 798 | + ], | ||
| 799 | + )), | ||
| 800 | + )), | ||
| 801 | + Container( | ||
| 802 | + height: ScreenUtil().setWidth(91 * 2), | ||
| 803 | + width: double.infinity, | ||
| 804 | + padding: EdgeInsets.only( | ||
| 805 | + top: ScreenUtil().setWidth(16 * 2), | ||
| 806 | + bottom: ScreenUtil().setWidth(35 * 2), | ||
| 807 | + left: ScreenUtil().setWidth(45 * 2), | ||
| 808 | + right: ScreenUtil().setWidth(45 * 2), | ||
| 809 | + ), | ||
| 810 | + decoration: BoxDecoration( | ||
| 811 | + color: MyColours.color_ffffff, | ||
| 812 | + boxShadow: [ | ||
| 813 | + BoxShadow( | ||
| 814 | + spreadRadius: ScreenUtil().setWidth(2), | ||
| 815 | + color: Color.fromRGBO(0, 0, 0, 0.1), | ||
| 816 | + offset: Offset(0, ScreenUtil().setWidth(-2)), | ||
| 817 | + blurRadius: ScreenUtil().setWidth(8)) | ||
| 818 | + ], | ||
| 819 | + borderRadius: BorderRadius.all( | ||
| 820 | + Radius.circular(ScreenUtil().setWidth(16)), | ||
| 821 | + ), | ||
| 822 | + ), | ||
| 823 | + child: RoundButton( | ||
| 824 | + text: '保存', | ||
| 825 | + height: ScreenUtil().setWidth(80), | ||
| 826 | + radius: ScreenUtil().setWidth(14), | ||
| 827 | + isBold: false, | ||
| 828 | + fontSize: 28, | ||
| 829 | + onPressed: () async { | ||
| 830 | + // "stime": fromDate == '点击选择' | ||
| 831 | + // ? "" | ||
| 832 | + // : '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}', | ||
| 833 | + // "etime": endDate == '点击选择' | ||
| 834 | + // ? '' | ||
| 835 | + // : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}', | ||
| 836 | + // UserModel userModel = | ||
| 837 | + // Provider.of<UserModel>(context, listen: false); | ||
| 838 | + // if (userModel.user.role_name == '管理员' || | ||
| 839 | + // userModel.user.role_name == '店长') { | ||
| 840 | + // NavigatorUtil.goRechargeEditPage(context); | ||
| 841 | + // } else { | ||
| 842 | + // bool needRefresh = | ||
| 843 | + // await NavigatorUtil.goCouponEditPage(context); | ||
| 844 | + // print(needRefresh); | ||
| 845 | + // if (needRefresh != null && needRefresh) { | ||
| 846 | + // bus.emit('refresh_coupon_list_f'); | ||
| 847 | + // //刷新页面数据 | ||
| 848 | + // // _controller.callRefresh(); | ||
| 849 | + // // _couponNetworkData(tabController.index); | ||
| 850 | + // } | ||
| 851 | + // } | ||
| 852 | + }, | ||
| 853 | + ), | ||
| 854 | + ) | ||
| 855 | + ], | ||
| 856 | + ), | ||
| 857 | + ); | ||
| 858 | + } | ||
| 859 | +} |
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 3 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 4 | +import 'package:one_key/pages/my/marketing_center/recharge/recharge_item.dart'; | ||
| 5 | +import 'package:one_key/res/colors.dart'; | ||
| 6 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 7 | +import 'package:provider/provider.dart'; | ||
| 8 | + | ||
| 9 | +import '../../../../constant/state.dart'; | ||
| 10 | +import '../../../../provider/marketing_center_provider.dart'; | ||
| 11 | +import '../../../../route/navigator_util.dart'; | ||
| 12 | +import '../../../../utils/screen_util.dart'; | ||
| 13 | +import '../../../../widgets/page_exception.dart'; | ||
| 14 | +import '../../../../widgets/round_button.dart'; | ||
| 15 | +import '../../../../widgets/v_empty_view.dart'; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * | ||
| 19 | + * 充值优惠首页 | ||
| 20 | + */ | ||
| 21 | + | ||
| 22 | +class RechargeHomePage extends StatefulWidget { | ||
| 23 | + RechargeHomePage({Key key}) : super(key: key); | ||
| 24 | + | ||
| 25 | + @override | ||
| 26 | + _RechargeHomePageState createState() => _RechargeHomePageState(); | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +class _RechargeHomePageState extends State<RechargeHomePage> { | ||
| 30 | + MarketingCenterProvider marketingCenterProvider; | ||
| 31 | + EasyRefreshController _controller = EasyRefreshController(); | ||
| 32 | + @override | ||
| 33 | + Widget build(BuildContext context) { | ||
| 34 | + marketingCenterProvider = | ||
| 35 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 36 | + return Scaffold( | ||
| 37 | + backgroundColor: MyColours.color_f3f3f3, | ||
| 38 | + appBar: SystemAppBar( | ||
| 39 | + '充值优惠', | ||
| 40 | + ), | ||
| 41 | + body: Container( | ||
| 42 | + child: Column( | ||
| 43 | + children: [ | ||
| 44 | + Expanded(child: Container( | ||
| 45 | + child: Consumer<MarketingCenterProvider>( | ||
| 46 | + builder: (context, model, _) { | ||
| 47 | + if (model.pageStateRechargeHome != PageState.Success) { | ||
| 48 | + return ExceptionPage( | ||
| 49 | + pageState: model.pageStateRechargeHome, | ||
| 50 | + callback: () { | ||
| 51 | + // offset = 0; | ||
| 52 | + // getMessage(showLoading: true); | ||
| 53 | + | ||
| 54 | + if (model.pageStateRechargeHome == PageState.Empty) { | ||
| 55 | + // NavigatorUtil.goCouponHistoryPage(context); | ||
| 56 | + } else { | ||
| 57 | + // _couponNetworkData(widget.index); | ||
| 58 | + } | ||
| 59 | + }, | ||
| 60 | + emptyMsg: "暂时没有列表信息哦,", | ||
| 61 | + emptyImg: "empty_search", | ||
| 62 | + showMsg: "加载中,请稍后...", | ||
| 63 | + // showText: '查看过期优惠券', | ||
| 64 | + ); | ||
| 65 | + } else { | ||
| 66 | + return EasyRefresh.custom( | ||
| 67 | + controller: _controller, | ||
| 68 | + shrinkWrap: true, | ||
| 69 | + slivers: [ | ||
| 70 | + SliverList( | ||
| 71 | + delegate: SliverChildBuilderDelegate( | ||
| 72 | + (BuildContext context, int index) { | ||
| 73 | + return RechargeItem( | ||
| 74 | + from: 'quan', | ||
| 75 | + // couponSonModel: couponProvider.couponList[index], | ||
| 76 | + // showBtn: true, | ||
| 77 | + // onPressedSwich: () { | ||
| 78 | + // couponProvider.couponList[index].isOpenBool = | ||
| 79 | + // !couponProvider.couponList[index].isOpenBool; | ||
| 80 | + // _setCustomerActivity(index); | ||
| 81 | + // }, | ||
| 82 | + // onPressed: () { | ||
| 83 | + // NavigatorUtil.goCouponDetailPage( | ||
| 84 | + // context, couponProvider.couponList[index]); | ||
| 85 | + // }, | ||
| 86 | + ); | ||
| 87 | + }, childCount: 100), | ||
| 88 | + ), | ||
| 89 | + SliverList( | ||
| 90 | + delegate: SliverChildBuilderDelegate( | ||
| 91 | + (BuildContext context, int index) { | ||
| 92 | + return Column( | ||
| 93 | + children: [ | ||
| 94 | + InkWell( | ||
| 95 | + onTap: () { | ||
| 96 | + // NavigatorUtil.goCouponHistoryPage(context); | ||
| 97 | + }, | ||
| 98 | + child: RichText( | ||
| 99 | + text: TextSpan( | ||
| 100 | + style: TextStyle( | ||
| 101 | + fontSize: ScreenUtil().setSp(28), | ||
| 102 | + ), | ||
| 103 | + children: [ | ||
| 104 | + TextSpan( | ||
| 105 | + text: '没有更多了,', | ||
| 106 | + style: TextStyle( | ||
| 107 | + color: MyColours.color_000000)), | ||
| 108 | + TextSpan( | ||
| 109 | + text: '查看过期优惠券', | ||
| 110 | + style: TextStyle( | ||
| 111 | + color: MyColours.color_438E93)), | ||
| 112 | + ]))), | ||
| 113 | + VEmptyView(80) | ||
| 114 | + ], | ||
| 115 | + ); | ||
| 116 | + }, childCount: 1), | ||
| 117 | + ) | ||
| 118 | + ], | ||
| 119 | + // onRefresh: () async { | ||
| 120 | + // // offset = 0; | ||
| 121 | + // // getMessage(showLoading: false); | ||
| 122 | + // }, | ||
| 123 | + // onLoad: () async { | ||
| 124 | + // // offset++; | ||
| 125 | + // // getMessage(showLoading: false); | ||
| 126 | + // }, | ||
| 127 | + ); | ||
| 128 | + } | ||
| 129 | + }), | ||
| 130 | + )), | ||
| 131 | + Container( | ||
| 132 | + height: ScreenUtil().setWidth(91 * 2), | ||
| 133 | + width: double.infinity, | ||
| 134 | + padding: EdgeInsets.only( | ||
| 135 | + top: ScreenUtil().setWidth(16 * 2), | ||
| 136 | + bottom: ScreenUtil().setWidth(35 * 2), | ||
| 137 | + left: ScreenUtil().setWidth(45 * 2), | ||
| 138 | + right: ScreenUtil().setWidth(45 * 2), | ||
| 139 | + ), | ||
| 140 | + decoration: BoxDecoration( | ||
| 141 | + color: MyColours.color_ffffff, | ||
| 142 | + boxShadow: [ | ||
| 143 | + BoxShadow( | ||
| 144 | + spreadRadius: ScreenUtil().setWidth(2), | ||
| 145 | + color: Color.fromRGBO(0, 0, 0, 0.1), | ||
| 146 | + offset: Offset(0, ScreenUtil().setWidth(-2)), | ||
| 147 | + blurRadius: ScreenUtil().setWidth(8)) | ||
| 148 | + ], | ||
| 149 | + borderRadius: BorderRadius.all( | ||
| 150 | + Radius.circular(ScreenUtil().setWidth(16)), | ||
| 151 | + ), | ||
| 152 | + ), | ||
| 153 | + child: RoundButton( | ||
| 154 | + text: '新建优惠', | ||
| 155 | + height: ScreenUtil().setWidth(80), | ||
| 156 | + radius: ScreenUtil().setWidth(14), | ||
| 157 | + isBold: false, | ||
| 158 | + fontSize: 28, | ||
| 159 | + onPressed: () async { | ||
| 160 | + // UserModel userModel = | ||
| 161 | + // Provider.of<UserModel>(context, listen: false); | ||
| 162 | + // if (userModel.user.role_name == '管理员' || | ||
| 163 | + // userModel.user.role_name == '店长') { | ||
| 164 | + NavigatorUtil.goRechargeEditPage(context); | ||
| 165 | + // } else { | ||
| 166 | + // bool needRefresh = | ||
| 167 | + // await NavigatorUtil.goCouponEditPage(context); | ||
| 168 | + // print(needRefresh); | ||
| 169 | + // if (needRefresh != null && needRefresh) { | ||
| 170 | + // bus.emit('refresh_coupon_list_f'); | ||
| 171 | + // //刷新页面数据 | ||
| 172 | + // // _controller.callRefresh(); | ||
| 173 | + // // _couponNetworkData(tabController.index); | ||
| 174 | + // } | ||
| 175 | + // } | ||
| 176 | + }, | ||
| 177 | + ), | ||
| 178 | + ) | ||
| 179 | + ], | ||
| 180 | + ), | ||
| 181 | + ), | ||
| 182 | + ); | ||
| 183 | + } | ||
| 184 | +} |
| 1 | +import 'package:common_utils/common_utils.dart'; | ||
| 2 | +import 'package:flutter/material.dart'; | ||
| 3 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 4 | +import 'package:one_key/models/coupon_model.dart'; | ||
| 5 | +import 'package:one_key/provider/coupon_provider.dart'; | ||
| 6 | +import 'package:one_key/res/colors.dart'; | ||
| 7 | +import 'package:one_key/utils/utils.dart'; | ||
| 8 | +import 'package:one_key/widgets/dashed_line_widget.dart'; | ||
| 9 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 10 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 11 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 12 | + | ||
| 13 | +import '../../../../utils/screen_util.dart'; | ||
| 14 | + | ||
| 15 | +class RechargeItem extends StatefulWidget { | ||
| 16 | + final String from; | ||
| 17 | + final VoidCallback onPressed; | ||
| 18 | + final VoidCallback onPressedSwich; | ||
| 19 | + final CouponSunModel couponSonModel; | ||
| 20 | + final bool showBtn; | ||
| 21 | + final bool showCheck; | ||
| 22 | + RechargeItem( | ||
| 23 | + {Key key, | ||
| 24 | + this.from, | ||
| 25 | + this.onPressed, | ||
| 26 | + this.onPressedSwich, | ||
| 27 | + this.couponSonModel, | ||
| 28 | + this.showBtn = false, | ||
| 29 | + this.showCheck = false}) | ||
| 30 | + : super(key: key); | ||
| 31 | + | ||
| 32 | + @override | ||
| 33 | + _RechargeItemState createState() => _RechargeItemState(); | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +class _RechargeItemState extends State<RechargeItem> { | ||
| 37 | + // bool showText = false; | ||
| 38 | + @override | ||
| 39 | + Widget build(BuildContext context) { | ||
| 40 | + // CouponSunModel sunModel = widget.couponSonModel; | ||
| 41 | + bool notSelect = true; | ||
| 42 | + if (widget.from == 'history') { | ||
| 43 | + notSelect = false; | ||
| 44 | + } else { | ||
| 45 | + // notSelect = sunModel.isOpenBool; | ||
| 46 | + } | ||
| 47 | + // double explainH = 0.0; | ||
| 48 | + | ||
| 49 | + // if (ObjectUtil.isNotEmpty(sunModel.explain)) { | ||
| 50 | + // explainH = Utils.calculateTextHeight( | ||
| 51 | + // '说明:fdgdfgdgfgsdgsg', | ||
| 52 | + // ScreenUtil().setSp(20), | ||
| 53 | + // FontWeight.normal, | ||
| 54 | + // ScreenUtil().screenWidth - | ||
| 55 | + // ScreenUtil().setWidth(92 * 2) + | ||
| 56 | + // ScreenUtil().setWidth(20), | ||
| 57 | + // 5, | ||
| 58 | + // context); | ||
| 59 | + // } | ||
| 60 | + return InkWell( | ||
| 61 | + onTap: widget.onPressed, | ||
| 62 | + child: Container( | ||
| 63 | + // width: ScreenUtil().setWidth(610), | ||
| 64 | + margin: EdgeInsets.fromLTRB( | ||
| 65 | + ScreenUtil().setWidth(40), | ||
| 66 | + ScreenUtil().setWidth(30), | ||
| 67 | + ScreenUtil().setWidth(40), | ||
| 68 | + ScreenUtil().setWidth(0)), | ||
| 69 | + decoration: BoxDecoration( | ||
| 70 | + color: MyColours.color_ffffff, | ||
| 71 | + boxShadow: [ | ||
| 72 | + BoxShadow( | ||
| 73 | + spreadRadius: ScreenUtil().setWidth(2), | ||
| 74 | + color: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 75 | + offset: Offset(0, ScreenUtil().setWidth(8)), | ||
| 76 | + blurRadius: ScreenUtil().setWidth(8)) | ||
| 77 | + ], | ||
| 78 | + borderRadius: BorderRadius.all( | ||
| 79 | + Radius.circular(ScreenUtil().setWidth(16)), | ||
| 80 | + ), | ||
| 81 | + ), | ||
| 82 | + child: Column( | ||
| 83 | + mainAxisSize: MainAxisSize.min, | ||
| 84 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 85 | + children: [ | ||
| 86 | + Container( | ||
| 87 | + height: ScreenUtil().setWidth(60), | ||
| 88 | + padding: | ||
| 89 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)), | ||
| 90 | + decoration: BoxDecoration( | ||
| 91 | + color: widget.from == 'history' | ||
| 92 | + ? MyColours.color_BFC4D4 | ||
| 93 | + : notSelect | ||
| 94 | + ? true | ||
| 95 | + ? MyColours.color_438E93 | ||
| 96 | + : MyColours.color_ED7B2F | ||
| 97 | + : MyColours.color_999999, | ||
| 98 | + borderRadius: BorderRadius.only( | ||
| 99 | + topLeft: Radius.circular(ScreenUtil().setWidth(16)), | ||
| 100 | + topRight: Radius.circular(ScreenUtil().setWidth(16)))), | ||
| 101 | + child: Row( | ||
| 102 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 103 | + children: [ | ||
| 104 | + Text( | ||
| 105 | + '充500赠100', | ||
| 106 | + style: TextStyle( | ||
| 107 | + color: MyColours.color_ffffff, | ||
| 108 | + fontWeight: FontWeight.bold, | ||
| 109 | + fontSize: ScreenUtil().setSp(32)), | ||
| 110 | + ), | ||
| 111 | + InkWell( | ||
| 112 | + onTap: widget.onPressedSwich, | ||
| 113 | + child: Text('更新时间:2022-12-18', | ||
| 114 | + maxLines: 1, | ||
| 115 | + overflow: TextOverflow.ellipsis, | ||
| 116 | + style: TextStyle( | ||
| 117 | + color: MyColours.color_ffffff, | ||
| 118 | + fontSize: ScreenUtil().setSp(20))), | ||
| 119 | + ), | ||
| 120 | + ], | ||
| 121 | + ), | ||
| 122 | + ), | ||
| 123 | + Container( | ||
| 124 | + padding: EdgeInsets.fromLTRB( | ||
| 125 | + ScreenUtil().setWidth(20 * 2), | ||
| 126 | + ScreenUtil().setWidth(26), | ||
| 127 | + ScreenUtil().setWidth(40), | ||
| 128 | + ScreenUtil().setWidth(26)), | ||
| 129 | + child: Column( | ||
| 130 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 131 | + children: [ | ||
| 132 | + Container( | ||
| 133 | + // height: ScreenUtil().setWidth(14 * 2), | ||
| 134 | + // width: ScreenUtil().setWidth(232 * 2), | ||
| 135 | + child: Text('会员充值满1000元赠余额200元;', | ||
| 136 | + maxLines: 1, | ||
| 137 | + overflow: TextOverflow.ellipsis, | ||
| 138 | + style: TextStyle( | ||
| 139 | + color: MyColours.color_999999, | ||
| 140 | + fontSize: ScreenUtil().setSp(20), | ||
| 141 | + )), | ||
| 142 | + ), | ||
| 143 | + VEmptyView(10), | ||
| 144 | + Container( | ||
| 145 | + // height: ScreenUtil().setWidth(14 * 2), | ||
| 146 | + // width: ScreenUtil().setWidth(232 * 2), | ||
| 147 | + child: Text('会员充值满1000元赠送50元代金券;', | ||
| 148 | + maxLines: 1, | ||
| 149 | + overflow: TextOverflow.ellipsis, | ||
| 150 | + style: TextStyle( | ||
| 151 | + color: MyColours.color_999999, | ||
| 152 | + fontSize: ScreenUtil().setSp(20), | ||
| 153 | + )), | ||
| 154 | + ), | ||
| 155 | + VEmptyView(10), | ||
| 156 | + Container( | ||
| 157 | + // height: ScreenUtil().setWidth(14 * 2), | ||
| 158 | + // width: ScreenUtil().setWidth(232 * 2), | ||
| 159 | + child: Text('会员充值满1000元赠送50元菜品券。', | ||
| 160 | + maxLines: 1, | ||
| 161 | + overflow: TextOverflow.ellipsis, | ||
| 162 | + style: TextStyle( | ||
| 163 | + color: MyColours.color_999999, | ||
| 164 | + fontSize: ScreenUtil().setSp(20), | ||
| 165 | + )), | ||
| 166 | + ), | ||
| 167 | + ], | ||
| 168 | + ), | ||
| 169 | + | ||
| 170 | + // widget.from == 'select' | ||
| 171 | + // ? widget.showCheck | ||
| 172 | + // ? Positioned( | ||
| 173 | + // right: 0, | ||
| 174 | + // top: ScreenUtil().setWidth(20), | ||
| 175 | + // child: Image.asset( | ||
| 176 | + // Utils.getImgPath(widget.couponSonModel.isCheck | ||
| 177 | + // ? 'check_r' | ||
| 178 | + // : 'check_un'), | ||
| 179 | + // width: ScreenUtil().setWidth(40), | ||
| 180 | + // height: ScreenUtil().setWidth(40), | ||
| 181 | + // )) | ||
| 182 | + // : Container() | ||
| 183 | + // : | ||
| 184 | + ), | ||
| 185 | + MySeparator(width: w(4), color: MyColours.color_BFC4D4), | ||
| 186 | + VEmptyView(15), | ||
| 187 | + Row( | ||
| 188 | + mainAxisAlignment: MainAxisAlignment.end, | ||
| 189 | + children: [ | ||
| 190 | + RoundButton( | ||
| 191 | + width: widget.from == 'history' | ||
| 192 | + ? ScreenUtil().setWidth(50 * 2) | ||
| 193 | + : ScreenUtil().setWidth(50 * 2), | ||
| 194 | + height: ScreenUtil().setWidth(20 * 2), | ||
| 195 | + radius: ScreenUtil().setWidth(10), | ||
| 196 | + text: '删除', | ||
| 197 | + fontSize: 24, | ||
| 198 | + textColor: MyColours.color_E34D59, | ||
| 199 | + gradientStart: MyColours.color_ffffff, | ||
| 200 | + gradientEnd: MyColours.color_ffffff, | ||
| 201 | + borderColor: MyColours.color_E34D59, | ||
| 202 | + onPressed: widget.onPressedSwich, | ||
| 203 | + ), | ||
| 204 | + HEmptyView(34), | ||
| 205 | + RoundButton( | ||
| 206 | + width: ScreenUtil().setWidth(50 * 2), | ||
| 207 | + height: ScreenUtil().setWidth(20 * 2), | ||
| 208 | + radius: ScreenUtil().setWidth(10), | ||
| 209 | + text: '禁用', | ||
| 210 | + | ||
| 211 | + ///启用 | ||
| 212 | + fontSize: 24, | ||
| 213 | + textColor: MyColours.color_438E93, | ||
| 214 | + gradientStart: MyColours.color_ffffff, | ||
| 215 | + gradientEnd: MyColours.color_ffffff, | ||
| 216 | + borderColor: MyColours.color_438E93, | ||
| 217 | + onPressed: widget.onPressedSwich, | ||
| 218 | + ), | ||
| 219 | + HEmptyView(38), | ||
| 220 | + ], | ||
| 221 | + ), | ||
| 222 | + VEmptyView(15) | ||
| 223 | + ], | ||
| 224 | + ), | ||
| 225 | + )); | ||
| 226 | + } | ||
| 227 | +} |
| 1 | +import 'dart:io'; | ||
| 2 | + | ||
| 3 | +import 'package:flutter/material.dart'; | ||
| 4 | +import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 5 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 6 | +import 'package:one_key/constant/state.dart'; | ||
| 7 | +import 'package:one_key/pages/coupon/coupon_item.dart'; | ||
| 8 | +import 'package:one_key/provider/SmsModel.dart'; | ||
| 9 | +import 'package:one_key/provider/coupon_provider.dart'; | ||
| 10 | +import 'package:one_key/provider/user_model.dart'; | ||
| 11 | +import 'package:one_key/res/colors.dart'; | ||
| 12 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 13 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 14 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 15 | +import 'package:one_key/utils/utils.dart'; | ||
| 16 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 17 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 18 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 19 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 20 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 21 | +import 'package:provider/provider.dart'; | ||
| 22 | +import 'package:sendsms/sendsms.dart'; | ||
| 23 | +// import 'package:sendsms/sendsms.dart'; | ||
| 24 | +import 'package:flutter_sms/flutter_sms.dart'; | ||
| 25 | + | ||
| 26 | +import '../../../../utils/screen_util.dart'; | ||
| 27 | +import '../../../coupon/coupon_item_f.dart'; | ||
| 28 | + | ||
| 29 | +class RechargeSelectStoreCouponPage extends StatefulWidget { | ||
| 30 | + final String from; | ||
| 31 | + final List<String> selectList; | ||
| 32 | + RechargeSelectStoreCouponPage({Key key, this.from, this.selectList}) | ||
| 33 | + : super(key: key); | ||
| 34 | + | ||
| 35 | + @override | ||
| 36 | + _RechargeSelectStoreCouponPageState createState() => | ||
| 37 | + _RechargeSelectStoreCouponPageState(); | ||
| 38 | +} | ||
| 39 | + | ||
| 40 | +class _RechargeSelectStoreCouponPageState | ||
| 41 | + extends State<RechargeSelectStoreCouponPage> { | ||
| 42 | + EasyRefreshController _controller = EasyRefreshController(); | ||
| 43 | + CouponProvider couponProvider; | ||
| 44 | + | ||
| 45 | + ///获取优惠券列表数据(status == 1) | ||
| 46 | + | ||
| 47 | + _couponNetworkData({bool isShowLoading = true}) async { | ||
| 48 | + Map<String, String> params = { | ||
| 49 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 50 | + }; | ||
| 51 | + // if (!widget.hasModify) { | ||
| 52 | + params['status'] = '1'; | ||
| 53 | + // } | ||
| 54 | + await couponProvider.getRechargeSelectActivity(context, params, | ||
| 55 | + isShowLoading: isShowLoading); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @override | ||
| 59 | + void initState() { | ||
| 60 | + // TODO: implement initState | ||
| 61 | + super.initState(); | ||
| 62 | + | ||
| 63 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 64 | + // if (!couponProvider.hasModify) { | ||
| 65 | + couponProvider.coupons = widget.selectList; | ||
| 66 | + _couponNetworkData(); | ||
| 67 | + // } else { | ||
| 68 | + // couponProvider.pageStateSelect = PageState.Success; | ||
| 69 | + // // couponProvider.notifyListeners(); | ||
| 70 | + // } | ||
| 71 | + }); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @override | ||
| 75 | + void dispose() { | ||
| 76 | + super.dispose(); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @override | ||
| 80 | + Widget build(BuildContext context) { | ||
| 81 | + couponProvider = Provider.of<CouponProvider>(context, listen: true); | ||
| 82 | + return Scaffold( | ||
| 83 | + backgroundColor: MyColours.color_ffffff, | ||
| 84 | + appBar: SystemAppBar('选择优惠券'), | ||
| 85 | + // appBar: AppBar( | ||
| 86 | + // backgroundColor: Colors.transparent, | ||
| 87 | + // elevation: 0, | ||
| 88 | + // leading: InkWell( | ||
| 89 | + // onTap: () { | ||
| 90 | + // Navigator.pop(context); | ||
| 91 | + // Utils.changeStatusColor(color: Colors.transparent); | ||
| 92 | + // }, | ||
| 93 | + // child: Padding( | ||
| 94 | + // padding: EdgeInsets.symmetric( | ||
| 95 | + // horizontal: ScreenUtil().setWidth(40), | ||
| 96 | + // vertical: ScreenUtil().setWidth(15)), | ||
| 97 | + // child: Row( | ||
| 98 | + // children: <Widget>[ | ||
| 99 | + // Image.asset( | ||
| 100 | + // "assets/icon_back.png", | ||
| 101 | + // width: ScreenUtil().setWidth(20), | ||
| 102 | + // height: ScreenUtil().setWidth(31), | ||
| 103 | + // ) | ||
| 104 | + // ], | ||
| 105 | + // )), | ||
| 106 | + // ), | ||
| 107 | + // title: Text( | ||
| 108 | + // '优惠券', | ||
| 109 | + // style: TextStyle( | ||
| 110 | + // color: MyColours.color_353535, | ||
| 111 | + // fontSize: ScreenUtil().setSp(34), | ||
| 112 | + // decoration: TextDecoration.none), | ||
| 113 | + // ), | ||
| 114 | + // actions: <Widget>[ | ||
| 115 | + // couponProvider.pageStateSelect == PageState.Success | ||
| 116 | + // ? InkWell( | ||
| 117 | + // onTap: () { | ||
| 118 | + // if (couponProvider.checkValue) { | ||
| 119 | + // couponProvider.cancelAll(); | ||
| 120 | + // } else { | ||
| 121 | + // couponProvider.addAll(); | ||
| 122 | + // } | ||
| 123 | + // }, | ||
| 124 | + // child: Padding( | ||
| 125 | + // padding: | ||
| 126 | + // EdgeInsets.only(right: ScreenUtil().setWidth(40)), | ||
| 127 | + // child: Row(children: [ | ||
| 128 | + // Container( | ||
| 129 | + // // color: Colors.red, | ||
| 130 | + // alignment: Alignment.center, | ||
| 131 | + // child: Text( | ||
| 132 | + // '全选', | ||
| 133 | + // style: TextStyle( | ||
| 134 | + // color: MyColours.color_199095, | ||
| 135 | + // fontSize: ScreenUtil().setSp(34)), | ||
| 136 | + // )), | ||
| 137 | + // HEmptyView(20), | ||
| 138 | + // Image.asset( | ||
| 139 | + // Utils.getImgPath(couponProvider.checkValue | ||
| 140 | + // ? 'check_g' | ||
| 141 | + // : 'check_un'), | ||
| 142 | + // width: ScreenUtil().setWidth(40)) | ||
| 143 | + // ]))) | ||
| 144 | + // : Container() | ||
| 145 | + // ], | ||
| 146 | + // centerTitle: true, // 标题居中 | ||
| 147 | + // ), | ||
| 148 | + body: WillPopScope( | ||
| 149 | + child: Column( | ||
| 150 | + children: [ | ||
| 151 | + Expanded(child: Consumer<CouponProvider>( | ||
| 152 | + builder: (context, model, _) { | ||
| 153 | + if (model.pageStateSelect != PageState.Success) { | ||
| 154 | + return ExceptionPage( | ||
| 155 | + pageState: model.pageStateSelect, | ||
| 156 | + callback: () { | ||
| 157 | + _couponNetworkData(); | ||
| 158 | + // offset = 0; | ||
| 159 | + // getMessage(showLoading: true); | ||
| 160 | + }, | ||
| 161 | + emptyMsg: "暂时没有列表信息哦", | ||
| 162 | + emptyImg: "empty_search", | ||
| 163 | + showMsg: "加载中,请稍后...", | ||
| 164 | + ); | ||
| 165 | + } else { | ||
| 166 | + return EasyRefresh.custom( | ||
| 167 | + controller: _controller, | ||
| 168 | + shrinkWrap: true, | ||
| 169 | + slivers: [ | ||
| 170 | + SliverList( | ||
| 171 | + delegate: SliverChildBuilderDelegate( | ||
| 172 | + (BuildContext context, int index) { | ||
| 173 | + return VEmptyView(40); | ||
| 174 | + }, childCount: 1), | ||
| 175 | + ), | ||
| 176 | + SliverList( | ||
| 177 | + delegate: SliverChildBuilderDelegate( | ||
| 178 | + (BuildContext context, int index) { | ||
| 179 | + return InkWell( | ||
| 180 | + onTap: () { | ||
| 181 | + couponProvider.couponListSelect[index].isCheck = | ||
| 182 | + !couponProvider | ||
| 183 | + .couponListSelect[index].isCheck; | ||
| 184 | + if (couponProvider | ||
| 185 | + .couponListSelect[index].isCheck) { | ||
| 186 | + couponProvider.addData(index); | ||
| 187 | + } else { | ||
| 188 | + couponProvider.cancelData(index); | ||
| 189 | + } | ||
| 190 | + couponProvider.getCheckValue(); | ||
| 191 | + }, | ||
| 192 | + // child: Row( | ||
| 193 | + // children: [ | ||
| 194 | + // HEmptyView(30), | ||
| 195 | + // !widget.hasModify | ||
| 196 | + // ? Checkbox( | ||
| 197 | + // value: couponProvider | ||
| 198 | + // .couponListSelect[index].isCheck, | ||
| 199 | + // checkColor: MyColours.color_ffffff, | ||
| 200 | + // activeColor: MyColours.app_main, | ||
| 201 | + // onChanged: (bool value) {}, | ||
| 202 | + // ) | ||
| 203 | + // : Container(), | ||
| 204 | + // Image.asset( | ||
| 205 | + // couponProvider.listData[index]['checked'] | ||
| 206 | + // ? 'assets/select.png' | ||
| 207 | + // : 'assets/unselect.png', | ||
| 208 | + // width: ScreenUtil().setWidth(44)), | ||
| 209 | + child: CouponItemF( | ||
| 210 | + from: 'select', | ||
| 211 | + showCheck: true, | ||
| 212 | + couponSonModel: | ||
| 213 | + couponProvider.couponListSelect[index], | ||
| 214 | + onPressed: () { | ||
| 215 | + //改这里 ******8 | ||
| 216 | + if (true) { | ||
| 217 | + couponProvider | ||
| 218 | + .couponListSelect[index].isCheck = | ||
| 219 | + !couponProvider | ||
| 220 | + .couponListSelect[index].isCheck; | ||
| 221 | + if (couponProvider | ||
| 222 | + .couponListSelect[index].isCheck) { | ||
| 223 | + couponProvider.addData(index); | ||
| 224 | + } else { | ||
| 225 | + couponProvider.cancelData(index); | ||
| 226 | + } | ||
| 227 | + couponProvider.getCheckValue(); | ||
| 228 | + } | ||
| 229 | + })); | ||
| 230 | + }, childCount: couponProvider.couponListSelect.length), | ||
| 231 | + ) | ||
| 232 | + ], | ||
| 233 | + // onRefresh: () async { | ||
| 234 | + // // offset = 0; | ||
| 235 | + // // getMessage(showLoading: false); | ||
| 236 | + // }, | ||
| 237 | + // onLoad: () async { | ||
| 238 | + // // offset++; | ||
| 239 | + // // getMessage(showLoading: false); | ||
| 240 | + // }, | ||
| 241 | + ); | ||
| 242 | + } | ||
| 243 | + }, | ||
| 244 | + )), | ||
| 245 | + couponProvider.pageStateSelect == PageState.Success | ||
| 246 | + ? Text( | ||
| 247 | + '注:充值优惠选择的优惠券,全部来自店铺核销券', | ||
| 248 | + style: TextStyle( | ||
| 249 | + color: MyColours.color_999999, fontSize: font(12)), | ||
| 250 | + ) | ||
| 251 | + : SizedBox(), | ||
| 252 | + VEmptyView(20), | ||
| 253 | + couponProvider.pageStateSelect == PageState.Success | ||
| 254 | + ? Padding( | ||
| 255 | + padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0, | ||
| 256 | + ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), | ||
| 257 | + child: Row( | ||
| 258 | + children: [ | ||
| 259 | + InkWell( | ||
| 260 | + onTap: () { | ||
| 261 | + if (couponProvider.checkValue) { | ||
| 262 | + couponProvider.cancelAll(); | ||
| 263 | + } else { | ||
| 264 | + couponProvider.addAll(); | ||
| 265 | + } | ||
| 266 | + }, | ||
| 267 | + child: Row( | ||
| 268 | + children: [ | ||
| 269 | + Image.asset( | ||
| 270 | + Utils.getImgPath(couponProvider.checkValue | ||
| 271 | + ? 'c_mul_select' | ||
| 272 | + : 'c_mul_select_un'), | ||
| 273 | + width: ScreenUtil().setWidth(40)), | ||
| 274 | + HEmptyView(4), | ||
| 275 | + Container( | ||
| 276 | + // color: Colors.red, | ||
| 277 | + alignment: Alignment.center, | ||
| 278 | + child: Text( | ||
| 279 | + '全选', | ||
| 280 | + style: TextStyle( | ||
| 281 | + color: MyColours.color_515151, | ||
| 282 | + // fontWeight: FontWeight.bold, | ||
| 283 | + fontSize: ScreenUtil().setSp(32)), | ||
| 284 | + )) | ||
| 285 | + ], | ||
| 286 | + )), | ||
| 287 | + HEmptyView(20), | ||
| 288 | + Expanded( | ||
| 289 | + child: RoundButton( | ||
| 290 | + onPressed: () async { | ||
| 291 | + if (widget.from == 'statistics') { | ||
| 292 | + /*** 发版注释 | ||
| 293 | + DialogUtil.cupertinoAlertDialog(context, | ||
| 294 | + title: '确认发送', | ||
| 295 | + content: '是否确定为当前所选顾客发送该优惠券', lCallback: () { | ||
| 296 | + print('取消发送'); | ||
| 297 | + }, rCallback: () async { | ||
| 298 | + if (Platform.isIOS) { | ||
| 299 | + List<String> phoneNumber = [ | ||
| 300 | + '18161963378', | ||
| 301 | + '18729572142', | ||
| 302 | + '18765432345' | ||
| 303 | + ]; | ||
| 304 | + String message = "test"; | ||
| 305 | + try { | ||
| 306 | + String _result = await sendSMS( | ||
| 307 | + message: message, recipients: phoneNumber); | ||
| 308 | + print(_result); | ||
| 309 | + } catch (error) { | ||
| 310 | + print(error.toString()); | ||
| 311 | + } | ||
| 312 | + } else { | ||
| 313 | + print('确定发送'); | ||
| 314 | + String phoneNumber = "18161963378;18729572142"; | ||
| 315 | + String message = "test"; | ||
| 316 | + | ||
| 317 | + // await Sendsms.onGetPermission(); | ||
| 318 | + | ||
| 319 | + // if (await Sendsms.hasPermission()) { | ||
| 320 | + await Sendsms.onSendSMS(phoneNumber, message); | ||
| 321 | + } | ||
| 322 | + | ||
| 323 | + // } | ||
| 324 | + // SmsModel smsModel = new SmsModel(); | ||
| 325 | + // // String sms = await smsModel.getSmsContent(context, params); | ||
| 326 | + // String phoneNumber = ""; | ||
| 327 | + // await Sendsms.onSendSMS(phoneNumber, '短信内容'); | ||
| 328 | + }); | ||
| 329 | + */ | ||
| 330 | + } else { | ||
| 331 | + Map temp = { | ||
| 332 | + 'couponsid': couponProvider.coupons, | ||
| 333 | + 'couponsdata': couponProvider.couponListSelect | ||
| 334 | + }; | ||
| 335 | + Navigator.pop(context, temp); | ||
| 336 | + } | ||
| 337 | + }, | ||
| 338 | + text: '确认选择${couponProvider.coupons.length}个优惠券', | ||
| 339 | + fontSize: 34, | ||
| 340 | + isBold: false, | ||
| 341 | + height: ScreenUtil().setWidth(80), | ||
| 342 | + // width: double.infinity, | ||
| 343 | + radius: ScreenUtil().setWidth(10), | ||
| 344 | + )) | ||
| 345 | + ], | ||
| 346 | + )) | ||
| 347 | + : Container() | ||
| 348 | + ], | ||
| 349 | + ), | ||
| 350 | + onWillPop: () async { | ||
| 351 | + Utils.changeStatusColor(color: Colors.transparent); | ||
| 352 | + Navigator.of(context).pop(); | ||
| 353 | + return true; | ||
| 354 | + }, | ||
| 355 | + ), | ||
| 356 | + ); | ||
| 357 | + } | ||
| 358 | +} |
| @@ -394,6 +394,74 @@ class CouponProvider with ChangeNotifier { | @@ -394,6 +394,74 @@ class CouponProvider with ChangeNotifier { | ||
| 394 | } | 394 | } |
| 395 | 395 | ||
| 396 | ///客户经理获取所创建活动列表(选择优惠券) | 396 | ///客户经理获取所创建活动列表(选择优惠券) |
| 397 | + Future<List<CouponSunModel>> getRechargeSelectActivity( | ||
| 398 | + BuildContext context, Map<String, String> params, | ||
| 399 | + {isShowLoading = true}) async { | ||
| 400 | + if (isShowLoading) { | ||
| 401 | + pageStateSelect = PageState.Loading; | ||
| 402 | + notifyListeners(); | ||
| 403 | + } | ||
| 404 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 405 | + .request<dynamic>(context, Method.get, HttpUrl.get_customer_activity, | ||
| 406 | + data: params, showLoading: false) | ||
| 407 | + .catchError((error) { | ||
| 408 | + print(error.toString()); | ||
| 409 | + if (error is MyError) { | ||
| 410 | + switch (error.type) { | ||
| 411 | + case 1: | ||
| 412 | + pageStateSelect = PageState.ConnectivityError; | ||
| 413 | + break; | ||
| 414 | + case 2: | ||
| 415 | + pageStateSelect = PageState.ConnectivityTimeOut; | ||
| 416 | + break; | ||
| 417 | + default: | ||
| 418 | + pageStateSelect = PageState.ConnectivityError; | ||
| 419 | + break; | ||
| 420 | + } | ||
| 421 | + } | ||
| 422 | + notifyListeners(); | ||
| 423 | + }); | ||
| 424 | + if (baseResp.code == Constant.status_success) { | ||
| 425 | + if (baseResp.data.isEmpty) { | ||
| 426 | + pageStateSelect = PageState.Empty; | ||
| 427 | + } else { | ||
| 428 | + pageStateSelect = PageState.Success; | ||
| 429 | + } | ||
| 430 | + couponListSelect = CouponModel.fromJson(baseResp.responseData).data; | ||
| 431 | + // if (hasModify) { | ||
| 432 | + // //已经绑定 | ||
| 433 | + List<CouponSunModel> temp = []; | ||
| 434 | + for (int i = 0; i < couponListSelect.length; i++) { | ||
| 435 | + if (couponListSelect[i].isType == '1' && | ||
| 436 | + couponListSelect[i].isExamine == '1' && | ||
| 437 | + couponListSelect[i].status == '1') { | ||
| 438 | + //istype == 1 店铺券 isExamine == '1 可核销券 | ||
| 439 | + temp.add(couponListSelect[i]); | ||
| 440 | + } | ||
| 441 | + } | ||
| 442 | + couponListSelect = temp; | ||
| 443 | + // } else { | ||
| 444 | + for (int i = 0; i < couponListSelect.length; i++) { | ||
| 445 | + for (int j = 0; j < coupons.length; j++) { | ||
| 446 | + if (couponListSelect[i].id == coupons[j]) { | ||
| 447 | + couponListSelect[i].isCheck = true; | ||
| 448 | + } | ||
| 449 | + } | ||
| 450 | + } | ||
| 451 | + // } | ||
| 452 | + | ||
| 453 | + getCheckValue(); | ||
| 454 | + notifyListeners(); | ||
| 455 | + } else { | ||
| 456 | + pageStateSelect = PageState.ConnectivityError; | ||
| 457 | + if (baseResp != null) { | ||
| 458 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 459 | + } | ||
| 460 | + } | ||
| 461 | + return couponListSelect; | ||
| 462 | + } | ||
| 463 | + | ||
| 464 | + ///客户经理获取所创建活动列表(选择优惠券) | ||
| 397 | Future<List<CouponSunModel>> getCustomerSelectActivity( | 465 | Future<List<CouponSunModel>> getCustomerSelectActivity( |
| 398 | BuildContext context, Map<String, String> params, | 466 | BuildContext context, Map<String, String> params, |
| 399 | {isShowLoading = true}) async { | 467 | {isShowLoading = true}) async { |
| @@ -17,6 +17,7 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -17,6 +17,7 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 17 | MarkDataModel markDataModel; | 17 | MarkDataModel markDataModel; |
| 18 | 18 | ||
| 19 | PageState pageState = PageState.Loading; | 19 | PageState pageState = PageState.Loading; |
| 20 | + PageState pageStateRechargeHome = PageState.Success; | ||
| 20 | 21 | ||
| 21 | //获取桌位列表 | 22 | //获取桌位列表 |
| 22 | getTableList(context, {needLoading = true}) async { | 23 | getTableList(context, {needLoading = true}) async { |
| @@ -1542,4 +1542,33 @@ class NavigatorUtil { | @@ -1542,4 +1542,33 @@ class NavigatorUtil { | ||
| 1542 | "${Routes.out_store_record_detail_page}?detail=${FluroConvertUtils.object2string(outWineRecordSunModel)}", | 1542 | "${Routes.out_store_record_detail_page}?detail=${FluroConvertUtils.object2string(outWineRecordSunModel)}", |
| 1543 | replace: replace); | 1543 | replace: replace); |
| 1544 | } | 1544 | } |
| 1545 | + | ||
| 1546 | + ///充值优惠 | ||
| 1547 | + static Future<dynamic> goRechargeHomePage( | ||
| 1548 | + BuildContext context, { | ||
| 1549 | + replace = false, | ||
| 1550 | + }) { | ||
| 1551 | + return _navigateTo(context, "${Routes.recharge_home_page}", | ||
| 1552 | + replace: replace); | ||
| 1553 | + } | ||
| 1554 | + | ||
| 1555 | + ///充值优惠详情编辑页 | ||
| 1556 | + static Future<dynamic> goRechargeEditPage( | ||
| 1557 | + BuildContext context, { | ||
| 1558 | + replace = false, | ||
| 1559 | + }) { | ||
| 1560 | + return _navigateTo(context, "${Routes.recharge_edit_page}", | ||
| 1561 | + replace: replace); | ||
| 1562 | + } | ||
| 1563 | + | ||
| 1564 | + ///充值优惠选择店铺可核销优惠券 | ||
| 1565 | + static Future<dynamic> goRechargeSelectStoreCouponPage( | ||
| 1566 | + BuildContext context, | ||
| 1567 | + String selectIDs, { | ||
| 1568 | + replace = false, | ||
| 1569 | + }) { | ||
| 1570 | + return _navigateTo(context, | ||
| 1571 | + "${Routes.recharge_select_store_coupon_page}?selectIDs=$selectIDs", | ||
| 1572 | + replace: replace); | ||
| 1573 | + } | ||
| 1545 | } | 1574 | } |
| @@ -189,6 +189,9 @@ import '../pages/my/marketing_center/book_notification/marking_coupon_select_pag | @@ -189,6 +189,9 @@ import '../pages/my/marketing_center/book_notification/marking_coupon_select_pag | ||
| 189 | import '../pages/my/marketing_center/book_notification/marking_preview_page.dart'; | 189 | import '../pages/my/marketing_center/book_notification/marking_preview_page.dart'; |
| 190 | import '../pages/my/marketing_center/book_notification/store_introduce_page.dart'; | 190 | import '../pages/my/marketing_center/book_notification/store_introduce_page.dart'; |
| 191 | import '../pages/my/marketing_center/marketing_center_home_page.dart'; | 191 | import '../pages/my/marketing_center/marketing_center_home_page.dart'; |
| 192 | +import '../pages/my/marketing_center/recharge/recharge_edit_page.dart'; | ||
| 193 | +import '../pages/my/marketing_center/recharge/recharge_home_page.dart'; | ||
| 194 | +import '../pages/my/marketing_center/recharge/recharge_select_store_coupon_page.dart'; | ||
| 192 | import '../pages/my/plan_dish/final_plan_dish_page.dart'; | 195 | import '../pages/my/plan_dish/final_plan_dish_page.dart'; |
| 193 | import '../pages/my/plan_dish/my_plan_dish_home_page.dart'; | 196 | import '../pages/my/plan_dish/my_plan_dish_home_page.dart'; |
| 194 | import '../pages/my/plan_dish/plan_dish_create_select_type_page.dart'; | 197 | import '../pages/my/plan_dish/plan_dish_create_select_type_page.dart'; |
| @@ -2482,3 +2485,44 @@ var outStoreRecordDetailPageHandle = new Handler( | @@ -2482,3 +2485,44 @@ var outStoreRecordDetailPageHandle = new Handler( | ||
| 2482 | child: OutStoreRecordDetailPage( | 2485 | child: OutStoreRecordDetailPage( |
| 2483 | outWineRecordSunModel: outWineRecordSunModel)); | 2486 | outWineRecordSunModel: outWineRecordSunModel)); |
| 2484 | }); | 2487 | }); |
| 2488 | + | ||
| 2489 | +///充值优惠-首页 | ||
| 2490 | +var rechargeHomePageHandle = new Handler( | ||
| 2491 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 2492 | + // OutWineRecordSunModel outWineRecordSunModel = OutWineRecordSunModel.fromJson( | ||
| 2493 | + // json.decode( | ||
| 2494 | + // FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | ||
| 2495 | + | ||
| 2496 | + return ChangeNotifierProvider<MarketingCenterProvider>( | ||
| 2497 | + create: (_) => MarketingCenterProvider(), child: RechargeHomePage()); | ||
| 2498 | +}); | ||
| 2499 | + | ||
| 2500 | +///充值优惠详情编辑 | ||
| 2501 | +var rechargeEditPageHandle = new Handler( | ||
| 2502 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 2503 | + // OutWineRecordSunModel outWineRecordSunModel = OutWineRecordSunModel.fromJson( | ||
| 2504 | + // json.decode( | ||
| 2505 | + // FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | ||
| 2506 | + | ||
| 2507 | + return ChangeNotifierProvider<MarketingCenterProvider>( | ||
| 2508 | + create: (_) => MarketingCenterProvider(), child: RechargeEditPage()); | ||
| 2509 | +}); | ||
| 2510 | + | ||
| 2511 | +///充值优惠选择店铺可核销优惠券 | ||
| 2512 | +var rechargeSelectStoreCouponPageHandle = new Handler( | ||
| 2513 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 2514 | + // OutWineRecordSunModel outWineRecordSunModel = OutWineRecordSunModel.fromJson( | ||
| 2515 | + // json.decode( | ||
| 2516 | + // FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | ||
| 2517 | + | ||
| 2518 | + String selectIDs = params["selectIDs"].first; | ||
| 2519 | + List<String> selectList = []; | ||
| 2520 | + if (selectIDs.length > 0) { | ||
| 2521 | + selectList = selectIDs.split(','); | ||
| 2522 | + } | ||
| 2523 | + return ChangeNotifierProvider<MarketingCenterProvider>( | ||
| 2524 | + create: (_) => MarketingCenterProvider(), | ||
| 2525 | + child: ChangeNotifierProvider<CouponProvider>( | ||
| 2526 | + create: (_) => CouponProvider(), | ||
| 2527 | + child: RechargeSelectStoreCouponPage(selectList: selectList))); | ||
| 2528 | +}); |
| @@ -222,6 +222,14 @@ class Routes { | @@ -222,6 +222,14 @@ class Routes { | ||
| 222 | static String out_store_record_detail_page = | 222 | static String out_store_record_detail_page = |
| 223 | "/out_store_record_detail_page"; //出库记录列表详情,一层循环 | 223 | "/out_store_record_detail_page"; //出库记录列表详情,一层循环 |
| 224 | 224 | ||
| 225 | +/** 充值优惠 | ||
| 226 | + */ | ||
| 227 | + | ||
| 228 | + static String recharge_home_page = "/recharge_home_page"; //充值优惠首页 | ||
| 229 | + static String recharge_edit_page = "/recharge_edit_page"; //充值优惠详情编辑页 | ||
| 230 | + static String recharge_select_store_coupon_page = | ||
| 231 | + "/recharge_select_store_coupon_page"; //充值优惠选择店铺可核销优惠券 | ||
| 232 | + | ||
| 225 | static void configureRoutes(FluroRouter router) { | 233 | static void configureRoutes(FluroRouter router) { |
| 226 | router.notFoundHandler = new Handler( | 234 | router.notFoundHandler = new Handler( |
| 227 | handlerFunc: (BuildContext context, Map<String, List<String>> params) { | 235 | handlerFunc: (BuildContext context, Map<String, List<String>> params) { |
| @@ -429,5 +437,11 @@ class Routes { | @@ -429,5 +437,11 @@ class Routes { | ||
| 429 | 437 | ||
| 430 | router.define(out_store_record_detail_page, | 438 | router.define(out_store_record_detail_page, |
| 431 | handler: outStoreRecordDetailPageHandle); | 439 | handler: outStoreRecordDetailPageHandle); |
| 440 | + router.define(recharge_home_page, handler: rechargeHomePageHandle); | ||
| 441 | + | ||
| 442 | + router.define(recharge_edit_page, handler: rechargeEditPageHandle); | ||
| 443 | + | ||
| 444 | + router.define(recharge_select_store_coupon_page, | ||
| 445 | + handler: rechargeSelectStoreCouponPageHandle); | ||
| 432 | } | 446 | } |
| 433 | } | 447 | } |
| @@ -280,6 +280,121 @@ class DialogUtil { | @@ -280,6 +280,121 @@ class DialogUtil { | ||
| 280 | }); | 280 | }); |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | + ///优惠每周选择 | ||
| 284 | + static openWeekSelectModalBottomSheet(context, List<FilterBtnModel> weekData, | ||
| 285 | + {VoidCallback lCallback, VoidCallback rCallback}) async { | ||
| 286 | + List<FilterBtnModel> data = weekData.map((e) { | ||
| 287 | + return FilterBtnModel.fromJson(e.toJson()); | ||
| 288 | + }).toList(); | ||
| 289 | + | ||
| 290 | + final option = await showModalBottomSheet( | ||
| 291 | + context: context, | ||
| 292 | + backgroundColor: Colors.transparent, | ||
| 293 | + isDismissible: false, | ||
| 294 | + isScrollControlled: true, | ||
| 295 | + builder: (BuildContext context) { | ||
| 296 | + return StatefulBuilder(builder: (context, state) { | ||
| 297 | + return Container( | ||
| 298 | + decoration: BoxDecoration( | ||
| 299 | + color: MyColours.color_ffffff, | ||
| 300 | + borderRadius: BorderRadius.only( | ||
| 301 | + topLeft: Radius.circular(ScreenUtil().setWidth(10)), | ||
| 302 | + topRight: Radius.circular(ScreenUtil().setWidth(10)))), | ||
| 303 | + child: Column( | ||
| 304 | + mainAxisSize: MainAxisSize.min, | ||
| 305 | + children: <Widget>[ | ||
| 306 | + Padding( | ||
| 307 | + padding: EdgeInsets.only( | ||
| 308 | + left: w(25), right: w(25), top: w(26), bottom: w(12)), | ||
| 309 | + child: Row( | ||
| 310 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 311 | + children: [ | ||
| 312 | + InkWell( | ||
| 313 | + onTap: () { | ||
| 314 | + Navigator.pop(context); | ||
| 315 | + }, | ||
| 316 | + child: Container( | ||
| 317 | + child: Text( | ||
| 318 | + '取消', | ||
| 319 | + style: TextStyle( | ||
| 320 | + fontSize: ScreenUtil().setSp(32), | ||
| 321 | + color: MyColours.color_515151, | ||
| 322 | + ), | ||
| 323 | + ), | ||
| 324 | + ), | ||
| 325 | + ), | ||
| 326 | + InkWell( | ||
| 327 | + onTap: () { | ||
| 328 | + Navigator.pop(context, data); | ||
| 329 | + }, | ||
| 330 | + child: Container( | ||
| 331 | + child: Text( | ||
| 332 | + '确定', | ||
| 333 | + style: TextStyle( | ||
| 334 | + fontSize: ScreenUtil().setSp(32), | ||
| 335 | + color: MyColours.color_438E93, | ||
| 336 | + ), | ||
| 337 | + ), | ||
| 338 | + ), | ||
| 339 | + ), | ||
| 340 | + ], | ||
| 341 | + )), | ||
| 342 | + MyDivider( | ||
| 343 | + double.infinity, | ||
| 344 | + ScreenUtil().setWidth(2), | ||
| 345 | + color: MyColours.color_DBDBDB, | ||
| 346 | + ), | ||
| 347 | + VEmptyView(116), | ||
| 348 | + ListView.builder( | ||
| 349 | + shrinkWrap: true, | ||
| 350 | + itemCount: data.length, | ||
| 351 | + itemBuilder: (context, index) { | ||
| 352 | + return InkWell( | ||
| 353 | + onTap: () { | ||
| 354 | + state(() { | ||
| 355 | + data[index].select = !data[index].select; | ||
| 356 | + }); | ||
| 357 | + }, | ||
| 358 | + child: Container( | ||
| 359 | + margin: EdgeInsets.only(bottom: w(7)), | ||
| 360 | + padding: EdgeInsets.only( | ||
| 361 | + left: w(33), | ||
| 362 | + right: w(33), | ||
| 363 | + top: w(16), | ||
| 364 | + bottom: w(7)), | ||
| 365 | + decoration: index == data.length - 1 | ||
| 366 | + ? null | ||
| 367 | + : BoxDecoration( | ||
| 368 | + border: Border( | ||
| 369 | + bottom: BorderSide( | ||
| 370 | + width: w(1), | ||
| 371 | + color: | ||
| 372 | + MyColours.color_DBDBDB))), | ||
| 373 | + child: Row( | ||
| 374 | + mainAxisAlignment: | ||
| 375 | + MainAxisAlignment.spaceBetween, | ||
| 376 | + children: [ | ||
| 377 | + Text(data[index].title, | ||
| 378 | + style: TextStyle( | ||
| 379 | + color: MyColours.color_515151, | ||
| 380 | + fontSize: font(16))), | ||
| 381 | + Image.asset( | ||
| 382 | + Utils.getImgPath(data[index].select | ||
| 383 | + ? 'c_mul_select' | ||
| 384 | + : 'c_mul_select_un'), | ||
| 385 | + width: w(20)), | ||
| 386 | + ], | ||
| 387 | + ))); | ||
| 388 | + }), | ||
| 389 | + ], | ||
| 390 | + ), | ||
| 391 | + ); | ||
| 392 | + }); | ||
| 393 | + }); | ||
| 394 | + print(option); | ||
| 395 | + return option; | ||
| 396 | + } | ||
| 397 | + | ||
| 283 | ///添加图片UI弹出 | 398 | ///添加图片UI弹出 |
| 284 | static openImageModalBottomSheet(context, | 399 | static openImageModalBottomSheet(context, |
| 285 | {VoidCallback lCallback, VoidCallback rCallback}) async { | 400 | {VoidCallback lCallback, VoidCallback rCallback}) async { |
| @@ -4643,7 +4758,8 @@ class DialogUtil { | @@ -4643,7 +4758,8 @@ class DialogUtil { | ||
| 4643 | } | 4758 | } |
| 4644 | 4759 | ||
| 4645 | //主题颜色选择弹框 | 4760 | //主题颜色选择弹框 |
| 4646 | - static showThemeColorSelectDialog(BuildContext context, List<ThemeColorModel> themeColorData, | 4761 | + static showThemeColorSelectDialog( |
| 4762 | + BuildContext context, List<ThemeColorModel> themeColorData, | ||
| 4647 | {CustomCallBack callback}) { | 4763 | {CustomCallBack callback}) { |
| 4648 | return showModalBottomSheet( | 4764 | return showModalBottomSheet( |
| 4649 | context: context, | 4765 | context: context, |
| @@ -4671,7 +4787,7 @@ class DialogUtil { | @@ -4671,7 +4787,7 @@ class DialogUtil { | ||
| 4671 | child: Container( | 4787 | child: Container( |
| 4672 | width: double.infinity, | 4788 | width: double.infinity, |
| 4673 | height: w(106), | 4789 | height: w(106), |
| 4674 | - color:themeColorData[0].color, | 4790 | + color: themeColorData[0].color, |
| 4675 | margin: EdgeInsets.symmetric(horizontal: w(30)), | 4791 | margin: EdgeInsets.symmetric(horizontal: w(30)), |
| 4676 | padding: EdgeInsets.only(left: w(10), top: w(13)), | 4792 | padding: EdgeInsets.only(left: w(10), top: w(13)), |
| 4677 | child: Container( | 4793 | child: Container( |
| @@ -5704,7 +5820,7 @@ class DialogUtil { | @@ -5704,7 +5820,7 @@ class DialogUtil { | ||
| 5704 | ); | 5820 | ); |
| 5705 | } | 5821 | } |
| 5706 | 5822 | ||
| 5707 | - static Future cupertinoAlertDialogOnly(BuildContext context, | 5823 | + static Future cupertinoAlertDialogOnly(BuildContext context, |
| 5708 | {String title = "", | 5824 | {String title = "", |
| 5709 | String content = "内容", | 5825 | String content = "内容", |
| 5710 | String lTitle = "取消", | 5826 | String lTitle = "取消", |
| @@ -36,7 +36,10 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget { | @@ -36,7 +36,10 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget { | ||
| 36 | leftTitle != '' ? ScreenUtil().setWidth(84 * 2 + 40 + 10) : 56, | 36 | leftTitle != '' ? ScreenUtil().setWidth(84 * 2 + 40 + 10) : 56, |
| 37 | leading: showLeading | 37 | leading: showLeading |
| 38 | ? InkWell( | 38 | ? InkWell( |
| 39 | - onTap: onTap, | 39 | + onTap: onTap ?? |
| 40 | + () { | ||
| 41 | + Navigator.pop(context); | ||
| 42 | + }, | ||
| 40 | child: Padding( | 43 | child: Padding( |
| 41 | padding: EdgeInsets.symmetric( | 44 | padding: EdgeInsets.symmetric( |
| 42 | horizontal: ScreenUtil().setWidth(40), | 45 | horizontal: ScreenUtil().setWidth(40), |
-
Please register or login to post a comment