Commit b459dd18f86dfa831a4caca27d02efee27098998

Authored by wdn127929
1 parent 2f3cb0a4

优惠券生成海报部分UI

... ... @@ -330,32 +330,32 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
onTap: () {
Navigator.pop(context);
},
rightImgName: couponProvider != null &&
couponProvider.couponSunModel != null &&
// couponProvider.couponSunModel.isType == '1' &&
// couponProvider.couponSunModel.isExamine == '1' &&
couponProvider.couponSunModel.status == '1'
? 'share.png'
: null,
onTapRight: () {
// if (couponProvider.couponSunModel.isType == '1' &&
// couponProvider.couponSunModel.isExamine == '1' &&
// couponProvider.couponSunModel.status == '1') {
if (couponProvider.couponSunModel.isType == '1' &&
couponProvider.couponSunModel.status == '1') {
//店铺券
Utils.goShareBuyCouponToWeChat(
context,
widget.idstr,
couponProvider.couponSunModel.use,
couponProvider.couponSunModel);
} else if (couponProvider.couponSunModel.isType == '2' &&
couponProvider.couponSunModel.status == '1') {
// 我的优惠券
Utils.goShareBuyCouponToWeChatMy(context, widget.idstr,
managerName, couponProvider.couponSunModel);
}
},
// rightImgName: couponProvider != null &&
// couponProvider.couponSunModel != null &&
// // couponProvider.couponSunModel.isType == '1' &&
// // couponProvider.couponSunModel.isExamine == '1' &&
// couponProvider.couponSunModel.status == '1'
// ? 'share.png'
// : null,
// onTapRight: () {
// // if (couponProvider.couponSunModel.isType == '1' &&
// // couponProvider.couponSunModel.isExamine == '1' &&
// // couponProvider.couponSunModel.status == '1') {
// if (couponProvider.couponSunModel.isType == '1' &&
// couponProvider.couponSunModel.status == '1') {
// //店铺券
// Utils.goShareBuyCouponToWeChat(
// context,
// widget.idstr,
// couponProvider.couponSunModel.use,
// couponProvider.couponSunModel);
// } else if (couponProvider.couponSunModel.isType == '2' &&
// couponProvider.couponSunModel.status == '1') {
// // 我的优惠券
// Utils.goShareBuyCouponToWeChatMy(context, widget.idstr,
// managerName, couponProvider.couponSunModel);
// }
// },
),
body: Consumer<CouponProvider>(builder: (context, model, _) {
if (pageState != PageState.Success) {
... ... @@ -640,7 +640,86 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
: false)
],
))),
)
),
Container(
height: ScreenUtil().setWidth(91 * 2),
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(16 * 2),
bottom: ScreenUtil().setWidth(35 * 2),
left: ScreenUtil().setWidth(23 * 2),
right: ScreenUtil().setWidth(23 * 2),
),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.1),
offset: Offset(0, ScreenUtil().setWidth(-2)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(16)),
topRight: Radius.circular(ScreenUtil().setWidth(16))),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
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 {
NavigatorUtil.goCouponPosterPage(
context,
widget.idstr,
couponProvider.couponSunModel.use,
couponProvider.couponSunModel);
},
),
HEmptyView(30),
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 == '1' &&
couponProvider.couponSunModel.status == '1') {
//店铺券
Utils.goShareBuyCouponToWeChat(
context,
widget.idstr,
couponProvider.couponSunModel.use,
couponProvider.couponSunModel);
} else if (couponProvider.couponSunModel.isType ==
'2' &&
couponProvider.couponSunModel.status == '1') {
// 我的优惠券
Utils.goShareBuyCouponToWeChatMy(
context,
widget.idstr,
managerName,
couponProvider.couponSunModel);
}
},
),
)
],
))
]);
}
}));
... ...
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../models/coupon_model.dart';
import '../../models/user.dart';
import '../../provider/base_info_provider.dart';
import '../../res/colors.dart';
import '../../utils/screen_util.dart';
import '../../widgets/h_empty_view.dart';
import '../../widgets/round_button.dart';
/**
* 优惠券分享海报
*/
class CouponPosterPage extends StatefulWidget {
final String id; //优惠券ID
final CouponUse use;
final CouponSunModel couponSunModel;
CouponPosterPage({Key key, this.id, this.use, this.couponSunModel})
: super(key: key);
@override
_CouponPosterPageState createState() => _CouponPosterPageState();
}
class _CouponPosterPageState extends State<CouponPosterPage> {
String managerName = '';
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
// if (widget.idstr != null && widget.idstr != 'null') {
_getCustomerActivityBaseinfo();
});
}
_getCustomerActivityBaseinfo() async {
BaseIndoProvider _baseIndoProvider =
Provider.of<BaseIndoProvider>(context, listen: false);
Map<String, String> params = {
'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
};
bool success =
await _baseIndoProvider.getCustomerActivityBaseinfo(context, params);
if (success) {
managerName = _baseIndoProvider.baseInfoSunModel.name;
}
}
@override
Widget build(BuildContext context) {
User user = Provider.of<UserModel>(context, listen: false).user;
String times = '营业时间:';
if (user.morning != "") {
times += user.morning;
}
if (user.noon != "") {
times += ' ${user.noon}';
}
if (user.night != "") {
times += ' ${user.night}';
}
String phone = user.sellerphone.replaceAll(',', ' ');
String address = '地址:' + user.sellerAddr;
String title = "${user.sellername}向您推荐一张优惠券";
String name = '';
if (widget.couponSunModel.isType == '1') {
//店铺优惠券
String price = widget.couponSunModel.price;
if (widget.use != null) {
if (widget.use.isCash) {
if (price == '0') {
title = '免费获取';
} else {
title = '仅需${price}元,获取';
}
name = '${user.sellername}${widget.use.cash}元代金券';
} else if (widget.use.isDiscount) {
if (price == '0') {
title = '免费获取';
} else {
title = '仅需${price}元,获取';
}
name = '${user.sellername}${widget.use.discount}折折扣券';
} else if (widget.use.isDish) {
if (price == '0') {
title = '免费获取';
} else {
title = '仅需${price}元,获取';
}
name = '${user.sellername}${widget.couponSunModel.aname}';
}
}
} else {
// title = "${managerName}给您赠送${widget.couponSunModel.aname}";
// title = "${widget.couponSunModel.aname}";
name = "${widget.couponSunModel.aname}";
}
return Scaffold(
appBar: SystemAppBar('优惠券详情'),
backgroundColor: MyColours.color_ffffff,
body: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Stack(
clipBehavior: Clip.none,
children: [
CachedNetworkImage(
imageUrl: user.sellerimage,
width: double.infinity,
height: w(280),
fit: BoxFit.cover,
),
Positioned(
bottom: -w(64),
child: Container(
// width: double.infinity,
// height: w(128),
padding: EdgeInsets.symmetric(
horizontal: w(10), vertical: w(18)),
margin: EdgeInsets.symmetric(horizontal: w(20)),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(r(8))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
user.sellername,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_E4461D,
fontSize: font(16),
fontWeight: FontWeight.bold),
),
VEmptyView(30),
Text(
times,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
),
),
VEmptyView(10),
RichText(
text: TextSpan(
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
),
children: [
TextSpan(
text: '电话:',
style: TextStyle(
fontSize: font(14),
color: MyColours.color_515151)),
TextSpan(
text: phone,
style: TextStyle(
overflow: TextOverflow.ellipsis,
fontSize: font(14),
color: MyColours.color_E4461D)),
])),
VEmptyView(10),
Row(
children: [
Text(
address,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14),
),
),
Image.asset(
Utils.getImgPath('location_orange'),
width: w(25),
)
],
),
],
),
))
],
),
VEmptyView(170),
Text(
title,
style: TextStyle(
fontSize: font(32), color: MyColours.color_000000),
),
VEmptyView(30),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(20)),
child: Row(
children: [
Image.asset(
Utils.getImgPath('coupon_l'),
height: w(100),
),
HEmptyView(1),
Expanded(
child: Container(
alignment: Alignment.center,
constraints: BoxConstraints(minHeight: w(120)),
decoration: BoxDecoration(color: Colors.red),
child: Text(name,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: font(32),
color: MyColours.color_ffffff)),
)),
HEmptyView(1),
Image.asset(
Utils.getImgPath('coupon_r'),
// width: w(20),
height: w(100),
),
],
)),
VEmptyView(30),
// CachedNetworkImage(imageUrl: imageUrl)
],
)),
),
Container(
height: ScreenUtil().setWidth(91 * 2),
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(16 * 2),
bottom: ScreenUtil().setWidth(35 * 2),
left: ScreenUtil().setWidth(23 * 2),
right: ScreenUtil().setWidth(23 * 2),
),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.1),
offset: Offset(0, ScreenUtil().setWidth(-2)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(16)),
topRight: Radius.circular(ScreenUtil().setWidth(16))),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
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: () {},
),
HEmptyView(30),
Expanded(
child: RoundButton(
text: '分享给客户',
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: false,
fontSize: 28,
onPressed: () {},
),
)
],
))
],
));
}
}
... ...
import 'package:flutter/material.dart';
class MyColours {
static const Color color_F8F7F3 = Color(0xFFF8F7F3);
static const Color color_E4461D = Color(0xFFE4461D);
static const Color color_F8F7F3 = Color(0xFFF8F7F3);
static const Color color_33438E93 = Color(0x33438E93);
static const Color color_E89243 = Color(0xFFE89243);
static const Color color_3E6F51 = Color(0xFF3E6F51);
... ...
... ... @@ -1895,10 +1895,25 @@ class NavigatorUtil {
///预订通知短信模板选择
static Future<dynamic> goSmsTemplateSettingPage(
BuildContext context, String smsTemplate,{
BuildContext context,
String smsTemplate, {
replace = false,
}) {
return _navigateTo(context,
"${Routes.sms_template_setting_page}?smsTemplate=${Uri.encodeComponent(smsTemplate)}",
replace: replace);
}
///优惠券海报
static Future<dynamic> goCouponPosterPage(
BuildContext context,
String id,
CouponUse use,
CouponSunModel couponSunModel, {
replace = false,
}) {
return _navigateTo(context, "${Routes.sms_template_setting_page}?smsTemplate=${Uri.encodeComponent(smsTemplate)}",
return _navigateTo(context,
"${Routes.coupon_poster_page}?id=$id&use=${FluroConvertUtils.object2string(use)}&couponSunModel=${FluroConvertUtils.object2string(couponSunModel)}",
replace: replace);
}
}
... ...
... ... @@ -167,6 +167,7 @@ import '../models/set_xuan_tai_model.dart';
import '../models/setmeal_by_id_model.dart';
import '../models/setmeal_model.dart';
import '../models/wine_manage_model.dart';
import '../pages/coupon/coupon_poster_pgae.dart';
import '../pages/coupon/coupon_setting_page.dart';
import '../pages/coupon/coupon_verification_detail_page.dart';
import '../pages/coupon/verification_coupon_page.dart';
... ... @@ -3234,5 +3235,21 @@ var smsTemplateSettingPageHandle = new Handler(
String smsTemplate = params["smsTemplate"].first;
return ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(),
child: SmsTemplateSettingPage(smsTemplate:smsTemplate));
child: SmsTemplateSettingPage(smsTemplate: smsTemplate));
});
//优惠券海报
var couponPosterPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String id = params["id"].first;
// String smsTemplate = params["smsTemplate"].first;
CouponUse use = CouponUse.fromJson(
json.decode(FluroConvertUtils.fluroCnParamsDecode(params["use"].first)));
CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
return ChangeNotifierProvider<BaseIndoProvider>(
create: (_) => BaseIndoProvider(),
child:
CouponPosterPage(id: id, use: use, couponSunModel: couponSunModel));
});
... ...
... ... @@ -309,6 +309,10 @@ class Routes {
static String sms_template_setting_page = "/sms_template_setting_page"; //短信模版设置
static String coupon_poster_page = "/coupon_poster_page"; //优惠券海报
... ... @@ -582,6 +586,11 @@ router.define(export_book_data_page, handler: exportBookDataPageHandle);
router.define(sms_template_setting_page, handler: smsTemplateSettingPageHandle);
router.define(coupon_poster_page, handler: couponPosterPageHandle);
}
... ...