Commit 558b3e323a4c7383059145e27c0faad24b5014a0

Authored by wdn127929
1 parent 02a21966

配置录入电话姓名开关

... ... @@ -54,6 +54,7 @@ class GetDzSellerConfSunModel {
String saiyouyun;
Bookinginfo bookinginfo;
String isAllowUpdate;
List<String> isShowRnamePhone;
GetDzSellerConfSunModel(
{this.id,
... ... @@ -79,7 +80,8 @@ class GetDzSellerConfSunModel {
this.isMarketing,
this.saiyouyun,
this.bookinginfo,
this.isAllowUpdate});
this.isAllowUpdate,
this.isShowRnamePhone});
GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
... ... @@ -110,6 +112,15 @@ class GetDzSellerConfSunModel {
? new Bookinginfo.fromJson(json['bookinginfo'])
: null;
isAllowUpdate = json['is_allow_update'] ?? '1';
isShowRnamePhone = [];
if (json['is_show_ranme_phone'] != null &&
json['is_show_ranme_phone'] != '') {
convert.json.decode(json['is_show_ranme_phone']).forEach((v) {
isShowRnamePhone.add(v);
});
}
}
Map<String, dynamic> toJson() {
... ... @@ -140,7 +151,29 @@ class GetDzSellerConfSunModel {
data['bookinginfo'] = this.bookinginfo.toJson();
}
data['is_allow_update'] = this.isAllowUpdate;
data['is_show_ranme_phone'] = this.isShowRnamePhone;
return data;
}
}
class InputSetting {
String uid;
String isShowName;
String isShowPhone;
InputSetting({this.uid, this.isShowName, this.isShowPhone});
InputSetting.fromJson(Map<String, dynamic> json) {
uid = json['uid'];
isShowName = json['is_show_name'];
isShowPhone = json['is_show_phone'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['uid'] = this.uid;
data['is_show_name'] = this.isShowName;
data['is_show_phone'] = this.isShowPhone;
return data;
}
}
... ...
... ... @@ -308,6 +308,11 @@ class InvicationPageState extends State<InvicationPage>
bus.on("refresh_photo_invication", (args) {
_getTablesPhoto();
});
bus.on("getDzSellerConf", (args) {
getDzSellerConf();
});
// Utils.changeStatusColor(color: Colors.transparent);
... ... @@ -424,6 +429,9 @@ class InvicationPageState extends State<InvicationPage>
bus.off("refresh_coupon_invitation");
bus.off("refresh_invitaion_info");
bus.off("refresh_photo_invication");
bus.off("getDzSellerConf");
WidgetsBinding.instance.removeObserver(this); //销毁观察者
if (_timer != null) {
_timer.cancel();
... ... @@ -5215,11 +5223,18 @@ class InvicationPageState extends State<InvicationPage>
myModel = Provider.of<MyModel>(context, listen: true);
return SafeArea(
child: Scaffold(
appBar: SystemAppBar('预订安排', titleColor: MyColours.color_438E93,
onTap: () {
needBack = true;
_showConfirmWidget(needBack: true);
}),
appBar: SystemAppBar(
'预订安排',
titleColor: MyColours.color_438E93,
onTap: () {
needBack = true;
_showConfirmWidget(needBack: true);
},
rightImgName: 'set_g.png',
onTapRight: () {
NavigatorUtil.goInputNamePhoneSettingPage(context);
},
),
backgroundColor: Colors.white,
// resizeToAvoidBottomInset: false,
body: InkWell(
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/GetDzSellerConfModel.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:provider/provider.dart';
import '../../provider/marketing_center_provider.dart';
import '../../provider/user_model.dart';
import '../../res/colors.dart';
import '../../utils/event_bus.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/MyDivider.dart';
import '../../widgets/round_button.dart';
import 'dart:convert';
/**
* 姓名和电话输入的时候是否需要自动匹配
*/
class InputNamePhoneSettingPage extends StatefulWidget {
InputNamePhoneSettingPage({Key key}) : super(key: key);
... ... @@ -10,12 +26,164 @@ class InputNamePhoneSettingPage extends StatefulWidget {
}
class _InputNamePhoneSettingPageState extends State<InputNamePhoneSettingPage> {
bool nameSwich = true;
bool phoneSwich = true;
MarketingCenterProvider marketingCenterProvider;
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
getDzSellerConf();
});
}
getDzSellerConf() async {
bool success = await marketingCenterProvider.getDzSellerConf(context);
if (success && marketingCenterProvider.dzSellerConfModel != null) {
if (marketingCenterProvider.dzSellerConfModel.isShowRnamePhone.length >
0) {
String uid = Provider.of<UserModel>(context, listen: false).user.openid;
marketingCenterProvider.dzSellerConfModel.isShowRnamePhone
.forEach((element) {
List subdata = element.split('-');
if (subdata[0] == uid) {
//设置过
phoneSwich = subdata[1] == '1' ? true : false;
nameSwich = subdata[2] == '1' ? true : false;
setState(() {});
}
});
}
}
}
Widget _itemSmsWidget(bool isSelect, String title,
{GestureTapCallback onTap}) {
return Column(
children: [
InkWell(
onTap: onTap,
child: Padding(
padding: EdgeInsets.only(
left: w(16), top: w(14), bottom: w(3), right: w(12)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: TextStyle(
color: MyColours.color_515151, fontSize: font(14)),
),
Spacer(),
Container(
margin: EdgeInsets.symmetric(
horizontal: w(7), vertical: w(4)),
child: Image.asset(
Utils.getImgPath(isSelect ? 'swich_on' : 'swich_off'),
width: w(44),
),
)
// RoundButton(
// text: '预览',
// gradientStart: MyColours.color_ffffff,
// gradientEnd: MyColours.color_ffffff,
// borderColor: MyColours.color_438E93,
// textColor: MyColours.color_438E93,
// radius: ScreenUtil().setWidth(22),
// fontSize: 24,
// width: w(72),
// height: ScreenUtil().setWidth(44),
// isBold: true,
// onPressed: () {
// NavigatorUtil.goMarkingPreviewPage(context);
// },
// ),
]))),
Padding(
padding: EdgeInsets.only(left: w(16)),
child: MyDivider(double.infinity, w(0.5),
color: MyColours.color_E7E7E7)),
],
);
}
_setConfing() async {
List<String> setting =
marketingCenterProvider.dzSellerConfModel.isShowRnamePhone;
String uid = Provider.of<UserModel>(context, listen: false).user.openid;
marketingCenterProvider.dzSellerConfModel.isShowRnamePhone
.forEach((element) {
List subdata = element.split('-');
if (subdata[0] == uid) {
//设置过
setting.remove(element); //如果有,则移除,重新设置
}
});
String inputSetting =
'${uid}-${phoneSwich ? '1' : '0'}-${nameSwich ? '1' : '0'}';
setting.add(inputSetting);
bool success = await marketingCenterProvider.setConfing(
context,
{
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'key': 'is_show_ranme_phone',
'value': json.encode(setting)
},
needToast: false);
if (success) {
//刷新预订安排页面的配置
bus.emit('getDzSellerConf');
Navigator.pop(context);
}
}
@override
Widget build(BuildContext context) {
marketingCenterProvider =
Provider.of<MarketingCenterProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar('信息录入辅助设置'),
body: SingleChildScrollView(
body: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
_itemSmsWidget(phoneSwich, '录入电话号码时,自动填充已有客户信息', onTap: () {
setState(() {
phoneSwich = !phoneSwich;
});
}),
_itemSmsWidget(nameSwich, '录入客户姓名时,自动填充已有电话信息', onTap: () {
setState(() {
nameSwich = !nameSwich;
});
}),
],
),
)),
Container(
padding: EdgeInsets.only(
left: w(45), top: w(12), bottom: w(25), right: w(45)),
child: RoundButton(
text: '保存',
// width: ScreenUtil().setWidth(280 * 2),
height: ScreenUtil().setWidth(41 * 2),
radius: ScreenUtil().setWidth(10),
isBold: true,
fontSize: 32,
onPressed: () {
_setConfing();
}))
],
),
);
}
... ...
... ... @@ -268,8 +268,10 @@ class NavigatorUtil {
}
/// 优惠券历史列表
static void goCouponHistoryPage(BuildContext context,int index, {replace = false}) {
_navigateTo(context, "${Routes.coupon_history}?index=${index}", replace: replace);
static void goCouponHistoryPage(BuildContext context, int index,
{replace = false}) {
_navigateTo(context, "${Routes.coupon_history}?index=${index}",
replace: replace);
}
/// 创建优惠券
... ... @@ -1917,4 +1919,13 @@ class NavigatorUtil {
"${Routes.coupon_poster_page}?id=$id&use=${FluroConvertUtils.object2string(use)}&couponSunModel=${FluroConvertUtils.object2string(couponSunModel)}",
replace: replace);
}
///录入姓名和电话是否自动提示设置
static Future<dynamic> goInputNamePhoneSettingPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.input_name_phone_setting_page}",
replace: replace);
}
}
... ...
... ... @@ -208,6 +208,7 @@ import '../pages/my/feast_manage/feast_setmeal_manage_edit_page.dart';
import '../pages/my/feast_manage/feast_type_page.dart';
import '../pages/my/feast_manage/feast_wine_manage_edit_page.dart';
import '../pages/my/feast_manage/feast_wine_manage_page.dart';
import '../pages/my/input_name_phone_setting_page.dart';
import '../pages/my/marketing_center/book_notification/book_info_page.dart';
import '../pages/my/marketing_center/book_notification/chef_introduce_page.dart';
import '../pages/my/marketing_center/book_notification/dish_show_page.dart';
... ... @@ -2357,7 +2358,6 @@ var orderEditListShowPageHandle = new Handler(
oftenList.add(MenuSunModel.fromJson2(item));
}
}
String planPrice = params["planPrice"].first;
... ... @@ -3257,3 +3257,18 @@ var couponPosterPageHandle = new Handler(
child:
CouponPosterPage(id: id, use: use, couponSunModel: couponSunModel));
});
///姓名和电话录入是是否提示配置
var inputNamePhoneSettingPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
// String id = params["id"].first;
// // String smsTemplate = params["smsTemplate"].first;
// CouponUse use = CouponUse.fromJson(
// json.decode(FluroConvertUtils.fluroCnParamsDecode(params["use"].first)));
// CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
return ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(),
child: InputNamePhoneSettingPage());
});
... ...
... ... @@ -307,15 +307,13 @@ class Routes {
static String export_book_data_page = "/export_book_data_page"; //预订数据导出页面
static String sms_template_setting_page = "/sms_template_setting_page"; //短信模版设置
static String sms_template_setting_page =
"/sms_template_setting_page"; //短信模版设置
static String coupon_poster_page = "/coupon_poster_page"; //优惠券海报
static String input_name_phone_setting_page =
"/input_name_phone_setting_page"; //姓名和电话录入配置页
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -581,17 +579,15 @@ class Routes {
router.define(areas_select_page, handler: areasSelectPageHandle);
router.define(export_book_data_page, handler: exportBookDataPageHandle);
router.define(sms_template_setting_page, handler: smsTemplateSettingPageHandle);
router.define(coupon_poster_page, handler: couponPosterPageHandle);
router.define(export_book_data_page, handler: exportBookDataPageHandle);
router.define(sms_template_setting_page,
handler: smsTemplateSettingPageHandle);
router.define(coupon_poster_page, handler: couponPosterPageHandle);
router.define(input_name_phone_setting_page, handler: inputNamePhoneSettingPageHandle);
}
}
... ...