Commit df3b7056ea6a66578256996f325289c9ec014fbd

Authored by wdn127929
1 parent 9c509379

付费优惠券保存

... ... @@ -157,7 +157,7 @@ class Constant {
'到店': ['管理员', '店长', '前台', '迎宾'],
'离店': ['管理员', '店长', '前台', '迎宾'],
'全店任务': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
'创建新的优惠券': [
'创建新券': [
'管理员',
'店长',
],
... ...
... ... @@ -88,6 +88,10 @@ class CouponSunModel extends Object {
@JsonKey(name: 'use')
CouponUse use;
@JsonKey(name: 'arule')
Arule arule;
@JsonKey(name: 'exp_date')
ExpDate expDate;
... ... @@ -103,6 +107,11 @@ class CouponSunModel extends Object {
@JsonKey(name: 'lite_qrcode')
String liteQrcode;
@JsonKey(name: 'aexpiration')
String aexpiration;
// arule 券使用和分享规则 领取后有效天数
bool isCheck = false;
bool showText = false;
bool isMarking = false;
... ... @@ -127,11 +136,13 @@ class CouponSunModel extends Object {
this.isOpenBool,
this.price,
this.use,
this.arule,
this.expDate,
this.nickNameShow,
this.grantNum,
this.urllink,
this.liteQrcode);
this.liteQrcode,
this.aexpiration);
factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$CouponSunModelFromJson(srcJson);
... ... @@ -172,6 +183,56 @@ class CouponUse extends Object {
}
@JsonSerializable()
class Arule extends Object {
@JsonKey(name: 'is_same_day')
bool isSameDay;
@JsonKey(name: 'is_accumulation')
bool isAccumulation;
@JsonKey(name: 'is_compartment')
bool isCompartment;
@JsonKey(name: 'is_eatin')
bool isEatin;
@JsonKey(name: 'is_takeout')
bool isTakeout;
@JsonKey(name: 'is_appointment')
bool isAppointment;
@JsonKey(name: 'is_share_lose')
bool isShareLose;
@JsonKey(name: 'is_share_have')
bool isShareHave;
@JsonKey(name: 'is_commission')
bool isCommission;
@JsonKey(name: 'commission')
String commission;
Arule(
this.isSameDay,
this.isAccumulation,
this.isCompartment,
this.isEatin,
this.isTakeout,
this.isAppointment,
this.isShareLose,
this.isShareHave,
this.isCommission,
this.commission);
factory Arule.fromJson(Map<String, dynamic> srcJson) =>
_$AruleFromJson(srcJson);
Map<String, dynamic> toJson() => _$AruleToJson(this);
}
@JsonSerializable()
class ExpDate extends Object {
@JsonKey(name: 'is_none')
bool isNone;
... ...
... ... @@ -51,6 +51,13 @@ CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) {
: (json['use'] is Map)
? CouponUse.fromJson(json['use'])
: null,
json['arule'] == null
? null
: (json['arule'] is String)
? Arule.fromJson(jsonDecode(json['arule']))
: (json['arule'] is Map)
? Arule.fromJson(json['arule'])
: null,
json['exp_date'] == null
? null
: (json['exp_date'] is String)
... ... @@ -62,6 +69,7 @@ CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) {
json['grant_num'] as String,
json['urllink'] as String,
json['lite_qrcode'] as String,
json['aexpiration'] as String,
);
}
... ... @@ -86,11 +94,13 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) =>
'isOpenBool': instance.isOpenBool,
'price': instance.price,
'use': instance.use,
'arule': instance.arule,
'exp_date': instance.expDate,
'nick_name': instance.nickNameShow,
'grant_num': instance.grantNum,
'urllink':instance.urllink,
'lite_qrcode':instance.liteQrcode
'urllink': instance.urllink,
'lite_qrcode': instance.liteQrcode,
'aexpiration': instance.aexpiration
};
CouponUse _$CouponUseFromJson(Map<String, dynamic> json) {
... ... @@ -147,6 +157,96 @@ Map<String, dynamic> _$CouponUseToJson(CouponUse instance) => <String, dynamic>{
'images': instance.images
};
Arule _$AruleFromJson(Map<String, dynamic> json) {
bool isSameDay = false;
if (json['is_same_day'] is String) {
isSameDay = json['is_same_day'] == '1' ? true : false;
} else if (json['is_same_day'] is bool) {
isSameDay = json['is_same_day'] ? true : false;
}
bool isAccumulation = false;
if (json['is_accumulation'] is String) {
isAccumulation = json['is_accumulation'] == '1' ? true : false;
} else if (json['is_accumulation'] is bool) {
isAccumulation = json['is_accumulation'] ? true : false;
}
bool isCompartment = false;
if (json['is_compartment'] is String) {
isCompartment = json['is_compartment'] == '1' ? true : false;
} else if (json['is_compartment'] is bool) {
isCompartment = json['is_compartment'] ? true : false;
}
bool isEatin = false;
if (json['is_eatin'] is String) {
isEatin = json['is_eatin'] == '1' ? true : false;
} else if (json['is_eatin'] is bool) {
isEatin = json['is_eatin'] ? true : false;
}
bool isTakeout = false;
if (json['is_takeout'] is String) {
isTakeout = json['is_takeout'] == '1' ? true : false;
} else if (json['is_takeout'] is bool) {
isTakeout = json['is_takeout'] ? true : false;
}
bool isAppointment = false;
if (json['is_appointment'] is String) {
isAppointment = json['is_appointment'] == '1' ? true : false;
} else if (json['is_appointment'] is bool) {
isAppointment = json['is_appointment'] ? true : false;
}
bool isShareLose = false;
if (json['is_share_lose'] is String) {
isShareLose = json['is_share_lose'] == '1' ? true : false;
} else if (json['is_share_lose'] is bool) {
isShareLose = json['is_share_lose'] ? true : false;
}
bool isShareHave = false;
if (json['is_share_have'] is String) {
isShareHave = json['is_share_have'] == '1' ? true : false;
} else if (json['is_share_have'] is bool) {
isShareHave = json['is_share_have'] ? true : false;
}
bool isCommission = false;
if (json['is_commission'] is String) {
isCommission = json['is_commission'] == '1' ? true : false;
} else if (json['is_commission'] is bool) {
isCommission = json['is_commission'] ? true : false;
}
return Arule(
isSameDay,
isAccumulation,
isCompartment,
isEatin,
isTakeout,
isAppointment,
isShareLose,
isShareHave,
isCommission,
json['commission']);
}
Map<String, dynamic> _$AruleToJson(Arule instance) => <String, dynamic>{
'is_same_day': instance.isSameDay,
'is_accumulation': instance.isAccumulation,
'is_compartment': instance.isCompartment,
'is_eatin': instance.isEatin,
'is_takeout': instance.isTakeout,
'is_appointment': instance.isAppointment,
'is_share_lose': instance.isShareLose,
'is_share_have': instance.isShareHave,
'is_commission': instance.isCommission,
'commission': instance.commission,
};
ExpDate _$ExpDateFromJson(Map<String, dynamic> json) {
List<FilterBtnModel> weekdata = [];
if (json['week_data'] != null) {
... ...
... ... @@ -338,7 +338,6 @@ class MarkStoreModel {
if (json['content'] != null) {
content = [];
if (json['content'] is List) {
List temp = json['content'];
temp.forEach((element) {
... ... @@ -417,7 +416,7 @@ class MarkChefModel {
isImages = json['is_images'];
if (json['content'] != null) {
content = [];
if (json['content'] is List) {
if (json['content'] is List) {
List temp = json['content'];
temp.forEach((element) {
content.add(ContentModel.fromJson(element));
... ... @@ -521,12 +520,13 @@ class MarkMarketingModel {
String isLink; //
String wecomle; //
String logo; //
String isCoupon;
String isCouponFree;
String isCouponPay;
String isRecharge;
RechargeListSunModel rechargeData;
List<CouponSunModel> couponDataList;
List<CouponSunModel> couponDataListPay;
List<CouponSunModel> couponDataListFree;
String isComments;
String isCommentsCoupon;
List<CouponSunModel> couponDataListComments;
... ... @@ -541,10 +541,12 @@ class MarkMarketingModel {
this.isTranspond,
this.logo,
this.wecomle,
this.isCoupon,
this.isCouponFree,
this.isCouponPay,
this.isRecharge,
this.rechargeData,
this.couponDataList,
this.couponDataListPay,
this.couponDataListFree,
this.isComments,
this.isCommentsCoupon,
this.couponDataListComments,
... ... @@ -558,35 +560,65 @@ class MarkMarketingModel {
isLink = json['is_link'];
wecomle = json['wecomle'];
logo = json['logo'];
isCoupon = json['is_coupon'];
isCouponFree = json['is_coupon_free'];
isCouponPay = json['is_coupon_pay'];
isRecharge = json['is_recharge'];
rechargeData = json['recharge_data'] != null
? new RechargeListSunModel.fromJson(json['recharge_data'])
: null;
if (json['coupon_data'] != null) {
couponDataList = <CouponSunModel>[];
if (json['coupon_data'] is Map) {
if (json['coupon_data_pay'] != null) {
couponDataListPay = <CouponSunModel>[];
if (json['coupon_data_pay'] is Map) {
//旧数据map
couponDataListPay.add(CouponSunModel.fromJson(json['coupon_data_pay']));
} else {
var couponData;
if (json['coupon_data_pay'] is String) {
couponData = convert.jsonDecode(json['coupon_data_pay']);
} else {
couponData = json['coupon_data_pay'];
}
if (couponData is List) {
couponData.forEach((v) {
couponDataListPay.add(CouponSunModel.fromJson(v));
});
} else if (couponData is Map) {
// json['coupon_data'].forEach((v) {
couponDataListPay.add(CouponSunModel.fromJson(couponData));
// });
} else {
couponData.forEach((v) {
couponDataListPay.add(v);
});
}
}
}
if (json['coupon_data_free'] != null) {
couponDataListFree = <CouponSunModel>[];
if (json['coupon_data_free'] is Map) {
//旧数据map
couponDataList.add(CouponSunModel.fromJson(json['coupon_data']));
couponDataListFree
.add(CouponSunModel.fromJson(json['coupon_data_free']));
} else {
var couponData;
if (json['coupon_data'] is String) {
couponData = convert.jsonDecode(json['coupon_data']);
if (json['coupon_data_free'] is String) {
couponData = convert.jsonDecode(json['coupon_data_free']);
} else {
couponData = json['coupon_data'];
couponData = json['coupon_data_free'];
}
if (couponData is List) {
couponData.forEach((v) {
couponDataList.add(CouponSunModel.fromJson(v));
couponDataListFree.add(CouponSunModel.fromJson(v));
});
} else if (couponData is Map) {
// json['coupon_data'].forEach((v) {
couponDataList.add(CouponSunModel.fromJson(couponData));
couponDataListFree.add(CouponSunModel.fromJson(couponData));
// });
} else {
couponData.forEach((v) {
couponDataList.add(v);
couponDataListFree.add(v);
});
}
}
... ... @@ -635,10 +667,12 @@ class MarkMarketingModel {
data['is_link'] = this.isLink;
data['wecomle'] = this.wecomle;
data['logo'] = this.logo;
data['is_coupon'] = this.isCoupon;
data['is_coupon_free'] = this.isCouponFree;
data['is_coupon_pay'] = this.isCouponPay;
data['is_recharge'] = this.isRecharge;
data['recharge_data'] = this.rechargeData;
data['coupon_data'] = this.couponDataList;
data['coupon_data_pay'] = this.couponDataListPay;
data['coupon_data_free'] = this.couponDataListFree;
data['is_comments'] = this.isComments;
data['is_comments_coupon'] = this.isCommentsCoupon;
data['coupon_data_comments'] = this.couponDataListComments;
... ...
... ... @@ -66,36 +66,44 @@ class _CouponCreateSelectTypePageState
child: Row(
children: [
Image.asset(
Utils.getImgPath(selectF
? 'coupon_select_type_user'
: 'coupon_select_type_user_un'),
width: ScreenUtil().setWidth(70 * 2),
),
HEmptyView(70),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'仅为我创建',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
VEmptyView(16),
Text(
'创建后仅我可发放该优惠券',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: selectF
? MyColours.color_ffffff
: MyColours.color_BFC4D4),
),
],
Utils.getImgPath(selectF ? 'free' : 'free_un'),
width: ScreenUtil().setWidth(50 * 2),
),
HEmptyView(56),
Expanded(
child: Text(
'免费代金券',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: selectF
? MyColours.color_ffffff
: MyColours.color_999999),
)),
// Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// '仅为我创建',
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(36),
// color: selectF
// ? MyColours.color_ffffff
// : MyColours.color_999999),
// ),
// VEmptyView(16),
// Text(
// '创建后仅我可发放该优惠券',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(24),
// color: selectF
// ? MyColours.color_ffffff
// : MyColours.color_BFC4D4),
// ),
// ],
// ),
],
),
)),
... ... @@ -130,37 +138,21 @@ class _CouponCreateSelectTypePageState
child: Row(
children: [
Image.asset(
Utils.getImgPath(!selectF
? 'coupon_select_type_store'
: 'coupon_select_type_store_un'),
width: ScreenUtil().setWidth(75 * 2),
Utils.getImgPath(!selectF ? 'pay' : 'pay_un'),
width: ScreenUtil().setWidth(50 * 2),
),
HEmptyView(60),
HEmptyView(56),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'为全店创建',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
VEmptyView(16),
Text(
'创建后所有员工均可发放该优惠券',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_BFC4D4),
),
],
)),
child: Text(
'付费优惠券',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
),
],
),
)),
... ...
... ... @@ -197,7 +197,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
///是否立即启用
Widget _canUse(String title, bool swich) {
return Container(
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(14)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
... ... @@ -215,8 +215,12 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
Spacer(),
Image.asset(
swich
? Utils.getImgPath('swich_on')
: Utils.getImgPath('swich_off'),
? Utils.getImgPath(title == '立即启用' || title == '是否核销'
? 'swich_on'
: 'swich_on_lit')
: Utils.getImgPath(title == '立即启用' || title == '是否核销'
? 'swich_off'
: 'swich_off_lit'),
width: ScreenUtil().setWidth(44 * 2),
)
],
... ... @@ -328,9 +332,9 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
appBar: SystemAppBar(
'优惠券详情',
onTap: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
// rightImgName: couponProvider != null &&
// couponProvider.couponSunModel != null &&
... ... @@ -386,13 +390,22 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
'券类型',
couponProvider.couponSunModel.isType == '1'
? '店铺优惠券'
: '我的优惠券'),
: couponProvider.couponSunModel.isType ==
'2'
? '我的优惠券'
: couponProvider
.couponSunModel.isType ==
'3'
? '免费代金券'
: '付费优惠券'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (couponProvider.couponSunModel.isType == '1')
if (couponProvider.couponSunModel.isType == '1' ||
couponProvider.couponSunModel.isType == '3' ||
couponProvider.couponSunModel.isType == '4')
Column(
children: [
_canUse(
... ... @@ -414,7 +427,21 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (couponProvider.couponSunModel.isType == '1' &&
_item(
couponProvider.couponSunModel.isType == '3'
? '券金额'
: '销售价',
'${couponProvider.couponSunModel.price}元' ??
''),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if ((couponProvider.couponSunModel.isType == '1' ||
couponProvider.couponSunModel.isType ==
'4') &&
couponProvider.couponSunModel.use != null)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
... ... @@ -470,25 +497,22 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'销售价',
'${couponProvider.couponSunModel.price}元' ??
''),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
],
),
_item('券要求', couponProvider.couponSunModel.desc),
_item(
'消费要求',
couponProvider.couponSunModel.isType == '1' ||
couponProvider.couponSunModel.isType ==
'2'
? couponProvider.couponSunModel.desc
: '消费满${couponProvider.couponSunModel.desc}元可用'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'有效期从',
'活动开始于',
Utils.getDateStrFromJiekou(
couponProvider.couponSunModel.stime)),
Container(
... ... @@ -497,9 +521,40 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
),
VEmptyView(24),
_item(
'有效期至',
'活动结束于',
Utils.getDateStrFromJiekou(
couponProvider.couponSunModel.etime)),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (couponProvider.couponSunModel.isType == '3' ||
couponProvider.couponSunModel.isType == '4')
_item('领取后有效天数',
couponProvider.couponSunModel.aexpiration),
if ((couponProvider.couponSunModel.isType == '3' ||
couponProvider.couponSunModel.isType ==
'4') &&
couponProvider.couponSunModel.expDate != null)
Column(children: [
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'不可用日期',
couponProvider
.couponSunModel.expDate.weekShow),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
]),
if (couponProvider.couponSunModel.isType == '1' &&
couponProvider.couponSunModel.expDate != null)
Column(children: [
... ... @@ -555,7 +610,102 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
// ],
// )
// : SizedBox(),
couponProvider.couponSunModel.isType == '1'
if (couponProvider.couponSunModel.isType == '3' ||
couponProvider.couponSunModel.isType == '4')
Column(
children: [
VEmptyView(24),
Container(
alignment: Alignment.centerLeft,
child: Text(
'使用规则:',
style: TextStyle(
color: MyColours.color_515151,
// fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(24),
Padding(
padding: EdgeInsets.only(
left: w(32),
),
child: Column(
children: [
_canUse(
'领取当日可用',
couponProvider.couponSunModel.arule
.isSameDay),
_canUse(
'可以叠加使用其他优惠券',
couponProvider.couponSunModel.arule
.isAccumulation,
),
_canUse(
'可使用包间',
couponProvider.couponSunModel.arule
.isCompartment),
_canUse(
'堂食可用',
couponProvider
.couponSunModel.arule.isEatin,
),
_canUse(
'外带可用',
couponProvider.couponSunModel.arule
.isTakeout),
_canUse(
'是否需要提前预约',
couponProvider.couponSunModel.arule
.isAppointment),
],
),
),
VEmptyView(24),
Container(
alignment: Alignment.centerLeft,
child: Text(
'分享设置:',
style: TextStyle(
color: MyColours.color_515151,
// fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(24),
Padding(
padding: EdgeInsets.only(
left: w(32),
),
child: Column(
children: [
_canUse(
'用户可以分享给好友',
couponProvider.couponSunModel.arule
.isShareLose),
_canUse(
'用户分享给好友后继续拥有此券',
couponProvider
.couponSunModel.arule.isShareHave,
),
_canUse(
'分享核销后,分享用户获得佣金',
couponProvider.couponSunModel.arule
.isCommission),
_item('分享佣金',
'${couponProvider.couponSunModel.arule.commission}%'),
],
),
),
VEmptyView(24),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
],
),
couponProvider.couponSunModel.isType == '1' ||
couponProvider.couponSunModel.isType == '4'
? Column(
crossAxisAlignment:
CrossAxisAlignment.start,
... ... @@ -573,12 +723,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'发放总量限制',
couponProvider
.couponSunModel.grantNum ??
''),
// _select(
// '谁可以发放',
// '查看',
... ... @@ -594,6 +739,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
],
)
: SizedBox(),
VEmptyView(24),
_item('发放总量限制',
couponProvider.couponSunModel.grantNum ?? ''),
couponProvider.couponSunModel.explain != null &&
couponProvider.couponSunModel.explain != ''
? Container(
... ... @@ -607,39 +756,40 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
: SizedBox(),
couponProvider.couponSunModel.explain != null &&
couponProvider.couponSunModel.explain != ''
? _item('券说明', '')
? _item('券说明',
couponProvider.couponSunModel.explain)
: SizedBox(),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
// VEmptyView(24),
// if (couponProvider.couponSunModel.explain != null &&
// couponProvider.couponSunModel.explain != '')
// Align(
// alignment: Alignment.centerRight,
// child: Text(
// couponProvider.couponSunModel.explain,
// textAlign: TextAlign.left,
// style: TextStyle(
// // height: 1.5,
// fontSize: font(16),
// color: MyColours.color_999999),
// ),
// ),
VEmptyView(24),
if (couponProvider.couponSunModel.explain != null &&
couponProvider.couponSunModel.explain != '')
Align(
alignment: Alignment.centerLeft,
child: Text(
couponProvider.couponSunModel.explain,
textAlign: TextAlign.left,
style: TextStyle(
// height: 1.5,
fontSize: font(16),
color: MyColours.color_999999),
),
),
if (couponProvider.couponSunModel.explain != null &&
couponProvider.couponSunModel.explain != '')
VEmptyView(24),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
VEmptyView(24),
// VEmptyView(24),
_canUse(
'立即启用',
couponProvider.couponSunModel.status == '1'
? true
: false)
: false),
VEmptyView(24),
],
))),
),
... ... @@ -668,7 +818,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (couponProvider.couponSunModel.liteQrcode != null &&
couponProvider.couponSunModel.isType == '1')
(couponProvider.couponSunModel.isType == '4'))
RoundButton(
text: '生成海报',
width: w(100),
... ... @@ -706,82 +856,90 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
),
if (couponProvider.couponSunModel.liteQrcode != null)
HEmptyView(30),
RoundButton(
text: '复用',
width: w(100),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: true,
fontSize: 28,
onPressed: () async {
//复用,跳转至编辑页面
bool needRefresh =
await NavigatorUtil.goCouponEditPage(context,
isMine:
couponProvider.couponSunModel.isType ==
'1'
? false
: true,
couponSunModel: couponProvider.couponSunModel);
if(needRefresh != null &&needRefresh){
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
},
),
HEmptyView(30),
Expanded(
child: RoundButton(
text: '分享给客户',
if (couponProvider.couponSunModel.isType == '3' ||
couponProvider.couponSunModel.isType == '4')
RoundButton(
text: '复用',
width: w(100),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: false,
isBold: true,
fontSize: 28,
onPressed: () {
if (couponProvider.couponSunModel.status != '1') {
Utils.showToast('请先启用优惠券后再进行操作!');
return;
}
if (couponProvider.couponSunModel.isType == '1' &&
couponProvider.couponSunModel.status == '1') {
//店铺券
// 谁可以发放
// 可以发放的才能分享
if (couponProvider.couponSunModel.uidList
.split(',')
.contains(Provider.of<UserModel>(context,
listen: false)
.user
.openid)) {
//包含当前登录人
Utils.goShareBuyCouponToWeChat(
context,
widget.idstr,
couponProvider.couponSunModel.use,
couponProvider.couponSunModel);
} else {
Utils.showToast('您没有此权限');
onPressed: () async {
//复用,跳转至编辑页面
bool needRefresh =
await NavigatorUtil.goCouponEditPage(context,
isMine:
couponProvider.couponSunModel.isType ==
'4'
? false
: true,
couponSunModel:
couponProvider.couponSunModel);
if (needRefresh != null && needRefresh) {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
} else if (couponProvider.couponSunModel.isType ==
'2' &&
couponProvider.couponSunModel.status == '1') {
// 我的优惠券
Utils.goShareBuyCouponToWeChatMy(
context,
widget.idstr,
managerName,
couponProvider.couponSunModel);
}
},
),
)
HEmptyView(30),
if (couponProvider.couponSunModel.isType == '3' ||
couponProvider.couponSunModel.isType == '4')
Expanded(
child: RoundButton(
text: '分享给客户',
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: false,
fontSize: 28,
onPressed: () {
if (couponProvider.couponSunModel.status != '1') {
Utils.showToast('请先启用优惠券后再进行操作!');
return;
}
if ((couponProvider.couponSunModel.isType ==
'3' ||
couponProvider.couponSunModel.isType ==
'4') &&
couponProvider.couponSunModel.status == '1') {
//店铺券
// 谁可以发放
// 可以发放的才能分享
if (couponProvider.couponSunModel.uidList
.split(',')
.contains(Provider.of<UserModel>(context,
listen: false)
.user
.openid)) {
//包含当前登录人
Utils.goShareBuyCouponToWeChat(
context,
widget.idstr,
couponProvider.couponSunModel.use,
couponProvider.couponSunModel);
} else {
Utils.showToast('您没有此权限');
}
}
// else if (couponProvider.couponSunModel.isType ==
// '2' &&
// couponProvider.couponSunModel.status == '1') {
// // 我的优惠券
// Utils.goShareBuyCouponToWeChatMy(
// context,
// widget.idstr,
// managerName,
// couponProvider.couponSunModel);
// }
},
),
)
],
))
]);
... ...
... ... @@ -49,7 +49,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
TextEditingController _couponRequireEditControl = TextEditingController();
TextEditingController _couponExplainEditControl = TextEditingController();
TextEditingController _limitNumControl = TextEditingController();
TextEditingController _commissionControl = TextEditingController();
TextEditingController _limitDay = TextEditingController();
FocusNode _limitNumFocusNode = FocusNode();
FocusNode _limitDayFocusNode = FocusNode();
FocusNode _commissionFocusNode = FocusNode();
final heightCell = ScreenUtil().setWidth(48 * 2);
bool swichState = true; //默认启用 开关状态
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
... ... @@ -59,7 +64,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
FocusNode _requireFocusNode = FocusNode();
bool showDateSelWidget = false;
CouponProvider couponProvider;
bool swichHexiao = true; //默认启用 核销状态
// bool swichHexiao = true; //默认启用 核销状态
String uids = '';
TextEditingController _priceControl = TextEditingController();
FocusNode _priceFocusNode = FocusNode();
... ... @@ -79,7 +84,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
bool limitNone = true;
bool limitWeek = false;
bool limitBirthday = false;
String weekShow = '点击设置可用日期';
String weekShow = '无';
List<FilterBtnModel> weekData = [];
// morning == "00:00-00:00"
... ... @@ -92,6 +97,20 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
List<String> imgAll = [];
bool isSameDay = true; //领取当日可用
bool isAccumulation = true; //叠加使用
bool isCompartment = true; //包间可用
bool isEatin = true; //堂食
bool isTakeout = true; //外带
bool isAppointment = true; //预约
bool isShareLose = true; //分享好友
bool isShareHave = true; //分享好友后继续拥有此券
bool isCommission = true; //返佣金
@override
void initState() {
super.initState();
... ... @@ -193,15 +212,26 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
endDate = DateUtil.formatDate(dateTimee, format: DateFormats.y_mo_d);
swichState = widget.couponSunModel.status == '1' ? true : false;
_priceControl.text = widget.couponSunModel.price;
_limitDay.text = widget.couponSunModel.aexpiration;
isSameDay = widget.couponSunModel.arule.isSameDay;
isAccumulation = widget.couponSunModel.arule.isAccumulation;
isCompartment = widget.couponSunModel.arule.isCompartment;
isEatin = widget.couponSunModel.arule.isEatin; //堂食
isTakeout = widget.couponSunModel.arule.isTakeout; //外带
isAppointment = widget.couponSunModel.arule.isAppointment;
isShareLose = widget.couponSunModel.arule.isShareLose; //分享好友
isShareHave = widget.couponSunModel.arule.isShareHave; //分享好友后继续拥有此券
isCommission = widget.couponSunModel.arule.isCommission; //返佣金
_commissionControl.text = widget.couponSunModel.arule.commission;
weekShow = widget.couponSunModel.expDate.weekShow ?? '无';
weekData = widget.couponSunModel.expDate.weekData ?? [];
_limitNumControl.text = widget.couponSunModel.grantNum;
if (widget.isMine) {
//我的优惠券
} else {
//店铺
swichHexiao = widget.couponSunModel.isExamine == '1' ? true : false;
_priceControl.text = widget.couponSunModel.price;
if (!widget.isMine) {
//付费优惠券
// swichHexiao = widget.couponSunModel.isExamine == '1' ? true : false;
money = widget.couponSunModel.use.isCash;
dish = widget.couponSunModel.use.isDish;
discount = widget.couponSunModel.use.isDiscount;
... ... @@ -223,10 +253,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
limitBirthday = widget.couponSunModel.expDate.isBirthday ? true : false;
limitWeek = widget.couponSunModel.expDate.isWeek ? true : false;
weekShow = widget.couponSunModel.expDate.weekShow ?? '点击设置可用日期';
weekData = widget.couponSunModel.expDate.weekData ?? [];
uids = widget.couponSunModel.uidList;
_limitNumControl.text = widget.couponSunModel.grantNum;
}
}
... ... @@ -286,6 +313,11 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
filterBtnModel.title = '周${Utils.formatWeekDayNum(i)}';
weekData.add(filterBtnModel);
}
FilterBtnModel filterBtnModel1 = FilterBtnModel();
filterBtnModel1.selectNoon = false;
filterBtnModel1.selectNig = false;
filterBtnModel1.title = '法定假日';
weekData.add(filterBtnModel1);
}
//创建新券 客户经理创建活动
... ... @@ -307,14 +339,46 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
"explain": _couponExplainEditControl.text,
"is_open": swichState ? "1" : "0",
"status": swichState ? "1" : "0",
'is_type': widget.isMine ? "2" : "1"
'is_type': widget.isMine ? "3" : "4"
};
params['aexpiration'] = _limitDay.text;
// params['arule'] = ;
params['price'] =
_priceControl.text.trim().length == 0 ? '0' : _priceControl.text;
Map expDate = {
// 'is_none': limitNone ? '1' : '0',
// 'is_week': limitWeek ? '1' : '0',
// 'is_birthday': limitBirthday ? '1' : '0',
'week_show': weekShow,
'week_data': weekData
};
params['exp_date'] = jsonEncode(expDate);
if (_limitNumControl.text.trim().length == 0) {
params['grant_num'] = '1000';
} else {
params['grant_num'] = _limitNumControl.text;
}
Map setting = {
'is_same_day': isSameDay ? '1' : '0',
'is_accumulation': isAccumulation ? '1' : '0',
'is_compartment': isCompartment ? '1' : '0',
'is_eatin': isEatin ? '1' : '0',
'is_takeout': isTakeout ? '1' : '0',
'is_appointment': isAppointment ? '1' : '0',
'is_share_lose': isShareLose ? '1' : '0',
'is_share_have': isShareHave ? '1' : '0',
'is_commission': isCommission ? '1' : '0',
'commission': _commissionControl.text
};
params['arule'] = jsonEncode(setting);
params['is_examine'] = "1";
List<String> images = [];
if (!widget.isMine) {
params['is_examine'] = swichHexiao ? "1" : "0";
params['uid_list'] = uids;
params['price'] =
_priceControl.text.trim().length == 0 ? '0' : _priceControl.text;
if (img.length > 0) {
img.forEach((value) {
... ... @@ -332,21 +396,6 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
'images': json.encode(images)
};
params['use'] = jsonEncode(use);
Map expDate = {
'is_none': limitNone ? '1' : '0',
'is_week': limitWeek ? '1' : '0',
'is_birthday': limitBirthday ? '1' : '0',
'week_show': weekShow,
'week_data': weekData
};
params['exp_date'] = jsonEncode(expDate);
if (_limitNumControl.text.trim().length == 0) {
params['grant_num'] = '1000';
} else {
params['grant_num'] = _limitNumControl.text;
}
}
bool isSuccess =
await couponProvider.createCustomerActivity(context, params);
... ... @@ -380,6 +429,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
TextEditingController controller, FocusNode focusNode,
{TextInputType textInputType = TextInputType.text}) {
return Container(
margin: EdgeInsets.only(bottom: w(12)),
height: w(24),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
... ... @@ -388,11 +439,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
title,
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
fontWeight:
title == '分享佣金' ? FontWeight.normal : FontWeight.bold,
fontSize: title == '分享佣金' ? font(14) : font(16)),
),
),
HEmptyView(80),
// HEmptyView(10),
Expanded(
// width: ScreenUtil().setWidth(231 * 2),
child: TextField(
... ... @@ -406,18 +458,25 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
//输入文本的样式
inputFormatters: title == '券名称'
? [LengthLimitingTextInputFormatter(15)]
: [],
: title == '券金额' ||
title == '领取后有效天数' ||
title == '消费要求(0为无门槛)' ||
title == '分享佣金' ||
title == '发放总量限制'
? [FilteringTextInputFormatter.digitsOnly]
: [], // 限制输入为数字,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
fontSize: ScreenUtil().setSp(28),
),
focusNode: focusNode,
decoration: InputDecoration(
isCollapsed: true,
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32),
fontSize: ScreenUtil().setSp(28),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
... ... @@ -432,7 +491,26 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
},
keyboardType: textInputType),
),
HEmptyView(32)
HEmptyView(5),
if (title == '领取后有效天数')
Text(
'天',
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
fontSize: font(14),
),
),
if (title == '分享佣金')
Text(
'%',
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
fontSize: font(14),
),
),
HEmptyView(22)
],
),
);
... ... @@ -569,16 +647,16 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
)),
VEmptyView(26),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
// VEmptyView(26),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
TextField(
controller: _couponExplainEditControl,
// keyboardType: TextInputType.number, //键盘类型,数字键盘
maxLines: 3,
maxLength: 50,
maxLines: 5,
maxLength: 500,
// maxLengthEnforced: true,
style: TextStyle(
... ... @@ -632,11 +710,14 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
}
///是否立即启用
Widget _canUse(String title, bool swich, GestureTapCallback onTap) {
Widget _canUse(String title, bool swich, GestureTapCallback onTap,
{bool isBig = true}) {
return InkWell(
onTap: onTap,
child: Container(
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
padding: isBig
? EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24))
: EdgeInsets.only(bottom: w(17)),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
... ... @@ -649,15 +730,16 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
title,
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
fontWeight:
title == '立即启用' ? FontWeight.bold : FontWeight.normal,
fontSize: title == '立即启用' ? font(16) : font(14)),
),
),
Spacer(),
Image.asset(
swich
? Utils.getImgPath('swich_on')
: Utils.getImgPath('swich_off'),
? Utils.getImgPath(isBig ? 'swich_on' : 'swich_on_lit')
: Utils.getImgPath(isBig ? 'swich_off' : 'swich_off_lit'),
width: ScreenUtil().setWidth(44 * 2),
)
],
... ... @@ -797,51 +879,52 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
child: Column(
children: [
VEmptyView(56),
_item('券类型', widget.isMine ? '我的优惠券' : '店铺优惠券'),
// _item('券类型', widget.isMine ? '我的优惠券' : '店铺优惠券'),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(24),
// widget.isMine
// ? SizedBox()
// : _canUse('是否核销', swichHexiao, () {
// setState(() {
// swichHexiao = !swichHexiao;
// });
// }),
// widget.isMine
// ? SizedBox()
// : Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// widget.isMine ? SizedBox() : VEmptyView(24),
_textfield('券名称', '点击输入券名称',
_couponNameEditControl, _nameFocusNode),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
widget.isMine
? SizedBox()
: _canUse('是否核销', swichHexiao, () {
setState(() {
swichHexiao = !swichHexiao;
});
}),
widget.isMine
? SizedBox()
: Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
_textfield('券名称', '例:9折券/200元代金券/菜品券',
_couponNameEditControl, _nameFocusNode),
VEmptyView(48),
//销售价
_textfield(widget.isMine ? '券金额' : '销售价',
'点击输入代金券金额', _priceControl, _priceFocusNode,
textInputType:
TextInputType.numberWithOptions(
decimal: true)),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
VEmptyView(48),
if (!widget.isMine)
Column(
children: [
//销售价
_textfield('销售价', '默认0元,可以免费发放',
_priceControl, _priceFocusNode,
textInputType:
TextInputType.numberWithOptions(
decimal: true)),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
// VEmptyView(24),
//券用途
VEmptyView(56),
Container(
alignment: Alignment.centerLeft,
child: Text(
... ... @@ -1059,16 +1142,18 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
],
),
_textfield('券要求', '例:无门槛/满2000元',
_textfield('消费要求(0为无门槛)', '点击输入最低消费金额需求',
_couponRequireEditControl, _requireFocusNode),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_select('有效期从', fromDate, () {
_select('活动开始于', fromDate, () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
... ... @@ -1100,7 +1185,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_select('有效期至', endDate, () {
_select('活动结束于', endDate, () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
... ... @@ -1131,128 +1216,294 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (!widget.isMine)
Column(
children: [
//使用限制
VEmptyView(24),
Container(
alignment: Alignment.centerLeft,
child: Text(
'使用限制',
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(40),
Row(
children: [
HEmptyView(30),
_itemRadioWidget(limitNone, '无',
onTap: () {
if (!limitNone) {
setState(() {
limitNone = true;
VEmptyView(48),
limitWeek = false;
limitBirthday = false;
});
}
}),
Spacer(),
_itemRadioWidget(limitWeek, '每周',
onTap: () {
if (!limitWeek) {
setState(() {
limitWeek = true;
limitNone = false;
limitBirthday = false;
});
}
}),
Spacer(),
_itemRadioWidget(
limitBirthday, '会员生日当天', onTap: () {
if (!limitBirthday) {
setState(() {
limitBirthday = true;
limitNone = false;
limitWeek = false;
});
}
}),
HEmptyView(30),
],
),
if (limitWeek) VEmptyView(30),
if (limitWeek)
_select1(weekShow, '', () async {
FocusScope.of(context).requestFocus(
FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
// showPickerDateTime(context);
showDateSelWidget = false;
List<FilterBtnModel> data = await DialogUtil
.openCoponsWeekSelectModalBottomSheet(
context, weekData);
if (data != null) {
//改变了
weekData = [];
weekData.addAll(data);
weekShow = '';
String noonStr = '午餐:';
String nightStr = '晚餐:';
weekData.forEach((element) {
if (element.selectNoon) {
noonStr += '${element.title} ';
}
if (element.selectNig) {
nightStr += '${element.title} ';
}
});
if (noonStr.endsWith(' ')) {
noonStr = noonStr.substring(
0, noonStr.length - 1);
}
if (nightStr.endsWith(' ')) {
nightStr = nightStr.substring(
0, nightStr.length - 1);
}
_textfield('领取后有效天数', '点击输入,0表示到活动结束', _limitDay,
_limitDayFocusNode,
textInputType: TextInputType.number),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (noonStr == '午餐:' &&
nightStr == '晚餐:') {
weekShow = '点击设置可用日期';
} else {
if (noonStr != '午餐:' &&
nightStr != '晚餐:') {
weekShow =
noonStr + '\n' + nightStr;
} else if (noonStr != '午餐:') {
weekShow = noonStr;
} else {
weekShow = nightStr;
}
}
_select('不可用日期', weekShow, () async {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
// showPickerDateTime(context);
showDateSelWidget = false;
List<FilterBtnModel> data = await DialogUtil
.openCoponsWeekSelectModalBottomSheet(
context, weekData);
if (data != null) {
//改变了
weekData = [];
weekData.addAll(data);
weekShow = '';
String noonStr = '午餐:';
String nightStr = '晚餐:';
weekData.forEach((element) {
if (element.selectNoon) {
noonStr += '${element.title} ';
}
if (element.selectNig) {
nightStr += '${element.title} ';
}
});
if (noonStr.endsWith(' ')) {
noonStr = noonStr.substring(
0, noonStr.length - 1);
}
if (nightStr.endsWith(' ')) {
nightStr = nightStr.substring(
0, nightStr.length - 1);
}
if (noonStr == '午餐:' && nightStr == '晚餐:') {
weekShow = '无';
} else {
if (noonStr != '午餐:' && nightStr != '晚餐:') {
weekShow = noonStr + '\n' + nightStr;
} else if (noonStr != '午餐:') {
weekShow = noonStr;
} else {
weekShow = nightStr;
}
}
setState(() {});
}
}),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
setState(() {});
}
}),
limitWeek ? VEmptyView(22) : VEmptyView(48),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
Container(
alignment: Alignment.centerLeft,
child: Text(
'使用规则:',
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(24),
Padding(
padding: EdgeInsets.only(
left: w(32),
),
child: Column(
children: [
_canUse('领取当日可用', isSameDay, () {
setState(() {
isSameDay = !isSameDay;
});
}, isBig: false),
_canUse('可以叠加使用其他优惠券', isAccumulation, () {
setState(() {
isAccumulation = !isAccumulation;
});
}, isBig: false),
_canUse('可使用包间', isCompartment, () {
setState(() {
isCompartment = !isCompartment;
});
}, isBig: false),
_canUse('堂食可用', isEatin, () {
setState(() {
isEatin = !isEatin;
});
}, isBig: false),
_canUse('外带可用', isTakeout, () {
setState(() {
isTakeout = !isTakeout;
});
}, isBig: false),
_canUse('是否需要提前预约', isAppointment, () {
setState(() {
isAppointment = !isAppointment;
});
}, isBig: false),
],
),
),
VEmptyView(24),
Container(
alignment: Alignment.centerLeft,
child: Text(
'分享设置:',
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(24),
Padding(
padding: EdgeInsets.only(
left: w(32),
),
child: Column(
children: [
_canUse('用户可以分享给好友', isShareLose, () {
setState(() {
isShareLose = !isShareLose;
});
}, isBig: false),
_canUse('用户分享给好友后继续拥有此券', isShareHave, () {
setState(() {
isShareHave = !isShareHave;
});
}, isBig: false),
_canUse('分享核销后,分享用户获得佣金', isCommission, () {
setState(() {
isCommission = !isCommission;
});
}, isBig: false),
_textfield(
'分享佣金',
'点击输入,0表示到活动结束',
_commissionControl,
_commissionFocusNode,
textInputType: TextInputType.number),
],
),
),
VEmptyView(24),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
// if (!widget.isMine)
// Column(
// children: [
// //使用限制
// VEmptyView(24),
// Container(
// alignment: Alignment.centerLeft,
// child: Text(
// '使用限制',
// style: TextStyle(
// color: Color.fromRGBO(0, 0, 0, 0.9),
// fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(32)),
// ),
// ),
// VEmptyView(40),
// Row(
// children: [
// HEmptyView(30),
// _itemRadioWidget(limitNone, '无',
// onTap: () {
// if (!limitNone) {
// setState(() {
// limitNone = true;
// limitWeek = false;
// limitBirthday = false;
// });
// }
// }),
// Spacer(),
// _itemRadioWidget(limitWeek, '每周',
// onTap: () {
// if (!limitWeek) {
// setState(() {
// limitWeek = true;
// limitNone = false;
// limitBirthday = false;
// });
// }
// }),
// Spacer(),
// _itemRadioWidget(
// limitBirthday, '会员生日当天', onTap: () {
// if (!limitBirthday) {
// setState(() {
// limitBirthday = true;
// limitNone = false;
// limitWeek = false;
// });
// }
// }),
// HEmptyView(30),
// ],
// ),
// if (limitWeek) VEmptyView(30),
// if (limitWeek)
// _select1(weekShow, '', () async {
// FocusScope.of(context).requestFocus(
// FocusNode()); //点击空白处隐藏键盘
// //弹出时间选择器
// // showPickerDateTime(context);
// showDateSelWidget = false;
// List<FilterBtnModel> data = await DialogUtil
// .openCoponsWeekSelectModalBottomSheet(
// context, weekData);
// if (data != null) {
// //改变了
// weekData = [];
// weekData.addAll(data);
// weekShow = '';
// String noonStr = '午餐:';
// String nightStr = '晚餐:';
// weekData.forEach((element) {
// if (element.selectNoon) {
// noonStr += '${element.title} ';
// }
// if (element.selectNig) {
// nightStr += '${element.title} ';
// }
// });
// if (noonStr.endsWith(' ')) {
// noonStr = noonStr.substring(
// 0, noonStr.length - 1);
// }
// if (nightStr.endsWith(' ')) {
// nightStr = nightStr.substring(
// 0, nightStr.length - 1);
// }
// if (noonStr == '午餐:' &&
// nightStr == '晚餐:') {
// weekShow = '点击设置可用日期';
// } else {
// if (noonStr != '午餐:' &&
// nightStr != '晚餐:') {
// weekShow =
// noonStr + '\n' + nightStr;
// } else if (noonStr != '午餐:') {
// weekShow = noonStr;
// } else {
// weekShow = nightStr;
// }
// }
// setState(() {});
// }
// }),
// limitWeek ? VEmptyView(22) : VEmptyView(48),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(48),
// ],
// ),
widget.isMine ? VEmptyView(48) : VEmptyView(24),
widget.isMine
? SizedBox()
: _select('谁可以发放', '编辑', () async {
... ... @@ -1270,19 +1521,15 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
widget.isMine
? SizedBox()
: _textfield('发放总量限制', '点击输入总数量限制',
_limitNumControl, _limitNumFocusNode,
textInputType: TextInputType.number),
widget.isMine
? SizedBox()
: Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
widget.isMine ? SizedBox() : VEmptyView(48),
_textfield('发放总量限制', '点击输入总数量限制',
_limitNumControl, _limitNumFocusNode,
textInputType: TextInputType.number),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_explain('券说明', '例:可用包间,停车免费,不与店内其他活动共享等'),
VEmptyView(20),
_canUse('立即启用', swichState, () {
... ... @@ -1313,6 +1560,11 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
Utils.showToast('请填写券名称');
return;
}
if (_priceControl.text.trim().length == 0) {
Utils.showToast(widget.isMine ? '请填写券金额' : '请填写销售价');
return;
}
if (!widget.isMine) {
if (money && moneyControl.text.trim().length == 0) {
Utils.showToast('请输入代金券金额!');
... ... @@ -1327,42 +1579,54 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
Utils.showToast('请输入菜品!');
return;
}
if (limitWeek && weekShow == '点击设置可用日期') {
Utils.showToast('请设置可用日期!');
return;
}
if (uids == null || uids == '') {
Utils.showToast('请设置发放人!');
return;
}
bool isNumber = Utils.isInteger(
_limitNumControl.text.trim()); //判断输入的内容是否是数字
if (!isNumber) {
Utils.showToast('发放总量限制请输入数字');
_limitNumControl.text = '';
return;
}
}
if (_couponRequireEditControl.text.trim().length == 0) {
Utils.showToast('请填写券要求');
Utils.showToast('请填写消费要求');
return;
}
if (fromDate == '点击选择') {
Utils.showToast('请选择有效期起始时间');
Utils.showToast('请选择活动开始时间');
return;
}
if (endDate == '点击选择') {
Utils.showToast('请选择有效期结束时间');
Utils.showToast('请选择活动结束时间');
return;
}
if (DateUtil.getDateTime(endDate)
.compareTo(DateUtil.getDateTime(fromDate)) <
0) {
Utils.showToast('有效期结束时间不能早于起始时间');
Utils.showToast('活动结束时间不能早于活动开始时间');
return;
}
if (_limitDay.text.trim().length == 0) {
Utils.showToast('请填写领取后有效天数');
return;
}
if (isCommission &&
_commissionControl.text.trim().length == 0) {
Utils.showToast('请填写分享佣金的比例');
return;
}
if (!widget.isMine) {
if (uids == null || uids == '') {
Utils.showToast('请设置发放人!');
return;
}
}
if (_limitNumControl.text.trim().length == 0) {
Utils.showToast('请填写发放总量限制');
return;
}
// bool isNumber = Utils.isInteger(
// _limitNumControl.text.trim()); //判断输入的内容是否是数字
// if (!isNumber) {
// Utils.showToast('发放总量限制请输入数字');
// _limitNumControl.text = '';
// return;
// }
// ***参数***
// _couponNameEditControl.text
... ... @@ -1375,8 +1639,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
}
},
text: '立即创建',
fontSize: 24,
isBold: false,
fontSize: 32,
isBold: true,
height: ScreenUtil().setWidth(37 * 2),
width: ScreenUtil().setWidth(130 * 2),
radius: ScreenUtil().setWidth(22),
... ...
... ... @@ -64,268 +64,10 @@ class _CouponItemFState extends State<CouponItemF> {
? Alignment.centerLeft
: AlignmentDirectional.topStart,
children: [
InkWell(
onTap: widget.onPressed,
child: Container(
// width: ScreenUtil().setWidth(610),
margin: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.25),
offset: Offset(0, ScreenUtil().setWidth(8)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(16)),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: ScreenUtil().setWidth(40),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(24)),
decoration: BoxDecoration(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? sunModel.isType == '1'
? sunModel.isMarking
? MyColours.color_00A870
: MyColours.color_438E93
: MyColours.color_ED7B2F
: MyColours.color_999999,
borderRadius: BorderRadius.only(
topLeft:
Radius.circular(ScreenUtil().setWidth(16)),
topRight: Radius.circular(
ScreenUtil().setWidth(16)))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
sunModel.isType == '1'
? sunModel.isExamine == '1'
? '店铺优惠券(核销)'
: '店铺优惠券'
: '我的优惠券',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24)),
),
InkWell(
onTap: widget.onPressedSwich,
child: Text(
sunModel.isType == '1'
? sunModel.isExamine == '1'
? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张'
: '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张'
: '被领取:${sunModel.receiveNum}张',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20))),
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(9 * 2),
ScreenUtil().setWidth(10),
ScreenUtil().setWidth(20)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: ScreenUtil().setWidth(232 * 2),
child: Container(
height: ScreenUtil().setWidth(25 * 2),
constraints: BoxConstraints(
maxWidth: ScreenUtil().setWidth(190)),
child: Text(
sunModel.aname,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_515151
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(36),
fontWeight: FontWeight.bold),
),
)),
Container(
height: ScreenUtil().setWidth(14 * 2),
width: ScreenUtil().setWidth(232 * 2),
child: Text('${sunModel.desc}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_515151
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(20),
)),
),
VEmptyView(16),
(ObjectUtil.isNotEmpty(sunModel.stime) &&
sunModel.stime != '0') ||
(ObjectUtil.isNotEmpty(sunModel.etime) &&
sunModel.etime != '0')
? Container(
child: Text(
'使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}',
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(20))),
)
: Container(),
],
),
// widget.from == 'select'
// ? widget.showCheck
// ? Positioned(
// right: 0,
// top: ScreenUtil().setWidth(20),
// child: Image.asset(
// Utils.getImgPath(widget.couponSonModel.isCheck
// ? 'check_r'
// : 'check_un'),
// width: ScreenUtil().setWidth(40),
// height: ScreenUtil().setWidth(40),
// ))
// : Container()
// :
),
ObjectUtil.isNotEmpty(sunModel.explain)
? const MySeparator(
width: 3, color: MyColours.color_f3f3f3)
: SizedBox(),
ObjectUtil.isNotEmpty(sunModel.explain)
? InkWell(
onTap: () {
if (explainH > 19) {
setState(() {
widget.couponSonModel.showText =
!widget.couponSonModel.showText;
});
}
},
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: widget.from == 'history'
? MyColours.color_ffffff
: notSelect
? MyColours.color_ffffff
: MyColours.color_FAFAFA,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(
ScreenUtil().setWidth(20)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(20)))),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
widget.couponSonModel.showText
? Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(14),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(14)),
width: ScreenUtil().screenWidth -
ScreenUtil().setWidth(92 * 2),
child: Text(
'说明:${sunModel.explain}',
maxLines: 5,
style: TextStyle(
color: widget.from ==
'history'
? MyColours
.color_BFC4D4
: MyColours
.color_999999,
fontSize: ScreenUtil()
.setSp(20))),
)
: Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(14),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(14)),
width: ScreenUtil().screenWidth -
ScreenUtil()
.setWidth(92 * 2) +
ScreenUtil().setWidth(20),
child: Text(
'说明:${sunModel.explain}',
maxLines: 1,
overflow: TextOverflow.fade,
softWrap: false,
style: TextStyle(
color: widget.from ==
'history'
? MyColours
.color_BFC4D4
: MyColours
.color_999999,
fontSize: ScreenUtil()
.setSp(20))),
),
Spacer(),
explainH > 19
? Container(
margin: EdgeInsets.only(
top:
ScreenUtil().setWidth(10),
right: ScreenUtil()
.setWidth(16)),
child: Image.asset(
!widget.couponSonModel
.showText
? Utils.getImgPath(
'quan_down_f')
: Utils.getImgPath(
'quan_up_f'),
width:
ScreenUtil().setWidth(28),
height: ScreenUtil()
.setWidth(28)),
)
: Container(),
HEmptyView(14)
],
)),
)
: Container(),
VEmptyView(32),
],
),
)),
Positioned(
left: ScreenUtil().setWidth(21),
child: widget.from == 'select'
Row(
children: [
HEmptyView(20),
widget.from == 'select'
? Image.asset(
Utils.getImgPath(sunModel.isCheck
? widget.radio
... ... @@ -334,9 +76,324 @@ class _CouponItemFState extends State<CouponItemF> {
: widget.radio
? 'show_select_f'
: 'c_not_edit'),
width: w(25),
width: w(20),
)
: Container()),
: Container(),
Expanded(
child: InkWell(
onTap: widget.onPressed,
child: Container(
// width: ScreenUtil().setWidth(610),
margin: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(20),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.25),
offset: Offset(0, ScreenUtil().setWidth(8)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(16)),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: ScreenUtil().setWidth(40),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(24)),
decoration: BoxDecoration(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: widget.from == 'setting'
? MyColours.color_00A870
: notSelect
? sunModel.isType == '1' ||
sunModel.isType ==
'3' ||
sunModel.isType == '4'
? sunModel.isMarking
? MyColours.color_00A870
: MyColours.color_438E93
: MyColours.color_ED7B2F
: MyColours.color_999999,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(
ScreenUtil().setWidth(16)),
topRight: Radius.circular(
ScreenUtil().setWidth(16)))),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
sunModel.isType == '1'
? sunModel.isExamine == '1'
? '店铺优惠券(核销)'
: '店铺优惠券'
: sunModel.isType == '2'
? '我的优惠券'
: sunModel.isType == '3'
? '免费代金券'
: '付费优惠券',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24)),
),
InkWell(
onTap: widget.onPressedSwich,
child: Text(
sunModel.isType == '1'
? sunModel.isExamine == '1'
? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张'
: '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张'
: sunModel.isType == '2'
? '被领取:${sunModel.receiveNum}张'
: '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize:
ScreenUtil().setSp(20))),
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(9 * 2),
ScreenUtil().setWidth(10),
ScreenUtil().setWidth(20)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: ScreenUtil().setWidth(232 * 2),
child: Container(
height: ScreenUtil().setWidth(25 * 2),
constraints: BoxConstraints(
maxWidth:
ScreenUtil().setWidth(190)),
child: Text(
sunModel.aname,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_515151
: MyColours
.color_999999,
fontSize:
ScreenUtil().setSp(36),
fontWeight: FontWeight.bold),
),
)),
Container(
height: ScreenUtil().setWidth(14 * 2),
width: ScreenUtil().setWidth(232 * 2),
child: Text(
sunModel.isType == '1' ||
sunModel.isType == '2'
? '${sunModel.desc}'
: sunModel.desc == '0'
? ''
: '消费满${sunModel.desc}元可用',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
? MyColours.color_515151
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(20),
)),
),
VEmptyView(16),
(ObjectUtil.isNotEmpty(sunModel.stime) &&
sunModel.stime != '0') ||
(ObjectUtil.isNotEmpty(
sunModel.etime) &&
sunModel.etime != '0')
? Container(
child: Text(
'使用时间:${ObjectUtil.isNotEmpty(sunModel.stime) ? Utils.getDateStrFromJiekou(sunModel.stime) : '--'} 至 ${ObjectUtil.isNotEmpty(sunModel.etime) ? Utils.getDateStrFromJiekou(sunModel.etime) : '--'}',
style: TextStyle(
color: widget.from ==
'history'
? MyColours.color_BFC4D4
: MyColours
.color_999999,
fontSize: ScreenUtil()
.setSp(20))),
)
: Container(),
],
),
// widget.from == 'select'
// ? widget.showCheck
// ? Positioned(
// right: 0,
// top: ScreenUtil().setWidth(20),
// child: Image.asset(
// Utils.getImgPath(widget.couponSonModel.isCheck
// ? 'check_r'
// : 'check_un'),
// width: ScreenUtil().setWidth(40),
// height: ScreenUtil().setWidth(40),
// ))
// : Container()
// :
),
ObjectUtil.isNotEmpty(sunModel.explain)
? const MySeparator(
width: 3, color: MyColours.color_f3f3f3)
: SizedBox(),
ObjectUtil.isNotEmpty(sunModel.explain)
? InkWell(
onTap: () {
if (explainH > 19) {
setState(() {
widget.couponSonModel.showText =
!widget.couponSonModel.showText;
});
}
},
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: widget.from == 'history'
? MyColours.color_ffffff
: notSelect
? MyColours.color_ffffff
: MyColours.color_FAFAFA,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(
ScreenUtil()
.setWidth(20)),
bottomRight: Radius.circular(
ScreenUtil()
.setWidth(20)))),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
widget.couponSonModel.showText
? Container(
padding:
EdgeInsets.fromLTRB(
ScreenUtil()
.setWidth(
24 * 2),
ScreenUtil()
.setWidth(14),
ScreenUtil()
.setWidth(0),
ScreenUtil()
.setWidth(
14)),
width: ScreenUtil()
.screenWidth -
ScreenUtil()
.setWidth(92 * 2),
child: Text(
'说明:${sunModel.explain}',
maxLines: 5,
style: TextStyle(
color: widget
.from ==
'history'
? MyColours
.color_BFC4D4
: MyColours
.color_999999,
fontSize:
ScreenUtil()
.setSp(
20))),
)
: Container(
padding:
EdgeInsets.fromLTRB(
ScreenUtil()
.setWidth(
24 * 2),
ScreenUtil()
.setWidth(14),
ScreenUtil()
.setWidth(0),
ScreenUtil()
.setWidth(
14)),
width: ScreenUtil()
.screenWidth -
ScreenUtil().setWidth(
92 * 2) +
ScreenUtil()
.setWidth(20),
child: Text(
'说明:${sunModel.explain}',
maxLines: 1,
overflow:
TextOverflow.fade,
softWrap: false,
style: TextStyle(
color: widget
.from ==
'history'
? MyColours
.color_BFC4D4
: MyColours
.color_999999,
fontSize:
ScreenUtil()
.setSp(
20))),
),
Spacer(),
explainH > 19
? Container(
margin: EdgeInsets.only(
top: ScreenUtil()
.setWidth(10),
right: ScreenUtil()
.setWidth(16)),
child: Image.asset(
!widget.couponSonModel
.showText
? Utils.getImgPath(
'quan_down_f')
: Utils.getImgPath(
'quan_up_f'),
width: ScreenUtil()
.setWidth(28),
height: ScreenUtil()
.setWidth(28)),
)
: Container(),
HEmptyView(14)
],
)),
)
: Container(),
VEmptyView(32),
],
),
))),
],
),
Positioned(
right: ScreenUtil().setWidth(100),
top: ScreenUtil().setWidth(37 * 2),
... ...
... ... @@ -194,14 +194,14 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
backgroundColor: MyColours.color_f3f3f3,
appBar: Utils.getAuthority(context, '线上券-设置')
? SystemAppBar(
'线上券',
'优惠券',
rightImgName: 'set_g.png',
onTapRight: () {
NavigatorUtil.goCouponSettingPage(context);
},
)
: SystemAppBar(
'线上券',
'优惠券',
),
body: Column(
children: <Widget>[
... ... @@ -211,16 +211,22 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
color: MyColours.color_ffffff,
padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(6)),
child: TabBar(
isScrollable: true, // 允许滚动
padding: EdgeInsets.only(left: w(15)),
// labelPadding:
// EdgeInsets.only(left: 16.0, right: 16.0), // 调整标签周围的空白区域
controller: tabController,
tabs: [
Tab(
text: "全部",
),
Tab(
text: "店铺优惠券",
text: "免费代金券",
),
Tab(
text: "我的优惠券",
text: "付费优惠券",
),
Tab(
text: "核销记录",
... ... @@ -233,7 +239,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
unselectedLabelColor: MyColours.color_999999,
labelStyle: TextStyle(
color: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(25),
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold),
unselectedLabelStyle: TextStyle(
color: MyColours.color_999999,
... ... @@ -254,12 +260,12 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
create: (_) => PersonnelProvider(),
child: ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(),
child: CouponSunPage(index: 1))),
child: CouponSunPage(index: 3))),
ChangeNotifierProvider<PersonnelProvider>(
create: (_) => PersonnelProvider(),
child: ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(),
child: CouponSunPage(index: 2))),
child: CouponSunPage(index: 4))),
ChangeNotifierProvider<PersonnelProvider>(
create: (_) => PersonnelProvider(),
child: CouponHasVerificationPage()),
... ... @@ -271,8 +277,8 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(16 * 2),
bottom: ScreenUtil().setWidth(35 * 2),
left: ScreenUtil().setWidth(45 * 2),
right: ScreenUtil().setWidth(45 * 2),
left: ScreenUtil().setWidth(23 * 2),
right: ScreenUtil().setWidth(23 * 2),
),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
... ... @@ -293,10 +299,10 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
tabController.index == 3
? Expanded(
child: RoundButton(
text: '扫码核销',
text: '扫码核销付费券',
width: tabController.index == 3
? double.infinity
: w(100),
: w(218),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
... ... @@ -304,15 +310,15 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: true,
fontSize: 28,
fontSize:32,
onPressed: () async {
_scan();
},
),
)
: RoundButton(
text: '扫码核销',
width: w(100),
text: '扫码核销付费券',
width: w(218),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
... ... @@ -320,7 +326,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: true,
fontSize: 28,
fontSize: 32,
onPressed: () async {
_scan();
},
... ... @@ -329,15 +335,15 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
if (tabController.index != 3)
Expanded(
child: RoundButton(
text: '创建新的优惠券',
text: '创建新券',
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: false,
fontSize: 28,
isBold: true,
fontSize: 32,
onPressed: () async {
// UserModel userModel =
// Provider.of<UserModel>(context, listen: false);
if (Utils.getAuthority(context, '创建新的优惠券')) {
if (Utils.getAuthority(context, '创建新券')) {
NavigatorUtil.goCouponCreateSelectTypePage(context);
}
// if (userModel.user.role_name == '管理员' ||
... ...
... ... @@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/pages/coupon/coupon_item_f.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:provider/provider.dart';
... ... @@ -39,7 +40,9 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
bool isOnlineBook = false; //在线预订
bool isOrder = false; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
bool isCouponFree = false; // 代金券免费
bool isCouponPay = false; // 代金券付费
bool isRecharge = false; //充值券
String welcome = '';
String qiniuUrl = '';
... ... @@ -48,6 +51,11 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
String rechargeContent = '';
List<CouponSunModel> couponDataList = [];
List<CouponSunModel> couponDataListFree = [];
List<CouponSunModel> couponDataListPay = [];
List<CouponSunModel> couponSelectFree = [];
List<CouponSunModel> couponSelectPay = [];
bool isComments = false; //启用评价设置
bool isCommentsCoupon = false; //启用评价送券
List<CouponSunModel> couponDataListComments = [];
... ... @@ -82,9 +90,14 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
? true
: false;
isCouponPay =
marketingCenterProvider.markDataModel.marketing.isCouponPay == '1'
? true
: false;
isCouponFree =
marketingCenterProvider.markDataModel.marketing.isCouponFree == '1'
? true
: false;
isRecharge =
marketingCenterProvider.markDataModel.marketing.isRecharge == '1'
... ... @@ -93,8 +106,12 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
rechargeData =
marketingCenterProvider.markDataModel.marketing.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
couponSelectPay =
marketingCenterProvider.markDataModel.marketing.couponDataListPay ??
[];
couponSelectFree =
marketingCenterProvider.markDataModel.marketing.couponDataListFree ??
[];
couponDataListComments = marketingCenterProvider
.markDataModel.marketing.couponDataListComments ??
[];
... ... @@ -126,13 +143,15 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
'is_arrival': isArrival ? '1' : '0', //确认到店
'is_online_book': isOnlineBook ? '1' : '0', //在线预订
'is_order': isOrder ? '1' : '0', //去点餐
'is_coupon': isCoupon ? '1' : '0', //代金券暂时
'is_coupon_free': isCouponFree ? '1' : '0', //代金券暂时免费
'is_coupon_pay': isCouponPay ? '1' : '0', //代金券暂时付费
'is_recharge': isRecharge ? '1' : '0', //充值券暂时
'is_link': isLink ? '1' : '0',
'wecomle': welcome ?? '',
'logo': qiniuUrl,
'recharge_data': rechargeData,
'coupon_data': json.encode(couponDataList),
// 'coupon_data_free': json.encode(couponDataList),
'coupon_data_pay': json.encode(couponSelectPay),
'is_comments': isComments ? '1' : '0',
'is_comments_coupon': isCommentsCoupon ? '1' : '0',
'coupon_data_comments': json.encode(couponDataListComments),
... ... @@ -161,14 +180,28 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
};
params['status'] = '1';
await couponProvider.getCustomerSelectActivityMarking(context, params,
isShowLoading: isShowLoading);
if (couponDataList == null || couponDataList.length == 0) {
if (couponProvider.couponListSelect != null &&
couponProvider.couponListSelect.length > 0) {
couponDataList.add(couponProvider.couponListSelect[0]);
List<CouponSunModel> couponData =
await couponProvider.getCustomerSelectActivityMarking(context, params,
isShowLoading: isShowLoading);
//组装免费、付费数据
couponData.forEach((element) {
if (element.isType == '3') {
couponDataListFree.add(element);
} else if (element.isType == '4') {
couponDataListPay.add(element);
}
}
});
// if (couponSelectFree == null || couponSelectFree.length == 0) {
// if (couponDataListFree != null && couponDataListFree.length > 0) {
// couponSelectFree.add(couponDataListFree[0]);
// }
// }
// if (couponSelectPay == null || couponSelectPay.length == 0) {
// if (couponDataListPay != null && couponDataListPay.length > 0) {
// couponSelectPay.add(couponDataListPay[0]);
// }
// }
setState(() {});
}
... ... @@ -197,63 +230,77 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
bool select = false,
VoidCallback onPressedSelect,
}) {
return Container(
margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)),
child: Column(
children: [
InkWell(
onTap: onPressedSelect,
child: Row(
children: [
Image.asset(
Utils.getImgPath(select ? 'f_select' : 'f_select_not'),
width: w(20),
),
HEmptyView(20),
Text(
'推荐店内优惠券活动',
style: TextStyle(
fontSize: font(14), color: MyColours.color_515151),
),
Spacer(),
RoundButton(
text: '选择活动',
width: w(72),
height: w(22),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
radius: r(11),
fontSize: 24,
isBold: true,
onPressed: onPressed,
)
],
)),
VEmptyView(20),
ListView.builder(
shrinkWrap: true,
controller: controller,
itemCount: couponDataList.length,
itemBuilder: (BuildContext context, int index) {
CouponSunModel couponData = couponDataList[index];
return _markingCuponItem(
couponData.aname,
_getCouponsDesc(couponData),
couponData.price ?? '',
couponData.use != null && couponData.use.isCash
? '${(double.parse(couponData.price) / double.parse(couponData.use.cash)) * 10}折'
: '',
'切换活动',
select: isCoupon, onPressedSelect: () {
setState(() {
isCoupon = !isCoupon;
});
});
})
],
),
return Column(
children: [
Container(
margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)),
child: InkWell(
onTap: onPressedSelect,
child: Row(
children: [
Image.asset(
Utils.getImgPath(select ? 'f_select' : 'f_select_not'),
width: w(20),
),
HEmptyView(20),
Text(
'预订安排中推荐付费优惠券活动',
style: TextStyle(
fontSize: font(14), color: MyColours.color_515151),
),
Spacer(),
RoundButton(
text: '选择活动',
width: w(72),
height: w(22),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
radius: r(11),
fontSize: 24,
isBold: true,
onPressed: onPressed,
)
],
))),
VEmptyView(20),
ListView.builder(
shrinkWrap: true,
controller: controller,
itemCount: couponSelectPay.length,
itemBuilder: (BuildContext context, int index) {
CouponSunModel couponData = couponSelectPay[index];
return CouponItemF(
from: 'setting',
couponSonModel: couponData,
showBtn: false,
onPressedSwich: () {
// couponProvider.couponList[index].isOpenBool =
// !couponProvider.couponList[index].isOpenBool;
// _setCustomerActivity(index);
},
onPressed: () {
NavigatorUtil.goCouponDetailPage(
context, couponProvider.couponList[index],
idStr: couponProvider.couponList[index].id);
},
);
// return _markingCuponItem(
// couponData.aname,
// _getCouponsDesc(couponData),
// couponData.price ?? '',
// couponData.use != null && couponData.use.isCash
// ? '${(double.parse(couponData.price) / double.parse(couponData.use.cash)) * 10}折'
// : '',
// '切换活动',
// select: isCoupon, onPressedSelect: () {
// setState(() {
// isCoupon = !isCoupon;
// });
// });
})
],
);
}
... ... @@ -426,30 +473,31 @@ class _CouponSettingPageState extends State<CouponSettingPage> {
children: [
_headItem('预订安排中附带的营销推广'),
VEmptyView(24),
couponProvider.couponListSelect != null &&
couponProvider.couponListSelect.length > 0
couponDataListPay != null && couponDataListPay.length > 0
? _markingCupon(
select: isCoupon,
select: isCouponPay,
onPressedSelect: () {
setState(() {
isCoupon = !isCoupon;
isCouponPay = !isCouponPay;
});
},
onPressed: () async {
//切换活动
Map temp =
await NavigatorUtil.goMarkingCouponSelectPage(
context, {'object': couponDataList});
context,
'4',
{'object': couponSelectPay});
if (temp != null && temp['coupon'] != null) {
couponDataList = temp['coupon'];
couponSelectPay = temp['coupon'];
setState(() {});
}
})
: (couponProvider.couponListSelect == null ||
couponProvider.couponListSelect.length == 0)
: (couponDataListPay == null ||
couponDataListPay.length == 0)
? _markingItem(
'推荐店内优惠券活动',
'预订安排中推荐付费优惠券活动',
'当前没有可用优惠券,请创建优惠券后再来尝试。',
select: false,
)
... ...
... ... @@ -41,9 +41,9 @@ class _CouponSunPageState extends State<CouponSunPage> {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (widget.index == 0) {
couponProvider.pageState = PageState.Loading;
} else if (widget.index == 1) {
} else if (widget.index == 3) {
couponProvider.pageStateStore = PageState.Loading;
} else if (widget.index == 2) {
} else if (widget.index == 4) {
couponProvider.pageStateMine = PageState.Loading;
}
couponProvider.notifyListeners();
... ... @@ -119,7 +119,17 @@ class _CouponSunPageState extends State<CouponSunPage> {
bool success = await marketingCenterProvider.getSellerTemplateConf(context);
if (success && marketingCenterProvider.markDataModel.marketing != null) {
couponDataList =
marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
marketingCenterProvider.markDataModel.marketing.couponDataListPay ??
[];
if (marketingCenterProvider.markDataModel.marketing.couponDataListFree !=
null &&
marketingCenterProvider
.markDataModel.marketing.couponDataListFree.length >
0) {
couponDataList.addAll(
marketingCenterProvider.markDataModel.marketing.couponDataListFree);
}
return true;
} else {
return false;
... ... @@ -156,9 +166,9 @@ class _CouponSunPageState extends State<CouponSunPage> {
PageState pageState;
if (widget.index == 0) {
pageState = couponProvider.pageState;
} else if (widget.index == 1) {
} else if (widget.index == 3) {
pageState = couponProvider.pageStateStore;
} else if (widget.index == 2) {
} else if (widget.index == 4) {
pageState = couponProvider.pageStateMine;
}
return Container(
... ...
... ... @@ -25,15 +25,18 @@ import 'package:sendsms/sendsms.dart';
import 'package:flutter_sms/flutter_sms.dart';
import '../../../../models/coupon_model.dart';
import '../../../../utils/screen_util.dart';
/**
* 优惠券单选页面
*/
class MarkingCouponSelectPage extends StatefulWidget {
final String type;
final List<CouponSunModel> couponList;
final bool mulSelect;
MarkingCouponSelectPage({Key key, this.couponList, this.mulSelect = true})
MarkingCouponSelectPage(
{Key key, this.type, this.couponList, this.mulSelect = true})
: super(key: key);
@override
... ... @@ -52,6 +55,7 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> {
_couponNetworkData({bool isShowLoading = true}) async {
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
"is_type": widget.type
};
params['status'] = '1';
... ... @@ -104,10 +108,10 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> {
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'优惠券',
'选择优惠券',
onTap: () {
if (Navigator.canPop(context)) {
Navigator.pop(context);
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
},
),
... ... @@ -190,7 +194,7 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> {
child: CouponItemF(
from: 'select',
showCheck: true,
radio: true,
radio: false,
couponSonModel:
couponProvider.couponListSelect[index],
onPressed: () {
... ... @@ -240,24 +244,43 @@ class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> {
)),
VEmptyView(20),
couponProvider.pageStateSelect == PageState.Success
? Padding(
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () async {
Map temp = {
'coupon': selectDataList,
};
if (Navigator.canPop(context)) {
Navigator.pop(context, temp);
}
},
text: '确定',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
width: double.infinity,
radius: ScreenUtil().setWidth(10),
? Container(
padding: EdgeInsets.only(
left: w(20), top: w(12), right: w(20), bottom: w(25)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
Utils.getImgPath(true ? 'c_mul_select' : 'c_not_edit'),
width: ScreenUtil().setWidth(40),
),
HEmptyView(10),
Text(
'全选',
style: TextStyle(
fontSize: ScreenUtil().setWidth(32),
fontWeight: FontWeight.bold,
color: MyColours.color_000000),
),
HEmptyView(20),
Expanded(
child: RoundButton(
onPressed: () async {
Map temp = {
'coupon': selectDataList,
};
if (Navigator.canPop(context)) {
Navigator.pop(context, temp);
}
},
text: '确定选择${selectDataList.length}个优惠券',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
// width: double.infinity,
radius: ScreenUtil().setWidth(10),
)),
],
))
: Container()
],
... ...
... ... @@ -51,14 +51,17 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
bool isOnlineBook = false; //在线预订
bool isOrder = false; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
bool isCouponFree = false; // 代金券
bool isCouponPay = false; // 代金券
bool isRecharge = false; //充值券
bool isCustomerCancel = true; //向客人开放取消预订功能
RechargeListSunModel rechargeData;
String rechargeContent = '';
List<CouponSunModel> couponDataList = [];
List<CouponSunModel> couponDataListFree = [];
List<CouponSunModel> couponDataListPay = [];
bool isComments = false; //启用评价设置
bool isCommentsCoupon = false; //启用评价送券
List<CouponSunModel> couponDataListComments = [];
... ... @@ -165,9 +168,14 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
? true
: false;
isCouponFree =
marketingCenterProvider.markDataModel.marketing.isCouponFree == '1'
? true
: false;
isCouponPay =
marketingCenterProvider.markDataModel.marketing.isCouponPay == '1'
? true
: false;
isRecharge =
marketingCenterProvider.markDataModel.marketing.isRecharge == '1'
... ... @@ -176,8 +184,12 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
rechargeData =
marketingCenterProvider.markDataModel.marketing.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
couponDataListFree =
marketingCenterProvider.markDataModel.marketing.couponDataListFree ??
[];
couponDataListPay =
marketingCenterProvider.markDataModel.marketing.couponDataListPay ??
[];
couponDataListComments = marketingCenterProvider
.markDataModel.marketing.couponDataListComments ??
[];
... ...
... ... @@ -38,7 +38,8 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
bool isOnlineBook = false; //在线预订
bool isOrder = false; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
bool isCouponFree = false; // 代金券
bool isCouponPay = false; // 代金券
bool isRecharge = false; //充值券
String welcome = '';
... ... @@ -47,7 +48,8 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
RechargeListSunModel rechargeData;
String rechargeContent = '';
List<CouponSunModel> couponDataList = [];
List<CouponSunModel> couponDataListFree = [];
List<CouponSunModel> couponDataListPay = [];
bool isComments = false; //启用评价设置
bool isCommentsCoupon = false; //启用评价送券
List<CouponSunModel> couponDataListComments = [];
... ... @@ -83,21 +85,27 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
? true
: false;
isCouponFree =
marketingCenterProvider.markDataModel.marketing.isCouponFree == '1'
? true
: false;
isCouponPay =
marketingCenterProvider.markDataModel.marketing.isCouponPay == '1'
? true
: false;
isRecharge =
marketingCenterProvider.markDataModel.marketing.isRecharge == '1'
? true
: false;
rechargeData =
marketingCenterProvider.markDataModel.marketing.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
couponDataListFree =
marketingCenterProvider.markDataModel.marketing.couponDataListFree ??
[];
couponDataListPay =
marketingCenterProvider.markDataModel.marketing.couponDataListPay ??
[];
couponDataListComments = marketingCenterProvider
.markDataModel.marketing.couponDataListComments ??
[];
... ... @@ -130,13 +138,15 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
'is_arrival': isArrival ? '1' : '0', //确认到店
'is_online_book': isOnlineBook ? '1' : '0', //在线预订
'is_order': isOrder ? '1' : '0', //去点餐
'is_coupon': isCoupon ? '1' : '0', //代金券暂时
'is_coupon_free': isCouponFree ? '1' : '0', //代金券暂时
'is_coupon_pay': isCouponPay ? '1' : '0', //代金券暂时
'is_recharge': isRecharge ? '1' : '0', //充值券暂时
'is_link': isLink ? '1' : '0',
'wecomle': welcome ?? '',
'logo': qiniuUrl,
'recharge_data': rechargeData,
'coupon_data': json.encode(couponDataList),
'coupon_data_pay': json.encode(couponDataListPay),
'coupon_data_free': json.encode(couponDataListFree),
'is_comments': isComments ? '1' : '0',
'is_comments_coupon': isCommentsCoupon ? '1' : '0',
'coupon_data_comments': json.encode(couponDataListComments),
... ... @@ -152,7 +162,7 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
// bus.emit('refresh_coupon_list_f');
Utils.showToast('保存成功');
if (Navigator.canPop(context)) {
Navigator.pop(context);
Navigator.pop(context);
}
}
}
... ... @@ -494,6 +504,7 @@ class _CommentsSettingPageState extends State<CommentsSettingPage> {
Map temp =
await NavigatorUtil.goMarkingCouponSelectPage(
context,
'3',
{'object': couponDataListComments},
mulSelect: false);
// Map temp = await NavigatorUtil.goCouponSelectPage(
... ...
... ... @@ -35,7 +35,8 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
bool isOnlineBook = false; //在线预订
bool isOrder = true; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
bool isCouponFree = false; // 代金券
bool isCouponPay = false; // 代金券
bool isRecharge = false; //充值券
RechargeListSunModel rechargeData;
... ... @@ -44,7 +45,8 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
String welcome = '';
List<CouponSunModel> couponDataList = [];
List<CouponSunModel> couponDataListFree = [];
List<CouponSunModel> couponDataListPay = [];
bool isComments = false; //启用评价设置
bool isCommentsCoupon = false; //启用评价送券
List<CouponSunModel> couponDataListComments = [];
... ... @@ -88,9 +90,14 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
? true
: false;
isCouponFree =
marketingCenterProvider.markDataModel.marketing.isCouponFree == '1'
? true
: false;
isCouponPay =
marketingCenterProvider.markDataModel.marketing.isCouponPay == '1'
? true
: false;
isRecharge =
marketingCenterProvider.markDataModel.marketing.isRecharge == '1'
... ... @@ -99,8 +106,12 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
rechargeData =
marketingCenterProvider.markDataModel.marketing.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
couponDataListFree =
marketingCenterProvider.markDataModel.marketing.couponDataListFree ??
[];
couponDataListPay =
marketingCenterProvider.markDataModel.marketing.couponDataListPay ??
[];
couponDataListComments = marketingCenterProvider
.markDataModel.marketing.couponDataListComments ??
[];
... ... @@ -132,9 +143,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
if (indexSelect < 0 || indexSelect > 4) {
indexSelect = 0;
}
setState(() {
});
setState(() {});
}
}
... ... @@ -148,13 +157,15 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
'is_arrival': isArrival ? '1' : '0', //确认到店
'is_online_book': isOnlineBook ? '1' : '0', //在线预订
'is_order': isOrder ? '1' : '0', //去点餐
'is_coupon': isCoupon ? '1' : '0', //代金券暂时
'is_coupon_free': isCouponFree ? '1' : '0', //代金券暂时
'is_coupon_pay': isCouponPay ? '1' : '0', //代金券暂时
'is_recharge': isRecharge ? '1' : '0', //充值券暂时
'is_link': isLink ? '1' : '0',
'wecomle': welcome ?? '',
'logo': qiniuUrl,
'recharge_data': rechargeData,
'coupon_data': json.encode(couponDataList),
'coupon_data_free': json.encode(couponDataListFree),
'coupon_data_pay': json.encode(couponDataListPay),
'is_comments': isComments ? '1' : '0',
'is_comments_coupon': isCommentsCoupon ? '1' : '0',
'coupon_data_comments': json.encode(couponDataListComments),
... ... @@ -169,7 +180,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
if (success) {
Utils.showToast('保存成功');
if (Navigator.canPop(context)) {
Navigator.pop(context);
Navigator.pop(context);
}
}
}
... ... @@ -219,7 +230,7 @@ class _OrderSettingPageState extends State<OrderSettingPage> {
await marketingCenterProvider.setConfing(
context,
{
'sid': Provider.of<UserModel>(context,listen: false).user.sellerid,
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'key': 'is_allow_update',
'value': '${indexSelect + 1}'
},
... ...
... ... @@ -38,7 +38,8 @@ class _RechargeSettingPageState extends State<RechargeSettingPage> {
bool isOnlineBook = false; //在线预订
bool isOrder = false; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
bool isCouponFree = false; // 代金券
bool isCouponPay = false; // 代金券
bool isRecharge = false; //充值券
String welcome = '';
... ... @@ -47,7 +48,8 @@ class _RechargeSettingPageState extends State<RechargeSettingPage> {
RechargeListSunModel rechargeData;
String rechargeContent = '';
List<CouponSunModel> couponDataList = [];
List<CouponSunModel> couponDataListFree = [];
List<CouponSunModel> couponDataListPay = [];
List<RechargeListSunModel> rechargeListCanUse = [];
bool isComments = false; //启用评价设置
bool isCommentsCoupon = false; //启用评价送券
... ... @@ -83,20 +85,28 @@ class _RechargeSettingPageState extends State<RechargeSettingPage> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
? true
: false;
isCouponFree =
marketingCenterProvider.markDataModel.marketing.isCouponFree == '1'
? true
: false;
isCouponPay =
marketingCenterProvider.markDataModel.marketing.isCouponPay == '1'
? true
: false;
isRecharge =
marketingCenterProvider.markDataModel.marketing.isRecharge == '1'
? true
: false;
rechargeData =
marketingCenterProvider.markDataModel.marketing.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
couponDataListFree =
marketingCenterProvider.markDataModel.marketing.couponDataListFree ??
[];
couponDataListPay =
marketingCenterProvider.markDataModel.marketing.couponDataListPay ??
[];
couponDataListComments = marketingCenterProvider
.markDataModel.marketing.couponDataListComments ??
[];
... ... @@ -129,13 +139,15 @@ class _RechargeSettingPageState extends State<RechargeSettingPage> {
'is_arrival': isArrival ? '1' : '0', //确认到店
'is_online_book': isOnlineBook ? '1' : '0', //在线预订
'is_order': isOrder ? '1' : '0', //去点餐
'is_coupon': isCoupon ? '1' : '0', //代金券暂时
'is_coupon_free': isCouponFree ? '1' : '0', //代金券暂时
'is_coupon_pay': isCouponPay ? '1' : '0', //代金券暂时
'is_recharge': isRecharge ? '1' : '0', //充值券暂时
'is_link': isLink ? '1' : '0',
'wecomle': welcome ?? '',
'logo': qiniuUrl,
'recharge_data': rechargeData,
'coupon_data': json.encode(couponDataList),
'coupon_data_pay': json.encode(couponDataListPay),
'coupon_data_free': json.encode(couponDataListFree),
'is_comments': isComments ? '1' : '0',
'is_comments_coupon': isCommentsCoupon ? '1' : '0',
'coupon_data_comments': json.encode(couponDataListComments),
... ... @@ -150,9 +162,9 @@ class _RechargeSettingPageState extends State<RechargeSettingPage> {
if (success) {
bus.emit('refresh_recharge_home');
Utils.showToast('保存成功');
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
}
... ...
... ... @@ -52,7 +52,7 @@ class _MarkingInteractionPageSimState extends State<MarkingInteractionPageSim> {
bool isOnlineBook = false; //在线预订
bool isOrder = false; //提前点餐
bool isLink = false; //充值优惠活动链接
bool isCoupon = false; // 代金券
// bool isCoupon = false; // 代金券
bool isRecharge = false; //充值券
RechargeListSunModel rechargeData;
... ... @@ -153,9 +153,9 @@ class _MarkingInteractionPageSimState extends State<MarkingInteractionPageSim> {
? true
: false;
isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
? true
: false;
// isCoupon = marketingCenterProvider.markDataModel.marketing.isCoupon == '1'
// ? true
// : false;
isRecharge =
marketingCenterProvider.markDataModel.marketing.isRecharge == '1'
... ... @@ -164,8 +164,8 @@ class _MarkingInteractionPageSimState extends State<MarkingInteractionPageSim> {
rechargeData =
marketingCenterProvider.markDataModel.marketing.rechargeData;
couponDataList =
marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
// couponDataList =
// marketingCenterProvider.markDataModel.marketing.couponDataList ?? [];
couponDataListComments = marketingCenterProvider
.markDataModel.marketing.couponDataListComments ??
[];
... ...
... ... @@ -179,9 +179,9 @@ class CouponProvider with ChangeNotifier {
PageState state;
if (index == 0) {
state = pageState;
} else if (index == 1) {
} else if (index == 3) {
state = pageStateStore;
} else if (index == 2) {
} else if (index == 4) {
state = pageStateMine;
}
if (isShowLoading) {
... ... @@ -233,9 +233,9 @@ class CouponProvider with ChangeNotifier {
}
if (index == 0) {
pageState = state;
} else if (index == 1) {
} else if (index == 3) {
pageStateStore = state;
} else if (index == 2) {
} else if (index == 4) {
pageStateMine = state;
}
notifyListeners();
... ... @@ -435,15 +435,15 @@ class CouponProvider with ChangeNotifier {
}
couponListSelect = CouponModel.fromJson(baseResp.responseData).data;
List<CouponSunModel> temp = [];
for (int i = 0; i < couponListSelect.length; i++) {
if (couponListSelect[i].isType == '1' &&
couponListSelect[i].isExamine == '1') {
//店铺优惠券 && 可核销 && dang
temp.add(couponListSelect[i]);
}
}
couponListSelect = temp;
// List<CouponSunModel> temp = [];
// for (int i = 0; i < couponListSelect.length; i++) {
// if (couponListSelect[i].isType == '1' &&
// couponListSelect[i].isExamine == '1') {
// //店铺优惠券 && 可核销 && dang
// temp.add(couponListSelect[i]);
// }
// }
// couponListSelect = temp;
notifyListeners();
} else {
... ...
... ... @@ -1723,21 +1723,21 @@ class NavigatorUtil {
///预订安排通知定制------优惠券选择
static Future<dynamic> goMarkingCouponSelectPage(
BuildContext context, Map object,
BuildContext context,String type, Map object,
{replace = false, bool mulSelect = true}) {
return _navigateTo(context,
"${Routes.marking_coupon_select_page}?object=${FluroConvertUtils.object2string(object)}&mulSelect=${mulSelect}",
"${Routes.marking_coupon_select_page}?object=${FluroConvertUtils.object2string(object)}&type=$type&mulSelect=${mulSelect}",
replace: replace);
}
///预订安排通知定制------预订安排预览页
static Future<dynamic> goMarkingPreviewPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.marking_preview_page}",
replace: replace);
}
// ///预订安排通知定制------预订安排预览页
// static Future<dynamic> goMarkingPreviewPage(
// BuildContext context, {
// replace = false,
// }) {
// return _navigateTo(context, "${Routes.marking_preview_page}",
// replace: replace);
// }
///我的------存酒管理首页
static Future<dynamic> goStoreWineManageHomePage(
... ...
... ... @@ -3092,7 +3092,7 @@ var markingInteractionPageSimHandle = new Handler(
//我的----营销中心-优惠券选择
var markingCouponSelectPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String idstr = params["idstr"].first;dfdf
String type = params["type"].first;
List<CouponSunModel> res = [];
if (params.keys.contains('object')) {
Map object = FluroConvertUtils.string2map(params["object"].first);
... ... @@ -3108,18 +3108,18 @@ var markingCouponSelectPageHandle = new Handler(
// .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
return ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(),
child: MarkingCouponSelectPage(couponList: res, mulSelect: mulSelect));
child: MarkingCouponSelectPage(type:type,couponList: res, mulSelect: mulSelect));
});
//我的----营销中心-预订安排预览页
var markingPreviewPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String idstr = params["idstr"].first;
// NotebookDetail detailEntity = NotebookDetail.fromJson(json
// .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
return ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(), child: MarkingPreviewPage());
});
// var markingPreviewPageHandle = new Handler(
// handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// // String idstr = params["idstr"].first;
// // NotebookDetail detailEntity = NotebookDetail.fromJson(json
// // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
// return ChangeNotifierProvider<MarketingCenterProvider>(
// create: (_) => MarketingCenterProvider(), child: MarkingPreviewPage());
// });
///我的----存酒管理
var storeWineManageHomePageHandle = new Handler(
... ...
... ... @@ -19,7 +19,6 @@ class Routes {
static String select_table = "/select_table"; //选择桌位
static String select_table_f = "/select_table_f"; //选择桌位_方硕新修改的页面
static String invication = "/invication"; //邀请函
static String invication_sim = "/invication_sim"; //邀请函
... ... @@ -63,7 +62,7 @@ class Routes {
static String store_type_fill_manage_page =
"/store_type_fill_manage_page"; //包间置满管理
static String store_type_fill_manage_page_sim =
static String store_type_fill_manage_page_sim =
"/store_type_fill_manage_page_sim"; //包间置满管理
static String sms_manager_page = "/sms_manager_page"; //短信充值
static String sms_recharge_page = "/sms_recharge_page"; //短信充值
... ... @@ -90,9 +89,7 @@ class Routes {
"/personnel_password_edit_page"; //密码修改页
static String change_detail_f = "/change_detail_f"; //变更预订_方硕新修改页面
static String change_detail_f_only = "/change_detail_f_only"; //变更预订_方硕新修改页面
static String change_detail_f_only = "/change_detail_f_only"; //变更预订_方硕新修改页面
static String photo_manager_page = "/photo_manager_page"; //照片管理
static String edit_reserver_page = "/edit_reserver_page"; //填写预订联系人
static String store_customer_page = "/store_customer_page"; //全店客情
... ... @@ -220,7 +217,7 @@ class Routes {
*/
static String order_advance_home_page = "/order_advance_home_page"; //经理预点菜首页
// static String order_advance_home_page_sim = "/order_advance_home_page_sim"; //经理预点菜首页
static String order_advance_edit_page = "/order_advance_edit_page"; //经理预点菜编辑
static String order_preview_page = "/order_preview_page"; //预览页
static String order_edit_list_show_page =
... ... @@ -259,8 +256,8 @@ class Routes {
static String marking_coupon_select_page =
"/marking_coupon_select_page"; //预订安排通知定制------优惠券选择
static String marking_preview_page =
"/marking_preview_page"; //预订安排通知定制------预览页
// static String marking_preview_page =
// "/marking_preview_page"; //预订安排通知定制------预览页
/** 存酒管理
*/
... ... @@ -391,35 +388,20 @@ class Routes {
static String mini_program_setting_page =
"/mini_program_setting_page"; //小程序封面样式设置
static String wine_setting_msg_page =
"/wine_setting_msg_page"; //存酒短信模版设置
static String wine_setting_msg_page = "/wine_setting_msg_page"; //存酒短信模版设置
static String book_time_setting_list_page =
static String book_time_setting_list_page =
"/book_time_setting_list_page"; //多时段预订列表
static String book_time_setting_edit_page =
static String book_time_setting_edit_page =
"/book_time_setting_edit_page"; //多时段预订列表编辑页面
static String park_info_page =
"/park_info_page"; //停车指引介绍
static String park_info_page = "/park_info_page"; //停车指引介绍
static String birthday_setting_page =
"/birthday_setting_page"; //客户生日提醒及营销
static String birthday_setting_page = "/birthday_setting_page"; //客户生日提醒及营销
static String birthday_sms_module_setting_page =
static String birthday_sms_module_setting_page =
"/birthday_sms_module_setting_page"; //客户生日提前通知短信设置
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
... ... @@ -436,7 +418,8 @@ class Routes {
router.define(reserve_detail_sim, handler: reserveDetailSimHandler);
router.define(select_table, handler: handleSelectTableHandler);
router.define(select_table_f, handler: handleSelectTableFHandler);
router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHandler);
router.define(select_table_f_or_reserve,
handler: handleSelectTableFOrReserveHandler);
router.define(invication, handler: handleInvicationHandler);
router.define(invication_sim, handler: handleInvicationSimHandler);
... ... @@ -489,8 +472,6 @@ router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHan
router.define(store_type_fill_manage_page_sim,
handler: storeTypeFillManagePageSimHandler);
router.define(sms_manager_page, handler: smsManagerPageHandler);
router.define(sms_recharge_page, handler: smsRechargePageHandler);
router.define(store_base_info_page, handler: storeBaseInfoPageHandler);
... ... @@ -517,8 +498,8 @@ router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHan
router.define(personnel_password_edit_page,
handler: personnelPasswordEditPageHandle);
router.define(change_detail_f, handler: noteBookChangeFPageHandle);
router.define(change_detail_f_only, handler: noteBookChangeFPageOnlyHandle);
router.define(change_detail_f_only, handler: noteBookChangeFPageOnlyHandle);
router.define(photo_manager_page, handler: photoManagerPageHandle);
router.define(edit_reserver_page, handler: editReserverPageHandle);
router.define(store_customer_page, handler: storeCustomerPageHandle);
... ... @@ -632,7 +613,6 @@ router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHan
router.define(final_plan_dish_page, handler: finalPlanDishPageHandle);
router.define(order_advance_home_page, handler: orderAdvanceHomePageHandle);
// router.define(order_advance_home_page_sim, handler: orderAdvanceHomePageSimHandle);
router.define(order_advance_edit_page, handler: orderAdvanceEidtPageHandle);
router.define(order_preview_page, handler: orderPreviewPageHandle);
... ... @@ -668,7 +648,7 @@ router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHan
handler: markingInteractionPageSimHandle);
router.define(marking_coupon_select_page,
handler: markingCouponSelectPageHandle);
router.define(marking_preview_page, handler: markingPreviewPageHandle);
// router.define(marking_preview_page, handler: markingPreviewPageHandle);
router.define(store_wine_manag_home_page,
handler: storeWineManageHomePageHandle);
... ... @@ -762,30 +742,21 @@ router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHan
handler: invicationAdditionPageHandle);
router.define(payment_setting_page, handler: paymentSettingPageHandle);
router.define(mini_program_setting_page, handler: miniprogramSettingPageHandle);
router.define(wine_setting_msg_page, handler:wineSettingMsgPageHandle);
router.define(book_time_setting_list_page, handler:bookTimeSettingListPageHandle);
router.define(book_time_setting_edit_page, handler:bookTimeSettingEditPageHandle);
router.define(park_info_page, handler:parkInfoPageHandle);
router.define(birthday_setting_page, handler:birthdaySettingPageHandle);
router.define(birthday_sms_module_setting_page, handler:birthdaySmsModuleSettingPageHandle);
router.define(mini_program_setting_page,
handler: miniprogramSettingPageHandle);
router.define(wine_setting_msg_page, handler: wineSettingMsgPageHandle);
router.define(book_time_setting_list_page,
handler: bookTimeSettingListPageHandle);
router.define(book_time_setting_edit_page,
handler: bookTimeSettingEditPageHandle);
router.define(park_info_page, handler: parkInfoPageHandle);
router.define(birthday_setting_page, handler: birthdaySettingPageHandle);
router.define(birthday_sms_module_setting_page,
handler: birthdaySmsModuleSettingPageHandle);
}
}
... ...