|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
import 'package:one_key/provider/marketing_center_provider.dart';
|
|
|
|
import 'package:one_key/route/navigator_util.dart';
|
|
|
|
|
|
|
|
import 'package:one_key/widgets/MyDivider.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../../../constant/state.dart';
|
|
|
|
import '../../../../res/colors.dart';
|
|
|
|
|
|
|
|
import '../../../../utils/screen_util.dart';
|
|
|
|
import '../../../../utils/utils.dart';
|
|
|
|
import '../../../../widgets/h_empty_view.dart';
|
|
|
|
import '../../../../widgets/page_exception.dart';
|
|
|
|
|
|
|
|
import '../../../../widgets/v_empty_view.dart';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 会员充值
|
|
|
|
*/
|
|
|
|
|
|
|
|
class MessageRechargeInfoPage extends StatefulWidget {
|
|
|
|
final String idstr;
|
|
|
|
MessageRechargeInfoPage({Key key, this.idstr}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_MessageRechargeInfoPageState createState() =>
|
|
|
|
_MessageRechargeInfoPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MessageRechargeInfoPageState extends State<MessageRechargeInfoPage> {
|
|
|
|
MarketingCenterProvider marketingCenterProvider;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
// if (widget.idstr != null && widget.idstr != 'null') {
|
|
|
|
// _getNewRechargeDetail();
|
|
|
|
// }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_getNewRechargeDetail() async {
|
|
|
|
bool success = await marketingCenterProvider.getNewRechargeDetail(
|
|
|
|
context, widget.idstr);
|
|
|
|
}
|
|
|
|
|
|
|
|
///输入框
|
|
|
|
Widget _text(
|
|
|
|
String title,
|
|
|
|
String hintText,
|
|
|
|
) {
|
|
|
|
return Container(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
hintText,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(32)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///券说明
|
|
|
|
Widget _explain(
|
|
|
|
String title,
|
|
|
|
String hintText,
|
|
|
|
) {
|
|
|
|
return Container(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Align(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
)),
|
|
|
|
VEmptyView(26),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(20)),
|
|
|
|
child: Text(
|
|
|
|
marketingCenterProvider.rechargeDetail.explain == '' ||
|
|
|
|
marketingCenterProvider.rechargeDetail.explain == null
|
|
|
|
? '无'
|
|
|
|
: marketingCenterProvider.rechargeDetail.explain,
|
|
|
|
|
|
|
|
// maxLengthEnforced: true,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_999999), //输入文本的样式
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///是否立即启用
|
|
|
|
Widget _canUse() {
|
|
|
|
return Container(
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
child: Text(
|
|
|
|
'立即启用',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Image.asset(
|
|
|
|
marketingCenterProvider.rechargeDetail.isOpen == '1'
|
|
|
|
? Utils.getImgPath('swich_on')
|
|
|
|
: Utils.getImgPath('swich_off'),
|
|
|
|
width: ScreenUtil().setWidth(44 * 2),
|
|
|
|
),
|
|
|
|
HEmptyView(16)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
marketingCenterProvider =
|
|
|
|
Provider.of<MarketingCenterProvider>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar('会员充值'),
|
|
|
|
body: Consumer<MarketingCenterProvider>(builder: (context, model, _) {
|
|
|
|
if (model.pageStateMessageDetail != PageState.Success) {
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageStateMessageDetail,
|
|
|
|
callback: () {
|
|
|
|
// offset = 0;
|
|
|
|
// getMessage(showLoading: true);
|
|
|
|
|
|
|
|
if (model.pageStateMessageDetail == PageState.Empty) {
|
|
|
|
// NavigatorUtil.goCouponHistoryPage(context);
|
|
|
|
} else {
|
|
|
|
// _couponNetworkData(widget.index);
|
|
|
|
}
|
|
|
|
// _getNewRechargeDetail();
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有详情数据哦",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
// showText: '查看过期优惠券',
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
VEmptyView(56),
|
|
|
|
_text(
|
|
|
|
'顾客姓名',
|
|
|
|
'欧阳正德 先生',
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(48),
|
|
|
|
_text(
|
|
|
|
'联系电话',
|
|
|
|
'1987665555',
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(48),
|
|
|
|
_text(
|
|
|
|
'顾客生日',
|
|
|
|
'2022-04-12',
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(48),
|
|
|
|
_text(
|
|
|
|
'充值金额',
|
|
|
|
'1000元',
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(48),
|
|
|
|
_text(
|
|
|
|
'活动名称',
|
|
|
|
'充1000送100',
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(48),
|
|
|
|
_text(
|
|
|
|
'充值满',
|
|
|
|
'1000',
|
|
|
|
),
|
|
|
|
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,
|
|
|
|
// children: [
|
|
|
|
// if (marketingCenterProvider
|
|
|
|
// .rechargeDetail.rechargeList.isPrice ==
|
|
|
|
// '1')
|
|
|
|
// Row(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.spaceBetween,
|
|
|
|
// children: [
|
|
|
|
// Text(
|
|
|
|
// '赠送',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_515151,
|
|
|
|
// fontSize: ScreenUtil().setSp(32)),
|
|
|
|
// ),
|
|
|
|
// Spacer(),
|
|
|
|
// Text(
|
|
|
|
// '${marketingCenterProvider.rechargeDetail.rechargeList.price}元余额',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_999999,
|
|
|
|
// fontSize: ScreenUtil().setSp(32)),
|
|
|
|
// ),
|
|
|
|
// HEmptyView(32)
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// if (marketingCenterProvider
|
|
|
|
// .rechargeDetail.rechargeList.isPrice ==
|
|
|
|
// '1')
|
|
|
|
// VEmptyView(26),
|
|
|
|
// if (marketingCenterProvider
|
|
|
|
// .rechargeDetail.rechargeList.isScore ==
|
|
|
|
// '1')
|
|
|
|
// Row(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.spaceBetween,
|
|
|
|
// children: [
|
|
|
|
// Text(
|
|
|
|
// '赠送',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_515151,
|
|
|
|
// fontSize: ScreenUtil().setSp(32)),
|
|
|
|
// ),
|
|
|
|
// Spacer(),
|
|
|
|
// Text(
|
|
|
|
// '${marketingCenterProvider.rechargeDetail.rechargeList.score}积分',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_999999,
|
|
|
|
// fontSize: ScreenUtil().setSp(32)),
|
|
|
|
// ),
|
|
|
|
// HEmptyView(32)
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// if (marketingCenterProvider
|
|
|
|
// .rechargeDetail.rechargeList.isScore ==
|
|
|
|
// '1')
|
|
|
|
// VEmptyView(26),
|
|
|
|
// if (marketingCenterProvider.rechargeDetail
|
|
|
|
// .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.rechargeDetail
|
|
|
|
// .rechargeList.isCoupons ==
|
|
|
|
// '1')
|
|
|
|
// VEmptyView(26),
|
|
|
|
// if (marketingCenterProvider.rechargeDetail
|
|
|
|
// .rechargeList.isCoupons ==
|
|
|
|
// '1')
|
|
|
|
// Wrap(
|
|
|
|
// spacing: w(9),
|
|
|
|
// runSpacing: w(9),
|
|
|
|
// alignment: WrapAlignment.start,
|
|
|
|
// runAlignment: WrapAlignment.start,
|
|
|
|
// children: marketingCenterProvider
|
|
|
|
// .rechargeDetail.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
|
|
|
|
// .rechargeDetail.expDate.isFix ==
|
|
|
|
// '1'
|
|
|
|
// ? '无'
|
|
|
|
// : marketingCenterProvider.rechargeDetail
|
|
|
|
// .expDate.isWeek ==
|
|
|
|
// '1'
|
|
|
|
// ? '每周指定日期可用'
|
|
|
|
// : '会员生日当天',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_999999,
|
|
|
|
// fontSize: ScreenUtil().setSp(32)),
|
|
|
|
// ),
|
|
|
|
// HEmptyView(32)
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// if (marketingCenterProvider
|
|
|
|
// .rechargeDetail.expDate.isWeek ==
|
|
|
|
// '1')
|
|
|
|
// VEmptyView(26),
|
|
|
|
// if (marketingCenterProvider
|
|
|
|
// .rechargeDetail.expDate.isWeek ==
|
|
|
|
// '1')
|
|
|
|
// Align(
|
|
|
|
// alignment: Alignment.centerRight,
|
|
|
|
// child: Padding(
|
|
|
|
// padding: EdgeInsets.only(right: w(16)),
|
|
|
|
// child: Text(
|
|
|
|
// marketingCenterProvider
|
|
|
|
// .rechargeDetail.expDate.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
|
|
|
|
// .rechargeDetail.stimeStr +
|
|
|
|
// '至' +
|
|
|
|
// marketingCenterProvider
|
|
|
|
// .rechargeDetail.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(
|
|
|
|
// '备注',
|
|
|
|
// '请输入备注信息',
|
|
|
|
// ),
|
|
|
|
// VEmptyView(48),
|
|
|
|
// _canUse()
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|