Commit 074babfde822afc68683b420f4347ac5640e91b3

Authored by wdn127929
1 parent 5cb88650

营销中心--充值优惠UI okok

971 Bytes

1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
  2 +import 'package:flutter/services.dart';
2 import 'package:flutter_easyrefresh/easy_refresh.dart'; 3 import 'package:flutter_easyrefresh/easy_refresh.dart';
3 import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 import 'package:one_key/constant/state.dart'; 5 import 'package:one_key/constant/state.dart';
@@ -13,6 +14,11 @@ import 'package:one_key/widgets/round_button.dart'; @@ -13,6 +14,11 @@ import 'package:one_key/widgets/round_button.dart';
13 import 'package:one_key/widgets/system_app_bar.dart'; 14 import 'package:one_key/widgets/system_app_bar.dart';
14 import 'package:one_key/widgets/v_empty_view.dart'; 15 import 'package:one_key/widgets/v_empty_view.dart';
15 import 'package:provider/provider.dart'; 16 import 'package:provider/provider.dart';
  17 +import 'package:barcode_scan2/barcode_scan2.dart';
  18 +
  19 +import '../../utils/dialog_util.dart';
  20 +import '../../utils/misc.dart';
  21 +
16 22
17 /** 23 /**
18 * 优惠券列表 24 * 优惠券列表
@@ -59,12 +65,27 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { @@ -59,12 +65,27 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
59 // // !couponProvider.couponList[index].isOpenBool; 65 // // !couponProvider.couponList[index].isOpenBool;
60 // // couponProvider.notifyListeners(); 66 // // couponProvider.notifyListeners();
61 // // } 67 // // }
62 - // } 68 + // }'
  69 + ScanResult scanResult;
  70 +
  71 + var _aspectTolerance = 0.5;
  72 + // var _numberOfCameras = 0;
  73 + var _selectedCamera = -1;
  74 + var _autoEnableFlash = false;
  75 +
  76 + static final _possibleFormats = BarcodeFormat.values.toList()
  77 + ..removeWhere((e) => e == BarcodeFormat.unknown);
  78 +
  79 + List<BarcodeFormat> selectedFormats = [..._possibleFormats];
63 80
64 @override 81 @override
65 void initState() { 82 void initState() {
66 // TODO: implement initState 83 // TODO: implement initState
67 super.initState(); 84 super.initState();
  85 + // Future.delayed(Duration.zero, () async {
  86 + // // _numberOfCameras = await BarcodeScanner.numberOfCameras;
  87 + // setState(() {});
  88 + // });
68 tabController = TabController(length: 3, vsync: this); 89 tabController = TabController(length: 3, vsync: this);
69 tabController.addListener(() { 90 tabController.addListener(() {
70 // couponProvider.couponList = []; 91 // couponProvider.couponList = [];
@@ -92,20 +113,62 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { @@ -92,20 +113,62 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
92 super.dispose(); 113 super.dispose();
93 } 114 }
94 115
  116 + Future<void> _scan() async {
  117 + try {
  118 + final result = await BarcodeScanner.scan(
  119 + options: ScanOptions(
  120 + strings: {'cancel': '退出', 'flash_on': '开闪光灯', 'flash_off': '关闪光灯'},
  121 + restrictFormat: selectedFormats,
  122 + useCamera: _selectedCamera,
  123 + autoEnableFlash: _autoEnableFlash, //true打开闪光灯, false关闭闪光灯
  124 + android: AndroidOptions(
  125 + aspectTolerance: 0.5, useAutoFocus: true), //(默认已配)添加Android自动对焦
  126 + ),
  127 + );
  128 + // result.rawContent
  129 + setState(() => scanResult = result);
  130 + print(result);
  131 + } on PlatformException catch (e) {
  132 + setState(() {
  133 + scanResult = ScanResult(
  134 + type: ResultType.Error,
  135 + rawContent: e.code == BarcodeScanner.cameraAccessDenied
  136 + ? 'The user did not grant the camera permission!'
  137 + : 'Unknown error: $e',
  138 + );
  139 + if (e.code == BarcodeScanner.cameraAccessDenied) {
  140 + DialogUtil.openAlertDialog(
  141 + context, '未获得相机权限', "请在手机的权限管理里,将相机权限开启", '去设置', 340.0,
  142 + onTap: () {
  143 + openSetting();
  144 + Navigator.pop(context, '');
  145 + });
  146 + }
  147 + });
  148 + }
  149 + }
  150 +
95 @override 151 @override
96 Widget build(BuildContext context) { 152 Widget build(BuildContext context) {
97 couponProvider = Provider.of<CouponProvider>(context, listen: true); 153 couponProvider = Provider.of<CouponProvider>(context, listen: true);
98 return Scaffold( 154 return Scaffold(
99 backgroundColor: MyColours.color_f3f3f3, 155 backgroundColor: MyColours.color_f3f3f3,
100 - appBar: SystemAppBar('线上券', onTap: () {  
101 - if (widget.needRefrsh) {  
102 - EventBus().emit('refresh_coupon_invitation');  
103 - } else {  
104 - EventBus().emit('changeStatusColor');  
105 - } 156 + appBar: SystemAppBar(
  157 + '线上券',
  158 + onTap: () {
  159 + if (widget.needRefrsh) {
  160 + EventBus().emit('refresh_coupon_invitation');
  161 + } else {
  162 + EventBus().emit('changeStatusColor');
  163 + }
106 164
107 - Navigator.of(context).pop();  
108 - }), 165 + Navigator.of(context).pop();
  166 + },
  167 + rightImgName: 'scan.png',
  168 + onTapRight: () {
  169 + _scan();
  170 + },
  171 + ),
109 body: WillPopScope( 172 body: WillPopScope(
110 onWillPop: () { 173 onWillPop: () {
111 if (widget.needRefrsh) { 174 if (widget.needRefrsh) {
  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:flutter/material.dart';
  3 +import 'package:flutter_picker/Picker.dart';
  4 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:one_key/models/coupon_model.dart';
  6 +import 'package:one_key/models/filter_btn_model.dart';
  7 +import 'package:one_key/route/navigator_util.dart';
  8 +import 'package:one_key/widgets/MyDivider.dart';
  9 +import 'package:one_key/widgets/system_app_bar.dart';
  10 +
  11 +import '../../../../res/colors.dart';
  12 +import '../../../../utils/dialog_util.dart';
  13 +import '../../../../utils/screen_util.dart';
  14 +import '../../../../utils/utils.dart';
  15 +import '../../../../widgets/h_empty_view.dart';
  16 +import '../../../../widgets/round_button.dart';
  17 +import '../../../../widgets/v_empty_view.dart';
  18 +
  19 +/**
  20 + *
  21 + * 优惠券详情
  22 + */
  23 +
  24 +class RechargeDetailPage extends StatefulWidget {
  25 + RechargeDetailPage({Key key}) : super(key: key);
  26 +
  27 + @override
  28 + _RechargeDetailPageState createState() => _RechargeDetailPageState();
  29 +}
  30 +
  31 +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;
  63 +
  64 + @override
  65 + void initState() {
  66 + super.initState();
  67 +
  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 = '';
  128 + }
  129 + });
  130 + }
  131 +
  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 + }
  143 + }
  144 +
  145 + ///输入框
  146 + Widget _text(
  147 + String title,
  148 + String hintText,
  149 + ) {
  150 + return Container(
  151 + child: Row(
  152 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  153 + children: [
  154 + Container(
  155 + child: Text(
  156 + title,
  157 + style: TextStyle(
  158 + color: MyColours.color_515151,
  159 + fontSize: ScreenUtil().setSp(32)),
  160 + ),
  161 + ),
  162 + Spacer(),
  163 + Text(
  164 + hintText,
  165 + style: TextStyle(
  166 + color: MyColours.color_999999,
  167 + fontSize: ScreenUtil().setSp(32),
  168 + ),
  169 + ),
  170 + HEmptyView(32)
  171 + ],
  172 + ),
  173 + );
  174 + }
  175 +
  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 + ///券说明
  220 + Widget _explain(String title, String hintText,
  221 + TextEditingController controller, FocusNode node) {
  222 + return Container(
  223 + // height: ScreenUtil().setWidth(380),
  224 + // padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
  225 + child: Column(
  226 + crossAxisAlignment: CrossAxisAlignment.start,
  227 + children: [
  228 + Align(
  229 + alignment: Alignment.centerLeft,
  230 + child: Text(
  231 + title,
  232 + textAlign: TextAlign.left,
  233 + style: TextStyle(
  234 + color: MyColours.color_515151,
  235 + fontSize: ScreenUtil().setSp(32)),
  236 + )),
  237 + VEmptyView(26),
  238 + // Container(
  239 + // height: ScreenUtil().setWidth(2),
  240 + // color: MyColours.color_E7E7E7,
  241 + // ),
  242 + Padding(
  243 + padding: EdgeInsets.only(left: w(20)),
  244 + child: Text(
  245 + 'beihaisehfisehfasfhaise',
  246 +
  247 + // maxLengthEnforced: true,
  248 + style: TextStyle(
  249 + fontSize: ScreenUtil().setSp(32),
  250 + color: MyColours.color_999999), //输入文本的样式
  251 + )),
  252 + ],
  253 + ),
  254 + );
  255 + }
  256 +
  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 + ///是否立即启用
  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 + ),
  307 + ),
  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 + ),
  317 + ),
  318 + );
  319 + }
  320 +
  321 + @override
  322 + Widget build(BuildContext context) {
  323 + 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)),
  371 + child: Column(
  372 + crossAxisAlignment: CrossAxisAlignment.start,
  373 + // mainAxisAlignment: MainAxisAlignment.start,
  374 + children: [
  375 + Text(
  376 + '赠送1000元余额',
  377 + style: TextStyle(
  378 + color: MyColours.color_999999,
  379 + fontSize: ScreenUtil().setSp(32)),
  380 + ),
  381 + VEmptyView(20),
  382 + Text(
  383 + '赠送1000积分',
  384 + style: TextStyle(
  385 + color: MyColours.color_999999,
  386 + fontSize: ScreenUtil().setSp(32)),
  387 + ),
  388 + VEmptyView(20),
  389 + Text(
  390 + '赠送优惠券',
  391 + style: TextStyle(
  392 + color: MyColours.color_999999,
  393 + fontSize: ScreenUtil().setSp(32)),
  394 + ),
  395 + Padding(
  396 + padding: EdgeInsets.only(
  397 + left: w(45),
  398 + right: w(8),
  399 + ),
  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),
  414 + ],
  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 + ],
  456 + )),
  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 + );
  515 + }
  516 +}
