Commit 536a7465e24d49fbd4391059457d44e2a28283e1

Authored by wdn127929
1 parent b073674f

设置预订定金

@@ -56,6 +56,9 @@ class GetDzSellerConfSunModel { @@ -56,6 +56,9 @@ class GetDzSellerConfSunModel {
56 String isAllowUpdate; 56 String isAllowUpdate;
57 List<String> isShowRnamePhone; 57 List<String> isShowRnamePhone;
58 58
  59 + String isShowNoticeDeposit;
  60 + String depositPrice;
  61 +
59 GetDzSellerConfSunModel( 62 GetDzSellerConfSunModel(
60 {this.id, 63 {this.id,
61 this.sid, 64 this.sid,
@@ -81,7 +84,9 @@ class GetDzSellerConfSunModel { @@ -81,7 +84,9 @@ class GetDzSellerConfSunModel {
81 this.saiyouyun, 84 this.saiyouyun,
82 this.bookinginfo, 85 this.bookinginfo,
83 this.isAllowUpdate, 86 this.isAllowUpdate,
84 - this.isShowRnamePhone}); 87 + this.isShowRnamePhone,
  88 + this.isShowNoticeDeposit,
  89 + this.depositPrice});
85 90
86 GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) { 91 GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) {
87 id = json['id']; 92 id = json['id'];
@@ -121,6 +126,8 @@ class GetDzSellerConfSunModel { @@ -121,6 +126,8 @@ class GetDzSellerConfSunModel {
121 isShowRnamePhone.add(v); 126 isShowRnamePhone.add(v);
122 }); 127 });
123 } 128 }
  129 + isShowNoticeDeposit = json['is_show_notice_deposit'];
  130 + depositPrice = json['deposit_price'];
