Showing
18 changed files
with
1800 additions
and
685 deletions
| 1 | import 'dart:convert' as convert; | 1 | import 'dart:convert' as convert; |
| 2 | 2 | ||
| 3 | +import 'package:one_key/models/recharge_list_model.dart'; | ||
| 4 | + | ||
| 5 | +import 'coupon_model.dart'; | ||
| 6 | + | ||
| 3 | class MarkDataModel extends Object { | 7 | class MarkDataModel extends Object { |
| 4 | String id; | 8 | String id; |
| 5 | 9 | ||
| @@ -305,6 +309,11 @@ class MarkMarketingModel { | @@ -305,6 +309,11 @@ class MarkMarketingModel { | ||
| 305 | String isLink; // | 309 | String isLink; // |
| 306 | String wecomle; // | 310 | String wecomle; // |
| 307 | String logo; // | 311 | String logo; // |
| 312 | + String isCoupon; | ||
| 313 | + String isRecharge; | ||
| 314 | + RechargeListSunModel rechargeData; | ||
| 315 | + | ||
| 316 | + CouponSunModel couponData; | ||
| 308 | 317 | ||
| 309 | MarkMarketingModel( | 318 | MarkMarketingModel( |
| 310 | {this.isArrival, | 319 | {this.isArrival, |
| @@ -313,7 +322,9 @@ class MarkMarketingModel { | @@ -313,7 +322,9 @@ class MarkMarketingModel { | ||
| 313 | this.isOrder, | 322 | this.isOrder, |
| 314 | this.isTranspond, | 323 | this.isTranspond, |
| 315 | this.logo, | 324 | this.logo, |
| 316 | - this.wecomle}); | 325 | + this.wecomle, |
| 326 | + this.isCoupon, | ||
| 327 | + this.isRecharge}); | ||
| 317 | 328 | ||
| 318 | MarkMarketingModel.fromJson(Map<String, dynamic> json) { | 329 | MarkMarketingModel.fromJson(Map<String, dynamic> json) { |
| 319 | isTranspond = json['is_transpond']; | 330 | isTranspond = json['is_transpond']; |
| @@ -323,6 +334,16 @@ class MarkMarketingModel { | @@ -323,6 +334,16 @@ class MarkMarketingModel { | ||
| 323 | isLink = json['is_link']; | 334 | isLink = json['is_link']; |
| 324 | wecomle = json['wecomle']; | 335 | wecomle = json['wecomle']; |
| 325 | logo = json['logo']; | 336 | logo = json['logo']; |
| 337 | + isCoupon = json['is_coupon']; | ||
| 338 | + isRecharge = json['is_recharge']; | ||
| 339 | + rechargeData = json['recharge_data'] != null | ||
| 340 | + ? new RechargeListSunModel.fromJson( | ||
| 341 | + json['recharge_data']) | ||
| 342 | + : null; | ||
| 343 | + | ||
| 344 | + couponData = json['coupon_data'] != null | ||
| 345 | + ? new CouponSunModel.fromJson(json['coupon_data']) | ||
| 346 | + : null; | ||
| 326 | } | 347 | } |
| 327 | 348 | ||
| 328 | Map<String, dynamic> toJson() { | 349 | Map<String, dynamic> toJson() { |
| @@ -334,6 +355,11 @@ class MarkMarketingModel { | @@ -334,6 +355,11 @@ class MarkMarketingModel { | ||
| 334 | data['is_link'] = this.isLink; | 355 | data['is_link'] = this.isLink; |
| 335 | data['wecomle'] = this.wecomle; | 356 | data['wecomle'] = this.wecomle; |
| 336 | data['logo'] = this.logo; | 357 | data['logo'] = this.logo; |
| 358 | + data['is_coupon'] = this.isCoupon; | ||
| 359 | + data['is_recharge'] = this.isRecharge; | ||
| 360 | + data['recharge_data'] = this.rechargeData; | ||
| 361 | + data['coupon_data'] = this.couponData; | ||
| 362 | + | ||
| 337 | return data; | 363 | return data; |
| 338 | } | 364 | } |
| 339 | } | 365 | } |
lib/models/recharge_list_model.dart
0 → 100644
| 1 | +import 'dart:convert' as convert; | ||
| 2 | + | ||
| 3 | +import 'package:common_utils/common_utils.dart'; | ||
| 4 | +import 'package:one_key/models/filter_btn_model.dart'; | ||
| 5 | + | ||
| 6 | +import 'coupon_model.dart'; | ||
| 7 | + | ||
| 8 | +class RechargeListModel { | ||
| 9 | + int ret; | ||
| 10 | + List<RechargeListSunModel> data; | ||
| 11 | + String msg; | ||
| 12 | + | ||
| 13 | + RechargeListModel({this.ret, this.data, this.msg}); | ||
| 14 | + | ||
| 15 | + RechargeListModel.fromJson(Map<String, dynamic> json) { | ||
| 16 | + ret = json['ret']; | ||
| 17 | + if (json['data'] != null) { | ||
| 18 | + data = []; | ||
| 19 | + json['data'].forEach((v) { | ||
| 20 | + if (v['status'] != '1') { | ||
| 21 | + data.add(new RechargeListSunModel.fromJson(v)); | ||
| 22 | + } | ||
| 23 | + }); | ||
| 24 | + } | ||
| 25 | + msg = json['msg']; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + Map<String, dynamic> toJson() { | ||
| 29 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 30 | + data['ret'] = this.ret; | ||
| 31 | + if (this.data != null) { | ||
| 32 | + data['data'] = this.data.map((v) => v.toJson()).toList(); | ||
| 33 | + } | ||
| 34 | + data['msg'] = this.msg; | ||
| 35 | + return data; | ||
| 36 | + } | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +class RechargeListSunModel { | ||
| 40 | + String id; | ||
| 41 | + String uid; | ||
| 42 | + String sellerid; | ||
| 43 | + String rname; | ||
| 44 | + String rechargeMoney; | ||
| 45 | + RechargeListDataModel rechargeList; | ||
| 46 | + RechargeDateModel expDate; | ||
| 47 | + String explain; | ||
| 48 | + String isOpen; | ||
| 49 | + String status; | ||
| 50 | + // Null qrcode; | ||
| 51 | + String isExamine; | ||
| 52 | + String cdate; | ||
| 53 | + bool isCheck = false; | ||
| 54 | + | ||
| 55 | + String get cdateStr { | ||
| 56 | + if (cdate.toString() == '0') { | ||
| 57 | + return ''; | ||
| 58 | + } | ||
| 59 | + DateTime dateTime = | ||
| 60 | + DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000); | ||
| 61 | + return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + RechargeListSunModel( | ||
| 65 | + {this.id, | ||
| 66 | + this.uid, | ||
| 67 | + this.sellerid, | ||
| 68 | + this.rname, | ||
| 69 | + this.rechargeMoney, | ||
| 70 | + this.rechargeList, | ||
| 71 | + this.expDate, | ||
| 72 | + this.explain, | ||
| 73 | + this.isOpen, | ||
| 74 | + this.status, | ||
| 75 | + // this.qrcode, | ||
| 76 | + this.isExamine, | ||
| 77 | + this.cdate}); | ||
| 78 | + | ||
| 79 | + RechargeListSunModel.fromJson(Map<String, dynamic> json) { | ||
| 80 | + id = json['id']; | ||
| 81 | + uid = json['uid']; | ||
| 82 | + sellerid = json['sellerid']; | ||
| 83 | + rname = json['rname']; | ||
| 84 | + rechargeMoney = json['recharge_money']; | ||
| 85 | + rechargeList = json['recharge_list'] == null | ||
| 86 | + ? null | ||
| 87 | + : json['recharge_list'] is Map | ||
| 88 | + ? RechargeListDataModel.fromJson(json['recharge_list']) | ||
| 89 | + : RechargeListDataModel.fromJson(convert | ||
| 90 | + .jsonDecode(json['recharge_list']) as Map<String, dynamic>); | ||
| 91 | + | ||
| 92 | + expDate = json['exp_date'] == null | ||
| 93 | + ? null | ||
| 94 | + : json['exp_date'] is Map | ||
| 95 | + ? RechargeDateModel.fromJson(json['exp_date']) | ||
| 96 | + : RechargeDateModel.fromJson( | ||
| 97 | + convert.jsonDecode(json['exp_date']) as Map<String, dynamic>); | ||
| 98 | + explain = json['explain']; | ||
| 99 | + isOpen = json['is_open']; | ||
| 100 | + status = json['status']; | ||
| 101 | + // qrcode = json['qrcode']; | ||
| 102 | + isExamine = json['is_examine']; | ||
| 103 | + cdate = json['cdate']; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + Map<String, dynamic> toJson() { | ||
| 107 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 108 | + data['id'] = this.id; | ||
| 109 | + data['uid'] = this.uid; | ||
| 110 | + data['sellerid'] = this.sellerid; | ||
| 111 | + data['rname'] = this.rname; | ||
| 112 | + data['recharge_money'] = this.rechargeMoney; | ||
| 113 | + data['recharge_list'] = this.rechargeList; | ||
| 114 | + data['exp_date'] = this.expDate; | ||
| 115 | + data['explain'] = this.explain; | ||
| 116 | + data['is_open'] = this.isOpen; | ||
| 117 | + data['status'] = this.status; | ||
| 118 | + // data['qrcode'] = this.qrcode; | ||
| 119 | + data['is_examine'] = this.isExamine; | ||
| 120 | + data['cdate'] = this.cdate; | ||
| 121 | + return data; | ||
| 122 | + } | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +class RechargeListDataModel { | ||
| 126 | + String isPrice; | ||
| 127 | + String isScore; | ||
| 128 | + String isCoupons; | ||
| 129 | + String price; | ||
| 130 | + String score; | ||
| 131 | + List<CouponSunModel> coupons; | ||
| 132 | + List<dynamic> couponsIds; | ||
| 133 | + List<dynamic> couponsNames; | ||
| 134 | + | ||
| 135 | + RechargeListDataModel({ | ||
| 136 | + this.isPrice, | ||
| 137 | + this.isCoupons, | ||
| 138 | + this.isScore, | ||
| 139 | + this.price, | ||
| 140 | + this.score, | ||
| 141 | + this.coupons, | ||
| 142 | + this.couponsIds, | ||
| 143 | + this.couponsNames, | ||
| 144 | + }); | ||
| 145 | + | ||
| 146 | + RechargeListDataModel.fromJson(Map<String, dynamic> json) { | ||
| 147 | + isPrice = json['is_price']; | ||
| 148 | + isScore = json['is_score']; | ||
| 149 | + isCoupons = json['is_coupons']; | ||
| 150 | + price = json['price']; | ||
| 151 | + score = json['score']; | ||
| 152 | + coupons = <CouponSunModel>[]; | ||
| 153 | + if (json['coupons'] != null) { | ||
| 154 | + json['coupons'].forEach((v) { | ||
| 155 | + coupons.add(new CouponSunModel.fromJson(v)); | ||
| 156 | + }); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + couponsIds = json['coupons_ids']; | ||
| 160 | + couponsNames = json['coupons_names']; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + Map<String, dynamic> toJson() { | ||
| 164 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 165 | + data['is_price'] = this.isPrice; | ||
| 166 | + data['is_score'] = this.isScore; | ||
| 167 | + data['is_coupons'] = this.isCoupons; | ||
| 168 | + data['price'] = this.price; | ||
| 169 | + data['score'] = this.score; | ||
| 170 | + data['coupons'] = this.coupons; | ||
| 171 | + data['coupons_ids'] = this.couponsIds; | ||
| 172 | + data['coupons_names'] = this.couponsNames; | ||
| 173 | + | ||
| 174 | + return data; | ||
| 175 | + } | ||
| 176 | +} | ||
| 177 | + | ||
| 178 | +class RechargeDateModel { | ||
| 179 | + String isFix; | ||
| 180 | + String isWeek; | ||
| 181 | + String isBirthday; | ||
| 182 | + String fixSdate; | ||
| 183 | + String fixEdate; | ||
| 184 | + String weekDateShow; | ||
| 185 | + List<FilterBtnModel> weekDateData; | ||
| 186 | + | ||
| 187 | + RechargeDateModel({ | ||
| 188 | + this.isFix, | ||
| 189 | + this.isWeek, | ||
| 190 | + this.isBirthday, | ||
| 191 | + this.fixSdate, | ||
| 192 | + this.fixEdate, | ||
| 193 | + this.weekDateShow, | ||
| 194 | + this.weekDateData, | ||
| 195 | + }); | ||
| 196 | + | ||
| 197 | + RechargeDateModel.fromJson(Map<String, dynamic> json) { | ||
| 198 | + isFix = json['is_fix']; | ||
| 199 | + isWeek = json['is_week']; | ||
| 200 | + isBirthday = json['is_birthday']; | ||
| 201 | + fixSdate = json['fix_sdate']; | ||
| 202 | + fixEdate = json['fix_edate']; | ||
| 203 | + weekDateShow = json['week_date_show']; | ||
| 204 | + | ||
| 205 | + weekDateData = <FilterBtnModel>[]; | ||
| 206 | + if (json['week_date_data'] != null && json['week_date_data'] != '') { | ||
| 207 | + json['week_date_data'].forEach((v) { | ||
| 208 | + weekDateData.add(new FilterBtnModel.fromJson(v)); | ||
| 209 | + }); | ||
| 210 | + } | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + Map<String, dynamic> toJson() { | ||
| 214 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 215 | + data['is_fix'] = this.isFix; | ||
| 216 | + data['is_week'] = this.isWeek; | ||
| 217 | + data['is_birthday'] = this.isBirthday; | ||
| 218 | + data['fix_sdate'] = this.fixSdate; | ||
| 219 | + data['fix_edate'] = this.fixEdate; | ||
| 220 | + data['week_date_show'] = this.weekDateShow; | ||
| 221 | + data['week_date_data'] = this.weekDateData; | ||
| 222 | + | ||
| 223 | + return data; | ||
| 224 | + } | ||
| 225 | +} |
| @@ -400,4 +400,18 @@ class HttpUrl { | @@ -400,4 +400,18 @@ class HttpUrl { | ||
| 400 | static const String ins_guest = | 400 | static const String ins_guest = |
| 401 | "?service=App.GuestManage.InsGuest"; // 新增客户 | 401 | "?service=App.GuestManage.InsGuest"; // 新增客户 |
| 402 | 402 | ||
| 403 | + static const String create_new_recharge = | ||
| 404 | + "?service=App.Activity.CreateNewRecharge"; // 创建/修改新充值活动 | ||
| 405 | + | ||
| 406 | + static const String get_new_recharge_list = | ||
| 407 | + "?service=App.Activity.GetNewRechargeList"; // 获取新充值活动列表 | ||
| 408 | + | ||
| 409 | + static const String get_new_recharge_detail = | ||
| 410 | + "?service=App.Activity.GetNewRecharge"; // 获取新充值活动详情 | ||
| 411 | + | ||
| 412 | + | ||
| 413 | + static const String get_activity_by_id = | ||
| 414 | + "?service=App.Activity.GetActivityById"; // 客户经理优惠券信息 | ||
| 415 | + | ||
| 416 | + | ||
| 403 | } | 417 | } |
| @@ -37,6 +37,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | @@ -37,6 +37,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> { | ||
| 37 | @override | 37 | @override |
| 38 | void initState() { | 38 | void initState() { |
| 39 | super.initState(); | 39 | super.initState(); |
| 40 | + | ||
| 41 | + if(widget.couponSunModel == null){ | ||
| 42 | + | ||
| 43 | + } | ||
| 40 | } | 44 | } |
| 41 | 45 | ||
| 42 | ///时间选择 | 46 | ///时间选择 |
| @@ -23,11 +23,14 @@ import 'package:sendsms/sendsms.dart'; | @@ -23,11 +23,14 @@ import 'package:sendsms/sendsms.dart'; | ||
| 23 | // import 'package:sendsms/sendsms.dart'; | 23 | // import 'package:sendsms/sendsms.dart'; |
| 24 | import 'package:flutter_sms/flutter_sms.dart'; | 24 | import 'package:flutter_sms/flutter_sms.dart'; |
| 25 | 25 | ||
| 26 | +import '../../../../models/coupon_model.dart'; | ||
| 27 | + | ||
| 26 | /** | 28 | /** |
| 27 | * 优惠券单选页面 | 29 | * 优惠券单选页面 |
| 28 | */ | 30 | */ |
| 29 | class MarkingCouponSelectPage extends StatefulWidget { | 31 | class MarkingCouponSelectPage extends StatefulWidget { |
| 30 | - MarkingCouponSelectPage({Key key}) : super(key: key); | 32 | + final String selectid; |
| 33 | + MarkingCouponSelectPage({Key key, this.selectid}) : super(key: key); | ||
| 31 | 34 | ||
| 32 | @override | 35 | @override |
| 33 | _MarkingCouponSelectPageState createState() => | 36 | _MarkingCouponSelectPageState createState() => |
| @@ -38,6 +41,8 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -38,6 +41,8 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 38 | EasyRefreshController _controller = EasyRefreshController(); | 41 | EasyRefreshController _controller = EasyRefreshController(); |
| 39 | CouponProvider couponProvider; | 42 | CouponProvider couponProvider; |
| 40 | 43 | ||
| 44 | + CouponSunModel selectData; | ||
| 45 | + | ||
| 41 | ///获取优惠券列表数据(status == 1) | 46 | ///获取优惠券列表数据(status == 1) |
| 42 | 47 | ||
| 43 | _couponNetworkData({bool isShowLoading = true}) async { | 48 | _couponNetworkData({bool isShowLoading = true}) async { |
| @@ -48,6 +53,16 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -48,6 +53,16 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 48 | 53 | ||
| 49 | await couponProvider.getCustomerSelectActivityMarking(context, params, | 54 | await couponProvider.getCustomerSelectActivityMarking(context, params, |
| 50 | isShowLoading: isShowLoading); | 55 | isShowLoading: isShowLoading); |
| 56 | + | ||
| 57 | + outerloop: | ||
| 58 | + for (var i = 0; i < couponProvider.couponListSelect.length; i++) { | ||
| 59 | + if (couponProvider.couponListSelect[i].id == widget.selectid) { | ||
| 60 | + couponProvider.couponListSelect[i].isCheck = true; | ||
| 61 | + selectData = couponProvider.couponListSelect[i]; | ||
| 62 | + break outerloop; | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + setState(() {}); | ||
| 51 | } | 66 | } |
| 52 | 67 | ||
| 53 | @override | 68 | @override |
| @@ -121,6 +136,9 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -121,6 +136,9 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 121 | 136 | ||
| 122 | couponProvider.couponListSelect[index].isCheck = | 137 | couponProvider.couponListSelect[index].isCheck = |
| 123 | true; | 138 | true; |
| 139 | + | ||
| 140 | + selectData = | ||
| 141 | + couponProvider.couponListSelect[index]; | ||
| 124 | }, | 142 | }, |
| 125 | // child: Row( | 143 | // child: Row( |
| 126 | // children: [ | 144 | // children: [ |
| @@ -156,6 +174,9 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -156,6 +174,9 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 156 | couponProvider | 174 | couponProvider |
| 157 | .couponListSelect[index].isCheck = true; | 175 | .couponListSelect[index].isCheck = true; |
| 158 | 176 | ||
| 177 | + selectData = | ||
| 178 | + couponProvider.couponListSelect[index]; | ||
| 179 | + | ||
| 159 | // couponProvider | 180 | // couponProvider |
| 160 | // .couponListSelect[index].isCheck = !old; | 181 | // .couponListSelect[index].isCheck = !old; |
| 161 | setState(() {}); | 182 | setState(() {}); |
| @@ -182,7 +203,10 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -182,7 +203,10 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 182 | ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), | 203 | ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), |
| 183 | child: RoundButton( | 204 | child: RoundButton( |
| 184 | onPressed: () async { | 205 | onPressed: () async { |
| 185 | - Navigator.pop(context); | 206 | + Map temp = { |
| 207 | + 'coupon': selectData, | ||
| 208 | + }; | ||
| 209 | + Navigator.pop(context, temp); | ||
| 186 | }, | 210 | }, |
| 187 | text: '确定', | 211 | text: '确定', |
| 188 | fontSize: 34, | 212 | fontSize: 34, |
| @@ -11,6 +11,8 @@ import 'package:one_key/widgets/v_empty_view.dart'; | @@ -11,6 +11,8 @@ import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 11 | import 'package:permission_handler/permission_handler.dart'; | 11 | import 'package:permission_handler/permission_handler.dart'; |
| 12 | import 'package:provider/provider.dart'; | 12 | import 'package:provider/provider.dart'; |
| 13 | 13 | ||
| 14 | +import '../../../../models/coupon_model.dart'; | ||
| 15 | +import '../../../../models/recharge_list_model.dart'; | ||
| 14 | import '../../../../models/upload_img_model.dart'; | 16 | import '../../../../models/upload_img_model.dart'; |
| 15 | import '../../../../provider/coupon_provider.dart'; | 17 | import '../../../../provider/coupon_provider.dart'; |
| 16 | import '../../../../provider/marketing_center_provider.dart'; | 18 | import '../../../../provider/marketing_center_provider.dart'; |
| @@ -43,18 +45,26 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -43,18 +45,26 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 43 | 45 | ||
| 44 | UploadImageProvider _uploadImageProvider; | 46 | UploadImageProvider _uploadImageProvider; |
| 45 | MarketingCenterProvider marketingCenterProvider; | 47 | MarketingCenterProvider marketingCenterProvider; |
| 46 | - bool is_transpond = false; //转发邀请函 | ||
| 47 | - bool is_arrival = false; //确认到店 | ||
| 48 | - bool is_online_book = false; //在线预订 | ||
| 49 | - bool is_order = false; //提前点餐 | ||
| 50 | - bool is_link = false; //充值优惠活动链接 | 48 | + bool isTranspond = false; //转发邀请函 |
| 49 | + bool isArrival = false; //确认到店 | ||
| 50 | + bool isOnlineBook = false; //在线预订 | ||
| 51 | + bool isOrder = false; //提前点餐 | ||
| 52 | + bool isLink = false; //充值优惠活动链接 | ||
| 53 | + bool isCoupon = false; // 代金券 | ||
| 54 | + bool isRecharge = false; //充值券 | ||
| 55 | + | ||
| 56 | + RechargeListSunModel rechargeData; | ||
| 57 | + String rechargeContent = ''; | ||
| 58 | + | ||
| 59 | + CouponSunModel couponData; | ||
| 51 | 60 | ||
| 52 | @override | 61 | @override |
| 53 | void initState() { | 62 | void initState() { |
| 54 | super.initState(); | 63 | super.initState(); |
| 55 | WidgetsBinding.instance.addPostFrameCallback((_) async { | 64 | WidgetsBinding.instance.addPostFrameCallback((_) async { |
| 56 | - // _couponNetworkData(); | ||
| 57 | - await getSellerTemplateConf(); | 65 | + _couponNetworkData(); |
| 66 | + _getNewRechargeList(); | ||
| 67 | + getSellerTemplateConf(); | ||
| 58 | }); | 68 | }); |
| 59 | } | 69 | } |
| 60 | 70 | ||
| @@ -64,29 +74,69 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -64,29 +74,69 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 64 | super.dispose(); | 74 | super.dispose(); |
| 65 | } | 75 | } |
| 66 | 76 | ||
| 77 | + _getNewRechargeList() async { | ||
| 78 | + await marketingCenterProvider.getNewRechargeList(context); | ||
| 79 | + if (rechargeData == null && | ||
| 80 | + marketingCenterProvider.rechargeList != null && | ||
| 81 | + marketingCenterProvider.rechargeList.length > 0) { | ||
| 82 | + rechargeData = marketingCenterProvider.rechargeList[0]; | ||
| 83 | + _getRechargeContent(); | ||
| 84 | + setState(() {}); | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + _getRechargeContent() { | ||
| 89 | + rechargeContent = ''; | ||
| 90 | + if (rechargeData.rechargeList.isPrice == '1') { | ||
| 91 | + rechargeContent += | ||
| 92 | + '会员充值满${rechargeData.rechargeMoney}元赠余额${rechargeData.rechargeList.price}元;'; | ||
| 93 | + } | ||
| 94 | + if (rechargeData.rechargeList.isScore == '1') { | ||
| 95 | + rechargeContent += | ||
| 96 | + '\n会员充值满${rechargeData.rechargeMoney}元赠${rechargeData.rechargeList.score}积分;'; | ||
| 97 | + } | ||
| 98 | + if (rechargeData.rechargeList.isCoupons == '1') { | ||
| 99 | + rechargeContent += | ||
| 100 | + '\n会员充值满${rechargeData.rechargeMoney}元赠${Utils.listToStringEnglish3(rechargeData.rechargeList.couponsNames)}。'; | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + | ||
| 67 | getSellerTemplateConf() async { | 104 | getSellerTemplateConf() async { |
| 68 | bool success = await marketingCenterProvider.getSellerTemplateConf(context); | 105 | bool success = await marketingCenterProvider.getSellerTemplateConf(context); |
| 69 | if (success && marketingCenterProvider.markDataModel.marketing != null) { | 106 | if (success && marketingCenterProvider.markDataModel.marketing != null) { |
| 70 | - is_transpond = | 107 | + isTranspond = |
| 71 | marketingCenterProvider.markDataModel.marketing.isTranspond == '1' | 108 | marketingCenterProvider.markDataModel.marketing.isTranspond == '1' |
| 72 | ? true | 109 | ? true |
| 73 | : false; | 110 | : false; |
| 74 | 111 | ||
| 75 | - is_arrival = | 112 | + isArrival = |
| 76 | marketingCenterProvider.markDataModel.marketing.isArrival == '1' | 113 | marketingCenterProvider.markDataModel.marketing.isArrival == '1' |
| 77 | ? true | 114 | ? true |
| 78 | : false; | 115 | : false; |
| 79 | - is_online_book = | 116 | + isOnlineBook = |
| 80 | marketingCenterProvider.markDataModel.marketing.isOnlineBook == '1' | 117 | marketingCenterProvider.markDataModel.marketing.isOnlineBook == '1' |
| 81 | ? true | 118 | ? true |
| 82 | : false; | 119 | : false; |
| 83 | - is_order = marketingCenterProvider.markDataModel.marketing.isOrder == '1' | 120 | + isOrder = marketingCenterProvider.markDataModel.marketing.isOrder == '1' |
| 84 | ? true | 121 | ? true |
| 85 | : false; | 122 | : false; |
| 86 | - is_link = marketingCenterProvider.markDataModel.marketing.isLink == '1' | 123 | + isLink = marketingCenterProvider.markDataModel.marketing.isLink == '1' |
| 87 | ? true | 124 | ? true |
| 88 | : false; | 125 | : false; |
| 89 | 126 | ||
| 127 | + isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1' | ||
| 128 | + ? true | ||
| 129 | + : false; | ||
| 130 | + | ||
| 131 | + isRecharge = | ||
| 132 | + marketingCenterProvider.markDataModel.marketing.isRecharge == '1' | ||
| 133 | + ? true | ||
| 134 | + : false; | ||
| 135 | + | ||
| 136 | + rechargeData = | ||
| 137 | + marketingCenterProvider.markDataModel.marketing.rechargeData; | ||
| 138 | + couponData = marketingCenterProvider.markDataModel.marketing.couponData; | ||
| 139 | + | ||
| 90 | _uploadImageProvider.firstImage.qiniuUrl = | 140 | _uploadImageProvider.firstImage.qiniuUrl = |
| 91 | marketingCenterProvider.markDataModel.marketing.logo ?? null; | 141 | marketingCenterProvider.markDataModel.marketing.logo ?? null; |
| 92 | 142 | ||
| @@ -112,6 +162,14 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -112,6 +162,14 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 112 | 162 | ||
| 113 | await couponProvider.getCustomerSelectActivityMarking(context, params, | 163 | await couponProvider.getCustomerSelectActivityMarking(context, params, |
| 114 | isShowLoading: isShowLoading); | 164 | isShowLoading: isShowLoading); |
| 165 | + if (couponData == null) { | ||
| 166 | + if (couponProvider.couponListSelect != null && | ||
| 167 | + couponProvider.couponListSelect.length > 0) { | ||
| 168 | + couponData = couponProvider.couponListSelect[0]; | ||
| 169 | + | ||
| 170 | + setState(() {}); | ||
| 171 | + } | ||
| 172 | + } | ||
| 115 | } | 173 | } |
| 116 | 174 | ||
| 117 | ///客户互动及店铺推广 | 175 | ///客户互动及店铺推广 |
| @@ -161,7 +219,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -161,7 +219,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 161 | ///#相机拍照,单图选择 | 219 | ///#相机拍照,单图选择 |
| 162 | Future _getFromPictureOrCamera(UploadImgModel imgModel, imageSource) async { | 220 | Future _getFromPictureOrCamera(UploadImgModel imgModel, imageSource) async { |
| 163 | final pickedFile = await picker.pickImage(source: imageSource); | 221 | final pickedFile = await picker.pickImage(source: imageSource); |
| 164 | - File compressedFile = await FlutterNativeImage.compressImage( | 222 | + File compressedFile = await FlutterNativeImage.compressImage( |
| 165 | pickedFile.path, | 223 | pickedFile.path, |
| 166 | quality: 50, | 224 | quality: 50, |
| 167 | percentage: 50); | 225 | percentage: 50); |
| @@ -181,13 +239,13 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -181,13 +239,13 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 181 | // _uploadImageProvider.imgSizeErweima = 76; | 239 | // _uploadImageProvider.imgSizeErweima = 76; |
| 182 | _uploadImageProvider.firstImage.qiniuUrl = null; | 240 | _uploadImageProvider.firstImage.qiniuUrl = null; |
| 183 | // } | 241 | // } |
| 184 | - bool need = await Utils.sizeNeed(File(pickedFile.path)); | 242 | + bool need = await Utils.sizeNeed(File(pickedFile.path)); |
| 185 | File file = File(pickedFile.path); | 243 | File file = File(pickedFile.path); |
| 186 | if (need) { | 244 | if (need) { |
| 187 | file = File(compressedFile.absolute.path); | 245 | file = File(compressedFile.absolute.path); |
| 188 | } | 246 | } |
| 189 | - UploadImageUtil().startUploadOnly( | ||
| 190 | - context, file, 4, true, _uploadImageProvider); | 247 | + UploadImageUtil() |
| 248 | + .startUploadOnly(context, file, 4, true, _uploadImageProvider); | ||
| 191 | } | 249 | } |
| 192 | } | 250 | } |
| 193 | 251 | ||
| @@ -323,27 +381,36 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -323,27 +381,36 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 323 | } | 381 | } |
| 324 | 382 | ||
| 325 | ///营销推广 | 383 | ///营销推广 |
| 326 | - Widget _markingItem(String selectTitle, String title, String content, | ||
| 327 | - String subtile, String discount, | ||
| 328 | - {VoidCallback onPressed, bool select = false}) { | 384 | + Widget _markingItem( |
| 385 | + String selectTitle, | ||
| 386 | + String title, | ||
| 387 | + String content, | ||
| 388 | + String subtile, | ||
| 389 | + String discount, { | ||
| 390 | + VoidCallback onPressed, | ||
| 391 | + bool select = false, | ||
| 392 | + VoidCallback onPressedSelect, | ||
| 393 | + }) { | ||
| 329 | return Container( | 394 | return Container( |
| 330 | margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)), | 395 | margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)), |
| 331 | child: Column( | 396 | child: Column( |
| 332 | children: [ | 397 | children: [ |
| 333 | - Row( | ||
| 334 | - children: [ | ||
| 335 | - Image.asset( | ||
| 336 | - Utils.getImgPath(select ? 'f_select' : 'f_select_not'), | ||
| 337 | - width: w(20), | ||
| 338 | - ), | ||
| 339 | - HEmptyView(20), | ||
| 340 | - Text( | ||
| 341 | - selectTitle, | ||
| 342 | - style: TextStyle( | ||
| 343 | - fontSize: font(14), color: MyColours.color_515151), | ||
| 344 | - ) | ||
| 345 | - ], | ||
| 346 | - ), | 398 | + InkWell( |
| 399 | + onTap: onPressedSelect, | ||
| 400 | + child: Row( | ||
| 401 | + children: [ | ||
| 402 | + Image.asset( | ||
| 403 | + Utils.getImgPath(select ? 'f_select' : 'f_select_not'), | ||
| 404 | + width: w(20), | ||
| 405 | + ), | ||
| 406 | + HEmptyView(20), | ||
| 407 | + Text( | ||
| 408 | + selectTitle, | ||
| 409 | + style: TextStyle( | ||
| 410 | + fontSize: font(14), color: MyColours.color_515151), | ||
| 411 | + ) | ||
| 412 | + ], | ||
| 413 | + )), | ||
| 347 | VEmptyView(20), | 414 | VEmptyView(20), |
| 348 | Container( | 415 | Container( |
| 349 | padding: EdgeInsets.all(w(12)), | 416 | padding: EdgeInsets.all(w(12)), |
| @@ -399,6 +466,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -399,6 +466,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 399 | Text( | 466 | Text( |
| 400 | content, | 467 | content, |
| 401 | style: TextStyle( | 468 | style: TextStyle( |
| 469 | + height: 1.2, | ||
| 402 | fontSize: font(10), | 470 | fontSize: font(10), |
| 403 | fontWeight: FontWeight.bold, | 471 | fontWeight: FontWeight.bold, |
| 404 | color: MyColours.color_515151), | 472 | color: MyColours.color_515151), |
| @@ -435,13 +503,13 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -435,13 +503,13 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 435 | // InkWell( | 503 | // InkWell( |
| 436 | // onTap: () { | 504 | // onTap: () { |
| 437 | // setState(() { | 505 | // setState(() { |
| 438 | - // is_link = !is_link; | 506 | + // isLink = !isLink; |
| 439 | // }); | 507 | // }); |
| 440 | // }, | 508 | // }, |
| 441 | // child: Row( | 509 | // child: Row( |
| 442 | // children: [ | 510 | // children: [ |
| 443 | // Image.asset( | 511 | // Image.asset( |
| 444 | - // Utils.getImgPath(is_link ? 'f_select' : 'f_select_not'), | 512 | + // Utils.getImgPath(isLink ? 'f_select' : 'f_select_not'), |
| 445 | // width: w(20), | 513 | // width: w(20), |
| 446 | // ), | 514 | // ), |
| 447 | // HEmptyView(20), | 515 | // HEmptyView(20), |
| @@ -709,47 +777,71 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -709,47 +777,71 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 709 | // '同行客人可以从电子邀请函了解预订信息、一键导航到店,快速联系餐厅服务人员。还可以了解更多餐厅介绍、各种活动。', | 777 | // '同行客人可以从电子邀请函了解预订信息、一键导航到店,快速联系餐厅服务人员。还可以了解更多餐厅介绍、各种活动。', |
| 710 | // onTap: () { | 778 | // onTap: () { |
| 711 | // setState(() { | 779 | // setState(() { |
| 712 | - // is_transpond = !is_transpond; | 780 | + // isTranspond = !isTranspond; |
| 713 | // }); | 781 | // }); |
| 714 | - // }, select: is_transpond), | 782 | + // }, select: isTranspond), |
| 715 | _storeItemWidget('向被邀请客人开放“确认到店”功能。', | 783 | _storeItemWidget('向被邀请客人开放“确认到店”功能。', |
| 716 | '被邀客人点击确认到店后,方便请客人了解被邀客人是否确认,同时,被邀客人的信息会加入到餐厅客户池中,方便餐厅维护客户。', | 784 | '被邀客人点击确认到店后,方便请客人了解被邀客人是否确认,同时,被邀客人的信息会加入到餐厅客户池中,方便餐厅维护客户。', |
| 717 | onTap: () { | 785 | onTap: () { |
| 718 | setState(() { | 786 | setState(() { |
| 719 | - is_arrival = !is_arrival; | 787 | + isArrival = !isArrival; |
| 720 | }); | 788 | }); |
| 721 | - }, select: is_arrival), | 789 | + }, select: isArrival), |
| 722 | _storeItemWidget('向客人开放“在线预订”功能。', | 790 | _storeItemWidget('向客人开放“在线预订”功能。', |
| 723 | '客人和被邀客人可以通过邀请函,直接点击在线预订,向商家提交预订需求,无需通过电话,经理可以详细了解客户需求并安排预订。', | 791 | '客人和被邀客人可以通过邀请函,直接点击在线预订,向商家提交预订需求,无需通过电话,经理可以详细了解客户需求并安排预订。', |
| 724 | onTap: () { | 792 | onTap: () { |
| 725 | setState(() { | 793 | setState(() { |
| 726 | - is_online_book = !is_online_book; | 794 | + isOnlineBook = !isOnlineBook; |
| 727 | }); | 795 | }); |
| 728 | - }, select: is_online_book), | 796 | + }, select: isOnlineBook), |
| 729 | _storeItemWidget('向被邀请客人开放“提前点餐”功能。', | 797 | _storeItemWidget('向被邀请客人开放“提前点餐”功能。', |
| 730 | '请客人从预定安排直接预先选菜,到店后确认下单,无需服务员花费时间给客户点餐,可以为餐厅节源提效。', | 798 | '请客人从预定安排直接预先选菜,到店后确认下单,无需服务员花费时间给客户点餐,可以为餐厅节源提效。', |
| 731 | onTap: () { | 799 | onTap: () { |
| 732 | setState(() { | 800 | setState(() { |
| 733 | - is_order = !is_order; | 801 | + isOrder = !isOrder; |
| 734 | }); | 802 | }); |
| 735 | - }, select: is_order), | 803 | + }, select: isOrder), |
| 804 | + VEmptyView(24), | ||
| 805 | + _headItem('预订安排中附带的营销推广'), | ||
| 736 | VEmptyView(24), | 806 | VEmptyView(24), |
| 737 | - // _headItem('预订安排中附带的营销推广'), | ||
| 738 | - // VEmptyView(24), | ||
| 739 | - // couponProvider.couponListSelect.length > 0 | ||
| 740 | - // ? _markingItem('推荐店内代金券优惠', couponProvider.couponListSelect[0].aname, | ||
| 741 | - // couponProvider.couponListSelect[0].desc, '100', '5折', onPressed: () { | ||
| 742 | - // NavigatorUtil.goMarkingCouponSelectPage( | ||
| 743 | - // context, | ||
| 744 | - // ); | ||
| 745 | - // }) | ||
| 746 | - // : SizedBox(), | ||
| 747 | - // _markingItem( | ||
| 748 | - // '推荐店内充值单一优惠活动', | ||
| 749 | - // '充1000赠300', | ||
| 750 | - // '会员充值满1000元赠余额200元;\n会员充值满1000元赠余额200元;\n会员充值满1000元赠余额200元;', | ||
| 751 | - // '', | ||
| 752 | - // ''), | 807 | + couponData != null |
| 808 | + ? _markingItem('推荐店内代金券优惠', couponData.aname, | ||
| 809 | + couponData.desc, '100', '5折', select: isCoupon, | ||
| 810 | + onPressedSelect: () { | ||
| 811 | + setState(() { | ||
| 812 | + isCoupon = !isCoupon; | ||
| 813 | + }); | ||
| 814 | + }, onPressed: () async { | ||
| 815 | + //切换活动 | ||
| 816 | + Map temp = | ||
| 817 | + await NavigatorUtil.goMarkingCouponSelectPage( | ||
| 818 | + context, couponData.id); | ||
| 819 | + if (temp['coupon'] != null) { | ||
| 820 | + couponData = temp['coupon']; | ||
| 821 | + | ||
| 822 | + setState(() {}); | ||
| 823 | + } | ||
| 824 | + }) | ||
| 825 | + : SizedBox(), | ||
| 826 | + rechargeData != null | ||
| 827 | + ? _markingItem('推荐店内充值单一优惠活动', rechargeData.rname, | ||
| 828 | + rechargeContent, '', '', select: isRecharge, | ||
| 829 | + onPressedSelect: () { | ||
| 830 | + setState(() { | ||
| 831 | + isRecharge = !isRecharge; | ||
| 832 | + }); | ||
| 833 | + }, onPressed: () async { | ||
| 834 | + //切换活动 | ||
| 835 | + Map temp = | ||
| 836 | + await NavigatorUtil.goMarkingRechargeSelectPage( | ||
| 837 | + context, rechargeData.id); | ||
| 838 | + if (temp['recharge'] != null) { | ||
| 839 | + rechargeData = temp['recharge']; | ||
| 840 | + _getRechargeContent(); | ||
| 841 | + setState(() {}); | ||
| 842 | + } | ||
| 843 | + }) | ||
| 844 | + : SizedBox(), | ||
| 753 | _markingOtherItem() | 845 | _markingOtherItem() |
| 754 | ], | 846 | ], |
| 755 | ), | 847 | ), |
| @@ -785,17 +877,19 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -785,17 +877,19 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 785 | 877 | ||
| 786 | //接口 | 878 | //接口 |
| 787 | Map marketingData = { | 879 | Map marketingData = { |
| 788 | - // 'is_transpond': is_transpond ? '1' : '0', //转发同行客人 | 880 | + // 'isTranspond': isTranspond ? '1' : '0', //转发同行客人 |
| 789 | 'is_transpond': '1', //转发同行客人 | 881 | 'is_transpond': '1', //转发同行客人 |
| 790 | - 'is_arrival': is_arrival ? '1' : '0', //确认到店 | ||
| 791 | - 'is_online_book': is_online_book ? '1' : '0', //在线预订 | ||
| 792 | - 'is_order': is_order ? '1' : '0', //去点餐 | ||
| 793 | - 'is_coupon': '0', //代金券暂时 | ||
| 794 | - 'is_recharge': '0', //充值券暂时 | ||
| 795 | - // 'is_link': is_link ? '1' : '0', | ||
| 796 | - 'is_link': '0', | 882 | + 'is_arrival': isArrival ? '1' : '0', //确认到店 |
| 883 | + 'is_online_book': isOnlineBook ? '1' : '0', //在线预订 | ||
| 884 | + 'is_order': isOrder ? '1' : '0', //去点餐 | ||
| 885 | + 'is_coupon': isCoupon ? '1' : '0', //代金券暂时 | ||
| 886 | + 'is_recharge': isRecharge ? '1' : '0', //充值券暂时 | ||
| 887 | + 'is_link': isLink ? '1' : '0', | ||
| 888 | + // 'is_link': '0', | ||
| 797 | 'wecomle': welcomeTextC.text ?? '', | 889 | 'wecomle': welcomeTextC.text ?? '', |
| 798 | 'logo': _uploadImageProvider.firstImage.qiniuUrl, | 890 | 'logo': _uploadImageProvider.firstImage.qiniuUrl, |
| 891 | + 'recharge_data': rechargeData, | ||
| 892 | + 'coupon_data': couponData | ||
| 799 | }; | 893 | }; |
| 800 | Map<String, String> params = { | 894 | Map<String, String> params = { |
| 801 | 'sid': Provider.of<UserModel>(context, listen: false) | 895 | 'sid': Provider.of<UserModel>(context, listen: false) |
| @@ -7,6 +7,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | @@ -7,6 +7,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 7 | import 'package:provider/provider.dart'; | 7 | import 'package:provider/provider.dart'; |
| 8 | 8 | ||
| 9 | import '../../../../constant/state.dart'; | 9 | import '../../../../constant/state.dart'; |
| 10 | +import '../../../../models/recharge_list_model.dart'; | ||
| 10 | import '../../../../models/theme_color_model.dart'; | 11 | import '../../../../models/theme_color_model.dart'; |
| 11 | import '../../../../provider/marketing_center_provider.dart'; | 12 | import '../../../../provider/marketing_center_provider.dart'; |
| 12 | import '../../../../provider/upload_img_provider.dart'; | 13 | import '../../../../provider/upload_img_provider.dart'; |
| @@ -44,6 +45,8 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | @@ -44,6 +45,8 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | ||
| 44 | 45 | ||
| 45 | UploadImageProvider _uploadImageProvider; | 46 | UploadImageProvider _uploadImageProvider; |
| 46 | 47 | ||
| 48 | + String rechargeContent; | ||
| 49 | + | ||
| 47 | @override | 50 | @override |
| 48 | void initState() { | 51 | void initState() { |
| 49 | super.initState(); | 52 | super.initState(); |
| @@ -59,6 +62,22 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | @@ -59,6 +62,22 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | ||
| 59 | super.dispose(); | 62 | super.dispose(); |
| 60 | } | 63 | } |
| 61 | 64 | ||
| 65 | + _getRechargeContent(RechargeListSunModel rechargeData) { | ||
| 66 | + rechargeContent = ''; | ||
| 67 | + if (rechargeData.rechargeList.isPrice == '1') { | ||
| 68 | + rechargeContent += | ||
| 69 | + '会员充值满${rechargeData.rechargeMoney}元赠余额${rechargeData.rechargeList.price}元;'; | ||
| 70 | + } | ||
| 71 | + if (rechargeData.rechargeList.isScore == '1') { | ||
| 72 | + rechargeContent += | ||
| 73 | + '\n会员充值满${rechargeData.rechargeMoney}元赠${rechargeData.rechargeList.score}积分;'; | ||
| 74 | + } | ||
| 75 | + if (rechargeData.rechargeList.isCoupons == '1') { | ||
| 76 | + rechargeContent += | ||
| 77 | + '\n会员充值满${rechargeData.rechargeMoney}元赠${Utils.listToStringEnglish3(rechargeData.rechargeList.couponsNames)}。'; | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + | ||
| 62 | ///初始化主题颜色 | 81 | ///初始化主题颜色 |
| 63 | _initThemeColor() { | 82 | _initThemeColor() { |
| 64 | // int colorValue = App.sp.get("themeColor"); | 83 | // int colorValue = App.sp.get("themeColor"); |
| @@ -195,6 +214,13 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | @@ -195,6 +214,13 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | ||
| 195 | homeSlogan = _marketingCenterProvider.markDataModel.home.slogan; | 214 | homeSlogan = _marketingCenterProvider.markDataModel.home.slogan; |
| 196 | homeImage = _marketingCenterProvider.markDataModel.home.image ?? null; | 215 | homeImage = _marketingCenterProvider.markDataModel.home.image ?? null; |
| 197 | } | 216 | } |
| 217 | + if (_marketingCenterProvider.markDataModel.marketing != null) { | ||
| 218 | + if (_marketingCenterProvider.markDataModel.marketing.isRecharge == | ||
| 219 | + '1') { | ||
| 220 | + _getRechargeContent( | ||
| 221 | + _marketingCenterProvider.markDataModel.marketing.rechargeData); | ||
| 222 | + } | ||
| 223 | + } | ||
| 198 | setState(() {}); | 224 | setState(() {}); |
| 199 | } | 225 | } |
| 200 | } | 226 | } |
| @@ -1114,6 +1140,184 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | @@ -1114,6 +1140,184 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | ||
| 1114 | ); | 1140 | ); |
| 1115 | } | 1141 | } |
| 1116 | 1142 | ||
| 1143 | + ///营销推广 | ||
| 1144 | + Widget _markingItem( | ||
| 1145 | + String selectTitle, | ||
| 1146 | + String title, | ||
| 1147 | + String content, | ||
| 1148 | + String subtile, | ||
| 1149 | + String discount, | ||
| 1150 | + String btnTtile, { | ||
| 1151 | + VoidCallback onPressed, | ||
| 1152 | + bool select = false, | ||
| 1153 | + VoidCallback onPressedSelect, | ||
| 1154 | + }) { | ||
| 1155 | + return Container( | ||
| 1156 | + margin: EdgeInsets.only(bottom: w(12)), | ||
| 1157 | + child: Column( | ||
| 1158 | + children: [ | ||
| 1159 | + // InkWell( | ||
| 1160 | + // onTap: onPressedSelect, | ||
| 1161 | + // child: Row( | ||
| 1162 | + // children: [ | ||
| 1163 | + // Image.asset( | ||
| 1164 | + // Utils.getImgPath(select ? 'f_select' : 'f_select_not'), | ||
| 1165 | + // width: w(20), | ||
| 1166 | + // ), | ||
| 1167 | + // HEmptyView(20), | ||
| 1168 | + // Text( | ||
| 1169 | + // selectTitle, | ||
| 1170 | + // style: TextStyle( | ||
| 1171 | + // fontSize: font(14), color: MyColours.color_515151), | ||
| 1172 | + // ) | ||
| 1173 | + // ], | ||
| 1174 | + // )), | ||
| 1175 | + // VEmptyView(20), | ||
| 1176 | + Container( | ||
| 1177 | + padding: EdgeInsets.all(w(12)), | ||
| 1178 | + decoration: BoxDecoration( | ||
| 1179 | + borderRadius: BorderRadiusDirectional.circular(r(8)), | ||
| 1180 | + border: Border.all(width: w(1), color: MyColours.color_DBDBDB)), | ||
| 1181 | + child: Row( | ||
| 1182 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 1183 | + children: [ | ||
| 1184 | + Column( | ||
| 1185 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 1186 | + children: [ | ||
| 1187 | + Row( | ||
| 1188 | + children: [ | ||
| 1189 | + Text( | ||
| 1190 | + title, | ||
| 1191 | + style: TextStyle( | ||
| 1192 | + fontSize: font(14), | ||
| 1193 | + fontWeight: FontWeight.bold, | ||
| 1194 | + color: MyColours.color_515151), | ||
| 1195 | + ), | ||
| 1196 | + HEmptyView(20), | ||
| 1197 | + subtile != '' | ||
| 1198 | + ? Text( | ||
| 1199 | + '¥${subtile}', | ||
| 1200 | + style: TextStyle( | ||
| 1201 | + fontSize: font(7), | ||
| 1202 | + fontWeight: FontWeight.bold, | ||
| 1203 | + color: MyColours.color_E34D59), | ||
| 1204 | + ) | ||
| 1205 | + : SizedBox(), | ||
| 1206 | + HEmptyView(10), | ||
| 1207 | + discount != '' | ||
| 1208 | + ? Container( | ||
| 1209 | + padding: EdgeInsets.symmetric( | ||
| 1210 | + horizontal: w(3), vertical: w(2)), | ||
| 1211 | + decoration: BoxDecoration( | ||
| 1212 | + borderRadius: BorderRadius.circular(r(3)), | ||
| 1213 | + border: Border.all( | ||
| 1214 | + width: w(0.5), | ||
| 1215 | + color: MyColours.color_E34D59)), | ||
| 1216 | + child: Text( | ||
| 1217 | + discount, | ||
| 1218 | + style: TextStyle( | ||
| 1219 | + color: MyColours.color_E34D59, | ||
| 1220 | + fontSize: font(7)), | ||
| 1221 | + ), | ||
| 1222 | + ) | ||
| 1223 | + : SizedBox(), | ||
| 1224 | + ], | ||
| 1225 | + ), | ||
| 1226 | + VEmptyView(20), | ||
| 1227 | + Text( | ||
| 1228 | + content, | ||
| 1229 | + style: TextStyle( | ||
| 1230 | + height: 1.2, | ||
| 1231 | + fontSize: font(10), | ||
| 1232 | + fontWeight: FontWeight.bold, | ||
| 1233 | + color: MyColours.color_515151), | ||
| 1234 | + ) | ||
| 1235 | + ], | ||
| 1236 | + ), | ||
| 1237 | + Container( | ||
| 1238 | + width: w(72), | ||
| 1239 | + height: w(22), | ||
| 1240 | + alignment: Alignment.center, | ||
| 1241 | + decoration: BoxDecoration( | ||
| 1242 | + borderRadius: BorderRadius.circular(r(11)), | ||
| 1243 | + gradient: LinearGradient( | ||
| 1244 | + stops: [ | ||
| 1245 | + -0.57, | ||
| 1246 | + 0.55, | ||
| 1247 | + 1.48 | ||
| 1248 | + ], | ||
| 1249 | + colors: [ | ||
| 1250 | + MyColours.color_4C8DAD, | ||
| 1251 | + MyColours.color_0143A3, | ||
| 1252 | + MyColours.color_42A5FF | ||
| 1253 | + ], | ||
| 1254 | + begin: Alignment.topLeft, | ||
| 1255 | + end: Alignment.bottomRight)), | ||
| 1256 | + child: Text( | ||
| 1257 | + btnTtile, | ||
| 1258 | + style: TextStyle( | ||
| 1259 | + fontSize: font(12), | ||
| 1260 | + color: MyColours.color_F8F9FD, | ||
| 1261 | + fontWeight: FontWeight.bold), | ||
| 1262 | + )), | ||
| 1263 | + ], | ||
| 1264 | + ), | ||
| 1265 | + ) | ||
| 1266 | + ], | ||
| 1267 | + ), | ||
| 1268 | + ); | ||
| 1269 | + } | ||
| 1270 | + | ||
| 1271 | + _rechargeWiddget() { | ||
| 1272 | + return Container( | ||
| 1273 | + padding: EdgeInsets.symmetric(horizontal: w(20), vertical: w(8)), | ||
| 1274 | + child: Column( | ||
| 1275 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 1276 | + children: [ | ||
| 1277 | + Text( | ||
| 1278 | + '特别优惠', | ||
| 1279 | + style: TextStyle( | ||
| 1280 | + color: MyColours.color_515151, | ||
| 1281 | + fontSize: font(18), | ||
| 1282 | + fontWeight: FontWeight.bold), | ||
| 1283 | + ), | ||
| 1284 | + VEmptyView(20), | ||
| 1285 | + _marketingCenterProvider.markDataModel.marketing.isCoupon == '1' | ||
| 1286 | + ? _markingItem( | ||
| 1287 | + '推荐店内代金券优惠', | ||
| 1288 | + _marketingCenterProvider | ||
| 1289 | + .markDataModel.marketing.couponData.aname, | ||
| 1290 | + _marketingCenterProvider | ||
| 1291 | + .markDataModel.marketing.couponData.desc, | ||
| 1292 | + '100', | ||
| 1293 | + '5折', | ||
| 1294 | + '去抢购' | ||
| 1295 | + | ||
| 1296 | + ) | ||
| 1297 | + : SizedBox(), | ||
| 1298 | + _marketingCenterProvider.markDataModel.marketing.isRecharge == '1' | ||
| 1299 | + ? _markingItem( | ||
| 1300 | + '推荐店内充值单一优惠活动', | ||
| 1301 | + _marketingCenterProvider | ||
| 1302 | + .markDataModel.marketing.rechargeData.rname, | ||
| 1303 | + rechargeContent, | ||
| 1304 | + '', | ||
| 1305 | + '', | ||
| 1306 | + '去充值' | ||
| 1307 | + ) | ||
| 1308 | + : SizedBox(), | ||
| 1309 | + VEmptyView(20), | ||
| 1310 | + // MyDivider( | ||
| 1311 | + // double.infinity, | ||
| 1312 | + // w(0.5), | ||
| 1313 | + // color: MyColours.color_DBDBDB, | ||
| 1314 | + // ), | ||
| 1315 | + // VEmptyView(16), | ||
| 1316 | + ], | ||
| 1317 | + ), | ||
| 1318 | + ); | ||
| 1319 | + } | ||
| 1320 | + | ||
| 1117 | ///logo + 优惠政策链接 | 1321 | ///logo + 优惠政策链接 |
| 1118 | /// | 1322 | /// |
| 1119 | Widget _logoWidget() { | 1323 | Widget _logoWidget() { |
| @@ -1264,6 +1468,15 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | @@ -1264,6 +1468,15 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | ||
| 1264 | '1' | 1468 | '1' |
| 1265 | ? _orderWidget() | 1469 | ? _orderWidget() |
| 1266 | : SizedBox(), | 1470 | : SizedBox(), |
| 1471 | + _marketingCenterProvider.markDataModel.marketing != null && | ||
| 1472 | + (_marketingCenterProvider | ||
| 1473 | + .markDataModel.marketing.isRecharge == | ||
| 1474 | + '1' || | ||
| 1475 | + _marketingCenterProvider | ||
| 1476 | + .markDataModel.marketing.isCoupon == | ||
| 1477 | + '1') | ||
| 1478 | + ? _rechargeWiddget() | ||
| 1479 | + : SizedBox(), | ||
| 1267 | _marketingCenterProvider.markDataModel.marketing != null | 1480 | _marketingCenterProvider.markDataModel.marketing != null |
| 1268 | ? _logoWidget() | 1481 | ? _logoWidget() |
| 1269 | : SizedBox() | 1482 | : SizedBox() |
| 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/pages/my/marketing_center/recharge/recharge_item.dart'; | ||
| 9 | +import 'package:one_key/provider/SmsModel.dart'; | ||
| 10 | +import 'package:one_key/provider/coupon_provider.dart'; | ||
| 11 | +import 'package:one_key/provider/marketing_center_provider.dart'; | ||
| 12 | +import 'package:one_key/provider/user_model.dart'; | ||
| 13 | +import 'package:one_key/res/colors.dart'; | ||
| 14 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 15 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 16 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 17 | +import 'package:one_key/utils/utils.dart'; | ||
| 18 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 19 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 20 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 21 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 22 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 23 | +import 'package:provider/provider.dart'; | ||
| 24 | +import 'package:sendsms/sendsms.dart'; | ||
| 25 | +// import 'package:sendsms/sendsms.dart'; | ||
| 26 | +import 'package:flutter_sms/flutter_sms.dart'; | ||
| 27 | + | ||
| 28 | +import '../../../../models/recharge_list_model.dart'; | ||
| 29 | + | ||
| 30 | +/** | ||
| 31 | + * 优惠券单选页面 | ||
| 32 | + */ | ||
| 33 | +class MarkingRechargeSelectPage extends StatefulWidget { | ||
| 34 | + final String selectid; | ||
| 35 | + MarkingRechargeSelectPage({Key key, this.selectid}) : super(key: key); | ||
| 36 | + | ||
| 37 | + @override | ||
| 38 | + _MarkingRechargeSelectPageState createState() => | ||
| 39 | + _MarkingRechargeSelectPageState(); | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +class _MarkingRechargeSelectPageState extends State<MarkingRechargeSelectPage> { | ||
| 43 | + EasyRefreshController _controller = EasyRefreshController(); | ||
| 44 | + MarketingCenterProvider marketingCenterProvider; | ||
| 45 | + RechargeListSunModel selectData; | ||
| 46 | + | ||
| 47 | + @override | ||
| 48 | + void initState() { | ||
| 49 | + // TODO: implement initState | ||
| 50 | + super.initState(); | ||
| 51 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 52 | + // if (!couponProvider.hasModify) { | ||
| 53 | + _getNewRechargeList(); | ||
| 54 | + // } else { | ||
| 55 | + // couponProvider.pageStateSelect = PageState.Success; | ||
| 56 | + // // couponProvider.notifyListeners(); | ||
| 57 | + // } | ||
| 58 | + }); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @override | ||
| 62 | + void dispose() { | ||
| 63 | + super.dispose(); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + ///获取优惠券列表数据 | ||
| 67 | + /// | ||
| 68 | + _getNewRechargeList() async { | ||
| 69 | + await marketingCenterProvider.getNewRechargeList(context); | ||
| 70 | + outerloop: | ||
| 71 | + for (var i = 0; i < marketingCenterProvider.rechargeList.length; i++) { | ||
| 72 | + if (marketingCenterProvider.rechargeList[i].id == widget.selectid) { | ||
| 73 | + marketingCenterProvider.rechargeList[i].isCheck = true; | ||
| 74 | + selectData = marketingCenterProvider.rechargeList[i]; | ||
| 75 | + break outerloop; | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + setState(() {}); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @override | ||
| 82 | + Widget build(BuildContext context) { | ||
| 83 | + marketingCenterProvider = | ||
| 84 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 85 | + return Scaffold( | ||
| 86 | + backgroundColor: MyColours.color_ffffff, | ||
| 87 | + appBar: SystemAppBar( | ||
| 88 | + '优惠券', | ||
| 89 | + onTap: () { | ||
| 90 | + Navigator.pop(context); | ||
| 91 | + }, | ||
| 92 | + ), | ||
| 93 | + body: WillPopScope( | ||
| 94 | + child: Column( | ||
| 95 | + children: [ | ||
| 96 | + Expanded(child: Consumer<MarketingCenterProvider>( | ||
| 97 | + builder: (context, model, _) { | ||
| 98 | + if (model.pageStateRechargeHome != PageState.Success) { | ||
| 99 | + return ExceptionPage( | ||
| 100 | + pageState: model.pageStateRechargeHome, | ||
| 101 | + callback: () { | ||
| 102 | + _getNewRechargeList(); | ||
| 103 | + // offset = 0; | ||
| 104 | + // getMessage(showLoading: true); | ||
| 105 | + }, | ||
| 106 | + emptyMsg: "暂时没有列表信息哦", | ||
| 107 | + emptyImg: "empty_search", | ||
| 108 | + showMsg: "加载中,请稍后...", | ||
| 109 | + ); | ||
| 110 | + } else { | ||
| 111 | + return EasyRefresh.custom( | ||
| 112 | + controller: _controller, | ||
| 113 | + shrinkWrap: true, | ||
| 114 | + slivers: [ | ||
| 115 | + SliverList( | ||
| 116 | + delegate: SliverChildBuilderDelegate( | ||
| 117 | + (BuildContext context, int index) { | ||
| 118 | + return VEmptyView(40); | ||
| 119 | + }, childCount: 1), | ||
| 120 | + ), | ||
| 121 | + SliverList( | ||
| 122 | + delegate: SliverChildBuilderDelegate( | ||
| 123 | + (BuildContext context, int index) { | ||
| 124 | + return InkWell( | ||
| 125 | + onTap: () { | ||
| 126 | + //改这里 ******8 | ||
| 127 | + marketingCenterProvider.rechargeList | ||
| 128 | + .forEach((element) { | ||
| 129 | + element.isCheck = false; | ||
| 130 | + }); | ||
| 131 | + | ||
| 132 | + marketingCenterProvider | ||
| 133 | + .rechargeList[index].isCheck = true; | ||
| 134 | + selectData = | ||
| 135 | + marketingCenterProvider.rechargeList[index]; | ||
| 136 | + }, | ||
| 137 | + // child: Row( | ||
| 138 | + // children: [ | ||
| 139 | + // HEmptyView(30), | ||
| 140 | + // !widget.hasModify | ||
| 141 | + // ? Checkbox( | ||
| 142 | + // value: couponProvider | ||
| 143 | + // .couponListSelect[index].isCheck, | ||
| 144 | + // checkColor: MyColours.color_ffffff, | ||
| 145 | + // activeColor: MyColours.app_main, | ||
| 146 | + // onChanged: (bool value) {}, | ||
| 147 | + // ) | ||
| 148 | + // : Container(), | ||
| 149 | + // Image.asset( | ||
| 150 | + // couponProvider.listData[index]['checked'] | ||
| 151 | + // ? 'assets/select.png' | ||
| 152 | + // : 'assets/unselect.png', | ||
| 153 | + // width: ScreenUtil().setWidth(44)), | ||
| 154 | + child: RechargeItem( | ||
| 155 | + from: 'select', | ||
| 156 | + showCheck: true, | ||
| 157 | + rechargeListSunModel: marketingCenterProvider | ||
| 158 | + .rechargeList[index], | ||
| 159 | + onPressed: () { | ||
| 160 | + // bool old = couponProvider | ||
| 161 | + // .couponListSelect[index].isCheck; | ||
| 162 | + //改这里 ******8 | ||
| 163 | + marketingCenterProvider.rechargeList | ||
| 164 | + .forEach((element) { | ||
| 165 | + element.isCheck = false; | ||
| 166 | + }); | ||
| 167 | + | ||
| 168 | + marketingCenterProvider | ||
| 169 | + .rechargeList[index].isCheck = true; | ||
| 170 | + | ||
| 171 | + selectData = marketingCenterProvider | ||
| 172 | + .rechargeList[index]; | ||
| 173 | + | ||
| 174 | + // couponProvider | ||
| 175 | + // .couponListSelect[index].isCheck = !old; | ||
| 176 | + setState(() {}); | ||
| 177 | + })); | ||
| 178 | + }, | ||
| 179 | + childCount: | ||
| 180 | + marketingCenterProvider.rechargeList.length), | ||
| 181 | + ) | ||
| 182 | + ], | ||
| 183 | + // onRefresh: () async { | ||
| 184 | + // // offset = 0; | ||
| 185 | + // // getMessage(showLoading: false); | ||
| 186 | + // }, | ||
| 187 | + // onLoad: () async { | ||
| 188 | + // // offset++; | ||
| 189 | + // // getMessage(showLoading: false); | ||
| 190 | + // }, | ||
| 191 | + ); | ||
| 192 | + } | ||
| 193 | + }, | ||
| 194 | + )), | ||
| 195 | + VEmptyView(20), | ||
| 196 | + marketingCenterProvider.pageStateRechargeHome == PageState.Success | ||
| 197 | + ? Padding( | ||
| 198 | + padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0, | ||
| 199 | + ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), | ||
| 200 | + child: RoundButton( | ||
| 201 | + onPressed: () async { | ||
| 202 | + Map temp = { | ||
| 203 | + 'recharge': selectData, | ||
| 204 | + }; | ||
| 205 | + Navigator.pop(context, temp); | ||
| 206 | + }, | ||
| 207 | + text: '确定', | ||
| 208 | + fontSize: 34, | ||
| 209 | + isBold: false, | ||
| 210 | + height: ScreenUtil().setWidth(80), | ||
| 211 | + width: double.infinity, | ||
| 212 | + radius: ScreenUtil().setWidth(10), | ||
| 213 | + )) | ||
| 214 | + : Container() | ||
| 215 | + ], | ||
| 216 | + ), | ||
| 217 | + onWillPop: () async { | ||
| 218 | + Utils.changeStatusColor(color: Colors.transparent); | ||
| 219 | + Navigator.of(context).pop(); | ||
| 220 | + return true; | ||
| 221 | + }, | ||
| 222 | + ), | ||
| 223 | + ); | ||
| 224 | + } | ||
| 225 | +} |
| 1 | -import 'package:common_utils/common_utils.dart'; | ||
| 2 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 3 | -import 'package:flutter_picker/Picker.dart'; | 2 | + |
| 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | 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'; | 4 | + |
| 5 | +import 'package:one_key/provider/marketing_center_provider.dart'; | ||
| 7 | import 'package:one_key/route/navigator_util.dart'; | 6 | import 'package:one_key/route/navigator_util.dart'; |
| 7 | + | ||
| 8 | import 'package:one_key/widgets/MyDivider.dart'; | 8 | import 'package:one_key/widgets/MyDivider.dart'; |
| 9 | import 'package:one_key/widgets/system_app_bar.dart'; | 9 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 10 | +import 'package:provider/provider.dart'; | ||
| 10 | 11 | ||
| 12 | +import '../../../../constant/state.dart'; | ||
| 11 | import '../../../../res/colors.dart'; | 13 | import '../../../../res/colors.dart'; |
| 12 | -import '../../../../utils/dialog_util.dart'; | 14 | + |
| 13 | import '../../../../utils/screen_util.dart'; | 15 | import '../../../../utils/screen_util.dart'; |
| 14 | import '../../../../utils/utils.dart'; | 16 | import '../../../../utils/utils.dart'; |
| 15 | import '../../../../widgets/h_empty_view.dart'; | 17 | import '../../../../widgets/h_empty_view.dart'; |
| 16 | -import '../../../../widgets/round_button.dart'; | 18 | +import '../../../../widgets/page_exception.dart'; |
| 19 | + | ||
| 17 | import '../../../../widgets/v_empty_view.dart'; | 20 | import '../../../../widgets/v_empty_view.dart'; |
| 18 | 21 | ||
| 19 | /** | 22 | /** |
| @@ -22,124 +25,30 @@ import '../../../../widgets/v_empty_view.dart'; | @@ -22,124 +25,30 @@ import '../../../../widgets/v_empty_view.dart'; | ||
| 22 | */ | 25 | */ |
| 23 | 26 | ||
| 24 | class RechargeDetailPage extends StatefulWidget { | 27 | class RechargeDetailPage extends StatefulWidget { |
| 25 | - RechargeDetailPage({Key key}) : super(key: key); | 28 | + final String idstr; |
| 29 | + RechargeDetailPage({Key key, this.idstr}) : super(key: key); | ||
| 26 | 30 | ||
| 27 | @override | 31 | @override |
| 28 | _RechargeDetailPageState createState() => _RechargeDetailPageState(); | 32 | _RechargeDetailPageState createState() => _RechargeDetailPageState(); |
| 29 | } | 33 | } |
| 30 | 34 | ||
| 31 | class _RechargeDetailPageState extends State<RechargeDetailPage> { | 35 | class _RechargeDetailPageState extends State<RechargeDetailPage> { |
| 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 | - bool givePriceSwich = false; | ||
| 61 | - bool giveScoreSwich = false; | ||
| 62 | - bool giveCouponsSwich = false; | 36 | + MarketingCenterProvider marketingCenterProvider; |
| 63 | 37 | ||
| 64 | @override | 38 | @override |
| 65 | void initState() { | 39 | void initState() { |
| 66 | super.initState(); | 40 | super.initState(); |
| 67 | 41 | ||
| 68 | - _initWeekData(); | ||
| 69 | - | ||
| 70 | - nameF.addListener(() { | ||
| 71 | - if (nameF.hasFocus) { | ||
| 72 | - //有焦点 | ||
| 73 | - if (showDateSelWidget) { | ||
| 74 | - Navigator.pop(context); | ||
| 75 | - showDateSelWidget = false; | ||
| 76 | - } | ||
| 77 | - } else { | ||
| 78 | - //失去焦点 | ||
| 79 | - // _editingController.text = ''; | ||
| 80 | - } | ||
| 81 | - }); | ||
| 82 | - priceminF.addListener(() { | ||
| 83 | - if (priceminF.hasFocus) { | ||
| 84 | - //有焦点 | ||
| 85 | - if (showDateSelWidget) { | ||
| 86 | - Navigator.pop(context); | ||
| 87 | - showDateSelWidget = false; | ||
| 88 | - } | ||
| 89 | - } else { | ||
| 90 | - //失去焦点 | ||
| 91 | - // _editingController.text = ''; | ||
| 92 | - } | ||
| 93 | - }); | ||
| 94 | - givePricF.addListener(() { | ||
| 95 | - if (givePricF.hasFocus) { | ||
| 96 | - //有焦点 | ||
| 97 | - if (showDateSelWidget) { | ||
| 98 | - Navigator.pop(context); | ||
| 99 | - showDateSelWidget = false; | ||
| 100 | - } | ||
| 101 | - } else { | ||
| 102 | - //失去焦点 | ||
| 103 | - // _editingController.text = ''; | ||
| 104 | - } | ||
| 105 | - }); | ||
| 106 | - giveScoreF.addListener(() { | ||
| 107 | - if (giveScoreF.hasFocus) { | ||
| 108 | - //有焦点 | ||
| 109 | - if (showDateSelWidget) { | ||
| 110 | - Navigator.pop(context); | ||
| 111 | - showDateSelWidget = false; | ||
| 112 | - } | ||
| 113 | - } else { | ||
| 114 | - //失去焦点 | ||
| 115 | - // _editingController.text = ''; | ||
| 116 | - } | ||
| 117 | - }); | ||
| 118 | - remarkF.addListener(() { | ||
| 119 | - if (remarkF.hasFocus) { | ||
| 120 | - //有焦点 | ||
| 121 | - if (showDateSelWidget) { | ||
| 122 | - Navigator.pop(context); | ||
| 123 | - showDateSelWidget = false; | ||
| 124 | - } | ||
| 125 | - } else { | ||
| 126 | - //失去焦点 | ||
| 127 | - // _editingController.text = ''; | 42 | + WidgetsBinding.instance.addPostFrameCallback((_) { |
| 43 | + if (widget.idstr != null && widget.idstr != 'null') { | ||
| 44 | + _getNewRechargeDetail(); | ||
| 128 | } | 45 | } |
| 129 | }); | 46 | }); |
| 130 | } | 47 | } |
| 131 | 48 | ||
| 132 | - _initWeekData() { | ||
| 133 | - FilterBtnModel filterBtnModel = FilterBtnModel(); | ||
| 134 | - filterBtnModel.select = false; | ||
| 135 | - filterBtnModel.title = '周日'; | ||
| 136 | - weekData.add(filterBtnModel); | ||
| 137 | - for (int i = 1; i < 7; i++) { | ||
| 138 | - FilterBtnModel filterBtnModel = FilterBtnModel(); | ||
| 139 | - filterBtnModel.select = false; | ||
| 140 | - filterBtnModel.title = '周${Utils.formatWeekDayNum(i)}'; | ||
| 141 | - weekData.add(filterBtnModel); | ||
| 142 | - } | 49 | + _getNewRechargeDetail() async { |
| 50 | + bool success = await marketingCenterProvider.getNewRechargeDetail( | ||
| 51 | + context, widget.idstr); | ||
| 143 | } | 52 | } |
| 144 | 53 | ||
| 145 | ///输入框 | 54 | ///输入框 |
| @@ -173,55 +82,12 @@ class _RechargeDetailPageState extends State<RechargeDetailPage> { | @@ -173,55 +82,12 @@ class _RechargeDetailPageState extends State<RechargeDetailPage> { | ||
| 173 | ); | 82 | ); |
| 174 | } | 83 | } |
| 175 | 84 | ||
| 176 | - ///时间选择 | ||
| 177 | - Widget _select(String title, String hintText, GestureTapCallback onTap) { | ||
| 178 | - return InkWell( | ||
| 179 | - onTap: onTap, | ||
| 180 | - child: Container( | ||
| 181 | - padding: EdgeInsets.only(left: ScreenUtil().setWidth(32)), | ||
| 182 | - child: Row( | ||
| 183 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 184 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 185 | - children: [ | ||
| 186 | - Container( | ||
| 187 | - // height: ScreenUtil().setWidth(40), | ||
| 188 | - // color: Colors.red, | ||
| 189 | - child: Text( | ||
| 190 | - title, | ||
| 191 | - style: TextStyle( | ||
| 192 | - color: title == '点击设置可用日期' | ||
| 193 | - ? MyColours.color_999999 | ||
| 194 | - : MyColours.color_515151, | ||
| 195 | - fontSize: ScreenUtil().setSp(32)), | ||
| 196 | - ), | ||
| 197 | - ), | ||
| 198 | - HEmptyView(20), | ||
| 199 | - Spacer(), | ||
| 200 | - Text(hintText, | ||
| 201 | - style: TextStyle( | ||
| 202 | - color: hintText == '点击设置开始日期' || hintText == '点击设置结束日期' | ||
| 203 | - ? MyColours.color_999999 | ||
| 204 | - : MyColours.color_515151, | ||
| 205 | - fontSize: ScreenUtil().setSp(32), | ||
| 206 | - )), | ||
| 207 | - HEmptyView(20), | ||
| 208 | - Image.asset( | ||
| 209 | - Utils.getImgPath('arrow_right_new'), | ||
| 210 | - width: ScreenUtil().setWidth(18), | ||
| 211 | - ), | ||
| 212 | - HEmptyView(32), | ||
| 213 | - ], | ||
| 214 | - ), | ||
| 215 | - ), | ||
| 216 | - ); | ||
| 217 | - } | ||
| 218 | - | ||
| 219 | ///券说明 | 85 | ///券说明 |
| 220 | - Widget _explain(String title, String hintText, | ||
| 221 | - TextEditingController controller, FocusNode node) { | 86 | + Widget _explain( |
| 87 | + String title, | ||
| 88 | + String hintText, | ||
| 89 | + ) { | ||
| 222 | return Container( | 90 | return Container( |
| 223 | - // height: ScreenUtil().setWidth(380), | ||
| 224 | - // padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)), | ||
| 225 | child: Column( | 91 | child: Column( |
| 226 | crossAxisAlignment: CrossAxisAlignment.start, | 92 | crossAxisAlignment: CrossAxisAlignment.start, |
| 227 | children: [ | 93 | children: [ |
| @@ -235,14 +101,10 @@ class _RechargeDetailPageState extends State<RechargeDetailPage> { | @@ -235,14 +101,10 @@ class _RechargeDetailPageState extends State<RechargeDetailPage> { | ||
| 235 | fontSize: ScreenUtil().setSp(32)), | 101 | fontSize: ScreenUtil().setSp(32)), |
| 236 | )), | 102 | )), |
| 237 | VEmptyView(26), | 103 | VEmptyView(26), |
| 238 | - // Container( | ||
| 239 | - // height: ScreenUtil().setWidth(2), | ||
| 240 | - // color: MyColours.color_E7E7E7, | ||
| 241 | - // ), | ||
| 242 | Padding( | 104 | Padding( |
| 243 | padding: EdgeInsets.only(left: w(20)), | 105 | padding: EdgeInsets.only(left: w(20)), |
| 244 | child: Text( | 106 | child: Text( |
| 245 | - 'beihaisehfisehfasfhaise', | 107 | + marketingCenterProvider.rechargeDetail.explain, |
| 246 | 108 | ||
| 247 | // maxLengthEnforced: true, | 109 | // maxLengthEnforced: true, |
| 248 | style: TextStyle( | 110 | style: TextStyle( |
| @@ -254,263 +116,287 @@ class _RechargeDetailPageState extends State<RechargeDetailPage> { | @@ -254,263 +116,287 @@ class _RechargeDetailPageState extends State<RechargeDetailPage> { | ||
| 254 | ); | 116 | ); |
| 255 | } | 117 | } |
| 256 | 118 | ||
| 257 | - _itemRadioWidget(bool select, String title, {GestureTapCallback onTap}) { | ||
| 258 | - return InkWell( | ||
| 259 | - onTap: onTap, | ||
| 260 | - child: Row(children: [ | ||
| 261 | - Image.asset( | ||
| 262 | - Utils.getImgPath( | ||
| 263 | - select ? 'plan_dish_select' : 'plan_dish_unselect'), | ||
| 264 | - width: w(20), | ||
| 265 | - ), | ||
| 266 | - HEmptyView(6), | ||
| 267 | - Text( | ||
| 268 | - title, | ||
| 269 | - style: TextStyle( | ||
| 270 | - color: MyColours.color_515151, | ||
| 271 | - fontSize: ScreenUtil().setSp(32)), | ||
| 272 | - ), | ||
| 273 | - ])); | ||
| 274 | - } | ||
| 275 | - | ||
| 276 | ///是否立即启用 | 119 | ///是否立即启用 |
| 277 | - Widget _canUse(String title, bool swich, GestureTapCallback onTap) { | ||
| 278 | - return InkWell( | ||
| 279 | - onTap: onTap, | ||
| 280 | - child: Container( | ||
| 281 | - // padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)), | ||
| 282 | - // margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)), | ||
| 283 | - child: Row( | ||
| 284 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 285 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 286 | - children: [ | ||
| 287 | - Container( | ||
| 288 | - // height: ScreenUtil().setWidth(40), | ||
| 289 | - // color: Colors.red, | ||
| 290 | - child: Text( | ||
| 291 | - '是否启用', | ||
| 292 | - style: TextStyle( | ||
| 293 | - color: MyColours.color_515151, | ||
| 294 | - fontSize: ScreenUtil().setSp(32)), | ||
| 295 | - ), | ||
| 296 | - ), | ||
| 297 | - Spacer(), | ||
| 298 | - Container( | ||
| 299 | - // height: ScreenUtil().setWidth(40), | ||
| 300 | - // color: Colors.red, | ||
| 301 | - child: Text( | ||
| 302 | - '启用/禁用', | ||
| 303 | - style: TextStyle( | ||
| 304 | - color: MyColours.color_999999, | ||
| 305 | - fontSize: ScreenUtil().setSp(32)), | ||
| 306 | - ), | 120 | + Widget _canUse() { |
| 121 | + return Container( | ||
| 122 | + child: Row( | ||
| 123 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 124 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 125 | + children: [ | ||
| 126 | + Container( | ||
| 127 | + child: Text( | ||
| 128 | + '立即启用', | ||
| 129 | + style: TextStyle( | ||
| 130 | + color: MyColours.color_515151, | ||
| 131 | + fontSize: ScreenUtil().setSp(32)), | ||
| 307 | ), | 132 | ), |
| 308 | - HEmptyView(20) | ||
| 309 | - // Image.asset( | ||
| 310 | - // swich | ||
| 311 | - // ? Utils.getImgPath('swich_on') | ||
| 312 | - // : Utils.getImgPath('swich_off'), | ||
| 313 | - // width: ScreenUtil().setWidth(44 * 2), | ||
| 314 | - // ) | ||
| 315 | - ], | ||
| 316 | - ), | 133 | + ), |
| 134 | + Spacer(), | ||
| 135 | + Image.asset( | ||
| 136 | + marketingCenterProvider.rechargeDetail.isOpen == '1' | ||
| 137 | + ? Utils.getImgPath('swich_on') | ||
| 138 | + : Utils.getImgPath('swich_off'), | ||
| 139 | + width: ScreenUtil().setWidth(44 * 2), | ||
| 140 | + ), | ||
| 141 | + HEmptyView(16) | ||
| 142 | + ], | ||
| 317 | ), | 143 | ), |
| 318 | ); | 144 | ); |
| 319 | } | 145 | } |
| 320 | 146 | ||
| 321 | @override | 147 | @override |
| 322 | Widget build(BuildContext context) { | 148 | Widget build(BuildContext context) { |
| 149 | + marketingCenterProvider = | ||
| 150 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 323 | return Scaffold( | 151 | return Scaffold( |
| 324 | - key: scaffoldKey, | ||
| 325 | - backgroundColor: MyColours.color_ffffff, | ||
| 326 | - appBar: SystemAppBar('充值优惠详情'), | ||
| 327 | - body: Column( | ||
| 328 | - children: [ | ||
| 329 | - Expanded( | ||
| 330 | - child: SingleChildScrollView( | ||
| 331 | - child: Padding( | ||
| 332 | - padding: EdgeInsets.only(left: w(32)), | ||
| 333 | - child: Column( | ||
| 334 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 335 | - children: [ | ||
| 336 | - VEmptyView(24), | ||
| 337 | - _text( | ||
| 338 | - '活动名称', | ||
| 339 | - '活动名称', | ||
| 340 | - ), | ||
| 341 | - VEmptyView(24), | ||
| 342 | - MyDivider( | ||
| 343 | - double.infinity, | ||
| 344 | - w(1), | ||
| 345 | - color: MyColours.color_E7E7E7, | ||
| 346 | - ), | ||
| 347 | - VEmptyView(24), | ||
| 348 | - _text( | ||
| 349 | - '充值满', | ||
| 350 | - '充值金额门槛', | ||
| 351 | - ), | ||
| 352 | - VEmptyView(24), | ||
| 353 | - MyDivider( | ||
| 354 | - double.infinity, | ||
| 355 | - w(1), | ||
| 356 | - color: MyColours.color_E7E7E7, | ||
| 357 | - ), | ||
| 358 | - VEmptyView(24), | ||
| 359 | - Container( | ||
| 360 | - alignment: Alignment.centerLeft, | ||
| 361 | - child: Text( | ||
| 362 | - '优惠活动', | ||
| 363 | - style: TextStyle( | ||
| 364 | - color: MyColours.color_515151, | ||
| 365 | - fontSize: ScreenUtil().setSp(32)), | ||
| 366 | - ), | ||
| 367 | - ), | ||
| 368 | - VEmptyView(26), | ||
| 369 | - Padding( | ||
| 370 | - padding: EdgeInsets.only(left: w(20)), | 152 | + backgroundColor: MyColours.color_ffffff, |
| 153 | + appBar: SystemAppBar('充值优惠详情'), | ||
| 154 | + body: Consumer<MarketingCenterProvider>(builder: (context, model, _) { | ||
| 155 | + if (model.pageStateDetail != PageState.Success) { | ||
| 156 | + return ExceptionPage( | ||
| 157 | + pageState: model.pageStateDetail, | ||
| 158 | + callback: () { | ||
| 159 | + // offset = 0; | ||
| 160 | + // getMessage(showLoading: true); | ||
| 161 | + | ||
| 162 | + if (model.pageStateDetail == PageState.Empty) { | ||
| 163 | + // NavigatorUtil.goCouponHistoryPage(context); | ||
| 164 | + } else { | ||
| 165 | + // _couponNetworkData(widget.index); | ||
| 166 | + } | ||
| 167 | + _getNewRechargeDetail(); | ||
| 168 | + }, | ||
| 169 | + emptyMsg: "暂时没有详情数据哦", | ||
| 170 | + emptyImg: "empty_search", | ||
| 171 | + showMsg: "加载中,请稍后...", | ||
| 172 | + // showText: '查看过期优惠券', | ||
| 173 | + ); | ||
| 174 | + } else { | ||
| 175 | + return Column( | ||
| 176 | + children: [ | ||
| 177 | + Expanded( | ||
| 178 | + child: SingleChildScrollView( | ||
| 179 | + child: Padding( | ||
| 180 | + padding: EdgeInsets.only(left: w(16)), | ||
| 371 | child: Column( | 181 | child: Column( |
| 372 | crossAxisAlignment: CrossAxisAlignment.start, | 182 | crossAxisAlignment: CrossAxisAlignment.start, |
| 373 | - // mainAxisAlignment: MainAxisAlignment.start, | ||
| 374 | children: [ | 183 | children: [ |
| 375 | - Text( | ||
| 376 | - '赠送1000元余额', | ||
| 377 | - style: TextStyle( | ||
| 378 | - color: MyColours.color_999999, | ||
| 379 | - fontSize: ScreenUtil().setSp(32)), | 184 | + VEmptyView(56), |
| 185 | + _text( | ||
| 186 | + '活动名称', | ||
| 187 | + marketingCenterProvider.rechargeDetail.rname, | ||
| 188 | + ), | ||
| 189 | + VEmptyView(24), | ||
| 190 | + MyDivider( | ||
| 191 | + double.infinity, | ||
| 192 | + w(0.5), | ||
| 193 | + color: MyColours.color_E7E7E7, | ||
| 194 | + ), | ||
| 195 | + VEmptyView(48), | ||
| 196 | + _text( | ||
| 197 | + '充值满', | ||
| 198 | + marketingCenterProvider | ||
| 199 | + .rechargeDetail.rechargeMoney, | ||
| 380 | ), | 200 | ), |
| 381 | - VEmptyView(20), | ||
| 382 | - Text( | ||
| 383 | - '赠送1000积分', | ||
| 384 | - style: TextStyle( | ||
| 385 | - color: MyColours.color_999999, | ||
| 386 | - fontSize: ScreenUtil().setSp(32)), | 201 | + VEmptyView(24), |
| 202 | + MyDivider( | ||
| 203 | + double.infinity, | ||
| 204 | + w(0.5), | ||
| 205 | + color: MyColours.color_E7E7E7, | ||
| 387 | ), | 206 | ), |
| 388 | - VEmptyView(20), | ||
| 389 | - Text( | ||
| 390 | - '赠送优惠券', | ||
| 391 | - style: TextStyle( | ||
| 392 | - color: MyColours.color_999999, | ||
| 393 | - fontSize: ScreenUtil().setSp(32)), | 207 | + VEmptyView(48), |
| 208 | + Container( | ||
| 209 | + alignment: Alignment.centerLeft, | ||
| 210 | + child: Text( | ||
| 211 | + '优惠活动', | ||
| 212 | + style: TextStyle( | ||
| 213 | + color: MyColours.color_515151, | ||
| 214 | + fontSize: ScreenUtil().setSp(32)), | ||
| 215 | + ), | ||
| 394 | ), | 216 | ), |
| 217 | + VEmptyView(28), | ||
| 395 | Padding( | 218 | Padding( |
| 396 | - padding: EdgeInsets.only( | ||
| 397 | - left: w(45), | ||
| 398 | - right: w(8), | 219 | + padding: EdgeInsets.only(left: w(16)), |
| 220 | + child: Column( | ||
| 221 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 222 | + // mainAxisAlignment: MainAxisAlignment.start, | ||
| 223 | + children: [ | ||
| 224 | + if (marketingCenterProvider | ||
| 225 | + .rechargeDetail.rechargeList.isPrice == | ||
| 226 | + '1') | ||
| 227 | + Row( | ||
| 228 | + mainAxisAlignment: | ||
| 229 | + MainAxisAlignment.spaceBetween, | ||
| 230 | + children: [ | ||
| 231 | + Text( | ||
| 232 | + '赠送', | ||
| 233 | + style: TextStyle( | ||
| 234 | + color: MyColours.color_515151, | ||
| 235 | + fontSize: ScreenUtil().setSp(32)), | ||
| 236 | + ), | ||
| 237 | + Spacer(), | ||
| 238 | + Text( | ||
| 239 | + '${marketingCenterProvider.rechargeDetail.rechargeList.price}元余额', | ||
| 240 | + style: TextStyle( | ||
| 241 | + color: MyColours.color_999999, | ||
| 242 | + fontSize: ScreenUtil().setSp(32)), | ||
| 243 | + ), | ||
| 244 | + HEmptyView(32) | ||
| 245 | + ], | ||
| 246 | + ), | ||
| 247 | + if (marketingCenterProvider | ||
| 248 | + .rechargeDetail.rechargeList.isPrice == | ||
| 249 | + '1') | ||
| 250 | + VEmptyView(26), | ||
| 251 | + if (marketingCenterProvider | ||
| 252 | + .rechargeDetail.rechargeList.isScore == | ||
| 253 | + '1') | ||
| 254 | + Row( | ||
| 255 | + mainAxisAlignment: | ||
| 256 | + MainAxisAlignment.spaceBetween, | ||
| 257 | + children: [ | ||
| 258 | + Text( | ||
| 259 | + '赠送', | ||
| 260 | + style: TextStyle( | ||
| 261 | + color: MyColours.color_515151, | ||
| 262 | + fontSize: ScreenUtil().setSp(32)), | ||
| 263 | + ), | ||
| 264 | + Spacer(), | ||
| 265 | + Text( | ||
| 266 | + '${marketingCenterProvider.rechargeDetail.rechargeList.score}积分', | ||
| 267 | + style: TextStyle( | ||
| 268 | + color: MyColours.color_999999, | ||
| 269 | + fontSize: ScreenUtil().setSp(32)), | ||
| 270 | + ), | ||
| 271 | + HEmptyView(32) | ||
| 272 | + ], | ||
| 273 | + ), | ||
| 274 | + if (marketingCenterProvider | ||
| 275 | + .rechargeDetail.rechargeList.isScore == | ||
| 276 | + '1') | ||
| 277 | + VEmptyView(26), | ||
| 278 | + if (marketingCenterProvider.rechargeDetail | ||
| 279 | + .rechargeList.isCoupons == | ||
| 280 | + '1') | ||
| 281 | + Row( | ||
| 282 | + mainAxisAlignment: | ||
| 283 | + MainAxisAlignment.spaceBetween, | ||
| 284 | + children: [ | ||
| 285 | + Text( | ||
| 286 | + '赠送', | ||
| 287 | + style: TextStyle( | ||
| 288 | + color: MyColours.color_515151, | ||
| 289 | + fontSize: ScreenUtil().setSp(32)), | ||
| 290 | + ), | ||
| 291 | + Spacer(), | ||
| 292 | + Text( | ||
| 293 | + '优惠券', | ||
| 294 | + style: TextStyle( | ||
| 295 | + color: MyColours.color_999999, | ||
| 296 | + fontSize: ScreenUtil().setSp(32)), | ||
| 297 | + ), | ||
| 298 | + HEmptyView(32) | ||
| 299 | + ], | ||
| 300 | + ), | ||
| 301 | + if (marketingCenterProvider.rechargeDetail | ||
| 302 | + .rechargeList.isCoupons == | ||
| 303 | + '1') | ||
| 304 | + VEmptyView(26), | ||
| 305 | + if (marketingCenterProvider.rechargeDetail | ||
| 306 | + .rechargeList.isCoupons == | ||
| 307 | + '1') | ||
| 308 | + Wrap( | ||
| 309 | + spacing: w(9), | ||
| 310 | + runSpacing: w(9), | ||
| 311 | + alignment: WrapAlignment.start, | ||
| 312 | + runAlignment: WrapAlignment.start, | ||
| 313 | + children: marketingCenterProvider | ||
| 314 | + .rechargeDetail.rechargeList.coupons | ||
| 315 | + .map((e) { | ||
| 316 | + return InkWell( | ||
| 317 | + onTap: () { | ||
| 318 | + // NavigatorUtil.goCouponDetailPage( | ||
| 319 | + // conetxt); | ||
| 320 | + }, | ||
| 321 | + child: Text( | ||
| 322 | + e.aname, | ||
| 323 | + style: TextStyle( | ||
| 324 | + color: MyColours.color_438E93, | ||
| 325 | + fontSize: | ||
| 326 | + ScreenUtil().setSp(32)), | ||
| 327 | + )); | ||
| 328 | + }).toList()), | ||
| 329 | + VEmptyView(26), | ||
| 330 | + ], | ||
| 331 | + ), | ||
| 332 | + ), | ||
| 333 | + MyDivider( | ||
| 334 | + double.infinity, | ||
| 335 | + w(0.5), | ||
| 336 | + color: MyColours.color_E7E7E7, | ||
| 337 | + ), | ||
| 338 | + VEmptyView(48), | ||
| 339 | + Row( | ||
| 340 | + children: [ | ||
| 341 | + Text( | ||
| 342 | + '充值日期限制:', | ||
| 343 | + style: TextStyle( | ||
| 344 | + color: MyColours.color_515151, | ||
| 345 | + fontSize: ScreenUtil().setSp(32)), | ||
| 346 | + ), | ||
| 347 | + Spacer(), | ||
| 348 | + Text( | ||
| 349 | + marketingCenterProvider | ||
| 350 | + .rechargeDetail.expDate.isFix == | ||
| 351 | + '1' | ||
| 352 | + ? '${marketingCenterProvider.rechargeDetail.expDate.fixSdate}至${marketingCenterProvider.rechargeDetail.expDate.fixEdate}' | ||
| 353 | + : marketingCenterProvider.rechargeDetail | ||
| 354 | + .expDate.isWeek == | ||
| 355 | + '1' | ||
| 356 | + ? '每周指定日期可用' | ||
| 357 | + : '会员生日当天', | ||
| 358 | + style: TextStyle( | ||
| 359 | + color: MyColours.color_999999, | ||
| 360 | + fontSize: ScreenUtil().setSp(32)), | ||
| 399 | ), | 361 | ), |
| 400 | - child: Wrap( | ||
| 401 | - spacing: w(9), | ||
| 402 | - runSpacing: w(9), | ||
| 403 | - alignment: WrapAlignment.start, | ||
| 404 | - runAlignment: WrapAlignment.start, | ||
| 405 | - children: coupons.map((e) { | ||
| 406 | - return Text( | ||
| 407 | - e, | ||
| 408 | - style: TextStyle( | ||
| 409 | - color: MyColours.color_999999, | ||
| 410 | - fontSize: ScreenUtil().setSp(32)), | ||
| 411 | - ); | ||
| 412 | - }).toList())), | ||
| 413 | - VEmptyView(20), | 362 | + HEmptyView(32) |
| 363 | + ], | ||
| 364 | + ), | ||
| 365 | + if (marketingCenterProvider | ||
| 366 | + .rechargeDetail.expDate.isWeek == | ||
| 367 | + '1') | ||
| 368 | + VEmptyView(26), | ||
| 369 | + if (marketingCenterProvider | ||
| 370 | + .rechargeDetail.expDate.isWeek == | ||
| 371 | + '1') | ||
| 372 | + Align( | ||
| 373 | + alignment: Alignment.centerRight, | ||
| 374 | + child: Text( | ||
| 375 | + marketingCenterProvider | ||
| 376 | + .rechargeDetail.expDate.weekDateShow, | ||
| 377 | + style: TextStyle( | ||
| 378 | + color: MyColours.color_999999, | ||
| 379 | + fontSize: ScreenUtil().setSp(32)), | ||
| 380 | + )), | ||
| 381 | + VEmptyView(24), | ||
| 382 | + MyDivider( | ||
| 383 | + double.infinity, | ||
| 384 | + w(0.5), | ||
| 385 | + color: MyColours.color_E7E7E7, | ||
| 386 | + ), | ||
| 387 | + VEmptyView(48), | ||
| 388 | + _explain( | ||
| 389 | + '备注', | ||
| 390 | + '请输入备注信息', | ||
| 391 | + ), | ||
| 392 | + VEmptyView(48), | ||
| 393 | + _canUse() | ||
| 414 | ], | 394 | ], |
| 415 | - ), | ||
| 416 | - ), | ||
| 417 | - MyDivider( | ||
| 418 | - double.infinity, | ||
| 419 | - w(1), | ||
| 420 | - color: MyColours.color_E7E7E7, | ||
| 421 | - ), | ||
| 422 | - VEmptyView(24), | ||
| 423 | - Container( | ||
| 424 | - alignment: Alignment.centerLeft, | ||
| 425 | - child: Text( | ||
| 426 | - '有效期', | ||
| 427 | - style: TextStyle( | ||
| 428 | - color: MyColours.color_515151, | ||
| 429 | - fontSize: ScreenUtil().setSp(32)), | ||
| 430 | - ), | ||
| 431 | - ), | ||
| 432 | - VEmptyView(24), | ||
| 433 | - Padding( | ||
| 434 | - padding: EdgeInsets.only(left: w(20)), | ||
| 435 | - child: Text( | ||
| 436 | - '2021.2.2-2022.3.4/周日、周一、周二/会员生日当天', | ||
| 437 | - style: TextStyle( | ||
| 438 | - color: MyColours.color_999999, | ||
| 439 | - fontSize: ScreenUtil().setSp(32)), | ||
| 440 | - )), | ||
| 441 | - VEmptyView(24), | ||
| 442 | - MyDivider( | ||
| 443 | - double.infinity, | ||
| 444 | - w(1), | ||
| 445 | - color: MyColours.color_E7E7E7, | ||
| 446 | - ), | ||
| 447 | - VEmptyView(24), | ||
| 448 | - _explain('备注', '请输入备注信息', remarkC, remarkF), | ||
| 449 | - VEmptyView(24), | ||
| 450 | - _canUse('立即启用', canUse, () { | ||
| 451 | - setState(() { | ||
| 452 | - canUse = !canUse; | ||
| 453 | - }); | ||
| 454 | - }) | ||
| 455 | - ], | 395 | + )), |
| 456 | )), | 396 | )), |
| 457 | - )), | ||
| 458 | - // Container( | ||
| 459 | - // height: ScreenUtil().setWidth(91 * 2), | ||
| 460 | - // width: double.infinity, | ||
| 461 | - // padding: EdgeInsets.only( | ||
| 462 | - // top: ScreenUtil().setWidth(16 * 2), | ||
| 463 | - // bottom: ScreenUtil().setWidth(35 * 2), | ||
| 464 | - // left: ScreenUtil().setWidth(45 * 2), | ||
| 465 | - // right: ScreenUtil().setWidth(45 * 2), | ||
| 466 | - // ), | ||
| 467 | - // decoration: BoxDecoration( | ||
| 468 | - // color: MyColours.color_ffffff, | ||
| 469 | - // boxShadow: [ | ||
| 470 | - // BoxShadow( | ||
| 471 | - // spreadRadius: ScreenUtil().setWidth(2), | ||
| 472 | - // color: Color.fromRGBO(0, 0, 0, 0.1), | ||
| 473 | - // offset: Offset(0, ScreenUtil().setWidth(-2)), | ||
| 474 | - // blurRadius: ScreenUtil().setWidth(8)) | ||
| 475 | - // ], | ||
| 476 | - // borderRadius: BorderRadius.all( | ||
| 477 | - // Radius.circular(ScreenUtil().setWidth(16)), | ||
| 478 | - // ), | ||
| 479 | - // ), | ||
| 480 | - // child: RoundButton( | ||
| 481 | - // text: '保存', | ||
| 482 | - // height: ScreenUtil().setWidth(80), | ||
| 483 | - // radius: ScreenUtil().setWidth(14), | ||
| 484 | - // isBold: false, | ||
| 485 | - // fontSize: 28, | ||
| 486 | - // onPressed: () async { | ||
| 487 | - // // "stime": fromDate == '点击选择' | ||
| 488 | - // // ? "" | ||
| 489 | - // // : '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}', | ||
| 490 | - // // "etime": endDate == '点击选择' | ||
| 491 | - // // ? '' | ||
| 492 | - // // : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}', | ||
| 493 | - // // UserModel userModel = | ||
| 494 | - // // Provider.of<UserModel>(context, listen: false); | ||
| 495 | - // // if (userModel.user.role_name == '管理员' || | ||
| 496 | - // // userModel.user.role_name == '店长') { | ||
| 497 | - // // NavigatorUtil.goRechargeDetailPage(context); | ||
| 498 | - // // } else { | ||
| 499 | - // // bool needRefresh = | ||
| 500 | - // // await NavigatorUtil.goCouponEditPage(context); | ||
| 501 | - // // print(needRefresh); | ||
| 502 | - // // if (needRefresh != null && needRefresh) { | ||
| 503 | - // // bus.emit('refresh_coupon_list_f'); | ||
| 504 | - // // //刷新页面数据 | ||
| 505 | - // // // _controller.callRefresh(); | ||
| 506 | - // // // _couponNetworkData(tabController.index); | ||
| 507 | - // // } | ||
| 508 | - // // } | ||
| 509 | - // }, | ||
| 510 | - // ), | ||
| 511 | - // ) | ||
| 512 | - ], | ||
| 513 | - ), | ||
| 514 | - ); | 397 | + ], |
| 398 | + ); | ||
| 399 | + } | ||
| 400 | + })); | ||
| 515 | } | 401 | } |
| 516 | } | 402 | } |
| @@ -6,12 +6,16 @@ import 'package:flutter_picker/Picker.dart'; | @@ -6,12 +6,16 @@ import 'package:flutter_picker/Picker.dart'; | ||
| 6 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 6 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 7 | import 'package:one_key/models/coupon_model.dart'; | 7 | import 'package:one_key/models/coupon_model.dart'; |
| 8 | import 'package:one_key/models/filter_btn_model.dart'; | 8 | import 'package:one_key/models/filter_btn_model.dart'; |
| 9 | +import 'package:one_key/provider/user_model.dart'; | ||
| 9 | import 'package:one_key/route/navigator_util.dart'; | 10 | import 'package:one_key/route/navigator_util.dart'; |
| 10 | import 'package:one_key/widgets/MyDivider.dart'; | 11 | import 'package:one_key/widgets/MyDivider.dart'; |
| 11 | import 'package:one_key/widgets/system_app_bar.dart'; | 12 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 13 | +import 'package:provider/provider.dart'; | ||
| 12 | 14 | ||
| 15 | +import '../../../../provider/marketing_center_provider.dart'; | ||
| 13 | import '../../../../res/colors.dart'; | 16 | import '../../../../res/colors.dart'; |
| 14 | import '../../../../utils/dialog_util.dart'; | 17 | import '../../../../utils/dialog_util.dart'; |
| 18 | +import '../../../../utils/event_bus.dart'; | ||
| 15 | import '../../../../utils/screen_util.dart'; | 19 | import '../../../../utils/screen_util.dart'; |
| 16 | import '../../../../utils/utils.dart'; | 20 | import '../../../../utils/utils.dart'; |
| 17 | import '../../../../widgets/h_empty_view.dart'; | 21 | import '../../../../widgets/h_empty_view.dart'; |
| @@ -24,7 +28,8 @@ import '../../../../widgets/v_empty_view.dart'; | @@ -24,7 +28,8 @@ import '../../../../widgets/v_empty_view.dart'; | ||
| 24 | */ | 28 | */ |
| 25 | 29 | ||
| 26 | class RechargeEditPage extends StatefulWidget { | 30 | class RechargeEditPage extends StatefulWidget { |
| 27 | - RechargeEditPage({Key key}) : super(key: key); | 31 | + final String idstr; |
| 32 | + RechargeEditPage({Key key, this.idstr}) : super(key: key); | ||
| 28 | 33 | ||
| 29 | @override | 34 | @override |
| 30 | _RechargeEditPageState createState() => _RechargeEditPageState(); | 35 | _RechargeEditPageState createState() => _RechargeEditPageState(); |
| @@ -55,9 +60,9 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -55,9 +60,9 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 55 | 60 | ||
| 56 | String weekShow = '点击设置可用日期'; | 61 | String weekShow = '点击设置可用日期'; |
| 57 | bool canUse = false; | 62 | bool canUse = false; |
| 58 | - List<String> coupons = []; | 63 | + List<dynamic> coupons = []; |
| 59 | 64 | ||
| 60 | - List<String> selectIDs = []; | 65 | + List<dynamic> selectIDs = []; |
| 61 | 66 | ||
| 62 | bool givePriceSwich = false; | 67 | bool givePriceSwich = false; |
| 63 | bool giveScoreSwich = false; | 68 | bool giveScoreSwich = false; |
| @@ -65,6 +70,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -65,6 +70,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 65 | 70 | ||
| 66 | List<CouponSunModel> couponsData = []; | 71 | List<CouponSunModel> couponsData = []; |
| 67 | 72 | ||
| 73 | + MarketingCenterProvider marketingCenterProvider; | ||
| 74 | + | ||
| 68 | @override | 75 | @override |
| 69 | void initState() { | 76 | void initState() { |
| 70 | super.initState(); | 77 | super.initState(); |
| @@ -131,6 +138,75 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -131,6 +138,75 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 131 | // _editingController.text = ''; | 138 | // _editingController.text = ''; |
| 132 | } | 139 | } |
| 133 | }); | 140 | }); |
| 141 | + | ||
| 142 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 143 | + if (widget.idstr != null && widget.idstr != 'null') { | ||
| 144 | + _getNewRechargeDetail(); | ||
| 145 | + } | ||
| 146 | + }); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + _getNewRechargeDetail() async { | ||
| 150 | + bool success = await marketingCenterProvider.getNewRechargeDetail( | ||
| 151 | + context, widget.idstr); | ||
| 152 | + if (success) { | ||
| 153 | + //请求成功 | ||
| 154 | + nameC.text = marketingCenterProvider.rechargeDetail.rname; | ||
| 155 | + priceminC.text = marketingCenterProvider.rechargeDetail.rechargeMoney; | ||
| 156 | + givePriceSwich = | ||
| 157 | + marketingCenterProvider.rechargeDetail.rechargeList.isPrice == '1' | ||
| 158 | + ? true | ||
| 159 | + : false; | ||
| 160 | + givePriceC.text = | ||
| 161 | + marketingCenterProvider.rechargeDetail.rechargeList.price; | ||
| 162 | + giveScoreSwich = | ||
| 163 | + marketingCenterProvider.rechargeDetail.rechargeList.isScore == '1' | ||
| 164 | + ? true | ||
| 165 | + : false; | ||
| 166 | + giveScoreC.text = | ||
| 167 | + marketingCenterProvider.rechargeDetail.rechargeList.score; | ||
| 168 | + giveCouponsSwich = | ||
| 169 | + marketingCenterProvider.rechargeDetail.rechargeList.isCoupons == '1' | ||
| 170 | + ? true | ||
| 171 | + : false; | ||
| 172 | + selectIDs = | ||
| 173 | + marketingCenterProvider.rechargeDetail.rechargeList.couponsIds; | ||
| 174 | + | ||
| 175 | + couponsData = marketingCenterProvider.rechargeDetail.rechargeList.coupons; | ||
| 176 | + coupons = | ||
| 177 | + marketingCenterProvider.rechargeDetail.rechargeList.couponsNames; | ||
| 178 | + fixdate = marketingCenterProvider.rechargeDetail.expDate.isFix == '1' | ||
| 179 | + ? true | ||
| 180 | + : false; | ||
| 181 | + if (marketingCenterProvider.rechargeDetail.expDate.fixSdate != '') { | ||
| 182 | + fromDate = marketingCenterProvider.rechargeDetail.expDate.fixSdate; | ||
| 183 | + } | ||
| 184 | + if (marketingCenterProvider.rechargeDetail.expDate.fixEdate != '') { | ||
| 185 | + endDate = marketingCenterProvider.rechargeDetail.expDate.fixEdate; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + weekly = marketingCenterProvider.rechargeDetail.expDate.isWeek == '1' | ||
| 189 | + ? true | ||
| 190 | + : false; | ||
| 191 | + if (marketingCenterProvider.rechargeDetail.expDate.weekDateShow != '') { | ||
| 192 | + weekShow = marketingCenterProvider.rechargeDetail.expDate.weekDateShow; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + if (marketingCenterProvider.rechargeDetail.expDate.weekDateData.length > | ||
| 196 | + 0) { | ||
| 197 | + weekData = marketingCenterProvider.rechargeDetail.expDate.weekDateData; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + birthday = | ||
| 201 | + marketingCenterProvider.rechargeDetail.expDate.isBirthday == '1' | ||
| 202 | + ? true | ||
| 203 | + : false; | ||
| 204 | + | ||
| 205 | + remarkC.text = marketingCenterProvider.rechargeDetail.explain; | ||
| 206 | + canUse = | ||
| 207 | + marketingCenterProvider.rechargeDetail.isOpen == '1' ? true : false; | ||
| 208 | + setState(() {}); | ||
| 209 | + } | ||
| 134 | } | 210 | } |
| 135 | 211 | ||
| 136 | _initWeekData() { | 212 | _initWeekData() { |
| @@ -385,6 +461,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -385,6 +461,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 385 | 461 | ||
| 386 | @override | 462 | @override |
| 387 | Widget build(BuildContext context) { | 463 | Widget build(BuildContext context) { |
| 464 | + marketingCenterProvider = | ||
| 465 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 388 | return Scaffold( | 466 | return Scaffold( |
| 389 | key: scaffoldKey, | 467 | key: scaffoldKey, |
| 390 | backgroundColor: MyColours.color_ffffff, | 468 | backgroundColor: MyColours.color_ffffff, |
| @@ -878,7 +956,19 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -878,7 +956,19 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 878 | isBold: false, | 956 | isBold: false, |
| 879 | fontSize: 28, | 957 | fontSize: 28, |
| 880 | onPressed: () async { | 958 | onPressed: () async { |
| 959 | + if (nameC.text.trim().length == 0) { | ||
| 960 | + Utils.showToast('请输入活动名称!'); | ||
| 961 | + return; | ||
| 962 | + } | ||
| 963 | + if (priceminC.text.trim().length == 0) { | ||
| 964 | + Utils.showToast('请输入充值金额门槛!'); | ||
| 965 | + return; | ||
| 966 | + } | ||
| 881 | //优惠活动 | 967 | //优惠活动 |
| 968 | + if (!giveScoreSwich && !givePriceSwich && !giveCouponsSwich) { | ||
| 969 | + Utils.showToast('请选择优惠活动!'); | ||
| 970 | + return; | ||
| 971 | + } | ||
| 882 | if (givePriceSwich && givePriceC.text.trim().length == 0) { | 972 | if (givePriceSwich && givePriceC.text.trim().length == 0) { |
| 883 | Utils.showToast('请输入赠送金额!'); | 973 | Utils.showToast('请输入赠送金额!'); |
| 884 | return; | 974 | return; |
| @@ -893,6 +983,10 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -893,6 +983,10 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 893 | } | 983 | } |
| 894 | 984 | ||
| 895 | //有效期 | 985 | //有效期 |
| 986 | + if (!fixdate && !weekly && !birthday) { | ||
| 987 | + Utils.showToast('请选择有效期!'); | ||
| 988 | + return; | ||
| 989 | + } | ||
| 896 | 990 | ||
| 897 | if (fixdate) { | 991 | if (fixdate) { |
| 898 | //固定时间段 | 992 | //固定时间段 |
| @@ -945,6 +1039,33 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -945,6 +1039,33 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 945 | 1039 | ||
| 946 | String dateStr = json.encode(date); | 1040 | String dateStr = json.encode(date); |
| 947 | print(dateStr); | 1041 | print(dateStr); |
| 1042 | + Map<String, String> pramas = { | ||
| 1043 | + 'sellerid': Provider.of<UserModel>(context, listen: false) | ||
| 1044 | + .user | ||
| 1045 | + .sellerid, | ||
| 1046 | + 'uid': Provider.of<UserModel>(context, listen: false) | ||
| 1047 | + .user | ||
| 1048 | + .openid, | ||
| 1049 | + 'rname': nameC.text, | ||
| 1050 | + 'recharge_money': priceminC.text, | ||
| 1051 | + 'recharge_list': discountsStr, | ||
| 1052 | + 'exp_date': dateStr, | ||
| 1053 | + 'explain': remarkC.text, | ||
| 1054 | + 'is_open': canUse ? '1' : '0' | ||
| 1055 | + }; | ||
| 1056 | + if (widget.idstr != null && widget.idstr != 'null') { | ||
| 1057 | + pramas['id'] = widget.idstr; | ||
| 1058 | + } | ||
| 1059 | + | ||
| 1060 | + bool success = await marketingCenterProvider.createNewRecharge( | ||
| 1061 | + context, pramas); | ||
| 1062 | + | ||
| 1063 | + if (success) { | ||
| 1064 | + //成功后返回前面列表 | ||
| 1065 | + Navigator.pop(context); | ||
| 1066 | + //刷新列表 | ||
| 1067 | + bus.emit('refresh_recharge_home'); | ||
| 1068 | + } | ||
| 948 | 1069 | ||
| 949 | // "stime": fromDate == '点击选择' | 1070 | // "stime": fromDate == '点击选择' |
| 950 | // ? "" | 1071 | // ? "" |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_easyrefresh/easy_refresh.dart'; | 2 | import 'package:flutter_easyrefresh/easy_refresh.dart'; |
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | +import 'package:one_key/models/recharge_list_model.dart'; | ||
| 4 | import 'package:one_key/pages/my/marketing_center/recharge/recharge_item.dart'; | 5 | 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/res/colors.dart'; |
| 6 | import 'package:one_key/utils/utils.dart'; | 7 | import 'package:one_key/utils/utils.dart'; |
| @@ -11,6 +12,8 @@ import '../../../../constant/state.dart'; | @@ -11,6 +12,8 @@ import '../../../../constant/state.dart'; | ||
| 11 | import '../../../../provider/marketing_center_provider.dart'; | 12 | import '../../../../provider/marketing_center_provider.dart'; |
| 12 | import '../../../../provider/user_model.dart'; | 13 | import '../../../../provider/user_model.dart'; |
| 13 | import '../../../../route/navigator_util.dart'; | 14 | import '../../../../route/navigator_util.dart'; |
| 15 | +import '../../../../utils/dialog_util.dart'; | ||
| 16 | +import '../../../../utils/event_bus.dart'; | ||
| 14 | import '../../../../utils/screen_util.dart'; | 17 | import '../../../../utils/screen_util.dart'; |
| 15 | import '../../../../widgets/page_exception.dart'; | 18 | import '../../../../widgets/page_exception.dart'; |
| 16 | import '../../../../widgets/round_button.dart'; | 19 | import '../../../../widgets/round_button.dart'; |
| @@ -31,6 +34,46 @@ class RechargeHomePage extends StatefulWidget { | @@ -31,6 +34,46 @@ class RechargeHomePage extends StatefulWidget { | ||
| 31 | class _RechargeHomePageState extends State<RechargeHomePage> { | 34 | class _RechargeHomePageState extends State<RechargeHomePage> { |
| 32 | MarketingCenterProvider marketingCenterProvider; | 35 | MarketingCenterProvider marketingCenterProvider; |
| 33 | EasyRefreshController _controller = EasyRefreshController(); | 36 | EasyRefreshController _controller = EasyRefreshController(); |
| 37 | + | ||
| 38 | + @override | ||
| 39 | + void initState() { | ||
| 40 | + // TODO: implement initState | ||
| 41 | + super.initState(); | ||
| 42 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 43 | + _getNewRechargeList(); | ||
| 44 | + }); | ||
| 45 | + | ||
| 46 | + bus.on("refresh_recharge_home", (arg) { | ||
| 47 | + _getNewRechargeList(); | ||
| 48 | + }); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @override | ||
| 52 | + void dispose() { | ||
| 53 | + super.dispose(); | ||
| 54 | + bus.off('refresh_recharge_home'); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + _getNewRechargeList() async { | ||
| 58 | + await marketingCenterProvider.getNewRechargeList(context); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + _openOrClose(RechargeListSunModel rechargeListSunModel, String isOpen) async { | ||
| 62 | + Map<String, String> pramas = { | ||
| 63 | + 'id': rechargeListSunModel.id, | ||
| 64 | + // 'status': remarkC.text, | ||
| 65 | + 'is_open': isOpen | ||
| 66 | + }; | ||
| 67 | + | ||
| 68 | + bool success = | ||
| 69 | + await marketingCenterProvider.createNewRecharge(context, pramas); | ||
| 70 | + if (success) { | ||
| 71 | + setState(() { | ||
| 72 | + rechargeListSunModel.isOpen = isOpen; | ||
| 73 | + }); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + | ||
| 34 | @override | 77 | @override |
| 35 | Widget build(BuildContext context) { | 78 | Widget build(BuildContext context) { |
| 36 | marketingCenterProvider = | 79 | marketingCenterProvider = |
| @@ -63,8 +106,9 @@ class _RechargeHomePageState extends State<RechargeHomePage> { | @@ -63,8 +106,9 @@ class _RechargeHomePageState extends State<RechargeHomePage> { | ||
| 63 | } else { | 106 | } else { |
| 64 | // _couponNetworkData(widget.index); | 107 | // _couponNetworkData(widget.index); |
| 65 | } | 108 | } |
| 109 | + _getNewRechargeList(); | ||
| 66 | }, | 110 | }, |
| 67 | - emptyMsg: "暂时没有列表信息哦,", | 111 | + emptyMsg: "暂时没有列表信息哦", |
| 68 | emptyImg: "empty_search", | 112 | emptyImg: "empty_search", |
| 69 | showMsg: "加载中,请稍后...", | 113 | showMsg: "加载中,请稍后...", |
| 70 | // showText: '查看过期优惠券', | 114 | // showText: '查看过期优惠券', |
| @@ -77,57 +121,92 @@ class _RechargeHomePageState extends State<RechargeHomePage> { | @@ -77,57 +121,92 @@ class _RechargeHomePageState extends State<RechargeHomePage> { | ||
| 77 | SliverList( | 121 | SliverList( |
| 78 | delegate: SliverChildBuilderDelegate( | 122 | delegate: SliverChildBuilderDelegate( |
| 79 | (BuildContext context, int index) { | 123 | (BuildContext context, int index) { |
| 124 | + RechargeListSunModel rechargeListSunModel = | ||
| 125 | + marketingCenterProvider.rechargeList[index]; | ||
| 80 | return RechargeItem( | 126 | return RechargeItem( |
| 81 | from: 'quan', | 127 | from: 'quan', |
| 82 | - // couponSonModel: couponProvider.couponList[index], | 128 | + rechargeListSunModel: rechargeListSunModel, |
| 83 | showBtn: showBtn, | 129 | showBtn: showBtn, |
| 84 | onPressedDel: () { | 130 | onPressedDel: () { |
| 85 | - // couponProvider.couponList[index].isOpenBool = | ||
| 86 | - // !couponProvider.couponList[index].isOpenBool; | ||
| 87 | - // _setCustomerActivity(index); | 131 | + //弹框确认是否删除 |
| 132 | + DialogUtil.cupertinoAlertDialog(context, | ||
| 133 | + title: "", | ||
| 134 | + content: "确定要将该优惠删除吗?", | ||
| 135 | + rTitle: "确定", rCallback: () async { | ||
| 136 | + Map<String, String> pramas = { | ||
| 137 | + 'id': rechargeListSunModel.id, | ||
| 138 | + 'status': '1', | ||
| 139 | + }; | ||
| 140 | + | ||
| 141 | + bool success = await marketingCenterProvider | ||
| 142 | + .createNewRecharge(context, pramas); | ||
| 143 | + if (success) { | ||
| 144 | + setState(() { | ||
| 145 | + marketingCenterProvider.rechargeList | ||
| 146 | + .removeAt(index); | ||
| 147 | + }); | ||
| 148 | + } | ||
| 149 | + }); | ||
| 150 | + }, | ||
| 151 | + onPressedUse: () async { | ||
| 152 | + if (rechargeListSunModel.isOpen == '1') { | ||
| 153 | + //开启的,去禁用 | ||
| 154 | + | ||
| 155 | + _openOrClose(rechargeListSunModel, '0'); | ||
| 156 | + } else { | ||
| 157 | + _openOrClose(rechargeListSunModel, '1'); | ||
| 158 | + } | ||
| 88 | }, | 159 | }, |
| 89 | - onPressedUse: () {}, | ||
| 90 | onPressed: () { | 160 | onPressed: () { |
| 91 | - if (showBtn) { | ||
| 92 | - //跳进编辑页 | ||
| 93 | - NavigatorUtil.goRechargeEditPage(context); | 161 | + if (showBtn || |
| 162 | + rechargeListSunModel.uid == | ||
| 163 | + Provider.of<UserModel>(context, | ||
| 164 | + listen: false) | ||
| 165 | + .user | ||
| 166 | + .openid) { | ||
| 167 | + //跳进编辑页,权限:管理员、店长、自己创建的券 | ||
| 168 | + NavigatorUtil.goRechargeEditPage(context, | ||
| 169 | + idstr: rechargeListSunModel.id); | ||
| 94 | } else { | 170 | } else { |
| 95 | //查看页 | 171 | //查看页 |
| 96 | - NavigatorUtil.goRechargeDetailPage(context); | 172 | + NavigatorUtil.goRechargeDetailPage( |
| 173 | + context, rechargeListSunModel.id); | ||
| 97 | } | 174 | } |
| 98 | }, | 175 | }, |
| 99 | ); | 176 | ); |
| 100 | - }, childCount: 100), | 177 | + }, |
| 178 | + childCount: | ||
| 179 | + marketingCenterProvider.rechargeList.length), | ||
| 101 | ), | 180 | ), |
| 102 | - SliverList( | ||
| 103 | - delegate: SliverChildBuilderDelegate( | ||
| 104 | - (BuildContext context, int index) { | ||
| 105 | - return Column( | ||
| 106 | - children: [ | ||
| 107 | - InkWell( | ||
| 108 | - onTap: () { | ||
| 109 | - // NavigatorUtil.goCouponHistoryPage(context); | ||
| 110 | - }, | ||
| 111 | - child: RichText( | ||
| 112 | - text: TextSpan( | ||
| 113 | - style: TextStyle( | ||
| 114 | - fontSize: ScreenUtil().setSp(28), | ||
| 115 | - ), | ||
| 116 | - children: [ | ||
| 117 | - TextSpan( | ||
| 118 | - text: '没有更多了,', | ||
| 119 | - style: TextStyle( | ||
| 120 | - color: MyColours.color_000000)), | ||
| 121 | - TextSpan( | ||
| 122 | - text: '查看过期优惠券', | ||
| 123 | - style: TextStyle( | ||
| 124 | - color: MyColours.color_438E93)), | ||
| 125 | - ]))), | ||
| 126 | - VEmptyView(80) | ||
| 127 | - ], | ||
| 128 | - ); | ||
| 129 | - }, childCount: 1), | ||
| 130 | - ) | 181 | + // SliverList( |
| 182 | + // delegate: SliverChildBuilderDelegate( | ||
| 183 | + // (BuildContext context, int index) { | ||
| 184 | + // return Column( | ||
| 185 | + // children: [ | ||
| 186 | + // InkWell( | ||
| 187 | + // onTap: () { | ||
| 188 | + // // NavigatorUtil.goCouponHistoryPage(context); | ||
| 189 | + // }, | ||
| 190 | + // child: RichText( | ||
| 191 | + // text: TextSpan( | ||
| 192 | + // style: TextStyle( | ||
| 193 | + // fontSize: ScreenUtil().setSp(28), | ||
| 194 | + // ), | ||
| 195 | + // children: [ | ||
| 196 | + // TextSpan( | ||
| 197 | + // text: '没有更多了,', | ||
| 198 | + // style: TextStyle( | ||
| 199 | + // color: MyColours.color_000000)), | ||
| 200 | + // TextSpan( | ||
| 201 | + // text: '查看过期优惠券', | ||
| 202 | + // style: TextStyle( | ||
| 203 | + // color: MyColours.color_438E93)), | ||
| 204 | + // ]))), | ||
| 205 | + // VEmptyView(80) | ||
| 206 | + // ], | ||
| 207 | + // ); | ||
| 208 | + // }, childCount: 1), | ||
| 209 | + // ) | ||
| 131 | ], | 210 | ], |
| 132 | // onRefresh: () async { | 211 | // onRefresh: () async { |
| 133 | // // offset = 0; | 212 | // // offset = 0; |
| @@ -10,6 +10,7 @@ import 'package:one_key/widgets/h_empty_view.dart'; | @@ -10,6 +10,7 @@ import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 10 | import 'package:one_key/widgets/round_button.dart'; | 10 | import 'package:one_key/widgets/round_button.dart'; |
| 11 | import 'package:one_key/widgets/v_empty_view.dart'; | 11 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 12 | 12 | ||
| 13 | +import '../../../../models/recharge_list_model.dart'; | ||
| 13 | import '../../../../provider/user_model.dart'; | 14 | import '../../../../provider/user_model.dart'; |
| 14 | import '../../../../utils/screen_util.dart'; | 15 | import '../../../../utils/screen_util.dart'; |
| 15 | 16 | ||
| @@ -18,7 +19,7 @@ class RechargeItem extends StatefulWidget { | @@ -18,7 +19,7 @@ class RechargeItem extends StatefulWidget { | ||
| 18 | final VoidCallback onPressed; | 19 | final VoidCallback onPressed; |
| 19 | final VoidCallback onPressedDel; | 20 | final VoidCallback onPressedDel; |
| 20 | final VoidCallback onPressedUse; | 21 | final VoidCallback onPressedUse; |
| 21 | - final CouponSunModel couponSonModel; | 22 | + final RechargeListSunModel rechargeListSunModel; |
| 22 | final bool showBtn; | 23 | final bool showBtn; |
| 23 | final bool showCheck; | 24 | final bool showCheck; |
| 24 | RechargeItem({ | 25 | RechargeItem({ |
| @@ -27,7 +28,7 @@ class RechargeItem extends StatefulWidget { | @@ -27,7 +28,7 @@ class RechargeItem extends StatefulWidget { | ||
| 27 | this.onPressed, | 28 | this.onPressed, |
| 28 | this.onPressedDel, | 29 | this.onPressedDel, |
| 29 | this.onPressedUse, | 30 | this.onPressedUse, |
| 30 | - this.couponSonModel, | 31 | + this.rechargeListSunModel, |
| 31 | this.showBtn = false, | 32 | this.showBtn = false, |
| 32 | this.showCheck = false, | 33 | this.showCheck = false, |
| 33 | }) : super(key: key); | 34 | }) : super(key: key); |
| @@ -62,168 +63,206 @@ class _RechargeItemState extends State<RechargeItem> { | @@ -62,168 +63,206 @@ class _RechargeItemState extends State<RechargeItem> { | ||
| 62 | // } | 63 | // } |
| 63 | return InkWell( | 64 | return InkWell( |
| 64 | onTap: widget.onPressed, | 65 | onTap: widget.onPressed, |
| 65 | - child: Container( | ||
| 66 | - // width: ScreenUtil().setWidth(610), | ||
| 67 | - margin: EdgeInsets.fromLTRB( | ||
| 68 | - ScreenUtil().setWidth(40), | ||
| 69 | - ScreenUtil().setWidth(30), | ||
| 70 | - ScreenUtil().setWidth(40), | ||
| 71 | - ScreenUtil().setWidth(0)), | ||
| 72 | - decoration: BoxDecoration( | ||
| 73 | - color: MyColours.color_ffffff, | ||
| 74 | - boxShadow: [ | ||
| 75 | - BoxShadow( | ||
| 76 | - spreadRadius: ScreenUtil().setWidth(2), | ||
| 77 | - color: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 78 | - offset: Offset(0, ScreenUtil().setWidth(8)), | ||
| 79 | - blurRadius: ScreenUtil().setWidth(8)) | ||
| 80 | - ], | ||
| 81 | - borderRadius: BorderRadius.all( | ||
| 82 | - Radius.circular(ScreenUtil().setWidth(16)), | ||
| 83 | - ), | ||
| 84 | - ), | ||
| 85 | - child: Column( | ||
| 86 | - mainAxisSize: MainAxisSize.min, | ||
| 87 | - crossAxisAlignment: CrossAxisAlignment.start, | 66 | + child: Stack( |
| 67 | + clipBehavior: Clip.none, | ||
| 68 | + alignment: Alignment.centerLeft, | ||
| 88 | children: [ | 69 | children: [ |
| 89 | - Container( | ||
| 90 | - height: ScreenUtil().setWidth(60), | ||
| 91 | - padding: | ||
| 92 | - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)), | ||
| 93 | - decoration: BoxDecoration( | ||
| 94 | - color: widget.from == 'history' | ||
| 95 | - ? MyColours.color_BFC4D4 | ||
| 96 | - : notSelect | ||
| 97 | - ? true | ||
| 98 | - ? MyColours.color_438E93 | ||
| 99 | - : MyColours.color_ED7B2F | ||
| 100 | - : MyColours.color_999999, | ||
| 101 | - borderRadius: BorderRadius.only( | ||
| 102 | - topLeft: Radius.circular(ScreenUtil().setWidth(16)), | ||
| 103 | - topRight: Radius.circular(ScreenUtil().setWidth(16)))), | ||
| 104 | - child: Row( | ||
| 105 | - mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 106 | - children: [ | ||
| 107 | - Text( | ||
| 108 | - '充500赠100', | ||
| 109 | - style: TextStyle( | ||
| 110 | - color: MyColours.color_ffffff, | ||
| 111 | - fontWeight: FontWeight.bold, | ||
| 112 | - fontSize: ScreenUtil().setSp(32)), | 70 | + InkWell( |
| 71 | + onTap: widget.onPressed, | ||
| 72 | + child: Container( | ||
| 73 | + // width: ScreenUtil().setWidth(610), | ||
| 74 | + margin: EdgeInsets.fromLTRB( | ||
| 75 | + ScreenUtil().setWidth(40), | ||
| 76 | + ScreenUtil().setWidth(30), | ||
| 77 | + ScreenUtil().setWidth(40), | ||
| 78 | + ScreenUtil().setWidth(0)), | ||
| 79 | + decoration: BoxDecoration( | ||
| 80 | + color: MyColours.color_ffffff, | ||
| 81 | + boxShadow: [ | ||
| 82 | + BoxShadow( | ||
| 83 | + spreadRadius: ScreenUtil().setWidth(2), | ||
| 84 | + color: Color.fromRGBO(0, 0, 0, 0.25), | ||
| 85 | + offset: Offset(0, ScreenUtil().setWidth(8)), | ||
| 86 | + blurRadius: ScreenUtil().setWidth(8)) | ||
| 87 | + ], | ||
| 88 | + borderRadius: BorderRadius.all( | ||
| 89 | + Radius.circular(ScreenUtil().setWidth(16)), | ||
| 90 | + ), | ||
| 113 | ), | 91 | ), |
| 114 | - Text('更新时间:2022-12-18', | ||
| 115 | - maxLines: 1, | ||
| 116 | - overflow: TextOverflow.ellipsis, | ||
| 117 | - style: TextStyle( | ||
| 118 | - color: MyColours.color_ffffff, | ||
| 119 | - fontSize: ScreenUtil().setSp(20))), | ||
| 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 | - ), | 92 | + child: Column( |
| 93 | + mainAxisSize: MainAxisSize.min, | ||
| 94 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 95 | + children: [ | ||
| 96 | + Container( | ||
| 97 | + height: ScreenUtil().setWidth(60), | ||
| 98 | + padding: EdgeInsets.symmetric( | ||
| 99 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 100 | + decoration: BoxDecoration( | ||
| 101 | + color: widget.from == 'history' | ||
| 102 | + ? MyColours.color_BFC4D4 | ||
| 103 | + : notSelect | ||
| 104 | + ? widget.rechargeListSunModel.isOpen == | ||
| 105 | + '1' | ||
| 106 | + ? MyColours.color_438E93 | ||
| 107 | + : MyColours.color_999999 | ||
| 108 | + : MyColours.color_999999, | ||
| 109 | + borderRadius: BorderRadius.only( | ||
| 110 | + topLeft: Radius.circular( | ||
| 111 | + ScreenUtil().setWidth(16)), | ||
| 112 | + topRight: Radius.circular( | ||
| 113 | + ScreenUtil().setWidth(16)))), | ||
| 114 | + child: Row( | ||
| 115 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 116 | + children: [ | ||
| 117 | + Text( | ||
| 118 | + widget.rechargeListSunModel.rname, | ||
| 119 | + style: TextStyle( | ||
| 120 | + color: MyColours.color_ffffff, | ||
| 121 | + fontWeight: FontWeight.bold, | ||
| 122 | + fontSize: ScreenUtil().setSp(32)), | ||
| 123 | + ), | ||
| 124 | + Text( | ||
| 125 | + '更新时间:${widget.rechargeListSunModel.cdateStr}', | ||
| 126 | + maxLines: 1, | ||
| 127 | + overflow: TextOverflow.ellipsis, | ||
| 128 | + style: TextStyle( | ||
| 129 | + color: MyColours.color_ffffff, | ||
| 130 | + fontSize: ScreenUtil().setSp(20))), | ||
| 131 | + ], | ||
| 132 | + ), | ||
| 133 | + ), | ||
| 134 | + Container( | ||
| 135 | + padding: EdgeInsets.fromLTRB( | ||
| 136 | + ScreenUtil().setWidth(20 * 2), | ||
| 137 | + ScreenUtil().setWidth(26), | ||
| 138 | + ScreenUtil().setWidth(40), | ||
| 139 | + ScreenUtil().setWidth(26)), | ||
| 140 | + child: Column( | ||
| 141 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 142 | + children: [ | ||
| 143 | + if (widget.rechargeListSunModel.rechargeList | ||
| 144 | + .isPrice == | ||
| 145 | + '1') | ||
| 146 | + Container( | ||
| 147 | + // height: ScreenUtil().setWidth(14 * 2), | ||
| 148 | + // width: ScreenUtil().setWidth(232 * 2), | ||
| 149 | + margin: EdgeInsets.only(bottom: w(5)), | ||
| 150 | + child: Text( | ||
| 151 | + '会员充值满${widget.rechargeListSunModel.rechargeMoney}元赠余额${widget.rechargeListSunModel.rechargeList.price}元;', | ||
| 152 | + maxLines: 1, | ||
| 153 | + overflow: TextOverflow.ellipsis, | ||
| 154 | + style: TextStyle( | ||
| 155 | + color: MyColours.color_999999, | ||
| 156 | + fontSize: ScreenUtil().setSp(20), | ||
| 157 | + )), | ||
| 158 | + ), | ||
| 159 | + if (widget.rechargeListSunModel.rechargeList | ||
| 160 | + .isScore == | ||
| 161 | + '1') | ||
| 162 | + Container( | ||
| 163 | + // height: ScreenUtil().setWidth(14 * 2), | ||
| 164 | + // width: ScreenUtil().setWidth(232 * 2), | ||
| 165 | + margin: EdgeInsets.only(bottom: w(5)), | ||
| 166 | + child: Text( | ||
| 167 | + '会员充值满${widget.rechargeListSunModel.rechargeMoney}元赠送${widget.rechargeListSunModel.rechargeList.score}积分;', | ||
| 168 | + maxLines: 1, | ||
| 169 | + overflow: TextOverflow.ellipsis, | ||
| 170 | + style: TextStyle( | ||
| 171 | + color: MyColours.color_999999, | ||
| 172 | + fontSize: ScreenUtil().setSp(20), | ||
| 173 | + )), | ||
| 174 | + ), | ||
| 175 | + if (widget.rechargeListSunModel.rechargeList | ||
| 176 | + .isCoupons == | ||
| 177 | + '1') | ||
| 178 | + Container( | ||
| 179 | + // height: ScreenUtil().setWidth(14 * 2), | ||
| 180 | + // width: ScreenUtil().setWidth(232 * 2), | ||
| 181 | + child: Text( | ||
| 182 | + '会员充值满${widget.rechargeListSunModel.rechargeMoney}元赠送${Utils.listToStringEnglish3(widget.rechargeListSunModel.rechargeList.couponsNames)}。', | ||
| 183 | + maxLines: 1, | ||
| 184 | + overflow: TextOverflow.ellipsis, | ||
| 185 | + style: TextStyle( | ||
| 186 | + color: MyColours.color_999999, | ||
| 187 | + fontSize: ScreenUtil().setSp(20), | ||
| 188 | + )), | ||
| 189 | + ), | ||
| 190 | + ], | ||
| 191 | + ), | ||
| 169 | 192 | ||
| 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 | - if (widget.showBtn) | ||
| 186 | - MySeparator(width: w(4), color: MyColours.color_BFC4D4), | ||
| 187 | - if (widget.showBtn) VEmptyView(15), | ||
| 188 | - if (widget.showBtn) | ||
| 189 | - Row( | ||
| 190 | - mainAxisAlignment: MainAxisAlignment.end, | ||
| 191 | - children: [ | ||
| 192 | - RoundButton( | ||
| 193 | - width: widget.from == 'history' | ||
| 194 | - ? ScreenUtil().setWidth(50 * 2) | ||
| 195 | - : ScreenUtil().setWidth(50 * 2), | ||
| 196 | - height: ScreenUtil().setWidth(20 * 2), | ||
| 197 | - radius: ScreenUtil().setWidth(10), | ||
| 198 | - text: '删除', | ||
| 199 | - fontSize: 24, | ||
| 200 | - textColor: MyColours.color_E34D59, | ||
| 201 | - gradientStart: MyColours.color_ffffff, | ||
| 202 | - gradientEnd: MyColours.color_ffffff, | ||
| 203 | - borderColor: MyColours.color_E34D59, | ||
| 204 | - onPressed: widget.onPressedDel, | ||
| 205 | - ), | ||
| 206 | - HEmptyView(34), | ||
| 207 | - RoundButton( | ||
| 208 | - width: ScreenUtil().setWidth(50 * 2), | ||
| 209 | - height: ScreenUtil().setWidth(20 * 2), | ||
| 210 | - radius: ScreenUtil().setWidth(10), | ||
| 211 | - text: '禁用', | 193 | + // widget.from == 'select' |
| 194 | + // ? widget.showCheck | ||
| 195 | + // ? Positioned( | ||
| 196 | + // right: 0, | ||
| 197 | + // top: ScreenUtil().setWidth(20), | ||
| 198 | + // child: Image.asset( | ||
| 199 | + // Utils.getImgPath(widget.couponSonModel.isCheck | ||
| 200 | + // ? 'check_r' | ||
| 201 | + // : 'check_un'), | ||
| 202 | + // width: ScreenUtil().setWidth(40), | ||
| 203 | + // height: ScreenUtil().setWidth(40), | ||
| 204 | + // )) | ||
| 205 | + // : Container() | ||
| 206 | + // : | ||
| 207 | + ), | ||
| 208 | + if (widget.showBtn) | ||
| 209 | + MySeparator( | ||
| 210 | + width: w(4), color: MyColours.color_BFC4D4), | ||
| 211 | + if (widget.showBtn) VEmptyView(15), | ||
| 212 | + if (widget.showBtn) | ||
| 213 | + Row( | ||
| 214 | + mainAxisAlignment: MainAxisAlignment.end, | ||
| 215 | + children: [ | ||
| 216 | + RoundButton( | ||
| 217 | + width: widget.from == 'history' | ||
| 218 | + ? ScreenUtil().setWidth(50 * 2) | ||
| 219 | + : ScreenUtil().setWidth(50 * 2), | ||
| 220 | + height: ScreenUtil().setWidth(20 * 2), | ||
| 221 | + radius: ScreenUtil().setWidth(10), | ||
| 222 | + text: '删除', | ||
| 223 | + fontSize: 24, | ||
| 224 | + textColor: MyColours.color_E34D59, | ||
| 225 | + gradientStart: MyColours.color_ffffff, | ||
| 226 | + gradientEnd: MyColours.color_ffffff, | ||
| 227 | + borderColor: MyColours.color_E34D59, | ||
| 228 | + onPressed: widget.onPressedDel, | ||
| 229 | + ), | ||
| 230 | + HEmptyView(34), | ||
| 231 | + RoundButton( | ||
| 232 | + width: ScreenUtil().setWidth(50 * 2), | ||
| 233 | + height: ScreenUtil().setWidth(20 * 2), | ||
| 234 | + radius: ScreenUtil().setWidth(10), | ||
| 235 | + text: widget.rechargeListSunModel.isOpen == '1' | ||
| 236 | + ? '禁用' | ||
| 237 | + : '启用', | ||
| 212 | 238 | ||
| 213 | - ///启用 | ||
| 214 | - fontSize: 24, | ||
| 215 | - textColor: MyColours.color_438E93, | ||
| 216 | - gradientStart: MyColours.color_ffffff, | ||
| 217 | - gradientEnd: MyColours.color_ffffff, | ||
| 218 | - borderColor: MyColours.color_438E93, | ||
| 219 | - onPressed: widget.onPressedUse, | 239 | + ///启用 |
| 240 | + fontSize: 24, | ||
| 241 | + textColor: MyColours.color_438E93, | ||
| 242 | + gradientStart: MyColours.color_ffffff, | ||
| 243 | + gradientEnd: MyColours.color_ffffff, | ||
| 244 | + borderColor: MyColours.color_438E93, | ||
| 245 | + onPressed: widget.onPressedUse, | ||
| 246 | + ), | ||
| 247 | + HEmptyView(38), | ||
| 248 | + ], | ||
| 249 | + ), | ||
| 250 | + if (widget.showBtn) VEmptyView(15) | ||
| 251 | + ], | ||
| 220 | ), | 252 | ), |
| 221 | - HEmptyView(38), | ||
| 222 | - ], | ||
| 223 | - ), | ||
| 224 | - if (widget.showBtn) VEmptyView(15) | ||
| 225 | - ], | ||
| 226 | - ), | ||
| 227 | - )); | 253 | + )), |
| 254 | + widget.showCheck | ||
| 255 | + ? Positioned( | ||
| 256 | + left: w(10), | ||
| 257 | + top: ScreenUtil().setWidth(115), | ||
| 258 | + child: Image.asset( | ||
| 259 | + Utils.getImgPath(widget.rechargeListSunModel.isCheck | ||
| 260 | + ? 'select_f' | ||
| 261 | + : 'show_select_f'), | ||
| 262 | + width: ScreenUtil().setWidth(50), | ||
| 263 | + height: ScreenUtil().setWidth(50), | ||
| 264 | + )) | ||
| 265 | + : SizedBox() | ||
| 266 | + ])); | ||
| 228 | } | 267 | } |
| 229 | } | 268 | } |
| @@ -164,11 +164,17 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -164,11 +164,17 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 164 | _getSmsInfo(context) async { | 164 | _getSmsInfo(context) async { |
| 165 | smsInfoData = await myModel.getSmsInfo(context); | 165 | smsInfoData = await myModel.getSmsInfo(context); |
| 166 | if (myModel.smsInfo == '0') { | 166 | if (myModel.smsInfo == '0') { |
| 167 | + if (!mounted) { | ||
| 168 | + return; | ||
| 169 | + } | ||
| 167 | setState(() { | 170 | setState(() { |
| 168 | smsErro = '短信余额不足,请充值短信条数'; | 171 | smsErro = '短信余额不足,请充值短信条数'; |
| 169 | showErro = smsErro; | 172 | showErro = smsErro; |
| 170 | }); | 173 | }); |
| 171 | } else { | 174 | } else { |
| 175 | + if (!mounted) { | ||
| 176 | + return; | ||
| 177 | + } | ||
| 172 | setState(() { | 178 | setState(() { |
| 173 | smsErro = ''; | 179 | smsErro = ''; |
| 174 | showErro = ''; | 180 | showErro = ''; |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:one_key/constant/state.dart'; | 2 | import 'package:one_key/constant/state.dart'; |
| 3 | +import 'package:one_key/models/recharge_list_model.dart'; | ||
| 3 | import 'package:one_key/provider/user_model.dart'; | 4 | import 'package:one_key/provider/user_model.dart'; |
| 4 | import 'package:provider/provider.dart'; | 5 | import 'package:provider/provider.dart'; |
| 5 | 6 | ||
| @@ -17,7 +18,12 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -17,7 +18,12 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 17 | MarkDataModel markDataModel; | 18 | MarkDataModel markDataModel; |
| 18 | 19 | ||
| 19 | PageState pageState = PageState.Loading; | 20 | PageState pageState = PageState.Loading; |
| 20 | - PageState pageStateRechargeHome = PageState.Success; | 21 | + PageState pageStateRechargeHome = PageState.Loading; |
| 22 | + | ||
| 23 | + List<RechargeListSunModel> rechargeList = []; | ||
| 24 | + | ||
| 25 | + RechargeListSunModel rechargeDetail; //充值优惠详情 | ||
| 26 | + PageState pageStateDetail = PageState.Loading; | ||
| 21 | 27 | ||
| 22 | //获取桌位列表 | 28 | //获取桌位列表 |
| 23 | getTableList(context, {needLoading = true}) async { | 29 | getTableList(context, {needLoading = true}) async { |
| @@ -108,4 +114,105 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -108,4 +114,105 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 108 | notifyListeners(); | 114 | notifyListeners(); |
| 109 | return false; | 115 | return false; |
| 110 | } | 116 | } |
| 117 | + | ||
| 118 | + // 商家设置预订安排模板页面 | ||
| 119 | + Future<bool> createNewRecharge( | ||
| 120 | + BuildContext context, Map<String, String> params, | ||
| 121 | + {bool showLoading = true}) async { | ||
| 122 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 123 | + .request<dynamic>(context, Method.get, HttpUrl.create_new_recharge, | ||
| 124 | + data: params, showLoading: showLoading) | ||
| 125 | + .catchError((error) { | ||
| 126 | + print(error.toString()); | ||
| 127 | + if (params['id'] == null) { | ||
| 128 | + Utils.showToast('创建新充值活动失败,请重试'); | ||
| 129 | + } else { | ||
| 130 | + Utils.showToast('修改新充值活动失败,请重试'); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + return false; | ||
| 134 | + }); | ||
| 135 | + if (baseResp.code == Constant.status_success) { | ||
| 136 | + if (baseResp.data is Map || baseResp.data == 1) { | ||
| 137 | + return true; | ||
| 138 | + } else { | ||
| 139 | + if (params['id'] == null) { | ||
| 140 | + Utils.showToast('创建新充值活动失败,请重试'); | ||
| 141 | + } else { | ||
| 142 | + Utils.showToast('修改新充值活动失败,请重试'); | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + } else { | ||
| 146 | + if (params['id'] == null) { | ||
| 147 | + Utils.showToast(baseResp.msg ?? '创建新充值活动失败,请重试'); | ||
| 148 | + } else { | ||
| 149 | + Utils.showToast(baseResp.msg ?? '修改新充值活动失败,请重试'); | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | + return false; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + // 获取新充值活动列表 | ||
| 156 | + Future<bool> getNewRechargeList(BuildContext context, | ||
| 157 | + {bool showLoading = true}) async { | ||
| 158 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 159 | + Map<String, String> params = { | ||
| 160 | + "sellerid": userModel.user.sellerid, | ||
| 161 | + // 'uid': userModel.user.openid | ||
| 162 | + }; | ||
| 163 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 164 | + .request<dynamic>(context, Method.get, HttpUrl.get_new_recharge_list, | ||
| 165 | + data: params, showLoading: showLoading) | ||
| 166 | + .catchError((error) { | ||
| 167 | + pageStateRechargeHome = PageState.ConnectivityError; | ||
| 168 | + print(error.toString()); | ||
| 169 | + Utils.showToast('获取新充值活动列表失败,请重试'); | ||
| 170 | + notifyListeners(); | ||
| 171 | + return false; | ||
| 172 | + }); | ||
| 173 | + if (baseResp.code == Constant.status_success) { | ||
| 174 | + rechargeList = RechargeListModel.fromJson(baseResp.responseData).data; | ||
| 175 | + if (rechargeList.length == 0) { | ||
| 176 | + pageStateRechargeHome = PageState.Empty; | ||
| 177 | + } else { | ||
| 178 | + pageStateRechargeHome = PageState.Success; | ||
| 179 | + } | ||
| 180 | + notifyListeners(); | ||
| 181 | + return true; | ||
| 182 | + } else { | ||
| 183 | + Utils.showToast(baseResp.msg); | ||
| 184 | + pageStateRechargeHome = PageState.ConnectivityError; | ||
| 185 | + } | ||
| 186 | + notifyListeners(); | ||
| 187 | + return false; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + // 获取新充值活动详情 | ||
| 191 | + Future<bool> getNewRechargeDetail(BuildContext context, String id, | ||
| 192 | + {bool showLoading = true}) async { | ||
| 193 | + Map<String, String> params = { | ||
| 194 | + "id": id, | ||
| 195 | + }; | ||
| 196 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 197 | + .request<dynamic>(context, Method.get, HttpUrl.get_new_recharge_detail, | ||
| 198 | + data: params, showLoading: showLoading) | ||
| 199 | + .catchError((error) { | ||
| 200 | + pageStateDetail = PageState.ConnectivityError; | ||
| 201 | + print(error.toString()); | ||
| 202 | + Utils.showToast('获取新充值活动详情失败,请重试'); | ||
| 203 | + notifyListeners(); | ||
| 204 | + return false; | ||
| 205 | + }); | ||
| 206 | + if (baseResp.code == Constant.status_success) { | ||
| 207 | + rechargeDetail = RechargeListSunModel.fromJson(baseResp.data); | ||
| 208 | + pageStateDetail = PageState.Success; | ||
| 209 | + notifyListeners(); | ||
| 210 | + return true; | ||
| 211 | + } else { | ||
| 212 | + Utils.showToast(baseResp.msg); | ||
| 213 | + pageStateDetail = PageState.ConnectivityError; | ||
| 214 | + } | ||
| 215 | + notifyListeners(); | ||
| 216 | + return false; | ||
| 217 | + } | ||
| 111 | } | 218 | } |
| @@ -1450,10 +1450,10 @@ class NavigatorUtil { | @@ -1450,10 +1450,10 @@ class NavigatorUtil { | ||
| 1450 | 1450 | ||
| 1451 | ///预订安排通知定制------优惠券选择 | 1451 | ///预订安排通知定制------优惠券选择 |
| 1452 | static Future<dynamic> goMarkingCouponSelectPage( | 1452 | static Future<dynamic> goMarkingCouponSelectPage( |
| 1453 | - BuildContext context, { | 1453 | + BuildContext context,String idstr, { |
| 1454 | replace = false, | 1454 | replace = false, |
| 1455 | }) { | 1455 | }) { |
| 1456 | - return _navigateTo(context, "${Routes.marking_coupon_select_page}", | 1456 | + return _navigateTo(context, "${Routes.marking_coupon_select_page}?idstr=$idstr", |
| 1457 | replace: replace); | 1457 | replace: replace); |
| 1458 | } | 1458 | } |
| 1459 | 1459 | ||
| @@ -1555,9 +1555,10 @@ class NavigatorUtil { | @@ -1555,9 +1555,10 @@ class NavigatorUtil { | ||
| 1555 | ///充值优惠详情编辑页 | 1555 | ///充值优惠详情编辑页 |
| 1556 | static Future<dynamic> goRechargeEditPage( | 1556 | static Future<dynamic> goRechargeEditPage( |
| 1557 | BuildContext context, { | 1557 | BuildContext context, { |
| 1558 | + String idstr, | ||
| 1558 | replace = false, | 1559 | replace = false, |
| 1559 | }) { | 1560 | }) { |
| 1560 | - return _navigateTo(context, "${Routes.recharge_edit_page}", | 1561 | + return _navigateTo(context, "${Routes.recharge_edit_page}?idstr=$idstr", |
| 1561 | replace: replace); | 1562 | replace: replace); |
| 1562 | } | 1563 | } |
| 1563 | 1564 | ||
| @@ -1574,14 +1575,15 @@ class NavigatorUtil { | @@ -1574,14 +1575,15 @@ class NavigatorUtil { | ||
| 1574 | 1575 | ||
| 1575 | ///充值优惠详情页 | 1576 | ///充值优惠详情页 |
| 1576 | static Future<dynamic> goRechargeDetailPage( | 1577 | static Future<dynamic> goRechargeDetailPage( |
| 1577 | - BuildContext context, { | 1578 | + BuildContext context, |
| 1579 | + String idstr, { | ||
| 1578 | replace = false, | 1580 | replace = false, |
| 1579 | }) { | 1581 | }) { |
| 1580 | - return _navigateTo(context, "${Routes.recharge_detail_page}", | 1582 | + return _navigateTo(context, "${Routes.recharge_detail_page}?idstr=$idstr", |
| 1581 | replace: replace); | 1583 | replace: replace); |
| 1582 | } | 1584 | } |
| 1583 | 1585 | ||
| 1584 | - ///核销使用 | 1586 | + ///核销使用 |
| 1585 | static Future<dynamic> goVerificationCouponPage( | 1587 | static Future<dynamic> goVerificationCouponPage( |
| 1586 | BuildContext context, { | 1588 | BuildContext context, { |
| 1587 | replace = false, | 1589 | replace = false, |
| @@ -1590,5 +1592,14 @@ class NavigatorUtil { | @@ -1590,5 +1592,14 @@ class NavigatorUtil { | ||
| 1590 | replace: replace); | 1592 | replace: replace); |
| 1591 | } | 1593 | } |
| 1592 | 1594 | ||
| 1593 | - | 1595 | + ///预订安排通知定制------充值优惠选择 |
| 1596 | + static Future<dynamic> goMarkingRechargeSelectPage( | ||
| 1597 | + BuildContext context, | ||
| 1598 | + String idstr, { | ||
| 1599 | + replace = false, | ||
| 1600 | + }) { | ||
| 1601 | + return _navigateTo( | ||
| 1602 | + context, "${Routes.marking_recharge_select_page}?idstr=$idstr", | ||
| 1603 | + replace: replace); | ||
| 1604 | + } | ||
| 1594 | } | 1605 | } |
| @@ -188,6 +188,7 @@ import '../pages/my/marketing_center/book_notification/dish_show_page.dart'; | @@ -188,6 +188,7 @@ import '../pages/my/marketing_center/book_notification/dish_show_page.dart'; | ||
| 188 | import '../pages/my/marketing_center/book_notification/first_image_page.dart'; | 188 | import '../pages/my/marketing_center/book_notification/first_image_page.dart'; |
| 189 | import '../pages/my/marketing_center/book_notification/marking_coupon_select_page.dart'; | 189 | import '../pages/my/marketing_center/book_notification/marking_coupon_select_page.dart'; |
| 190 | import '../pages/my/marketing_center/book_notification/marking_preview_page.dart'; | 190 | import '../pages/my/marketing_center/book_notification/marking_preview_page.dart'; |
| 191 | +import '../pages/my/marketing_center/book_notification/marking_recharge_select_page.dart'; | ||
| 191 | import '../pages/my/marketing_center/book_notification/store_introduce_page.dart'; | 192 | import '../pages/my/marketing_center/book_notification/store_introduce_page.dart'; |
| 192 | import '../pages/my/marketing_center/marketing_center_home_page.dart'; | 193 | import '../pages/my/marketing_center/marketing_center_home_page.dart'; |
| 193 | import '../pages/my/marketing_center/recharge/recharge_detail_page.dart'; | 194 | import '../pages/my/marketing_center/recharge/recharge_detail_page.dart'; |
| @@ -2392,12 +2393,12 @@ var markingInteractionPageHandle = new Handler( | @@ -2392,12 +2393,12 @@ var markingInteractionPageHandle = new Handler( | ||
| 2392 | //我的----营销中心-优惠券选择 | 2393 | //我的----营销中心-优惠券选择 |
| 2393 | var markingCouponSelectPageHandle = new Handler( | 2394 | var markingCouponSelectPageHandle = new Handler( |
| 2394 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | 2395 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { |
| 2395 | - // String idstr = params["idstr"].first; | 2396 | + String idstr = params["idstr"].first; |
| 2396 | // NotebookDetail detailEntity = NotebookDetail.fromJson(json | 2397 | // NotebookDetail detailEntity = NotebookDetail.fromJson(json |
| 2397 | // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | 2398 | // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); |
| 2398 | return ChangeNotifierProvider<MarketingCenterProvider>( | 2399 | return ChangeNotifierProvider<MarketingCenterProvider>( |
| 2399 | create: (_) => MarketingCenterProvider(), | 2400 | create: (_) => MarketingCenterProvider(), |
| 2400 | - child: MarkingCouponSelectPage()); | 2401 | + child: MarkingCouponSelectPage(selectid:idstr)); |
| 2401 | }); | 2402 | }); |
| 2402 | 2403 | ||
| 2403 | //我的----营销中心-预订安排预览页 | 2404 | //我的----营销中心-预订安排预览页 |
| @@ -2518,9 +2519,11 @@ var rechargeEditPageHandle = new Handler( | @@ -2518,9 +2519,11 @@ var rechargeEditPageHandle = new Handler( | ||
| 2518 | // OutWineRecordSunModel outWineRecordSunModel = OutWineRecordSunModel.fromJson( | 2519 | // OutWineRecordSunModel outWineRecordSunModel = OutWineRecordSunModel.fromJson( |
| 2519 | // json.decode( | 2520 | // json.decode( |
| 2520 | // FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | 2521 | // FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); |
| 2522 | + String idstr = params["idstr"].first; | ||
| 2521 | 2523 | ||
| 2522 | return ChangeNotifierProvider<MarketingCenterProvider>( | 2524 | return ChangeNotifierProvider<MarketingCenterProvider>( |
| 2523 | - create: (_) => MarketingCenterProvider(), child: RechargeEditPage()); | 2525 | + create: (_) => MarketingCenterProvider(), |
| 2526 | + child: RechargeEditPage(idstr: idstr)); | ||
| 2524 | }); | 2527 | }); |
| 2525 | 2528 | ||
| 2526 | ///充值优惠选择店铺可核销优惠券 | 2529 | ///充值优惠选择店铺可核销优惠券 |
| @@ -2553,9 +2556,13 @@ var rechargeDetailPageHandle = new Handler( | @@ -2553,9 +2556,13 @@ var rechargeDetailPageHandle = new Handler( | ||
| 2553 | // List<String> selectList = []; | 2556 | // List<String> selectList = []; |
| 2554 | // if (selectIDs.length > 0) { | 2557 | // if (selectIDs.length > 0) { |
| 2555 | // selectList = selectIDs.split(','); | 2558 | // selectList = selectIDs.split(','); |
| 2559 | + | ||
| 2556 | // } | 2560 | // } |
| 2561 | + String idstr = params["idstr"].first; | ||
| 2562 | + | ||
| 2557 | return ChangeNotifierProvider<MarketingCenterProvider>( | 2563 | return ChangeNotifierProvider<MarketingCenterProvider>( |
| 2558 | - create: (_) => MarketingCenterProvider(), child: RechargeDetailPage()); | 2564 | + create: (_) => MarketingCenterProvider(), |
| 2565 | + child: RechargeDetailPage(idstr: idstr)); | ||
| 2559 | }); | 2566 | }); |
| 2560 | 2567 | ||
| 2561 | ///核销使用 | 2568 | ///核销使用 |
| @@ -2573,3 +2580,14 @@ var verificationCouponPageHandle = new Handler( | @@ -2573,3 +2580,14 @@ var verificationCouponPageHandle = new Handler( | ||
| 2573 | return ChangeNotifierProvider<CouponProvider>( | 2580 | return ChangeNotifierProvider<CouponProvider>( |
| 2574 | create: (_) => CouponProvider(), child: VerificationCouponPage()); | 2581 | create: (_) => CouponProvider(), child: VerificationCouponPage()); |
| 2575 | }); | 2582 | }); |
| 2583 | + | ||
| 2584 | +///充值优惠选择 | ||
| 2585 | +var markingRechargeSelectPageHandle = new Handler( | ||
| 2586 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 2587 | + String idstr = params["idstr"].first; | ||
| 2588 | + // NotebookDetail detailEntity = NotebookDetail.fromJson(json | ||
| 2589 | + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | ||
| 2590 | + return ChangeNotifierProvider<MarketingCenterProvider>( | ||
| 2591 | + create: (_) => MarketingCenterProvider(), | ||
| 2592 | + child: MarkingRechargeSelectPage(selectid: idstr)); | ||
| 2593 | +}); |
| @@ -235,6 +235,10 @@ static String recharge_detail_page = | @@ -235,6 +235,10 @@ static String recharge_detail_page = | ||
| 235 | static String verification_coupon_page = | 235 | static String verification_coupon_page = |
| 236 | "/verification_coupon_page"; //核销使用 | 236 | "/verification_coupon_page"; //核销使用 |
| 237 | 237 | ||
| 238 | + static String marking_recharge_select_page = | ||
| 239 | + "/marking_recharge_select_page"; //充值优惠单选择页面 | ||
| 240 | + | ||
| 241 | + | ||
| 238 | 242 | ||
| 239 | 243 | ||
| 240 | 244 | ||
| @@ -456,6 +460,10 @@ router.define(recharge_detail_page, | @@ -456,6 +460,10 @@ router.define(recharge_detail_page, | ||
| 456 | handler: rechargeDetailPageHandle); | 460 | handler: rechargeDetailPageHandle); |
| 457 | router.define(verification_coupon_page, | 461 | router.define(verification_coupon_page, |
| 458 | handler: verificationCouponPageHandle); | 462 | handler: verificationCouponPageHandle); |
| 463 | + | ||
| 464 | +router.define(marking_recharge_select_page, | ||
| 465 | + handler: markingRechargeSelectPageHandle); | ||
| 466 | + | ||
| 459 | 467 | ||
| 460 | 468 | ||
| 461 | 469 |
| @@ -1630,6 +1630,21 @@ class Utils { | @@ -1630,6 +1630,21 @@ class Utils { | ||
| 1630 | return result.toString(); | 1630 | return result.toString(); |
| 1631 | } | 1631 | } |
| 1632 | 1632 | ||
| 1633 | + static String listToStringEnglish3(List<dynamic> list) { | ||
| 1634 | + if (list == null) { | ||
| 1635 | + return null; | ||
| 1636 | + } | ||
| 1637 | + String result; | ||
| 1638 | + list.forEach((string) { | ||
| 1639 | + if (result == null) { | ||
| 1640 | + result = string; | ||
| 1641 | + } else { | ||
| 1642 | + result = '$result、$string'; | ||
| 1643 | + } | ||
| 1644 | + }); | ||
| 1645 | + return result.toString(); | ||
| 1646 | + } | ||
| 1647 | + | ||
| 1633 | static String listToStringEnglish(List<String> list) { | 1648 | static String listToStringEnglish(List<String> list) { |
| 1634 | if (list == null) { | 1649 | if (list == null) { |
| 1635 | return null; | 1650 | return null; |
-
Please register or login to post a comment