|
@@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
@@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
4
|
import 'package:one_key/net/dio_util.dart';
|
4
|
import 'package:one_key/net/dio_util.dart';
|
|
5
|
|
5
|
|
|
6
|
import 'package:one_key/provider/coupon_provider.dart';
|
6
|
import 'package:one_key/provider/coupon_provider.dart';
|
|
|
|
7
|
+import 'package:one_key/provider/user_model.dart';
|
|
7
|
|
8
|
|
|
8
|
import 'package:one_key/res/colors.dart';
|
9
|
import 'package:one_key/res/colors.dart';
|
|
9
|
import 'package:one_key/utils/dialog_util.dart';
|
10
|
import 'package:one_key/utils/dialog_util.dart';
|
|
@@ -15,15 +16,19 @@ import 'package:one_key/widgets/system_app_bar.dart'; |
|
@@ -15,15 +16,19 @@ import 'package:one_key/widgets/system_app_bar.dart'; |
|
15
|
import 'package:one_key/widgets/v_empty_view.dart';
|
16
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
16
|
import 'package:provider/provider.dart';
|
17
|
import 'package:provider/provider.dart';
|
|
17
|
|
18
|
|
|
|
|
19
|
+import '../../constant/state.dart';
|
|
18
|
import '../../utils/screen_util.dart';
|
20
|
import '../../utils/screen_util.dart';
|
|
|
|
21
|
+import '../../widgets/page_exception.dart';
|
|
19
|
|
22
|
|
|
20
|
/**
|
23
|
/**
|
|
21
|
* 核销券详情页
|
24
|
* 核销券详情页
|
|
22
|
*/
|
25
|
*/
|
|
23
|
|
26
|
|
|
24
|
class VerificationCouponPage extends StatefulWidget {
|
27
|
class VerificationCouponPage extends StatefulWidget {
|
|
|
|
28
|
+ final String idstr;
|
|
25
|
VerificationCouponPage({
|
29
|
VerificationCouponPage({
|
|
26
|
Key key,
|
30
|
Key key,
|
|
|
|
31
|
+ this.idstr,
|
|
27
|
}) : super(key: key);
|
32
|
}) : super(key: key);
|
|
28
|
|
33
|
|
|
29
|
@override
|
34
|
@override
|
|
@@ -34,10 +39,135 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> { |
|
@@ -34,10 +39,135 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> { |
|
34
|
ScrollController controller = ScrollController();
|
39
|
ScrollController controller = ScrollController();
|
|
35
|
final heightCell = ScreenUtil().setWidth(80);
|
40
|
final heightCell = ScreenUtil().setWidth(80);
|
|
36
|
CouponProvider couponProvider;
|
41
|
CouponProvider couponProvider;
|
|
|
|
42
|
+ PageState pageState = PageState.Loading;
|
|
|
|
43
|
+ bool canUse = true;
|
|
|
|
44
|
+ bool past = false; //是否过期
|
|
|
|
45
|
+ int currTimeIndex;
|
|
|
|
46
|
+ bool limit = false;
|
|
37
|
|
47
|
|
|
38
|
@override
|
48
|
@override
|
|
39
|
void initState() {
|
49
|
void initState() {
|
|
40
|
super.initState();
|
50
|
super.initState();
|
|
|
|
51
|
+
|
|
|
|
52
|
+ WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
53
|
+ // _couponNetworkData(0);
|
|
|
|
54
|
+ initTime(context);
|
|
|
|
55
|
+ _getOrderRechargeByid();
|
|
|
|
56
|
+ });
|
|
|
|
57
|
+ }
|
|
|
|
58
|
+
|
|
|
|
59
|
+ //初始化时间
|
|
|
|
60
|
+ initTime(BuildContext context) async {
|
|
|
|
61
|
+ UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
62
|
+ DateTime dateTime = DateTime.now();
|
|
|
|
63
|
+
|
|
|
|
64
|
+ // String morning =
|
|
|
|
65
|
+ // userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
|
|
|
|
66
|
+ String noon =
|
|
|
|
67
|
+ userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
|
|
|
|
68
|
+ String night =
|
|
|
|
69
|
+ userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
|
|
|
|
70
|
+
|
|
|
|
71
|
+ if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
|
|
|
|
72
|
+ "-" +
|
|
|
|
73
|
+ Utils.addZeroNumber(dateTime.month) +
|
|
|
|
74
|
+ "-" +
|
|
|
|
75
|
+ Utils.addZeroNumber(dateTime.day) +
|
|
|
|
76
|
+ " " +
|
|
|
|
77
|
+ noon.split("-")[0] +
|
|
|
|
78
|
+ ":00")) &&
|
|
|
|
79
|
+ dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
80
|
+ "-" +
|
|
|
|
81
|
+ Utils.addZeroNumber(dateTime.month) +
|
|
|
|
82
|
+ "-" +
|
|
|
|
83
|
+ Utils.addZeroNumber(dateTime.day) +
|
|
|
|
84
|
+ " " +
|
|
|
|
85
|
+ noon.split("-")[1] +
|
|
|
|
86
|
+ ":00"))) {
|
|
|
|
87
|
+ //午餐时间内
|
|
|
|
88
|
+ currTimeIndex = 2;
|
|
|
|
89
|
+ } else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
|
|
|
|
90
|
+ "-" +
|
|
|
|
91
|
+ Utils.addZeroNumber(dateTime.month) +
|
|
|
|
92
|
+ "-" +
|
|
|
|
93
|
+ Utils.addZeroNumber(dateTime.day) +
|
|
|
|
94
|
+ " " +
|
|
|
|
95
|
+ night.split("-")[0] +
|
|
|
|
96
|
+ ":00")) &&
|
|
|
|
97
|
+ dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
98
|
+ "-" +
|
|
|
|
99
|
+ Utils.addZeroNumber(dateTime.month) +
|
|
|
|
100
|
+ "-" +
|
|
|
|
101
|
+ Utils.addZeroNumber(dateTime.day) +
|
|
|
|
102
|
+ " " +
|
|
|
|
103
|
+ night.split("-")[1] +
|
|
|
|
104
|
+ ":00"))) {
|
|
|
|
105
|
+ //晚市
|
|
|
|
106
|
+ currTimeIndex = 3;
|
|
|
|
107
|
+ } else {
|
|
|
|
108
|
+ //不在时间段内,不可使用
|
|
|
|
109
|
+ currTimeIndex = null;
|
|
|
|
110
|
+ }
|
|
|
|
111
|
+ }
|
|
|
|
112
|
+
|
|
|
|
113
|
+ _getOrderRechargeByid(
|
|
|
|
114
|
+ {PageState pageS = PageState.Loading, bool isShowLoading = true}) async {
|
|
|
|
115
|
+ pageState = pageS;
|
|
|
|
116
|
+ bool success = await couponProvider.getOrderRechargeByid(
|
|
|
|
117
|
+ context, {'id': widget.idstr},
|
|
|
|
118
|
+ isShowLoading: isShowLoading);
|
|
|
|
119
|
+ if (success) {
|
|
|
|
120
|
+ pageState = PageState.Success;
|
|
|
|
121
|
+
|
|
|
|
122
|
+ DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
123
|
+ int.parse(couponProvider.orderRechargeByidSunModel.activity.etime) *
|
|
|
|
124
|
+ 1000);
|
|
|
|
125
|
+
|
|
|
|
126
|
+ Duration days = dateTime.difference(DateTime.now());
|
|
|
|
127
|
+
|
|
|
|
128
|
+ print(days);
|
|
|
|
129
|
+ if (days.inDays < 0) {
|
|
|
|
130
|
+ //
|
|
|
|
131
|
+ past = true; //过期了
|
|
|
|
132
|
+ } else {
|
|
|
|
133
|
+ past = false; //没过期
|
|
|
|
134
|
+ }
|
|
|
|
135
|
+
|
|
|
|
136
|
+ if (couponProvider.orderRechargeByidSunModel.activity.expDate.isWeek) {
|
|
|
|
137
|
+ //使用限制是每周
|
|
|
|
138
|
+ List noonWeek = [];
|
|
|
|
139
|
+ List nightWeek = [];
|
|
|
|
140
|
+ couponProvider.orderRechargeByidSunModel.activity.expDate.weekData
|
|
|
|
141
|
+ .forEach((element) {
|
|
|
|
142
|
+ if (element.selectNoon) {
|
|
|
|
143
|
+ //午餐选中
|
|
|
|
144
|
+ noonWeek.add(element.title);
|
|
|
|
145
|
+ } else if (element.selectNig) {
|
|
|
|
146
|
+ //晚餐选中
|
|
|
|
147
|
+ nightWeek.add(element.title);
|
|
|
|
148
|
+ }
|
|
|
|
149
|
+ });
|
|
|
|
150
|
+ //获取当前是周几
|
|
|
|
151
|
+ String weekday = '周${Utils.formatWeekDayNum(DateTime.now().weekday)}';
|
|
|
|
152
|
+ if ((currTimeIndex == 2 && noonWeek.contains(weekday)) ||
|
|
|
|
153
|
+ (currTimeIndex == 3 && nightWeek.contains(weekday))) {
|
|
|
|
154
|
+ //可用
|
|
|
|
155
|
+ } else {
|
|
|
|
156
|
+ //不可用
|
|
|
|
157
|
+ limit = true;
|
|
|
|
158
|
+ }
|
|
|
|
159
|
+ }
|
|
|
|
160
|
+
|
|
|
|
161
|
+ if (couponProvider.orderRechargeByidSunModel.isExamine == '1' || past) {
|
|
|
|
162
|
+ //已核销or过期
|
|
|
|
163
|
+ canUse = false;
|
|
|
|
164
|
+ } else {
|
|
|
|
165
|
+ canUse = true;
|
|
|
|
166
|
+ }
|
|
|
|
167
|
+ } else {
|
|
|
|
168
|
+ pageState = PageState.ConnectivityError;
|
|
|
|
169
|
+ }
|
|
|
|
170
|
+ setState(() {});
|
|
41
|
}
|
171
|
}
|
|
42
|
|
172
|
|
|
43
|
///时间选择
|
173
|
///时间选择
|
|
@@ -118,175 +248,281 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> { |
|
@@ -118,175 +248,281 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> { |
|
118
|
Widget build(BuildContext context) {
|
248
|
Widget build(BuildContext context) {
|
|
119
|
couponProvider = Provider.of<CouponProvider>(context, listen: true);
|
249
|
couponProvider = Provider.of<CouponProvider>(context, listen: true);
|
|
120
|
return Scaffold(
|
250
|
return Scaffold(
|
|
121
|
- backgroundColor: MyColours.color_ffffff,
|
|
|
|
122
|
- appBar: SystemAppBar(
|
|
|
|
123
|
- '优惠券详情',
|
|
|
|
124
|
- onTap: () {
|
|
|
|
125
|
- Navigator.pop(context);
|
|
|
|
126
|
- },
|
|
|
|
127
|
- ),
|
|
|
|
128
|
- body: Column(children: [
|
|
|
|
129
|
- Expanded(
|
|
|
|
130
|
- child: SingleChildScrollView(
|
|
|
|
131
|
- controller: controller,
|
|
|
|
132
|
- physics: BouncingScrollPhysics(),
|
|
|
|
133
|
- child: Padding(
|
|
|
|
134
|
- padding: EdgeInsets.symmetric(
|
|
|
|
135
|
- horizontal: ScreenUtil().setWidth(32)),
|
|
|
|
136
|
- child: Column(
|
|
|
|
137
|
- children: [
|
|
|
|
138
|
- VEmptyView(56),
|
|
|
|
139
|
- _item('券用途', '代金券/折扣券/菜品券',
|
|
|
|
140
|
- textColor: MyColours.color_438E93, fontSize: 20),
|
|
|
|
141
|
- Container(
|
|
|
|
142
|
- height: ScreenUtil().setWidth(2),
|
|
|
|
143
|
- color: MyColours.color_E7E7E7,
|
|
|
|
144
|
- ),
|
|
|
|
145
|
- VEmptyView(24),
|
|
|
|
146
|
- _item('券金额/折扣率/所含菜品', '200元/9折/精品烤鸭',
|
|
|
|
147
|
- textColor: MyColours.color_438E93, fontSize: 20),
|
|
|
|
148
|
- Container(
|
|
|
|
149
|
- height: ScreenUtil().setWidth(2),
|
|
|
|
150
|
- color: MyColours.color_E7E7E7,
|
251
|
+ backgroundColor: MyColours.color_ffffff,
|
|
|
|
252
|
+ appBar: SystemAppBar(
|
|
|
|
253
|
+ '优惠券详情',
|
|
|
|
254
|
+ onTap: () {
|
|
|
|
255
|
+ Navigator.pop(context);
|
|
|
|
256
|
+ },
|
|
|
|
257
|
+ ),
|
|
|
|
258
|
+ body: Consumer<CouponProvider>(builder: (context, model, _) {
|
|
|
|
259
|
+ if (pageState != PageState.Success) {
|
|
|
|
260
|
+ return ExceptionPage(
|
|
|
|
261
|
+ pageState: pageState,
|
|
|
|
262
|
+ callback: () {
|
|
|
|
263
|
+ _getOrderRechargeByid();
|
|
|
|
264
|
+ },
|
|
|
|
265
|
+ emptyMsg: "暂时没有数据哦,",
|
|
|
|
266
|
+ emptyImg: "empty_search",
|
|
|
|
267
|
+ showMsg: "加载中,请稍后...",
|
|
|
|
268
|
+ );
|
|
|
|
269
|
+ } else {
|
|
|
|
270
|
+ return Column(children: [
|
|
|
|
271
|
+ Expanded(
|
|
|
|
272
|
+ child: SingleChildScrollView(
|
|
|
|
273
|
+ controller: controller,
|
|
|
|
274
|
+ physics: BouncingScrollPhysics(),
|
|
|
|
275
|
+ child: Padding(
|
|
|
|
276
|
+ padding: EdgeInsets.symmetric(
|
|
|
|
277
|
+ horizontal: ScreenUtil().setWidth(32)),
|
|
|
|
278
|
+ child: Column(
|
|
|
|
279
|
+ children: [
|
|
|
|
280
|
+ VEmptyView(56),
|
|
|
|
281
|
+ _item(
|
|
|
|
282
|
+ model.orderRechargeByidSunModel.activity.use ==
|
|
|
|
283
|
+ null
|
|
|
|
284
|
+ ? '券名称'
|
|
|
|
285
|
+ : '券用途',
|
|
|
|
286
|
+ model.orderRechargeByidSunModel.activity.use ==
|
|
|
|
287
|
+ null
|
|
|
|
288
|
+ ? model.orderRechargeByidSunModel.activity
|
|
|
|
289
|
+ .aname
|
|
|
|
290
|
+ : model.orderRechargeByidSunModel.activity
|
|
|
|
291
|
+ .use.isCash
|
|
|
|
292
|
+ ? '代金券'
|
|
|
|
293
|
+ : model.orderRechargeByidSunModel
|
|
|
|
294
|
+ .activity.use.isDiscount
|
|
|
|
295
|
+ ? '折扣券'
|
|
|
|
296
|
+ : model.orderRechargeByidSunModel
|
|
|
|
297
|
+ .activity.use.isDish
|
|
|
|
298
|
+ ? '菜品券'
|
|
|
|
299
|
+ : '',
|
|
|
|
300
|
+ textColor: MyColours.color_438E93,
|
|
|
|
301
|
+ fontSize: 20),
|
|
|
|
302
|
+ if (model.orderRechargeByidSunModel.activity.use !=
|
|
|
|
303
|
+ null)
|
|
|
|
304
|
+ Column(
|
|
|
|
305
|
+ children: [
|
|
|
|
306
|
+ Container(
|
|
|
|
307
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
308
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
309
|
+ ),
|
|
|
|
310
|
+ VEmptyView(24),
|
|
|
|
311
|
+ _item(
|
|
|
|
312
|
+ model.orderRechargeByidSunModel.activity
|
|
|
|
313
|
+ .use.isCash
|
|
|
|
314
|
+ ? '券金额'
|
|
|
|
315
|
+ : model.orderRechargeByidSunModel
|
|
|
|
316
|
+ .activity.use.isDiscount
|
|
|
|
317
|
+ ? '折扣率'
|
|
|
|
318
|
+ : model.orderRechargeByidSunModel
|
|
|
|
319
|
+ .activity.use.isDish
|
|
|
|
320
|
+ ? '所含菜品'
|
|
|
|
321
|
+ : '',
|
|
|
|
322
|
+ model.orderRechargeByidSunModel.activity
|
|
|
|
323
|
+ .use.isCash
|
|
|
|
324
|
+ ? '${model.orderRechargeByidSunModel.activity.use.cash}元'
|
|
|
|
325
|
+ : model.orderRechargeByidSunModel
|
|
|
|
326
|
+ .activity.use.isDiscount
|
|
|
|
327
|
+ ? '${model.orderRechargeByidSunModel.activity.use.discount}折'
|
|
|
|
328
|
+ : model.orderRechargeByidSunModel
|
|
|
|
329
|
+ .activity.use.isDish
|
|
|
|
330
|
+ ? model
|
|
|
|
331
|
+ .couponSunModel.use.dish
|
|
|
|
332
|
+ : '',
|
|
|
|
333
|
+ textColor: MyColours.color_438E93,
|
|
|
|
334
|
+ fontSize: 20),
|
|
|
|
335
|
+ ],
|
|
|
|
336
|
+ ),
|
|
|
|
337
|
+ Container(
|
|
|
|
338
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
339
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
340
|
+ ),
|
|
|
|
341
|
+ VEmptyView(24),
|
|
|
|
342
|
+ _item(
|
|
|
|
343
|
+ '券要求',
|
|
|
|
344
|
+ model.orderRechargeByidSunModel.activity.desc ??
|
|
|
|
345
|
+ ''),
|
|
|
|
346
|
+ Container(
|
|
|
|
347
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
348
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
349
|
+ ),
|
|
|
|
350
|
+ VEmptyView(24),
|
|
|
|
351
|
+ _item(
|
|
|
|
352
|
+ '有效期从',
|
|
|
|
353
|
+ Utils.getDateStrFromJiekou(model
|
|
|
|
354
|
+ .orderRechargeByidSunModel.activity.stime)),
|
|
|
|
355
|
+ Container(
|
|
|
|
356
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
357
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
358
|
+ ),
|
|
|
|
359
|
+ VEmptyView(24),
|
|
|
|
360
|
+ _item(
|
|
|
|
361
|
+ '有效期至',
|
|
|
|
362
|
+ Utils.getDateStrFromJiekou(model
|
|
|
|
363
|
+ .orderRechargeByidSunModel.activity.etime)),
|
|
|
|
364
|
+ // widget.couponSunModel.isType == '1'
|
|
|
|
365
|
+ // ? Column(
|
|
|
|
366
|
+ // crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
367
|
+ // children: [
|
|
|
|
368
|
+ // Container(
|
|
|
|
369
|
+ // height: ScreenUtil().setWidth(2),
|
|
|
|
370
|
+ // color: MyColours.color_E7E7E7,
|
|
|
|
371
|
+ // ),
|
|
|
|
372
|
+ // VEmptyView(24),
|
|
|
|
373
|
+ // _item('创建人', widget.couponSunModel.uid),
|
|
|
|
374
|
+ // ],
|
|
|
|
375
|
+ // )
|
|
|
|
376
|
+ // : SizedBox(),
|
|
|
|
377
|
+ // widget.couponSunModel.isType == '1'
|
|
|
|
378
|
+ // ? Column(
|
|
|
|
379
|
+ // crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
380
|
+ // children: [
|
|
|
|
381
|
+ // Container(
|
|
|
|
382
|
+ // height: ScreenUtil().setWidth(2),
|
|
|
|
383
|
+ // color: MyColours.color_E7E7E7,
|
|
|
|
384
|
+ // ),
|
|
|
|
385
|
+ // VEmptyView(24),
|
|
|
|
386
|
+ // _select(
|
|
|
|
387
|
+ // '谁可以发放',
|
|
|
|
388
|
+ // '查看',
|
|
|
|
389
|
+ // () async {
|
|
|
|
390
|
+ // await NavigatorUtil.goCouponToPersonnalPage(
|
|
|
|
391
|
+ // context, widget.couponSunModel.uidList,
|
|
|
|
392
|
+ // onlyShow: true);
|
|
|
|
393
|
+ // },
|
|
|
|
394
|
+ // )
|
|
|
|
395
|
+ // ],
|
|
|
|
396
|
+ // )
|
|
|
|
397
|
+ // : SizedBox(),
|
|
|
|
398
|
+ // widget.couponSunModel.explain != null &&
|
|
|
|
399
|
+ // widget.couponSunModel.explain != ''
|
|
|
|
400
|
+ // ? Container(
|
|
|
|
401
|
+ // height: ScreenUtil().setWidth(2),
|
|
|
|
402
|
+ // color: MyColours.color_E7E7E7,
|
|
|
|
403
|
+ // )
|
|
|
|
404
|
+ // : SizedBox(),
|
|
|
|
405
|
+ // widget.couponSunModel.explain != null &&
|
|
|
|
406
|
+ // widget.couponSunModel.explain != ''
|
|
|
|
407
|
+ // ? VEmptyView(24)
|
|
|
|
408
|
+ // : SizedBox(),
|
|
|
|
409
|
+ if (model.orderRechargeByidSunModel.activity
|
|
|
|
410
|
+ .expDate !=
|
|
|
|
411
|
+ null)
|
|
|
|
412
|
+ Column(children: [
|
|
|
|
413
|
+ Container(
|
|
|
|
414
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
415
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
416
|
+ ),
|
|
|
|
417
|
+ VEmptyView(24),
|
|
|
|
418
|
+ _item(
|
|
|
|
419
|
+ '使用限制',
|
|
|
|
420
|
+ model.orderRechargeByidSunModel.activity
|
|
|
|
421
|
+ .expDate.isNone
|
|
|
|
422
|
+ ? '无'
|
|
|
|
423
|
+ : model.orderRechargeByidSunModel
|
|
|
|
424
|
+ .activity.expDate.isBirthday
|
|
|
|
425
|
+ ? '会员生日当天'
|
|
|
|
426
|
+ : model.orderRechargeByidSunModel
|
|
|
|
427
|
+ .activity.expDate.isWeek
|
|
|
|
428
|
+ ? model
|
|
|
|
429
|
+ .orderRechargeByidSunModel
|
|
|
|
430
|
+ .activity
|
|
|
|
431
|
+ .expDate
|
|
|
|
432
|
+ .weekShow
|
|
|
|
433
|
+ : ''),
|
|
|
|
434
|
+ ]),
|
|
|
|
435
|
+ Container(
|
|
|
|
436
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
437
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
438
|
+ ),
|
|
|
|
439
|
+ VEmptyView(24),
|
|
|
|
440
|
+ _item(
|
|
|
|
441
|
+ '券说明',
|
|
|
|
442
|
+ model.orderRechargeByidSunModel.activity
|
|
|
|
443
|
+ .explain ??
|
|
|
|
444
|
+ ''),
|
|
|
|
445
|
+
|
|
|
|
446
|
+ Container(
|
|
|
|
447
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
448
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
449
|
+ ),
|
|
|
|
450
|
+ // VEmptyView(24),
|
|
|
|
451
|
+ // _item('券状态',
|
|
|
|
452
|
+ // widget.couponSunModel.status == '1' ? '发放中' : '停用')
|
|
|
|
453
|
+ ],
|
|
|
|
454
|
+ ))),
|
|
|
|
455
|
+ ),
|
|
|
|
456
|
+ !canUse
|
|
|
|
457
|
+ ? Padding(
|
|
|
|
458
|
+ padding: EdgeInsets.only(bottom: w(58)),
|
|
|
|
459
|
+ child: Image.asset(
|
|
|
|
460
|
+ Utils.getImgPath(past ? 'past' : 'has_use'),
|
|
|
|
461
|
+ width: w(50),
|
|
151
|
),
|
462
|
),
|
|
152
|
- VEmptyView(24),
|
|
|
|
153
|
- _item('券要求', '满200可用'),
|
|
|
|
154
|
- Container(
|
|
|
|
155
|
- height: ScreenUtil().setWidth(2),
|
|
|
|
156
|
- color: MyColours.color_E7E7E7,
|
463
|
+ )
|
|
|
|
464
|
+ : Container(
|
|
|
|
465
|
+ height: ScreenUtil().setWidth(91 * 2),
|
|
|
|
466
|
+ width: double.infinity,
|
|
|
|
467
|
+ padding: EdgeInsets.only(
|
|
|
|
468
|
+ top: ScreenUtil().setWidth(16 * 2),
|
|
|
|
469
|
+ bottom: ScreenUtil().setWidth(35 * 2),
|
|
|
|
470
|
+ left: ScreenUtil().setWidth(45 * 2),
|
|
|
|
471
|
+ right: ScreenUtil().setWidth(45 * 2),
|
|
157
|
),
|
472
|
),
|
|
158
|
- VEmptyView(24),
|
|
|
|
159
|
- _item('有效期从', '2022-4-4'), //Utils.getDateStrFromJiekou(
|
|
|
|
160
|
- // widget.couponSunModel.stime)
|
|
|
|
161
|
- Container(
|
|
|
|
162
|
- height: ScreenUtil().setWidth(2),
|
|
|
|
163
|
- color: MyColours.color_E7E7E7,
|
473
|
+ decoration: BoxDecoration(
|
|
|
|
474
|
+ color: MyColours.color_ffffff,
|
|
|
|
475
|
+ boxShadow: [
|
|
|
|
476
|
+ BoxShadow(
|
|
|
|
477
|
+ spreadRadius: ScreenUtil().setWidth(2),
|
|
|
|
478
|
+ color: Color.fromRGBO(0, 0, 0, 0.1),
|
|
|
|
479
|
+ offset: Offset(0, ScreenUtil().setWidth(-2)),
|
|
|
|
480
|
+ blurRadius: ScreenUtil().setWidth(8))
|
|
|
|
481
|
+ ],
|
|
|
|
482
|
+ borderRadius: BorderRadius.all(
|
|
|
|
483
|
+ Radius.circular(ScreenUtil().setWidth(16)),
|
|
|
|
484
|
+ ),
|
|
164
|
),
|
485
|
),
|
|
165
|
- VEmptyView(24),
|
|
|
|
166
|
- _item('有效期至', '2022-4-4'),
|
|
|
|
167
|
- // widget.couponSunModel.isType == '1'
|
|
|
|
168
|
- // ? Column(
|
|
|
|
169
|
- // crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
170
|
- // children: [
|
|
|
|
171
|
- // Container(
|
|
|
|
172
|
- // height: ScreenUtil().setWidth(2),
|
|
|
|
173
|
- // color: MyColours.color_E7E7E7,
|
|
|
|
174
|
- // ),
|
|
|
|
175
|
- // VEmptyView(24),
|
|
|
|
176
|
- // _item('创建人', widget.couponSunModel.uid),
|
|
|
|
177
|
- // ],
|
|
|
|
178
|
- // )
|
|
|
|
179
|
- // : SizedBox(),
|
|
|
|
180
|
- // widget.couponSunModel.isType == '1'
|
|
|
|
181
|
- // ? Column(
|
|
|
|
182
|
- // crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
183
|
- // children: [
|
|
|
|
184
|
- // Container(
|
|
|
|
185
|
- // height: ScreenUtil().setWidth(2),
|
|
|
|
186
|
- // color: MyColours.color_E7E7E7,
|
|
|
|
187
|
- // ),
|
|
|
|
188
|
- // VEmptyView(24),
|
|
|
|
189
|
- // _select(
|
|
|
|
190
|
- // '谁可以发放',
|
|
|
|
191
|
- // '查看',
|
|
|
|
192
|
- // () async {
|
|
|
|
193
|
- // await NavigatorUtil.goCouponToPersonnalPage(
|
|
|
|
194
|
- // context, widget.couponSunModel.uidList,
|
|
|
|
195
|
- // onlyShow: true);
|
|
|
|
196
|
- // },
|
|
|
|
197
|
- // )
|
|
|
|
198
|
- // ],
|
|
|
|
199
|
- // )
|
|
|
|
200
|
- // : SizedBox(),
|
|
|
|
201
|
- // widget.couponSunModel.explain != null &&
|
|
|
|
202
|
- // widget.couponSunModel.explain != ''
|
|
|
|
203
|
- // ? Container(
|
|
|
|
204
|
- // height: ScreenUtil().setWidth(2),
|
|
|
|
205
|
- // color: MyColours.color_E7E7E7,
|
|
|
|
206
|
- // )
|
|
|
|
207
|
- // : SizedBox(),
|
|
|
|
208
|
- // widget.couponSunModel.explain != null &&
|
|
|
|
209
|
- // widget.couponSunModel.explain != ''
|
|
|
|
210
|
- // ? VEmptyView(24)
|
|
|
|
211
|
- // : SizedBox(),
|
|
|
|
212
|
- _item('券说明',
|
|
|
|
213
|
- '最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多'),
|
486
|
+ child: RoundButton(
|
|
|
|
487
|
+ text: '核销使用',
|
|
|
|
488
|
+ height: ScreenUtil().setWidth(80),
|
|
|
|
489
|
+ radius: ScreenUtil().setWidth(14),
|
|
|
|
490
|
+ isBold: false,
|
|
|
|
491
|
+ fontSize: 28,
|
|
|
|
492
|
+ onPressed: () async {
|
|
|
|
493
|
+ // if (limit) {
|
|
|
|
494
|
+ // Utils.showToast('不在使用限制范围内,不可使用!');
|
|
|
|
495
|
+ // return;
|
|
|
|
496
|
+ // } else {
|
|
|
|
497
|
+ String limitStr = '';
|
|
|
|
498
|
+ if (limit) {
|
|
|
|
499
|
+ limitStr = '当前优惠券不在可用时间段内,';
|
|
|
|
500
|
+ } else if (couponProvider.orderRechargeByidSunModel
|
|
|
|
501
|
+ .activity.expDate.isBirthday) {
|
|
|
|
502
|
+ limitStr = '当前券只有生日可用,请核实后核销。';
|
|
|
|
503
|
+ }
|
|
|
|
504
|
+ DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
505
|
+ textAlign: TextAlign.left,
|
|
|
|
506
|
+ content: '${limitStr}确定要核销当前优惠券吗?核销使用后,该券不能再次使用。',
|
|
|
|
507
|
+ rCallback: () async {
|
|
|
|
508
|
+ //确定核销
|
|
214
|
|
509
|
|
|
215
|
- Container(
|
|
|
|
216
|
- height: ScreenUtil().setWidth(2),
|
|
|
|
217
|
- color: MyColours.color_E7E7E7,
|
510
|
+ bool success = await couponProvider
|
|
|
|
511
|
+ .setNewRechargeWriteOff(
|
|
|
|
512
|
+ context, {'id': widget.idstr});
|
|
|
|
513
|
+ if (success) {
|
|
|
|
514
|
+ //核销成功,刷新当前页面
|
|
|
|
515
|
+ _getOrderRechargeByid(
|
|
|
|
516
|
+ pageS: PageState.Success,
|
|
|
|
517
|
+ isShowLoading: true);
|
|
|
|
518
|
+ }
|
|
|
|
519
|
+ });
|
|
|
|
520
|
+ // }
|
|
|
|
521
|
+ },
|
|
218
|
),
|
522
|
),
|
|
219
|
- // VEmptyView(24),
|
|
|
|
220
|
- // _item('券状态',
|
|
|
|
221
|
- // widget.couponSunModel.status == '1' ? '发放中' : '停用')
|
|
|
|
222
|
- ],
|
|
|
|
223
|
- ))),
|
|
|
|
224
|
- ),
|
|
|
|
225
|
- true
|
|
|
|
226
|
- ? Padding(
|
|
|
|
227
|
- padding: EdgeInsets.only(bottom: w(58)),
|
|
|
|
228
|
- child: Image.asset(
|
|
|
|
229
|
- Utils.getImgPath('has_use'),
|
|
|
|
230
|
- width: w(50),
|
|
|
|
231
|
- ),
|
|
|
|
232
|
- )
|
|
|
|
233
|
- : Container(
|
|
|
|
234
|
- height: ScreenUtil().setWidth(91 * 2),
|
|
|
|
235
|
- width: double.infinity,
|
|
|
|
236
|
- padding: EdgeInsets.only(
|
|
|
|
237
|
- top: ScreenUtil().setWidth(16 * 2),
|
|
|
|
238
|
- bottom: ScreenUtil().setWidth(35 * 2),
|
|
|
|
239
|
- left: ScreenUtil().setWidth(45 * 2),
|
|
|
|
240
|
- right: ScreenUtil().setWidth(45 * 2),
|
|
|
|
241
|
- ),
|
|
|
|
242
|
- decoration: BoxDecoration(
|
|
|
|
243
|
- color: MyColours.color_ffffff,
|
|
|
|
244
|
- boxShadow: [
|
|
|
|
245
|
- BoxShadow(
|
|
|
|
246
|
- spreadRadius: ScreenUtil().setWidth(2),
|
|
|
|
247
|
- color: Color.fromRGBO(0, 0, 0, 0.1),
|
|
|
|
248
|
- offset: Offset(0, ScreenUtil().setWidth(-2)),
|
|
|
|
249
|
- blurRadius: ScreenUtil().setWidth(8))
|
|
|
|
250
|
- ],
|
|
|
|
251
|
- borderRadius: BorderRadius.all(
|
|
|
|
252
|
- Radius.circular(ScreenUtil().setWidth(16)),
|
|
|
|
253
|
- ),
|
|
|
|
254
|
- ),
|
|
|
|
255
|
- child: RoundButton(
|
|
|
|
256
|
- text: '核销使用',
|
|
|
|
257
|
- height: ScreenUtil().setWidth(80),
|
|
|
|
258
|
- radius: ScreenUtil().setWidth(14),
|
|
|
|
259
|
- isBold: false,
|
|
|
|
260
|
- fontSize: 28,
|
|
|
|
261
|
- onPressed: () async {
|
|
|
|
262
|
- DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
263
|
- content: '确定要核销当前优惠券吗?核销使用后,该券不能再次使用。');
|
|
|
|
264
|
- // "stime": fromDate == '点击选择'
|
|
|
|
265
|
- // ? ""
|
|
|
|
266
|
- // : '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}',
|
|
|
|
267
|
- // "etime": endDate == '点击选择'
|
|
|
|
268
|
- // ? ''
|
|
|
|
269
|
- // : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
|
|
|
|
270
|
- // UserModel userModel =
|
|
|
|
271
|
- // Provider.of<UserModel>(context, listen: false);
|
|
|
|
272
|
- // if (userModel.user.role_name == '管理员' ||
|
|
|
|
273
|
- // userModel.user.role_name == '店长') {
|
|
|
|
274
|
- // NavigatorUtil.goRechargeEditPage(context);
|
|
|
|
275
|
- // } else {
|
|
|
|
276
|
- // bool needRefresh =
|
|
|
|
277
|
- // await NavigatorUtil.goCouponEditPage(context);
|
|
|
|
278
|
- // print(needRefresh);
|
|
|
|
279
|
- // if (needRefresh != null && needRefresh) {
|
|
|
|
280
|
- // bus.emit('refresh_coupon_list_f');
|
|
|
|
281
|
- // //刷新页面数据
|
|
|
|
282
|
- // // _controller.callRefresh();
|
|
|
|
283
|
- // // _couponNetworkData(tabController.index);
|
|
|
|
284
|
- // }
|
|
|
|
285
|
- // }
|
|
|
|
286
|
- },
|
|
|
|
287
|
- ),
|
|
|
|
288
|
- )
|
|
|
|
289
|
- ]),
|
|
|
|
290
|
- );
|
523
|
+ )
|
|
|
|
524
|
+ ]);
|
|
|
|
525
|
+ }
|
|
|
|
526
|
+ }));
|
|
291
|
}
|
527
|
}
|
|
292
|
} |
528
|
} |