|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_picker/Picker.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/route/navigator_util.dart';
|
|
|
|
import 'package:one_key/widgets/MyDivider.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
|
|
|
|
import '../../../../res/colors.dart';
|
|
|
|
import '../../../../utils/dialog_util.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 {
|
|
|
|
RechargeEditPage({Key key}) : 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 = false;
|
|
|
|
List<String> coupons = [];
|
|
|
|
|
|
|
|
List<String> selectIDs = [];
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
_initWeekData();
|
|
|
|
|
|
|
|
nameF.addListener(() {
|
|
|
|
if (nameF.hasFocus) {
|
|
|
|
//有焦点
|
|
|
|
if (showDateSelWidget) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//失去焦点
|
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
priceminF.addListener(() {
|
|
|
|
if (priceminF.hasFocus) {
|
|
|
|
//有焦点
|
|
|
|
if (showDateSelWidget) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//失去焦点
|
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
givePricF.addListener(() {
|
|
|
|
if (givePricF.hasFocus) {
|
|
|
|
//有焦点
|
|
|
|
if (showDateSelWidget) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//失去焦点
|
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
giveScoreF.addListener(() {
|
|
|
|
if (giveScoreF.hasFocus) {
|
|
|
|
//有焦点
|
|
|
|
if (showDateSelWidget) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//失去焦点
|
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
remarkF.addListener(() {
|
|
|
|
if (remarkF.hasFocus) {
|
|
|
|
//有焦点
|
|
|
|
if (showDateSelWidget) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//失去焦点
|
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_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,
|
|
|
|
//输入文本的样式
|
|
|
|
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 _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.number, //键盘类型,数字键盘
|
|
|
|
maxLines: 3,
|
|
|
|
maxLength: 50,
|
|
|
|
|
|
|
|
// maxLengthEnforced: true,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_333333), //输入文本的样式
|
|
|
|
decoration: InputDecoration(
|
|
|
|
contentPadding: EdgeInsets.all(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) {
|
|
|
|
return Scaffold(
|
|
|
|
key: scaffoldKey,
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar('充值优惠详情'),
|
|
|
|
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()),
|
|
|
|
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),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(16),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
true ? 'f_select' : 'f_select_not'),
|
|
|
|
width: w(20),
|
|
|
|
),
|
|
|
|
HEmptyView(16),
|
|
|
|
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(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(16),
|
|
|
|
Text(
|
|
|
|
'元余额',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
true ? 'f_select' : 'f_select_not'),
|
|
|
|
width: w(20),
|
|
|
|
),
|
|
|
|
HEmptyView(16),
|
|
|
|
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(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(16),
|
|
|
|
Text(
|
|
|
|
'积分',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
true ? 'f_select' : 'f_select_not'),
|
|
|
|
width: w(20),
|
|
|
|
),
|
|
|
|
HEmptyView(16),
|
|
|
|
Text(
|
|
|
|
'赠送优惠券',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
HEmptyView(60),
|
|
|
|
InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
Map object = await NavigatorUtil
|
|
|
|
.goRechargeSelectStoreCouponPage(
|
|
|
|
context, selectIDs.join(','));
|
|
|
|
print(object);
|
|
|
|
if (object != null &&
|
|
|
|
object['couponsid'] != null) {
|
|
|
|
List<CouponSunModel> data =
|
|
|
|
object['couponsdata'];
|
|
|
|
//
|
|
|
|
selectIDs = object['couponsid'];
|
|
|
|
coupons = [];
|
|
|
|
data.forEach((element) {
|
|
|
|
if (element.isCheck) {
|
|
|
|
coupons.add(element.aname);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
'选择优惠券',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
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),
|
|
|
|
_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 {
|
|
|
|
// "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);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|