Commit 22eded6035e556672fc419c08f0ceab874b309e8

Authored by wdn127929
1 parent 80257a6b

营销中心-----优惠券-----新建优惠----提前点餐

@@ -99,6 +99,11 @@ class Constant { @@ -99,6 +99,11 @@ class Constant {
99 '店长', 99 '店长',
100 '前台', 100 '前台',
101 ], 101 ],
  102 + '请客人点菜': [
  103 + '管理员',
  104 + '店长',
  105 + '前台',
  106 + ],
102 '通知客户': [ 107 '通知客户': [
103 '管理员', 108 '管理员',
104 '店长', 109 '店长',
@@ -170,5 +175,13 @@ class Constant { @@ -170,5 +175,13 @@ class Constant {
170 '店长', 175 '店长',
171 ], 176 ],
172 '个人-月订单量': ['客户经理', '收银员', '服务员', '前台'], 177 '个人-月订单量': ['客户经理', '收银员', '服务员', '前台'],
  178 + '线上券-设置': [
  179 + '管理员',
  180 + '店长',
  181 + ],
  182 + '充值优惠-设置': [
  183 + '管理员',
  184 + '店长',
  185 + ],
173 }; 186 };
174 } 187 }
@@ -91,12 +91,12 @@ class CouponSunModel extends Object { @@ -91,12 +91,12 @@ class CouponSunModel extends Object {
91 @JsonKey(name: 'nick_name') 91 @JsonKey(name: 'nick_name')
92 String nickNameShow; 92 String nickNameShow;
93 93
94 - @JsonKey(name: 'grant_num') 94 + @JsonKey(name: 'grant_num')
95 String grantNum; 95 String grantNum;
96 -  
97 96
98 bool isCheck = false; 97 bool isCheck = false;
99 bool showText = false; 98 bool showText = false;
  99 + bool isMarking = false;
100 100
101 CouponSunModel( 101 CouponSunModel(
102 this.id, 102 this.id,
@@ -119,7 +119,8 @@ class CouponSunModel extends Object { @@ -119,7 +119,8 @@ class CouponSunModel extends Object {
119 this.price, 119 this.price,
120 this.use, 120 this.use,
121 this.expDate, 121 this.expDate,
122 - this.nickNameShow,this.grantNum); 122 + this.nickNameShow,
  123 + this.grantNum);
123 124
124 factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) => 125 factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) =>
125 _$CouponSunModelFromJson(srcJson); 126 _$CouponSunModelFromJson(srcJson);
@@ -53,6 +53,7 @@ class RechargeListSunModel { @@ -53,6 +53,7 @@ class RechargeListSunModel {
53 bool isCheck = false; 53 bool isCheck = false;
54 String stime; 54 String stime;
55 String etime; 55 String etime;
  56 + bool isMarking = false;
56 57
57 String get cdateStr { 58 String get cdateStr {
58 if (cdate.toString() == '0') { 59 if (cdate.toString() == '0') {
@@ -255,7 +255,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { @@ -255,7 +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 + // bus.emit('refresh_marketting_page');
259 259
260 bus.emit('refresh_table_m_coupon'); 260 bus.emit('refresh_table_m_coupon');
261 Navigator.pop(context, true); 261 Navigator.pop(context, true);
@@ -99,7 +99,9 @@ class _CouponItemFState extends State<CouponItemF> { @@ -99,7 +99,9 @@ class _CouponItemFState extends State<CouponItemF> {
99 ? MyColours.color_BFC4D4 99 ? MyColours.color_BFC4D4
100 : notSelect 100 : notSelect
101 ? sunModel.isType == '1' 101 ? sunModel.isType == '1'
102 - ? MyColours.color_438E93 102 + ? sunModel.isMarking
  103 + ? MyColours.color_00A870
  104 + : MyColours.color_438E93
103 : MyColours.color_ED7B2F 105 : MyColours.color_ED7B2F
104 : MyColours.color_999999, 106 : MyColours.color_999999,
105 borderRadius: BorderRadius.only( 107 borderRadius: BorderRadius.only(
@@ -10,14 +10,17 @@ import 'package:one_key/provider/user_model.dart'; @@ -10,14 +10,17 @@ import 'package:one_key/provider/user_model.dart';
10 import 'package:one_key/res/colors.dart'; 10 import 'package:one_key/res/colors.dart';
11 import 'package:one_key/utils/event_bus.dart'; 11 import 'package:one_key/utils/event_bus.dart';
12 import 'package:one_key/route/navigator_util.dart'; 12 import 'package:one_key/route/navigator_util.dart';
  13 +import 'package:one_key/widgets/h_empty_view.dart';
13 import 'package:one_key/widgets/round_button.dart'; 14 import 'package:one_key/widgets/round_button.dart';
14 import 'package:one_key/widgets/system_app_bar.dart'; 15 import 'package:one_key/widgets/system_app_bar.dart';
15 import 'package:one_key/widgets/v_empty_view.dart'; 16 import 'package:one_key/widgets/v_empty_view.dart';
16 import 'package:provider/provider.dart'; 17 import 'package:provider/provider.dart';
17 import 'package:barcode_scan2/barcode_scan2.dart'; 18 import 'package:barcode_scan2/barcode_scan2.dart';
18 19
  20 +import '../../provider/marketing_center_provider.dart';
19 import '../../utils/dialog_util.dart'; 21 import '../../utils/dialog_util.dart';
20 import '../../utils/misc.dart'; 22 import '../../utils/misc.dart';
  23 +import '../../utils/screen_util.dart';
21 import '../../utils/utils.dart'; 24 import '../../utils/utils.dart';
22 import 'coupon_has_verification_page.dart'; 25 import 'coupon_has_verification_page.dart';
23 26
@@ -165,13 +168,17 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { @@ -165,13 +168,17 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
165 couponProvider = Provider.of<CouponProvider>(context, listen: true); 168 couponProvider = Provider.of<CouponProvider>(context, listen: true);
166 return Scaffold( 169 return Scaffold(
167 backgroundColor: MyColours.color_f3f3f3, 170 backgroundColor: MyColours.color_f3f3f3,
168 - appBar: SystemAppBar(  
169 - '线上券',  
170 - rightImgName: 'scan.png',  
171 - onTapRight: () {  
172 - _scan();  
173 - },  
174 - ), 171 + appBar: Utils.getAuthority(context, '线上券-设置')
  172 + ? SystemAppBar(
  173 + '线上券',
  174 + rightImgName: 'set_g.png',
  175 + onTapRight: () {
  176 + NavigatorUtil.goCouponSettingPage(context);
  177 + },
  178 + )
  179 + : SystemAppBar(
  180 + '线上券',
  181 + ),
175 body: Column( 182 body: Column(
176 children: <Widget>[ 183 children: <Widget>[
177 Container( 184 Container(
@@ -202,7 +209,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { @@ -202,7 +209,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
202 unselectedLabelColor: MyColours.color_999999, 209 unselectedLabelColor: MyColours.color_999999,
203 labelStyle: TextStyle( 210 labelStyle: TextStyle(
204 color: MyColours.color_438E93, 211 color: MyColours.color_438E93,
205 - fontSize: ScreenUtil().setSp(28), 212 + fontSize: ScreenUtil().setSp(25),
206 fontWeight: FontWeight.bold), 213 fontWeight: FontWeight.bold),
207 unselectedLabelStyle: TextStyle( 214 unselectedLabelStyle: TextStyle(
208 color: MyColours.color_999999, 215 color: MyColours.color_999999,
@@ -216,23 +223,27 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { @@ -216,23 +223,27 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
216 children: [ 223 children: [
217 ChangeNotifierProvider<PersonnelProvider>( 224 ChangeNotifierProvider<PersonnelProvider>(
218 create: (_) => PersonnelProvider(), 225 create: (_) => PersonnelProvider(),
219 - child: CouponSunPage(index: 0)), 226 + child: ChangeNotifierProvider<MarketingCenterProvider>(
  227 + create: (_) => MarketingCenterProvider(),
  228 + child: CouponSunPage(index: 0))),
220 ChangeNotifierProvider<PersonnelProvider>( 229 ChangeNotifierProvider<PersonnelProvider>(
221 create: (_) => PersonnelProvider(), 230 create: (_) => PersonnelProvider(),
222 - child: CouponSunPage(index: 1)), 231 + child: ChangeNotifierProvider<MarketingCenterProvider>(
  232 + create: (_) => MarketingCenterProvider(),
  233 + child: CouponSunPage(index: 1))),
223 ChangeNotifierProvider<PersonnelProvider>( 234 ChangeNotifierProvider<PersonnelProvider>(
224 create: (_) => PersonnelProvider(), 235 create: (_) => PersonnelProvider(),
225 - child: CouponSunPage(index: 2)), 236 + child: ChangeNotifierProvider<MarketingCenterProvider>(
  237 + create: (_) => MarketingCenterProvider(),
  238 + child: CouponSunPage(index: 2))),
226 ChangeNotifierProvider<PersonnelProvider>( 239 ChangeNotifierProvider<PersonnelProvider>(
227 create: (_) => PersonnelProvider(), 240 create: (_) => PersonnelProvider(),
228 child: CouponHasVerificationPage()), 241 child: CouponHasVerificationPage()),
229 ], 242 ],
230 ), 243 ),
231 ), 244 ),
232 - if (tabController.index != 3)  
233 - Container( 245 + Container(
234 height: ScreenUtil().setWidth(91 * 2), 246 height: ScreenUtil().setWidth(91 * 2),
235 - width: double.infinity,  
236 padding: EdgeInsets.only( 247 padding: EdgeInsets.only(
237 top: ScreenUtil().setWidth(16 * 2), 248 top: ScreenUtil().setWidth(16 * 2),
238 bottom: ScreenUtil().setWidth(35 * 2), 249 bottom: ScreenUtil().setWidth(35 * 2),
@@ -248,40 +259,83 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin { @@ -248,40 +259,83 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
248 offset: Offset(0, ScreenUtil().setWidth(-2)), 259 offset: Offset(0, ScreenUtil().setWidth(-2)),
249 blurRadius: ScreenUtil().setWidth(8)) 260 blurRadius: ScreenUtil().setWidth(8))
250 ], 261 ],
251 - borderRadius: BorderRadius.all(  
252 - Radius.circular(ScreenUtil().setWidth(16)),  
253 - ),  
254 - ),  
255 - child: RoundButton(  
256 - text: '创建新的优惠券',  
257 - height: ScreenUtil().setWidth(80),  
258 - radius: ScreenUtil().setWidth(14),  
259 - isBold: false,  
260 - fontSize: 28,  
261 - onPressed: () async {  
262 - // UserModel userModel =  
263 - // Provider.of<UserModel>(context, listen: false);  
264 - if (Utils.getAuthority(context, '创建新的优惠券')) {  
265 - NavigatorUtil.goCouponCreateSelectTypePage(context);  
266 - }  
267 - // if (userModel.user.role_name == '管理员' ||  
268 - // userModel.user.role_name == '店长') {  
269 - // NavigatorUtil.goCouponCreateSelectTypePage(context);  
270 - // }  
271 - else {  
272 - bool needRefresh =  
273 - await NavigatorUtil.goCouponEditPage(context);  
274 - print(needRefresh);  
275 - if (needRefresh != null && needRefresh) {  
276 - bus.emit('refresh_coupon_list_f');  
277 - //刷新页面数据  
278 - // _controller.callRefresh();  
279 - // _couponNetworkData(tabController.index);  
280 - }  
281 - }  
282 - }, 262 + borderRadius: BorderRadius.only(
  263 + topLeft: Radius.circular(ScreenUtil().setWidth(16)),
  264 + topRight: Radius.circular(ScreenUtil().setWidth(16))),
283 ), 265 ),
284 - ) 266 + child: Row(
  267 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  268 + children: [
  269 + tabController.index == 3
  270 + ? Expanded(
  271 + child: RoundButton(
  272 + text: '扫码核销',
  273 + width: tabController.index == 3
  274 + ? double.infinity
  275 + : w(100),
  276 + gradientStart: MyColours.color_ffffff,
  277 + gradientEnd: MyColours.color_ffffff,
  278 + borderColor: MyColours.color_438E93,
  279 + textColor: MyColours.color_438E93,
  280 + height: ScreenUtil().setWidth(80),
  281 + radius: ScreenUtil().setWidth(14),
  282 + isBold: true,
  283 + fontSize: 28,
  284 + onPressed: () async {
  285 + _scan();
  286 + },
  287 + ),
  288 + )
  289 + : RoundButton(
  290 + text: '扫码核销',
  291 + width: w(100),
  292 + gradientStart: MyColours.color_ffffff,
  293 + gradientEnd: MyColours.color_ffffff,
  294 + borderColor: MyColours.color_438E93,
  295 + textColor: MyColours.color_438E93,
  296 + height: ScreenUtil().setWidth(80),
  297 + radius: ScreenUtil().setWidth(14),
  298 + isBold: true,
  299 + fontSize: 28,
  300 + onPressed: () async {
  301 + _scan();
  302 + },
  303 + ),
  304 + if (tabController.index != 3) HEmptyView(30),
  305 + if (tabController.index != 3)
  306 + Expanded(
  307 + child: RoundButton(
  308 + text: '创建新的优惠券',
  309 + height: ScreenUtil().setWidth(80),
  310 + radius: ScreenUtil().setWidth(14),
  311 + isBold: false,
  312 + fontSize: 28,
  313 + onPressed: () async {
  314 + // UserModel userModel =
  315 + // Provider.of<UserModel>(context, listen: false);
  316 + if (Utils.getAuthority(context, '创建新的优惠券')) {
  317 + NavigatorUtil.goCouponCreateSelectTypePage(context);
  318 + }
  319 + // if (userModel.user.role_name == '管理员' ||
  320 + // userModel.user.role_name == '店长') {
  321 + // NavigatorUtil.goCouponCreateSelectTypePage(context);
  322 + // }
  323 + else {
  324 + bool needRefresh =
  325 + await NavigatorUtil.goCouponEditPage(context);
  326 + print(needRefresh);
  327 + if (needRefresh != null && needRefresh) {
  328 + bus.emit('refresh_coupon_list_f');
  329 + //刷新页面数据
  330 + // _controller.callRefresh();
  331 + // _couponNetworkData(tabController.index);
  332 + }
  333 + }
  334 + },
  335 + ),
  336 + )
  337 + ],
  338 + ))
285 ], 339 ],
286 ), 340 ),
287 // child: Column( 341 // child: Column(
  1 +import 'dart:convert';
  2 +
  3 +import 'package:flutter/material.dart';
  4 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:one_key/widgets/system_app_bar.dart';
  6 +import 'package:provider/provider.dart';
  7 +
  8 +import '../../models/coupon_model.dart';
  9 +import '../../models/recharge_list_model.dart';
  10 +import '../../provider/coupon_provider.dart';
  11 +import '../../provider/marketing_center_provider.dart';
  12 +import '../../provider/user_model.dart';
  13 +import '../../res/colors.dart';
  14 +import '../../route/navigator_util.dart';
  15 +import '../../utils/event_bus.dart';
  16 +import '../../utils/screen_util.dart';
  17 +import '../../utils/utils.dart';
  18 +import '../../widgets/h_empty_view.dart';
  19 +import '../../widgets/round_button.dart';
  20 +import '../../widgets/v_empty_view.dart';
  21 +
  22 +/**
  23 + * 优惠券设置页面
  24 + * */
  25 +
  26 +class CouponSettingPage extends StatefulWidget {
  27 + CouponSettingPage({Key key}) : super(key: key);
  28 +
  29 + @override
  30 + _CouponSettingPageState createState() => _CouponSettingPageState();
  31 +}
  32 +
  33 +class _CouponSettingPageState extends State<CouponSettingPage> {
  34 + ScrollController controller = ScrollController();
  35 + CouponProvider couponProvider;
  36 + MarketingCenterProvider marketingCenterProvider;
  37 + bool isTranspond = false; //转发邀请函
  38 + bool isArrival = false; //确认到店
  39 + bool isOnlineBook = false; //在线预订
  40 + bool isOrder = false; //提前点餐
  41 + bool isLink = false; //充值优惠活动链接
  42 + bool isCoupon = false; // 代金券
  43 + bool isRecharge = false; //充值券
  44 + String welcome = '';
  45 + String qiniuUrl = '';
  46 +
  47 + RechargeListSunModel rechargeData;
  48 + String rechargeContent = '';
  49 +
  50 + List<CouponSunModel> couponDataList = [];
  51 + @override
  52 + void initState() {
  53 + super.initState();
  54 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  55 + _couponNetworkData();
  56 + getSellerTemplateConf();
  57 + });
  58 + }
  59 +
  60 + getSellerTemplateConf() async {
  61 + bool success = await marketingCenterProvider.getSellerTemplateConf(context);
  62 + if (success && marketingCenterProvider.markDataModel.marketing != null) {
  63 + isTranspond =
  64 + marketingCenterProvider.markDataModel.marketing.isTranspond == '1'
  65 + ? true
  66 + : false;
  67 +
  68 + isArrival =
  69 + marketingCenterProvider.markDataModel.marketing.isArrival == '1'
  70 + ? true
  71 + : false;
  72 + isOnlineBook =
  73 + marketingCenterProvider.markDataModel.marketing.isOnlineBook == '1'
  74 + ? true
  75 + : false;
  76 + isOrder = marketingCenterProvider.markDataModel.marketing.isOrder == '1'
  77 + ? true
  78 + : false;
  79 + isLink = marketingCenterProvider.markDataModel.marketing.isLink == '1'
  80 + ? true
  81 + : false;
  82 +
  83 + isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
  84 + ? true
  85 + : false;
  86 +
  87 + isRecharge =
  88 + marketingCenterProvider.markDataModel.marketing.isRecharge == '1'
  89 + ? true
  90 + : false;
  91 +
  92 + rechargeData =
  93 + marketingCenterProvider.markDataModel.marketing.rechargeData;
  94 + couponDataList =
  95 + marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
  96 +
  97 + qiniuUrl = marketingCenterProvider.markDataModel.marketing.logo ?? null;
  98 +
  99 + welcome = marketingCenterProvider.markDataModel.marketing.wecomle;
  100 +
  101 + setState(() {});
  102 + }
  103 + }
  104 +
  105 + ///优惠券设置
  106 +
  107 + _setCouponShow() async {
  108 + //接口
  109 + Map marketingData = {
  110 + // 'isTranspond': isTranspond ? '1' : '0', //转发同行客人
  111 + 'is_transpond': '1', //转发同行客人
  112 + 'is_arrival': isArrival ? '1' : '0', //确认到店
  113 + 'is_online_book': isOnlineBook ? '1' : '0', //在线预订
  114 + 'is_order': isOrder ? '1' : '0', //去点餐
  115 + 'is_coupon': isCoupon ? '1' : '0', //代金券暂时
  116 + 'is_recharge': isRecharge ? '1' : '0', //充值券暂时
  117 + 'is_link': isLink ? '1' : '0',
  118 + 'wecomle': welcome ?? '',
  119 + 'logo': qiniuUrl,
  120 + 'recharge_data': rechargeData,
  121 + 'coupon_data': json.encode(couponDataList)
  122 + };
  123 + Map<String, String> params = {
  124 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  125 + 'marketing': json.encode(marketingData)
  126 + };
  127 +
  128 + bool success = await marketingCenterProvider
  129 + .setSellerTemplateConf(context, params, showLoading: true);
  130 + if (success) {
  131 + bus.emit('refresh_coupon_list_f');
  132 + Utils.showToast('保存成功');
  133 + Navigator.pop(context);
  134 + }
  135 + }
  136 +
  137 + ///获取优惠券列表数据(status == 1)
  138 +
  139 + _couponNetworkData({bool isShowLoading = true}) async {
  140 + Map<String, String> params = {
  141 + "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  142 + };
  143 + params['status'] = '1';
  144 +
  145 + await couponProvider.getCustomerSelectActivityMarking(context, params,
  146 + isShowLoading: isShowLoading);
  147 + if (couponDataList == null || couponDataList.length == 0) {
  148 + if (couponProvider.couponListSelect != null &&
  149 + couponProvider.couponListSelect.length > 0) {
  150 + couponDataList.add(couponProvider.couponListSelect[0]);
  151 + }
  152 + }
  153 + setState(() {});
  154 + }
  155 +
  156 + ///标题
  157 + Widget _headItem(String title) {
  158 + return Container(
  159 + width: double.infinity,
  160 + alignment: Alignment.centerLeft,
  161 + decoration: BoxDecoration(
  162 + border: Border(
  163 + bottom:
  164 + BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
  165 + margin: EdgeInsets.only(left: w(16)),
  166 + padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(16)),
  167 + child: Text(
  168 + title,
  169 + style: TextStyle(
  170 + color: MyColours.color_515151, fontSize: ScreenUtil().setWidth(32)),
  171 + ),
  172 + );
  173 + }
  174 +
  175 + ///优惠券
  176 + Widget _markingCupon({
  177 + VoidCallback onPressed,
  178 + bool select = false,
  179 + VoidCallback onPressedSelect,
  180 + }) {
  181 + return Container(
  182 + margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)),
  183 + child: Column(
  184 + children: [
  185 + InkWell(
  186 + onTap: onPressedSelect,
  187 + child: Row(
  188 + children: [
  189 + Image.asset(
  190 + Utils.getImgPath(select ? 'f_select' : 'f_select_not'),
  191 + width: w(20),
  192 + ),
  193 + HEmptyView(20),
  194 + Text(
  195 + '推荐店内优惠券活动',
  196 + style: TextStyle(
  197 + fontSize: font(14), color: MyColours.color_515151),
  198 + ),
  199 + Spacer(),
  200 + RoundButton(
  201 + text: '选择活动',
  202 + width: w(72),
  203 + height: w(22),
  204 + gradientStart: MyColours.color_ffffff,
  205 + gradientEnd: MyColours.color_ffffff,
  206 + borderColor: MyColours.color_438E93,
  207 + textColor: MyColours.color_438E93,
  208 + radius: r(11),
  209 + fontSize: 24,
  210 + isBold: true,
  211 + onPressed: onPressed,
  212 + )
  213 + ],
  214 + )),
  215 + VEmptyView(20),
  216 + ListView.builder(
  217 + shrinkWrap: true,
  218 + controller: controller,
  219 + itemCount: couponDataList.length,
  220 + itemBuilder: (BuildContext context, int index) {
  221 + CouponSunModel couponData = couponDataList[index];
  222 + return _markingCuponItem(
  223 + couponData.aname,
  224 + _getCouponsDesc(couponData),
  225 + couponData.price ?? '',
  226 + couponData.use != null && couponData.use.isCash
  227 + ? '${(double.parse(couponData.price) / double.parse(couponData.use.cash)) * 10}折'
  228 + : '',
  229 + '切换活动',
  230 + select: isCoupon, onPressedSelect: () {
  231 + setState(() {
  232 + isCoupon = !isCoupon;
  233 + });
  234 + });
  235 + })
  236 + ],
  237 + ),
  238 + );
  239 + }
  240 +
  241 + String _getCouponsDesc(couponData) {
  242 + String couponsDesc = '';
  243 + if (couponData != null) {
  244 + if (couponData.expDate == null) {
  245 + couponsDesc = couponData.desc;
  246 + } else {
  247 + if (couponData.expDate.isNone) {
  248 + couponsDesc = '无限制,' + couponData.desc ?? '';
  249 + } else if (couponData.expDate.isBirthday) {
  250 + couponsDesc = '会员生日当天可用,' + couponData.desc ?? '';
  251 + } else if (couponData.expDate.isWeek) {
  252 + couponsDesc =
  253 + '${couponData.expDate.weekShow},' + couponData.desc ?? '';
  254 + }
  255 + }
  256 + }
  257 + return couponsDesc;
  258 + }
  259 +
  260 + ///优惠券
  261 + Widget _markingCuponItem(
  262 + String title,
  263 + String content,
  264 + String subtile,
  265 + String discount,
  266 + String btnTitle, {
  267 + VoidCallback onPressed,
  268 + bool select = false,
  269 + VoidCallback onPressedSelect,
  270 + }) {
  271 + return Container(
  272 + margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)),
  273 + child: Container(
  274 + padding: EdgeInsets.all(w(12)),
  275 + decoration: BoxDecoration(
  276 + borderRadius: BorderRadiusDirectional.circular(r(8)),
  277 + border: Border.all(width: w(1), color: MyColours.color_DBDBDB)),
  278 + child: Row(
  279 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  280 + children: [
  281 + Expanded(
  282 + child: Column(
  283 + crossAxisAlignment: CrossAxisAlignment.start,
  284 + children: [
  285 + Row(
  286 + children: [
  287 + Container(
  288 + constraints: BoxConstraints(maxWidth: w(150)),
  289 + child: Text(
  290 + title,
  291 + style: TextStyle(
  292 + fontSize: font(14),
  293 + fontWeight: FontWeight.bold,
  294 + color: MyColours.color_515151),
  295 + )),
  296 + HEmptyView(20),
  297 + subtile != ''
  298 + ? Text(
  299 + '¥${subtile}',
  300 + style: TextStyle(
  301 + fontSize: font(7),
  302 + fontWeight: FontWeight.bold,
  303 + color: MyColours.color_E34D59),
  304 + )
  305 + : SizedBox(),
  306 + HEmptyView(10),
  307 + discount != ''
  308 + ? Container(
  309 + padding: EdgeInsets.symmetric(
  310 + horizontal: w(3), vertical: w(2)),
  311 + decoration: BoxDecoration(
  312 + borderRadius: BorderRadius.circular(r(3)),
  313 + border: Border.all(
  314 + width: w(0.5),
  315 + color: MyColours.color_E34D59)),
  316 + child: Text(
  317 + discount,
  318 + style: TextStyle(
  319 + color: MyColours.color_E34D59,
  320 + fontSize: font(7)),
  321 + ),
  322 + )
  323 + : SizedBox(),
  324 + ],
  325 + ),
  326 + if (content != '') VEmptyView(20),
  327 + if (content != '')
  328 + Text(
  329 + content,
  330 + style: TextStyle(
  331 + height: 1.2,
  332 + fontSize: font(10),
  333 + fontWeight: FontWeight.bold,
  334 + color: MyColours.color_515151),
  335 + )
  336 + ],
  337 + )),
  338 + ],
  339 + ),
  340 + ),
  341 + );
  342 + }
  343 +
  344 + ///营销推广
  345 + Widget _markingItem(
  346 + String selectTitle,
  347 + String title, {
  348 + bool select = false,
  349 + VoidCallback onPressedSelect,
  350 + }) {
  351 + return Container(
  352 + margin: EdgeInsets.only(left: w(18), top: w(12), right: w(18)),
  353 + child: Column(
  354 + children: [
  355 + InkWell(
  356 + onTap: onPressedSelect,
  357 + child: Row(
  358 + children: [
  359 + Image.asset(
  360 + Utils.getImgPath(select ? 'f_select' : 'f_select_not'),
  361 + width: w(20),
  362 + ),
  363 + HEmptyView(20),
  364 + Text(
  365 + selectTitle,
  366 + style: TextStyle(
  367 + fontSize: font(14), color: MyColours.color_515151),
  368 + )
  369 + ],
  370 + )),
  371 + VEmptyView(20),
  372 + Container(
  373 + height: w(76),
  374 + padding: EdgeInsets.all(w(12)),
  375 + decoration: BoxDecoration(
  376 + borderRadius: BorderRadiusDirectional.circular(r(8)),
  377 + border:
  378 + Border.all(width: w(1), color: MyColours.color_DBDBDB)),
  379 + child: Text(
  380 + title,
  381 + maxLines: 2,
  382 + style: TextStyle(
  383 + fontSize: font(14),
  384 + // fontWeight: FontWeight.bold,
  385 + color: MyColours.color_515151),
  386 + ))
  387 + ],
  388 + ),
  389 + );
  390 + }
  391 +
  392 + @override
  393 + Widget build(BuildContext context) {
  394 + couponProvider = Provider.of<CouponProvider>(context, listen: false);
  395 +
  396 + marketingCenterProvider =
  397 + Provider.of<MarketingCenterProvider>(context, listen: false);
  398 + return Scaffold(
  399 + backgroundColor: MyColours.color_ffffff,
  400 + appBar: SystemAppBar('优惠券设置'),
  401 + body: Column(
  402 + children: [
  403 + Expanded(
  404 + child: SingleChildScrollView(
  405 + controller: controller,
  406 + child: Column(
  407 + children: [
  408 + _headItem('预订安排中附带的营销推广'),
  409 + VEmptyView(24),
  410 + couponProvider.couponListSelect != null &&
  411 + couponProvider.couponListSelect.length > 0
  412 + ? _markingCupon(
  413 + select: isCoupon,
  414 + onPressedSelect: () {
  415 + setState(() {
  416 + isCoupon = !isCoupon;
  417 + });
  418 + },
  419 + onPressed: () async {
  420 + //切换活动
  421 + Map temp =
  422 + await NavigatorUtil.goMarkingCouponSelectPage(
  423 + context, {'object': couponDataList});
  424 + if (temp['coupon'] != null) {
  425 + couponDataList = temp['coupon'];
  426 +
  427 + setState(() {});
  428 + }
  429 + })
  430 + : (couponProvider.couponListSelect == null ||
  431 + couponProvider.couponListSelect.length == 0)
  432 + ? _markingItem(
  433 + '推荐店内优惠券活动',
  434 + '当前没有可用优惠券,请创建优惠券后再来尝试。',
  435 + select: false,
  436 + )
  437 + : SizedBox(),
  438 + ],
  439 + ),
  440 + ),
  441 + ),
  442 + Container(
  443 + color: MyColours.color_ffffff,
  444 + padding: EdgeInsets.only(
  445 + left: w(45), right: w(45), top: w(12), bottom: w(25)),
  446 + child: RoundButton(
  447 + text: '保存',
  448 + gradientStart: MyColours.color_199095,
  449 + gradientEnd: MyColours.color_199095,
  450 + // borderColor: MyColours.color_999999,
  451 + radius: r(5),
  452 + fontSize: 34,
  453 + height: w(40),
  454 + isBold: true,
  455 + onPressed: () async {
  456 + _setCouponShow();
  457 + },
  458 + ),
  459 + )
  460 + ],
  461 + ));
  462 + }
  463 +}
@@ -14,6 +14,9 @@ import 'package:one_key/widgets/page_exception.dart'; @@ -14,6 +14,9 @@ import 'package:one_key/widgets/page_exception.dart';
14 import 'package:one_key/widgets/v_empty_view.dart'; 14 import 'package:one_key/widgets/v_empty_view.dart';
15 import 'package:provider/provider.dart'; 15 import 'package:provider/provider.dart';
16 16
  17 +import '../../models/coupon_model.dart';
  18 +import '../../provider/marketing_center_provider.dart';
  19 +
17 class CouponSunPage extends StatefulWidget { 20 class CouponSunPage extends StatefulWidget {
18 final int index; 21 final int index;
19 CouponSunPage({Key key, this.index}) : super(key: key); 22 CouponSunPage({Key key, this.index}) : super(key: key);
@@ -23,10 +26,12 @@ class CouponSunPage extends StatefulWidget { @@ -23,10 +26,12 @@ class CouponSunPage extends StatefulWidget {
23 } 26 }
24 27
25 class _CouponSunPageState extends State<CouponSunPage> { 28 class _CouponSunPageState extends State<CouponSunPage> {
  29 + MarketingCenterProvider marketingCenterProvider;
26 CouponProvider couponProvider; 30 CouponProvider couponProvider;
27 EasyRefreshController _controller = EasyRefreshController(); 31 EasyRefreshController _controller = EasyRefreshController();
28 PersonnelProvider personnelProvider; 32 PersonnelProvider personnelProvider;
29 List<PersonnelManageSunModel> authUserLists = []; 33 List<PersonnelManageSunModel> authUserLists = [];
  34 + List<CouponSunModel> couponDataList = [];
30 35
31 @override 36 @override
32 void initState() { 37 void initState() {
@@ -42,10 +47,12 @@ class _CouponSunPageState extends State<CouponSunPage> { @@ -42,10 +47,12 @@ class _CouponSunPageState extends State<CouponSunPage> {
42 couponProvider.pageStateMine = PageState.Loading; 47 couponProvider.pageStateMine = PageState.Loading;
43 } 48 }
44 couponProvider.notifyListeners(); 49 couponProvider.notifyListeners();
45 - _couponNetworkData(widget.index, isShowLoading: false); 50 + // _couponNetworkData(widget.index, isShowLoading: false);
  51 + _getCouponData();
46 52
47 bus.on("refresh_coupon_list_f", (arg) { 53 bus.on("refresh_coupon_list_f", (arg) {
48 - _couponNetworkData(widget.index); 54 + // _couponNetworkData(widget.index);
  55 + _getCouponData();
49 }); 56 });
50 }); 57 });
51 } 58 }
@@ -56,14 +63,67 @@ class _CouponSunPageState extends State<CouponSunPage> { @@ -56,14 +63,67 @@ class _CouponSunPageState extends State<CouponSunPage> {
56 } 63 }
57 64
58 ///获取优惠券列表数据 65 ///获取优惠券列表数据
59 - _couponNetworkData(int index, {bool isShowLoading = true}) async { 66 + Future<bool> _couponNetworkData(int index,
  67 + {bool isShowLoading = true}) async {
60 Map<String, String> params = { 68 Map<String, String> params = {
61 "uid": Provider.of<UserModel>(context, listen: false).user.openid, 69 "uid": Provider.of<UserModel>(context, listen: false).user.openid,
62 // 'is_time': '0' 70 // 'is_time': '0'
63 "is_type": index.toString() 71 "is_type": index.toString()
64 }; 72 };
65 - await couponProvider.getCustomerActivity(context, params, index, 73 + List<CouponSunModel> couponList = await couponProvider.getCustomerActivity(
  74 + context, params, index,
66 isShowLoading: isShowLoading); 75 isShowLoading: isShowLoading);
  76 + if (couponList != null && couponList.length > 0) {
  77 + return true;
  78 + } else {
  79 + return false;
  80 + }
  81 + // if (widget.index == 0 || widget.index == 1) {
  82 + // //营销中心设置的券是可核销的店铺券
  83 + // }
  84 + }
  85 +
  86 + _getCouponData() async {
  87 + Future.wait<bool>([
  88 + _couponNetworkData(widget.index, isShowLoading: false),
  89 + getSellerTemplateConf(context)
  90 + ]).then((results) async {
  91 + print(results[0]);
  92 + if (results[0] && results[1]) {
  93 + //成功
  94 +
  95 + couponProvider.couponList.forEach((element) {
  96 + couponDataList.forEach((marking) {
  97 + if (element.id == marking.id) {
  98 + element.isMarking = true;
  99 + }
  100 + });
  101 + });
  102 + print(couponProvider.couponList);
  103 + setState(() {});
  104 + } else {
  105 + // if (!results[0]) {
  106 + // //没有优惠券
  107 + // } else {}
  108 + // if (!results[1]) {
  109 + // //没有营销中心数据
  110 + // } else {}
  111 + setState(() {});
  112 + }
  113 + }).catchError((e) {
  114 + print(e);
  115 + });
  116 + }
  117 +
  118 + Future<bool> getSellerTemplateConf(BuildContext context) async {
  119 + bool success = await marketingCenterProvider.getSellerTemplateConf(context);
  120 + if (success && marketingCenterProvider.markDataModel.marketing != null) {
  121 + couponDataList =
  122 + marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
  123 + return true;
  124 + } else {
  125 + return false;
  126 + }
67 } 127 }
68 128
69 ///修改活动信息 129 ///修改活动信息
@@ -76,7 +136,7 @@ class _CouponSunPageState extends State<CouponSunPage> { @@ -76,7 +136,7 @@ class _CouponSunPageState extends State<CouponSunPage> {
76 bool isSuccess = await couponProvider.setCustomerActivity(context, params, 136 bool isSuccess = await couponProvider.setCustomerActivity(context, params,
77 isShowLoading: false); 137 isShowLoading: false);
78 print(isSuccess); 138 print(isSuccess);
79 - bus.emit('refresh_marketting_page'); 139 + // bus.emit('refresh_marketting_page');
80 _couponNetworkData(widget.index, isShowLoading: false); 140 _couponNetworkData(widget.index, isShowLoading: false);
81 // if (isSuccess) { 141 // if (isSuccess) {
82 // couponProvider.notifyListeners(); 142 // couponProvider.notifyListeners();
@@ -89,6 +149,8 @@ class _CouponSunPageState extends State<CouponSunPage> { @@ -89,6 +149,8 @@ class _CouponSunPageState extends State<CouponSunPage> {
89 149
90 @override 150 @override
91 Widget build(BuildContext context) { 151 Widget build(BuildContext context) {
  152 + marketingCenterProvider =
  153 + Provider.of<MarketingCenterProvider>(context, listen: true);
92 couponProvider = Provider.of<CouponProvider>(context, listen: true); 154 couponProvider = Provider.of<CouponProvider>(context, listen: true);
93 personnelProvider = Provider.of<PersonnelProvider>(context, listen: true); 155 personnelProvider = Provider.of<PersonnelProvider>(context, listen: true);
94 PageState pageState; 156 PageState pageState;
@@ -2710,6 +2710,80 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -2710,6 +2710,80 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
2710 // .length == 2710 // .length ==
2711 // 0 2711 // 0
2712 // ? 2712 // ?
  2713 + if (detailEntity
  2714 + .order.cookbooklist.length ==
  2715 + 0)
  2716 + Expanded(
  2717 + flex: 1,
  2718 + child: InkWell(
  2719 + onTap: () {
  2720 + if (Utils.getAuthority(
  2721 + context, '请客人点菜') ||
  2722 + widget.uid ==
  2723 + userModel
  2724 + .user.openid) {
  2725 + Utils.goShareOrderPageToWeChat(
  2726 + context,
  2727 + title:
  2728 + '${Provider.of<UserModel>(context, listen: false).user.nickName ?? Provider.of<UserModel>(context, listen: false).user.sellername}经理邀请您点餐了',
  2729 + img:
  2730 + 'http://nosqn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148571.jpg',
  2731 + rid: widget.rid,
  2732 + // oid: oid,
  2733 + sid: Provider.of<
  2734 + UserModel>(
  2735 + context,
  2736 + listen: false)
  2737 + .user
  2738 + .sellerid);
  2739 + }
  2740 + },
  2741 + child: Container(
  2742 + margin: EdgeInsets.only(
  2743 + right: ScreenUtil()
  2744 + .setWidth(20)),
  2745 + decoration: BoxDecoration(
  2746 + color: MyColours
  2747 + .color_ffffff,
  2748 + border: Border.all(
  2749 + width: w(1),
  2750 + color: !(Utils.getAuthority(
  2751 + context,
  2752 + '请客人点菜') ||
  2753 + widget.uid ==
  2754 + userModel
  2755 + .user
  2756 + .openid)
  2757 + ? MyColours
  2758 + .color_999999
  2759 + : MyColours
  2760 + .color_438E93),
  2761 + borderRadius: BorderRadius
  2762 + .circular(ScreenUtil()
  2763 + .setWidth(10)),
  2764 + ),
  2765 + child: Align(
  2766 + alignment:
  2767 + Alignment.center,
  2768 + child: Text('请客人点菜',
  2769 + style: TextStyle(
  2770 + color: !(Utils.getAuthority(context,
  2771 + '请客人点菜') ||
  2772 + widget.uid ==
  2773 + userModel
  2774 + .user
  2775 + .openid)
  2776 + ? MyColours
  2777 + .color_999999
  2778 + : MyColours
  2779 + .color_438E93,
  2780 + fontSize:
  2781 + ScreenUtil()
  2782 + .setSp(
  2783 + 34))),
  2784 + ),
  2785 + ),
  2786 + )),
2713 Expanded( 2787 Expanded(
2714 flex: 1, 2788 flex: 1,
2715 child: InkWell( 2789 child: InkWell(
@@ -2754,7 +2828,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -2754,7 +2828,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
2754 ), 2828 ),
2755 child: Align( 2829 child: Align(
2756 alignment: Alignment.center, 2830 alignment: Alignment.center,
2757 - child: Text('预点菜', 2831 + child: Text('经理预排菜',
2758 style: TextStyle( 2832 style: TextStyle(
2759 color: !(Utils.getAuthority( 2833 color: !(Utils.getAuthority(
2760 context, 2834 context,
@@ -2776,7 +2850,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -2776,7 +2850,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
2776 )), 2850 )),
2777 // : SizedBox(), 2851 // : SizedBox(),
2778 Expanded( 2852 Expanded(
2779 - flex: 2, 2853 + flex: 1,
2780 child: InkWell( 2854 child: InkWell(
2781 onTap: () { 2855 onTap: () {
2782 // String _nameStr = ''; 2856 // String _nameStr = '';
@@ -611,7 +611,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -611,7 +611,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
611 //初始化信鸽推送 611 //初始化信鸽推送
612 initPlatformState() { 612 initPlatformState() {
613 /// 开启DEBUG 613 /// 开启DEBUG
614 - XgFlutterPlugin().setEnableDebug(true); 614 + XgFlutterPlugin().setEnableDebug(false);
615 615
616 /// 添加回调事件 616 /// 添加回调事件
617 XgFlutterPlugin().addEventHandler( 617 XgFlutterPlugin().addEventHandler(
@@ -65,12 +65,12 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { @@ -65,12 +65,12 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
65 void initState() { 65 void initState() {
66 super.initState(); 66 super.initState();
67 WidgetsBinding.instance.addPostFrameCallback((_) async { 67 WidgetsBinding.instance.addPostFrameCallback((_) async {
68 - _couponNetworkData(); 68 + // _couponNetworkData();
69 _getNewRechargeList(); 69 _getNewRechargeList();
70 getSellerTemplateConf(); 70 getSellerTemplateConf();
71 - bus.on('refresh_marketting_page', (arg) {  
72 - _couponNetworkData();  
73 - }); 71 + // bus.on('refresh_marketting_page', (arg) {
  72 + // _couponNetworkData();
  73 + // });
74 bus.on('refresh_marketting_page_recharge', (arg) { 74 bus.on('refresh_marketting_page_recharge', (arg) {
75 _getNewRechargeList(); 75 _getNewRechargeList();
76 }); 76 });
@@ -80,7 +80,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { @@ -80,7 +80,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
80 @override 80 @override
81 void dispose() { 81 void dispose() {
82 _uploadImageProvider.firstImage = UploadImgModel(); 82 _uploadImageProvider.firstImage = UploadImgModel();
83 - bus.off('refresh_marketting_page'); 83 + // bus.off('refresh_marketting_page');
84 bus.off('refresh_marketting_page_recharge'); 84 bus.off('refresh_marketting_page_recharge');
85 85
86 super.dispose(); 86 super.dispose();
@@ -178,25 +178,25 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { @@ -178,25 +178,25 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
178 } 178 }
179 } 179 }
180 180
181 - ///获取优惠券列表数据(status == 1) 181 + // ///获取优惠券列表数据(status == 1)
182 182
183 - _couponNetworkData({bool isShowLoading = true}) async {  
184 - Map<String, String> params = {  
185 - "uid": Provider.of<UserModel>(context, listen: false).user.openid,  
186 - };  
187 - params['status'] = '1'; 183 + // _couponNetworkData({bool isShowLoading = true}) async {
  184 + // Map<String, String> params = {
  185 + // "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  186 + // };
  187 + // params['status'] = '1';
188 188
189 - await couponProvider.getCustomerSelectActivityMarking(context, params,  
190 - isShowLoading: isShowLoading);  
191 - if (couponDataList == null || couponDataList.length == 0) {  
192 - if (couponProvider.couponListSelect != null &&  
193 - couponProvider.couponListSelect.length > 0) {  
194 - couponDataList.add(couponProvider.couponListSelect[0]); 189 + // await couponProvider.getCustomerSelectActivityMarking(context, params,
  190 + // isShowLoading: isShowLoading);
  191 + // if (couponDataList == null || couponDataList.length == 0) {
  192 + // if (couponProvider.couponListSelect != null &&
  193 + // couponProvider.couponListSelect.length > 0) {
  194 + // couponDataList.add(couponProvider.couponListSelect[0]);
195 195
196 - setState(() {});  
197 - }  
198 - }  
199 - } 196 + // setState(() {});
  197 + // }
  198 + // }
  199 + // }
200 200
201 ///客户互动及店铺推广 201 ///客户互动及店铺推广
202 Widget _storeItemWidget(String title, String content, 202 Widget _storeItemWidget(String title, String content,
@@ -406,155 +406,155 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { @@ -406,155 +406,155 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
406 ); 406 );
407 } 407 }
408 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 - } 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 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 - } 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 558
559 ///营销推广 559 ///营销推广
560 Widget _markingItem( 560 Widget _markingItem(
@@ -682,27 +682,27 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { @@ -682,27 +682,27 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
682 color: MyColours.color_ffffff, 682 color: MyColours.color_ffffff,
683 margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)), 683 margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)),
684 child: Column(children: [ 684 child: Column(children: [
685 - InkWell(  
686 - onTap: () {  
687 - setState(() {  
688 - isLink = !isLink;  
689 - });  
690 - },  
691 - child: Row(  
692 - children: [  
693 - Image.asset(  
694 - Utils.getImgPath(isLink ? 'f_select' : 'f_select_not'),  
695 - width: w(20),  
696 - ),  
697 - HEmptyView(20),  
698 - Text(  
699 - '推荐店内充值优惠活动链接',  
700 - style: TextStyle(  
701 - fontSize: font(14), color: MyColours.color_515151),  
702 - )  
703 - ],  
704 - )),  
705 - VEmptyView(24), 685 + // InkWell(
  686 + // onTap: () {
  687 + // setState(() {
  688 + // isLink = !isLink;
  689 + // });
  690 + // },
  691 + // child: Row(
  692 + // children: [
  693 + // Image.asset(
  694 + // Utils.getImgPath(isLink ? 'f_select' : 'f_select_not'),
  695 + // width: w(20),
  696 + // ),
  697 + // HEmptyView(20),
  698 + // Text(
  699 + // '推荐店内充值优惠活动链接',
  700 + // style: TextStyle(
  701 + // fontSize: font(14), color: MyColours.color_515151),
  702 + // )
  703 + // ],
  704 + // )),
  705 + // VEmptyView(24),
706 Container( 706 Container(
707 height: w(180), 707 height: w(180),
708 child: _uploadImageProvider.firstImage.file != null || 708 child: _uploadImageProvider.firstImage.file != null ||
@@ -888,37 +888,37 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { @@ -888,37 +888,37 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
888 }), 888 }),
889 ), 889 ),
890 VEmptyView(40), 890 VEmptyView(40),
891 - Container(  
892 - width: w(188),  
893 - height: w(22),  
894 - alignment: Alignment.center,  
895 - decoration: BoxDecoration(  
896 - borderRadius: BorderRadius.circular(r(11)),  
897 - gradient: LinearGradient(stops: [  
898 - -0.57,  
899 - 0.55,  
900 - 1.48  
901 - ], colors: [  
902 - MyColours.color_4C8DAD,  
903 - MyColours.color_0143A3,  
904 - MyColours.color_42A5FF  
905 - ], begin: Alignment.centerLeft, end: Alignment.centerRight)),  
906 - child: RoundButton(  
907 - width: w(186),  
908 - height: w(20),  
909 - text: '点击了解更多会员优惠政策',  
910 - gradientStart: MyColours.color_ffffff,  
911 - gradientEnd: MyColours.color_ffffff,  
912 - borderColor: Colors.transparent,  
913 - // borderColor: MyColours.color_999999,  
914 - textColor: MyColours.color_999999,  
915 - radius: r(11),  
916 - fontSize: 24, 891 + // Container(
  892 + // width: w(188),
  893 + // height: w(22),
  894 + // alignment: Alignment.center,
  895 + // decoration: BoxDecoration(
  896 + // borderRadius: BorderRadius.circular(r(11)),
  897 + // gradient: LinearGradient(stops: [
  898 + // -0.57,
  899 + // 0.55,
  900 + // 1.48
  901 + // ], colors: [
  902 + // MyColours.color_4C8DAD,
  903 + // MyColours.color_0143A3,
  904 + // MyColours.color_42A5FF
  905 + // ], begin: Alignment.centerLeft, end: Alignment.centerRight)),
  906 + // child: RoundButton(
  907 + // width: w(186),
  908 + // height: w(20),
  909 + // text: '点击了解更多会员优惠政策',
  910 + // gradientStart: MyColours.color_ffffff,
  911 + // gradientEnd: MyColours.color_ffffff,
  912 + // borderColor: Colors.transparent,
  913 + // // borderColor: MyColours.color_999999,
  914 + // textColor: MyColours.color_999999,
  915 + // radius: r(11),
  916 + // fontSize: 24,
917 917
918 - isBold: true,  
919 - onPressed: () {},  
920 - )),  
921 - VEmptyView(18), 918 + // isBold: true,
  919 + // onPressed: () {},
  920 + // )),
  921 + // VEmptyView(18),
922 // Container( 922 // Container(
923 // height: w(28), 923 // height: w(28),
924 // alignment: Alignment.center, 924 // alignment: Alignment.center,
@@ -932,24 +932,24 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { @@ -932,24 +932,24 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
932 ])); 932 ]));
933 } 933 }
934 934
935 - String _getCouponsDesc(couponData) {  
936 - String couponsDesc = '';  
937 - if (couponData != null) {  
938 - if (couponData.expDate == null) {  
939 - couponsDesc = couponData.desc;  
940 - } else {  
941 - if (couponData.expDate.isNone) {  
942 - couponsDesc = '无限制,' + couponData.desc ?? '';  
943 - } else if (couponData.expDate.isBirthday) {  
944 - couponsDesc = '会员生日当天可用,' + couponData.desc ?? '';  
945 - } else if (couponData.expDate.isWeek) {  
946 - couponsDesc =  
947 - '${couponData.expDate.weekShow},' + couponData.desc ?? '';  
948 - }  
949 - }  
950 - }  
951 - return couponsDesc;  
952 - } 935 + // String _getCouponsDesc(couponData) {
  936 + // String couponsDesc = '';
  937 + // if (couponData != null) {
  938 + // if (couponData.expDate == null) {
  939 + // couponsDesc = couponData.desc;
  940 + // } else {
  941 + // if (couponData.expDate.isNone) {
  942 + // couponsDesc = '无限制,' + couponData.desc ?? '';
  943 + // } else if (couponData.expDate.isBirthday) {
  944 + // couponsDesc = '会员生日当天可用,' + couponData.desc ?? '';
  945 + // } else if (couponData.expDate.isWeek) {
  946 + // couponsDesc =
  947 + // '${couponData.expDate.weekShow},' + couponData.desc ?? '';
  948 + // }
  949 + // }
  950 + // }
  951 + // return couponsDesc;
  952 + // }
953 953
954 @override 954 @override
955 Widget build(BuildContext context) { 955 Widget build(BuildContext context) {
@@ -962,7 +962,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { @@ -962,7 +962,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
962 return Scaffold( 962 return Scaffold(
963 backgroundColor: MyColours.color_ffffff, 963 backgroundColor: MyColours.color_ffffff,
964 appBar: SystemAppBar( 964 appBar: SystemAppBar(
965 - '营销及客户互动', 965 + '客户互动',
966 onTap: () { 966 onTap: () {
967 Navigator.pop(context); 967 Navigator.pop(context);
968 }, 968 },
@@ -996,85 +996,85 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { @@ -996,85 +996,85 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
996 isOnlineBook = !isOnlineBook; 996 isOnlineBook = !isOnlineBook;
997 }); 997 });
998 }, select: isOnlineBook), 998 }, select: isOnlineBook),
999 - _storeItemWidget('向被邀请客人开放“提前点餐”功能。',  
1000 - '请客人从预定安排直接预先选菜,到店后确认下单,无需服务员花费时间给客户点餐,可以为餐厅节源提效。',  
1001 - onTap: () {  
1002 - setState(() {  
1003 - isOrder = !isOrder;  
1004 - });  
1005 - }, select: isOrder),  
1006 - VEmptyView(24),  
1007 - _headItem('预订安排中附带的营销推广'), 999 + // _storeItemWidget('向客人开放“提前点餐”功能。',
  1000 + // '请客人从预订安排直接预先选菜,到店后确认下单,无需服务员花费时间给客户点餐,可以为餐厅节源提效。',
  1001 + // onTap: () {
  1002 + // setState(() {
  1003 + // isOrder = !isOrder;
  1004 + // });
  1005 + // }, select: isOrder),
  1006 + // VEmptyView(24),
  1007 + _headItem('预订安排底部附带的餐厅logo及欢迎语'),
1008 VEmptyView(24), 1008 VEmptyView(24),
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']; 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'];
1025 1025
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(),  
1045 - rechargeData != null  
1046 - ? _markingItem('推荐店内充值单一优惠活动', rechargeData.rname,  
1047 - rechargeContent, '', '', '切换活动', select: isRecharge,  
1048 - onPressedSelect: () {  
1049 - setState(() {  
1050 - isRecharge = !isRecharge;  
1051 - });  
1052 - }, onPressed: () async {  
1053 - //切换活动  
1054 - Map temp =  
1055 - await NavigatorUtil.goMarkingRechargeSelectPage(  
1056 - context, rechargeData.id);  
1057 - if (temp != null && temp['recharge'] != null) {  
1058 - rechargeData = temp['recharge'];  
1059 - _getRechargeContent();  
1060 - setState(() {});  
1061 - }  
1062 - })  
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(), 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(),
  1045 + // rechargeData != null
  1046 + // ? _markingItem('推荐店内充值单一优惠活动', rechargeData.rname,
  1047 + // rechargeContent, '', '', '切换活动', select: isRecharge,
  1048 + // onPressedSelect: () {
  1049 + // setState(() {
  1050 + // isRecharge = !isRecharge;
  1051 + // });
  1052 + // }, onPressed: () async {
  1053 + // //切换活动
  1054 + // Map temp =
  1055 + // await NavigatorUtil.goMarkingRechargeSelectPage(
  1056 + // context, rechargeData.id);
  1057 + // if (temp != null && temp['recharge'] != null) {
  1058 + // rechargeData = temp['recharge'];
  1059 + // _getRechargeContent();
  1060 + // setState(() {});
  1061 + // }
  1062 + // })
  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(),
1078 _markingOtherItem() 1078 _markingOtherItem()
1079 ], 1079 ],
1080 ), 1080 ),
@@ -472,7 +472,7 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { @@ -472,7 +472,7 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> {
472 VEmptyView(10), 472 VEmptyView(10),
473 Padding( 473 Padding(
474 padding: EdgeInsets.only(left: w(8)), 474 padding: EdgeInsets.only(left: w(8)),
475 - child: Text('${reserveModel.address??''}', 475 + child: Text('${reserveModel.address ?? ''}',
476 style: TextStyle( 476 style: TextStyle(
477 height: 1.3, 477 height: 1.3,
478 color: MyColours.color_000000, 478 color: MyColours.color_000000,
@@ -1379,16 +1379,18 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { @@ -1379,16 +1379,18 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> {
1379 Widget _logoWidget() { 1379 Widget _logoWidget() {
1380 return Column( 1380 return Column(
1381 children: [ 1381 children: [
1382 - Container(  
1383 - height: w(180),  
1384 - child: CachedNetworkImage(  
1385 - imageUrl: _marketingCenterProvider.markDataModel.marketing.logo,  
1386 - fit: BoxFit.cover,  
1387 - width: double.infinity,  
1388 - // width: ScreenUtil()  
1389 - // .setWidth(imgSize * 2), 1382 + if (_marketingCenterProvider.markDataModel.marketing.logo != '' &&
  1383 + _marketingCenterProvider.markDataModel.marketing.logo != null)
  1384 + Container(
1390 height: w(180), 1385 height: w(180),
1391 - )), 1386 + child: CachedNetworkImage(
  1387 + imageUrl: _marketingCenterProvider.markDataModel.marketing.logo,
  1388 + fit: BoxFit.cover,
  1389 + width: double.infinity,
  1390 + // width: ScreenUtil()
  1391 + // .setWidth(imgSize * 2),
  1392 + height: w(180),
  1393 + )),
1392 if (_marketingCenterProvider.markDataModel.marketing.wecomle != null && 1394 if (_marketingCenterProvider.markDataModel.marketing.wecomle != null &&
1393 _marketingCenterProvider.markDataModel.marketing.wecomle != '') 1395 _marketingCenterProvider.markDataModel.marketing.wecomle != '')
1394 VEmptyView(40), 1396 VEmptyView(40),
@@ -264,7 +264,7 @@ class _CustomerNoticeSettingPageState extends State<CustomerNoticeSettingPage> { @@ -264,7 +264,7 @@ class _CustomerNoticeSettingPageState extends State<CustomerNoticeSettingPage> {
264 _item('招牌菜展示', onTap: () { 264 _item('招牌菜展示', onTap: () {
265 NavigatorUtil.goDishShowPage(context); 265 NavigatorUtil.goDishShowPage(context);
266 }), 266 }),
267 - _item('营销及客户互动功能', onTap: () { 267 + _item('客户互动', onTap: () {
268 NavigatorUtil.goMarkingInteractionPage(context); 268 NavigatorUtil.goMarkingInteractionPage(context);
269 }), 269 }),
270 ], 270 ],
@@ -234,6 +234,41 @@ class _MarketingCenterHomePageState extends State<MarketingCenterHomePage> { @@ -234,6 +234,41 @@ class _MarketingCenterHomePageState extends State<MarketingCenterHomePage> {
234 VEmptyView(24), 234 VEmptyView(24),
235 InkWell( 235 InkWell(
236 onTap: () { 236 onTap: () {
  237 + NavigatorUtil.goOrderSettingManagerPage(context);
  238 + },
  239 + child: Padding(
  240 + padding: EdgeInsets.only(
  241 + left: w(16),
  242 + top: w(12),
  243 + bottom: w(12),
  244 + right: w(12)),
  245 + child: Row(
  246 + children: [
  247 + Text(
  248 + '经理预排菜设置',
  249 + style: TextStyle(
  250 + color: MyColours.color_515151,
  251 + fontSize: ScreenUtil().setWidth(32)),
  252 + ),
  253 + Spacer(),
  254 + Container(
  255 + padding: EdgeInsets.symmetric(
  256 + horizontal: w(7), vertical: w(4)),
  257 + child: Image.asset(
  258 + "assets/arrow_right_new.png",
  259 + width: ScreenUtil().setWidth(18),
  260 + height: ScreenUtil().setWidth(32),
  261 + ),
  262 + )
  263 + ],
  264 + ))),
  265 + Padding(
  266 + padding: EdgeInsets.only(left: w(16)),
  267 + child: MyDivider(double.infinity, w(0.5),
  268 + color: MyColours.color_E7E7E7)),
  269 + VEmptyView(24),
  270 + InkWell(
  271 + onTap: () {
237 NavigatorUtil.goCustomerNoticeSettingPage(context); 272 NavigatorUtil.goCustomerNoticeSettingPage(context);
238 }, 273 },
239 child: Padding( 274 child: Padding(
  1 +import 'package:flutter/material.dart';
  2 +import 'package:one_key/widgets/system_app_bar.dart';
  3 +import 'package:provider/provider.dart';
  4 +
  5 +import '../../../provider/marketing_center_provider.dart';
  6 +import '../../../provider/user_model.dart';
  7 +import '../../../res/colors.dart';
  8 +import '../../../utils/screen_util.dart';
  9 +import '../../../utils/utils.dart';
  10 +import '../../../widgets/MyDivider.dart';
  11 +import '../../../widgets/round_button.dart';
  12 +import '../../../widgets/v_empty_view.dart';
  13 +
  14 +/**
  15 + * 经理排菜配置页面
  16 + */
  17 +class OrderSettingManagerPage extends StatefulWidget {
  18 + OrderSettingManagerPage({Key key}) : super(key: key);
  19 +
  20 + @override
  21 + _OrderSettingManagerPageState createState() =>
  22 + _OrderSettingManagerPageState();
  23 +}
  24 +
  25 +class _OrderSettingManagerPageState extends State<OrderSettingManagerPage> {
  26 + MarketingCenterProvider marketingCenterProvider;
  27 + bool selectShowPrice = true; //分享排菜单给客户时展示菜品价格
  28 +
  29 + @override
  30 + void initState() {
  31 + super.initState();
  32 +
  33 + WidgetsBinding.instance.addPostFrameCallback((_) {
  34 + getDzSellerConf();
  35 + });
  36 + }
  37 +
  38 + getDzSellerConf() async {
  39 + bool success = await marketingCenterProvider.getDzSellerConf(context);
  40 + if (success && marketingCenterProvider.dzSellerConfModel != null) {
  41 + selectShowPrice =
  42 + marketingCenterProvider.dzSellerConfModel.isShowPrice == '1'
  43 + ? true
  44 + : false;
  45 + setState(() {});
  46 + }
  47 + }
  48 +
  49 + ///分享排菜单给客户时展示菜品价格
  50 +
  51 + _setPriceShow() async {
  52 + Map<String, String> params = {
  53 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  54 + 'key': 'is_show_price',
  55 + 'value': selectShowPrice ? '1' : '0'
  56 + };
  57 +
  58 + bool success = await marketingCenterProvider.setConfing(context, params,
  59 + needToast: true);
  60 +
  61 + if (success) {
  62 + Navigator.pop(context);
  63 + // Utils.showToast('设置成功');
  64 + // return true;
  65 + // } else {
  66 + // Utils.showToast('设置失败,请重试');
  67 + // return false;
  68 + }
  69 + }
  70 +
  71 + @override
  72 + Widget build(BuildContext context) {
  73 + marketingCenterProvider =
  74 + Provider.of<MarketingCenterProvider>(context, listen: true);
  75 + return Scaffold(
  76 + backgroundColor: MyColours.color_ffffff,
  77 + appBar: SystemAppBar('经理预排菜'),
  78 + body: Column(
  79 + children: [
  80 + Expanded(
  81 + child: SingleChildScrollView(
  82 + child: Column(
  83 + children: [
  84 + InkWell(
  85 + onTap: () {
  86 + setState(() {
  87 + selectShowPrice = !selectShowPrice;
  88 + });
  89 + },
  90 + child: Padding(
  91 + padding: EdgeInsets.only(
  92 + left: w(16),
  93 + top: w(12),
  94 + bottom: w(12),
  95 + right: w(12)),
  96 + child: Row(
  97 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  98 + children: [
  99 + Text(
  100 + '分享排菜单给客户时展示菜品价格',
  101 + style: TextStyle(
  102 + color: MyColours.color_515151,
  103 + fontSize: font(16)),
  104 + ),
  105 + Spacer(),
  106 + Container(
  107 + padding: EdgeInsets.symmetric(
  108 + horizontal: w(7), vertical: w(4)),
  109 + child: Image.asset(
  110 + Utils.getImgPath(selectShowPrice
  111 + ? 'swich_on'
  112 + : 'swich_off'),
  113 + width: w(44),
  114 + ),
  115 + )
  116 + // RoundButton(
  117 + // text: '预览',
  118 + // gradientStart: MyColours.color_ffffff,
  119 + // gradientEnd: MyColours.color_ffffff,
  120 + // borderColor: MyColours.color_438E93,
  121 + // textColor: MyColours.color_438E93,
  122 + // radius: ScreenUtil().setWidth(22),
  123 + // fontSize: 24,
  124 + // width: w(72),
  125 + // height: ScreenUtil().setWidth(44),
  126 + // isBold: true,
  127 + // onPressed: () {
  128 + // NavigatorUtil.goMarkingPreviewPage(context);
  129 + // },
  130 + // ),
  131 + ]))),
  132 + Padding(
  133 + padding: EdgeInsets.only(left: w(16)),
  134 + child: MyDivider(double.infinity, w(0.5),
  135 + color: MyColours.color_E7E7E7)),
  136 + VEmptyView(20),
  137 + ],
  138 + ),
  139 + )),
  140 + RoundButton(
  141 + text: '保存',
  142 + gradientStart: MyColours.color_199095,
  143 + gradientEnd: MyColours.color_199095,
  144 + margin:
  145 + EdgeInsets.symmetric(horizontal: w(40), vertical: w(25)),
  146 + // borderColor: MyColours.color_999999,
  147 + radius: r(5),
  148 + fontSize: 32,
  149 + height: w(40),
  150 + isBold: true,
  151 + onPressed: () async {
  152 + //调用接口
  153 + _setPriceShow();
  154 + })
  155 + ],
  156 + ));
  157 + }
  158 +}
  1 +import 'dart:convert';
  2 +
1 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
2 import 'package:one_key/widgets/system_app_bar.dart'; 4 import 'package:one_key/widgets/system_app_bar.dart';
3 import 'package:provider/provider.dart'; 5 import 'package:provider/provider.dart';
4 6
  7 +import '../../../models/coupon_model.dart';
  8 +import '../../../models/recharge_list_model.dart';
5 import '../../../provider/marketing_center_provider.dart'; 9 import '../../../provider/marketing_center_provider.dart';
6 import '../../../provider/user_model.dart'; 10 import '../../../provider/user_model.dart';
7 import '../../../res/colors.dart'; 11 import '../../../res/colors.dart';
@@ -23,46 +27,107 @@ class OrderSettingPage extends StatefulWidget { @@ -23,46 +27,107 @@ class OrderSettingPage extends StatefulWidget {
23 27
24 class _OrderSettingPageState extends State<OrderSettingPage> { 28 class _OrderSettingPageState extends State<OrderSettingPage> {
25 MarketingCenterProvider marketingCenterProvider; 29 MarketingCenterProvider marketingCenterProvider;
26 - bool selectShowPrice = true; //分享排菜单给客户时展示菜品价格 30 +
  31 +
  32 + bool isTranspond = false; //转发邀请函
  33 + bool isArrival = false; //确认到店
  34 + bool isOnlineBook = false; //在线预订
  35 + bool isOrder = true; //提前点餐
  36 + bool isLink = false; //充值优惠活动链接
  37 + bool isCoupon = false; // 代金券
  38 + bool isRecharge = false; //充值券
  39 +
  40 + RechargeListSunModel rechargeData;
  41 + String rechargeContent = '';
  42 + String qiniuUrl = '';
  43 +
  44 + String welcome = '';
  45 +
  46 + List<CouponSunModel> couponDataList = [];
27 47
28 @override 48 @override
29 void initState() { 49 void initState() {
30 super.initState(); 50 super.initState();
31 51
32 WidgetsBinding.instance.addPostFrameCallback((_) { 52 WidgetsBinding.instance.addPostFrameCallback((_) {
33 - getDzSellerConf(); 53 + getSellerTemplateConf();
34 }); 54 });
35 } 55 }
36 56
37 - getDzSellerConf() async {  
38 - bool success = await marketingCenterProvider.getDzSellerConf(context);  
39 - if (success && marketingCenterProvider.dzSellerConfModel != null) {  
40 - selectShowPrice =  
41 - marketingCenterProvider.dzSellerConfModel.isShowPrice == '1' 57 + getSellerTemplateConf() async {
  58 + bool success = await marketingCenterProvider.getSellerTemplateConf(context);
  59 + if (success && marketingCenterProvider.markDataModel.marketing != null) {
  60 + isTranspond =
  61 + marketingCenterProvider.markDataModel.marketing.isTranspond == '1'
42 ? true 62 ? true
43 : false; 63 : false;
  64 +
  65 + isArrival =
  66 + marketingCenterProvider.markDataModel.marketing.isArrival == '1'
  67 + ? true
  68 + : false;
  69 + isOnlineBook =
  70 + marketingCenterProvider.markDataModel.marketing.isOnlineBook == '1'
  71 + ? true
  72 + : false;
  73 + isOrder = marketingCenterProvider.markDataModel.marketing.isOrder == '1'
  74 + ? true
  75 + : false;
  76 + isLink = marketingCenterProvider.markDataModel.marketing.isLink == '1'
  77 + ? true
  78 + : false;
  79 +
  80 + isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
  81 + ? true
  82 + : false;
  83 +
  84 + isRecharge =
  85 + marketingCenterProvider.markDataModel.marketing.isRecharge == '1'
  86 + ? true
  87 + : false;
  88 +
  89 + rechargeData =
  90 + marketingCenterProvider.markDataModel.marketing.rechargeData;
  91 + couponDataList =
  92 + marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
  93 +
  94 + qiniuUrl = marketingCenterProvider.markDataModel.marketing.logo ?? null;
  95 +
  96 + welcome = marketingCenterProvider.markDataModel.marketing.wecomle;
  97 +
44 setState(() {}); 98 setState(() {});
45 } 99 }
46 } 100 }
47 101
48 - ///分享排菜单给客户时展示菜品价格 102 + ///向客人开放提前点餐功能
49 103
50 - _setPriceShow() async { 104 + _setOrderBtnShow() async {
  105 + //接口
  106 + Map marketingData = {
  107 + // 'isTranspond': isTranspond ? '1' : '0', //转发同行客人
  108 + 'is_transpond': '1', //转发同行客人
  109 + 'is_arrival': isArrival ? '1' : '0', //确认到店
  110 + 'is_online_book': isOnlineBook ? '1' : '0', //在线预订
  111 + 'is_order': isOrder ? '1' : '0', //去点餐
  112 + 'is_coupon': isCoupon ? '1' : '0', //代金券暂时
  113 + 'is_recharge': isRecharge ? '1' : '0', //充值券暂时
  114 + 'is_link': isLink ? '1' : '0',
  115 + 'wecomle': welcome ?? '',
  116 + 'logo': qiniuUrl,
  117 + 'recharge_data': rechargeData,
  118 + 'coupon_data': json.encode(couponDataList)
  119 + };
51 Map<String, String> params = { 120 Map<String, String> params = {
52 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid, 121 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
53 - 'key': 'is_show_price',  
54 - 'value': selectShowPrice ? '1' : '0' 122 + 'marketing': json.encode(marketingData)
55 }; 123 };
56 124
57 - await marketingCenterProvider.setConfing(context, params, needToast: true);  
58 -  
59 - // if (success) {  
60 - // Utils.showToast('设置成功');  
61 - // return true;  
62 - // } else {  
63 - // Utils.showToast('设置失败,请重试');  
64 - // return false;  
65 - // } 125 + bool success = await marketingCenterProvider
  126 + .setSellerTemplateConf(context, params, showLoading: true);
  127 + if (success) {
  128 + Utils.showToast('保存成功');
  129 + Navigator.pop(context);
  130 + }
66 } 131 }
67 132
68 @override 133 @override
@@ -81,7 +146,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> { @@ -81,7 +146,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
81 InkWell( 146 InkWell(
82 onTap: () { 147 onTap: () {
83 setState(() { 148 setState(() {
84 - selectShowPrice = !selectShowPrice; 149 + isOrder = !isOrder;
85 }); 150 });
86 }, 151 },
87 child: Padding( 152 child: Padding(
@@ -94,7 +159,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> { @@ -94,7 +159,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
94 mainAxisAlignment: MainAxisAlignment.spaceBetween, 159 mainAxisAlignment: MainAxisAlignment.spaceBetween,
95 children: [ 160 children: [
96 Text( 161 Text(
97 - '分享排菜单给客户时展示菜品价格', 162 + '向客人开放提前点餐功能',
98 style: TextStyle( 163 style: TextStyle(
99 color: MyColours.color_515151, 164 color: MyColours.color_515151,
100 fontSize: font(16)), 165 fontSize: font(16)),
@@ -104,7 +169,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> { @@ -104,7 +169,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
104 padding: EdgeInsets.symmetric( 169 padding: EdgeInsets.symmetric(
105 horizontal: w(7), vertical: w(4)), 170 horizontal: w(7), vertical: w(4)),
106 child: Image.asset( 171 child: Image.asset(
107 - Utils.getImgPath(selectShowPrice 172 + Utils.getImgPath(isOrder
108 ? 'swich_on' 173 ? 'swich_on'
109 : 'swich_off'), 174 : 'swich_off'),
110 width: w(44), 175 width: w(44),
@@ -147,7 +212,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> { @@ -147,7 +212,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
147 isBold: true, 212 isBold: true,
148 onPressed: () async { 213 onPressed: () async {
149 //调用接口 214 //调用接口
150 - _setPriceShow(); 215 + _setOrderBtnShow();
151 }) 216 })
152 ], 217 ],
153 )); 218 ));
@@ -5,6 +5,7 @@ import 'package:one_key/models/recharge_list_model.dart'; @@ -5,6 +5,7 @@ import 'package:one_key/models/recharge_list_model.dart';
5 import 'package:one_key/pages/my/marketing_center/recharge/recharge_item.dart'; 5 import 'package:one_key/pages/my/marketing_center/recharge/recharge_item.dart';
6 import 'package:one_key/res/colors.dart'; 6 import 'package:one_key/res/colors.dart';
7 import 'package:one_key/utils/utils.dart'; 7 import 'package:one_key/utils/utils.dart';
  8 +import 'package:one_key/widgets/h_empty_view.dart';
8 import 'package:one_key/widgets/system_app_bar.dart'; 9 import 'package:one_key/widgets/system_app_bar.dart';
9 import 'package:provider/provider.dart'; 10 import 'package:provider/provider.dart';
10 11
@@ -34,17 +35,18 @@ class RechargeHomePage extends StatefulWidget { @@ -34,17 +35,18 @@ class RechargeHomePage extends StatefulWidget {
34 class _RechargeHomePageState extends State<RechargeHomePage> { 35 class _RechargeHomePageState extends State<RechargeHomePage> {
35 MarketingCenterProvider marketingCenterProvider; 36 MarketingCenterProvider marketingCenterProvider;
36 EasyRefreshController _controller = EasyRefreshController(); 37 EasyRefreshController _controller = EasyRefreshController();
  38 + RechargeListSunModel rechargeData;
37 39
38 @override 40 @override
39 void initState() { 41 void initState() {
40 // TODO: implement initState 42 // TODO: implement initState
41 super.initState(); 43 super.initState();
42 WidgetsBinding.instance.addPostFrameCallback((_) { 44 WidgetsBinding.instance.addPostFrameCallback((_) {
43 - _getNewRechargeList(); 45 + _getNewRechargeData();
44 }); 46 });
45 47
46 bus.on("refresh_recharge_home", (arg) { 48 bus.on("refresh_recharge_home", (arg) {
47 - _getNewRechargeList(); 49 + _getNewRechargeData();
48 }); 50 });
49 } 51 }
50 52
@@ -54,13 +56,59 @@ class _RechargeHomePageState extends State<RechargeHomePage> { @@ -54,13 +56,59 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
54 bus.off('refresh_recharge_home'); 56 bus.off('refresh_recharge_home');
55 } 57 }
56 58
57 - _getNewRechargeList() async { 59 + Future<bool> _getNewRechargeList() async {
58 UserModel userModel = Provider.of<UserModel>(context, listen: false); 60 UserModel userModel = Provider.of<UserModel>(context, listen: false);
59 Map<String, String> params = { 61 Map<String, String> params = {
60 "sellerid": userModel.user.sellerid, 62 "sellerid": userModel.user.sellerid,
61 // 'uid': userModel.user.openid 63 // 'uid': userModel.user.openid
62 }; 64 };
63 - await marketingCenterProvider.getNewRechargeList(context, params); 65 + bool success =
  66 + await marketingCenterProvider.getNewRechargeList(context, params);
  67 + if (success) {
  68 + return true;
  69 + } else {
  70 + return false;
  71 + }
  72 + }
  73 +
  74 + _getNewRechargeData() async {
  75 + Future.wait<bool>([_getNewRechargeList(), getSellerTemplateConf(context)])
  76 + .then((results) async {
  77 + print(results[0]);
  78 + if (results[0] && results[1]) {
  79 + //成功
  80 + if (rechargeData != null) {
  81 + marketingCenterProvider.rechargeList.forEach((element) {
  82 + if (element.id == rechargeData.id) {
  83 + element.isMarking = true;
  84 + }
  85 + });
  86 + }
  87 +
  88 + setState(() {});
  89 + } else {
  90 + // if (!results[0]) {
  91 + // //没有优惠券
  92 + // } else {}
  93 + // if (!results[1]) {
  94 + // //没有营销中心数据
  95 + // } else {}
  96 + setState(() {});
  97 + }
  98 + }).catchError((e) {
  99 + print(e);
  100 + });
  101 + }
  102 +
  103 + Future<bool> getSellerTemplateConf(BuildContext context) async {
  104 + bool success = await marketingCenterProvider.getSellerTemplateConf(context);
  105 + if (success && marketingCenterProvider.markDataModel.marketing != null) {
  106 + rechargeData =
  107 + marketingCenterProvider.markDataModel.marketing.rechargeData;
  108 + return true;
  109 + } else {
  110 + return false;
  111 + }
64 } 112 }
65 113
66 _openOrClose(RechargeListSunModel rechargeListSunModel, String isOpen) async { 114 _openOrClose(RechargeListSunModel rechargeListSunModel, String isOpen) async {
@@ -92,13 +140,17 @@ class _RechargeHomePageState extends State<RechargeHomePage> { @@ -92,13 +140,17 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
92 bool showBtn = Utils.getAuthority(context, '编辑优惠'); 140 bool showBtn = Utils.getAuthority(context, '编辑优惠');
93 return Scaffold( 141 return Scaffold(
94 backgroundColor: MyColours.color_f3f3f3, 142 backgroundColor: MyColours.color_f3f3f3,
95 - appBar: SystemAppBar(  
96 - '充值优惠',  
97 - rightImgName: 'share.png',  
98 - onTapRight: () {  
99 - Utils.goShareRechargeListToWeChat(context);  
100 - },  
101 - ), 143 + appBar: Utils.getAuthority(context, '充值优惠-设置')
  144 + ? SystemAppBar(
  145 + '充值优惠',
  146 + rightImgName: 'set_g.png',
  147 + onTapRight: () {
  148 + NavigatorUtil.goRechargeSettingPage(context);
  149 + },
  150 + )
  151 + : SystemAppBar(
  152 + '充值优惠',
  153 + ),
102 body: Container( 154 body: Container(
103 child: Column( 155 child: Column(
104 children: [ 156 children: [
@@ -244,15 +296,15 @@ class _RechargeHomePageState extends State<RechargeHomePage> { @@ -244,15 +296,15 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
244 // '管理员' || 296 // '管理员' ||
245 // Provider.of<UserModel>(context, listen: false).user.role_name == 297 // Provider.of<UserModel>(context, listen: false).user.role_name ==
246 // '店长') 298 // '店长')
247 - if (Utils.getAuthority(context, '新建优惠'))  
248 - Container( 299 +
  300 + Container(
249 height: ScreenUtil().setWidth(91 * 2), 301 height: ScreenUtil().setWidth(91 * 2),
250 width: double.infinity, 302 width: double.infinity,
251 padding: EdgeInsets.only( 303 padding: EdgeInsets.only(
252 top: ScreenUtil().setWidth(16 * 2), 304 top: ScreenUtil().setWidth(16 * 2),
253 bottom: ScreenUtil().setWidth(35 * 2), 305 bottom: ScreenUtil().setWidth(35 * 2),
254 - left: ScreenUtil().setWidth(45 * 2),  
255 - right: ScreenUtil().setWidth(45 * 2), 306 + left: ScreenUtil().setWidth(23 * 2),
  307 + right: ScreenUtil().setWidth(23 * 2),
256 ), 308 ),
257 decoration: BoxDecoration( 309 decoration: BoxDecoration(
258 color: MyColours.color_ffffff, 310 color: MyColours.color_ffffff,
@@ -267,33 +319,73 @@ class _RechargeHomePageState extends State<RechargeHomePage> { @@ -267,33 +319,73 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
267 Radius.circular(ScreenUtil().setWidth(16)), 319 Radius.circular(ScreenUtil().setWidth(16)),
268 ), 320 ),
269 ), 321 ),
270 - child: RoundButton(  
271 - text: '新建优惠',  
272 - height: ScreenUtil().setWidth(80),  
273 - radius: ScreenUtil().setWidth(14),  
274 - isBold: false,  
275 - fontSize: 28,  
276 - onPressed: () async {  
277 - // UserModel userModel =  
278 - // Provider.of<UserModel>(context, listen: false);  
279 - // if (userModel.user.role_name == '管理员' ||  
280 - // userModel.user.role_name == '店长') {  
281 - NavigatorUtil.goRechargeEditPage(context);  
282 - // } else {  
283 - // Utils.showToast('您还没有相关权限');  
284 - // // bool needRefresh =  
285 - // // await NavigatorUtil.goCouponEditPage(context);  
286 - // // print(needRefresh);  
287 - // // if (needRefresh != null && needRefresh) {  
288 - // // bus.emit('refresh_coupon_list_f');  
289 - // // //刷新页面数据  
290 - // // // _controller.callRefresh();  
291 - // // // _couponNetworkData(tabController.index);  
292 - // // }  
293 - // }  
294 - },  
295 - ),  
296 - ) 322 + child: Row(
  323 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  324 + children: [
  325 + Utils.getAuthority(context, '新建优惠')
  326 + ? RoundButton(
  327 + text: '分享给客户',
  328 + width: w(100),
  329 + height: ScreenUtil().setWidth(80),
  330 + radius: ScreenUtil().setWidth(14),
  331 + gradientStart: MyColours.color_ffffff,
  332 + gradientEnd: MyColours.color_ffffff,
  333 + borderColor: MyColours.color_438E93,
  334 + textColor: MyColours.color_438E93,
  335 + isBold: true,
  336 + fontSize: 28,
  337 + onPressed: () {
  338 + Utils.goShareRechargeListToWeChat(context);
  339 + },
  340 + )
  341 + : Expanded(
  342 + child: RoundButton(
  343 + text: '分享给客户',
  344 + width: w(100),
  345 + height: ScreenUtil().setWidth(80),
  346 + radius: ScreenUtil().setWidth(14),
  347 + gradientStart: MyColours.color_ffffff,
  348 + gradientEnd: MyColours.color_ffffff,
  349 + borderColor: MyColours.color_438E93,
  350 + textColor: MyColours.color_438E93,
  351 + isBold: true,
  352 + fontSize: 28,
  353 + onPressed: () {
  354 + Utils.goShareRechargeListToWeChat(context);
  355 + },
  356 + )),
  357 + if (Utils.getAuthority(context, '新建优惠')) HEmptyView(30),
  358 + if (Utils.getAuthority(context, '新建优惠'))
  359 + Expanded(
  360 + child: RoundButton(
  361 + text: '新建充值优惠',
  362 + height: ScreenUtil().setWidth(80),
  363 + radius: ScreenUtil().setWidth(14),
  364 + isBold: false,
  365 + fontSize: 28,
  366 + onPressed: () async {
  367 + // UserModel userModel =
  368 + // Provider.of<UserModel>(context, listen: false);
  369 + // if (userModel.user.role_name == '管理员' ||
  370 + // userModel.user.role_name == '店长') {
  371 + NavigatorUtil.goRechargeEditPage(context);
  372 + // } else {
  373 + // Utils.showToast('您还没有相关权限');
  374 + // // bool needRefresh =
  375 + // // await NavigatorUtil.goCouponEditPage(context);
  376 + // // print(needRefresh);
  377 + // // if (needRefresh != null && needRefresh) {
  378 + // // bus.emit('refresh_coupon_list_f');
  379 + // // //刷新页面数据
  380 + // // // _controller.callRefresh();
  381 + // // // _couponNetworkData(tabController.index);
  382 + // // }
  383 + // }
  384 + },
  385 + ),
  386 + )
  387 + ],
  388 + )),
297 ], 389 ],
298 ), 390 ),
299 ), 391 ),
@@ -71,9 +71,11 @@ class _RechargeItemState extends State<RechargeItem> { @@ -71,9 +71,11 @@ class _RechargeItemState extends State<RechargeItem> {
71 color: widget.from == 'history' 71 color: widget.from == 'history'
72 ? MyColours.color_BFC4D4 72 ? MyColours.color_BFC4D4
73 : notSelect 73 : notSelect
74 - ? widget.rechargeListSunModel.isOpen == '1'  
75 - ? MyColours.color_438E93  
76 - : MyColours.color_999999 74 + ? widget.rechargeListSunModel.isMarking
  75 + ? MyColours.color_00A870
  76 + : widget.rechargeListSunModel.isOpen == '1'
  77 + ? MyColours.color_438E93
  78 + : MyColours.color_999999
77 : MyColours.color_999999, 79 : MyColours.color_999999,
78 borderRadius: BorderRadius.only( 80 borderRadius: BorderRadius.only(
79 topLeft: Radius.circular(ScreenUtil().setWidth(16)), 81 topLeft: Radius.circular(ScreenUtil().setWidth(16)),
  1 +import 'dart:convert';
  2 +
  3 +import 'package:flutter/material.dart';
  4 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:one_key/res/colors.dart';
  6 +import 'package:one_key/widgets/system_app_bar.dart';
  7 +import 'package:provider/provider.dart';
  8 +
  9 +import '../../../../models/coupon_model.dart';
  10 +import '../../../../models/recharge_list_model.dart';
  11 +import '../../../../provider/marketing_center_provider.dart';
  12 +import '../../../../provider/user_model.dart';
  13 +import '../../../../route/navigator_util.dart';
  14 +import '../../../../utils/event_bus.dart';
  15 +import '../../../../utils/screen_util.dart';
  16 +import '../../../../utils/utils.dart';
  17 +import '../../../../widgets/h_empty_view.dart';
  18 +import '../../../../widgets/round_button.dart';
  19 +import '../../../../widgets/v_empty_view.dart';
  20 +
  21 +/**
  22 + * 充值优惠设置页面
  23 + * */
  24 +
  25 +class RechargeSettingPage extends StatefulWidget {
  26 + RechargeSettingPage({Key key}) : super(key: key);
  27 +
  28 + @override
  29 + _RechargeSettingPageState createState() => _RechargeSettingPageState();
  30 +}
  31 +
  32 +class _RechargeSettingPageState extends State<RechargeSettingPage> {
  33 + ScrollController controller = ScrollController();
  34 +
  35 + MarketingCenterProvider marketingCenterProvider;
  36 + bool isTranspond = false; //转发邀请函
  37 + bool isArrival = false; //确认到店
  38 + bool isOnlineBook = false; //在线预订
  39 + bool isOrder = false; //提前点餐
  40 + bool isLink = false; //充值优惠活动链接
  41 + bool isCoupon = false; // 代金券
  42 + bool isRecharge = false; //充值券
  43 + String welcome = '';
  44 + String qiniuUrl = '';
  45 +
  46 + RechargeListSunModel rechargeData;
  47 + String rechargeContent = '';
  48 +
  49 + List<CouponSunModel> couponDataList = [];
  50 + List<RechargeListSunModel> rechargeListCanUse = [];
  51 + @override
  52 + void initState() {
  53 + super.initState();
  54 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  55 + _getNewRechargeList();
  56 + getSellerTemplateConf();
  57 + });
  58 + }
  59 +
  60 + getSellerTemplateConf() async {
  61 + bool success = await marketingCenterProvider.getSellerTemplateConf(context);
  62 + if (success && marketingCenterProvider.markDataModel.marketing != null) {
  63 + isTranspond =
  64 + marketingCenterProvider.markDataModel.marketing.isTranspond == '1'
  65 + ? true
  66 + : false;
  67 +
  68 + isArrival =
  69 + marketingCenterProvider.markDataModel.marketing.isArrival == '1'
  70 + ? true
  71 + : false;
  72 + isOnlineBook =
  73 + marketingCenterProvider.markDataModel.marketing.isOnlineBook == '1'
  74 + ? true
  75 + : false;
  76 + isOrder = marketingCenterProvider.markDataModel.marketing.isOrder == '1'
  77 + ? true
  78 + : false;
  79 + isLink = marketingCenterProvider.markDataModel.marketing.isLink == '1'
  80 + ? true
  81 + : false;
  82 +
  83 + isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
  84 + ? true
  85 + : false;
  86 +
  87 + isRecharge =
  88 + marketingCenterProvider.markDataModel.marketing.isRecharge == '1'
  89 + ? true
  90 + : false;
  91 +
  92 + rechargeData =
  93 + marketingCenterProvider.markDataModel.marketing.rechargeData;
  94 + couponDataList =
  95 + marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
  96 +
  97 + qiniuUrl = marketingCenterProvider.markDataModel.marketing.logo ?? null;
  98 +
  99 + welcome = marketingCenterProvider.markDataModel.marketing.wecomle;
  100 +
  101 + setState(() {});
  102 + }
  103 + }
  104 +
  105 + ///优惠券设置
  106 +
  107 + _setCouponShow() async {
  108 + //接口
  109 + Map marketingData = {
  110 + // 'isTranspond': isTranspond ? '1' : '0', //转发同行客人
  111 + 'is_transpond': '1', //转发同行客人
  112 + 'is_arrival': isArrival ? '1' : '0', //确认到店
  113 + 'is_online_book': isOnlineBook ? '1' : '0', //在线预订
  114 + 'is_order': isOrder ? '1' : '0', //去点餐
  115 + 'is_coupon': isCoupon ? '1' : '0', //代金券暂时
  116 + 'is_recharge': isRecharge ? '1' : '0', //充值券暂时
  117 + 'is_link': isLink ? '1' : '0',
  118 + 'wecomle': welcome ?? '',
  119 + 'logo': qiniuUrl,
  120 + 'recharge_data': rechargeData,
  121 + 'coupon_data': json.encode(couponDataList)
  122 + };
  123 + Map<String, String> params = {
  124 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  125 + 'marketing': json.encode(marketingData)
  126 + };
  127 +
  128 + bool success = await marketingCenterProvider
  129 + .setSellerTemplateConf(context, params, showLoading: true);
  130 + if (success) {
  131 + bus.emit('refresh_recharge_home');
  132 + Utils.showToast('保存成功');
  133 + Navigator.pop(context);
  134 + }
  135 + }
  136 +
  137 + _getNewRechargeList() async {
  138 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  139 + Map<String, String> params = {
  140 + "sellerid": userModel.user.sellerid,
  141 + // 'uid': userModel.user.openid
  142 + };
  143 + await marketingCenterProvider.getNewRechargeList(context, params);
  144 + rechargeListCanUse = [];
  145 + if (marketingCenterProvider.rechargeList.length > 0) {
  146 + marketingCenterProvider.rechargeList.forEach((element) {
  147 + if (element.isOpen == '1') {
  148 + //启用状态
  149 + rechargeListCanUse.add(element);
  150 + }
  151 + });
  152 + }
  153 +
  154 + if (rechargeData == null && rechargeListCanUse.length > 0) {
  155 + rechargeData = rechargeListCanUse[0];
  156 + _getRechargeContent();
  157 + setState(() {});
  158 + }
  159 + }
  160 +
  161 + _getRechargeContent() {
  162 + rechargeContent = '';
  163 + if (rechargeData.rechargeList.isPrice == '1') {
  164 + rechargeContent +=
  165 + '会员充值满${rechargeData.rechargeMoney}元赠余额${rechargeData.rechargeList.price}元;';
  166 + }
  167 + if (rechargeData.rechargeList.isScore == '1') {
  168 + rechargeContent +=
  169 + '\n会员充值满${rechargeData.rechargeMoney}元赠${rechargeData.rechargeList.score}积分;';
  170 + }
  171 + if (rechargeData.rechargeList.isCoupons == '1') {
  172 + rechargeContent +=
  173 + '\n会员充值满${rechargeData.rechargeMoney}元赠${Utils.listToStringEnglish3(rechargeData.rechargeList.couponsNames)}。';
  174 + }
  175 + }
  176 +
  177 + ///标题
  178 + Widget _headItem(String title) {
  179 + return Container(
  180 + width: double.infinity,
  181 + alignment: Alignment.centerLeft,
  182 + decoration: BoxDecoration(
  183 + border: Border(
  184 + bottom:
  185 + BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
  186 + margin: EdgeInsets.only(left: w(16)),
  187 + padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(16)),
  188 + child: Text(
  189 + title,
  190 + style: TextStyle(
  191 + color: MyColours.color_515151, fontSize: ScreenUtil().setWidth(32)),
  192 + ),
  193 + );
  194 + }
  195 +
  196 + ///优惠券
  197 + Widget _markingCuponItem(
  198 + String title,
  199 + String content,
  200 + String subtile,
  201 + String discount,
  202 + String btnTitle, {
  203 + VoidCallback onPressed,
  204 + bool select = false,
  205 + VoidCallback onPressedSelect,
  206 + }) {
  207 + return Container(
  208 + margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)),
  209 + child: Container(
  210 + padding: EdgeInsets.all(w(12)),
  211 + decoration: BoxDecoration(
  212 + borderRadius: BorderRadiusDirectional.circular(r(8)),
  213 + border: Border.all(width: w(1), color: MyColours.color_DBDBDB)),
  214 + child: Row(
  215 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  216 + children: [
  217 + Expanded(
  218 + child: Column(
  219 + crossAxisAlignment: CrossAxisAlignment.start,
  220 + children: [
  221 + Row(
  222 + children: [
  223 + Container(
  224 + constraints: BoxConstraints(maxWidth: w(150)),
  225 + child: Text(
  226 + title,
  227 + style: TextStyle(
  228 + fontSize: font(14),
  229 + fontWeight: FontWeight.bold,
  230 + color: MyColours.color_515151),
  231 + )),
  232 + HEmptyView(20),
  233 + subtile != ''
  234 + ? Text(
  235 + '¥${subtile}',
  236 + style: TextStyle(
  237 + fontSize: font(7),
  238 + fontWeight: FontWeight.bold,
  239 + color: MyColours.color_E34D59),
  240 + )
  241 + : SizedBox(),
  242 + HEmptyView(10),
  243 + discount != ''
  244 + ? Container(
  245 + padding: EdgeInsets.symmetric(
  246 + horizontal: w(3), vertical: w(2)),
  247 + decoration: BoxDecoration(
  248 + borderRadius: BorderRadius.circular(r(3)),
  249 + border: Border.all(
  250 + width: w(0.5),
  251 + color: MyColours.color_E34D59)),
  252 + child: Text(
  253 + discount,
  254 + style: TextStyle(
  255 + color: MyColours.color_E34D59,
  256 + fontSize: font(7)),
  257 + ),
  258 + )
  259 + : SizedBox(),
  260 + ],
  261 + ),
  262 + if (content != '') VEmptyView(20),
  263 + if (content != '')
  264 + Text(
  265 + content,
  266 + style: TextStyle(
  267 + height: 1.2,
  268 + fontSize: font(10),
  269 + fontWeight: FontWeight.bold,
  270 + color: MyColours.color_515151),
  271 + )
  272 + ],
  273 + )),
  274 + ],
  275 + ),
  276 + ),
  277 + );
  278 + }
  279 +
  280 + ///营销推广
  281 + Widget _markingItem(
  282 + String selectTitle,
  283 + String title, {
  284 + bool select = false,
  285 + VoidCallback onPressedSelect,
  286 + }) {
  287 + return Container(
  288 + margin: EdgeInsets.only(left: w(18), top: w(12), right: w(18)),
  289 + child: Column(
  290 + children: [
  291 + InkWell(
  292 + onTap: onPressedSelect,
  293 + child: Row(
  294 + children: [
  295 + Image.asset(
  296 + Utils.getImgPath(select ? 'f_select' : 'f_select_not'),
  297 + width: w(20),
  298 + ),
  299 + HEmptyView(20),
  300 + Text(
  301 + selectTitle,
  302 + style: TextStyle(
  303 + fontSize: font(14), color: MyColours.color_515151),
  304 + )
  305 + ],
  306 + )),
  307 + VEmptyView(20),
  308 + Container(
  309 + height: w(76),
  310 + padding: EdgeInsets.all(w(12)),
  311 + decoration: BoxDecoration(
  312 + borderRadius: BorderRadiusDirectional.circular(r(8)),
  313 + border:
  314 + Border.all(width: w(1), color: MyColours.color_DBDBDB)),
  315 + child: Text(
  316 + title,
  317 + maxLines: 2,
  318 + style: TextStyle(
  319 + fontSize: font(14),
  320 + // fontWeight: FontWeight.bold,
  321 + color: MyColours.color_515151),
  322 + ))
  323 + ],
  324 + ),
  325 + );
  326 + }
  327 +
  328 + ///营销推广
  329 + Widget _markingItemRecharge(
  330 + String selectTitle,
  331 + String title,
  332 + String content,
  333 + String subtile,
  334 + String discount,
  335 + String btnTitle, {
  336 + VoidCallback onPressed,
  337 + bool select = false,
  338 + VoidCallback onPressedSelect,
  339 + }) {
  340 + return Container(
  341 + margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)),
  342 + child: Column(
  343 + children: [
  344 + InkWell(
  345 + onTap: onPressedSelect,
  346 + child: Row(
  347 + children: [
  348 + Image.asset(
  349 + Utils.getImgPath(select ? 'f_select' : 'f_select_not'),
  350 + width: w(20),
  351 + ),
  352 + HEmptyView(20),
  353 + Text(
  354 + selectTitle,
  355 + style: TextStyle(
  356 + fontSize: font(14), color: MyColours.color_515151),
  357 + )
  358 + ],
  359 + )),
  360 + VEmptyView(20),
  361 + Container(
  362 + padding: EdgeInsets.all(w(12)),
  363 + decoration: BoxDecoration(
  364 + borderRadius: BorderRadiusDirectional.circular(r(8)),
  365 + border: Border.all(width: w(1), color: MyColours.color_DBDBDB)),
  366 + child: Row(
  367 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  368 + children: [
  369 + Expanded(
  370 + child: Column(
  371 + crossAxisAlignment: CrossAxisAlignment.start,
  372 + children: [
  373 + Row(
  374 + children: [
  375 + Container(
  376 + constraints: BoxConstraints(maxWidth: w(150)),
  377 + child: Text(
  378 + title,
  379 + style: TextStyle(
  380 + fontSize: font(14),
  381 + fontWeight: FontWeight.bold,
  382 + color: MyColours.color_515151),
  383 + )),
  384 + HEmptyView(20),
  385 + subtile != ''
  386 + ? Text(
  387 + '¥${subtile}',
  388 + style: TextStyle(
  389 + fontSize: font(7),
  390 + fontWeight: FontWeight.bold,
  391 + color: MyColours.color_E34D59),
  392 + )
  393 + : SizedBox(),
  394 + HEmptyView(10),
  395 + discount != ''
  396 + ? Container(
  397 + padding: EdgeInsets.symmetric(
  398 + horizontal: w(3), vertical: w(2)),
  399 + decoration: BoxDecoration(
  400 + borderRadius: BorderRadius.circular(r(3)),
  401 + border: Border.all(
  402 + width: w(0.5),
  403 + color: MyColours.color_E34D59)),
  404 + child: Text(
  405 + discount,
  406 + style: TextStyle(
  407 + color: MyColours.color_E34D59,
  408 + fontSize: font(7)),
  409 + ),
  410 + )
  411 + : SizedBox(),
  412 + ],
  413 + ),
  414 + if (content != '') VEmptyView(20),
  415 + if (content != '')
  416 + Text(
  417 + content,
  418 + style: TextStyle(
  419 + height: 1.2,
  420 + fontSize: font(10),
  421 + fontWeight: FontWeight.bold,
  422 + color: MyColours.color_515151),
  423 + )
  424 + ],
  425 + )),
  426 + HEmptyView(20),
  427 + RoundButton(
  428 + text: btnTitle,
  429 + width: w(72),
  430 + height: w(22),
  431 + gradientStart: MyColours.color_ffffff,
  432 + gradientEnd: MyColours.color_ffffff,
  433 + borderColor: MyColours.color_438E93,
  434 + textColor: MyColours.color_438E93,
  435 + radius: r(11),
  436 + fontSize: 24,
  437 + isBold: true,
  438 + onPressed: onPressed,
  439 + )
  440 + ],
  441 + ),
  442 + )
  443 + ],
  444 + ),
  445 + );
  446 + }
  447 +
  448 + @override
  449 + Widget build(BuildContext context) {
  450 + marketingCenterProvider =
  451 + Provider.of<MarketingCenterProvider>(context, listen: false);
  452 + return Scaffold(
  453 + backgroundColor: MyColours.color_ffffff,
  454 + appBar: SystemAppBar('充值优惠设置'),
  455 + body: Column(
  456 + children: [
  457 + Expanded(
  458 + child: SingleChildScrollView(
  459 + controller: controller,
  460 + child: Column(
  461 + children: [
  462 + _headItem('预订安排中附带的营销推广'),
  463 + VEmptyView(24),
  464 + rechargeData != null
  465 + ? _markingItemRecharge('推荐店内充值单一优惠活动',
  466 + rechargeData.rname, rechargeContent, '', '', '切换活动',
  467 + select: isRecharge, onPressedSelect: () {
  468 + setState(() {
  469 + isRecharge = !isRecharge;
  470 + });
  471 + }, onPressed: () async {
  472 + //切换活动
  473 + Map temp =
  474 + await NavigatorUtil.goMarkingRechargeSelectPage(
  475 + context, rechargeData.id);
  476 + if (temp != null && temp['recharge'] != null) {
  477 + rechargeData = temp['recharge'];
  478 + _getRechargeContent();
  479 + setState(() {});
  480 + }
  481 + })
  482 + : (rechargeListCanUse == null ||
  483 + rechargeListCanUse.length == 0) &&
  484 + Utils.getAuthority(context, '新建优惠')
  485 + ? _markingItem(
  486 + '推荐店内充值单一优惠活动',
  487 + '当前没有创建充值优惠活动,请创建优惠活动后再来尝试。',
  488 + select: false,
  489 + )
  490 + : SizedBox(),
  491 + ],
  492 + ),
  493 + ),
  494 + ),
  495 + Container(
  496 + color: MyColours.color_ffffff,
  497 + padding: EdgeInsets.only(
  498 + left: w(45), right: w(45), top: w(12), bottom: w(25)),
  499 + child: RoundButton(
  500 + text: '保存',
  501 + gradientStart: MyColours.color_199095,
  502 + gradientEnd: MyColours.color_199095,
  503 + // borderColor: MyColours.color_999999,
  504 + radius: r(5),
  505 + fontSize: 34,
  506 + height: w(40),
  507 + isBold: true,
  508 + onPressed: () async {
  509 + _setCouponShow();
  510 + },
  511 + ),
  512 + )
  513 + ],
  514 + ));
  515 + }
  516 +}
@@ -800,112 +800,112 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -800,112 +800,112 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
800 horizontal: ScreenUtil().setHeight(40)), 800 horizontal: ScreenUtil().setHeight(40)),
801 child: Row( 801 child: Row(
802 children: [ 802 children: [
803 - Expanded(  
804 - flex: 1,  
805 - child: InkWell(  
806 - onTap: () async {  
807 - FocusScope.of(context)  
808 - .requestFocus(FocusNode()); //点击空白处隐藏键盘  
809 - if (widget.detailEntity.gid != null) {  
810 - await _setGuestInfo();  
811 - }  
812 - //调用排菜信息提交接口  
813 - Map<String, String> params = {  
814 - 'sellerid':  
815 - Provider.of<UserModel>(context, listen: false)  
816 - .user  
817 - .sellerid,  
818 - 'uid':  
819 - Provider.of<UserModel>(context, listen: false)  
820 - .user  
821 - .openid,  
822 - 'rid': widget.rid,  
823 - };  
824 - if (_planDishProvider.planId != null &&  
825 - _planDishProvider.planId != '') {  
826 - //已经存在id,则修改  
827 - params['id'] = _planDishProvider.planId;  
828 - }  
829 -  
830 - if (isTotal &&  
831 - totalController.text.trim().length > 0) {  
832 - //预计总价  
833 - params['total_price'] = totalController.text;  
834 - params['per_price'] = '0';  
835 - }  
836 - if (!isTotal &&  
837 - perController.text.trim().length > 0) {  
838 - //预计人均  
839 - params['per_price'] = perController.text;  
840 - params['total_price'] = '0';  
841 - }  
842 -  
843 - if (likeController.text.trim().length > 0) {  
844 - //喜好  
845 - params['like'] = likeController.text;  
846 - }  
847 - if (noFoodController.text.trim().length > 0) {  
848 - //忌口  
849 - params['taboos'] = noFoodController.text;  
850 - }  
851 - if (serviceController.text.trim().length > 0) {  
852 - //服务  
853 - params['serve'] = serviceController.text;  
854 - }  
855 - if (pnumController.text.trim().length > 0) {  
856 - params['pnum'] = pnumController.text;  
857 - }  
858 - params['plan_name'] = name ?? '';  
859 -  
860 -// cooklist 字符串 可选 单点菜品列表  
861 -// package_list 字符串 可选 选中套餐数据,[{"id":1,"num":2},{"id":2,"num":1}]  
862 -// often_list 字符串 可选 选中店内常点数据,[{"id":1,"num":2},{"id":2,"num":1}]  
863 -// temporary_list 字符串 可选 临时加菜,[{"cook_name":"炒土豆丝","price":20,"num",1,"unit":"份","practice":"香辣"},{"cook_name":"麻婆豆腐","price":18,"num",1,"unit":"份","practice":"香辣"}]  
864 -// plan_list 字符串 可选 选中排菜数据,[{"id":1,"num":2},{"id":2,"num":1}]  
865 -// menu_price 浮点型 可选 菜单总价  
866 -// member_price 浮点型 可选 会员总价  
867 -// plan_price 浮点型 可选 排菜总价  
868 -// remark  
869 -  
870 - bool success = await _planDishProvider  
871 - .setPlanCookByReserve(context, params);  
872 - if (success) {  
873 - // bus.emit("refresh_detail");  
874 - //获取成功  
875 - Utils.goShareOrderPageToWeChat(context,  
876 - title:  
877 - '${Provider.of<UserModel>(context, listen: false).user.nickName ?? Provider.of<UserModel>(context, listen: false).user.sellername}经理邀请您点餐了',  
878 - img:  
879 - 'http://nosqn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148571.jpg',  
880 - rid: widget.rid,  
881 - // oid: oid,  
882 - sid: Provider.of<UserModel>(context,  
883 - listen: false)  
884 - .user  
885 - .sellerid);  
886 - } else {  
887 - Utils.showToast('信息提交失败,请重试');  
888 - }  
889 - },  
890 - child: Container(  
891 - margin:  
892 - EdgeInsets.only(right: ScreenUtil().setWidth(20)),  
893 - decoration: BoxDecoration(  
894 - color: MyColours.color_ffffff,  
895 - border: Border.all(  
896 - width: w(1), color: MyColours.color_438E93),  
897 - borderRadius: BorderRadius.circular(  
898 - ScreenUtil().setWidth(10)),  
899 - ),  
900 - child: Align(  
901 - alignment: Alignment.center,  
902 - child: Text('请客户点菜',  
903 - style: TextStyle(  
904 - color: MyColours.color_438E93,  
905 - fontSize: ScreenUtil().setSp(32))),  
906 - ),  
907 - ),  
908 - )), 803 +// Expanded(
  804 +// flex: 1,
  805 +// child: InkWell(
  806 +// onTap: () async {
  807 +// FocusScope.of(context)
  808 +// .requestFocus(FocusNode()); //点击空白处隐藏键盘
  809 +// if (widget.detailEntity.gid != null) {
  810 +// await _setGuestInfo();
  811 +// }
  812 +// //调用排菜信息提交接口
  813 +// Map<String, String> params = {
  814 +// 'sellerid':
  815 +// Provider.of<UserModel>(context, listen: false)
  816 +// .user
  817 +// .sellerid,
  818 +// 'uid':
  819 +// Provider.of<UserModel>(context, listen: false)
  820 +// .user
  821 +// .openid,
  822 +// 'rid': widget.rid,
  823 +// };
  824 +// if (_planDishProvider.planId != null &&
  825 +// _planDishProvider.planId != '') {
  826 +// //已经存在id,则修改
  827 +// params['id'] = _planDishProvider.planId;
  828 +// }
  829 +
  830 +// if (isTotal &&
  831 +// totalController.text.trim().length > 0) {
  832 +// //预计总价
  833 +// params['total_price'] = totalController.text;
  834 +// params['per_price'] = '0';
  835 +// }
  836 +// if (!isTotal &&
  837 +// perController.text.trim().length > 0) {
  838 +// //预计人均
  839 +// params['per_price'] = perController.text;
  840 +// params['total_price'] = '0';
  841 +// }
  842 +
  843 +// if (likeController.text.trim().length > 0) {
  844 +// //喜好
  845 +// params['like'] = likeController.text;
  846 +// }
  847 +// if (noFoodController.text.trim().length > 0) {
  848 +// //忌口
  849 +// params['taboos'] = noFoodController.text;
  850 +// }
  851 +// if (serviceController.text.trim().length > 0) {
  852 +// //服务
  853 +// params['serve'] = serviceController.text;
  854 +// }
  855 +// if (pnumController.text.trim().length > 0) {
  856 +// params['pnum'] = pnumController.text;
  857 +// }
  858 +// params['plan_name'] = name ?? '';
  859 +
  860 +// // cooklist 字符串 可选 单点菜品列表
  861 +// // package_list 字符串 可选 选中套餐数据,[{"id":1,"num":2},{"id":2,"num":1}]
  862 +// // often_list 字符串 可选 选中店内常点数据,[{"id":1,"num":2},{"id":2,"num":1}]
  863 +// // temporary_list 字符串 可选 临时加菜,[{"cook_name":"炒土豆丝","price":20,"num",1,"unit":"份","practice":"香辣"},{"cook_name":"麻婆豆腐","price":18,"num",1,"unit":"份","practice":"香辣"}]
  864 +// // plan_list 字符串 可选 选中排菜数据,[{"id":1,"num":2},{"id":2,"num":1}]
  865 +// // menu_price 浮点型 可选 菜单总价
  866 +// // member_price 浮点型 可选 会员总价
  867 +// // plan_price 浮点型 可选 排菜总价
  868 +// // remark
  869 +
  870 +// bool success = await _planDishProvider
  871 +// .setPlanCookByReserve(context, params);
  872 +// if (success) {
  873 +// // bus.emit("refresh_detail");
  874 +// //获取成功
  875 +// Utils.goShareOrderPageToWeChat(context,
  876 +// title:
  877 +// '${Provider.of<UserModel>(context, listen: false).user.nickName ?? Provider.of<UserModel>(context, listen: false).user.sellername}经理邀请您点餐了',
  878 +// img:
  879 +// 'http://nosqn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148571.jpg',
  880 +// rid: widget.rid,
  881 +// // oid: oid,
  882 +// sid: Provider.of<UserModel>(context,
  883 +// listen: false)
  884 +// .user
  885 +// .sellerid);
  886 +// } else {
  887 +// Utils.showToast('信息提交失败,请重试');
  888 +// }
  889 +// },
  890 +// child: Container(
  891 +// margin:
  892 +// EdgeInsets.only(right: ScreenUtil().setWidth(20)),
  893 +// decoration: BoxDecoration(
  894 +// color: MyColours.color_ffffff,
  895 +// border: Border.all(
  896 +// width: w(1), color: MyColours.color_438E93),
  897 +// borderRadius: BorderRadius.circular(
  898 +// ScreenUtil().setWidth(10)),
  899 +// ),
  900 +// child: Align(
  901 +// alignment: Alignment.center,
  902 +// child: Text('请客户点菜',
  903 +// style: TextStyle(
  904 +// color: MyColours.color_438E93,
  905 +// fontSize: ScreenUtil().setSp(32))),
  906 +// ),
  907 +// ),
  908 +// )),
909 Expanded( 909 Expanded(
910 flex: 2, 910 flex: 2,
911 child: InkWell( 911 child: InkWell(
@@ -1765,6 +1765,15 @@ class NavigatorUtil { @@ -1765,6 +1765,15 @@ class NavigatorUtil {
1765 replace: replace); 1765 replace: replace);
1766 } 1766 }
1767 1767
  1768 + /// 经理排菜配置页
  1769 + static Future<dynamic> goOrderSettingManagerPage(
  1770 + BuildContext context, {
  1771 + replace = false,
  1772 + }) {
  1773 + return _navigateTo(context, "${Routes.order_setting_manager_page}",
  1774 + replace: replace);
  1775 + }
  1776 +
1768 /// 客户通知配置页 1777 /// 客户通知配置页
1769 static Future<dynamic> goCustomerNoticeSettingPage( 1778 static Future<dynamic> goCustomerNoticeSettingPage(
1770 BuildContext context, { 1779 BuildContext context, {
@@ -1773,4 +1782,22 @@ class NavigatorUtil { @@ -1773,4 +1782,22 @@ class NavigatorUtil {
1773 return _navigateTo(context, "${Routes.customer_notice_setting_page}", 1782 return _navigateTo(context, "${Routes.customer_notice_setting_page}",
1774 replace: replace); 1783 replace: replace);
1775 } 1784 }
  1785 +
  1786 + /// 客户通知配置页----优惠券配置
  1787 + static Future<dynamic> goCouponSettingPage(
  1788 + BuildContext context, {
  1789 + replace = false,
  1790 + }) {
  1791 + return _navigateTo(context, "${Routes.coupon_setting_page}",
  1792 + replace: replace);
  1793 + }
  1794 +
  1795 + /// 客户通知配置页----充值优惠配置
  1796 + static Future<dynamic> goRechargeSettingPage(
  1797 + BuildContext context, {
  1798 + replace = false,
  1799 + }) {
  1800 + return _navigateTo(context, "${Routes.recharge_setting_page}",
  1801 + replace: replace);
  1802 + }
1776 } 1803 }
@@ -164,6 +164,7 @@ import '../models/set_xuan_tai_model.dart'; @@ -164,6 +164,7 @@ import '../models/set_xuan_tai_model.dart';
164 import '../models/setmeal_by_id_model.dart'; 164 import '../models/setmeal_by_id_model.dart';
165 import '../models/setmeal_model.dart'; 165 import '../models/setmeal_model.dart';
166 import '../models/wine_manage_model.dart'; 166 import '../models/wine_manage_model.dart';
  167 +import '../pages/coupon/coupon_setting_page.dart';
167 import '../pages/coupon/coupon_verification_detail_page.dart'; 168 import '../pages/coupon/coupon_verification_detail_page.dart';
168 import '../pages/coupon/verification_coupon_page.dart'; 169 import '../pages/coupon/verification_coupon_page.dart';
169 import '../pages/feast/feast_board.dart'; 170 import '../pages/feast/feast_board.dart';
@@ -206,12 +207,14 @@ import '../pages/my/marketing_center/book_notification/marking_recharge_select_p @@ -206,12 +207,14 @@ import '../pages/my/marketing_center/book_notification/marking_recharge_select_p
206 import '../pages/my/marketing_center/book_notification/store_introduce_page.dart'; 207 import '../pages/my/marketing_center/book_notification/store_introduce_page.dart';
207 import '../pages/my/marketing_center/customer_notice_setting_page.dart'; 208 import '../pages/my/marketing_center/customer_notice_setting_page.dart';
208 import '../pages/my/marketing_center/marketing_center_home_page.dart'; 209 import '../pages/my/marketing_center/marketing_center_home_page.dart';
  210 +import '../pages/my/marketing_center/order_setting_manager_page.dart';
209 import '../pages/my/marketing_center/order_setting_page.dart'; 211 import '../pages/my/marketing_center/order_setting_page.dart';
210 import '../pages/my/marketing_center/recharge/recharge_detail_page.dart'; 212 import '../pages/my/marketing_center/recharge/recharge_detail_page.dart';
211 import '../pages/my/marketing_center/recharge/recharge_edit_page.dart'; 213 import '../pages/my/marketing_center/recharge/recharge_edit_page.dart';
212 import '../pages/my/marketing_center/recharge/recharge_history_page.dart'; 214 import '../pages/my/marketing_center/recharge/recharge_history_page.dart';
213 import '../pages/my/marketing_center/recharge/recharge_home_page.dart'; 215 import '../pages/my/marketing_center/recharge/recharge_home_page.dart';
214 import '../pages/my/marketing_center/recharge/recharge_select_store_coupon_page.dart'; 216 import '../pages/my/marketing_center/recharge/recharge_select_store_coupon_page.dart';
  217 +import '../pages/my/marketing_center/recharge/recharge_setting_page.dart';
215 import '../pages/my/menu_type/menu_add_dishes_page.dart'; 218 import '../pages/my/menu_type/menu_add_dishes_page.dart';
216 // import '../pages/my/menu_type/menu_add_dishes_page_new.dart'; 219 // import '../pages/my/menu_type/menu_add_dishes_page_new.dart';
217 import '../pages/my/menu_type/menu_dish_method_page.dart'; 220 import '../pages/my/menu_type/menu_dish_method_page.dart';
@@ -2931,6 +2934,22 @@ var orderSettingPageHandle = new Handler( @@ -2931,6 +2934,22 @@ var orderSettingPageHandle = new Handler(
2931 create: (_) => MarketingCenterProvider(), child: OrderSettingPage()); 2934 create: (_) => MarketingCenterProvider(), child: OrderSettingPage());
2932 }); 2935 });
2933 2936
  2937 +//经理排菜配置页
  2938 +var orderSettingManagerPageHandle = new Handler(
  2939 + handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  2940 + // String year = params["year"].first;
  2941 + // String month = params["month"].first;
  2942 + // String day = params["day"].first;
  2943 + // String uid = params["uid"].first;
  2944 +
  2945 + // DayList daylist = DayList.fromJson(json
  2946 + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["daylist"].first)));
  2947 +
  2948 + return ChangeNotifierProvider<MarketingCenterProvider>(
  2949 + create: (_) => MarketingCenterProvider(),
  2950 + child: OrderSettingManagerPage());
  2951 +});
  2952 +
2934 //客户通知配置页 2953 //客户通知配置页
2935 var customerNoticeSettingPageHandle = new Handler( 2954 var customerNoticeSettingPageHandle = new Handler(
2936 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 2955 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
@@ -2946,3 +2965,35 @@ var customerNoticeSettingPageHandle = new Handler( @@ -2946,3 +2965,35 @@ var customerNoticeSettingPageHandle = new Handler(
2946 create: (_) => MarketingCenterProvider(), 2965 create: (_) => MarketingCenterProvider(),
2947 child: CustomerNoticeSettingPage()); 2966 child: CustomerNoticeSettingPage());
2948 }); 2967 });
  2968 +
  2969 +//客户通知----优惠券配置页
  2970 +var couponSettingPageHandle = new Handler(
  2971 + handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  2972 + // String year = params["year"].first;
  2973 + // String month = params["month"].first;
  2974 + // String day = params["day"].first;
  2975 + // String uid = params["uid"].first;
  2976 +
  2977 + // DayList daylist = DayList.fromJson(json
  2978 + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["daylist"].first)));
  2979 +
  2980 + return ChangeNotifierProvider<MarketingCenterProvider>(
  2981 + create: (_) => MarketingCenterProvider(),
  2982 + child: ChangeNotifierProvider<CouponProvider>(
  2983 + create: (_) => CouponProvider(), child: CouponSettingPage()));
  2984 +});
  2985 +
  2986 +//客户通知----充值优惠配置页
  2987 +var rechargeSettingPageHandle = new Handler(
  2988 + handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  2989 + // String year = params["year"].first;
  2990 + // String month = params["month"].first;
  2991 + // String day = params["day"].first;
  2992 + // String uid = params["uid"].first;
  2993 +
  2994 + // DayList daylist = DayList.fromJson(json
  2995 + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["daylist"].first)));
  2996 +
  2997 + return ChangeNotifierProvider<MarketingCenterProvider>(
  2998 + create: (_) => MarketingCenterProvider(), child: RechargeSettingPage());
  2999 +});
@@ -282,6 +282,12 @@ class Routes { @@ -282,6 +282,12 @@ class Routes {
282 static String customer_notice_setting_page = 282 static String customer_notice_setting_page =
283 "/customer_notice_setting_page"; // 客户通知配置页 283 "/customer_notice_setting_page"; // 客户通知配置页
284 284
  285 + static String order_setting_manager_page =
  286 + "/order_setting_manager_page"; // 经理排菜配置页
  287 +
  288 + static String coupon_setting_page = "/coupon_setting_page"; // 优惠券设置页
  289 + static String recharge_setting_page = "/recharge_setting_page"; // 充值优惠设置页
  290 +
285 static void configureRoutes(FluroRouter router) { 291 static void configureRoutes(FluroRouter router) {
286 router.notFoundHandler = new Handler( 292 router.notFoundHandler = new Handler(
287 handlerFunc: (BuildContext context, Map<String, List<String>> params) { 293 handlerFunc: (BuildContext context, Map<String, List<String>> params) {
@@ -520,7 +526,14 @@ class Routes { @@ -520,7 +526,14 @@ class Routes {
520 router.define(month_order_page, handler: monthOrderPageHandle); 526 router.define(month_order_page, handler: monthOrderPageHandle);
521 router.define(day_order_page, handler: dayOrderPageHandle); 527 router.define(day_order_page, handler: dayOrderPageHandle);
522 router.define(order_setting_page, handler: orderSettingPageHandle); 528 router.define(order_setting_page, handler: orderSettingPageHandle);
523 - router.define(customer_notice_setting_page, handler: customerNoticeSettingPageHandle);  
524 - 529 + router.define(customer_notice_setting_page,
  530 + handler: customerNoticeSettingPageHandle);
  531 +
  532 + router.define(order_setting_manager_page,
  533 + handler: orderSettingManagerPageHandle);
  534 +
  535 + router.define(coupon_setting_page, handler: couponSettingPageHandle);
  536 +
  537 + router.define(recharge_setting_page, handler: rechargeSettingPageHandle);
525 } 538 }
526 } 539 }
@@ -85,7 +85,9 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget { @@ -85,7 +85,9 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget {
85 ? InkWell( 85 ? InkWell(
86 onTap: onTapRight, 86 onTap: onTapRight,
87 child: Padding( 87 child: Padding(
88 - padding: EdgeInsets.only(right: ScreenUtil().setWidth(40)), 88 + padding: EdgeInsets.only(
  89 + left: ScreenUtil().setWidth(40),
  90 + right: ScreenUtil().setWidth(40)),
89 child: rightImgName.endsWith('png') 91 child: rightImgName.endsWith('png')
90 ? Image.asset( 92 ? Image.asset(
91 Utils.getImgPath( 93 Utils.getImgPath(