Commit 9b9762e7e73db7e38d93ff7e5930ff521b2e5acf

Authored by weixin_45529955
1 parent ba728755

hhh

import 'dart:convert';
import 'package:common_utils/common_utils.dart';
... ... @@ -160,12 +159,13 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
}
_getNewRechargeDetail() async {
bool success = await marketingCenterProvider!.getNewRechargeDetail(
context, widget.idstr);
bool success = await marketingCenterProvider!
.getNewRechargeDetail(context, widget.idstr);
if (success) {
//请求成功
nameC.text = marketingCenterProvider!.rechargeDetail!.rname??"";
priceminC.text = marketingCenterProvider!.rechargeDetail!.rechargeMoney??"";
nameC.text = marketingCenterProvider!.rechargeDetail!.rname ?? "";
priceminC.text =
marketingCenterProvider!.rechargeDetail!.rechargeMoney ?? "";
givePriceSwich =
marketingCenterProvider!.rechargeDetail!.rechargeList!.isPrice == '1'
? true
... ... @@ -179,13 +179,15 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
giveScoreC.text =
marketingCenterProvider!.rechargeDetail!.rechargeList!.score!;
giveCouponsSwich =
marketingCenterProvider!.rechargeDetail!.rechargeList!.isCoupons == '1'
marketingCenterProvider!.rechargeDetail!.rechargeList!.isCoupons ==
'1'
? true
: false;
selectIDs =
marketingCenterProvider!.rechargeDetail!.rechargeList!.couponsIds;
couponsData = marketingCenterProvider!.rechargeDetail!.rechargeList!.coupons;
couponsData =
marketingCenterProvider!.rechargeDetail!.rechargeList!.coupons;
coupons =
marketingCenterProvider!.rechargeDetail!.rechargeList!.couponsNames;
fixdate = marketingCenterProvider!.rechargeDetail!.expDate!.isFix == '1'
... ... @@ -201,13 +203,17 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
weekly = marketingCenterProvider!.rechargeDetail!.expDate!.isWeek == '1'
? true
: false;
if (marketingCenterProvider!.rechargeDetail!.expDate!.weekDateShow != '') {
weekShow = marketingCenterProvider!.rechargeDetail!.expDate!.weekDateShow!;
if (marketingCenterProvider!.rechargeDetail!.expDate!.weekDateShow !=
'') {
weekShow =
marketingCenterProvider!.rechargeDetail!.expDate!.weekDateShow!;
}
if (marketingCenterProvider!.rechargeDetail!.expDate!.weekDateData!.length >
if (marketingCenterProvider!
.rechargeDetail!.expDate!.weekDateData!.length >
0) {
weekData = marketingCenterProvider!.rechargeDetail!.expDate!.weekDateData;
weekData =
marketingCenterProvider!.rechargeDetail!.expDate!.weekDateData;
}
birthday =
... ... @@ -215,7 +221,7 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
? true
: false;
remarkC.text = marketingCenterProvider!.rechargeDetail!.explain??"";
remarkC.text = marketingCenterProvider!.rechargeDetail!.explain ?? "";
canUse =
marketingCenterProvider!.rechargeDetail!.isOpen == '1' ? true : false;
setState(() {});
... ... @@ -259,6 +265,7 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
textAlign: TextAlign.right,
textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
... ... @@ -540,8 +547,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
if (widget.idstr != null &&
widget.idstr != 'null' &&
marketingCenterProvider!.rechargeDetail!.isOpen == '1') {
Utils.goShareBuyRechargeToWeChat(
context, widget.idstr, marketingCenterProvider!.rechargeDetail!);
Utils.goShareBuyRechargeToWeChat(context, widget.idstr,
marketingCenterProvider!.rechargeDetail!);
}
},
),
... ... @@ -553,14 +560,37 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
padding: EdgeInsets.only(left: w(32)),
child: Column(
children: [
_textfield('活动名称', '点击输入活动名称', nameC, nameF),
Container(
padding: EdgeInsets.only(right: w(10)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
'活动名称',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(80),
Container(
child: Text(
'当餐免费',
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32)),
),
),
])),
// _textfield('活动名称', '点击输入活动名称', nameC, nameF),
MyDivider(
double.infinity,
w(1),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_textfield('充值满', '点击输入充值金额门槛', priceminC, priceminF,
_textfield('充值实际消费金额的倍数', '点击输入', priceminC, priceminF,
textInputStyle:
TextInputType.numberWithOptions(decimal: true)),
MyDivider(
... ... @@ -795,7 +825,7 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
.requestFocus(FocusNode());
Map? object = await NavigatorUtil
.goRechargeSelectStoreCouponPage(
context, selectIDs!.join(',')) ;
context, selectIDs!.join(','));
print(object);
if (object != null &&
object['couponsid'] != null) {
... ... @@ -852,230 +882,234 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
Container(
alignment: Alignment.centerLeft,
child: Text(
'使用限制:',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(24),
Row(
children: [
HEmptyView(30),
_itemRadioWidget(fixdate, '无', onTap: () {
if (!fixdate) {
setState(() {
fixdate = true;
weekly = false;
birthday = false;
});
}
}),
Spacer(),
_itemRadioWidget(weekly, '每周', onTap: () {
if (!weekly) {
setState(() {
weekly = true;
fixdate = false;
birthday = false;
});
}
}),
Spacer(),
_itemRadioWidget(birthday, '会员生日当天', onTap: () {
if (!birthday) {
setState(() {
birthday = true;
weekly = false;
fixdate = false;
});
}
}),
HEmptyView(30),
],
),
birthday ? SizedBox() : VEmptyView(24),
// fixdate
// ? Column(
// children: [
// _select('有效期从', fromDate, () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// //弹出时间选择器
// // showPickerDateTime(context);
// showDateSelWidget = true;
// DialogUtil.showPickerDateTime24(
// context,
// scaffoldKey,
// (value) {
// // {'text': picker.adapter.text, 'select': selecteds}
// if (value != null) {
// setState(() {
// print(value);
// fromDate = DateUtil.formatDateStr(
// value,
// format: DateFormats.y_mo_d);
// });
// }
// showDateSelWidget = false;
// },
// dateTime: DateUtil.getDateTime(fromDate),
// pickerDateTimeType: PickerDateTimeType.kYMD,
// onCancel: () {
// showDateSelWidget = false;
// });
// }),
// VEmptyView(24),
// _select('有效期至', endDate, () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// //弹出时间选择器
// // showPickerDateTime(context);
// showDateSelWidget = true;
// DialogUtil.showPickerDateTime24(
// context,
// scaffoldKey,
// (value) {
// // {'text': picker.adapter.text, 'select': selecteds}
// if (value != null) {
// setState(() {
// print(value);
// endDate = DateUtil.formatDateStr(
// value,
// format: DateFormats.y_mo_d);
// });
// }
// showDateSelWidget = false;
// },
// dateTime: DateUtil.getDateTime(endDate),
// pickerDateTimeType: PickerDateTimeType.kYMD,
// onCancel: () {
// showDateSelWidget = false;
// });
// })
// ],
// )
// : SizedBox(),
weekly
? _select(weekShow, '', () async {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
// showPickerDateTime(context);
showDateSelWidget = false;
// Container(
// alignment: Alignment.centerLeft,
// child: Text(
// '使用限制:',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// VEmptyView(24),
// Row(
// children: [
// HEmptyView(30),
// _itemRadioWidget(fixdate, '无', onTap: () {
// if (!fixdate) {
// setState(() {
// fixdate = true;
// weekly = false;
// birthday = false;
// });
// }
// }),
// Spacer(),
// _itemRadioWidget(weekly, '每周', onTap: () {
// if (!weekly) {
// setState(() {
// weekly = true;
// fixdate = false;
// birthday = false;
// });
// }
// }),
// Spacer(),
// _itemRadioWidget(birthday, '会员生日当天', onTap: () {
// if (!birthday) {
// setState(() {
// birthday = true;
// weekly = false;
// fixdate = false;
// });
// }
// }),
// HEmptyView(30),
// ],
// ),
// birthday ? SizedBox() : VEmptyView(24),
// // fixdate
// // ? Column(
// // children: [
// // _select('有效期从', fromDate, () {
// // FocusScope.of(context)
// // .requestFocus(FocusNode()); //点击空白处隐藏键盘
// // //弹出时间选择器
// // // showPickerDateTime(context);
// // showDateSelWidget = true;
// // DialogUtil.showPickerDateTime24(
// // context,
// // scaffoldKey,
// // (value) {
// // // {'text': picker.adapter.text, 'select': selecteds}
// // if (value != null) {
// // setState(() {
// // print(value);
// // fromDate = DateUtil.formatDateStr(
// // value,
// // format: DateFormats.y_mo_d);
// // });
// // }
// // showDateSelWidget = false;
// // },
// // dateTime: DateUtil.getDateTime(fromDate),
// // pickerDateTimeType: PickerDateTimeType.kYMD,
// // onCancel: () {
// // showDateSelWidget = false;
// // });
// // }),
// // VEmptyView(24),
// // _select('有效期至', endDate, () {
// // FocusScope.of(context)
// // .requestFocus(FocusNode()); //点击空白处隐藏键盘
// // //弹出时间选择器
// // // showPickerDateTime(context);
// // showDateSelWidget = true;
// // DialogUtil.showPickerDateTime24(
// // context,
// // scaffoldKey,
// // (value) {
// // // {'text': picker.adapter.text, 'select': selecteds}
// // if (value != null) {
// // setState(() {
// // print(value);
// // endDate = DateUtil.formatDateStr(
// // value,
// // format: DateFormats.y_mo_d);
// // });
// // }
// // showDateSelWidget = false;
// // },
// // dateTime: DateUtil.getDateTime(endDate),
// // pickerDateTimeType: PickerDateTimeType.kYMD,
// // onCancel: () {
// // showDateSelWidget = false;
// // });
// // })
// // ],
// // )
// // : SizedBox(),
// weekly
// ? _select(weekShow, '', () async {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// //弹出时间选择器
// // showPickerDateTime(context);
// showDateSelWidget = false;
List<FilterBtnModel> data =
await DialogUtil.openWeekSelectModalBottomSheet(
context, weekData!);
if (data != null) {
//改变了
weekData = [];
weekData!.addAll(data);
weekShow = '';
// List<FilterBtnModel> data =
// await DialogUtil.openWeekSelectModalBottomSheet(
// context, weekData!);
// if (data != null) {
// //改变了
// weekData = [];
// weekData!.addAll(data);
// weekShow = '';
weekData!.forEach((element) {
if (element.select!) {
weekShow += '${element.title} ';
}
});
if (weekShow.endsWith(' ')) {
weekShow =
weekShow.substring(0, weekShow.length - 1);
}
if (weekShow == '') {
weekShow = '点击设置可用日期';
}
// weekData!.forEach((element) {
// if (element.select!) {
// weekShow += '${element.title} ';
// }
// });
// if (weekShow.endsWith(' ')) {
// weekShow =
// weekShow.substring(0, weekShow.length - 1);
// }
// if (weekShow == '') {
// weekShow = '点击设置可用日期';
// }
setState(() {});
}
})
: SizedBox(),
VEmptyView(24),
MyDivider(
double.infinity,
w(1),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
Container(
alignment: Alignment.centerLeft,
child: Text(
'有效期:',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(24),
_selectTime('有效期从', fromDate, () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
// showPickerDateTime(context);
showDateSelWidget = true;
DialogUtil.showPickerDateTime24(
context,
scaffoldKey,
(value) {
// {'text': picker.adapter.text, 'select': selecteds}
if (value != null) {
setState(() {
print(value);
fromDate = DateUtil.formatDateStr(value,
format: DateFormats.y_mo_d);
});
}
showDateSelWidget = false;
},
dateTime:fromDate == '点击设置开始日期' ? null: DateUtil.getDateTime(fromDate),
pickerDateTimeType: PickerDateTimeType.kYMD,
onCancel: () {
showDateSelWidget = false;
});
}),
// setState(() {});
// }
// })
// : SizedBox(),
// VEmptyView(24),
// MyDivider(
// double.infinity,
// w(1),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(48),
// Container(
// height: ScreenUtil().setWidth(2),
// alignment: Alignment.centerLeft,
// child: Text(
// '有效期:',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// VEmptyView(24),
// _selectTime('有效期从', fromDate, () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// //弹出时间选择器
// // showPickerDateTime(context);
// showDateSelWidget = true;
// DialogUtil.showPickerDateTime24(
// context,
// scaffoldKey,
// (value) {
// // {'text': picker.adapter.text, 'select': selecteds}
// if (value != null) {
// setState(() {
// print(value);
// fromDate = DateUtil.formatDateStr(value,
// format: DateFormats.y_mo_d);
// });
// }
// showDateSelWidget = false;
// },
// dateTime: fromDate == '点击设置开始日期'
// ? null
// : DateUtil.getDateTime(fromDate),
// pickerDateTimeType: PickerDateTimeType.kYMD,
// onCancel: () {
// showDateSelWidget = false;
// });
// }),
// // Container(
// // height: ScreenUtil().setWidth(2),
// // color: MyColours.color_E7E7E7,
// // ),
// VEmptyView(24),
// _selectTime('有效期至', endDate, () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// //弹出时间选择器
// // showPickerDateTime(context);
// showDateSelWidget = true;
// DialogUtil.showPickerDateTime24(
// context,
// scaffoldKey,
// (value) {
// // {'text': picker.adapter.text, 'select': selecteds}
// if (value != null) {
// setState(() {
// print(value);
// endDate = DateUtil.formatDateStr(value,
// format: DateFormats.y_mo_d);
// });
// }
// showDateSelWidget = false;
// },
// dateTime: endDate == '点击设置结束日期'
// ? null
// : DateUtil.getDateTime(endDate),
// pickerDateTimeType: PickerDateTimeType.kYMD,
// onCancel: () {
// showDateSelWidget = false;
// });
// }),
// VEmptyView(24),
// MyDivider(
// double.infinity,
// w(1),
// color: MyColours.color_E7E7E7,
// ),
VEmptyView(24),
_selectTime('有效期至', endDate, () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
// showPickerDateTime(context);
showDateSelWidget = true;
DialogUtil.showPickerDateTime24(
context,
scaffoldKey,
(value) {
// {'text': picker.adapter.text, 'select': selecteds}
if (value != null) {
setState(() {
print(value);
endDate = DateUtil.formatDateStr(value,
format: DateFormats.y_mo_d);
});
}
showDateSelWidget = false;
},
dateTime:endDate =='点击设置结束日期'?null: DateUtil.getDateTime(endDate),
pickerDateTimeType: PickerDateTimeType.kYMD,
onCancel: () {
showDateSelWidget = false;
});
}),
VEmptyView(24),
MyDivider(
double.infinity,
w(1),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
// VEmptyView(48),
_explain('备注', '请输入备注信息', remarkC, remarkF),
VEmptyView(72),
VEmptyView(72),
_canUse('立即启用', canUse, () {
setState(() {
canUse = !canUse;
... ... @@ -1233,8 +1267,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
pramas['id'] = widget.idstr;
}
bool success = await marketingCenterProvider!.createNewRecharge(
context, pramas);
bool success = await marketingCenterProvider!
.createNewRecharge(context, pramas);
if (success) {
//成功后返回前面列表
... ...
// import 'dart:convert';
// import 'package:common_utils/common_utils.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter/services.dart';
// import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
// import 'package:flutter_picker_plus/flutter_picker_plus.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/models/coupon_model.dart';
// import 'package:one_key/models/filter_btn_model.dart';
// import 'package:one_key/provider/user_model.dart';
// import 'package:one_key/route/navigator_util.dart';
// import 'package:one_key/widgets/MyDivider.dart';
// import 'package:one_key/widgets/system_app_bar.dart';
// import 'package:provider/provider.dart';
// import '../../../../provider/marketing_center_provider.dart';
// import '../../../../res/colors.dart';
// import '../../../../utils/dialog_util.dart';
// import '../../../../utils/event_bus.dart';
// import '../../../../utils/screen_util.dart';
// import '../../../../utils/utils.dart';
// import '../../../../widgets/h_empty_view.dart';
// import '../../../../widgets/round_button.dart';
// import '../../../../widgets/v_empty_view.dart';
// /**
// *
// * 新建优惠券
// */
// class RechargeEditPage extends StatefulWidget {
// final String? idstr;
// RechargeEditPage({Key? key, this.idstr}) : super(key: key);
// @override
// _RechargeEditPageState createState() => _RechargeEditPageState();
// }
// class _RechargeEditPageState extends State<RechargeEditPage> {
// TextEditingController nameC = TextEditingController();
// TextEditingController priceminC = TextEditingController();
// TextEditingController givePriceC = TextEditingController(); //赠送金额
// TextEditingController giveScoreC = TextEditingController(); //积分
// TextEditingController remarkC = TextEditingController(); //备注
// FocusNode nameF = FocusNode();
// FocusNode priceminF = FocusNode();
// FocusNode givePricF = FocusNode();
// FocusNode giveScoreF = FocusNode();
// FocusNode remarkF = FocusNode();
// bool fixdate = true;
// bool weekly = false;
// bool birthday = false;
// final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
// bool showDateSelWidget = false;
// String fromDate = '点击设置开始日期'; //有效期开始时间
// String endDate = '点击设置结束日期'; //有效期结束时间
// List<FilterBtnModel>? weekData = [];
// String weekShow = '点击设置可用日期';
// bool canUse = true;
// List<dynamic>? coupons = [];
// List<dynamic>? selectIDs = [];
// bool givePriceSwich = false;
// bool giveScoreSwich = false;
// bool giveCouponsSwich = false;
// List<CouponSunModel>? couponsData = [];
// MarketingCenterProvider? marketingCenterProvider;
// @override
// void initState() {
// super.initState();
// _initWeekData();
// nameF.addListener(() {
// if (nameF.hasFocus) {
// //有焦点
// if (showDateSelWidget) {
// if (Navigator.canPop(context)) {
// Navigator.pop(context);
// }
// showDateSelWidget = false;
// }
// } else {
// //失去焦点
// // _editingController.text = '';
// }
// });
// priceminF.addListener(() {
// if (priceminF.hasFocus) {
// //有焦点
// if (showDateSelWidget) {
// if (Navigator.canPop(context)) {
// Navigator.pop(context);
// }
// showDateSelWidget = false;
// }
// } else {
// //失去焦点
// // _editingController.text = '';
// }
// });
// givePricF.addListener(() {
// if (givePricF.hasFocus) {
// //有焦点
// if (showDateSelWidget) {
// if (Navigator.canPop(context)) {
// Navigator.pop(context);
// }
// showDateSelWidget = false;
// }
// } else {
// //失去焦点
// // _editingController.text = '';
// }
// });
// giveScoreF.addListener(() {
// if (giveScoreF.hasFocus) {
// //有焦点
// if (showDateSelWidget) {
// if (Navigator.canPop(context)) {
// Navigator.pop(context);
// }
// showDateSelWidget = false;
// }
// } else {
// //失去焦点
// // _editingController.text = '';
// }
// });
// remarkF.addListener(() {
// if (remarkF.hasFocus) {
// //有焦点
// if (showDateSelWidget) {
// if (Navigator.canPop(context)) {
// Navigator.pop(context);
// }
// showDateSelWidget = false;
// }
// } else {
// //失去焦点
// // _editingController.text = '';
// }
// });
// WidgetsBinding.instance.addPostFrameCallback((_) {
// if (widget.idstr != null && widget.idstr != 'null') {
// _getNewRechargeDetail();
// }
// });
// }
// _getNewRechargeDetail() async {
// bool success = await marketingCenterProvider!.getNewRechargeDetail(
// context, widget.idstr);
// if (success) {
// //请求成功
// nameC.text = marketingCenterProvider!.rechargeDetail!.rname??"";
// priceminC.text = marketingCenterProvider!.rechargeDetail!.rechargeMoney??"";
// givePriceSwich =
// marketingCenterProvider!.rechargeDetail!.rechargeList!.isPrice == '1'
// ? true
// : false;
// givePriceC.text =
// marketingCenterProvider!.rechargeDetail!.rechargeList!.price!;
// giveScoreSwich =
// marketingCenterProvider!.rechargeDetail!.rechargeList!.isScore == '1'
// ? true
// : false;
// giveScoreC.text =
// marketingCenterProvider!.rechargeDetail!.rechargeList!.score!;
// giveCouponsSwich =
// marketingCenterProvider!.rechargeDetail!.rechargeList!.isCoupons == '1'
// ? true
// : false;
// selectIDs =
// marketingCenterProvider!.rechargeDetail!.rechargeList!.couponsIds;
// couponsData = marketingCenterProvider!.rechargeDetail!.rechargeList!.coupons;
// coupons =
// marketingCenterProvider!.rechargeDetail!.rechargeList!.couponsNames;
// fixdate = marketingCenterProvider!.rechargeDetail!.expDate!.isFix == '1'
// ? true
// : false;
// // if (marketingCenterProvider.rechargeDetail.expDate.fixSdate != '') {
// fromDate = marketingCenterProvider!.rechargeDetail!.stimeStr;
// // }
// // if (marketingCenterProvider.rechargeDetail.expDate.fixEdate != '') {
// endDate = marketingCenterProvider!.rechargeDetail!.etimeStr;
// // }
// weekly = marketingCenterProvider!.rechargeDetail!.expDate!.isWeek == '1'
// ? true
// : false;
// if (marketingCenterProvider!.rechargeDetail!.expDate!.weekDateShow != '') {
// weekShow = marketingCenterProvider!.rechargeDetail!.expDate!.weekDateShow!;
// }
// if (marketingCenterProvider!.rechargeDetail!.expDate!.weekDateData!.length >
// 0) {
// weekData = marketingCenterProvider!.rechargeDetail!.expDate!.weekDateData;
// }
// birthday =
// marketingCenterProvider!.rechargeDetail!.expDate!.isBirthday == '1'
// ? true
// : false;
// remarkC.text = marketingCenterProvider!.rechargeDetail!.explain??"";
// canUse =
// marketingCenterProvider!.rechargeDetail!.isOpen == '1' ? true : false;
// setState(() {});
// }
// }
// _initWeekData() {
// FilterBtnModel filterBtnModel = FilterBtnModel();
// filterBtnModel.select = false;
// filterBtnModel.title = '周日';
// weekData!.add(filterBtnModel);
// for (int i = 1; i < 7; i++) {
// FilterBtnModel filterBtnModel = FilterBtnModel();
// filterBtnModel.select = false;
// filterBtnModel.title = '周${Utils.formatWeekDayNum(i)}';
// weekData!.add(filterBtnModel);
// }
// }
// ///输入框
// Widget _textfield(String title, String hintText,
// TextEditingController controller, FocusNode node,
// {TextInputType textInputStyle = TextInputType.text}) {
// return Container(
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Container(
// child: Text(
// title,
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// HEmptyView(80),
// Expanded(
// child: TextField(
// controller: controller,
// focusNode: node,
// textAlign: TextAlign.right,
// textAlignVertical: TextAlignVertical.bottom,
// maxLines: 1,
// // //光标颜色
// // cursorColor:
// // widget.isSelect ? Colors.white : MyColours.color_199095,
// //输入文本的样式
// inputFormatters:
// title == '活动名称' ? [LengthLimitingTextInputFormatter(15)] : [],
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32),
// ),
// // focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,
// decoration: InputDecoration(
// border: OutlineInputBorder(borderSide: BorderSide.none),
// hintText: hintText,
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(32),
// ),
// enabledBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
// focusedBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
// ),
// onChanged: (value) {},
// onEditingComplete: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// keyboardType: textInputStyle,
// ),
// ),
// HEmptyView(32)
// ],
// ),
// );
// }
// ///时间选择
// Widget _selectTime(String title, String hintText, GestureTapCallback onTap) {
// return InkWell(
// onTap: onTap,
// child: Container(
// // padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Container(
// // height: ScreenUtil().setWidth(40),
// // color: Colors.red,
// child: Text(
// title,
// style: TextStyle(
// color: title == '点击设置可用日期'
// ? MyColours.color_438E93
// : MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// HEmptyView(20),
// Spacer(),
// Text(hintText,
// style: TextStyle(
// color: hintText == '点击设置开始日期' || hintText == '点击设置结束日期'
// ? MyColours.color_438E93
// : MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32),
// )),
// HEmptyView(20),
// Image.asset(
// Utils.getImgPath('arrow_right_new'),
// width: ScreenUtil().setWidth(20),
// ),
// HEmptyView(32),
// ],
// ),
// ),
// );
// }
// ///时间选择
// Widget _select(String title, String hintText, GestureTapCallback onTap) {
// return InkWell(
// onTap: onTap,
// child: Container(
// padding: EdgeInsets.only(left: ScreenUtil().setWidth(32)),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Container(
// // height: ScreenUtil().setWidth(40),
// // color: Colors.red,
// child: Text(
// title,
// style: TextStyle(
// color: title == '点击设置可用日期'
// ? MyColours.color_999999
// : MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// HEmptyView(20),
// Spacer(),
// Text(hintText,
// style: TextStyle(
// color: hintText == '点击设置开始日期' || hintText == '点击设置结束日期'
// ? MyColours.color_999999
// : MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32),
// )),
// HEmptyView(20),
// Image.asset(
// Utils.getImgPath('arrow_right_new'),
// width: ScreenUtil().setWidth(18),
// ),
// HEmptyView(32),
// ],
// ),
// ),
// );
// }
// ///券说明
// Widget _explain(String title, String hintText,
// TextEditingController controller, FocusNode node) {
// return Container(
// // height: ScreenUtil().setWidth(380),
// padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Align(
// alignment: Alignment.centerLeft,
// child: Text(
// title,
// textAlign: TextAlign.left,
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// )),
// VEmptyView(26),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// TextField(
// controller: controller,
// focusNode: node,
// // keyboardType: TextInputType.numberWithOptions(decimal: true), //键盘类型,数字键盘
// maxLines: 3,
// maxLength: 150,
// // maxLengthEnforced: true,
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_333333), //输入文本的样式
// decoration: InputDecoration(
// contentPadding:
// EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(30)),
// hintText: hintText,
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(32),
// ),
// border: OutlineInputBorder(borderSide: BorderSide.none),
// enabledBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
// focusedBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
// // fillColor: MyColours.color_F9F9F9,
// // // fillColor: Colors.red,
// // filled: true,
// // enabledBorder: OutlineInputBorder(
// // //未选中时候的颜色
// // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
// // borderSide: BorderSide(
// // color: MyColours.color_cccccc,
// // width: ScreenUtil().setWidth(2)),
// // ),
// // focusedBorder: OutlineInputBorder(
// // //选中时外边框颜色
// // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
// // borderSide: BorderSide(
// // color: MyColours.app_main,
// // ),
// // ),
// // border: OutlineInputBorder(
// // borderRadius:
// // BorderRadius.circular(ScreenUtil().setWidth(20)),
// // borderSide: BorderSide(
// // color: Colors.red, width: ScreenUtil().setWidth(2))),
// ),
// onChanged: (value) {},
// ),
// ],
// ),
// );
// }
// _itemRadioWidget(bool select, String title, {GestureTapCallback? onTap}) {
// return InkWell(
// onTap: onTap,
// child: Row(children: [
// Image.asset(
// Utils.getImgPath(
// select ? 'plan_dish_select' : 'plan_dish_unselect'),
// width: w(20),
// ),
// HEmptyView(6),
// Text(
// title,
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ]));
// }
// ///是否立即启用
// Widget _canUse(String title, bool swich, GestureTapCallback onTap) {
// return InkWell(
// onTap: onTap,
// child: Container(
// padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
// margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Container(
// // height: ScreenUtil().setWidth(40),
// // color: Colors.red,
// child: Text(
// title,
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// Spacer(),
// Image.asset(
// swich
// ? Utils.getImgPath('swich_on')
// : Utils.getImgPath('swich_off'),
// width: ScreenUtil().setWidth(44 * 2),
// )
// ],
// ),
// ),
// );
// }
// @override
// Widget build(BuildContext context) {
// marketingCenterProvider =
// Provider.of<MarketingCenterProvider>(context, listen: true);
// return KeyboardDismissOnTap(
// child: Scaffold(
// key: scaffoldKey,
// backgroundColor: MyColours.color_ffffff,
// appBar: SystemAppBar(
// '充值优惠详情',
// rightImgName: marketingCenterProvider != null &&
// marketingCenterProvider!.rechargeDetail != null &&
// widget.idstr != null &&
// widget.idstr != 'null' &&
// marketingCenterProvider!.rechargeDetail!.isOpen == '1'
// ? 'share.png'
// : '',
// onTapRight: () {
// if (widget.idstr != null &&
// widget.idstr != 'null' &&
// marketingCenterProvider!.rechargeDetail!.isOpen == '1') {
// Utils.goShareBuyRechargeToWeChat(
// context, widget.idstr, marketingCenterProvider!.rechargeDetail!);
// }
// },
// ),
// body: Column(
// children: [
// Expanded(
// child: SingleChildScrollView(
// child: Padding(
// padding: EdgeInsets.only(left: w(32)),
// child: Column(
// children: [
// _textfield('活动名称', '点击输入活动名称', nameC, nameF),
// MyDivider(
// double.infinity,
// w(1),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(24),
// _textfield('充值满', '点击输入充值金额门槛', priceminC, priceminF,
// textInputStyle:
// TextInputType.numberWithOptions(decimal: true)),
// MyDivider(
// double.infinity,
// w(1),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(48),
// Container(
// alignment: Alignment.centerLeft,
// child: Text(
// '优惠活动',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// VEmptyView(26),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// children: [
// InkWell(
// onTap: () {
// setState(() {
// givePriceSwich = !givePriceSwich;
// });
// },
// child: Padding(
// padding: EdgeInsets.only(
// left: w(16),
// right: w(8),
// ),
// child: Image.asset(
// Utils.getImgPath(givePriceSwich
// ? 'f_select'
// : 'f_select_not'),
// width: w(20),
// ),
// ),
// ),
// Text(
// '赠送',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// HEmptyView(16),
// Container(
// width: w(140),
// height: w(28),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// border: Border.all(
// width: w(1),
// color: MyColours.color_DBDBDB)),
// child: TextField(
// controller: givePriceC,
// focusNode: givePricF,
// textAlign: TextAlign.center,
// // textAlignVertical: TextAlignVertical.bottom,
// maxLines: 1,
// // //光标颜色
// // cursorColor:
// // widget.isSelect ? Colors.white : MyColours.color_199095,
// //输入文本的样式
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32),
// ),
// // focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,
// decoration: InputDecoration(
// isCollapsed:
// true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// hintText: '',
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(32),
// ),
// enabledBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
// contentPadding: EdgeInsets.zero,
// focusedBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
// ),
// onChanged: (value) {},
// onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// keyboardType: TextInputType.numberWithOptions(
// decimal: true),
// ),
// ),
// HEmptyView(16),
// Text(
// '元余额',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ],
// ),
// VEmptyView(20),
// Row(
// children: [
// InkWell(
// onTap: () {
// setState(() {
// giveScoreSwich = !giveScoreSwich;
// });
// },
// child: Padding(
// padding: EdgeInsets.only(
// left: w(16),
// right: w(8),
// ),
// child: Image.asset(
// Utils.getImgPath(giveScoreSwich
// ? 'f_select'
// : 'f_select_not'),
// width: w(20),
// ),
// ),
// ),
// Text(
// '赠送',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// HEmptyView(16),
// Container(
// width: w(140),
// height: w(28),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// border: Border.all(
// width: w(1),
// color: MyColours.color_DBDBDB)),
// child: TextField(
// controller: giveScoreC,
// focusNode: giveScoreF,
// textAlign: TextAlign.center,
// // textAlignVertical: TextAlignVertical.bottom,
// maxLines: 1,
// // //光标颜色
// // cursorColor:
// // widget.isSelect ? Colors.white : MyColours.color_199095,
// //输入文本的样式
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32),
// ),
// // focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,
// decoration: InputDecoration(
// isCollapsed:
// true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// hintText: '',
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(32),
// ),
// enabledBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
// contentPadding: EdgeInsets.zero,
// focusedBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
// ),
// onChanged: (value) {},
// onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// keyboardType: TextInputType.numberWithOptions(
// decimal: true),
// ),
// ),
// HEmptyView(16),
// Text(
// '积分',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ],
// ),
// VEmptyView(20),
// Row(
// children: [
// InkWell(
// onTap: () {
// setState(() {
// giveCouponsSwich = !giveCouponsSwich;
// });
// },
// child: Padding(
// padding: EdgeInsets.only(
// left: w(16),
// right: w(8),
// ),
// child: Image.asset(
// Utils.getImgPath(giveCouponsSwich
// ? 'f_select'
// : 'f_select_not'),
// width: w(20),
// ),
// ),
// ),
// Text(
// '赠送优惠券',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// HEmptyView(60),
// if (giveCouponsSwich)
// InkWell(
// onTap: () async {
// FocusScope.of(context)
// .requestFocus(FocusNode());
// Map? object = await NavigatorUtil
// .goRechargeSelectStoreCouponPage(
// context, selectIDs!.join(',')) ;
// print(object);
// if (object != null &&
// object['couponsid'] != null) {
// List<CouponSunModel> data =
// object['couponsdata'];
// couponsData = [];
// //
// selectIDs = object['couponsid'];
// coupons = [];
// data.forEach((element) {
// if (element.isCheck) {
// coupons!.add(element.aname);
// couponsData!.add(element);
// }
// });
// setState(() {});
// }
// },
// child: Text(
// '选择优惠券',
// style: TextStyle(
// color: MyColours.color_438E93,
// fontSize: ScreenUtil().setSp(32)),
// )),
// ],
// ),
// if (giveCouponsSwich) VEmptyView(20),
// if (giveCouponsSwich)
// Padding(
// padding: EdgeInsets.only(
// left: w(45),
// right: w(8),
// ),
// child: Wrap(
// spacing: w(9),
// runSpacing: w(9),
// alignment: WrapAlignment.start,
// runAlignment: WrapAlignment.start,
// children: coupons!.map((e) {
// return Text(
// e,
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// );
// }).toList())),
// VEmptyView(20),
// ],
// ),
// MyDivider(
// double.infinity,
// w(1),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(48),
// Container(
// alignment: Alignment.centerLeft,
// child: Text(
// '使用限制:',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// VEmptyView(24),
// Row(
// children: [
// HEmptyView(30),
// _itemRadioWidget(fixdate, '无', onTap: () {
// if (!fixdate) {
// setState(() {
// fixdate = true;
// weekly = false;
// birthday = false;
// });
// }
// }),
// Spacer(),
// _itemRadioWidget(weekly, '每周', onTap: () {
// if (!weekly) {
// setState(() {
// weekly = true;
// fixdate = false;
// birthday = false;
// });
// }
// }),
// Spacer(),
// _itemRadioWidget(birthday, '会员生日当天', onTap: () {
// if (!birthday) {
// setState(() {
// birthday = true;
// weekly = false;
// fixdate = false;
// });
// }
// }),
// HEmptyView(30),
// ],
// ),
// birthday ? SizedBox() : VEmptyView(24),
// // fixdate
// // ? Column(
// // children: [
// // _select('有效期从', fromDate, () {
// // FocusScope.of(context)
// // .requestFocus(FocusNode()); //点击空白处隐藏键盘
// // //弹出时间选择器
// // // showPickerDateTime(context);
// // showDateSelWidget = true;
// // DialogUtil.showPickerDateTime24(
// // context,
// // scaffoldKey,
// // (value) {
// // // {'text': picker.adapter.text, 'select': selecteds}
// // if (value != null) {
// // setState(() {
// // print(value);
// // fromDate = DateUtil.formatDateStr(
// // value,
// // format: DateFormats.y_mo_d);
// // });
// // }
// // showDateSelWidget = false;
// // },
// // dateTime: DateUtil.getDateTime(fromDate),
// // pickerDateTimeType: PickerDateTimeType.kYMD,
// // onCancel: () {
// // showDateSelWidget = false;
// // });
// // }),
// // VEmptyView(24),
// // _select('有效期至', endDate, () {
// // FocusScope.of(context)
// // .requestFocus(FocusNode()); //点击空白处隐藏键盘
// // //弹出时间选择器
// // // showPickerDateTime(context);
// // showDateSelWidget = true;
// // DialogUtil.showPickerDateTime24(
// // context,
// // scaffoldKey,
// // (value) {
// // // {'text': picker.adapter.text, 'select': selecteds}
// // if (value != null) {
// // setState(() {
// // print(value);
// // endDate = DateUtil.formatDateStr(
// // value,
// // format: DateFormats.y_mo_d);
// // });
// // }
// // showDateSelWidget = false;
// // },
// // dateTime: DateUtil.getDateTime(endDate),
// // pickerDateTimeType: PickerDateTimeType.kYMD,
// // onCancel: () {
// // showDateSelWidget = false;
// // });
// // })
// // ],
// // )
// // : SizedBox(),
// weekly
// ? _select(weekShow, '', () async {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// //弹出时间选择器
// // showPickerDateTime(context);
// showDateSelWidget = false;
// List<FilterBtnModel> data =
// await DialogUtil.openWeekSelectModalBottomSheet(
// context, weekData!);
// if (data != null) {
// //改变了
// weekData = [];
// weekData!.addAll(data);
// weekShow = '';
// weekData!.forEach((element) {
// if (element.select!) {
// weekShow += '${element.title} ';
// }
// });
// if (weekShow.endsWith(' ')) {
// weekShow =
// weekShow.substring(0, weekShow.length - 1);
// }
// if (weekShow == '') {
// weekShow = '点击设置可用日期';
// }
// setState(() {});
// }
// })
// : SizedBox(),
// VEmptyView(24),
// MyDivider(
// double.infinity,
// w(1),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(48),
// Container(
// alignment: Alignment.centerLeft,
// child: Text(
// '有效期:',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// VEmptyView(24),
// _selectTime('有效期从', fromDate, () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// //弹出时间选择器
// // showPickerDateTime(context);
// showDateSelWidget = true;
// DialogUtil.showPickerDateTime24(
// context,
// scaffoldKey,
// (value) {
// // {'text': picker.adapter.text, 'select': selecteds}
// if (value != null) {
// setState(() {
// print(value);
// fromDate = DateUtil.formatDateStr(value,
// format: DateFormats.y_mo_d);
// });
// }
// showDateSelWidget = false;
// },
// dateTime:fromDate == '点击设置开始日期' ? null: DateUtil.getDateTime(fromDate),
// pickerDateTimeType: PickerDateTimeType.kYMD,
// onCancel: () {
// showDateSelWidget = false;
// });
// }),
// // Container(
// // height: ScreenUtil().setWidth(2),
// // color: MyColours.color_E7E7E7,
// // ),
// VEmptyView(24),
// _selectTime('有效期至', endDate, () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// //弹出时间选择器
// // showPickerDateTime(context);
// showDateSelWidget = true;
// DialogUtil.showPickerDateTime24(
// context,
// scaffoldKey,
// (value) {
// // {'text': picker.adapter.text, 'select': selecteds}
// if (value != null) {
// setState(() {
// print(value);
// endDate = DateUtil.formatDateStr(value,
// format: DateFormats.y_mo_d);
// });
// }
// showDateSelWidget = false;
// },
// dateTime:endDate =='点击设置结束日期'?null: DateUtil.getDateTime(endDate),
// pickerDateTimeType: PickerDateTimeType.kYMD,
// onCancel: () {
// showDateSelWidget = false;
// });
// }),
// VEmptyView(24),
// MyDivider(
// double.infinity,
// w(1),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(48),
// _explain('备注', '请输入备注信息', remarkC, remarkF),
// VEmptyView(72),
// _canUse('立即启用', canUse, () {
// setState(() {
// canUse = !canUse;
// });
// })
// ],
// )),
// )),
// Container(
// height: ScreenUtil().setWidth(91 * 2),
// width: double.infinity,
// padding: EdgeInsets.only(
// top: ScreenUtil().setWidth(16 * 2),
// bottom: ScreenUtil().setWidth(35 * 2),
// left: ScreenUtil().setWidth(45 * 2),
// right: ScreenUtil().setWidth(45 * 2),
// ),
// decoration: BoxDecoration(
// color: MyColours.color_ffffff,
// boxShadow: [
// BoxShadow(
// spreadRadius: ScreenUtil().setWidth(2),
// color: Color.fromRGBO(0, 0, 0, 0.1),
// offset: Offset(0, ScreenUtil().setWidth(-2)),
// blurRadius: ScreenUtil().setWidth(8))
// ],
// borderRadius: BorderRadius.all(
// Radius.circular(ScreenUtil().setWidth(16)),
// ),
// ),
// child: RoundButton(
// text: '保存',
// height: ScreenUtil().setWidth(80),
// radius: ScreenUtil().setWidth(14),
// isBold: false,
// fontSize: 28,
// onPressed: () async {
// if (nameC.text.trim().length == 0) {
// Utils.showToast('请输入活动名称!');
// return;
// }
// if (priceminC.text.trim().length == 0) {
// Utils.showToast('请输入充值门槛金额!');
// return;
// }
// if (!Utils.isNumeric(priceminC.text.trim())) {
// Utils.showToast('充值门槛金额请输入数字!');
// return;
// }
// if (double.parse(priceminC.text.trim()) <= 0) {
// Utils.showToast('充值门槛金额需大于0!');
// return;
// }
// //优惠活动
// if (!giveScoreSwich && !givePriceSwich && !giveCouponsSwich) {
// Utils.showToast('请选择优惠活动!');
// return;
// }
// if (givePriceSwich && givePriceC.text.trim().length == 0) {
// Utils.showToast('请输入赠送金额!');
// return;
// }
// if (giveScoreSwich && giveScoreC.text.trim().length == 0) {
// Utils.showToast('请输入赠送积分!');
// return;
// }
// if (giveCouponsSwich && couponsData!.length == 0) {
// Utils.showToast('请选择赠送的优惠券!');
// return;
// }
// //有效期
// if (!fixdate && !weekly && !birthday) {
// Utils.showToast('请选择有效期!');
// return;
// }
// // if (fixdate) {
// //固定时间段
// if (fromDate == '点击设置开始日期') {
// Utils.showToast('请设置有效期的开始日期!');
// return;
// }
// if (endDate == '点击设置结束日期') {
// Utils.showToast('请设置有效期的结束日期!');
// return;
// }
// if (DateUtil.getDateTime(endDate)
// .compareTo(DateUtil.getDateTime(fromDate)) <
// 0) {
// Utils.showToast('有效期结束日期不能早于开始日期!');
// return;
// }
// // }
// if (weekly && weekShow == '点击设置可用日期') {
// Utils.showToast('请设置可用日期!');
// return;
// }
// String from = fromDate + ' 00:00:00';
// String end = endDate + ' 23:59:59';
// String stime = fromDate == '点击设置开始日期'
// ? ""
// : '${(DateUtil.getDateMsByTimeStr(from)! / 1000).floor()}';
// String etime = endDate == '点击设置结束日期'
// ? ''
// : '${(DateUtil.getDateMsByTimeStr(end)! / 1000).floor()}';
// Map discounts = {
// 'is_price': givePriceSwich ? '1' : '0', //优惠活动,赠送金额
// 'is_score': giveScoreSwich ? '1' : '0', //赠送积分
// 'is_coupons': giveCouponsSwich ? '1' : '0', //赠送优惠券
// 'price': givePriceC.text,
// 'score': giveScoreC.text,
// 'coupons': couponsData,
// 'coupons_ids': selectIDs,
// 'coupons_names': coupons
// };
// String discountsStr = json.encode(discounts);
// print(discountsStr);
// Map date = {
// 'is_fix': fixdate ? '1' : '0',
// 'is_week': weekly ? '1' : '0',
// 'is_birthday': birthday ? '1' : '0',
// // 'fix_sdate': fixdate ? fromDate : '', // 开始时间
// // 'fix_edate': fixdate ? endDate : '', //结束时间
// 'week_date_show': weekly ? weekShow : '',
// 'week_date_data': weekly ? weekData : ''
// };
// String dateStr = json.encode(date);
// print(dateStr);
// Map<String, String?> pramas = {
// 'sellerid': Provider.of<UserModel>(context, listen: false)
// .user!
// .sellerid,
// 'uid': Provider.of<UserModel>(context, listen: false)
// .user!
// .openid,
// 'rname': nameC.text,
// 'recharge_money': priceminC.text,
// 'recharge_list': discountsStr,
// 'exp_date': dateStr,
// 'explain': remarkC.text,
// 'is_open': canUse ? '1' : '0',
// 'stime': stime,
// 'etime': etime
// };
// if (widget.idstr != null && widget.idstr != 'null') {
// pramas['id'] = widget.idstr;
// }
// bool success = await marketingCenterProvider!.createNewRecharge(
// context, pramas);
// if (success) {
// //成功后返回前面列表
// if (Navigator.canPop(context)) {
// Navigator.pop(context);
// }
// //刷新列表
// bus.emit('refresh_marketting_page_recharge');
// bus.emit('refresh_recharge_home');
// }
// // "stime": fromDate == '点击选择'
// // ? ""
// // : '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}',
// // "etime": endDate == '点击选择'
// // ? ''
// // : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
// // UserModel userModel =
// // Provider.of<UserModel>(context, listen: false);
// // if (userModel.user.role_name == '管理员' ||
// // userModel.user.role_name == '店长') {
// // NavigatorUtil.goRechargeEditPage(context);
// // } else {
// // bool needRefresh =
// // await NavigatorUtil.goCouponEditPage(context);
// // print(needRefresh);
// // if (needRefresh != null && needRefresh) {
// // bus.emit('refresh_coupon_list_f');
// // //刷新页面数据
// // // _controller.callRefresh();
// // // _couponNetworkData(tabController.index);
// // }
// // }
// },
// ),
// )
// ],
// ),
// ));
// }
// }
... ...
... ... @@ -355,23 +355,8 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
isBold: false,
fontSize: 28,
onPressed: () async {
// UserModel userModel =
// Provider.of<UserModel>(context, listen: false);
// if (userModel.user.role_name == '管理员' ||
// userModel.user.role_name == '店长') {
NavigatorUtil.goRechargeEditPage(context);
// } else {
// Utils.showToast('您还没有相关权限');
// // bool needRefresh =
// // await NavigatorUtil.goCouponEditPage(context);
// // print(needRefresh);
// // if (needRefresh != null && needRefresh) {
// // bus.emit('refresh_coupon_list_f');
// // //刷新页面数据
// // // _controller.callRefresh();
// // // _couponNetworkData(tabController.index);
// // }
// }
// NavigatorUtil.goRechargeEditPage(context);
NavigatorUtil.goRechargeTypeSelectPage(context);
},
),
)
... ...
import 'package:flutter/material.dart';
// import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
/**
* 新建充值优惠---类型选择
*/
class RechargeTypeSelectPage extends StatefulWidget {
RechargeTypeSelectPage({Key? key}) : super(key: key);
@override
_RechargeTypeSelectPageState createState() => _RechargeTypeSelectPageState();
}
class _RechargeTypeSelectPageState extends State<RechargeTypeSelectPage> {
bool selectF = true;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'选择充值优惠类型',
onTap: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
),
body: SingleChildScrollView(
child: Column(
children: [
VEmptyView(98),
InkWell(
onTap: () {
if (!selectF) {
setState(() {
selectF = !selectF;
});
}
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
height: ScreenUtil().setWidth(106 * 2),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
offset: Offset(0, ScreenUtil().setWidth(4)),
blurRadius: ScreenUtil().setWidth(20),
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(32, 109, 114, 0.2))
],
color: selectF
? MyColours.color_438E93
: MyColours.color_ffffff,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(24))),
child: Row(
children: [
// Image.asset(
// Utils.getImgPath(selectF
// ? 'coupon_select_type_user'
// : 'coupon_select_type_user_un'),
// width: ScreenUtil().setWidth(70 * 2),
// ),
// HEmptyView(70),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'当餐免费',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
VEmptyView(16),
Text(
'顾客充值当餐实际消费金额的X倍,则当餐免费',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: selectF
? MyColours.color_ffffff
: MyColours.color_BFC4D4),
),
],
)),
],
),
)),
VEmptyView(94),
InkWell(
onTap: () {
if (selectF) {
setState(() {
selectF = !selectF;
});
}
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
height: ScreenUtil().setWidth(106 * 2),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
offset: Offset(0, ScreenUtil().setWidth(4)),
blurRadius: ScreenUtil().setWidth(20),
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.1))
],
color: !selectF
? MyColours.color_438E93
: MyColours.color_ffffff,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(24))),
child: Row(
children: [
// Image.asset(
// Utils.getImgPath(!selectF
// ? 'coupon_select_type_store'
// : 'coupon_select_type_store_un'),
// width: ScreenUtil().setWidth(75 * 2),
// ),
// HEmptyView(60),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'充满即赠',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
VEmptyView(16),
Text(
'顾客充值满X元,赠送余额Y元',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_BFC4D4),
),
],
)),
],
),
)),
VEmptyView(112),
RoundButton(
text: '立即创建',
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
width: ScreenUtil().setWidth(130 * 2),
height: ScreenUtil().setWidth(37 * 2),
textColor: MyColours.color_438E93,
fontSize: 24,
isBold: true,
radius: ScreenUtil().setWidth(22),
onPressed: () async {
bool? needRefresh = await NavigatorUtil.goRechargeEditPage(
context,
);
print(needRefresh);
if (needRefresh != null && needRefresh) {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
},
)
],
),
),
);
}
}
... ...
... ... @@ -2480,9 +2480,6 @@ class NavigatorUtil {
replace: replace);
}
///买单前送消费金
static Future<dynamic> goGiveMoneyBeforePayPage(
BuildContext context, {
... ... @@ -2492,6 +2489,15 @@ class NavigatorUtil {
replace: replace);
}
///选择充值优惠类型
static Future<dynamic> goRechargeTypeSelectPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.recharge_type_select_page}",
replace: replace);
}
static Future<dynamic> goSetBirthdayPage(
BuildContext context, String? gid, String? lunar, String? solar,
{replace = false, String from = 'store'}) {
... ...
... ... @@ -94,6 +94,7 @@ import 'package:one_key/pages/my/finance_manage/vip_record_detail_page.dart';
import 'package:one_key/pages/my/marketing_center/book_notification/marking_interaction_page.dart';
import 'package:one_key/pages/my/marketing_center/grant_page.dart';
import 'package:one_key/pages/my/marketing_center/grant_wechat_image_page.dart';
import 'package:one_key/pages/my/marketing_center/recharge/recharge_type_select_page.dart';
import 'package:one_key/pages/my/menu_type/menu_set_price_page.dart';
import 'package:one_key/pages/my/personnel_type/base_info_personnal_page.dart';
import 'package:one_key/pages/my/personnel_type/personnel_detail_page.dart';
... ... @@ -948,7 +949,8 @@ var handleCouponDetailPageHandler = new Handler(
return ChangeNotifierProvider<BaseIndoProvider>(
create: (_) => BaseIndoProvider(),
child: CouponDetailPage(couponSunModel: couponSunModel, idstr: idStr,isHistory:isHistory));
child: CouponDetailPage(
couponSunModel: couponSunModel, idstr: idStr, isHistory: isHistory));
});
///个人资料页面
... ... @@ -4329,10 +4331,6 @@ var grantPageHandle = new Handler(
create: (_) => FinanceProvider(), child: GrantPage());
});
///买单前送消费金
var giveMoneyBeforePayPageHandle = new Handler(
handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
... ... @@ -4342,7 +4340,14 @@ var giveMoneyBeforePayPageHandle = new Handler(
create: (_) => FinanceProvider(), child: GiveMoneyBeforePayPage());
});
///选择充值优惠类型
var rechargeTypeSelectPageHandle = new Handler(
handlerFunc: (BuildContext? context, Map<String, List<Object>> params) {
// ConsumeQrcodeSunModel data = ConsumeQrcodeSunModel.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["data"]!.first as String)));
return ChangeNotifierProvider<FinanceProvider>(
create: (_) => FinanceProvider(), child: RechargeTypeSelectPage());
});
///扫码领消费金
var grantWechatPageHandle = new Handler(
... ...
... ... @@ -437,14 +437,11 @@ class Routes {
static String grant_wechat_page = "/grant_wechat_page"; // 扫码领消费金
static String give_money_before_pay_page =
"/give_money_before_pay_page"; // 买单前送消费金
static String give_money_before_pay_page = "/give_money_before_pay_page"; // 买单前送消费金
static String recharge_type_select_page =
"/recharge_type_select_page"; // 新建充值优惠类型选择
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -833,15 +830,14 @@ class Routes {
router.define(return_money_page, handler: returnMoneyPageHandle);
router.define( grant_page, handler: grantPageHandle);
router.define( grant_wechat_page , handler: grantWechatPageHandle);
router.define(grant_page, handler: grantPageHandle);
router.define(grant_wechat_page, handler: grantWechatPageHandle);
router.define( give_money_before_pay_page , handler: giveMoneyBeforePayPageHandle);
router.define(give_money_before_pay_page,
handler: giveMoneyBeforePayPageHandle);
router.define(recharge_type_select_page,
handler: rechargeTypeSelectPageHandle);
}
}
... ...