|
@@ -17,6 +17,9 @@ import 'package:one_key/widgets/system_app_bar.dart'; |
|
@@ -17,6 +17,9 @@ import 'package:one_key/widgets/system_app_bar.dart'; |
|
17
|
import 'package:one_key/widgets/v_empty_view.dart';
|
17
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
18
|
import 'package:provider/provider.dart';
|
18
|
import 'package:provider/provider.dart';
|
|
19
|
|
19
|
|
|
|
|
20
|
+import '../../models/filter_btn_model.dart';
|
|
|
|
21
|
+import '../../utils/screen_util.dart';
|
|
|
|
22
|
+
|
|
20
|
/**
|
23
|
/**
|
|
21
|
* 新建券
|
24
|
* 新建券
|
|
22
|
*/
|
25
|
*/
|
|
@@ -45,6 +48,31 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
@@ -45,6 +48,31 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
45
|
CouponProvider couponProvider;
|
48
|
CouponProvider couponProvider;
|
|
46
|
bool swichHexiao = true; //默认启用 核销状态
|
49
|
bool swichHexiao = true; //默认启用 核销状态
|
|
47
|
String uids = '';
|
50
|
String uids = '';
|
|
|
|
51
|
+ TextEditingController _priceControl = TextEditingController();
|
|
|
|
52
|
+ FocusNode _priceFocusNode = FocusNode();
|
|
|
|
53
|
+
|
|
|
|
54
|
+ bool money = true;
|
|
|
|
55
|
+ bool discount = false;
|
|
|
|
56
|
+ bool dish = false;
|
|
|
|
57
|
+
|
|
|
|
58
|
+ TextEditingController moneyControl = TextEditingController();
|
|
|
|
59
|
+ TextEditingController discountControl = TextEditingController();
|
|
|
|
60
|
+ TextEditingController dishControl = TextEditingController();
|
|
|
|
61
|
+
|
|
|
|
62
|
+ FocusNode moneyFocusNode = FocusNode();
|
|
|
|
63
|
+ FocusNode discountFocusNode = FocusNode();
|
|
|
|
64
|
+ FocusNode dishFocusNode = FocusNode();
|
|
|
|
65
|
+
|
|
|
|
66
|
+ bool limitNone = true;
|
|
|
|
67
|
+ bool limitWeek = false;
|
|
|
|
68
|
+ bool limitBirthday = false;
|
|
|
|
69
|
+ String weekShow = '点击设置可用日期';
|
|
|
|
70
|
+ List<FilterBtnModel> weekData = [];
|
|
|
|
71
|
+
|
|
|
|
72
|
+ // morning == "00:00-00:00"
|
|
|
|
73
|
+ String morning;
|
|
|
|
74
|
+ String noon;
|
|
|
|
75
|
+ String night;
|
|
48
|
|
76
|
|
|
49
|
@override
|
77
|
@override
|
|
50
|
void initState() {
|
78
|
void initState() {
|
|
@@ -73,21 +101,112 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
@@ -73,21 +101,112 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
73
|
// _editingController.text = '';
|
101
|
// _editingController.text = '';
|
|
74
|
}
|
102
|
}
|
|
75
|
});
|
103
|
});
|
|
|
|
104
|
+
|
|
|
|
105
|
+ _priceFocusNode.addListener(() {
|
|
|
|
106
|
+ if (_priceFocusNode.hasFocus) {
|
|
|
|
107
|
+ //有焦点
|
|
|
|
108
|
+ if (showDateSelWidget) {
|
|
|
|
109
|
+ Navigator.pop(context);
|
|
|
|
110
|
+ showDateSelWidget = false;
|
|
|
|
111
|
+ }
|
|
|
|
112
|
+ } else {
|
|
|
|
113
|
+ //失去焦点
|
|
|
|
114
|
+ // _editingController.text = '';
|
|
|
|
115
|
+ }
|
|
|
|
116
|
+ });
|
|
|
|
117
|
+ moneyFocusNode.addListener(() {
|
|
|
|
118
|
+ if (moneyFocusNode.hasFocus) {
|
|
|
|
119
|
+ //有焦点
|
|
|
|
120
|
+ if (showDateSelWidget) {
|
|
|
|
121
|
+ Navigator.pop(context);
|
|
|
|
122
|
+ showDateSelWidget = false;
|
|
|
|
123
|
+ }
|
|
|
|
124
|
+ } else {
|
|
|
|
125
|
+ //失去焦点
|
|
|
|
126
|
+ // _editingController.text = '';
|
|
|
|
127
|
+ }
|
|
|
|
128
|
+ });
|
|
|
|
129
|
+ discountFocusNode.addListener(() {
|
|
|
|
130
|
+ if (discountFocusNode.hasFocus) {
|
|
|
|
131
|
+ //有焦点
|
|
|
|
132
|
+ if (showDateSelWidget) {
|
|
|
|
133
|
+ Navigator.pop(context);
|
|
|
|
134
|
+ showDateSelWidget = false;
|
|
|
|
135
|
+ }
|
|
|
|
136
|
+ } else {
|
|
|
|
137
|
+ //失去焦点
|
|
|
|
138
|
+ // _editingController.text = '';
|
|
|
|
139
|
+ }
|
|
|
|
140
|
+ });
|
|
|
|
141
|
+ dishFocusNode.addListener(() {
|
|
|
|
142
|
+ if (dishFocusNode.hasFocus) {
|
|
|
|
143
|
+ //有焦点
|
|
|
|
144
|
+ if (showDateSelWidget) {
|
|
|
|
145
|
+ Navigator.pop(context);
|
|
|
|
146
|
+ showDateSelWidget = false;
|
|
|
|
147
|
+ }
|
|
|
|
148
|
+ } else {
|
|
|
|
149
|
+ //失去焦点
|
|
|
|
150
|
+ // _editingController.text = '';
|
|
|
|
151
|
+ }
|
|
|
|
152
|
+ });
|
|
|
|
153
|
+
|
|
|
|
154
|
+ WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
155
|
+ // _couponNetworkData(0);
|
|
|
|
156
|
+ _initWeekData();
|
|
|
|
157
|
+ });
|
|
|
|
158
|
+ }
|
|
|
|
159
|
+
|
|
|
|
160
|
+ // //初始化时间
|
|
|
|
161
|
+ // initWeekData() async {
|
|
|
|
162
|
+ // // UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
163
|
+
|
|
|
|
164
|
+ // // morning =
|
|
|
|
165
|
+ // // userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
|
|
|
|
166
|
+ // // noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
|
|
|
|
167
|
+ // // night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
|
|
|
|
168
|
+ // // if (morning != "00:00-00:00") {
|
|
|
|
169
|
+ // // //开通早餐
|
|
|
|
170
|
+ // // }
|
|
|
|
171
|
+ // // if (morning != "00:00-00:00") {
|
|
|
|
172
|
+ // // //开通午餐
|
|
|
|
173
|
+ // // }
|
|
|
|
174
|
+ // // if (morning != "00:00-00:00") {
|
|
|
|
175
|
+ // // //开通晚餐
|
|
|
|
176
|
+ // // }
|
|
|
|
177
|
+
|
|
|
|
178
|
+ // }
|
|
|
|
179
|
+
|
|
|
|
180
|
+ _initWeekData() {
|
|
|
|
181
|
+ FilterBtnModel filterBtnModel = FilterBtnModel();
|
|
|
|
182
|
+ filterBtnModel.selectNoon = false;
|
|
|
|
183
|
+ filterBtnModel.selectNig = false;
|
|
|
|
184
|
+ filterBtnModel.title = '周日';
|
|
|
|
185
|
+ weekData.add(filterBtnModel);
|
|
|
|
186
|
+ for (int i = 1; i < 7; i++) {
|
|
|
|
187
|
+ FilterBtnModel filterBtnModel = FilterBtnModel();
|
|
|
|
188
|
+ filterBtnModel.selectNoon = false;
|
|
|
|
189
|
+ filterBtnModel.selectNig = false;
|
|
|
|
190
|
+ filterBtnModel.title = '周${Utils.formatWeekDayNum(i)}';
|
|
|
|
191
|
+ weekData.add(filterBtnModel);
|
|
|
|
192
|
+ }
|
|
76
|
}
|
193
|
}
|
|
77
|
|
194
|
|
|
78
|
//创建新券 客户经理创建活动
|
195
|
//创建新券 客户经理创建活动
|
|
79
|
_createNewCoupon() async {
|
196
|
_createNewCoupon() async {
|
|
80
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
197
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
198
|
+ String from = fromDate + ' 00:00:00';
|
|
|
|
199
|
+ String end = endDate + ' 23:59:59';
|
|
81
|
Map<String, String> params = {
|
200
|
Map<String, String> params = {
|
|
82
|
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
|
201
|
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
|
|
83
|
"aname": _couponNameEditControl.text.trim(),
|
202
|
"aname": _couponNameEditControl.text.trim(),
|
|
84
|
"desc": _couponRequireEditControl.text.trim(),
|
203
|
"desc": _couponRequireEditControl.text.trim(),
|
|
85
|
"stime": fromDate == '点击选择'
|
204
|
"stime": fromDate == '点击选择'
|
|
86
|
? ""
|
205
|
? ""
|
|
87
|
- : '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}',
|
206
|
+ : '${(DateUtil.getDateMsByTimeStr(from) / 1000).floor()}',
|
|
88
|
"etime": endDate == '点击选择'
|
207
|
"etime": endDate == '点击选择'
|
|
89
|
? ''
|
208
|
? ''
|
|
90
|
- : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
|
209
|
+ : '${(DateUtil.getDateMsByTimeStr(end) / 1000).floor()}',
|
|
91
|
"explain": _couponExplainEditControl.text,
|
210
|
"explain": _couponExplainEditControl.text,
|
|
92
|
"is_open": swichState ? "1" : "0",
|
211
|
"is_open": swichState ? "1" : "0",
|
|
93
|
"status": swichState ? "1" : "0",
|
212
|
"status": swichState ? "1" : "0",
|
|
@@ -111,7 +230,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
@@ -111,7 +230,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
111
|
}
|
230
|
}
|
|
112
|
|
231
|
|
|
113
|
///输入框
|
232
|
///输入框
|
|
114
|
- Widget _textfield(String title, String hintText) {
|
233
|
+ Widget _textfield(String title, String hintText,
|
|
|
|
234
|
+ TextEditingController controller, FocusNode focusNode,
|
|
|
|
235
|
+ {TextInputType textInputType = TextInputType.text}) {
|
|
115
|
return Container(
|
236
|
return Container(
|
|
116
|
child: Row(
|
237
|
child: Row(
|
|
117
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
238
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
@@ -129,41 +250,38 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
@@ -129,41 +250,38 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
129
|
Container(
|
250
|
Container(
|
|
130
|
width: ScreenUtil().setWidth(231 * 2),
|
251
|
width: ScreenUtil().setWidth(231 * 2),
|
|
131
|
child: TextField(
|
252
|
child: TextField(
|
|
132
|
- controller: title == '券名称'
|
|
|
|
133
|
- ? _couponNameEditControl
|
|
|
|
134
|
- : _couponRequireEditControl,
|
|
|
|
135
|
- textAlign: TextAlign.right,
|
|
|
|
136
|
- textAlignVertical: TextAlignVertical.bottom,
|
|
|
|
137
|
- maxLines: 1,
|
|
|
|
138
|
- // //光标颜色
|
|
|
|
139
|
- // cursorColor:
|
|
|
|
140
|
- // widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
141
|
- //输入文本的样式
|
|
|
|
142
|
- style: TextStyle(
|
|
|
|
143
|
- color: MyColours.color_515151,
|
|
|
|
144
|
- fontSize: ScreenUtil().setSp(32),
|
|
|
|
145
|
- ),
|
|
|
|
146
|
- focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,
|
|
|
|
147
|
- decoration: InputDecoration(
|
|
|
|
148
|
- border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
149
|
- hintText: hintText,
|
|
|
|
150
|
- hintStyle: TextStyle(
|
|
|
|
151
|
- color: MyColours.color_999999,
|
253
|
+ controller: controller,
|
|
|
|
254
|
+ textAlign: TextAlign.right,
|
|
|
|
255
|
+ textAlignVertical: TextAlignVertical.bottom,
|
|
|
|
256
|
+ maxLines: 1,
|
|
|
|
257
|
+ // //光标颜色
|
|
|
|
258
|
+ // cursorColor:
|
|
|
|
259
|
+ // widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
260
|
+ //输入文本的样式
|
|
|
|
261
|
+ style: TextStyle(
|
|
|
|
262
|
+ color: MyColours.color_515151,
|
|
152
|
fontSize: ScreenUtil().setSp(32),
|
263
|
fontSize: ScreenUtil().setSp(32),
|
|
153
|
),
|
264
|
),
|
|
154
|
- enabledBorder: new UnderlineInputBorder(
|
|
|
|
155
|
- borderSide: BorderSide.none,
|
265
|
+ focusNode: focusNode,
|
|
|
|
266
|
+ decoration: InputDecoration(
|
|
|
|
267
|
+ border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
268
|
+ hintText: hintText,
|
|
|
|
269
|
+ hintStyle: TextStyle(
|
|
|
|
270
|
+ color: MyColours.color_999999,
|
|
|
|
271
|
+ fontSize: ScreenUtil().setSp(32),
|
|
|
|
272
|
+ ),
|
|
|
|
273
|
+ enabledBorder: new UnderlineInputBorder(
|
|
|
|
274
|
+ borderSide: BorderSide.none,
|
|
|
|
275
|
+ ),
|
|
|
|
276
|
+ focusedBorder: new UnderlineInputBorder(
|
|
|
|
277
|
+ borderSide: BorderSide.none,
|
|
|
|
278
|
+ ),
|
|
156
|
),
|
279
|
),
|
|
157
|
- focusedBorder: new UnderlineInputBorder(
|
|
|
|
158
|
- borderSide: BorderSide.none,
|
|
|
|
159
|
- ),
|
|
|
|
160
|
- ),
|
|
|
|
161
|
- onChanged: (value) {},
|
|
|
|
162
|
- onEditingComplete: () {
|
|
|
|
163
|
- FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
164
|
- },
|
|
|
|
165
|
- keyboardType: TextInputType.text,
|
|
|
|
166
|
- ),
|
280
|
+ onChanged: (value) {},
|
|
|
|
281
|
+ onEditingComplete: () {
|
|
|
|
282
|
+ FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
283
|
+ },
|
|
|
|
284
|
+ keyboardType: textInputType),
|
|
167
|
),
|
285
|
),
|
|
168
|
HEmptyView(32)
|
286
|
HEmptyView(32)
|
|
169
|
],
|
287
|
],
|
|
@@ -171,6 +289,77 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
@@ -171,6 +289,77 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
171
|
);
|
289
|
);
|
|
172
|
}
|
290
|
}
|
|
173
|
|
291
|
|
|
|
|
292
|
+ ///输入框
|
|
|
|
293
|
+ Widget _textfieldSelect(
|
|
|
|
294
|
+ String title,
|
|
|
|
295
|
+ String hintText,
|
|
|
|
296
|
+ TextEditingController controller,
|
|
|
|
297
|
+ FocusNode focusNode, {
|
|
|
|
298
|
+ TextInputType textInputType = TextInputType.text,
|
|
|
|
299
|
+ String subtitle = '',
|
|
|
|
300
|
+ }) {
|
|
|
|
301
|
+ return Container(
|
|
|
|
302
|
+ padding: EdgeInsets.only(left: w(20), right: (w(20))),
|
|
|
|
303
|
+ child: Row(
|
|
|
|
304
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
305
|
+ children: [
|
|
|
|
306
|
+ Container(
|
|
|
|
307
|
+ child: Text(
|
|
|
|
308
|
+ title,
|
|
|
|
309
|
+ style: TextStyle(
|
|
|
|
310
|
+ color: MyColours.color_515151,
|
|
|
|
311
|
+ fontSize: ScreenUtil().setSp(32)),
|
|
|
|
312
|
+ ),
|
|
|
|
313
|
+ ),
|
|
|
|
314
|
+ HEmptyView(40),
|
|
|
|
315
|
+ Expanded(
|
|
|
|
316
|
+ child: TextField(
|
|
|
|
317
|
+ controller: controller,
|
|
|
|
318
|
+ textAlign: TextAlign.right,
|
|
|
|
319
|
+ textAlignVertical: TextAlignVertical.bottom,
|
|
|
|
320
|
+ maxLines: 1,
|
|
|
|
321
|
+ // //光标颜色
|
|
|
|
322
|
+ // cursorColor:
|
|
|
|
323
|
+ // widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
324
|
+ //输入文本的样式
|
|
|
|
325
|
+ style: TextStyle(
|
|
|
|
326
|
+ color: MyColours.color_515151,
|
|
|
|
327
|
+ fontSize: ScreenUtil().setSp(32),
|
|
|
|
328
|
+ ),
|
|
|
|
329
|
+ focusNode: focusNode,
|
|
|
|
330
|
+ decoration: InputDecoration(
|
|
|
|
331
|
+ isCollapsed: true,
|
|
|
|
332
|
+ border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
333
|
+ hintText: hintText,
|
|
|
|
334
|
+ hintStyle: TextStyle(
|
|
|
|
335
|
+ color: MyColours.color_999999,
|
|
|
|
336
|
+ fontSize: ScreenUtil().setSp(32),
|
|
|
|
337
|
+ ),
|
|
|
|
338
|
+ enabledBorder: new UnderlineInputBorder(
|
|
|
|
339
|
+ borderSide: BorderSide.none,
|
|
|
|
340
|
+ ),
|
|
|
|
341
|
+ focusedBorder: new UnderlineInputBorder(
|
|
|
|
342
|
+ borderSide: BorderSide.none,
|
|
|
|
343
|
+ ),
|
|
|
|
344
|
+ ),
|
|
|
|
345
|
+ onChanged: (value) {},
|
|
|
|
346
|
+ onEditingComplete: () {
|
|
|
|
347
|
+ FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
348
|
+ },
|
|
|
|
349
|
+ keyboardType: textInputType),
|
|
|
|
350
|
+ ),
|
|
|
|
351
|
+ if (subtitle != '') HEmptyView(6),
|
|
|
|
352
|
+ Text(
|
|
|
|
353
|
+ subtitle,
|
|
|
|
354
|
+ style: TextStyle(
|
|
|
|
355
|
+ color: MyColours.color_515151,
|
|
|
|
356
|
+ fontSize: ScreenUtil().setSp(32)),
|
|
|
|
357
|
+ ),
|
|
|
|
358
|
+ ],
|
|
|
|
359
|
+ ),
|
|
|
|
360
|
+ );
|
|
|
|
361
|
+ }
|
|
|
|
362
|
+
|
|
174
|
///时间选择
|
363
|
///时间选择
|
|
175
|
Widget _select(String title, String hintText, GestureTapCallback onTap) {
|
364
|
Widget _select(String title, String hintText, GestureTapCallback onTap) {
|
|
176
|
return InkWell(
|
365
|
return InkWell(
|
|
@@ -363,6 +552,69 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
@@ -363,6 +552,69 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
363
|
);
|
552
|
);
|
|
364
|
}
|
553
|
}
|
|
365
|
|
554
|
|
|
|
|
555
|
+ _itemRadioWidget(bool select, String title, {GestureTapCallback onTap}) {
|
|
|
|
556
|
+ return InkWell(
|
|
|
|
557
|
+ onTap: onTap,
|
|
|
|
558
|
+ child: Row(children: [
|
|
|
|
559
|
+ Image.asset(
|
|
|
|
560
|
+ Utils.getImgPath(
|
|
|
|
561
|
+ select ? 'plan_dish_select' : 'plan_dish_unselect'),
|
|
|
|
562
|
+ width: w(20),
|
|
|
|
563
|
+ ),
|
|
|
|
564
|
+ HEmptyView(6),
|
|
|
|
565
|
+ Text(
|
|
|
|
566
|
+ title,
|
|
|
|
567
|
+ style: TextStyle(
|
|
|
|
568
|
+ color: MyColours.color_515151,
|
|
|
|
569
|
+ fontSize: ScreenUtil().setSp(32)),
|
|
|
|
570
|
+ ),
|
|
|
|
571
|
+ ]));
|
|
|
|
572
|
+ }
|
|
|
|
573
|
+
|
|
|
|
574
|
+ ///时间选择
|
|
|
|
575
|
+ Widget _select1(String title, String hintText, GestureTapCallback onTap) {
|
|
|
|
576
|
+ return InkWell(
|
|
|
|
577
|
+ onTap: onTap,
|
|
|
|
578
|
+ child: Container(
|
|
|
|
579
|
+ padding: EdgeInsets.only(left: ScreenUtil().setWidth(32)),
|
|
|
|
580
|
+ child: Row(
|
|
|
|
581
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
582
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
583
|
+ children: [
|
|
|
|
584
|
+ Container(
|
|
|
|
585
|
+ // height: ScreenUtil().setWidth(40),
|
|
|
|
586
|
+ // color: Colors.red,
|
|
|
|
587
|
+ child: Text(
|
|
|
|
588
|
+ title,
|
|
|
|
589
|
+ style: TextStyle(
|
|
|
|
590
|
+ height: 1.5,
|
|
|
|
591
|
+ color: title == '点击设置可用日期'
|
|
|
|
592
|
+ ? MyColours.color_999999
|
|
|
|
593
|
+ : MyColours.color_515151,
|
|
|
|
594
|
+ fontSize: ScreenUtil().setSp(32)),
|
|
|
|
595
|
+ ),
|
|
|
|
596
|
+ ),
|
|
|
|
597
|
+ HEmptyView(20),
|
|
|
|
598
|
+ Spacer(),
|
|
|
|
599
|
+ Text(hintText,
|
|
|
|
600
|
+ style: TextStyle(
|
|
|
|
601
|
+ color: hintText == '点击设置开始日期' || hintText == '点击设置结束日期'
|
|
|
|
602
|
+ ? MyColours.color_999999
|
|
|
|
603
|
+ : MyColours.color_515151,
|
|
|
|
604
|
+ fontSize: ScreenUtil().setSp(32),
|
|
|
|
605
|
+ )),
|
|
|
|
606
|
+ HEmptyView(20),
|
|
|
|
607
|
+ Image.asset(
|
|
|
|
608
|
+ Utils.getImgPath('arrow_right_new'),
|
|
|
|
609
|
+ width: ScreenUtil().setWidth(18),
|
|
|
|
610
|
+ ),
|
|
|
|
611
|
+ HEmptyView(32),
|
|
|
|
612
|
+ ],
|
|
|
|
613
|
+ ),
|
|
|
|
614
|
+ ),
|
|
|
|
615
|
+ );
|
|
|
|
616
|
+ }
|
|
|
|
617
|
+
|
|
366
|
@override
|
618
|
@override
|
|
367
|
Widget build(BuildContext context) {
|
619
|
Widget build(BuildContext context) {
|
|
368
|
couponProvider = Provider.of<CouponProvider>(context, listen: true);
|
620
|
couponProvider = Provider.of<CouponProvider>(context, listen: true);
|
|
@@ -412,13 +664,110 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
@@ -412,13 +664,110 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
412
|
color: MyColours.color_E7E7E7,
|
664
|
color: MyColours.color_E7E7E7,
|
|
413
|
),
|
665
|
),
|
|
414
|
widget.isMine ? SizedBox() : VEmptyView(24),
|
666
|
widget.isMine ? SizedBox() : VEmptyView(24),
|
|
415
|
- _textfield('券名称', '例:9折券/200元代金券/菜品券'),
|
667
|
+ _textfield('券名称', '例:9折券/200元代金券/菜品券',
|
|
|
|
668
|
+ _couponNameEditControl, _nameFocusNode),
|
|
416
|
Container(
|
669
|
Container(
|
|
417
|
height: ScreenUtil().setWidth(2),
|
670
|
height: ScreenUtil().setWidth(2),
|
|
418
|
color: MyColours.color_E7E7E7,
|
671
|
color: MyColours.color_E7E7E7,
|
|
419
|
),
|
672
|
),
|
|
420
|
VEmptyView(24),
|
673
|
VEmptyView(24),
|
|
421
|
- _textfield('券要求', '例:无门槛/满2000元'),
|
674
|
+ if (!widget.isMine)
|
|
|
|
675
|
+ Column(
|
|
|
|
676
|
+ children: [
|
|
|
|
677
|
+ //销售价
|
|
|
|
678
|
+
|
|
|
|
679
|
+ _textfield('销售价', '默认0元,可以免费发放',
|
|
|
|
680
|
+ _priceControl, _priceFocusNode,
|
|
|
|
681
|
+ textInputType:
|
|
|
|
682
|
+ TextInputType.numberWithOptions()),
|
|
|
|
683
|
+
|
|
|
|
684
|
+ Container(
|
|
|
|
685
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
686
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
687
|
+ ),
|
|
|
|
688
|
+ // VEmptyView(24),
|
|
|
|
689
|
+ //券用途
|
|
|
|
690
|
+ VEmptyView(56),
|
|
|
|
691
|
+ Container(
|
|
|
|
692
|
+ alignment: Alignment.centerLeft,
|
|
|
|
693
|
+ child: Text(
|
|
|
|
694
|
+ '券用途',
|
|
|
|
695
|
+ style: TextStyle(
|
|
|
|
696
|
+ color: Color.fromRGBO(0, 0, 0, 0.9),
|
|
|
|
697
|
+ fontWeight: FontWeight.bold,
|
|
|
|
698
|
+ fontSize: ScreenUtil().setSp(32)),
|
|
|
|
699
|
+ ),
|
|
|
|
700
|
+ ),
|
|
|
|
701
|
+ VEmptyView(40),
|
|
|
|
702
|
+ Row(
|
|
|
|
703
|
+ children: [
|
|
|
|
704
|
+ HEmptyView(30),
|
|
|
|
705
|
+ _itemRadioWidget(money, '代金券',
|
|
|
|
706
|
+ onTap: () {
|
|
|
|
707
|
+ if (!money) {
|
|
|
|
708
|
+ setState(() {
|
|
|
|
709
|
+ money = true;
|
|
|
|
710
|
+
|
|
|
|
711
|
+ dish = false;
|
|
|
|
712
|
+ discount = false;
|
|
|
|
713
|
+ });
|
|
|
|
714
|
+ }
|
|
|
|
715
|
+ }),
|
|
|
|
716
|
+ Spacer(),
|
|
|
|
717
|
+ _itemRadioWidget(discount, '折扣券',
|
|
|
|
718
|
+ onTap: () {
|
|
|
|
719
|
+ if (!discount) {
|
|
|
|
720
|
+ setState(() {
|
|
|
|
721
|
+ discount = true;
|
|
|
|
722
|
+
|
|
|
|
723
|
+ dish = false;
|
|
|
|
724
|
+ money = false;
|
|
|
|
725
|
+ });
|
|
|
|
726
|
+ }
|
|
|
|
727
|
+ }),
|
|
|
|
728
|
+ Spacer(),
|
|
|
|
729
|
+ _itemRadioWidget(dish, '菜品券',
|
|
|
|
730
|
+ onTap: () {
|
|
|
|
731
|
+ if (!dish) {
|
|
|
|
732
|
+ setState(() {
|
|
|
|
733
|
+ dish = true;
|
|
|
|
734
|
+ discount = false;
|
|
|
|
735
|
+ money = false;
|
|
|
|
736
|
+ });
|
|
|
|
737
|
+ }
|
|
|
|
738
|
+ }),
|
|
|
|
739
|
+ HEmptyView(30),
|
|
|
|
740
|
+ ],
|
|
|
|
741
|
+ ),
|
|
|
|
742
|
+ VEmptyView(30),
|
|
|
|
743
|
+
|
|
|
|
744
|
+ if (money)
|
|
|
|
745
|
+ _textfieldSelect('金额:', '点击输入代金券金额',
|
|
|
|
746
|
+ moneyControl, moneyFocusNode,
|
|
|
|
747
|
+ subtitle: '元',
|
|
|
|
748
|
+ textInputType: TextInputType
|
|
|
|
749
|
+ .numberWithOptions()),
|
|
|
|
750
|
+ if (discount)
|
|
|
|
751
|
+ _textfieldSelect('折扣率:', '点击输入折扣,如9折',
|
|
|
|
752
|
+ moneyControl, moneyFocusNode,
|
|
|
|
753
|
+ subtitle: '折',
|
|
|
|
754
|
+ textInputType: TextInputType
|
|
|
|
755
|
+ .numberWithOptions()),
|
|
|
|
756
|
+
|
|
|
|
757
|
+ if (dish)
|
|
|
|
758
|
+ _textfieldSelect('菜品:', '点击输入赠送菜品名称',
|
|
|
|
759
|
+ moneyControl, moneyFocusNode,
|
|
|
|
760
|
+ textInputType: TextInputType
|
|
|
|
761
|
+ .numberWithOptions()),
|
|
|
|
762
|
+ VEmptyView(48),
|
|
|
|
763
|
+ Container(
|
|
|
|
764
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
765
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
766
|
+ ),
|
|
|
|
767
|
+ ],
|
|
|
|
768
|
+ ),
|
|
|
|
769
|
+ _textfield('券要求', '例:无门槛/满2000元',
|
|
|
|
770
|
+ _couponRequireEditControl, _requireFocusNode),
|
|
422
|
Container(
|
771
|
Container(
|
|
423
|
height: ScreenUtil().setWidth(2),
|
772
|
height: ScreenUtil().setWidth(2),
|
|
424
|
color: MyColours.color_E7E7E7,
|
773
|
color: MyColours.color_E7E7E7,
|
|
@@ -440,12 +789,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
@@ -440,12 +789,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
440
|
print(value);
|
789
|
print(value);
|
|
441
|
fromDate = DateUtil.formatDateStr(
|
790
|
fromDate = DateUtil.formatDateStr(
|
|
442
|
value,
|
791
|
value,
|
|
443
|
- format: DateFormats.full);
|
792
|
+ format: DateFormats.y_mo_d);
|
|
444
|
});
|
793
|
});
|
|
445
|
}
|
794
|
}
|
|
446
|
showDateSelWidget = false;
|
795
|
showDateSelWidget = false;
|
|
447
|
},
|
796
|
},
|
|
448
|
dateTime: DateUtil.getDateTime(fromDate),
|
797
|
dateTime: DateUtil.getDateTime(fromDate),
|
|
|
|
798
|
+ pickerDateTimeType: PickerDateTimeType.kYMD,
|
|
449
|
onCancel: () {
|
799
|
onCancel: () {
|
|
450
|
showDateSelWidget = false;
|
800
|
showDateSelWidget = false;
|
|
451
|
});
|
801
|
});
|
|
@@ -471,12 +821,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
@@ -471,12 +821,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
471
|
print(value);
|
821
|
print(value);
|
|
472
|
endDate = DateUtil.formatDateStr(
|
822
|
endDate = DateUtil.formatDateStr(
|
|
473
|
value,
|
823
|
value,
|
|
474
|
- format: DateFormats.full);
|
824
|
+ format: DateFormats.y_mo_d);
|
|
475
|
});
|
825
|
});
|
|
476
|
}
|
826
|
}
|
|
477
|
showDateSelWidget = false;
|
827
|
showDateSelWidget = false;
|
|
478
|
},
|
828
|
},
|
|
479
|
dateTime: DateUtil.getDateTime(endDate),
|
829
|
dateTime: DateUtil.getDateTime(endDate),
|
|
|
|
830
|
+ pickerDateTimeType: PickerDateTimeType.kYMD,
|
|
480
|
onCancel: () {
|
831
|
onCancel: () {
|
|
481
|
showDateSelWidget = false;
|
832
|
showDateSelWidget = false;
|
|
482
|
});
|
833
|
});
|
|
@@ -486,6 +837,127 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
@@ -486,6 +837,127 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
486
|
color: MyColours.color_E7E7E7,
|
837
|
color: MyColours.color_E7E7E7,
|
|
487
|
),
|
838
|
),
|
|
488
|
VEmptyView(24),
|
839
|
VEmptyView(24),
|
|
|
|
840
|
+ if (!widget.isMine)
|
|
|
|
841
|
+ Column(
|
|
|
|
842
|
+ children: [
|
|
|
|
843
|
+ //使用限制
|
|
|
|
844
|
+ VEmptyView(24),
|
|
|
|
845
|
+ Container(
|
|
|
|
846
|
+ alignment: Alignment.centerLeft,
|
|
|
|
847
|
+ child: Text(
|
|
|
|
848
|
+ '使用限制',
|
|
|
|
849
|
+ style: TextStyle(
|
|
|
|
850
|
+ color: Color.fromRGBO(0, 0, 0, 0.9),
|
|
|
|
851
|
+ fontWeight: FontWeight.bold,
|
|
|
|
852
|
+ fontSize: ScreenUtil().setSp(32)),
|
|
|
|
853
|
+ ),
|
|
|
|
854
|
+ ),
|
|
|
|
855
|
+ VEmptyView(40),
|
|
|
|
856
|
+ Row(
|
|
|
|
857
|
+ children: [
|
|
|
|
858
|
+ HEmptyView(30),
|
|
|
|
859
|
+ _itemRadioWidget(limitNone, '无',
|
|
|
|
860
|
+ onTap: () {
|
|
|
|
861
|
+ if (!limitNone) {
|
|
|
|
862
|
+ setState(() {
|
|
|
|
863
|
+ limitNone = true;
|
|
|
|
864
|
+
|
|
|
|
865
|
+ limitWeek = false;
|
|
|
|
866
|
+ limitBirthday = false;
|
|
|
|
867
|
+ });
|
|
|
|
868
|
+ }
|
|
|
|
869
|
+ }),
|
|
|
|
870
|
+ Spacer(),
|
|
|
|
871
|
+ _itemRadioWidget(limitWeek, '每周',
|
|
|
|
872
|
+ onTap: () {
|
|
|
|
873
|
+ if (!limitWeek) {
|
|
|
|
874
|
+ setState(() {
|
|
|
|
875
|
+ limitWeek = true;
|
|
|
|
876
|
+
|
|
|
|
877
|
+ limitNone = false;
|
|
|
|
878
|
+ limitBirthday = false;
|
|
|
|
879
|
+ });
|
|
|
|
880
|
+ }
|
|
|
|
881
|
+ }),
|
|
|
|
882
|
+ Spacer(),
|
|
|
|
883
|
+ _itemRadioWidget(
|
|
|
|
884
|
+ limitBirthday, '会员生日当天', onTap: () {
|
|
|
|
885
|
+ if (!limitBirthday) {
|
|
|
|
886
|
+ setState(() {
|
|
|
|
887
|
+ limitBirthday = true;
|
|
|
|
888
|
+ limitNone = false;
|
|
|
|
889
|
+ limitWeek = false;
|
|
|
|
890
|
+ });
|
|
|
|
891
|
+ }
|
|
|
|
892
|
+ }),
|
|
|
|
893
|
+ HEmptyView(30),
|
|
|
|
894
|
+ ],
|
|
|
|
895
|
+ ),
|
|
|
|
896
|
+ if (limitWeek) VEmptyView(30),
|
|
|
|
897
|
+
|
|
|
|
898
|
+ if (limitWeek)
|
|
|
|
899
|
+ _select1(weekShow, '', () async {
|
|
|
|
900
|
+ FocusScope.of(context).requestFocus(
|
|
|
|
901
|
+ FocusNode()); //点击空白处隐藏键盘
|
|
|
|
902
|
+ //弹出时间选择器
|
|
|
|
903
|
+ // showPickerDateTime(context);
|
|
|
|
904
|
+ showDateSelWidget = false;
|
|
|
|
905
|
+
|
|
|
|
906
|
+ List<FilterBtnModel> data = await DialogUtil
|
|
|
|
907
|
+ .openCoponsWeekSelectModalBottomSheet(
|
|
|
|
908
|
+ context, weekData);
|
|
|
|
909
|
+ if (data != null) {
|
|
|
|
910
|
+ //改变了
|
|
|
|
911
|
+ weekData = [];
|
|
|
|
912
|
+ weekData.addAll(data);
|
|
|
|
913
|
+ weekShow = '';
|
|
|
|
914
|
+
|
|
|
|
915
|
+ String noonStr = '午餐:';
|
|
|
|
916
|
+ String nightStr = '晚餐:';
|
|
|
|
917
|
+
|
|
|
|
918
|
+ weekData.forEach((element) {
|
|
|
|
919
|
+ if (element.selectNoon) {
|
|
|
|
920
|
+ noonStr += '${element.title} ';
|
|
|
|
921
|
+ }
|
|
|
|
922
|
+ if (element.selectNig) {
|
|
|
|
923
|
+ nightStr += '${element.title} ';
|
|
|
|
924
|
+ }
|
|
|
|
925
|
+ });
|
|
|
|
926
|
+ if (noonStr.endsWith(' ')) {
|
|
|
|
927
|
+ noonStr = noonStr.substring(
|
|
|
|
928
|
+ 0, noonStr.length - 1);
|
|
|
|
929
|
+ }
|
|
|
|
930
|
+ if (nightStr.endsWith(' ')) {
|
|
|
|
931
|
+ nightStr = nightStr.substring(
|
|
|
|
932
|
+ 0, nightStr.length - 1);
|
|
|
|
933
|
+ }
|
|
|
|
934
|
+
|
|
|
|
935
|
+ if (noonStr == '午餐:' &&
|
|
|
|
936
|
+ nightStr == '晚餐:') {
|
|
|
|
937
|
+ weekShow = '点击设置可用日期';
|
|
|
|
938
|
+ } else {
|
|
|
|
939
|
+ if (noonStr != '午餐:' &&
|
|
|
|
940
|
+ nightStr != '晚餐:') {
|
|
|
|
941
|
+ weekShow =
|
|
|
|
942
|
+ noonStr + '\n' + nightStr;
|
|
|
|
943
|
+ } else if (noonStr != '午餐:') {
|
|
|
|
944
|
+ weekShow = noonStr;
|
|
|
|
945
|
+ } else {
|
|
|
|
946
|
+ weekShow = nightStr;
|
|
|
|
947
|
+ }
|
|
|
|
948
|
+ }
|
|
|
|
949
|
+
|
|
|
|
950
|
+ setState(() {});
|
|
|
|
951
|
+ }
|
|
|
|
952
|
+ }),
|
|
|
|
953
|
+ limitWeek ? VEmptyView(22) : VEmptyView(48),
|
|
|
|
954
|
+ Container(
|
|
|
|
955
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
956
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
957
|
+ ),
|
|
|
|
958
|
+ VEmptyView(48),
|
|
|
|
959
|
+ ],
|
|
|
|
960
|
+ ),
|
|
489
|
widget.isMine
|
961
|
widget.isMine
|
|
490
|
? SizedBox()
|
962
|
? SizedBox()
|
|
491
|
: _select('谁可以发放', '编辑', () async {
|
963
|
: _select('谁可以发放', '编辑', () async {
|