|
...
|
...
|
@@ -17,6 +17,9 @@ import 'package:one_key/widgets/system_app_bar.dart'; |
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../models/filter_btn_model.dart';
|
|
|
|
import '../../utils/screen_util.dart';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新建券
|
|
|
|
*/
|
|
...
|
...
|
@@ -45,6 +48,31 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
CouponProvider couponProvider;
|
|
|
|
bool swichHexiao = true; //默认启用 核销状态
|
|
|
|
String uids = '';
|
|
|
|
TextEditingController _priceControl = TextEditingController();
|
|
|
|
FocusNode _priceFocusNode = FocusNode();
|
|
|
|
|
|
|
|
bool money = true;
|
|
|
|
bool discount = false;
|
|
|
|
bool dish = false;
|
|
|
|
|
|
|
|
TextEditingController moneyControl = TextEditingController();
|
|
|
|
TextEditingController discountControl = TextEditingController();
|
|
|
|
TextEditingController dishControl = TextEditingController();
|
|
|
|
|
|
|
|
FocusNode moneyFocusNode = FocusNode();
|
|
|
|
FocusNode discountFocusNode = FocusNode();
|
|
|
|
FocusNode dishFocusNode = FocusNode();
|
|
|
|
|
|
|
|
bool limitNone = true;
|
|
|
|
bool limitWeek = false;
|
|
|
|
bool limitBirthday = false;
|
|
|
|
String weekShow = '点击设置可用日期';
|
|
|
|
List<FilterBtnModel> weekData = [];
|
|
|
|
|
|
|
|
// morning == "00:00-00:00"
|
|
|
|
String morning;
|
|
|
|
String noon;
|
|
|
|
String night;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -73,21 +101,112 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
_priceFocusNode.addListener(() {
|
|
|
|
if (_priceFocusNode.hasFocus) {
|
|
|
|
//有焦点
|
|
|
|
if (showDateSelWidget) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//失去焦点
|
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
moneyFocusNode.addListener(() {
|
|
|
|
if (moneyFocusNode.hasFocus) {
|
|
|
|
//有焦点
|
|
|
|
if (showDateSelWidget) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//失去焦点
|
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
discountFocusNode.addListener(() {
|
|
|
|
if (discountFocusNode.hasFocus) {
|
|
|
|
//有焦点
|
|
|
|
if (showDateSelWidget) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//失去焦点
|
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dishFocusNode.addListener(() {
|
|
|
|
if (dishFocusNode.hasFocus) {
|
|
|
|
//有焦点
|
|
|
|
if (showDateSelWidget) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//失去焦点
|
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
// _couponNetworkData(0);
|
|
|
|
_initWeekData();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// //初始化时间
|
|
|
|
// initWeekData() async {
|
|
|
|
// // UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
|
|
|
|
// // morning =
|
|
|
|
// // userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
|
|
|
|
// // noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
|
|
|
|
// // night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
|
|
|
|
// // if (morning != "00:00-00:00") {
|
|
|
|
// // //开通早餐
|
|
|
|
// // }
|
|
|
|
// // if (morning != "00:00-00:00") {
|
|
|
|
// // //开通午餐
|
|
|
|
// // }
|
|
|
|
// // if (morning != "00:00-00:00") {
|
|
|
|
// // //开通晚餐
|
|
|
|
// // }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
_initWeekData() {
|
|
|
|
FilterBtnModel filterBtnModel = FilterBtnModel();
|
|
|
|
filterBtnModel.selectNoon = false;
|
|
|
|
filterBtnModel.selectNig = false;
|
|
|
|
filterBtnModel.title = '周日';
|
|
|
|
weekData.add(filterBtnModel);
|
|
|
|
for (int i = 1; i < 7; i++) {
|
|
|
|
FilterBtnModel filterBtnModel = FilterBtnModel();
|
|
|
|
filterBtnModel.selectNoon = false;
|
|
|
|
filterBtnModel.selectNig = false;
|
|
|
|
filterBtnModel.title = '周${Utils.formatWeekDayNum(i)}';
|
|
|
|
weekData.add(filterBtnModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//创建新券 客户经理创建活动
|
|
|
|
_createNewCoupon() async {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
String from = fromDate + ' 00:00:00';
|
|
|
|
String end = endDate + ' 23:59:59';
|
|
|
|
Map<String, String> params = {
|
|
|
|
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
|
|
|
|
"aname": _couponNameEditControl.text.trim(),
|
|
|
|
"desc": _couponRequireEditControl.text.trim(),
|
|
|
|
"stime": fromDate == '点击选择'
|
|
|
|
? ""
|
|
|
|
: '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}',
|
|
|
|
: '${(DateUtil.getDateMsByTimeStr(from) / 1000).floor()}',
|
|
|
|
"etime": endDate == '点击选择'
|
|
|
|
? ''
|
|
|
|
: '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
|
|
|
|
: '${(DateUtil.getDateMsByTimeStr(end) / 1000).floor()}',
|
|
|
|
"explain": _couponExplainEditControl.text,
|
|
|
|
"is_open": swichState ? "1" : "0",
|
|
|
|
"status": swichState ? "1" : "0",
|
|
...
|
...
|
@@ -111,7 +230,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
}
|
|
|
|
|
|
|
|
///输入框
|
|
|
|
Widget _textfield(String title, String hintText) {
|
|
|
|
Widget _textfield(String title, String hintText,
|
|
|
|
TextEditingController controller, FocusNode focusNode,
|
|
|
|
{TextInputType textInputType = TextInputType.text}) {
|
|
|
|
return Container(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
...
|
...
|
@@ -129,41 +250,38 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
Container(
|
|
|
|
width: ScreenUtil().setWidth(231 * 2),
|
|
|
|
child: TextField(
|
|
|
|
controller: title == '券名称'
|
|
|
|
? _couponNameEditControl
|
|
|
|
: _couponRequireEditControl,
|
|
|
|
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,
|
|
|
|
controller: controller,
|
|
|
|
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),
|
|
|
|
),
|
|
|
|
enabledBorder: new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
focusNode: focusNode,
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
focusedBorder: new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onChanged: (value) {},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
},
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
),
|
|
|
|
onChanged: (value) {},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
},
|
|
|
|
keyboardType: textInputType),
|
|
|
|
),
|
|
|
|
HEmptyView(32)
|
|
|
|
],
|
|
...
|
...
|
@@ -171,6 +289,77 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///输入框
|
|
|
|
Widget _textfieldSelect(
|
|
|
|
String title,
|
|
|
|
String hintText,
|
|
|
|
TextEditingController controller,
|
|
|
|
FocusNode focusNode, {
|
|
|
|
TextInputType textInputType = TextInputType.text,
|
|
|
|
String subtitle = '',
|
|
|
|
}) {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.only(left: w(20), right: (w(20))),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(40),
|
|
|
|
Expanded(
|
|
|
|
child: TextField(
|
|
|
|
controller: controller,
|
|
|
|
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: focusNode,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
isCollapsed: true,
|
|
|
|
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: textInputType),
|
|
|
|
),
|
|
|
|
if (subtitle != '') HEmptyView(6),
|
|
|
|
Text(
|
|
|
|
subtitle,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///时间选择
|
|
|
|
Widget _select(String title, String hintText, GestureTapCallback onTap) {
|
|
|
|
return InkWell(
|
|
...
|
...
|
@@ -363,6 +552,69 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_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 _select1(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(
|
|
|
|
height: 1.5,
|
|
|
|
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),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
couponProvider = Provider.of<CouponProvider>(context, listen: true);
|
|
...
|
...
|
@@ -412,13 +664,110 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
widget.isMine ? SizedBox() : VEmptyView(24),
|
|
|
|
_textfield('券名称', '例:9折券/200元代金券/菜品券'),
|
|
|
|
_textfield('券名称', '例:9折券/200元代金券/菜品券',
|
|
|
|
_couponNameEditControl, _nameFocusNode),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_textfield('券要求', '例:无门槛/满2000元'),
|
|
|
|
if (!widget.isMine)
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
//销售价
|
|
|
|
|
|
|
|
_textfield('销售价', '默认0元,可以免费发放',
|
|
|
|
_priceControl, _priceFocusNode,
|
|
|
|
textInputType:
|
|
|
|
TextInputType.numberWithOptions()),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
// VEmptyView(24),
|
|
|
|
//券用途
|
|
|
|
VEmptyView(56),
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text(
|
|
|
|
'券用途',
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(30),
|
|
|
|
_itemRadioWidget(money, '代金券',
|
|
|
|
onTap: () {
|
|
|
|
if (!money) {
|
|
|
|
setState(() {
|
|
|
|
money = true;
|
|
|
|
|
|
|
|
dish = false;
|
|
|
|
discount = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Spacer(),
|
|
|
|
_itemRadioWidget(discount, '折扣券',
|
|
|
|
onTap: () {
|
|
|
|
if (!discount) {
|
|
|
|
setState(() {
|
|
|
|
discount = true;
|
|
|
|
|
|
|
|
dish = false;
|
|
|
|
money = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Spacer(),
|
|
|
|
_itemRadioWidget(dish, '菜品券',
|
|
|
|
onTap: () {
|
|
|
|
if (!dish) {
|
|
|
|
setState(() {
|
|
|
|
dish = true;
|
|
|
|
discount = false;
|
|
|
|
money = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
HEmptyView(30),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
|
|
|
|
if (money)
|
|
|
|
_textfieldSelect('金额:', '点击输入代金券金额',
|
|
|
|
moneyControl, moneyFocusNode,
|
|
|
|
subtitle: '元',
|
|
|
|
textInputType: TextInputType
|
|
|
|
.numberWithOptions()),
|
|
|
|
if (discount)
|
|
|
|
_textfieldSelect('折扣率:', '点击输入折扣,如9折',
|
|
|
|
moneyControl, moneyFocusNode,
|
|
|
|
subtitle: '折',
|
|
|
|
textInputType: TextInputType
|
|
|
|
.numberWithOptions()),
|
|
|
|
|
|
|
|
if (dish)
|
|
|
|
_textfieldSelect('菜品:', '点击输入赠送菜品名称',
|
|
|
|
moneyControl, moneyFocusNode,
|
|
|
|
textInputType: TextInputType
|
|
|
|
.numberWithOptions()),
|
|
|
|
VEmptyView(48),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
_textfield('券要求', '例:无门槛/满2000元',
|
|
|
|
_couponRequireEditControl, _requireFocusNode),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
...
|
...
|
@@ -440,12 +789,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
print(value);
|
|
|
|
fromDate = DateUtil.formatDateStr(
|
|
|
|
value,
|
|
|
|
format: DateFormats.full);
|
|
|
|
format: DateFormats.y_mo_d);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
showDateSelWidget = false;
|
|
|
|
},
|
|
|
|
dateTime: DateUtil.getDateTime(fromDate),
|
|
|
|
pickerDateTimeType: PickerDateTimeType.kYMD,
|
|
|
|
onCancel: () {
|
|
|
|
showDateSelWidget = false;
|
|
|
|
});
|
|
...
|
...
|
@@ -471,12 +821,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
print(value);
|
|
|
|
endDate = DateUtil.formatDateStr(
|
|
|
|
value,
|
|
|
|
format: DateFormats.full);
|
|
|
|
format: DateFormats.y_mo_d);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
showDateSelWidget = false;
|
|
|
|
},
|
|
|
|
dateTime: DateUtil.getDateTime(endDate),
|
|
|
|
pickerDateTimeType: PickerDateTimeType.kYMD,
|
|
|
|
onCancel: () {
|
|
|
|
showDateSelWidget = false;
|
|
|
|
});
|
|
...
|
...
|
@@ -486,6 +837,127 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
if (!widget.isMine)
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
//使用限制
|
|
|
|
VEmptyView(24),
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text(
|
|
|
|
'使用限制',
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(30),
|
|
|
|
_itemRadioWidget(limitNone, '无',
|
|
|
|
onTap: () {
|
|
|
|
if (!limitNone) {
|
|
|
|
setState(() {
|
|
|
|
limitNone = true;
|
|
|
|
|
|
|
|
limitWeek = false;
|
|
|
|
limitBirthday = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Spacer(),
|
|
|
|
_itemRadioWidget(limitWeek, '每周',
|
|
|
|
onTap: () {
|
|
|
|
if (!limitWeek) {
|
|
|
|
setState(() {
|
|
|
|
limitWeek = true;
|
|
|
|
|
|
|
|
limitNone = false;
|
|
|
|
limitBirthday = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
Spacer(),
|
|
|
|
_itemRadioWidget(
|
|
|
|
limitBirthday, '会员生日当天', onTap: () {
|
|
|
|
if (!limitBirthday) {
|
|
|
|
setState(() {
|
|
|
|
limitBirthday = true;
|
|
|
|
limitNone = false;
|
|
|
|
limitWeek = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
HEmptyView(30),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
if (limitWeek) VEmptyView(30),
|
|
|
|
|
|
|
|
if (limitWeek)
|
|
|
|
_select1(weekShow, '', () async {
|
|
|
|
FocusScope.of(context).requestFocus(
|
|
|
|
FocusNode()); //点击空白处隐藏键盘
|
|
|
|
//弹出时间选择器
|
|
|
|
// showPickerDateTime(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
|
|
|
|
List<FilterBtnModel> data = await DialogUtil
|
|
|
|
.openCoponsWeekSelectModalBottomSheet(
|
|
|
|
context, weekData);
|
|
|
|
if (data != null) {
|
|
|
|
//改变了
|
|
|
|
weekData = [];
|
|
|
|
weekData.addAll(data);
|
|
|
|
weekShow = '';
|
|
|
|
|
|
|
|
String noonStr = '午餐:';
|
|
|
|
String nightStr = '晚餐:';
|
|
|
|
|
|
|
|
weekData.forEach((element) {
|
|
|
|
if (element.selectNoon) {
|
|
|
|
noonStr += '${element.title} ';
|
|
|
|
}
|
|
|
|
if (element.selectNig) {
|
|
|
|
nightStr += '${element.title} ';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (noonStr.endsWith(' ')) {
|
|
|
|
noonStr = noonStr.substring(
|
|
|
|
0, noonStr.length - 1);
|
|
|
|
}
|
|
|
|
if (nightStr.endsWith(' ')) {
|
|
|
|
nightStr = nightStr.substring(
|
|
|
|
0, nightStr.length - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (noonStr == '午餐:' &&
|
|
|
|
nightStr == '晚餐:') {
|
|
|
|
weekShow = '点击设置可用日期';
|
|
|
|
} else {
|
|
|
|
if (noonStr != '午餐:' &&
|
|
|
|
nightStr != '晚餐:') {
|
|
|
|
weekShow =
|
|
|
|
noonStr + '\n' + nightStr;
|
|
|
|
} else if (noonStr != '午餐:') {
|
|
|
|
weekShow = noonStr;
|
|
|
|
} else {
|
|
|
|
weekShow = nightStr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
limitWeek ? VEmptyView(22) : VEmptyView(48),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(48),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
widget.isMine
|
|
|
|
? SizedBox()
|
|
|
|
: _select('谁可以发放', '编辑', () async {
|
...
|
...
|
|