@@ -57,6 +57,10 @@ class _RechargeEditPageState extends State<RechargeEditPage> { @@ -57,6 +57,10 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
57 57
58 List<String> selectIDs = []; 58 List<String> selectIDs = [];
59 59
  60 + bool givePriceSwich = false;
  61 + bool giveScoreSwich = false;
  62 + bool giveCouponsSwich = false;
  63 +
60 @override 64 @override
61 void initState() { 65 void initState() {
62 super.initState(); 66 super.initState();
@@ -414,226 +418,266 @@ class _RechargeEditPageState extends State<RechargeEditPage> { @@ -414,226 +418,266 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
414 ), 418 ),
415 ), 419 ),
416 VEmptyView(26), 420 VEmptyView(26),
417 - Padding(  
418 - padding: EdgeInsets.only(  
419 - left: w(16),  
420 - ),  
421 - child: Column(  
422 - crossAxisAlignment: CrossAxisAlignment.start, 421 + Column(
  422 + crossAxisAlignment: CrossAxisAlignment.start,
  423 + children: [
  424 + Row(
423 children: [ 425 children: [
424 - Row(  
425 - children: [  
426 - Image.asset(  
427 - Utils.getImgPath(  
428 - true ? 'f_select' : 'f_select_not'),  
429 - width: w(20), 426 + InkWell(
  427 + onTap: () {
  428 + setState(() {
  429 + givePriceSwich = !givePriceSwich;
  430 + });
  431 + },
  432 + child: Padding(
  433 + padding: EdgeInsets.only(
  434 + left: w(16),
  435 + right: w(8),
430 ), 436 ),
431 - HEmptyView(16),  
432 - Text(  
433 - '赠送',  
434 - style: TextStyle(  
435 - color: MyColours.color_515151,  
436 - fontSize: ScreenUtil().setSp(32)), 437 + child: Image.asset(
  438 + Utils.getImgPath(givePriceSwich
  439 + ? 'f_select'
  440 + : 'f_select_not'),
  441 + width: w(20),
437 ), 442 ),
438 - HEmptyView(16),  
439 - Container(  
440 - width: w(140),  
441 - height: w(28),  
442 - alignment: Alignment.center,  
443 - decoration: BoxDecoration(  
444 - border: Border.all(  
445 - width: w(1),  
446 - color: MyColours.color_DBDBDB)),  
447 - child: TextField(  
448 - controller: givePriceC,  
449 - focusNode: givePricF,  
450 - textAlign: TextAlign.center,  
451 - // textAlignVertical: TextAlignVertical.bottom,  
452 - maxLines: 1, 443 + ),
  444 + ),
  445 + Text(
  446 + '赠送',
  447 + style: TextStyle(
  448 + color: MyColours.color_515151,
  449 + fontSize: ScreenUtil().setSp(32)),
  450 + ),
  451 + HEmptyView(16),
  452 + Container(
  453 + width: w(140),
  454 + height: w(28),
  455 + alignment: Alignment.center,
  456 + decoration: BoxDecoration(
  457 + border: Border.all(
  458 + width: w(1),
  459 + color: MyColours.color_DBDBDB)),
  460 + child: TextField(
  461 + controller: givePriceC,
  462 + focusNode: givePricF,
  463 + textAlign: TextAlign.center,
  464 + // textAlignVertical: TextAlignVertical.bottom,
  465 + maxLines: 1,
453 466
454 - // //光标颜色  
455 - // cursorColor:  
456 - // widget.isSelect ? Colors.white : MyColours.color_199095,  
457 - //输入文本的样式  
458 - style: TextStyle(  
459 - color: MyColours.color_515151,  
460 - fontSize: ScreenUtil().setSp(32),  
461 - ),  
462 - // focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,  
463 - decoration: InputDecoration(  
464 - isCollapsed:  
465 - true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度  
466 - border: OutlineInputBorder(  
467 - borderSide: BorderSide.none),  
468 - hintText: '',  
469 - hintStyle: TextStyle(  
470 - color: MyColours.color_999999,  
471 - fontSize: ScreenUtil().setSp(32),  
472 - ),  
473 - enabledBorder: new UnderlineInputBorder(  
474 - borderSide: BorderSide.none,  
475 - ),  
476 - contentPadding: EdgeInsets.zero,  
477 - focusedBorder: new UnderlineInputBorder(  
478 - borderSide: BorderSide.none,  
479 - ),  
480 - ),  
481 - onChanged: (value) {},  
482 - onEditingComplete: () {  
483 - FocusScope.of(context).requestFocus(  
484 - FocusNode()); //点击空白处隐藏键盘  
485 - },  
486 - keyboardType:  
487 - TextInputType.numberWithOptions(),  
488 - ), 467 + // //光标颜色
  468 + // cursorColor:
  469 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  470 + //输入文本的样式
  471 + style: TextStyle(
  472 + color: MyColours.color_515151,
  473 + fontSize: ScreenUtil().setSp(32),
489 ), 474 ),
490 - HEmptyView(16),  
491 - Text(  
492 - '元余额',  
493 - style: TextStyle(  
494 - color: MyColours.color_515151,  
495 - fontSize: ScreenUtil().setSp(32)), 475 + // focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,
  476 + decoration: InputDecoration(
  477 + isCollapsed:
  478 + true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  479 + border: OutlineInputBorder(
  480 + borderSide: BorderSide.none),
  481 + hintText: '',
  482 + hintStyle: TextStyle(
  483 + color: MyColours.color_999999,
  484 + fontSize: ScreenUtil().setSp(32),
  485 + ),
  486 + enabledBorder: new UnderlineInputBorder(
  487 + borderSide: BorderSide.none,
  488 + ),
  489 + contentPadding: EdgeInsets.zero,
  490 + focusedBorder: new UnderlineInputBorder(
  491 + borderSide: BorderSide.none,
  492 + ),
496 ), 493 ),
497 - ], 494 + onChanged: (value) {},
  495 + onEditingComplete: () {
  496 + FocusScope.of(context)
  497 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  498 + },
  499 + keyboardType: TextInputType.numberWithOptions(),
  500 + ),
498 ), 501 ),
499 - VEmptyView(20),  
500 - Row(  
501 - children: [  
502 - Image.asset(  
503 - Utils.getImgPath(  
504 - true ? 'f_select' : 'f_select_not'),  
505 - width: w(20), 502 + HEmptyView(16),
  503 + Text(
  504 + '元余额',
  505 + style: TextStyle(
  506 + color: MyColours.color_515151,
  507 + fontSize: ScreenUtil().setSp(32)),
  508 + ),
  509 + ],
  510 + ),
  511 + VEmptyView(20),
  512 + Row(
  513 + children: [
  514 + InkWell(
  515 + onTap: () {
  516 + setState(() {
  517 + giveScoreSwich = !giveScoreSwich;
  518 + });
  519 + },
  520 + child: Padding(
  521 + padding: EdgeInsets.only(
  522 + left: w(16),
  523 + right: w(8),
506 ), 524 ),
507 - HEmptyView(16),  
508 - Text(  
509 - '赠送',  
510 - style: TextStyle(  
511 - color: MyColours.color_515151,  
512 - fontSize: ScreenUtil().setSp(32)), 525 + child: Image.asset(
  526 + Utils.getImgPath(giveScoreSwich
  527 + ? 'f_select'
  528 + : 'f_select_not'),
  529 + width: w(20),
513 ), 530 ),
514 - HEmptyView(16),  
515 - Container(  
516 - width: w(140),  
517 - height: w(28),  
518 - alignment: Alignment.center,  
519 - decoration: BoxDecoration(  
520 - border: Border.all(  
521 - width: w(1),  
522 - color: MyColours.color_DBDBDB)),  
523 - child: TextField(  
524 - controller: giveScoreC,  
525 - focusNode: giveScoreF,  
526 - textAlign: TextAlign.center,  
527 - // textAlignVertical: TextAlignVertical.bottom,  
528 - maxLines: 1, 531 + ),
  532 + ),
  533 + Text(
  534 + '赠送',
  535 + style: TextStyle(
  536 + color: MyColours.color_515151,
  537 + fontSize: ScreenUtil().setSp(32)),
  538 + ),
  539 + HEmptyView(16),
  540 + Container(
  541 + width: w(140),
  542 + height: w(28),
  543 + alignment: Alignment.center,
  544 + decoration: BoxDecoration(
  545 + border: Border.all(
  546 + width: w(1),
  547 + color: MyColours.color_DBDBDB)),
  548 + child: TextField(
  549 + controller: giveScoreC,
  550 + focusNode: giveScoreF,
  551 + textAlign: TextAlign.center,
  552 + // textAlignVertical: TextAlignVertical.bottom,
  553 + maxLines: 1,
529 554
530 - // //光标颜色  
531 - // cursorColor:  
532 - // widget.isSelect ? Colors.white : MyColours.color_199095,  
533 - //输入文本的样式  
534 - style: TextStyle(  
535 - color: MyColours.color_515151,  
536 - fontSize: ScreenUtil().setSp(32),  
537 - ),  
538 - // focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,  
539 - decoration: InputDecoration(  
540 - isCollapsed:  
541 - true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度  
542 - border: OutlineInputBorder(  
543 - borderSide: BorderSide.none),  
544 - hintText: '',  
545 - hintStyle: TextStyle(  
546 - color: MyColours.color_999999,  
547 - fontSize: ScreenUtil().setSp(32),  
548 - ),  
549 - enabledBorder: new UnderlineInputBorder(  
550 - borderSide: BorderSide.none,  
551 - ),  
552 - contentPadding: EdgeInsets.zero,  
553 - focusedBorder: new UnderlineInputBorder(  
554 - borderSide: BorderSide.none,  
555 - ),  
556 - ),  
557 - onChanged: (value) {},  
558 - onEditingComplete: () {  
559 - FocusScope.of(context).requestFocus(  
560 - FocusNode()); //点击空白处隐藏键盘  
561 - },  
562 - keyboardType:  
563 - TextInputType.numberWithOptions(),  
564 - ), 555 + // //光标颜色
  556 + // cursorColor:
  557 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  558 + //输入文本的样式
  559 + style: TextStyle(
  560 + color: MyColours.color_515151,
  561 + fontSize: ScreenUtil().setSp(32),
565 ), 562 ),
566 - HEmptyView(16),  
567 - Text(  
568 - '积分',  
569 - style: TextStyle(  
570 - color: MyColours.color_515151,  
571 - fontSize: ScreenUtil().setSp(32)), 563 + // focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,
  564 + decoration: InputDecoration(
  565 + isCollapsed:
  566 + true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  567 + border: OutlineInputBorder(
  568 + borderSide: BorderSide.none),
  569 + hintText: '',
  570 + hintStyle: TextStyle(
  571 + color: MyColours.color_999999,
  572 + fontSize: ScreenUtil().setSp(32),
  573 + ),
  574 + enabledBorder: new UnderlineInputBorder(
  575 + borderSide: BorderSide.none,
  576 + ),
  577 + contentPadding: EdgeInsets.zero,
  578 + focusedBorder: new UnderlineInputBorder(
  579 + borderSide: BorderSide.none,
  580 + ),
572 ), 581 ),
573 - ], 582 + onChanged: (value) {},
  583 + onEditingComplete: () {
  584 + FocusScope.of(context)
  585 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  586 + },
  587 + keyboardType: TextInputType.numberWithOptions(),
  588 + ),
574 ), 589 ),
575 - VEmptyView(20),  
576 - Row(  
577 - children: [  
578 - Image.asset(  
579 - Utils.getImgPath(  
580 - true ? 'f_select' : 'f_select_not'),  
581 - width: w(20), 590 + HEmptyView(16),
  591 + Text(
  592 + '积分',
  593 + style: TextStyle(
  594 + color: MyColours.color_515151,
  595 + fontSize: ScreenUtil().setSp(32)),
  596 + ),
  597 + ],
  598 + ),
  599 + VEmptyView(20),
  600 + Row(
  601 + children: [
  602 + InkWell(
  603 + onTap: () {
  604 + setState(() {
  605 + giveCouponsSwich = !giveCouponsSwich;
  606 + });
  607 + },
  608 + child: Padding(
  609 + padding: EdgeInsets.only(
  610 + left: w(16),
  611 + right: w(8),
582 ), 612 ),
583 - HEmptyView(16),  
584 - Text(  
585 - '赠送优惠券',  
586 - style: TextStyle(  
587 - color: MyColours.color_515151,  
588 - fontSize: ScreenUtil().setSp(32)), 613 + child: Image.asset(
  614 + Utils.getImgPath(giveCouponsSwich
  615 + ? 'f_select'
  616 + : 'f_select_not'),
  617 + width: w(20),
589 ), 618 ),
590 - HEmptyView(60),  
591 - InkWell(  
592 - onTap: () async {  
593 - Map object = await NavigatorUtil  
594 - .goRechargeSelectStoreCouponPage(  
595 - context, selectIDs.join(','));  
596 - print(object);  
597 - if (object != null &&  
598 - object['couponsid'] != null) {  
599 - List<CouponSunModel> data =  
600 - object['couponsdata'];  
601 - //  
602 - selectIDs = object['couponsid'];  
603 - coupons = [];  
604 - data.forEach((element) {  
605 - if (element.isCheck) {  
606 - coupons.add(element.aname);  
607 - }  
608 - });  
609 - setState(() {});  
610 - }  
611 - },  
612 - child: Text(  
613 - '选择优惠券',  
614 - style: TextStyle(  
615 - color: MyColours.color_438E93,  
616 - fontSize: ScreenUtil().setSp(32)),  
617 - )),  
618 - ], 619 + ),
  620 + ),
  621 + Text(
  622 + '赠送优惠券',
  623 + style: TextStyle(
  624 + color: MyColours.color_515151,
  625 + fontSize: ScreenUtil().setSp(32)),
619 ), 626 ),
620 - VEmptyView(20),  
621 - Wrap(  
622 - spacing: w(9),  
623 - runSpacing: w(9),  
624 - alignment: WrapAlignment.start,  
625 - runAlignment: WrapAlignment.start,  
626 - children: coupons.map((e) {  
627 - return Text(  
628 - e, 627 + HEmptyView(60),
  628 + if (giveCouponsSwich)
  629 + InkWell(
  630 + onTap: () async {
  631 + Map object = await NavigatorUtil
  632 + .goRechargeSelectStoreCouponPage(
  633 + context, selectIDs.join(','));
  634 + print(object);
  635 + if (object != null &&
  636 + object['couponsid'] != null) {
  637 + List<CouponSunModel> data =
  638 + object['couponsdata'];
  639 + //
  640 + selectIDs = object['couponsid'];
  641 + coupons = [];
  642 + data.forEach((element) {
  643 + if (element.isCheck) {
  644 + coupons.add(element.aname);
  645 + }
  646 + });
  647 + setState(() {});
  648 + }
  649 + },
  650 + child: Text(
  651 + '选择优惠券',
629 style: TextStyle( 652 style: TextStyle(
630 - color: MyColours.color_515151, 653 + color: MyColours.color_438E93,
631 fontSize: ScreenUtil().setSp(32)), 654 fontSize: ScreenUtil().setSp(32)),
632 - );  
633 - }).toList()),  
634 - VEmptyView(20), 655 + )),
635 ], 656 ],
636 - )), 657 + ),
  658 + if (giveCouponsSwich) VEmptyView(20),
  659 + if (giveCouponsSwich)
  660 + Padding(
  661 + padding: EdgeInsets.only(
  662 + left: w(45),
  663 + right: w(8),
  664 + ),
  665 + child: Wrap(
  666 + spacing: w(9),
  667 + runSpacing: w(9),
  668 + alignment: WrapAlignment.start,
  669 + runAlignment: WrapAlignment.start,
  670 + children: coupons.map((e) {
  671 + return Text(
  672 + e,
  673 + style: TextStyle(
  674 + color: MyColours.color_515151,
  675 + fontSize: ScreenUtil().setSp(32)),
  676 + );
  677 + }).toList())),
  678 + VEmptyView(20),
  679 + ],
  680 + ),