124 } 131 }
125 132
126 Map<String, dynamic> toJson() { 133 Map<String, dynamic> toJson() {
@@ -152,6 +159,8 @@ class GetDzSellerConfSunModel { @@ -152,6 +159,8 @@ class GetDzSellerConfSunModel {
152 } 159 }
153 data['is_allow_update'] = this.isAllowUpdate; 160 data['is_allow_update'] = this.isAllowUpdate;
154 data['is_show_ranme_phone'] = this.isShowRnamePhone; 161 data['is_show_ranme_phone'] = this.isShowRnamePhone;
  162 + data['is_show_notice_deposit'] = this.isShowNoticeDeposit;
  163 + data['deposit_price'] = this.depositPrice;
155 return data; 164 return data;
156 } 165 }
157 } 166 }
@@ -169,6 +169,10 @@ class Data extends Object { @@ -169,6 +169,10 @@ class Data extends Object {
169 @JsonKey(name: 'daily') 169 @JsonKey(name: 'daily')
170 Daily dailyShow; 170 Daily dailyShow;
171 171
  172 +
  173 + @JsonKey(name: 'applyment_sub_mchid')
  174 + String applymentSubMchid;
  175 +
172 Data( 176 Data(
173 this.id, 177 this.id,
174 this.pid, 178 this.pid,
@@ -211,7 +215,8 @@ class Data extends Object { @@ -211,7 +215,8 @@ class Data extends Object {
211 this.sellerCode, 215 this.sellerCode,
212 this.realAddress, 216 this.realAddress,
213 this.edate, 217 this.edate,
214 - this.dailyShow 218 + this.dailyShow,
  219 + this.applymentSubMchid
215 ); 220 );
216 221
217 factory Data.fromJson(Map<String, dynamic> srcJson) => 222 factory Data.fromJson(Map<String, dynamic> srcJson) =>
@@ -81,6 +81,7 @@ Data _$DataFromJson(Map<String, dynamic> json) { @@ -81,6 +81,7 @@ Data _$DataFromJson(Map<String, dynamic> json) {
81 ? null 81 ? null
82 : Daily.fromJson( 82 : Daily.fromJson(
83 convert.jsonDecode(json['daily']) as Map<String, dynamic>), 83 convert.jsonDecode(json['daily']) as Map<String, dynamic>),
  84 + json['applyment_sub_mchid'] as String,
84 ); 85 );
85 } 86 }
86 87
@@ -126,6 +127,7 @@ Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{ @@ -126,6 +127,7 @@ Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{
126 'seller_code': instance.sellerCode, 127 'seller_code': instance.sellerCode,
127 'real_address': instance.realAddress, 128 'real_address': instance.realAddress,
128 'edate': instance.edate, 129 'edate': instance.edate,
  130 + 'applyment_sub_mchid':instance.applymentSubMchid
129 }; 131 };
130 Daily _$DailyFromJson(Map<String, dynamic> json) { 132 Daily _$DailyFromJson(Map<String, dynamic> json) {
131 return Daily(json['morning'] as String, json['noon'] as String, 133 return Daily(json['morning'] as String, json['noon'] as String,
@@ -1681,7 +1681,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -1681,7 +1681,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
1681 style: TextStyle(color: MyColours.color_515151, fontSize: font(15)), 1681 style: TextStyle(color: MyColours.color_515151, fontSize: font(15)),
1682 ), 1682 ),
1683 Spacer(), 1683 Spacer(),
1684 - RoundButton( 1684 + if(detailModel.reserveDepositList.length==0) RoundButton(
1685 text: '添加一项', 1685 text: '添加一项',
1686 radius: r(11), 1686 radius: r(11),
1687 width: w(72), 1687 width: w(72),
@@ -378,6 +378,40 @@ class _MarketingCenterHomePageState extends State<MarketingCenterHomePage> { @@ -378,6 +378,40 @@ class _MarketingCenterHomePageState extends State<MarketingCenterHomePage> {
378 child: MyDivider(double.infinity, w(0.5), 378 child: MyDivider(double.infinity, w(0.5),
379 color: MyColours.color_E7E7E7)), 379 color: MyColours.color_E7E7E7)),
380 VEmptyView(24), 380 VEmptyView(24),
  381 + InkWell(
  382 + onTap: () {
  383 + NavigatorUtil.goPaymentSettingPage(context);
  384 + },
  385 + child: Padding(
  386 + padding: EdgeInsets.only(
  387 + left: w(16),
  388 + top: w(12),
  389 + bottom: w(12),
  390 + right: w(12)),
  391 + child: Row(
  392 + children: [
  393 + Text(
  394 + '预订订金',
  395 + style: TextStyle(
  396 + color: MyColours.color_515151,
  397 + fontSize: ScreenUtil().setWidth(32)),
  398 + ),
  399 + Spacer(),
  400 + Container(
  401 + padding: EdgeInsets.symmetric(
  402 + horizontal: w(7), vertical: w(4)),
  403 + child: Image.asset(
  404 + "assets/arrow_right_new.png",
  405 + width: ScreenUtil().setWidth(18),
  406 + height: ScreenUtil().setWidth(32),
  407 + ),
  408 + )
  409 + ],
  410 + ))),
  411 + Padding(
  412 + padding: EdgeInsets.only(left: w(16)),
  413 + child: MyDivider(double.infinity, w(0.5),
  414 + color: MyColours.color_E7E7E7)),
381 // InkWell( 415 // InkWell(
382 // onTap: () { 416 // onTap: () {
383 // setState(() { 417 // setState(() {
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter/services.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:one_key/provider/marketing_center_provider.dart';
  5 +import 'package:one_key/widgets/system_app_bar.dart';
  6 +import 'package:provider/provider.dart';
  7 +
  8 +import '../../../provider/store_base_info_provider.dart';
  9 +import '../../../provider/user_model.dart';
  10 +import '../../../res/colors.dart';
  11 +import '../../../utils/MyNumberTextInputFormatter.dart';
  12 +import '../../../utils/screen_util.dart';
  13 +import '../../../utils/utils.dart';
  14 +import '../../../widgets/MyDivider.dart';
  15 +import '../../../widgets/h_empty_view.dart';
  16 +import '../../../widgets/round_button.dart';
  17 +import '../../../widgets/v_empty_view.dart';
  18 +
  19 +/**
  20 + * 订金设置
  21 + */
  22 +class PaymentSettingPage extends StatefulWidget {
  23 + const PaymentSettingPage();
  24 +
  25 + @override
  26 + State<PaymentSettingPage> createState() => _PaymentSettingPageState();
  27 +}
  28 +
  29 +class _PaymentSettingPageState extends State<PaymentSettingPage> {
  30 + bool isPayment = false; //默认关闭
  31 +
  32 + TextEditingController moneyControl = TextEditingController();
  33 + FocusNode moneyFocusNode = FocusNode();
  34 +
  35 + MarketingCenterProvider marketingCenterProvider;
  36 +
  37 + @override
  38 + void initState() {
  39 + super.initState();
  40 +
  41 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  42 + _getDzSellerConf();
  43 + });
  44 + }
  45 +
  46 + _getDzSellerConf() async {
  47 + await marketingCenterProvider.getDzSellerConf(context);
  48 + if (marketingCenterProvider.dzSellerConfModel != null) {
  49 + isPayment =
  50 + marketingCenterProvider.dzSellerConfModel.isShowNoticeDeposit == '1'
  51 + ? true
  52 + : false;
  53 + moneyControl.text =
  54 + marketingCenterProvider.dzSellerConfModel.depositPrice ?? '';
  55 + setState(() {});
  56 + }
  57 + }
  58 +
  59 + ///保存接口
  60 + _setData() async {
  61 + Future.wait<bool>([
  62 + _setIsShowNoticeDeposit(),
  63 +
  64 + _setDepositPrice(),
  65 + ]).then((results) {
  66 + print(results[0]);
  67 + if (results[0] && results[1]) {
  68 + Utils.showToast('设置成功');
  69 + Navigator.pop(context);
  70 + }
  71 + }).catchError((e) {
  72 + Utils.showToast('设置失败,请重试');
  73 + print(e);
  74 + });
  75 + }
  76 +
  77 + ///获取店铺过期时间
  78 + _getSellerById() async {
  79 + StoreBaseIndoProvider storeBaseIndoProvider =
  80 + Provider.of<StoreBaseIndoProvider>(context, listen: false);
  81 + await storeBaseIndoProvider.getSellerById(context);
  82 + if (storeBaseIndoProvider.itemModel != null) {
  83 + String applymentSubMchid =
  84 + storeBaseIndoProvider.itemModel.data.applymentSubMchid;
  85 + if (applymentSubMchid != null && applymentSubMchid != '') {
  86 + //商家开通了微信支付
  87 + _setData();
  88 + } else {
  89 + //商家未开通微信支付
  90 + Utils.showToast('商家未开通微信支付功能!');
  91 + }
  92 + }
  93 + }
  94 +
  95 + ///使用店铺手机发送营销短信
  96 + Future<bool> _setIsShowNoticeDeposit({bool isShowLoading = true}) async {
  97 + Map<String, String> params = {
  98 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  99 + 'key': 'is_show_notice_deposit',
  100 + 'value': isPayment ? '1' : '0'
  101 + };
  102 +
  103 + bool success = await marketingCenterProvider.setConfing(context, params,
  104 + needToast: false);
  105 +
  106 + if (success) {
  107 + return true;
  108 + } else {
  109 + return false;
  110 + }
  111 + }
  112 +
  113 + ///使用店铺手机发送通知短信
  114 + Future<bool> _setDepositPrice({bool isShowLoading = true}) async {
  115 + if(moneyControl.text.trim().length > 0){
  116 + Map<String, String> params = {
  117 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  118 + 'key': 'deposit_price',
  119 + 'value': moneyControl.text
  120 + };
  121 +
  122 + bool success = await marketingCenterProvider.setConfing(context, params,
  123 + needToast: false);
  124 +
  125 + if (success) {
  126 + return true;
  127 + } else {
  128 + return false;
  129 + }
  130 + }else{
  131 + return true;
  132 + }
  133 +
  134 + }
  135 +
  136 + ///输入框
  137 + Widget _textfieldSelect(
  138 + String title,
  139 + String hintText,
  140 + TextEditingController controller,
  141 + FocusNode focusNode, {
  142 + TextInputType textInputType = TextInputType.text,
  143 + String subtitle = '',
  144 + }) {
  145 + return Container(
  146 + padding: EdgeInsets.only(left: w(20), right: (w(20))),
  147 + child: Row(
  148 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  149 + children: [
  150 + Container(
  151 + child: Text(
  152 + title,
  153 + style: TextStyle(
  154 + color: MyColours.color_515151,
  155 + fontSize: ScreenUtil().setSp(32)),
  156 + ),
  157 + ),
  158 + HEmptyView(40),
  159 + Expanded(
  160 + child: TextField(
  161 + controller: controller,
  162 + textAlign: TextAlign.right,
  163 + textAlignVertical: TextAlignVertical.bottom,
  164 + maxLines: 1,
  165 + inputFormatters: title == '预订订金金额'
  166 + ? [
  167 + FilteringTextInputFormatter(RegExp("[0-9.]"),
  168 + allow: true),
  169 + MyNumberTextInputFormatter(digit: 2),
  170 + ]
  171 + : [],
  172 + // //光标颜色
  173 + // cursorColor:
  174 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  175 + //输入文本的样式
  176 + style: TextStyle(
  177 + color: MyColours.color_515151,
  178 + fontSize: ScreenUtil().setSp(32),
  179 + ),
  180 + focusNode: focusNode,
  181 + decoration: InputDecoration(
  182 + isCollapsed: true,
  183 + border: OutlineInputBorder(borderSide: BorderSide.none),
  184 + hintText: hintText,
  185 + hintStyle: TextStyle(
  186 + color: MyColours.color_999999,
  187 + fontSize: ScreenUtil().setSp(32),
  188 + ),
  189 + enabledBorder: new UnderlineInputBorder(
  190 + borderSide: BorderSide.none,
  191 + ),
  192 + focusedBorder: new UnderlineInputBorder(
  193 + borderSide: BorderSide.none,
  194 + ),
  195 + ),
  196 + onChanged: (value) {},
  197 + onEditingComplete: () {
  198 + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  199 + },
  200 + keyboardType: textInputType),
  201 + ),
  202 + if (subtitle != '') HEmptyView(6),
  203 + Text(
  204 + subtitle,
  205 + style: TextStyle(
  206 + color: MyColours.color_515151,
  207 + fontSize: ScreenUtil().setSp(32)),
  208 + ),
  209 + ],
  210 + ),
  211 + );
  212 + }
  213 +
  214 + @override
  215 + Widget build(BuildContext context) {
  216 + marketingCenterProvider =
  217 + Provider.of<MarketingCenterProvider>(context, listen: false);
  218 + return Scaffold(
  219 + backgroundColor: MyColours.color_ffffff,
  220 + appBar: SystemAppBar('预订订金'),
  221 + body: Column(
  222 + children: [
  223 + Expanded(
  224 + child: SingleChildScrollView(
  225 + child: Column(
  226 + children: [
  227 + InkWell(
  228 + onTap: () {
  229 + setState(() {
  230 + isPayment = !isPayment;
  231 + });
  232 + },
  233 + child: Padding(
  234 + padding: EdgeInsets.only(
  235 + left: w(16),
  236 + top: w(12),
  237 + bottom: w(11),
  238 + right: w(12)),
  239 + child: Row(
  240 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  241 + children: [
  242 + Text(
  243 + '在客户预订通知中,增加支付订金功能',
  244 + style: TextStyle(
  245 + color: MyColours.color_515151,
  246 + fontSize: font(16)),
  247 + ),
  248 + Spacer(),
  249 + Container(
  250 + padding: EdgeInsets.symmetric(
  251 + horizontal: w(7), vertical: w(4)),
  252 + child: Image.asset(
  253 + Utils.getImgPath(
  254 + isPayment ? 'swich_on' : 'swich_off'),
  255 + width: w(44),
  256 + ),
  257 + )
  258 + // RoundButton(
  259 + // text: '预览',
  260 + // gradientStart: MyColours.color_ffffff,
  261 + // gradientEnd: MyColours.color_ffffff,
  262 + // borderColor: MyColours.color_438E93,
  263 + // textColor: MyColours.color_438E93,
  264 + // radius: ScreenUtil().setWidth(22),
  265 + // fontSize: 24,
  266 + // width: w(72),
  267 + // height: ScreenUtil().setWidth(44),
  268 + // isBold: true,
  269 + // onPressed: () {
  270 + // NavigatorUtil.goMarkingPreviewPage(context);
  271 + // },
  272 + // ),
  273 + ]))),
  274 + // VEmptyView(24),
  275 + Padding(
  276 + padding: EdgeInsets.only(left: w(16)),
  277 + child: MyDivider(double.infinity, w(0.5),
  278 + color: MyColours.color_E7E7E7)),
  279 + VEmptyView(48),
  280 + _textfieldSelect(
  281 + '预订订金金额', '点击输入订金金额', moneyControl, moneyFocusNode,
  282 + subtitle: '',
  283 + textInputType: TextInputType.numberWithOptions()),
  284 + VEmptyView(22),
  285 + Padding(
  286 + padding: EdgeInsets.only(left: w(16)),
  287 + child: MyDivider(double.infinity, w(0.5),
  288 + color: MyColours.color_E7E7E7)),
  289 + ],
  290 + ),
  291 + )),
  292 + Container(
  293 + color: MyColours.color_ffffff,
  294 + padding: EdgeInsets.only(
  295 + left: w(45), right: w(45), top: w(12), bottom: w(25)),
  296 + child: RoundButton(
  297 + text: '保存',
  298 + gradientStart: MyColours.color_199095,
  299 + gradientEnd: MyColours.color_199095,
  300 + // borderColor: MyColours.color_999999,
  301 + radius: r(5),
  302 + fontSize: 34,
  303 + height: w(40),
  304 + isBold: true,
  305 + onPressed: () async {
  306 + FocusScope.of(context)
  307 + .requestFocus(FocusNode()); //隐藏键盘
  308 +
  309 + _getSellerById();
  310 + },
  311 + ),
  312 + )
  313 + ],
  314 + ));
  315 + }
  316 +}
@@ -2148,4 +2148,14 @@ class NavigatorUtil { @@ -2148,4 +2148,14 @@ class NavigatorUtil {
2148 return _navigateTo(context, "${Routes.invication_addition_page}?rid=$rid", 2148 return _navigateTo(context, "${Routes.invication_addition_page}?rid=$rid",
2149 replace: replace); 2149 replace: replace);
2150 } 2150 }
  2151 +
  2152 + //预订信息模块设置-自定义图文默认
  2153 + static Future<dynamic> goPaymentSettingPage(
  2154 + BuildContext context, {
  2155 +
  2156 + replace = false,
  2157 + }) {
  2158 + return _navigateTo(context, "${Routes.payment_setting_page}",
  2159 + replace: replace);
  2160 + }
2151 } 2161 }
@@ -230,6 +230,7 @@ import '../pages/my/marketing_center/invitation_theme_home_preview_page.dart'; @@ -230,6 +230,7 @@ import '../pages/my/marketing_center/invitation_theme_home_preview_page.dart';
230 import '../pages/my/marketing_center/marketing_center_home_page.dart'; 230 import '../pages/my/marketing_center/marketing_center_home_page.dart';
231 import '../pages/my/marketing_center/order_setting_manager_page.dart'; 231 import '../pages/my/marketing_center/order_setting_manager_page.dart';
232 import '../pages/my/marketing_center/order_setting_page.dart'; 232 import '../pages/my/marketing_center/order_setting_page.dart';
  233 +import '../pages/my/marketing_center/payment_setting_page.dart';
233 import '../pages/my/marketing_center/recharge/recharge_detail_page.dart'; 234 import '../pages/my/marketing_center/recharge/recharge_detail_page.dart';
234 import '../pages/my/marketing_center/recharge/recharge_edit_page.dart'; 235 import '../pages/my/marketing_center/recharge/recharge_edit_page.dart';
235 import '../pages/my/marketing_center/recharge/recharge_history_page.dart'; 236 import '../pages/my/marketing_center/recharge/recharge_history_page.dart';
@@ -3689,3 +3690,22 @@ var invicationAdditionPageHandle = new Handler( @@ -3689,3 +3690,22 @@ var invicationAdditionPageHandle = new Handler(
3689 create: (_) => MarketingCenterProvider(), 3690 create: (_) => MarketingCenterProvider(),
3690 child: InvicationAdditionPage(rid)); 3691 child: InvicationAdditionPage(rid));
3691 }); 3692 });
  3693 +
  3694 +
  3695 +
  3696 +///在客户预订通知中,增加支付订金功能
  3697 +var paymentSettingPageHandle = new Handler(
  3698 + handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  3699 + // String rid = params["rid"].first;
  3700 + // // String smsTemplate = params["smsTemplate"].first;
  3701 + // CouponUse use = CouponUse.fromJson(
  3702 + // json.decode(FluroConvertUtils.fluroCnParamsDecode(params["use"].first)));
  3703 + // CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
  3704 + // FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
  3705 + return ChangeNotifierProvider<MarketingCenterProvider>(
  3706 + create: (_) => MarketingCenterProvider(),
  3707 + child: ChangeNotifierProvider<StoreBaseIndoProvider>(
  3708 + create: (_) => StoreBaseIndoProvider(),
  3709 + child:PaymentSettingPage()));
  3710 +
  3711 +});
