Showing
13 changed files
with
404 additions
and
127 deletions
| @@ -317,7 +317,7 @@ class MarkMarketingModel { | @@ -317,7 +317,7 @@ class MarkMarketingModel { | ||
| 317 | String isRecharge; | 317 | String isRecharge; |
| 318 | RechargeListSunModel rechargeData; | 318 | RechargeListSunModel rechargeData; |
| 319 | 319 | ||
| 320 | - CouponSunModel couponData; | 320 | + List<CouponSunModel> couponDataList; |
| 321 | 321 | ||
| 322 | MarkMarketingModel( | 322 | MarkMarketingModel( |
| 323 | {this.isArrival, | 323 | {this.isArrival, |
| @@ -343,10 +343,28 @@ class MarkMarketingModel { | @@ -343,10 +343,28 @@ class MarkMarketingModel { | ||
| 343 | rechargeData = json['recharge_data'] != null | 343 | rechargeData = json['recharge_data'] != null |
| 344 | ? new RechargeListSunModel.fromJson(json['recharge_data']) | 344 | ? new RechargeListSunModel.fromJson(json['recharge_data']) |
| 345 | : null; | 345 | : null; |
| 346 | - | ||
| 347 | - couponData = json['coupon_data'] != null | ||
| 348 | - ? new CouponSunModel.fromJson(json['coupon_data']) | ||
| 349 | - : null; | 346 | + if (json['coupon_data'] != null) { |
| 347 | + couponDataList = <CouponSunModel>[]; | ||
| 348 | + if (json['coupon_data'] is Map) { | ||
| 349 | + //旧数据map | ||
| 350 | + couponDataList.add(CouponSunModel.fromJson(json['coupon_data'])); | ||
| 351 | + } else { | ||
| 352 | + var couponData = convert.jsonDecode(json['coupon_data']); | ||
| 353 | + if (couponData is List) { | ||
| 354 | + couponData.forEach((v) { | ||
| 355 | + couponDataList.add(CouponSunModel.fromJson(v)); | ||
| 356 | + }); | ||
| 357 | + } else if (couponData is Map) { | ||
| 358 | + // json['coupon_data'].forEach((v) { | ||
| 359 | + couponDataList.add(CouponSunModel.fromJson(couponData)); | ||
| 360 | + // }); | ||
| 361 | + } else { | ||
| 362 | + couponData.forEach((v) { | ||
| 363 | + couponDataList.add(v); | ||
| 364 | + }); | ||
| 365 | + } | ||
| 366 | + } | ||
| 367 | + } | ||
| 350 | } | 368 | } |
| 351 | 369 | ||
| 352 | Map<String, dynamic> toJson() { | 370 | Map<String, dynamic> toJson() { |
| @@ -361,7 +379,7 @@ class MarkMarketingModel { | @@ -361,7 +379,7 @@ class MarkMarketingModel { | ||
| 361 | data['is_coupon'] = this.isCoupon; | 379 | data['is_coupon'] = this.isCoupon; |
| 362 | data['is_recharge'] = this.isRecharge; | 380 | data['is_recharge'] = this.isRecharge; |
| 363 | data['recharge_data'] = this.rechargeData; | 381 | data['recharge_data'] = this.rechargeData; |
| 364 | - data['coupon_data'] = this.couponData; | 382 | + data['coupon_data'] = this.couponDataList; |
| 365 | 383 | ||
| 366 | return data; | 384 | return data; |
| 367 | } | 385 | } |
| @@ -255,6 +255,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -255,6 +255,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 255 | // bus.emit('refresh_coupon_list'); | 255 | // bus.emit('refresh_coupon_list'); |
| 256 | EventBus().emit('refresh_coupon_invitation'); | 256 | EventBus().emit('refresh_coupon_invitation'); |
| 257 | bus.emit('refresh_coupon_list_f'); | 257 | bus.emit('refresh_coupon_list_f'); |
| 258 | + bus.emit('refresh_marketting_page'); | ||
| 258 | 259 | ||
| 259 | bus.emit('refresh_table_m_coupon'); | 260 | bus.emit('refresh_table_m_coupon'); |
| 260 | Navigator.pop(context, true); | 261 | Navigator.pop(context, true); |
| @@ -711,7 +712,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -711,7 +712,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 711 | _textfield('销售价', '默认0元,可以免费发放', | 712 | _textfield('销售价', '默认0元,可以免费发放', |
| 712 | _priceControl, _priceFocusNode, | 713 | _priceControl, _priceFocusNode, |
| 713 | textInputType: | 714 | textInputType: |
| 714 | - TextInputType.numberWithOptions(decimal: true)), | 715 | + TextInputType.numberWithOptions( |
| 716 | + decimal: true)), | ||
| 715 | 717 | ||
| 716 | Container( | 718 | Container( |
| 717 | height: ScreenUtil().setWidth(2), | 719 | height: ScreenUtil().setWidth(2), |
| @@ -52,7 +52,6 @@ class _CouponSunPageState extends State<CouponSunPage> { | @@ -52,7 +52,6 @@ class _CouponSunPageState extends State<CouponSunPage> { | ||
| 52 | 52 | ||
| 53 | @override | 53 | @override |
| 54 | void dispose() { | 54 | void dispose() { |
| 55 | - | ||
| 56 | super.dispose(); | 55 | super.dispose(); |
| 57 | } | 56 | } |
| 58 | 57 | ||
| @@ -77,6 +76,7 @@ class _CouponSunPageState extends State<CouponSunPage> { | @@ -77,6 +76,7 @@ class _CouponSunPageState extends State<CouponSunPage> { | ||
| 77 | bool isSuccess = await couponProvider.setCustomerActivity(context, params, | 76 | bool isSuccess = await couponProvider.setCustomerActivity(context, params, |
| 78 | isShowLoading: false); | 77 | isShowLoading: false); |
| 79 | print(isSuccess); | 78 | print(isSuccess); |
| 79 | + bus.emit('refresh_marketting_page'); | ||
| 80 | _couponNetworkData(widget.index, isShowLoading: false); | 80 | _couponNetworkData(widget.index, isShowLoading: false); |
| 81 | // if (isSuccess) { | 81 | // if (isSuccess) { |
| 82 | // couponProvider.notifyListeners(); | 82 | // couponProvider.notifyListeners(); |
| @@ -30,8 +30,8 @@ import '../../../../models/coupon_model.dart'; | @@ -30,8 +30,8 @@ import '../../../../models/coupon_model.dart'; | ||
| 30 | * 优惠券单选页面 | 30 | * 优惠券单选页面 |
| 31 | */ | 31 | */ |
| 32 | class MarkingCouponSelectPage extends StatefulWidget { | 32 | class MarkingCouponSelectPage extends StatefulWidget { |
| 33 | - final String selectid; | ||
| 34 | - MarkingCouponSelectPage({Key key, this.selectid}) : super(key: key); | 33 | + final List<CouponSunModel> couponList; |
| 34 | + MarkingCouponSelectPage({Key key, this.couponList}) : super(key: key); | ||
| 35 | 35 | ||
| 36 | @override | 36 | @override |
| 37 | _MarkingCouponSelectPageState createState() => | 37 | _MarkingCouponSelectPageState createState() => |
| @@ -42,7 +42,7 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -42,7 +42,7 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 42 | EasyRefreshController _controller = EasyRefreshController(); | 42 | EasyRefreshController _controller = EasyRefreshController(); |
| 43 | CouponProvider couponProvider; | 43 | CouponProvider couponProvider; |
| 44 | 44 | ||
| 45 | - CouponSunModel selectData; | 45 | + List<CouponSunModel> selectDataList = []; |
| 46 | 46 | ||
| 47 | ///获取优惠券列表数据(status == 1) | 47 | ///获取优惠券列表数据(status == 1) |
| 48 | 48 | ||
| @@ -55,14 +55,24 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -55,14 +55,24 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 55 | await couponProvider.getCustomerSelectActivityMarking(context, params, | 55 | await couponProvider.getCustomerSelectActivityMarking(context, params, |
| 56 | isShowLoading: isShowLoading); | 56 | isShowLoading: isShowLoading); |
| 57 | 57 | ||
| 58 | - outerloop: | ||
| 59 | - for (var i = 0; i < couponProvider.couponListSelect.length; i++) { | ||
| 60 | - if (couponProvider.couponListSelect[i].id == widget.selectid) { | ||
| 61 | - couponProvider.couponListSelect[i].isCheck = true; | ||
| 62 | - selectData = couponProvider.couponListSelect[i]; | ||
| 63 | - break outerloop; | 58 | + // outerloop: |
| 59 | + // for (var i = 0; i < couponProvider.couponListSelect.length; i++) { | ||
| 60 | + // if (couponProvider.couponListSelect[i].id == widget.couponList) { | ||
| 61 | + // couponProvider.couponListSelect[i].isCheck = true; | ||
| 62 | + // selectDataList.add(couponProvider.couponListSelect[i]); | ||
| 63 | + // // break outerloop; | ||
| 64 | + // } | ||
| 65 | + // } | ||
| 66 | + for (var item in couponProvider.couponListSelect) { | ||
| 67 | + for (var itemselect in widget.couponList) { | ||
| 68 | + if (itemselect.id == item.id) { | ||
| 69 | + item.isCheck = true; | ||
| 70 | + selectDataList.add(item); | ||
| 71 | + // break outerloop; | ||
| 72 | + } | ||
| 64 | } | 73 | } |
| 65 | } | 74 | } |
| 75 | + | ||
| 66 | setState(() {}); | 76 | setState(() {}); |
| 67 | } | 77 | } |
| 68 | 78 | ||
| @@ -130,16 +140,26 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -130,16 +140,26 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 130 | return InkWell( | 140 | return InkWell( |
| 131 | onTap: () { | 141 | onTap: () { |
| 132 | //改这里 ******8 | 142 | //改这里 ******8 |
| 133 | - couponProvider.couponListSelect | ||
| 134 | - .forEach((element) { | ||
| 135 | - element.isCheck = false; | ||
| 136 | - }); | 143 | + // couponProvider.couponListSelect |
| 144 | + // .forEach((element) { | ||
| 145 | + // element.isCheck = false; | ||
| 146 | + // }); | ||
| 137 | 147 | ||
| 148 | + // couponProvider.couponListSelect[index].isCheck = | ||
| 149 | + // true; | ||
| 138 | couponProvider.couponListSelect[index].isCheck = | 150 | couponProvider.couponListSelect[index].isCheck = |
| 139 | - true; | ||
| 140 | - | ||
| 141 | - selectData = | ||
| 142 | - couponProvider.couponListSelect[index]; | 151 | + !couponProvider |
| 152 | + .couponListSelect[index].isCheck; | ||
| 153 | + if (couponProvider | ||
| 154 | + .couponListSelect[index].isCheck) { | ||
| 155 | + selectDataList.add( | ||
| 156 | + couponProvider.couponListSelect[index]); | ||
| 157 | + } else { | ||
| 158 | + selectDataList.remove( | ||
| 159 | + couponProvider.couponListSelect[index]); | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + setState(() {}); | ||
| 143 | }, | 163 | }, |
| 144 | // child: Row( | 164 | // child: Row( |
| 145 | // children: [ | 165 | // children: [ |
| @@ -168,16 +188,18 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -168,16 +188,18 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 168 | // bool old = couponProvider | 188 | // bool old = couponProvider |
| 169 | // .couponListSelect[index].isCheck; | 189 | // .couponListSelect[index].isCheck; |
| 170 | //改这里 ******8 | 190 | //改这里 ******8 |
| 171 | - couponProvider.couponListSelect | ||
| 172 | - .forEach((element) { | ||
| 173 | - element.isCheck = false; | ||
| 174 | - }); | ||
| 175 | - | ||
| 176 | couponProvider | 191 | couponProvider |
| 177 | - .couponListSelect[index].isCheck = true; | ||
| 178 | - | ||
| 179 | - selectData = | ||
| 180 | - couponProvider.couponListSelect[index]; | 192 | + .couponListSelect[index].isCheck = |
| 193 | + !couponProvider | ||
| 194 | + .couponListSelect[index].isCheck; | ||
| 195 | + if (couponProvider | ||
| 196 | + .couponListSelect[index].isCheck) { | ||
| 197 | + selectDataList.add(couponProvider | ||
| 198 | + .couponListSelect[index]); | ||
| 199 | + } else { | ||
| 200 | + selectDataList.remove(couponProvider | ||
| 201 | + .couponListSelect[index]); | ||
| 202 | + } | ||
| 181 | 203 | ||
| 182 | // couponProvider | 204 | // couponProvider |
| 183 | // .couponListSelect[index].isCheck = !old; | 205 | // .couponListSelect[index].isCheck = !old; |
| @@ -205,8 +227,8 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | @@ -205,8 +227,8 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 205 | ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), | 227 | ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), |
| 206 | child: RoundButton( | 228 | child: RoundButton( |
| 207 | onPressed: () async { | 229 | onPressed: () async { |
| 208 | - Map temp = { | ||
| 209 | - 'coupon': selectData, | 230 | + Map temp = { |
| 231 | + 'coupon': selectDataList, | ||
| 210 | }; | 232 | }; |
| 211 | Navigator.pop(context, temp); | 233 | Navigator.pop(context, temp); |
| 212 | }, | 234 | }, |
| @@ -20,6 +20,7 @@ import '../../../../provider/upload_img_provider.dart'; | @@ -20,6 +20,7 @@ import '../../../../provider/upload_img_provider.dart'; | ||
| 20 | import '../../../../provider/user_model.dart'; | 20 | import '../../../../provider/user_model.dart'; |
| 21 | import '../../../../res/colors.dart'; | 21 | import '../../../../res/colors.dart'; |
| 22 | import '../../../../route/navigator_util.dart'; | 22 | import '../../../../route/navigator_util.dart'; |
| 23 | +import '../../../../utils/event_bus.dart'; | ||
| 23 | import '../../../../utils/screen_util.dart'; | 24 | import '../../../../utils/screen_util.dart'; |
| 24 | import '../../../../utils/upload_image_util.dart'; | 25 | import '../../../../utils/upload_image_util.dart'; |
| 25 | import '../../../../widgets/MyDivider.dart'; | 26 | import '../../../../widgets/MyDivider.dart'; |
| @@ -56,7 +57,9 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -56,7 +57,9 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 56 | RechargeListSunModel rechargeData; | 57 | RechargeListSunModel rechargeData; |
| 57 | String rechargeContent = ''; | 58 | String rechargeContent = ''; |
| 58 | 59 | ||
| 59 | - CouponSunModel couponData; | 60 | + List<CouponSunModel> couponDataList = []; |
| 61 | + List<RechargeListSunModel> rechargeListCanUse = []; | ||
| 62 | + ScrollController controller = ScrollController(); | ||
| 60 | 63 | ||
| 61 | @override | 64 | @override |
| 62 | void initState() { | 65 | void initState() { |
| @@ -65,12 +68,21 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -65,12 +68,21 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 65 | _couponNetworkData(); | 68 | _couponNetworkData(); |
| 66 | _getNewRechargeList(); | 69 | _getNewRechargeList(); |
| 67 | getSellerTemplateConf(); | 70 | getSellerTemplateConf(); |
| 71 | + bus.on('refresh_marketting_page', (arg) { | ||
| 72 | + _couponNetworkData(); | ||
| 73 | + }); | ||
| 74 | + bus.on('refresh_marketting_page_recharge', (arg) { | ||
| 75 | + _getNewRechargeList(); | ||
| 76 | + }); | ||
| 68 | }); | 77 | }); |
| 69 | } | 78 | } |
| 70 | 79 | ||
| 71 | @override | 80 | @override |
| 72 | void dispose() { | 81 | void dispose() { |
| 73 | _uploadImageProvider.firstImage = UploadImgModel(); | 82 | _uploadImageProvider.firstImage = UploadImgModel(); |
| 83 | + bus.off('refresh_marketting_page'); | ||
| 84 | + bus.off('refresh_marketting_page_recharge'); | ||
| 85 | + | ||
| 74 | super.dispose(); | 86 | super.dispose(); |
| 75 | } | 87 | } |
| 76 | 88 | ||
| @@ -81,7 +93,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -81,7 +93,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 81 | // 'uid': userModel.user.openid | 93 | // 'uid': userModel.user.openid |
| 82 | }; | 94 | }; |
| 83 | await marketingCenterProvider.getNewRechargeList(context, params); | 95 | await marketingCenterProvider.getNewRechargeList(context, params); |
| 84 | - List<RechargeListSunModel> rechargeListCanUse = []; | 96 | + rechargeListCanUse = []; |
| 85 | if (marketingCenterProvider.rechargeList.length > 0) { | 97 | if (marketingCenterProvider.rechargeList.length > 0) { |
| 86 | marketingCenterProvider.rechargeList.forEach((element) { | 98 | marketingCenterProvider.rechargeList.forEach((element) { |
| 87 | if (element.isOpen == '1') { | 99 | if (element.isOpen == '1') { |
| @@ -148,7 +160,8 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -148,7 +160,8 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 148 | 160 | ||
| 149 | rechargeData = | 161 | rechargeData = |
| 150 | marketingCenterProvider.markDataModel.marketing.rechargeData; | 162 | marketingCenterProvider.markDataModel.marketing.rechargeData; |
| 151 | - couponData = marketingCenterProvider.markDataModel.marketing.couponData; | 163 | + couponDataList = |
| 164 | + marketingCenterProvider.markDataModel.marketing.couponDataList; | ||
| 152 | 165 | ||
| 153 | _uploadImageProvider.firstImage.qiniuUrl = | 166 | _uploadImageProvider.firstImage.qiniuUrl = |
| 154 | marketingCenterProvider.markDataModel.marketing.logo ?? null; | 167 | marketingCenterProvider.markDataModel.marketing.logo ?? null; |
| @@ -175,10 +188,10 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -175,10 +188,10 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 175 | 188 | ||
| 176 | await couponProvider.getCustomerSelectActivityMarking(context, params, | 189 | await couponProvider.getCustomerSelectActivityMarking(context, params, |
| 177 | isShowLoading: isShowLoading); | 190 | isShowLoading: isShowLoading); |
| 178 | - if (couponData == null) { | 191 | + if (couponDataList == null || couponDataList.length == 0) { |
| 179 | if (couponProvider.couponListSelect != null && | 192 | if (couponProvider.couponListSelect != null && |
| 180 | couponProvider.couponListSelect.length > 0) { | 193 | couponProvider.couponListSelect.length > 0) { |
| 181 | - couponData = couponProvider.couponListSelect[0]; | 194 | + couponDataList.add(couponProvider.couponListSelect[0]); |
| 182 | 195 | ||
| 183 | setState(() {}); | 196 | setState(() {}); |
| 184 | } | 197 | } |
| @@ -393,13 +406,164 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -393,13 +406,164 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 393 | ); | 406 | ); |
| 394 | } | 407 | } |
| 395 | 408 | ||
| 409 | + ///优惠券 | ||
| 410 | + Widget _markingCupon({ | ||
| 411 | + VoidCallback onPressed, | ||
| 412 | + bool select = false, | ||
| 413 | + VoidCallback onPressedSelect, | ||
| 414 | + }) { | ||
| 415 | + return Container( | ||
| 416 | + margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)), | ||
| 417 | + child: Column( | ||
| 418 | + children: [ | ||
| 419 | + InkWell( | ||
| 420 | + onTap: onPressedSelect, | ||
| 421 | + child: Row( | ||
| 422 | + children: [ | ||
| 423 | + Image.asset( | ||
| 424 | + Utils.getImgPath(select ? 'f_select' : 'f_select_not'), | ||
| 425 | + width: w(20), | ||
| 426 | + ), | ||
| 427 | + HEmptyView(20), | ||
| 428 | + Text( | ||
| 429 | + '推荐店内代金券优惠', | ||
| 430 | + style: TextStyle( | ||
| 431 | + fontSize: font(14), color: MyColours.color_515151), | ||
| 432 | + ), | ||
| 433 | + Spacer(), | ||
| 434 | + RoundButton( | ||
| 435 | + text: '选择活动', | ||
| 436 | + width: w(72), | ||
| 437 | + height: w(22), | ||
| 438 | + gradientStart: MyColours.color_ffffff, | ||
| 439 | + gradientEnd: MyColours.color_ffffff, | ||
| 440 | + borderColor: MyColours.color_438E93, | ||
| 441 | + textColor: MyColours.color_438E93, | ||
| 442 | + radius: r(11), | ||
| 443 | + fontSize: 24, | ||
| 444 | + isBold: true, | ||
| 445 | + onPressed: onPressed, | ||
| 446 | + ) | ||
| 447 | + ], | ||
| 448 | + )), | ||
| 449 | + VEmptyView(20), | ||
| 450 | + ListView.builder( | ||
| 451 | + shrinkWrap: true, | ||
| 452 | + controller: controller, | ||
| 453 | + itemCount: couponDataList.length, | ||
| 454 | + itemBuilder: (BuildContext context, int index) { | ||
| 455 | + CouponSunModel couponData = couponDataList[index]; | ||
| 456 | + return _markingCuponItem( | ||
| 457 | + couponData.aname, | ||
| 458 | + _getCouponsDesc(couponData), | ||
| 459 | + couponData.price ?? '', | ||
| 460 | + couponData.use != null && couponData.use.isCash | ||
| 461 | + ? '${(double.parse(couponData.price) / double.parse(couponData.use.cash)) * 10}折' | ||
| 462 | + : '', | ||
| 463 | + '切换活动', | ||
| 464 | + select: isCoupon, onPressedSelect: () { | ||
| 465 | + setState(() { | ||
| 466 | + isCoupon = !isCoupon; | ||
| 467 | + }); | ||
| 468 | + }); | ||
| 469 | + }) | ||
| 470 | + ], | ||
| 471 | + ), | ||
| 472 | + ); | ||
| 473 | + } | ||
| 474 | + | ||
| 475 | + ///优惠券 | ||
| 476 | + Widget _markingCuponItem( | ||
| 477 | + String title, | ||
| 478 | + String content, | ||
| 479 | + String subtile, | ||
| 480 | + String discount, | ||
| 481 | + String btnTitle, { | ||
| 482 | + VoidCallback onPressed, | ||
| 483 | + bool select = false, | ||
| 484 | + VoidCallback onPressedSelect, | ||
| 485 | + }) { | ||
| 486 | + return Container( | ||
| 487 | + margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)), | ||
| 488 | + child: Container( | ||
| 489 | + padding: EdgeInsets.all(w(12)), | ||
| 490 | + decoration: BoxDecoration( | ||
| 491 | + borderRadius: BorderRadiusDirectional.circular(r(8)), | ||
| 492 | + border: Border.all(width: w(1), color: MyColours.color_DBDBDB)), | ||
| 493 | + child: Row( | ||
| 494 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 495 | + children: [ | ||
| 496 | + Expanded( | ||
| 497 | + child: Column( | ||
| 498 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 499 | + children: [ | ||
| 500 | + Row( | ||
| 501 | + children: [ | ||
| 502 | + Container( | ||
| 503 | + constraints: BoxConstraints(maxWidth: w(150)), | ||
| 504 | + child: Text( | ||
| 505 | + title, | ||
| 506 | + style: TextStyle( | ||
| 507 | + fontSize: font(14), | ||
| 508 | + fontWeight: FontWeight.bold, | ||
| 509 | + color: MyColours.color_515151), | ||
| 510 | + )), | ||
| 511 | + HEmptyView(20), | ||
| 512 | + subtile != '' | ||
| 513 | + ? Text( | ||
| 514 | + '¥${subtile}', | ||
| 515 | + style: TextStyle( | ||
| 516 | + fontSize: font(7), | ||
| 517 | + fontWeight: FontWeight.bold, | ||
| 518 | + color: MyColours.color_E34D59), | ||
| 519 | + ) | ||
| 520 | + : SizedBox(), | ||
| 521 | + HEmptyView(10), | ||
| 522 | + discount != '' | ||
| 523 | + ? Container( | ||
| 524 | + padding: EdgeInsets.symmetric( | ||
| 525 | + horizontal: w(3), vertical: w(2)), | ||
| 526 | + decoration: BoxDecoration( | ||
| 527 | + borderRadius: BorderRadius.circular(r(3)), | ||
| 528 | + border: Border.all( | ||
| 529 | + width: w(0.5), | ||
| 530 | + color: MyColours.color_E34D59)), | ||
| 531 | + child: Text( | ||
| 532 | + discount, | ||
| 533 | + style: TextStyle( | ||
| 534 | + color: MyColours.color_E34D59, | ||
| 535 | + fontSize: font(7)), | ||
| 536 | + ), | ||
| 537 | + ) | ||
| 538 | + : SizedBox(), | ||
| 539 | + ], | ||
| 540 | + ), | ||
| 541 | + if (content != '') VEmptyView(20), | ||
| 542 | + if (content != '') | ||
| 543 | + Text( | ||
| 544 | + content, | ||
| 545 | + style: TextStyle( | ||
| 546 | + height: 1.2, | ||
| 547 | + fontSize: font(10), | ||
| 548 | + fontWeight: FontWeight.bold, | ||
| 549 | + color: MyColours.color_515151), | ||
| 550 | + ) | ||
| 551 | + ], | ||
| 552 | + )), | ||
| 553 | + ], | ||
| 554 | + ), | ||
| 555 | + ), | ||
| 556 | + ); | ||
| 557 | + } | ||
| 558 | + | ||
| 396 | ///营销推广 | 559 | ///营销推广 |
| 397 | Widget _markingItem( | 560 | Widget _markingItem( |
| 398 | String selectTitle, | 561 | String selectTitle, |
| 399 | String title, | 562 | String title, |
| 400 | String content, | 563 | String content, |
| 401 | String subtile, | 564 | String subtile, |
| 402 | - String discount, { | 565 | + String discount, |
| 566 | + String btnTitle, { | ||
| 403 | VoidCallback onPressed, | 567 | VoidCallback onPressed, |
| 404 | bool select = false, | 568 | bool select = false, |
| 405 | VoidCallback onPressedSelect, | 569 | VoidCallback onPressedSelect, |
| @@ -490,8 +654,9 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -490,8 +654,9 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 490 | ) | 654 | ) |
| 491 | ], | 655 | ], |
| 492 | )), | 656 | )), |
| 657 | + HEmptyView(20), | ||
| 493 | RoundButton( | 658 | RoundButton( |
| 494 | - text: '切换活动', | 659 | + text: btnTitle, |
| 495 | width: w(72), | 660 | width: w(72), |
| 496 | height: w(22), | 661 | height: w(22), |
| 497 | gradientStart: MyColours.color_ffffff, | 662 | gradientStart: MyColours.color_ffffff, |
| @@ -767,14 +932,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -767,14 +932,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 767 | ])); | 932 | ])); |
| 768 | } | 933 | } |
| 769 | 934 | ||
| 770 | - @override | ||
| 771 | - Widget build(BuildContext context) { | ||
| 772 | - couponProvider = Provider.of<CouponProvider>(context, listen: true); | ||
| 773 | - _uploadImageProvider = | ||
| 774 | - Provider.of<UploadImageProvider>(context, listen: true); | ||
| 775 | - marketingCenterProvider = | ||
| 776 | - Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 777 | - | 935 | + String _getCouponsDesc(couponData) { |
| 778 | String couponsDesc = ''; | 936 | String couponsDesc = ''; |
| 779 | if (couponData != null) { | 937 | if (couponData != null) { |
| 780 | if (couponData.expDate == null) { | 938 | if (couponData.expDate == null) { |
| @@ -790,6 +948,16 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -790,6 +948,16 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 790 | } | 948 | } |
| 791 | } | 949 | } |
| 792 | } | 950 | } |
| 951 | + return couponsDesc; | ||
| 952 | + } | ||
| 953 | + | ||
| 954 | + @override | ||
| 955 | + Widget build(BuildContext context) { | ||
| 956 | + couponProvider = Provider.of<CouponProvider>(context, listen: true); | ||
| 957 | + _uploadImageProvider = | ||
| 958 | + Provider.of<UploadImageProvider>(context, listen: true); | ||
| 959 | + marketingCenterProvider = | ||
| 960 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 793 | 961 | ||
| 794 | return Scaffold( | 962 | return Scaffold( |
| 795 | backgroundColor: MyColours.color_ffffff, | 963 | backgroundColor: MyColours.color_ffffff, |
| @@ -803,6 +971,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -803,6 +971,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 803 | children: [ | 971 | children: [ |
| 804 | Expanded( | 972 | Expanded( |
| 805 | child: SingleChildScrollView( | 973 | child: SingleChildScrollView( |
| 974 | + controller: controller, | ||
| 806 | child: Column( | 975 | child: Column( |
| 807 | children: [ | 976 | children: [ |
| 808 | _headItem('客户互动及店铺推广'), | 977 | _headItem('客户互动及店铺推广'), |
| @@ -837,34 +1006,45 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -837,34 +1006,45 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 837 | VEmptyView(24), | 1006 | VEmptyView(24), |
| 838 | _headItem('预订安排中附带的营销推广'), | 1007 | _headItem('预订安排中附带的营销推广'), |
| 839 | VEmptyView(24), | 1008 | VEmptyView(24), |
| 840 | - couponData != null | ||
| 841 | - ? _markingItem( | ||
| 842 | - '推荐店内代金券优惠', | ||
| 843 | - couponData.aname, | ||
| 844 | - couponsDesc, | ||
| 845 | - couponData.price ?? '', | ||
| 846 | - couponData.use != null && couponData.use.isCash | ||
| 847 | - ? '${(double.parse(couponData.price) / double.parse(couponData.use.cash)) * 10}折' | ||
| 848 | - : '', | ||
| 849 | - select: isCoupon, onPressedSelect: () { | ||
| 850 | - setState(() { | ||
| 851 | - isCoupon = !isCoupon; | ||
| 852 | - }); | ||
| 853 | - }, onPressed: () async { | ||
| 854 | - //切换活动 | ||
| 855 | - Map temp = | ||
| 856 | - await NavigatorUtil.goMarkingCouponSelectPage( | ||
| 857 | - context, couponData.id); | ||
| 858 | - if (temp['coupon'] != null) { | ||
| 859 | - couponData = temp['coupon']; | 1009 | + couponProvider.couponListSelect != null && |
| 1010 | + couponProvider.couponListSelect.length > 0 | ||
| 1011 | + ? _markingCupon( | ||
| 1012 | + select: isCoupon, | ||
| 1013 | + onPressedSelect: () { | ||
| 1014 | + setState(() { | ||
| 1015 | + isCoupon = !isCoupon; | ||
| 1016 | + }); | ||
| 1017 | + }, | ||
| 1018 | + onPressed: () async { | ||
| 1019 | + //切换活动 | ||
| 1020 | + Map temp = | ||
| 1021 | + await NavigatorUtil.goMarkingCouponSelectPage( | ||
| 1022 | + context, {'object': couponDataList}); | ||
| 1023 | + if (temp['coupon'] != null) { | ||
| 1024 | + couponDataList = temp['coupon']; | ||
| 860 | 1025 | ||
| 861 | - setState(() {}); | ||
| 862 | - } | ||
| 863 | - }) | ||
| 864 | - : SizedBox(), | 1026 | + setState(() {}); |
| 1027 | + } | ||
| 1028 | + }) | ||
| 1029 | + : (couponProvider.couponListSelect == null || | ||
| 1030 | + couponProvider.couponListSelect.length == | ||
| 1031 | + 0) && | ||
| 1032 | + Utils.getAuthority(context, '创建新的优惠券') | ||
| 1033 | + ? _markingItem( | ||
| 1034 | + '推荐店内代金券优惠', | ||
| 1035 | + '当前没有代金券', | ||
| 1036 | + '注:代金券附加在预订安排中,可以随着预订人给被请客客人发送邀请函自动传播,吸引顾客到店。', | ||
| 1037 | + '', | ||
| 1038 | + '', | ||
| 1039 | + '创建优惠', | ||
| 1040 | + select: false, onPressed: () { | ||
| 1041 | + //创建优惠 | ||
| 1042 | + NavigatorUtil.goCouponPage(context); | ||
| 1043 | + }) | ||
| 1044 | + : SizedBox(), | ||
| 865 | rechargeData != null | 1045 | rechargeData != null |
| 866 | ? _markingItem('推荐店内充值单一优惠活动', rechargeData.rname, | 1046 | ? _markingItem('推荐店内充值单一优惠活动', rechargeData.rname, |
| 867 | - rechargeContent, '', '', select: isRecharge, | 1047 | + rechargeContent, '', '', '切换活动', select: isRecharge, |
| 868 | onPressedSelect: () { | 1048 | onPressedSelect: () { |
| 869 | setState(() { | 1049 | setState(() { |
| 870 | isRecharge = !isRecharge; | 1050 | isRecharge = !isRecharge; |
| @@ -880,7 +1060,21 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -880,7 +1060,21 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 880 | setState(() {}); | 1060 | setState(() {}); |
| 881 | } | 1061 | } |
| 882 | }) | 1062 | }) |
| 883 | - : SizedBox(), | 1063 | + : (rechargeListCanUse == null || |
| 1064 | + rechargeListCanUse.length == 0) && | ||
| 1065 | + Utils.getAuthority(context, '新建优惠') | ||
| 1066 | + ? _markingItem( | ||
| 1067 | + '推荐店内充值单一优惠活动', | ||
| 1068 | + '当前没有创建充值优惠活动', | ||
| 1069 | + '注:充值优惠活动附加在预订安排中,可以随着预订人给被请客客人发送邀请函自动传播。', | ||
| 1070 | + '', | ||
| 1071 | + '', | ||
| 1072 | + '创建优惠', | ||
| 1073 | + select: false, onPressed: () { | ||
| 1074 | + //创建新优惠 | ||
| 1075 | + NavigatorUtil.goRechargeHomePage(context); | ||
| 1076 | + }) | ||
| 1077 | + : SizedBox(), | ||
| 884 | _markingOtherItem() | 1078 | _markingOtherItem() |
| 885 | ], | 1079 | ], |
| 886 | ), | 1080 | ), |
| @@ -928,7 +1122,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -928,7 +1122,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 928 | 'wecomle': welcomeTextC.text ?? '', | 1122 | 'wecomle': welcomeTextC.text ?? '', |
| 929 | 'logo': _uploadImageProvider.firstImage.qiniuUrl, | 1123 | 'logo': _uploadImageProvider.firstImage.qiniuUrl, |
| 930 | 'recharge_data': rechargeData, | 1124 | 'recharge_data': rechargeData, |
| 931 | - 'coupon_data': couponData | 1125 | + 'coupon_data': json.encode(couponDataList) |
| 932 | }; | 1126 | }; |
| 933 | Map<String, String> params = { | 1127 | Map<String, String> params = { |
| 934 | 'sid': Provider.of<UserModel>(context, listen: false) | 1128 | 'sid': Provider.of<UserModel>(context, listen: false) |
| 1 | import 'package:cached_network_image/cached_network_image.dart'; | 1 | import 'package:cached_network_image/cached_network_image.dart'; |
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | +import 'package:one_key/models/coupon_model.dart'; | ||
| 4 | import 'package:one_key/models/mark_data_model.dart'; | 5 | import 'package:one_key/models/mark_data_model.dart'; |
| 5 | import 'package:one_key/widgets/MyDivider.dart'; | 6 | import 'package:one_key/widgets/MyDivider.dart'; |
| 6 | import 'package:one_key/widgets/system_app_bar.dart'; | 7 | import 'package:one_key/widgets/system_app_bar.dart'; |
| @@ -1269,36 +1270,55 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | @@ -1269,36 +1270,55 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | ||
| 1269 | ); | 1270 | ); |
| 1270 | } | 1271 | } |
| 1271 | 1272 | ||
| 1272 | - _rechargeWiddget() { | 1273 | + String _getCouponsDesc(couponData) { |
| 1273 | String couponsDesc = ''; | 1274 | String couponsDesc = ''; |
| 1274 | - if (_marketingCenterProvider.markDataModel.marketing.couponData != null) { | ||
| 1275 | - if (_marketingCenterProvider.markDataModel.marketing.couponData.expDate == | ||
| 1276 | - null) { | ||
| 1277 | - couponsDesc = | ||
| 1278 | - _marketingCenterProvider.markDataModel.marketing.couponData.desc; | 1275 | + if (couponData != null) { |
| 1276 | + if (couponData.expDate == null) { | ||
| 1277 | + couponsDesc = couponData.desc; | ||
| 1279 | } else { | 1278 | } else { |
| 1280 | - if (_marketingCenterProvider | ||
| 1281 | - .markDataModel.marketing.couponData.expDate.isNone) { | ||
| 1282 | - couponsDesc = '无限制,' + | ||
| 1283 | - _marketingCenterProvider | ||
| 1284 | - .markDataModel.marketing.couponData.desc ?? | ||
| 1285 | - ''; | ||
| 1286 | - } else if (_marketingCenterProvider | ||
| 1287 | - .markDataModel.marketing.couponData.expDate.isBirthday) { | ||
| 1288 | - couponsDesc = '会员生日当天可用,' + | ||
| 1289 | - _marketingCenterProvider | ||
| 1290 | - .markDataModel.marketing.couponData.desc ?? | ||
| 1291 | - ''; | ||
| 1292 | - } else if (_marketingCenterProvider | ||
| 1293 | - .markDataModel.marketing.couponData.expDate.isWeek) { | 1279 | + if (couponData.expDate.isNone) { |
| 1280 | + couponsDesc = '无限制,' + couponData.desc ?? ''; | ||
| 1281 | + } else if (couponData.expDate.isBirthday) { | ||
| 1282 | + couponsDesc = '会员生日当天可用,' + couponData.desc ?? ''; | ||
| 1283 | + } else if (couponData.expDate.isWeek) { | ||
| 1294 | couponsDesc = | 1284 | couponsDesc = |
| 1295 | - '${_marketingCenterProvider.markDataModel.marketing.couponData.expDate.weekShow},' + | ||
| 1296 | - _marketingCenterProvider | ||
| 1297 | - .markDataModel.marketing.couponData.desc ?? | ||
| 1298 | - ''; | 1285 | + '${couponData.expDate.weekShow},' + couponData.desc ?? ''; |
| 1299 | } | 1286 | } |
| 1300 | } | 1287 | } |
| 1301 | } | 1288 | } |
| 1289 | + return couponsDesc; | ||
| 1290 | + } | ||
| 1291 | + | ||
| 1292 | + _rechargeWiddget() { | ||
| 1293 | + // String couponsDesc = ''; | ||
| 1294 | + // if (_marketingCenterProvider.markDataModel.marketing.couponData != null) { | ||
| 1295 | + // if (_marketingCenterProvider.markDataModel.marketing.couponData.expDate == | ||
| 1296 | + // null) { | ||
| 1297 | + // couponsDesc = | ||
| 1298 | + // _marketingCenterProvider.markDataModel.marketing.couponData.desc; | ||
| 1299 | + // } else { | ||
| 1300 | + // if (_marketingCenterProvider | ||
| 1301 | + // .markDataModel.marketing.couponData.expDate.isNone) { | ||
| 1302 | + // couponsDesc = '无限制,' + | ||
| 1303 | + // _marketingCenterProvider | ||
| 1304 | + // .markDataModel.marketing.couponData.desc ?? | ||
| 1305 | + // ''; | ||
| 1306 | + // } else if (_marketingCenterProvider | ||
| 1307 | + // .markDataModel.marketing.couponData.expDate.isBirthday) { | ||
| 1308 | + // couponsDesc = '会员生日当天可用,' + | ||
| 1309 | + // _marketingCenterProvider | ||
| 1310 | + // .markDataModel.marketing.couponData.desc ?? | ||
| 1311 | + // ''; | ||
| 1312 | + // } else if (_marketingCenterProvider | ||
| 1313 | + // .markDataModel.marketing.couponData.expDate.isWeek) { | ||
| 1314 | + // couponsDesc = | ||
| 1315 | + // '${_marketingCenterProvider.markDataModel.marketing.couponData.expDate.weekShow},' + | ||
| 1316 | + // _marketingCenterProvider | ||
| 1317 | + // .markDataModel.marketing.couponData.desc ?? | ||
| 1318 | + // ''; | ||
| 1319 | + // } | ||
| 1320 | + // } | ||
| 1321 | + // } | ||
| 1302 | return Container( | 1322 | return Container( |
| 1303 | padding: EdgeInsets.symmetric(horizontal: w(20), vertical: w(8)), | 1323 | padding: EdgeInsets.symmetric(horizontal: w(20), vertical: w(8)), |
| 1304 | child: Column( | 1324 | child: Column( |
| @@ -1313,22 +1333,24 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | @@ -1313,22 +1333,24 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { | ||
| 1313 | ), | 1333 | ), |
| 1314 | VEmptyView(20), | 1334 | VEmptyView(20), |
| 1315 | _marketingCenterProvider.markDataModel.marketing.isCoupon == '1' | 1335 | _marketingCenterProvider.markDataModel.marketing.isCoupon == '1' |
| 1316 | - ? _markingItem( | ||
| 1317 | - '推荐店内代金券优惠', | ||
| 1318 | - _marketingCenterProvider | ||
| 1319 | - .markDataModel.marketing.couponData.aname, | ||
| 1320 | - couponsDesc, | ||
| 1321 | - _marketingCenterProvider | ||
| 1322 | - .markDataModel.marketing.couponData.price ?? | ||
| 1323 | - "", | ||
| 1324 | - _marketingCenterProvider | ||
| 1325 | - .markDataModel.marketing.couponData.use != | ||
| 1326 | - null && | ||
| 1327 | - _marketingCenterProvider | ||
| 1328 | - .markDataModel.marketing.couponData.use.isCash | ||
| 1329 | - ? '${(double.parse(_marketingCenterProvider.markDataModel.marketing.couponData.price) / double.parse(_marketingCenterProvider.markDataModel.marketing.couponData.use.cash)) * 10}折' | ||
| 1330 | - : '', | ||
| 1331 | - '去抢购') | 1336 | + ? ListView.builder( |
| 1337 | + controller: controller, | ||
| 1338 | + shrinkWrap: true, | ||
| 1339 | + itemCount: _marketingCenterProvider | ||
| 1340 | + .markDataModel.marketing.couponDataList.length, | ||
| 1341 | + itemBuilder: (context, index) { | ||
| 1342 | + CouponSunModel couponSunModel = _marketingCenterProvider | ||
| 1343 | + .markDataModel.marketing.couponDataList[index]; | ||
| 1344 | + return _markingItem( | ||
| 1345 | + '推荐店内代金券优惠', | ||
| 1346 | + couponSunModel.aname, | ||
| 1347 | + _getCouponsDesc(couponSunModel), | ||
| 1348 | + couponSunModel.price ?? "", | ||
| 1349 | + couponSunModel.use != null && couponSunModel.use.isCash | ||
| 1350 | + ? '${(double.parse(couponSunModel.price) / double.parse(couponSunModel.use.cash)) * 10}折' | ||
| 1351 | + : '', | ||
| 1352 | + '去抢购'); | ||
| 1353 | + }) | ||
| 1332 | : SizedBox(), | 1354 | : SizedBox(), |
| 1333 | _marketingCenterProvider.markDataModel.marketing.isRecharge == '1' | 1355 | _marketingCenterProvider.markDataModel.marketing.isRecharge == '1' |
| 1334 | ? _markingItem( | 1356 | ? _markingItem( |
| @@ -546,7 +546,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -546,7 +546,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 546 | ), | 546 | ), |
| 547 | VEmptyView(24), | 547 | VEmptyView(24), |
| 548 | _textfield('充值满', '点击输入充值金额门槛', priceminC, priceminF, | 548 | _textfield('充值满', '点击输入充值金额门槛', priceminC, priceminF, |
| 549 | - textInputStyle: TextInputType.numberWithOptions(decimal: true)), | 549 | + textInputStyle: |
| 550 | + TextInputType.numberWithOptions(decimal: true)), | ||
| 550 | MyDivider( | 551 | MyDivider( |
| 551 | double.infinity, | 552 | double.infinity, |
| 552 | w(1), | 553 | w(1), |
| @@ -641,7 +642,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -641,7 +642,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 641 | FocusScope.of(context) | 642 | FocusScope.of(context) |
| 642 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 | 643 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 643 | }, | 644 | }, |
| 644 | - keyboardType: TextInputType.numberWithOptions(decimal: true), | 645 | + keyboardType: TextInputType.numberWithOptions( |
| 646 | + decimal: true), | ||
| 645 | ), | 647 | ), |
| 646 | ), | 648 | ), |
| 647 | HEmptyView(16), | 649 | HEmptyView(16), |
| @@ -729,7 +731,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -729,7 +731,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 729 | FocusScope.of(context) | 731 | FocusScope.of(context) |
| 730 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 | 732 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 731 | }, | 733 | }, |
| 732 | - keyboardType: TextInputType.numberWithOptions(decimal: true), | 734 | + keyboardType: TextInputType.numberWithOptions( |
| 735 | + decimal: true), | ||
| 733 | ), | 736 | ), |
| 734 | ), | 737 | ), |
| 735 | HEmptyView(16), | 738 | HEmptyView(16), |
| @@ -1222,6 +1225,7 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | @@ -1222,6 +1225,7 @@ class _RechargeEditPageState extends State<RechargeEditPage> { | ||
| 1222 | //成功后返回前面列表 | 1225 | //成功后返回前面列表 |
| 1223 | Navigator.pop(context); | 1226 | Navigator.pop(context); |
| 1224 | //刷新列表 | 1227 | //刷新列表 |
| 1228 | + bus.emit('refresh_marketting_page_recharge'); | ||
| 1225 | bus.emit('refresh_recharge_home'); | 1229 | bus.emit('refresh_recharge_home'); |
| 1226 | } | 1230 | } |
| 1227 | 1231 |
| @@ -73,6 +73,7 @@ class _RechargeHomePageState extends State<RechargeHomePage> { | @@ -73,6 +73,7 @@ class _RechargeHomePageState extends State<RechargeHomePage> { | ||
| 73 | bool success = | 73 | bool success = |
| 74 | await marketingCenterProvider.createNewRecharge(context, pramas); | 74 | await marketingCenterProvider.createNewRecharge(context, pramas); |
| 75 | if (success) { | 75 | if (success) { |
| 76 | + bus.emit('refresh_marketting_page_recharge'); | ||
| 76 | setState(() { | 77 | setState(() { |
| 77 | rechargeListSunModel.isOpen = isOpen; | 78 | rechargeListSunModel.isOpen = isOpen; |
| 78 | }); | 79 | }); |
| @@ -151,6 +152,7 @@ class _RechargeHomePageState extends State<RechargeHomePage> { | @@ -151,6 +152,7 @@ class _RechargeHomePageState extends State<RechargeHomePage> { | ||
| 151 | bool success = await marketingCenterProvider | 152 | bool success = await marketingCenterProvider |
| 152 | .createNewRecharge(context, pramas); | 153 | .createNewRecharge(context, pramas); |
| 153 | if (success) { | 154 | if (success) { |
| 155 | + bus.emit('refresh_marketting_page_recharge'); | ||
| 154 | setState(() { | 156 | setState(() { |
| 155 | marketingCenterProvider.rechargeList | 157 | marketingCenterProvider.rechargeList |
| 156 | .removeAt(index); | 158 | .removeAt(index); |
| @@ -131,6 +131,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | @@ -131,6 +131,7 @@ class NoteBookItemFState extends State<NoteBookItemF> | ||
| 131 | }; | 131 | }; |
| 132 | params["cause"] = json.encode(causeMap); | 132 | params["cause"] = json.encode(causeMap); |
| 133 | } | 133 | } |
| 134 | + params['note_name'] = userModel.user.account; | ||
| 134 | NotebookDetailModel detailModel = | 135 | NotebookDetailModel detailModel = |
| 135 | Provider.of<NotebookDetailModel>(context, listen: false); | 136 | Provider.of<NotebookDetailModel>(context, listen: false); |
| 136 | bool success = | 137 | bool success = |
| @@ -143,6 +143,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | @@ -143,6 +143,7 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> | ||
| 143 | }; | 143 | }; |
| 144 | params["cause"] = json.encode(causeMap); | 144 | params["cause"] = json.encode(causeMap); |
| 145 | } | 145 | } |
| 146 | + params['note_name'] = userModel.user.account; | ||
| 146 | NotebookDetailModel detailModel = | 147 | NotebookDetailModel detailModel = |
| 147 | Provider.of<NotebookDetailModel>(context, listen: false); | 148 | Provider.of<NotebookDetailModel>(context, listen: false); |
| 148 | bool success = | 149 | bool success = |
| @@ -153,6 +153,7 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -153,6 +153,7 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 153 | Future<bool> setReserveStatus( | 153 | Future<bool> setReserveStatus( |
| 154 | BuildContext context, Map<String, String> params, | 154 | BuildContext context, Map<String, String> params, |
| 155 | {ifPush = true, showLoading = false}) async { | 155 | {ifPush = true, showLoading = false}) async { |
| 156 | + | ||
| 156 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | 157 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() |
| 157 | .request<Map<String, dynamic>>( | 158 | .request<Map<String, dynamic>>( |
| 158 | context, Method.get, HttpUrl.set_reserve_status, | 159 | context, Method.get, HttpUrl.set_reserve_status, |
| @@ -1460,11 +1460,11 @@ class NavigatorUtil { | @@ -1460,11 +1460,11 @@ class NavigatorUtil { | ||
| 1460 | ///预订安排通知定制------优惠券选择 | 1460 | ///预订安排通知定制------优惠券选择 |
| 1461 | static Future<dynamic> goMarkingCouponSelectPage( | 1461 | static Future<dynamic> goMarkingCouponSelectPage( |
| 1462 | BuildContext context, | 1462 | BuildContext context, |
| 1463 | - String idstr, { | 1463 | + Map object, { |
| 1464 | replace = false, | 1464 | replace = false, |
| 1465 | }) { | 1465 | }) { |
| 1466 | - return _navigateTo( | ||
| 1467 | - context, "${Routes.marking_coupon_select_page}?idstr=$idstr", | 1466 | + return _navigateTo(context, |
| 1467 | + "${Routes.marking_coupon_select_page}?object=${FluroConvertUtils.object2string(object)}", | ||
| 1468 | replace: replace); | 1468 | replace: replace); |
| 1469 | } | 1469 | } |
| 1470 | 1470 |
| @@ -2483,12 +2483,21 @@ var markingInteractionPageHandle = new Handler( | @@ -2483,12 +2483,21 @@ var markingInteractionPageHandle = new Handler( | ||
| 2483 | //我的----营销中心-优惠券选择 | 2483 | //我的----营销中心-优惠券选择 |
| 2484 | var markingCouponSelectPageHandle = new Handler( | 2484 | var markingCouponSelectPageHandle = new Handler( |
| 2485 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | 2485 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { |
| 2486 | - String idstr = params["idstr"].first; | 2486 | + // String idstr = params["idstr"].first;dfdf |
| 2487 | + List<CouponSunModel> res = []; | ||
| 2488 | + if (params.keys.contains('object')) { | ||
| 2489 | + Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 2490 | + List temp = object['object']; | ||
| 2491 | + | ||
| 2492 | + for (var item in temp) { | ||
| 2493 | + res.add(CouponSunModel.fromJson(item)); | ||
| 2494 | + } | ||
| 2495 | + } | ||
| 2487 | // NotebookDetail detailEntity = NotebookDetail.fromJson(json | 2496 | // NotebookDetail detailEntity = NotebookDetail.fromJson(json |
| 2488 | // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | 2497 | // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); |
| 2489 | return ChangeNotifierProvider<MarketingCenterProvider>( | 2498 | return ChangeNotifierProvider<MarketingCenterProvider>( |
| 2490 | create: (_) => MarketingCenterProvider(), | 2499 | create: (_) => MarketingCenterProvider(), |
| 2491 | - child: MarkingCouponSelectPage(selectid: idstr)); | 2500 | + child: MarkingCouponSelectPage(couponList: res)); |
| 2492 | }); | 2501 | }); |
| 2493 | 2502 | ||
| 2494 | //我的----营销中心-预订安排预览页 | 2503 | //我的----营销中心-预订安排预览页 |
| @@ -2929,5 +2938,6 @@ var customerNoticeSettingPageHandle = new Handler( | @@ -2929,5 +2938,6 @@ var customerNoticeSettingPageHandle = new Handler( | ||
| 2929 | // .decode(FluroConvertUtils.fluroCnParamsDecode(params["daylist"].first))); | 2938 | // .decode(FluroConvertUtils.fluroCnParamsDecode(params["daylist"].first))); |
| 2930 | 2939 | ||
| 2931 | return ChangeNotifierProvider<MarketingCenterProvider>( | 2940 | return ChangeNotifierProvider<MarketingCenterProvider>( |
| 2932 | - create: (_) => MarketingCenterProvider(), child: CustomerNoticeSettingPage()); | 2941 | + create: (_) => MarketingCenterProvider(), |
| 2942 | + child: CustomerNoticeSettingPage()); | ||
| 2933 | }); | 2943 | }); |
-
Please register or login to post a comment