|
...
|
...
|
@@ -20,6 +20,7 @@ import '../../../../provider/upload_img_provider.dart'; |
|
|
|
import '../../../../provider/user_model.dart';
|
|
|
|
import '../../../../res/colors.dart';
|
|
|
|
import '../../../../route/navigator_util.dart';
|
|
|
|
import '../../../../utils/event_bus.dart';
|
|
|
|
import '../../../../utils/screen_util.dart';
|
|
|
|
import '../../../../utils/upload_image_util.dart';
|
|
|
|
import '../../../../widgets/MyDivider.dart';
|
|
...
|
...
|
@@ -56,7 +57,9 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
RechargeListSunModel rechargeData;
|
|
|
|
String rechargeContent = '';
|
|
|
|
|
|
|
|
CouponSunModel couponData;
|
|
|
|
List<CouponSunModel> couponDataList = [];
|
|
|
|
List<RechargeListSunModel> rechargeListCanUse = [];
|
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -65,12 +68,21 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
_couponNetworkData();
|
|
|
|
_getNewRechargeList();
|
|
|
|
getSellerTemplateConf();
|
|
|
|
bus.on('refresh_marketting_page', (arg) {
|
|
|
|
_couponNetworkData();
|
|
|
|
});
|
|
|
|
bus.on('refresh_marketting_page_recharge', (arg) {
|
|
|
|
_getNewRechargeList();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
_uploadImageProvider.firstImage = UploadImgModel();
|
|
|
|
bus.off('refresh_marketting_page');
|
|
|
|
bus.off('refresh_marketting_page_recharge');
|
|
|
|
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -81,7 +93,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
// 'uid': userModel.user.openid
|
|
|
|
};
|
|
|
|
await marketingCenterProvider.getNewRechargeList(context, params);
|
|
|
|
List<RechargeListSunModel> rechargeListCanUse = [];
|
|
|
|
rechargeListCanUse = [];
|
|
|
|
if (marketingCenterProvider.rechargeList.length > 0) {
|
|
|
|
marketingCenterProvider.rechargeList.forEach((element) {
|
|
|
|
if (element.isOpen == '1') {
|
|
...
|
...
|
@@ -148,7 +160,8 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
|
|
|
|
rechargeData =
|
|
|
|
marketingCenterProvider.markDataModel.marketing.rechargeData;
|
|
|
|
couponData = marketingCenterProvider.markDataModel.marketing.couponData;
|
|
|
|
couponDataList =
|
|
|
|
marketingCenterProvider.markDataModel.marketing.couponDataList;
|
|
|
|
|
|
|
|
_uploadImageProvider.firstImage.qiniuUrl =
|
|
|
|
marketingCenterProvider.markDataModel.marketing.logo ?? null;
|
|
...
|
...
|
@@ -175,10 +188,10 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
|
|
|
|
await couponProvider.getCustomerSelectActivityMarking(context, params,
|
|
|
|
isShowLoading: isShowLoading);
|
|
|
|
if (couponData == null) {
|
|
|
|
if (couponDataList == null || couponDataList.length == 0) {
|
|
|
|
if (couponProvider.couponListSelect != null &&
|
|
|
|
couponProvider.couponListSelect.length > 0) {
|
|
|
|
couponData = couponProvider.couponListSelect[0];
|
|
|
|
couponDataList.add(couponProvider.couponListSelect[0]);
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
...
|
...
|
@@ -393,13 +406,164 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///优惠券
|
|
|
|
Widget _markingCupon({
|
|
|
|
VoidCallback onPressed,
|
|
|
|
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;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///优惠券
|
|
|
|
Widget _markingCuponItem(
|
|
|
|
String title,
|
|
|
|
String content,
|
|
|
|
String subtile,
|
|
|
|
String discount,
|
|
|
|
String btnTitle, {
|
|
|
|
VoidCallback onPressed,
|
|
|
|
bool select = false,
|
|
|
|
VoidCallback onPressedSelect,
|
|
|
|
}) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)),
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.all(w(12)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadiusDirectional.circular(r(8)),
|
|
|
|
border: Border.all(width: w(1), color: MyColours.color_DBDBDB)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
constraints: BoxConstraints(maxWidth: w(150)),
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(14),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: MyColours.color_515151),
|
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
subtile != ''
|
|
|
|
? Text(
|
|
|
|
'¥${subtile}',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(7),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: MyColours.color_E34D59),
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
HEmptyView(10),
|
|
|
|
discount != ''
|
|
|
|
? Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(3), vertical: w(2)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(r(3)),
|
|
|
|
border: Border.all(
|
|
|
|
width: w(0.5),
|
|
|
|
color: MyColours.color_E34D59)),
|
|
|
|
child: Text(
|
|
|
|
discount,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_E34D59,
|
|
|
|
fontSize: font(7)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
if (content != '') VEmptyView(20),
|
|
|
|
if (content != '')
|
|
|
|
Text(
|
|
|
|
content,
|
|
|
|
style: TextStyle(
|
|
|
|
height: 1.2,
|
|
|
|
fontSize: font(10),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: MyColours.color_515151),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///营销推广
|
|
|
|
Widget _markingItem(
|
|
|
|
String selectTitle,
|
|
|
|
String title,
|
|
|
|
String content,
|
|
|
|
String subtile,
|
|
|
|
String discount, {
|
|
|
|
String discount,
|
|
|
|
String btnTitle, {
|
|
|
|
VoidCallback onPressed,
|
|
|
|
bool select = false,
|
|
|
|
VoidCallback onPressedSelect,
|
|
...
|
...
|
@@ -490,8 +654,9 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
RoundButton(
|
|
|
|
text: '切换活动',
|
|
|
|
text: btnTitle,
|
|
|
|
width: w(72),
|
|
|
|
height: w(22),
|
|
|
|
gradientStart: MyColours.color_ffffff,
|
|
...
|
...
|
@@ -767,14 +932,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
]));
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
couponProvider = Provider.of<CouponProvider>(context, listen: true);
|
|
|
|
_uploadImageProvider =
|
|
|
|
Provider.of<UploadImageProvider>(context, listen: true);
|
|
|
|
marketingCenterProvider =
|
|
|
|
Provider.of<MarketingCenterProvider>(context, listen: true);
|
|
|
|
|
|
|
|
String _getCouponsDesc(couponData) {
|
|
|
|
String couponsDesc = '';
|
|
|
|
if (couponData != null) {
|
|
|
|
if (couponData.expDate == null) {
|
|
...
|
...
|
@@ -790,6 +948,16 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return couponsDesc;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
couponProvider = Provider.of<CouponProvider>(context, listen: true);
|
|
|
|
_uploadImageProvider =
|
|
|
|
Provider.of<UploadImageProvider>(context, listen: true);
|
|
|
|
marketingCenterProvider =
|
|
|
|
Provider.of<MarketingCenterProvider>(context, listen: true);
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
...
|
...
|
@@ -803,6 +971,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
controller: controller,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
_headItem('客户互动及店铺推广'),
|
|
...
|
...
|
@@ -837,34 +1006,45 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
VEmptyView(24),
|
|
|
|
_headItem('预订安排中附带的营销推广'),
|
|
|
|
VEmptyView(24),
|
|
|
|
couponData != null
|
|
|
|
? _markingItem(
|
|
|
|
'推荐店内代金券优惠',
|
|
|
|
couponData.aname,
|
|
|
|
couponsDesc,
|
|
|
|
couponData.price ?? '',
|
|
|
|
couponData.use != null && couponData.use.isCash
|
|
|
|
? '${(double.parse(couponData.price) / double.parse(couponData.use.cash)) * 10}折'
|
|
|
|
: '',
|
|
|
|
select: isCoupon, onPressedSelect: () {
|
|
|
|
setState(() {
|
|
|
|
isCoupon = !isCoupon;
|
|
|
|
});
|
|
|
|
}, onPressed: () async {
|
|
|
|
//切换活动
|
|
|
|
Map temp =
|
|
|
|
await NavigatorUtil.goMarkingCouponSelectPage(
|
|
|
|
context, couponData.id);
|
|
|
|
if (temp['coupon'] != null) {
|
|
|
|
couponData = temp['coupon'];
|
|
|
|
couponProvider.couponListSelect != null &&
|
|
|
|
couponProvider.couponListSelect.length > 0
|
|
|
|
? _markingCupon(
|
|
|
|
select: isCoupon,
|
|
|
|
onPressedSelect: () {
|
|
|
|
setState(() {
|
|
|
|
isCoupon = !isCoupon;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onPressed: () async {
|
|
|
|
//切换活动
|
|
|
|
Map temp =
|
|
|
|
await NavigatorUtil.goMarkingCouponSelectPage(
|
|
|
|
context, {'object': couponDataList});
|
|
|
|
if (temp['coupon'] != null) {
|
|
|
|
couponDataList = temp['coupon'];
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
: SizedBox(),
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
: (couponProvider.couponListSelect == null ||
|
|
|
|
couponProvider.couponListSelect.length ==
|
|
|
|
0) &&
|
|
|
|
Utils.getAuthority(context, '创建新的优惠券')
|
|
|
|
? _markingItem(
|
|
|
|
'推荐店内代金券优惠',
|
|
|
|
'当前没有代金券',
|
|
|
|
'注:代金券附加在预订安排中,可以随着预订人给被请客客人发送邀请函自动传播,吸引顾客到店。',
|
|
|
|
'',
|
|
|
|
'',
|
|
|
|
'创建优惠',
|
|
|
|
select: false, onPressed: () {
|
|
|
|
//创建优惠
|
|
|
|
NavigatorUtil.goCouponPage(context);
|
|
|
|
})
|
|
|
|
: SizedBox(),
|
|
|
|
rechargeData != null
|
|
|
|
? _markingItem('推荐店内充值单一优惠活动', rechargeData.rname,
|
|
|
|
rechargeContent, '', '', select: isRecharge,
|
|
|
|
rechargeContent, '', '', '切换活动', select: isRecharge,
|
|
|
|
onPressedSelect: () {
|
|
|
|
setState(() {
|
|
|
|
isRecharge = !isRecharge;
|
|
...
|
...
|
@@ -880,7 +1060,21 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
: SizedBox(),
|
|
|
|
: (rechargeListCanUse == null ||
|
|
|
|
rechargeListCanUse.length == 0) &&
|
|
|
|
Utils.getAuthority(context, '新建优惠')
|
|
|
|
? _markingItem(
|
|
|
|
'推荐店内充值单一优惠活动',
|
|
|
|
'当前没有创建充值优惠活动',
|
|
|
|
'注:充值优惠活动附加在预订安排中,可以随着预订人给被请客客人发送邀请函自动传播。',
|
|
|
|
'',
|
|
|
|
'',
|
|
|
|
'创建优惠',
|
|
|
|
select: false, onPressed: () {
|
|
|
|
//创建新优惠
|
|
|
|
NavigatorUtil.goRechargeHomePage(context);
|
|
|
|
})
|
|
|
|
: SizedBox(),
|
|
|
|
_markingOtherItem()
|
|
|
|
],
|
|
|
|
),
|
|
...
|
...
|
@@ -928,7 +1122,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
|
|
|
'wecomle': welcomeTextC.text ?? '',
|
|
|
|
'logo': _uploadImageProvider.firstImage.qiniuUrl,
|
|
|
|
'recharge_data': rechargeData,
|
|
|
|
'coupon_data': couponData
|
|
|
|
'coupon_data': json.encode(couponDataList)
|
|
|
|
};
|
|
|
|
Map<String, String> params = {
|
|
|
|
'sid': Provider.of<UserModel>(context, listen: false)
|
...
|
...
|
|