637 MyDivider( 681 MyDivider(
638 double.infinity, 682 double.infinity,
639 w(1), 683 w(1),
@@ -3,11 +3,13 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; @@ -3,11 +3,13 @@ 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/pages/my/marketing_center/recharge/recharge_item.dart'; 4 import 'package:one_key/pages/my/marketing_center/recharge/recharge_item.dart';
5 import 'package:one_key/res/colors.dart'; 5 import 'package:one_key/res/colors.dart';
  6 +import 'package:one_key/utils/utils.dart';
6 import 'package:one_key/widgets/system_app_bar.dart'; 7 import 'package:one_key/widgets/system_app_bar.dart';
7 import 'package:provider/provider.dart'; 8 import 'package:provider/provider.dart';
8 9
9 import '../../../../constant/state.dart'; 10 import '../../../../constant/state.dart';
10 import '../../../../provider/marketing_center_provider.dart'; 11 import '../../../../provider/marketing_center_provider.dart';
  12 +import '../../../../provider/user_model.dart';
11 import '../../../../route/navigator_util.dart'; 13 import '../../../../route/navigator_util.dart';
12 import '../../../../utils/screen_util.dart'; 14 import '../../../../utils/screen_util.dart';
13 import '../../../../widgets/page_exception.dart'; 15 import '../../../../widgets/page_exception.dart';
@@ -33,6 +35,11 @@ class _RechargeHomePageState extends State<RechargeHomePage> { @@ -33,6 +35,11 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
33 Widget build(BuildContext context) { 35 Widget build(BuildContext context) {
34 marketingCenterProvider = 36 marketingCenterProvider =
35 Provider.of<MarketingCenterProvider>(context, listen: true); 37 Provider.of<MarketingCenterProvider>(context, listen: true);
  38 + bool showBtn = Provider.of<UserModel>(context, listen: false)
  39 + .user
  40 + .role_name ==
  41 + '管理员' ||
  42 + Provider.of<UserModel>(context, listen: false).user.role_name == '店长';
36 return Scaffold( 43 return Scaffold(
37 backgroundColor: MyColours.color_f3f3f3, 44 backgroundColor: MyColours.color_f3f3f3,
38 appBar: SystemAppBar( 45 appBar: SystemAppBar(
@@ -73,16 +80,22 @@ class _RechargeHomePageState extends State<RechargeHomePage> { @@ -73,16 +80,22 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
73 return RechargeItem( 80 return RechargeItem(
74 from: 'quan', 81 from: 'quan',
75 // couponSonModel: couponProvider.couponList[index], 82 // couponSonModel: couponProvider.couponList[index],
76 - // showBtn: true,  
77 - // onPressedSwich: () {  
78 - // couponProvider.couponList[index].isOpenBool =  
79 - // !couponProvider.couponList[index].isOpenBool;  
80 - // _setCustomerActivity(index);  
81 - // },  
82 - // onPressed: () {  
83 - // NavigatorUtil.goCouponDetailPage(  
84 - // context, couponProvider.couponList[index]);  
85 - // }, 83 + showBtn: showBtn,
  84 + onPressedDel: () {
  85 + // couponProvider.couponList[index].isOpenBool =
  86 + // !couponProvider.couponList[index].isOpenBool;
  87 + // _setCustomerActivity(index);
  88 + },
  89 + onPressedUse: () {},
  90 + onPressed: () {
  91 + if (showBtn) {
  92 + //跳进编辑页
  93 + NavigatorUtil.goRechargeEditPage(context);
  94 + } else {
  95 + //查看页
  96 + NavigatorUtil.goRechargeDetailPage(context);
  97 + }
  98 + },
86 ); 99 );
87 }, childCount: 100), 100 }, childCount: 100),
88 ), 101 ),
@@ -128,54 +141,59 @@ class _RechargeHomePageState extends State<RechargeHomePage> { @@ -128,54 +141,59 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
128 } 141 }
129 }), 142 }),
130 )), 143 )),
131 - Container(  
132 - height: ScreenUtil().setWidth(91 * 2),  
133 - width: double.infinity,  
134 - padding: EdgeInsets.only(  
135 - top: ScreenUtil().setWidth(16 * 2),  
136 - bottom: ScreenUtil().setWidth(35 * 2),  
137 - left: ScreenUtil().setWidth(45 * 2),  
138 - right: ScreenUtil().setWidth(45 * 2),  
139 - ),  
140 - decoration: BoxDecoration(  
141 - color: MyColours.color_ffffff,  
142 - boxShadow: [  
143 - BoxShadow(  
144 - spreadRadius: ScreenUtil().setWidth(2),  
145 - color: Color.fromRGBO(0, 0, 0, 0.1),  
146 - offset: Offset(0, ScreenUtil().setWidth(-2)),  
147 - blurRadius: ScreenUtil().setWidth(8))  
148 - ],  
149 - borderRadius: BorderRadius.all(  
150 - Radius.circular(ScreenUtil().setWidth(16)), 144 + if (Provider.of<UserModel>(context, listen: false).user.role_name ==
  145 + '管理员' ||
  146 + Provider.of<UserModel>(context, listen: false).user.role_name ==
  147 + '店长')
  148 + Container(
  149 + height: ScreenUtil().setWidth(91 * 2),
  150 + width: double.infinity,
  151 + padding: EdgeInsets.only(
  152 + top: ScreenUtil().setWidth(16 * 2),
  153 + bottom: ScreenUtil().setWidth(35 * 2),
  154 + left: ScreenUtil().setWidth(45 * 2),
  155 + right: ScreenUtil().setWidth(45 * 2),
151 ), 156 ),
152 - ),  
153 - child: RoundButton(  
154 - text: '新建优惠',  
155 - height: ScreenUtil().setWidth(80),  
156 - radius: ScreenUtil().setWidth(14),  
157 - isBold: false,  
158 - fontSize: 28,  
159 - onPressed: () async {  
160 - // UserModel userModel =  
161 - // Provider.of<UserModel>(context, listen: false);  
162 - // if (userModel.user.role_name == '管理员' ||  
163 - // userModel.user.role_name == '店长') { 157 + decoration: BoxDecoration(
  158 + color: MyColours.color_ffffff,
  159 + boxShadow: [
  160 + BoxShadow(
  161 + spreadRadius: ScreenUtil().setWidth(2),
  162 + color: Color.fromRGBO(0, 0, 0, 0.1),
  163 + offset: Offset(0, ScreenUtil().setWidth(-2)),
  164 + blurRadius: ScreenUtil().setWidth(8))
  165 + ],
  166 + borderRadius: BorderRadius.all(
  167 + Radius.circular(ScreenUtil().setWidth(16)),
  168 + ),
  169 + ),
  170 + child: RoundButton(
  171 + text: '新建优惠',
  172 + height: ScreenUtil().setWidth(80),
  173 + radius: ScreenUtil().setWidth(14),
  174 + isBold: false,
  175 + fontSize: 28,
  176 + onPressed: () async {
  177 + // UserModel userModel =
  178 + // Provider.of<UserModel>(context, listen: false);
  179 + // if (userModel.user.role_name == '管理员' ||
  180 + // userModel.user.role_name == '店长') {
164 NavigatorUtil.goRechargeEditPage(context); 181 NavigatorUtil.goRechargeEditPage(context);
165 - // } else {  
166 - // bool needRefresh =  
167 - // await NavigatorUtil.goCouponEditPage(context);  
168 - // print(needRefresh);  
169 - // if (needRefresh != null && needRefresh) {  
170 - // bus.emit('refresh_coupon_list_f');  
171 - // //刷新页面数据  
172 - // // _controller.callRefresh();  
173 - // // _couponNetworkData(tabController.index);  
174 - // }  
175 - // }  
176 - },  
177 - ),  
178 - ) 182 + // } else {
  183 + // Utils.showToast('您还没有相关权限');
  184 + // // bool needRefresh =
  185 + // // await NavigatorUtil.goCouponEditPage(context);
  186 + // // print(needRefresh);
  187 + // // if (needRefresh != null && needRefresh) {
  188 + // // bus.emit('refresh_coupon_list_f');
  189 + // // //刷新页面数据
  190 + // // // _controller.callRefresh();
  191 + // // // _couponNetworkData(tabController.index);
  192 + // // }
  193 + // }
  194 + },
  195 + ),
  196 + )
