|
...
|
...
|
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_picker/flutter_picker.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
|
|
import 'package:one_key/constant/state.dart';
|
|
|
|
import 'package:one_key/models/coupon_model.dart';
|
|
|
|
import 'package:one_key/provider/coupon_provider.dart';
|
|
|
|
import 'package:one_key/provider/user_model.dart';
|
|
...
|
...
|
@@ -17,13 +18,17 @@ import 'package:one_key/widgets/system_app_bar.dart'; |
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../widgets/page_exception.dart';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新建券
|
|
|
|
*/
|
|
|
|
|
|
|
|
class CouponDetailPage extends StatefulWidget {
|
|
|
|
final CouponSunModel couponSunModel;
|
|
|
|
CouponDetailPage({Key key, this.couponSunModel}) : super(key: key);
|
|
|
|
final String idstr;
|
|
|
|
CouponDetailPage({Key key, this.couponSunModel, this.idstr})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_CouponDetailPageState createState() => _CouponDetailPageState();
|
|
...
|
...
|
@@ -33,14 +38,33 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
final heightCell = ScreenUtil().setWidth(80);
|
|
|
|
CouponProvider couponProvider;
|
|
|
|
PageState pageState = PageState.Loading;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
if(widget.couponSunModel == null){
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
if (widget.idstr != null && widget.idstr != 'null') {
|
|
|
|
_getActivityById();
|
|
|
|
} else {
|
|
|
|
couponProvider.couponSunModel = widget.couponSunModel;
|
|
|
|
pageState = PageState.Success;
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_getActivityById() async {
|
|
|
|
pageState = PageState.Loading;
|
|
|
|
bool success =
|
|
|
|
await couponProvider.getActivityById(context, {'id': widget.idstr});
|
|
|
|
if (success) {
|
|
|
|
pageState = PageState.Success;
|
|
|
|
} else {
|
|
|
|
pageState = PageState.ConnectivityError;
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
///时间选择
|
|
...
|
...
|
@@ -123,121 +147,145 @@ class _CouponDetailPageState extends State<CouponDetailPage> { |
|
|
|
Widget build(BuildContext context) {
|
|
|
|
couponProvider = Provider.of<CouponProvider>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'优惠券详情',
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
body: Column(children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
controller: controller,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32)),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(56),
|
|
|
|
_item(
|
|
|
|
'券类型',
|
|
|
|
widget.couponSunModel.isType == '1'
|
|
|
|
? widget.couponSunModel.isExamine == '1'
|
|
|
|
? '店铺优惠券(核销券)'
|
|
|
|
: '店铺优惠券'
|
|
|
|
: '我的优惠券'),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('券名称', widget.couponSunModel.aname),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('券要求', widget.couponSunModel.desc),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'有效期从',
|
|
|
|
Utils.getDateStrFromJiekou(
|
|
|
|
widget.couponSunModel.stime)),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'有效期至',
|
|
|
|
Utils.getDateStrFromJiekou(
|
|
|
|
widget.couponSunModel.etime)),
|
|
|
|
widget.couponSunModel.isType == '1'
|
|
|
|
? Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('创建人', widget.couponSunModel.uid),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
widget.couponSunModel.isType == '1'
|
|
|
|
? Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_select(
|
|
|
|
'谁可以发放',
|
|
|
|
'查看',
|
|
|
|
() async {
|
|
|
|
await NavigatorUtil.goCouponToPersonnalPage(
|
|
|
|
context, widget.couponSunModel.uidList,
|
|
|
|
onlyShow: true);
|
|
|
|
},
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
widget.couponSunModel.explain != null &&
|
|
|
|
widget.couponSunModel.explain != ''
|
|
|
|
? Container(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'优惠券详情',
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
body: Consumer<CouponProvider>(builder: (context, model, _) {
|
|
|
|
if (pageState != PageState.Success) {
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: pageState,
|
|
|
|
callback: () {
|
|
|
|
_getActivityById();
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有数据哦,",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Column(children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
controller: controller,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32)),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(56),
|
|
|
|
_item(
|
|
|
|
'券类型',
|
|
|
|
couponProvider.couponSunModel.isType == '1'
|
|
|
|
? couponProvider.couponSunModel.isExamine ==
|
|
|
|
'1'
|
|
|
|
? '店铺优惠券(核销券)'
|
|
|
|
: '店铺优惠券'
|
|
|
|
: '我的优惠券'),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
widget.couponSunModel.explain != null &&
|
|
|
|
widget.couponSunModel.explain != ''
|
|
|
|
? VEmptyView(24)
|
|
|
|
: SizedBox(),
|
|
|
|
widget.couponSunModel.explain != null &&
|
|
|
|
widget.couponSunModel.explain != ''
|
|
|
|
? _item('券说明', widget.couponSunModel.explain)
|
|
|
|
: SizedBox(),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('券状态',
|
|
|
|
widget.couponSunModel.status == '1' ? '发放中' : '停用')
|
|
|
|
],
|
|
|
|
))),
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
);
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('券名称', couponProvider.couponSunModel.aname),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('券要求', couponProvider.couponSunModel.desc),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'有效期从',
|
|
|
|
Utils.getDateStrFromJiekou(
|
|
|
|
couponProvider.couponSunModel.stime)),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'有效期至',
|
|
|
|
Utils.getDateStrFromJiekou(
|
|
|
|
couponProvider.couponSunModel.etime)),
|
|
|
|
couponProvider.couponSunModel.isType == '1'
|
|
|
|
? Column(
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('创建人',
|
|
|
|
couponProvider.couponSunModel.uid),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
couponProvider.couponSunModel.isType == '1'
|
|
|
|
? Column(
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_select(
|
|
|
|
'谁可以发放',
|
|
|
|
'查看',
|
|
|
|
() async {
|
|
|
|
await NavigatorUtil
|
|
|
|
.goCouponToPersonnalPage(
|
|
|
|
context,
|
|
|
|
couponProvider
|
|
|
|
.couponSunModel.uidList,
|
|
|
|
onlyShow: true);
|
|
|
|
},
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
couponProvider.couponSunModel.explain != null &&
|
|
|
|
couponProvider.couponSunModel.explain != ''
|
|
|
|
? Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
couponProvider.couponSunModel.explain != null &&
|
|
|
|
couponProvider.couponSunModel.explain != ''
|
|
|
|
? VEmptyView(24)
|
|
|
|
: SizedBox(),
|
|
|
|
couponProvider.couponSunModel.explain != null &&
|
|
|
|
couponProvider.couponSunModel.explain != ''
|
|
|
|
? _item('券说明',
|
|
|
|
couponProvider.couponSunModel.explain)
|
|
|
|
: SizedBox(),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'券状态',
|
|
|
|
couponProvider.couponSunModel.status == '1'
|
|
|
|
? '发放中'
|
|
|
|
: '停用')
|
|
|
|
],
|
|
|
|
))),
|
|
|
|
)
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|