|
...
|
...
|
@@ -22,7 +22,8 @@ import 'package:provider/provider.dart'; |
|
|
|
*/
|
|
|
|
|
|
|
|
class CouponEidtPage extends StatefulWidget {
|
|
|
|
CouponEidtPage({Key key}) : super(key: key);
|
|
|
|
final bool isMine;
|
|
|
|
CouponEidtPage({Key key, this.isMine = true}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_CouponEidtPageState createState() => _CouponEidtPageState();
|
|
...
|
...
|
@@ -33,7 +34,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
TextEditingController _couponNameEditControl = TextEditingController();
|
|
|
|
TextEditingController _couponRequireEditControl = TextEditingController();
|
|
|
|
TextEditingController _couponExplainEditControl = TextEditingController();
|
|
|
|
final heightCell = ScreenUtil().setWidth(48);
|
|
|
|
final heightCell = ScreenUtil().setWidth(48 * 2);
|
|
|
|
bool swichState = true; //默认启用 开关状态
|
|
|
|
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
String fromDate = '点击选择'; //有效期开始时间
|
|
...
|
...
|
@@ -42,6 +43,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
FocusNode _requireFocusNode = FocusNode();
|
|
|
|
bool showDateSelWidget = false;
|
|
|
|
CouponProvider couponProvider;
|
|
|
|
bool swichHexiao = true; //默认启用 核销状态
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -87,8 +89,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
: '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
|
|
|
|
"explain": _couponExplainEditControl.text,
|
|
|
|
"is_open": swichState ? "1" : "0",
|
|
|
|
"status": swichState ? "1" : "0"
|
|
|
|
"status": swichState ? "1" : "0",
|
|
|
|
'is_type': widget.isMine ? "2" : "1"
|
|
|
|
};
|
|
|
|
if (!widget.isMine) {
|
|
|
|
params['is_examine'] = swichHexiao ? "1" : "0";
|
|
|
|
params['uid_list'] = '';
|
|
|
|
}
|
|
|
|
bool isSuccess =
|
|
|
|
await couponProvider.createCustomerActivity(context, params);
|
|
|
|
if (isSuccess) {
|
|
...
|
...
|
@@ -108,9 +115,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(34)),
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(80),
|
|
...
|
...
|
@@ -128,6 +135,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
// widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
),
|
|
|
|
focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,
|
|
...
|
...
|
@@ -151,51 +159,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
},
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
HEmptyView(32)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///时间选择
|
|
|
|
Widget _select(String title, String hintText) {
|
|
|
|
Widget _select(String title, String hintText, GestureTapCallback onTap) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
//弹出时间选择器
|
|
|
|
// showPickerDateTime(context);
|
|
|
|
showDateSelWidget = true;
|
|
|
|
DialogUtil.showPickerDateTime24(
|
|
|
|
context,
|
|
|
|
scaffoldKey,
|
|
|
|
(value) {
|
|
|
|
// {'text': picker.adapter.text, 'select': selecteds}
|
|
|
|
if (value != null) {
|
|
|
|
if (title == '有效期从') {
|
|
|
|
setState(() {
|
|
|
|
print(value);
|
|
|
|
fromDate =
|
|
|
|
DateUtil.formatDateStr(value, format: DateFormats.full);
|
|
|
|
});
|
|
|
|
} else if (title == '有效期至') {
|
|
|
|
setState(() {
|
|
|
|
print(value);
|
|
|
|
endDate =
|
|
|
|
DateUtil.formatDateStr(value, format: DateFormats.full);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
showDateSelWidget = false;
|
|
|
|
},
|
|
|
|
dateTime: title == '有效期从'
|
|
|
|
? DateUtil.getDateTime(fromDate)
|
|
|
|
: DateUtil.getDateTime(endDate),
|
|
|
|
onCancel: () {
|
|
|
|
showDateSelWidget = false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
height: heightCell,
|
|
|
|
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
...
|
...
|
@@ -206,8 +182,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(30)),
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
...
|
...
|
@@ -216,15 +193,15 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
style: TextStyle(
|
|
|
|
color: hintText == '点击选择'
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_333333,
|
|
|
|
: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('arr_right_gray'),
|
|
|
|
width: ScreenUtil().setWidth(12),
|
|
|
|
height: ScreenUtil().setWidth(22),
|
|
|
|
)
|
|
|
|
Utils.getImgPath('arrow_right_new'),
|
|
|
|
width: ScreenUtil().setWidth(20),
|
|
|
|
),
|
|
|
|
HEmptyView(32),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
...
|
...
|
@@ -235,6 +212,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
Widget _explain(String title, String hintText) {
|
|
|
|
return Container(
|
|
|
|
// height: ScreenUtil().setWidth(380),
|
|
|
|
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
...
|
...
|
@@ -244,15 +222,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
title,
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(34)),
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
)),
|
|
|
|
VEmptyView(30),
|
|
|
|
VEmptyView(26),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
TextField(
|
|
|
|
controller: _couponExplainEditControl,
|
|
|
|
// keyboardType: TextInputType.number, //键盘类型,数字键盘
|
|
|
|
maxLines: 6,
|
|
|
|
maxLines: 3,
|
|
|
|
maxLength: 50,
|
|
|
|
|
|
|
|
// maxLengthEnforced: true,
|
|
...
|
...
|
@@ -266,23 +248,33 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
),
|
|
|
|
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)),
|
|
|
|
|
|
|
|
border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
|
|
|
|
enabledBorder: new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
//选中时外边框颜色
|
|
|
|
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: MyColours.app_main,
|
|
|
|
),
|
|
|
|
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)),
|
|
...
|
...
|
@@ -297,16 +289,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
}
|
|
|
|
|
|
|
|
///是否立即启用
|
|
|
|
Widget _canUse(String title) {
|
|
|
|
Widget _canUse(String title, bool swich, GestureTapCallback onTap) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
swichState = !swichState;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(top: ScreenUtil().setWidth(30)),
|
|
|
|
// height: heightCell,
|
|
|
|
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
|
|
|
|
margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
...
|
...
|
@@ -317,18 +305,17 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(34)),
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Image.asset(
|
|
|
|
swichState
|
|
|
|
swich
|
|
|
|
? Utils.getImgPath('swich_on')
|
|
|
|
: Utils.getImgPath('swich_off'),
|
|
|
|
width: ScreenUtil().setWidth(122),
|
|
|
|
height: ScreenUtil().setWidth(82),
|
|
|
|
width: ScreenUtil().setWidth(44 * 2),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
...
|
...
|
@@ -336,6 +323,41 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///
|
|
|
|
Widget _item(String title, String subTitle) {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
|
|
|
|
margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(60),
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
subTitle,
|
|
|
|
maxLines: 20,
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.4),
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
couponProvider = Provider.of<CouponProvider>(context, listen: true);
|
|
...
|
...
|
@@ -343,7 +365,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
key: scaffoldKey,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'创建新券',
|
|
|
|
'优惠券详情',
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context, false);
|
|
|
|
},
|
|
...
|
...
|
@@ -358,98 +380,165 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
controller: controller,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40)),
|
|
|
|
padding: EdgeInsets.only(left: ScreenUtil().setWidth(32)),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(40),
|
|
|
|
VEmptyView(56),
|
|
|
|
_item('券类型', widget.isMine ? '我的优惠券' : '店铺优惠券'),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
widget.isMine
|
|
|
|
? SizedBox()
|
|
|
|
: _canUse('是否核销', swichHexiao, () {
|
|
|
|
setState(() {
|
|
|
|
swichHexiao = !swichHexiao;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
widget.isMine
|
|
|
|
? SizedBox()
|
|
|
|
: Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
widget.isMine ? SizedBox() : VEmptyView(24),
|
|
|
|
_textfield('券名称', '例:9折券/200元代金券/菜品券'),
|
|
|
|
VEmptyView(22),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_efefef,
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(108 * 2)),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
VEmptyView(24),
|
|
|
|
_textfield('券要求', '例:无门槛/满2000元'),
|
|
|
|
VEmptyView(22),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_efefef,
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(108 * 2)),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
_select('有效期从', fromDate),
|
|
|
|
VEmptyView(30),
|
|
|
|
VEmptyView(24),
|
|
|
|
_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.full);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
showDateSelWidget = false;
|
|
|
|
},
|
|
|
|
dateTime: DateUtil.getDateTime(fromDate),
|
|
|
|
onCancel: () {
|
|
|
|
showDateSelWidget = false;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_efefef,
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(108 * 2)),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
_select('有效期至', endDate),
|
|
|
|
VEmptyView(30),
|
|
|
|
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.full);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
showDateSelWidget = false;
|
|
|
|
},
|
|
|
|
dateTime: DateUtil.getDateTime(endDate),
|
|
|
|
onCancel: () {
|
|
|
|
showDateSelWidget = false;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_efefef,
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(108 * 2)),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
VEmptyView(24),
|
|
|
|
widget.isMine
|
|
|
|
? SizedBox()
|
|
|
|
: _select('谁可以发放', '编辑', () {}),
|
|
|
|
widget.isMine
|
|
|
|
? SizedBox()
|
|
|
|
: Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
widget.isMine ? SizedBox() : VEmptyView(24),
|
|
|
|
_explain('券说明', '例:可用包间,停车免费,不与店内其他活动共享等'),
|
|
|
|
// VEmptyView(20),
|
|
|
|
_canUse('是否立即启用'),
|
|
|
|
VEmptyView(20),
|
|
|
|
_canUse('立即启用', swichState, () {
|
|
|
|
setState(() {
|
|
|
|
swichState = !swichState;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
VEmptyView(30),
|
|
|
|
],
|
|
|
|
))),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
|
|
|
|
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
|
|
|
|
child: RoundButton(
|
|
|
|
onPressed: () {
|
|
|
|
if (_couponNameEditControl.text.trim().length == 0) {
|
|
|
|
Utils.showToast('请填写券名称');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (_couponRequireEditControl.text.trim().length == 0) {
|
|
|
|
Utils.showToast('请填写券要求');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (fromDate == '点击选择') {
|
|
|
|
Utils.showToast('请选择有效期起始时间');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (endDate == '点击选择') {
|
|
|
|
Utils.showToast('请选择有效期结束时间');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (DateUtil.getDateTime(endDate)
|
|
|
|
.compareTo(DateUtil.getDateTime(fromDate)) <
|
|
|
|
0) {
|
|
|
|
Utils.showToast('有效期结束时间不能早于起始时间');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// ***参数***
|
|
|
|
// _couponNameEditControl.text
|
|
|
|
// _couponRequireEditControl.text
|
|
|
|
// fromDate
|
|
|
|
// endDate
|
|
|
|
// _couponExplainEditControl.text
|
|
|
|
// swichState
|
|
|
|
_createNewCoupon();
|
|
|
|
},
|
|
|
|
text: '保存',
|
|
|
|
fontSize: 34,
|
|
|
|
isBold: false,
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
width: double.infinity,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
))
|
|
|
|
RoundButton(
|
|
|
|
onPressed: () {
|
|
|
|
if (_couponNameEditControl.text.trim().length == 0) {
|
|
|
|
Utils.showToast('请填写券名称');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (_couponRequireEditControl.text.trim().length == 0) {
|
|
|
|
Utils.showToast('请填写券要求');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (fromDate == '点击选择') {
|
|
|
|
Utils.showToast('请选择有效期起始时间');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (endDate == '点击选择') {
|
|
|
|
Utils.showToast('请选择有效期结束时间');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (DateUtil.getDateTime(endDate)
|
|
|
|
.compareTo(DateUtil.getDateTime(fromDate)) <
|
|
|
|
0) {
|
|
|
|
Utils.showToast('有效期结束时间不能早于起始时间');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// ***参数***
|
|
|
|
// _couponNameEditControl.text
|
|
|
|
// _couponRequireEditControl.text
|
|
|
|
// fromDate
|
|
|
|
// endDate
|
|
|
|
// _couponExplainEditControl.text
|
|
|
|
// swichState
|
|
|
|
_createNewCoupon();
|
|
|
|
},
|
|
|
|
text: '立即创建',
|
|
|
|
fontSize: 24,
|
|
|
|
isBold: false,
|
|
|
|
height: ScreenUtil().setWidth(37 * 2),
|
|
|
|
width: ScreenUtil().setWidth(130 * 2),
|
|
|
|
radius: ScreenUtil().setWidth(22),
|
|
|
|
),
|
|
|
|
VEmptyView(32)
|
|
|
|
])),
|
|
|
|
);
|
|
|
|
}
|
...
|
...
|
|