179 ], 197 ],
180 ), 198 ),
181 ), 199 ),
@@ -10,24 +10,27 @@ import 'package:one_key/widgets/h_empty_view.dart'; @@ -10,24 +10,27 @@ 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 '../../../../provider/user_model.dart';
13 import '../../../../utils/screen_util.dart'; 14 import '../../../../utils/screen_util.dart';
14 15
15 class RechargeItem extends StatefulWidget { 16 class RechargeItem extends StatefulWidget {
16 final String from; 17 final String from;
17 final VoidCallback onPressed; 18 final VoidCallback onPressed;
18 - final VoidCallback onPressedSwich; 19 + final VoidCallback onPressedDel;
  20 + final VoidCallback onPressedUse;
19 final CouponSunModel couponSonModel; 21 final CouponSunModel couponSonModel;
20 final bool showBtn; 22 final bool showBtn;
21 final bool showCheck; 23 final bool showCheck;
22 - RechargeItem(  
23 - {Key key,  
24 - this.from,  
25 - this.onPressed,  
26 - this.onPressedSwich,  
27 - this.couponSonModel,  
28 - this.showBtn = false,  
29 - this.showCheck = false})  
30 - : super(key: key); 24 + RechargeItem({
  25 + Key key,
  26 + this.from,
  27 + this.onPressed,
  28 + this.onPressedDel,
  29 + this.onPressedUse,
  30 + this.couponSonModel,
  31 + this.showBtn = false,
  32 + this.showCheck = false,
  33 + }) : super(key: key);
31 34
32 @override 35 @override
33 _RechargeItemState createState() => _RechargeItemState(); 36 _RechargeItemState createState() => _RechargeItemState();
@@ -108,15 +111,12 @@ class _RechargeItemState extends State<RechargeItem> { @@ -108,15 +111,12 @@ class _RechargeItemState extends State<RechargeItem> {
108 fontWeight: FontWeight.bold, 111 fontWeight: FontWeight.bold,
109 fontSize: ScreenUtil().setSp(32)), 112 fontSize: ScreenUtil().setSp(32)),
110 ), 113 ),
111 - InkWell(  
112 - onTap: widget.onPressedSwich,  
113 - child: Text('更新时间:2022-12-18',  
114 - maxLines: 1,  
115 - overflow: TextOverflow.ellipsis,  
116 - style: TextStyle(  
117 - color: MyColours.color_ffffff,  
118 - fontSize: ScreenUtil().setSp(20))),  
119 - ), 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 ], 120 ],
121 ), 121 ),
122 ), 122 ),
@@ -136,7 +136,7 @@ class _RechargeItemState extends State<RechargeItem> { @@ -136,7 +136,7 @@ class _RechargeItemState extends State<RechargeItem> {
136 maxLines: 1, 136 maxLines: 1,
137 overflow: TextOverflow.ellipsis, 137 overflow: TextOverflow.ellipsis,
138 style: TextStyle( 138 style: TextStyle(
139 - color: MyColours.color_999999, 139 + color: MyColours.color_999999,
140 fontSize: ScreenUtil().setSp(20), 140 fontSize: ScreenUtil().setSp(20),
141 )), 141 )),
142 ), 142 ),
@@ -148,7 +148,7 @@ class _RechargeItemState extends State<RechargeItem> { @@ -148,7 +148,7 @@ class _RechargeItemState extends State<RechargeItem> {
148 maxLines: 1, 148 maxLines: 1,
149 overflow: TextOverflow.ellipsis, 149 overflow: TextOverflow.ellipsis,
150 style: TextStyle( 150 style: TextStyle(
151 - color: MyColours.color_999999, 151 + color: MyColours.color_999999,
152 fontSize: ScreenUtil().setSp(20), 152 fontSize: ScreenUtil().setSp(20),
153 )), 153 )),
154 ), 154 ),
@@ -160,7 +160,7 @@ class _RechargeItemState extends State<RechargeItem> { @@ -160,7 +160,7 @@ class _RechargeItemState extends State<RechargeItem> {
160 maxLines: 1, 160 maxLines: 1,
161 overflow: TextOverflow.ellipsis, 161 overflow: TextOverflow.ellipsis,
162 style: TextStyle( 162 style: TextStyle(
163 - color: MyColours.color_999999, 163 + color: MyColours.color_999999,
164 fontSize: ScreenUtil().setSp(20), 164 fontSize: ScreenUtil().setSp(20),
165 )), 165 )),
166 ), 166 ),
@@ -182,44 +182,46 @@ class _RechargeItemState extends State<RechargeItem> { @@ -182,44 +182,46 @@ class _RechargeItemState extends State<RechargeItem> {
182 // : Container() 182 // : Container()
183 // : 183 // :
184 ), 184 ),
185 - MySeparator(width: w(4), color: MyColours.color_BFC4D4),  
186 - VEmptyView(15),  
187 - Row(  
188 - mainAxisAlignment: MainAxisAlignment.end,  
189 - children: [  
190 - RoundButton(  
191 - width: widget.from == 'history'  
192 - ? ScreenUtil().setWidth(50 * 2)  
193 - : ScreenUtil().setWidth(50 * 2),  
194 - height: ScreenUtil().setWidth(20 * 2),  
195 - radius: ScreenUtil().setWidth(10),  
196 - text: '删除',  
197 - fontSize: 24,  
198 - textColor: MyColours.color_E34D59,  
199 - gradientStart: MyColours.color_ffffff,  
200 - gradientEnd: MyColours.color_ffffff,  
201 - borderColor: MyColours.color_E34D59,  
202 - onPressed: widget.onPressedSwich,  
203 - ),  
204 - HEmptyView(34),  
205 - RoundButton(  
206 - width: ScreenUtil().setWidth(50 * 2),  
207 - height: ScreenUtil().setWidth(20 * 2),  
208 - radius: ScreenUtil().setWidth(10),  
209 - text: '禁用', 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: '禁用',
210 212
211 - ///启用  
212 - fontSize: 24,  
213 - textColor: MyColours.color_438E93,  
214 - gradientStart: MyColours.color_ffffff,  
215 - gradientEnd: MyColours.color_ffffff,  
216 - borderColor: MyColours.color_438E93,  
217 - onPressed: widget.onPressedSwich,  
218 - ),  
219 - HEmptyView(38),  
220 - ],  
221 - ),  
222 - VEmptyView(15) 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,
  220 + ),
  221 + HEmptyView(38),
  222 + ],
  223 + ),
  224 + if (widget.showBtn) VEmptyView(15)
