Commit c86d23a6999f91d37704b2928e30add398253717

Authored by wdn127929
1 parent f338a308

个人优惠券分享

... ... @@ -18,6 +18,7 @@ import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../provider/base_info_provider.dart';
import '../../utils/screen_util.dart';
import '../../widgets/page_exception.dart';
... ... @@ -40,6 +41,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
final heightCell = ScreenUtil().setWidth(80);
CouponProvider couponProvider;
PageState pageState = PageState.Loading;
String managerName = '';
@override
void initState() {
... ... @@ -48,6 +50,7 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
WidgetsBinding.instance.addPostFrameCallback((_) {
// if (widget.idstr != null && widget.idstr != 'null') {
_getActivityById();
_getCustomerActivityBaseinfo();
// } else {
// couponProvider.couponSunModel = widget.couponSunModel;
// pageState = PageState.Success;
... ... @@ -56,6 +59,21 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
});
}
_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;
}
}
_getActivityById() async {
pageState = PageState.Loading;
bool success = await couponProvider
... ... @@ -216,21 +234,28 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
},
rightImgName: couponProvider != null &&
couponProvider.couponSunModel != null &&
couponProvider.couponSunModel.isType == '1' &&
couponProvider.couponSunModel.isExamine == '1' &&
// 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.isExamine == '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);
}
},
),
... ... @@ -442,7 +467,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
_item(
'发放总量限制',
couponProvider
.couponSunModel.grantNum??''),
.couponSunModel.grantNum ??
''),
// _select(
// '谁可以发放',
// '查看',
... ...
... ... @@ -644,7 +644,9 @@ var handleCouponDetailPageHandler = new Handler(
FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
}
return CouponDetailPage(couponSunModel: couponSunModel, idstr: idStr);
return ChangeNotifierProvider<BaseIndoProvider>(
create: (_) => BaseIndoProvider(),
child: CouponDetailPage(couponSunModel: couponSunModel, idstr: idStr));
});
///个人资料页面
... ...
... ... @@ -1731,6 +1731,60 @@ class Utils {
}
//跳转到优惠券购买页面
static goShareBuyCouponToWeChatMy(BuildContext context, String couponid,
String managerName, CouponSunModel couponSunModel) async {
String _webPageUrl = "http://colorcun.com/";
// String _thumbnail =
// "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1";
// String _thumbnail =
// "https://qn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148572.jpg";
// String sellerImage =
// Provider.of<UserModel>(context, listen: false).user.sellerimage;
String _thumbnail = 'https://nosqn.colorcun.com/share_money.png';
String _title = "${managerName}给您赠送${couponSunModel.aname},点击查看详情";
String _userName = "gh_487873d353b3";
String _path =
"pack-activity/pack/buyCoupon?id=$couponid&name=${Provider.of<UserModel>(context, listen: false).user.sellername}&sid=${Provider.of<UserModel>(context, listen: false).user.sellerid}&types=2";
// if (Provider.of<UserModel>(context, listen: false).user.sellerid == '677') {
// //京厨九跳转新的邀请函地址
// _path =
// "pages/customer/index?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
// }
String _description = "进入查看包间详情,转发同行好友,还可一键导航到饭店";
// Uint8List source = await testComporessList(context, _thumbnail);
//跳转小程序
var model = new WeChatShareMiniProgramModel(
webPageUrl: _webPageUrl,
userName: _userName,
title: _title,
path: _path,
// description: 'hhh',
// miniProgramType: , //体验版
miniProgramType: Constant.wxMiniProgramType, //正式版
// miniProgramType: //开发版
// thumbnail: WeChatImage.binary(source)
thumbnail: WeChatImage.network(_thumbnail),
// hdImagePath: WeChatImage.network(_thumbnail), thumbnail: null,
// thumbnail: WeChatImage.binary(image)
);
//分享链接
// var model = WeChatShareWebPageModel(
// // 'https://xt04.colorcun.com/h5/index.html#/?id=$rid&hasInvitation=1',
// 'https://xt04.colorcun.com/h5/index.html?id=$rid&hasInvitation=1&hasSellerShare=1',
// title: _title,
// description: _description,
// thumbnail: WeChatImage.network(_thumbnail),
// scene: WeChatScene.SESSION,
// );
bool isSuccess = await shareToWeChat(model);
return isSuccess;
}
//跳转到优惠券购买页面
static goShareBuyCouponToWeChat(BuildContext context, String couponid,
CouponUse use, CouponSunModel couponSunModel) async {
String _webPageUrl = "http://colorcun.com/";
... ...