Commit 5a51e2393f9e9479a5149b41406ef52887d6d7cf

Authored by wdn127929
1 parent c86d23a6

消息中心会员充值详情报错处理

... ... @@ -37,10 +37,12 @@ class RechargeNoticeSunModel {
RechargeNoticeSunModel({this.recharge, this.guest});
RechargeNoticeSunModel.fromJson(Map<String, dynamic> json) {
recharge = json['recharge'] != null
recharge = json['recharge'] != null && (json['recharge'] is Map)
? new Recharge.fromJson(json['recharge'])
: null;
guest = json['guest'] != null ? new Guest.fromJson(json['guest']) : null;
guest = json['guest'] != null && json['guest'] != false
? new Guest.fromJson(json['guest'])
: null;
}
Map<String, dynamic> toJson() {
... ... @@ -189,7 +191,7 @@ class Guest {
}
get cDayShow {
if (cDay != null) {
if (cDay != null && cDay != '') {
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
int.parse(cDay.toString()) * 1000);
return dateTime.year.toString() +
... ...
... ... @@ -193,9 +193,10 @@ class _MessageRechargeInfoPageState extends State<MessageRechargeInfoPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(56),
_text(
'顾客姓名',
'${marketingCenterProvider.rechargeNoticeSunModel.guest.rnameStr}',
'${marketingCenterProvider.rechargeNoticeSunModel.guest == null ? '' : marketingCenterProvider.rechargeNoticeSunModel.guest.rnameStr}',
),
VEmptyView(24),
MyDivider(
... ... @@ -206,7 +207,7 @@ class _MessageRechargeInfoPageState extends State<MessageRechargeInfoPage> {
VEmptyView(48),
_text(
'联系电话',
'${marketingCenterProvider.rechargeNoticeSunModel.guest.phone}',
'${marketingCenterProvider.rechargeNoticeSunModel.guest == null ? '' : marketingCenterProvider.rechargeNoticeSunModel.guest.phone}',
),
VEmptyView(24),
MyDivider(
... ... @@ -217,7 +218,7 @@ class _MessageRechargeInfoPageState extends State<MessageRechargeInfoPage> {
VEmptyView(48),
_text(
'顾客生日',
'${marketingCenterProvider.rechargeNoticeSunModel.guest.cDayShow}',
'${marketingCenterProvider.rechargeNoticeSunModel.guest == null ? '' : marketingCenterProvider.rechargeNoticeSunModel.guest.cDayShow}',
),
VEmptyView(24),
MyDivider(
... ... @@ -237,276 +238,307 @@ class _MessageRechargeInfoPageState extends State<MessageRechargeInfoPage> {
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
_text(
'活动名称',
'${marketingCenterProvider.rechargeNoticeSunModel.recharge.rname}',
),
VEmptyView(24),
MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
_text(
'充值满',
'${marketingCenterProvider.rechargeNoticeSunModel.recharge.rechargeMoney}',
),
VEmptyView(24),
MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
Container(
alignment: Alignment.centerLeft,
child: Text(
'优惠活动',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(28),
Padding(
padding: EdgeInsets.only(left: w(16)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
if (marketingCenterProvider
.rechargeNoticeSunModel.recharge !=
null)
Column(
children: [
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isPrice ==
'1')
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'赠送',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
Spacer(),
Text(
'${marketingCenterProvider.rechargeNoticeSunModel.recharge.rechargeList.price}元余额',
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32)),
),
HEmptyView(32)
],
_text(
'活动名称',
'${marketingCenterProvider.rechargeNoticeSunModel.recharge.rname}',
),
VEmptyView(24),
MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
_text(
'充值满',
'${marketingCenterProvider.rechargeNoticeSunModel.recharge.rechargeMoney}',
),
VEmptyView(24),
MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
Container(
alignment: Alignment.centerLeft,
child: Text(
'优惠活动',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isPrice ==
'1')
VEmptyView(26),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isScore ==
'1')
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'赠送',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
Spacer(),
Text(
'${marketingCenterProvider.rechargeNoticeSunModel.recharge.rechargeList.score}积分',
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32)),
),
HEmptyView(32)
],
),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isScore ==
'1')
VEmptyView(26),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isCoupons ==
'1')
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
),
VEmptyView(28),
Padding(
padding: EdgeInsets.only(left: w(16)),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
'赠送',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
Spacer(),
Text(
'优惠券',
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32)),
),
HEmptyView(32)
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isPrice ==
'1')
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'赠送',
style: TextStyle(
color: MyColours.color_515151,
fontSize:
ScreenUtil().setSp(32)),
),
Spacer(),
Text(
'${marketingCenterProvider.rechargeNoticeSunModel.recharge.rechargeList.price}元余额',
style: TextStyle(
color: MyColours.color_999999,
fontSize:
ScreenUtil().setSp(32)),
),
HEmptyView(32)
],
),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isPrice ==
'1')
VEmptyView(26),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isScore ==
'1')
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'赠送',
style: TextStyle(
color: MyColours.color_515151,
fontSize:
ScreenUtil().setSp(32)),
),
Spacer(),
Text(
'${marketingCenterProvider.rechargeNoticeSunModel.recharge.rechargeList.score}积分',
style: TextStyle(
color: MyColours.color_999999,
fontSize:
ScreenUtil().setSp(32)),
),
HEmptyView(32)
],
),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isScore ==
'1')
VEmptyView(26),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isCoupons ==
'1')
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'赠送',
style: TextStyle(
color: MyColours.color_515151,
fontSize:
ScreenUtil().setSp(32)),
),
Spacer(),
Text(
'优惠券',
style: TextStyle(
color: MyColours.color_999999,
fontSize:
ScreenUtil().setSp(32)),
),
HEmptyView(32)
],
),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isCoupons ==
'1')
VEmptyView(26),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isCoupons ==
'1')
Wrap(
spacing: w(9),
runSpacing: w(9),
alignment: WrapAlignment.start,
runAlignment: WrapAlignment.start,
children: marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.coupons
.map((e) {
return InkWell(
onTap: () {
NavigatorUtil
.goCouponDetailPage(
context, null,
idStr: e.id);
},
child: Text(
e.aname,
style: TextStyle(
color: MyColours
.color_438E93,
fontSize: ScreenUtil()
.setSp(32)),
));
}).toList()),
VEmptyView(26),
],
),
),
MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
Row(
children: [
Text(
'使用限制:',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
Spacer(),
Text(
marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.expDate
.isFix ==
'1'
? '无'
: marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.expDate
.isWeek ==
'1'
? '每周指定日期可用'
: '会员生日当天',
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32)),
),
HEmptyView(32)
],
),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isCoupons ==
.expDate
.isWeek ==
'1')
VEmptyView(26),
if (marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.isCoupons ==
.expDate
.isWeek ==
'1')
Wrap(
spacing: w(9),
runSpacing: w(9),
alignment: WrapAlignment.start,
runAlignment: WrapAlignment.start,
children: marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.rechargeList
.coupons
.map((e) {
return InkWell(
onTap: () {
NavigatorUtil.goCouponDetailPage(
context, null,
idStr: e.id);
},
child: Text(
e.aname,
style: TextStyle(
color: MyColours.color_438E93,
fontSize:
ScreenUtil().setSp(32)),
));
}).toList()),
VEmptyView(26),
],
),
),
MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
Row(
children: [
Text(
'使用限制:',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
Spacer(),
Text(
marketingCenterProvider.rechargeNoticeSunModel
.recharge.expDate.isFix ==
'1'
? '无'
: marketingCenterProvider
Align(
alignment: Alignment.centerRight,
child: Padding(
padding:
EdgeInsets.only(right: w(16)),
child: Text(
marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.expDate
.isWeek ==
'1'
? '每周指定日期可用'
: '会员生日当天',
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32)),
),
HEmptyView(32)
],
),
if (marketingCenterProvider.rechargeNoticeSunModel
.recharge.expDate.isWeek ==
'1')
VEmptyView(26),
if (marketingCenterProvider.rechargeNoticeSunModel
.recharge.expDate.isWeek ==
'1')
Align(
alignment: Alignment.centerRight,
child: Padding(
padding: EdgeInsets.only(right: w(16)),
child: Text(
.weekDateShow,
maxLines: 10,
style: TextStyle(
color: MyColours.color_999999,
fontSize:
ScreenUtil().setSp(32)),
))),
VEmptyView(24),
MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
Row(
children: [
Text(
'有效期:',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
Spacer(),
Text(
marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.expDate
.weekDateShow,
maxLines: 10,
.rechargeNoticeSunModel
.recharge
.stimeStr +
'至' +
marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.etimeStr,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32)),
))),
VEmptyView(24),
MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
Row(
children: [
Text(
'有效期:',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
Spacer(),
Text(
marketingCenterProvider.rechargeNoticeSunModel
.recharge.stimeStr +
'至' +
marketingCenterProvider
.rechargeNoticeSunModel
.recharge
.etimeStr,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32)),
),
HEmptyView(32)
],
),
VEmptyView(24),
MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
_explain(
'备注',
),
),
HEmptyView(32)
],
),
VEmptyView(24),
MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
_explain(
'备注',
),
],
),
VEmptyView(48),
// _canUse()
],
... ...
... ... @@ -332,8 +332,15 @@ class MarketingCenterProvider extends ChangeNotifier {
return false;
});
if (baseResp.code == Constant.status_success) {
rechargeNoticeSunModel = RechargeNoticeModel.fromJson(baseResp.responseData).data;
pageStateMessageDetail = PageState.Success;
rechargeNoticeSunModel =
RechargeNoticeModel.fromJson(baseResp.responseData).data;
if (rechargeNoticeSunModel.recharge == null &&
rechargeNoticeSunModel.guest == null) {
pageStateMessageDetail = PageState.Empty;
} else {
pageStateMessageDetail = PageState.Success;
}
notifyListeners();
return true;
} else {
... ...