223 ], 225 ],
224 ), 226 ),
225 )); 227 ));
@@ -1571,4 +1571,13 @@ class NavigatorUtil { @@ -1571,4 +1571,13 @@ class NavigatorUtil {
1571 "${Routes.recharge_select_store_coupon_page}?selectIDs=$selectIDs", 1571 "${Routes.recharge_select_store_coupon_page}?selectIDs=$selectIDs",
1572 replace: replace); 1572 replace: replace);
1573 } 1573 }
  1574 +
  1575 + ///充值优惠详情页
  1576 + static Future<dynamic> goRechargeDetailPage(
  1577 + BuildContext context, {
  1578 + replace = false,
  1579 + }) {
  1580 + return _navigateTo(context, "${Routes.recharge_detail_page}",
  1581 + replace: replace);
  1582 + }
1574 } 1583 }
@@ -189,6 +189,7 @@ import '../pages/my/marketing_center/book_notification/marking_coupon_select_pag @@ -189,6 +189,7 @@ import '../pages/my/marketing_center/book_notification/marking_coupon_select_pag
189 import '../pages/my/marketing_center/book_notification/marking_preview_page.dart'; 189 import '../pages/my/marketing_center/book_notification/marking_preview_page.dart';
190 import '../pages/my/marketing_center/book_notification/store_introduce_page.dart'; 190 import '../pages/my/marketing_center/book_notification/store_introduce_page.dart';
191 import '../pages/my/marketing_center/marketing_center_home_page.dart'; 191 import '../pages/my/marketing_center/marketing_center_home_page.dart';
  192 +import '../pages/my/marketing_center/recharge/recharge_detail_page.dart';