@@ -378,6 +378,10 @@ static String customer_detail_page_sim = "/customer_detail_page_sim"; //å®¢æˆ·è¯ @@ -378,6 +378,10 @@ static String customer_detail_page_sim = "/customer_detail_page_sim"; //客户è¯
378 static String invication_addition_page = 378 static String invication_addition_page =
379 "/invication_addition_page"; //预订信息模块设置-自定义图文默认 379 "/invication_addition_page"; //预订信息模块设置-自定义图文默认
380 380
  381 + static String payment_setting_page =
  382 + "/payment_setting_page"; //在客户预订通知中,增加支付订金功能
  383 +
  384 +
381 385
382 386
383 387
@@ -709,6 +713,9 @@ router.define(invication_sim, handler: handleInvicationSimHandler); @@ -709,6 +713,9 @@ router.define(invication_sim, handler: handleInvicationSimHandler);
709 router.define(month_order_home_page, handler: monthOrderHomePageHandle); 713 router.define(month_order_home_page, handler: monthOrderHomePageHandle);
710 714
711 router.define(invication_addition_page, handler: invicationAdditionPageHandle); 715 router.define(invication_addition_page, handler: invicationAdditionPageHandle);
  716 + router.define(payment_setting_page, handler: paymentSettingPageHandle);
  717 +
  718 +
712 719
713 720
714 721