|
...
|
...
|
@@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:one_key/net/dio_util.dart';
|
|
|
|
|
|
|
|
import 'package:one_key/provider/coupon_provider.dart';
|
|
|
|
import 'package:one_key/provider/user_model.dart';
|
|
|
|
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/utils/dialog_util.dart';
|
|
...
|
...
|
@@ -15,15 +16,19 @@ import 'package:one_key/widgets/system_app_bar.dart'; |
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../constant/state.dart';
|
|
|
|
import '../../utils/screen_util.dart';
|
|
|
|
import '../../widgets/page_exception.dart';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 核销券详情页
|
|
|
|
*/
|
|
|
|
|
|
|
|
class VerificationCouponPage extends StatefulWidget {
|
|
|
|
final String idstr;
|
|
|
|
VerificationCouponPage({
|
|
|
|
Key key,
|
|
|
|
this.idstr,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
...
|
...
|
@@ -34,10 +39,135 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> { |
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
final heightCell = ScreenUtil().setWidth(80);
|
|
|
|
CouponProvider couponProvider;
|
|
|
|
PageState pageState = PageState.Loading;
|
|
|
|
bool canUse = true;
|
|
|
|
bool past = false; //是否过期
|
|
|
|
int currTimeIndex;
|
|
|
|
bool limit = false;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
// _couponNetworkData(0);
|
|
|
|
initTime(context);
|
|
|
|
_getOrderRechargeByid();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//初始化时间
|
|
|
|
initTime(BuildContext context) async {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
DateTime dateTime = DateTime.now();
|
|
|
|
|
|
|
|
// String morning =
|
|
|
|
// userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
|
|
|
|
String noon =
|
|
|
|
userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
|
|
|
|
String night =
|
|
|
|
userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
|
|
|
|
|
|
|
|
if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
noon.split("-")[0] +
|
|
|
|
":00")) &&
|
|
|
|
dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
noon.split("-")[1] +
|
|
|
|
":00"))) {
|
|
|
|
//午餐时间内
|
|
|
|
currTimeIndex = 2;
|
|
|
|
} else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
night.split("-")[0] +
|
|
|
|
":00")) &&
|
|
|
|
dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
" " +
|
|
|
|
night.split("-")[1] +
|
|
|
|
":00"))) {
|
|
|
|
//晚市
|
|
|
|
currTimeIndex = 3;
|
|
|
|
} else {
|
|
|
|
//不在时间段内,不可使用
|
|
|
|
currTimeIndex = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_getOrderRechargeByid(
|
|
|
|
{PageState pageS = PageState.Loading, bool isShowLoading = true}) async {
|
|
|
|
pageState = pageS;
|
|
|
|
bool success = await couponProvider.getOrderRechargeByid(
|
|
|
|
context, {'id': widget.idstr},
|
|
|
|
isShowLoading: isShowLoading);
|
|
|
|
if (success) {
|
|
|
|
pageState = PageState.Success;
|
|
|
|
|
|
|
|
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
int.parse(couponProvider.orderRechargeByidSunModel.activity.etime) *
|
|
|
|
1000);
|
|
|
|
|
|
|
|
Duration days = dateTime.difference(DateTime.now());
|
|
|
|
|
|
|
|
print(days);
|
|
|
|
if (days.inDays < 0) {
|
|
|
|
//
|
|
|
|
past = true; //过期了
|
|
|
|
} else {
|
|
|
|
past = false; //没过期
|
|
|
|
}
|
|
|
|
|
|
|
|
if (couponProvider.orderRechargeByidSunModel.activity.expDate.isWeek) {
|
|
|
|
//使用限制是每周
|
|
|
|
List noonWeek = [];
|
|
|
|
List nightWeek = [];
|
|
|
|
couponProvider.orderRechargeByidSunModel.activity.expDate.weekData
|
|
|
|
.forEach((element) {
|
|
|
|
if (element.selectNoon) {
|
|
|
|
//午餐选中
|
|
|
|
noonWeek.add(element.title);
|
|
|
|
} else if (element.selectNig) {
|
|
|
|
//晚餐选中
|
|
|
|
nightWeek.add(element.title);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
//获取当前是周几
|
|
|
|
String weekday = '周${Utils.formatWeekDayNum(DateTime.now().weekday)}';
|
|
|
|
if ((currTimeIndex == 2 && noonWeek.contains(weekday)) ||
|
|
|
|
(currTimeIndex == 3 && nightWeek.contains(weekday))) {
|
|
|
|
//可用
|
|
|
|
} else {
|
|
|
|
//不可用
|
|
|
|
limit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (couponProvider.orderRechargeByidSunModel.isExamine == '1' || past) {
|
|
|
|
//已核销or过期
|
|
|
|
canUse = false;
|
|
|
|
} else {
|
|
|
|
canUse = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
pageState = PageState.ConnectivityError;
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
///时间选择
|
|
...
|
...
|
@@ -118,175 +248,281 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> { |
|
|
|
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('券用途', '代金券/折扣券/菜品券',
|
|
|
|
textColor: MyColours.color_438E93, fontSize: 20),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('券金额/折扣率/所含菜品', '200元/9折/精品烤鸭',
|
|
|
|
textColor: MyColours.color_438E93, fontSize: 20),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
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: () {
|
|
|
|
_getOrderRechargeByid();
|
|
|
|
},
|
|
|
|
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(
|
|
|
|
model.orderRechargeByidSunModel.activity.use ==
|
|
|
|
null
|
|
|
|
? '券名称'
|
|
|
|
: '券用途',
|
|
|
|
model.orderRechargeByidSunModel.activity.use ==
|
|
|
|
null
|
|
|
|
? model.orderRechargeByidSunModel.activity
|
|
|
|
.aname
|
|
|
|
: model.orderRechargeByidSunModel.activity
|
|
|
|
.use.isCash
|
|
|
|
? '代金券'
|
|
|
|
: model.orderRechargeByidSunModel
|
|
|
|
.activity.use.isDiscount
|
|
|
|
? '折扣券'
|
|
|
|
: model.orderRechargeByidSunModel
|
|
|
|
.activity.use.isDish
|
|
|
|
? '菜品券'
|
|
|
|
: '',
|
|
|
|
textColor: MyColours.color_438E93,
|
|
|
|
fontSize: 20),
|
|
|
|
if (model.orderRechargeByidSunModel.activity.use !=
|
|
|
|
null)
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
model.orderRechargeByidSunModel.activity
|
|
|
|
.use.isCash
|
|
|
|
? '券金额'
|
|
|
|
: model.orderRechargeByidSunModel
|
|
|
|
.activity.use.isDiscount
|
|
|
|
? '折扣率'
|
|
|
|
: model.orderRechargeByidSunModel
|
|
|
|
.activity.use.isDish
|
|
|
|
? '所含菜品'
|
|
|
|
: '',
|
|
|
|
model.orderRechargeByidSunModel.activity
|
|
|
|
.use.isCash
|
|
|
|
? '${model.orderRechargeByidSunModel.activity.use.cash}元'
|
|
|
|
: model.orderRechargeByidSunModel
|
|
|
|
.activity.use.isDiscount
|
|
|
|
? '${model.orderRechargeByidSunModel.activity.use.discount}折'
|
|
|
|
: model.orderRechargeByidSunModel
|
|
|
|
.activity.use.isDish
|
|
|
|
? model
|
|
|
|
.couponSunModel.use.dish
|
|
|
|
: '',
|
|
|
|
textColor: MyColours.color_438E93,
|
|
|
|
fontSize: 20),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'券要求',
|
|
|
|
model.orderRechargeByidSunModel.activity.desc ??
|
|
|
|
''),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'有效期从',
|
|
|
|
Utils.getDateStrFromJiekou(model
|
|
|
|
.orderRechargeByidSunModel.activity.stime)),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'有效期至',
|
|
|
|
Utils.getDateStrFromJiekou(model
|
|
|
|
.orderRechargeByidSunModel.activity.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(
|
|
|
|
// height: ScreenUtil().setWidth(2),
|
|
|
|
// color: MyColours.color_E7E7E7,
|
|
|
|
// )
|
|
|
|
// : SizedBox(),
|
|
|
|
// widget.couponSunModel.explain != null &&
|
|
|
|
// widget.couponSunModel.explain != ''
|
|
|
|
// ? VEmptyView(24)
|
|
|
|
// : SizedBox(),
|
|
|
|
if (model.orderRechargeByidSunModel.activity
|
|
|
|
.expDate !=
|
|
|
|
null)
|
|
|
|
Column(children: [
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'使用限制',
|
|
|
|
model.orderRechargeByidSunModel.activity
|
|
|
|
.expDate.isNone
|
|
|
|
? '无'
|
|
|
|
: model.orderRechargeByidSunModel
|
|
|
|
.activity.expDate.isBirthday
|
|
|
|
? '会员生日当天'
|
|
|
|
: model.orderRechargeByidSunModel
|
|
|
|
.activity.expDate.isWeek
|
|
|
|
? model
|
|
|
|
.orderRechargeByidSunModel
|
|
|
|
.activity
|
|
|
|
.expDate
|
|
|
|
.weekShow
|
|
|
|
: ''),
|
|
|
|
]),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item(
|
|
|
|
'券说明',
|
|
|
|
model.orderRechargeByidSunModel.activity
|
|
|
|
.explain ??
|
|
|
|
''),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
// VEmptyView(24),
|
|
|
|
// _item('券状态',
|
|
|
|
// widget.couponSunModel.status == '1' ? '发放中' : '停用')
|
|
|
|
],
|
|
|
|
))),
|
|
|
|
),
|
|
|
|
!canUse
|
|
|
|
? Padding(
|
|
|
|
padding: EdgeInsets.only(bottom: w(58)),
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(past ? 'past' : 'has_use'),
|
|
|
|
width: w(50),
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('券要求', '满200可用'),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
height: ScreenUtil().setWidth(91 * 2),
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: ScreenUtil().setWidth(16 * 2),
|
|
|
|
bottom: ScreenUtil().setWidth(35 * 2),
|
|
|
|
left: ScreenUtil().setWidth(45 * 2),
|
|
|
|
right: ScreenUtil().setWidth(45 * 2),
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('有效期从', '2022-4-4'), //Utils.getDateStrFromJiekou(
|
|
|
|
// widget.couponSunModel.stime)
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
spreadRadius: ScreenUtil().setWidth(2),
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.1),
|
|
|
|
offset: Offset(0, ScreenUtil().setWidth(-2)),
|
|
|
|
blurRadius: ScreenUtil().setWidth(8))
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(ScreenUtil().setWidth(16)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
_item('有效期至', '2022-4-4'),
|
|
|
|
// 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(
|
|
|
|
// height: ScreenUtil().setWidth(2),
|
|
|
|
// color: MyColours.color_E7E7E7,
|
|
|
|
// )
|
|
|
|
// : SizedBox(),
|
|
|
|
// widget.couponSunModel.explain != null &&
|
|
|
|
// widget.couponSunModel.explain != ''
|
|
|
|
// ? VEmptyView(24)
|
|
|
|
// : SizedBox(),
|
|
|
|
_item('券说明',
|
|
|
|
'最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多'),
|
|
|
|
child: RoundButton(
|
|
|
|
text: '核销使用',
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
radius: ScreenUtil().setWidth(14),
|
|
|
|
isBold: false,
|
|
|
|
fontSize: 28,
|
|
|
|
onPressed: () async {
|
|
|
|
// if (limit) {
|
|
|
|
// Utils.showToast('不在使用限制范围内,不可使用!');
|
|
|
|
// return;
|
|
|
|
// } else {
|
|
|
|
String limitStr = '';
|
|
|
|
if (limit) {
|
|
|
|
limitStr = '当前优惠券不在可用时间段内,';
|
|
|
|
} else if (couponProvider.orderRechargeByidSunModel
|
|
|
|
.activity.expDate.isBirthday) {
|
|
|
|
limitStr = '当前券只有生日可用,请核实后核销。';
|
|
|
|
}
|
|
|
|
DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
content: '${limitStr}确定要核销当前优惠券吗?核销使用后,该券不能再次使用。',
|
|
|
|
rCallback: () async {
|
|
|
|
//确定核销
|
|
|
|
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
bool success = await couponProvider
|
|
|
|
.setNewRechargeWriteOff(
|
|
|
|
context, {'id': widget.idstr});
|
|
|
|
if (success) {
|
|
|
|
//核销成功,刷新当前页面
|
|
|
|
_getOrderRechargeByid(
|
|
|
|
pageS: PageState.Success,
|
|
|
|
isShowLoading: true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
),
|
|
|
|
// VEmptyView(24),
|
|
|
|
// _item('券状态',
|
|
|
|
// widget.couponSunModel.status == '1' ? '发放中' : '停用')
|
|
|
|
],
|
|
|
|
))),
|
|
|
|
),
|
|
|
|
true
|
|
|
|
? Padding(
|
|
|
|
padding: EdgeInsets.only(bottom: w(58)),
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath('has_use'),
|
|
|
|
width: w(50),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
height: ScreenUtil().setWidth(91 * 2),
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: ScreenUtil().setWidth(16 * 2),
|
|
|
|
bottom: ScreenUtil().setWidth(35 * 2),
|
|
|
|
left: ScreenUtil().setWidth(45 * 2),
|
|
|
|
right: ScreenUtil().setWidth(45 * 2),
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
spreadRadius: ScreenUtil().setWidth(2),
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.1),
|
|
|
|
offset: Offset(0, ScreenUtil().setWidth(-2)),
|
|
|
|
blurRadius: ScreenUtil().setWidth(8))
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
Radius.circular(ScreenUtil().setWidth(16)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: RoundButton(
|
|
|
|
text: '核销使用',
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
radius: ScreenUtil().setWidth(14),
|
|
|
|
isBold: false,
|
|
|
|
fontSize: 28,
|
|
|
|
onPressed: () async {
|
|
|
|
DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
content: '确定要核销当前优惠券吗?核销使用后,该券不能再次使用。');
|
|
|
|
// "stime": fromDate == '点击选择'
|
|
|
|
// ? ""
|
|
|
|
// : '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}',
|
|
|
|
// "etime": endDate == '点击选择'
|
|
|
|
// ? ''
|
|
|
|
// : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
|
|
|
|
// UserModel userModel =
|
|
|
|
// Provider.of<UserModel>(context, listen: false);
|
|
|
|
// if (userModel.user.role_name == '管理员' ||
|
|
|
|
// userModel.user.role_name == '店长') {
|
|
|
|
// NavigatorUtil.goRechargeEditPage(context);
|
|
|
|
// } else {
|
|
|
|
// bool needRefresh =
|
|
|
|
// await NavigatorUtil.goCouponEditPage(context);
|
|
|
|
// print(needRefresh);
|
|
|
|
// if (needRefresh != null && needRefresh) {
|
|
|
|
// bus.emit('refresh_coupon_list_f');
|
|
|
|
// //刷新页面数据
|
|
|
|
// // _controller.callRefresh();
|
|
|
|
// // _couponNetworkData(tabController.index);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
);
|
|
|
|
)
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|