192 import '../pages/my/marketing_center/recharge/recharge_edit_page.dart'; 193 import '../pages/my/marketing_center/recharge/recharge_edit_page.dart';
193 import '../pages/my/marketing_center/recharge/recharge_home_page.dart'; 194 import '../pages/my/marketing_center/recharge/recharge_home_page.dart';
194 import '../pages/my/marketing_center/recharge/recharge_select_store_coupon_page.dart'; 195 import '../pages/my/marketing_center/recharge/recharge_select_store_coupon_page.dart';
@@ -2526,3 +2527,19 @@ var rechargeSelectStoreCouponPageHandle = new Handler( @@ -2526,3 +2527,19 @@ var rechargeSelectStoreCouponPageHandle = new Handler(
2526 create: (_) => CouponProvider(), 2527 create: (_) => CouponProvider(),
2527 child: RechargeSelectStoreCouponPage(selectList: selectList))); 2528 child: RechargeSelectStoreCouponPage(selectList: selectList)));
2528 }); 2529 });
  2530 +
  2531 +///充值优惠详情页
  2532 +var rechargeDetailPageHandle = new Handler(
  2533 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  2534 + // OutWineRecordSunModel outWineRecordSunModel = OutWineRecordSunModel.fromJson(
  2535 + // json.decode(
  2536 + // FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
  2537 +
  2538 + // String selectIDs = params["selectIDs"].first;
  2539 + // List<String> selectList = [];
  2540 + // if (selectIDs.length > 0) {
  2541 + // selectList = selectIDs.split(',');
  2542 + // }
  2543 + return ChangeNotifierProvider<MarketingCenterProvider>(
  2544 + create: (_) => MarketingCenterProvider(), child: RechargeDetailPage());
  2545 +});
@@ -229,6 +229,10 @@ class Routes { @@ -229,6 +229,10 @@ class Routes {
229 static String recharge_edit_page = "/recharge_edit_page"; //充值优惠详情编辑页 229 static String recharge_edit_page = "/recharge_edit_page"; //充值优惠详情编辑页
230 static String recharge_select_store_coupon_page = 230 static String recharge_select_store_coupon_page =
231 "/recharge_select_store_coupon_page"; //充值优惠选择店铺可核销优惠券 231 "/recharge_select_store_coupon_page"; //充值优惠选择店铺可核销优惠券
  232 +static String recharge_detail_page =
  233 + "/recharge_detail_page"; //充值优惠详情页
  234 +
  235 +
232 236
233 static void configureRoutes(FluroRouter router) { 237 static void configureRoutes(FluroRouter router) {
234 router.notFoundHandler = new Handler( 238 router.notFoundHandler = new Handler(
@@ -443,5 +447,9 @@ class Routes { @@ -443,5 +447,9 @@ class Routes {
443 447
444 router.define(recharge_select_store_coupon_page, 448 router.define(recharge_select_store_coupon_page,
445 handler: rechargeSelectStoreCouponPageHandle); 449 handler: rechargeSelectStoreCouponPageHandle);
  450 +router.define(recharge_detail_page,
  451 + handler: rechargeDetailPageHandle);
  452 +
  453 +
446 } 454 }
447 } 455 }
@@ -84,7 +84,7 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget { @@ -84,7 +84,7 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget {
84 ? Image.asset( 84 ? Image.asset(
85 Utils.getImgPath( 85 Utils.getImgPath(
86 rightImgName.replaceAll('.png', '')), 86 rightImgName.replaceAll('.png', '')),
87 - width: ScreenUtil().setWidth(48)) 87 + width: ScreenUtil().setWidth(40))
88 : Container( 88 : Container(
89 // color: Colors.red, 89 // color: Colors.red,
90 alignment: Alignment.center, 90 alignment: Alignment.center,
@@ -78,6 +78,13 @@ packages: @@ -78,6 +78,13 @@ packages:
78 url: "https://pub.flutter-io.cn" 78 url: "https://pub.flutter-io.cn"
79 source: hosted 79 source: hosted
80 version: "2.0.0" 80 version: "2.0.0"
  81 + barcode_scan2:
  82 + dependency: "direct main"
  83 + description:
  84 + name: barcode_scan2
  85 + url: "https://pub.flutter-io.cn"
  86 + source: hosted
  87 + version: "4.2.4"
81 boolean_selector: 88 boolean_selector:
82 dependency: transitive 89 dependency: transitive
83 description: 90 description:
@@ -1001,6 +1008,13 @@ packages: @@ -1001,6 +1008,13 @@ packages:
1001 url: "https://pub.flutter-io.cn" 1008 url: "https://pub.flutter-io.cn"
1002 source: hosted 1009 source: hosted
1003 version: "4.2.1" 1010 version: "4.2.1"
  1011 + protobuf:
  1012 + dependency: transitive
  1013 + description:
  1014 + name: protobuf
  1015 + url: "https://pub.flutter-io.cn"
  1016 + source: hosted
  1017 + version: "2.1.0"
1004 provider: 1018 provider:
1005 dependency: "direct main" 1019 dependency: "direct main"
1006 description: 1020 description:
@@ -186,6 +186,9 @@ dependencies: @@ -186,6 +186,9 @@ dependencies:
186 image: ^4.0.15 186 image: ^4.0.15
187 image_cropper: ^3.0.1 187 image_cropper: ^3.0.1
188 pin_code_fields: ^7.4.0 188 pin_code_fields: ^7.4.0
  189 + # 二维码扫描
  190 + barcode_scan2: ^4.2.4
  191 + # qr_code_scanner: ^1.0.1
189 192
190 193
191 #表格多选组建 194 #表格多选组建