Commit f16782e90ec083e367bd343e9869834882b5b1bd

Authored by wdn127929
1 parent 4d7541b0

更换微信、过期优惠券自己显示自己

@@ -699,7 +699,7 @@ @@ -699,7 +699,7 @@
699 CURRENT_PROJECT_VERSION = 5233; 699 CURRENT_PROJECT_VERSION = 5233;
700 DEVELOPMENT_TEAM = 8J59HM8B82; 700 DEVELOPMENT_TEAM = 8J59HM8B82;
701 ENABLE_BITCODE = NO; 701 ENABLE_BITCODE = NO;
702 - FLUTTER_BUILD_MODE = release; 702 + FLUTTER_BUILD_MODE = debug;
703 FRAMEWORK_SEARCH_PATHS = ( 703 FRAMEWORK_SEARCH_PATHS = (
704 "$(inherited)", 704 "$(inherited)",
705 "$(PROJECT_DIR)/Flutter", 705 "$(PROJECT_DIR)/Flutter",
@@ -665,7 +665,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -665,7 +665,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
665 child: Row( 665 child: Row(
666 mainAxisAlignment: MainAxisAlignment.spaceBetween, 666 mainAxisAlignment: MainAxisAlignment.spaceBetween,
667 children: [ 667 children: [
668 - if (couponProvider.couponSunModel.liteQrcode != null) 668 + if (couponProvider.couponSunModel.liteQrcode != null &&
  669 + couponProvider.couponSunModel.isType == '1')
669 RoundButton( 670 RoundButton(
670 text: '生成海报', 671 text: '生成海报',
671 width: w(100), 672 width: w(100),
@@ -678,11 +679,27 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -678,11 +679,27 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
678 isBold: true, 679 isBold: true,
679 fontSize: 28, 680 fontSize: 28,
680 onPressed: () async { 681 onPressed: () async {
681 - NavigatorUtil.goCouponPosterPage(  
682 - context,  
683 - widget.idstr,  
684 - couponProvider.couponSunModel.use,  
685 - couponProvider.couponSunModel); 682 + if (couponProvider.couponSunModel.status != '1') {
  683 + Utils.showToast('请先启用优惠券后再进行操作!');
  684 + return;
  685 + }
  686 +
  687 + // 谁可以发放
  688 + // 可以发放的才能分享
  689 + if (couponProvider.couponSunModel.uidList
  690 + .split(',')
  691 + .contains(Provider.of<UserModel>(context,
  692 + listen: false)
  693 + .user
  694 + .openid)) {
  695 + NavigatorUtil.goCouponPosterPage(
  696 + context,
  697 + widget.idstr,
  698 + couponProvider.couponSunModel.use,
  699 + couponProvider.couponSunModel);
  700 + } else {
  701 + Utils.showToast('您没有此权限');
  702 + }
686 }, 703 },
687 ), 704 ),
688 if (couponProvider.couponSunModel.liteQrcode != null) 705 if (couponProvider.couponSunModel.liteQrcode != null)
@@ -702,11 +719,24 @@ class _CouponDetailPageState extends State<CouponDetailPage> { @@ -702,11 +719,24 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
702 if (couponProvider.couponSunModel.isType == '1' && 719 if (couponProvider.couponSunModel.isType == '1' &&
703 couponProvider.couponSunModel.status == '1') { 720 couponProvider.couponSunModel.status == '1') {
704 //店铺券 721 //店铺券
705 - Utils.goShareBuyCouponToWeChat(  
706 - context,  
707 - widget.idstr,  
708 - couponProvider.couponSunModel.use,  
709 - couponProvider.couponSunModel); 722 +
  723 + // 谁可以发放
  724 + // 可以发放的才能分享
  725 + if (couponProvider.couponSunModel.uidList
  726 + .split(',')
  727 + .contains(Provider.of<UserModel>(context,
  728 + listen: false)
  729 + .user
  730 + .openid)) {
  731 + //包含当前登录人
  732 + Utils.goShareBuyCouponToWeChat(
  733 + context,
  734 + widget.idstr,
  735 + couponProvider.couponSunModel.use,
  736 + couponProvider.couponSunModel);
  737 + } else {
  738 + Utils.showToast('您没有此权限');
  739 + }
710 } else if (couponProvider.couponSunModel.isType == 740 } else if (couponProvider.couponSunModel.isType ==
711 '2' && 741 '2' &&
712 couponProvider.couponSunModel.status == '1') { 742 couponProvider.couponSunModel.status == '1') {
@@ -11,11 +11,14 @@ import 'package:one_key/widgets/system_app_bar.dart'; @@ -11,11 +11,14 @@ import 'package:one_key/widgets/system_app_bar.dart';
11 import 'package:one_key/widgets/v_empty_view.dart'; 11 import 'package:one_key/widgets/v_empty_view.dart';
12 import 'package:provider/provider.dart'; 12 import 'package:provider/provider.dart';
13 13
  14 +import '../../models/coupon_model.dart';
  15 +
14 /** 16 /**
15 * 历史券 17 * 历史券
16 */ 18 */
17 class CouponHistoryPage extends StatefulWidget { 19 class CouponHistoryPage extends StatefulWidget {
18 - CouponHistoryPage({Key key}) : super(key: key); 20 + final int index;
  21 + CouponHistoryPage({Key key, this.index}) : super(key: key);
19 22
20 @override 23 @override
21 _CouponHistoryPageState createState() => _CouponHistoryPageState(); 24 _CouponHistoryPageState createState() => _CouponHistoryPageState();
@@ -33,6 +36,27 @@ class _CouponHistoryPageState extends State<CouponHistoryPage> { @@ -33,6 +36,27 @@ class _CouponHistoryPageState extends State<CouponHistoryPage> {
33 }; 36 };
34 await couponProvider.getCustomerHistoryActivity(context, params, 37 await couponProvider.getCustomerHistoryActivity(context, params,
35 isShowLoading: isShowLoading); 38 isShowLoading: isShowLoading);
  39 +
  40 + List<CouponSunModel> temp = []; //优惠券历史列表
  41 +
  42 + if (widget.index == 1) {
  43 + //店铺历史优惠券
  44 + couponProvider.couponListHistory.forEach((element) {
  45 + if (element.isType == '1') {
  46 + temp.add(element);
  47 + }
  48 + });
  49 + couponProvider.couponListHistory = temp;
  50 + } else if (widget.index == 2) {
  51 + //店铺历史优惠券
  52 + couponProvider.couponListHistory.forEach((element) {
  53 + if (element.isType == '2') {
  54 + temp.add(element);
  55 + }
  56 + });
  57 + couponProvider.couponListHistory = temp;
  58 + }
  59 + setState(() {});
36 } 60 }
37 61
38 @override 62 @override
@@ -171,7 +171,7 @@ class _CouponSunPageState extends State<CouponSunPage> { @@ -171,7 +171,7 @@ class _CouponSunPageState extends State<CouponSunPage> {
171 // getMessage(showLoading: true); 171 // getMessage(showLoading: true);
172 172
173 if (pageState == PageState.Empty) { 173 if (pageState == PageState.Empty) {
174 - NavigatorUtil.goCouponHistoryPage(context); 174 + NavigatorUtil.goCouponHistoryPage(context, widget.index);
175 } else { 175 } else {
176 _couponNetworkData(widget.index); 176 _couponNetworkData(widget.index);
177 } 177 }
@@ -213,7 +213,8 @@ class _CouponSunPageState extends State<CouponSunPage> { @@ -213,7 +213,8 @@ class _CouponSunPageState extends State<CouponSunPage> {
213 children: [ 213 children: [
214 InkWell( 214 InkWell(
215 onTap: () { 215 onTap: () {
216 - NavigatorUtil.goCouponHistoryPage(context); 216 + NavigatorUtil.goCouponHistoryPage(
  217 + context, widget.index);
217 }, 218 },
218 child: RichText( 219 child: RichText(
219 text: TextSpan( 220 text: TextSpan(
@@ -1412,9 +1412,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -1412,9 +1412,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
1412 case AppLifecycleState.resumed: //应用前台可见 1412 case AppLifecycleState.resumed: //应用前台可见
1413 // if (widget.initialIndex == 1 && needRefreshTemp == false) { 1413 // if (widget.initialIndex == 1 && needRefreshTemp == false) {
1414 // } else { 1414 // } else {
1415 - // _clearBadge(() { 1415 + _clearBadge(() {
1416 // _getAllUnMessages(); 1416 // _getAllUnMessages();
1417 - // }); 1417 + });
1418 // } 1418 // }
1419 1419
1420 break; 1420 break;
@@ -279,7 +279,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -279,7 +279,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
279 ///获取二维码 279 ///获取二维码
280 _getWechatQrcode({bool need = false}) async { 280 _getWechatQrcode({bool need = false}) async {
281 String sid = Provider.of<UserModel>(context, listen: false).user.sellerid; 281 String sid = Provider.of<UserModel>(context, listen: false).user.sellerid;
282 - String id = Provider.of<UserModel>(context, listen: false).user.openid; 282 + // String id = Provider.of<UserModel>(context, listen: false).user.openid;
283 // https: //xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode/sellerid/商家ID/uid/当前账号ID 283 // https: //xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode/sellerid/商家ID/uid/当前账号ID
284 Response response = await DioUtil.getInstance().getDio().get( 284 Response response = await DioUtil.getInstance().getDio().get(
285 "https://xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode?sellerid=$sid&uid=${data.id}"); 285 "https://xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode?sellerid=$sid&uid=${data.id}");
@@ -312,6 +312,10 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -312,6 +312,10 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
312 userModel = Provider.of<UserModel>(context, listen: false); 312 userModel = Provider.of<UserModel>(context, listen: false);
313 313
314 personnelProvider = Provider.of<PersonnelProvider>(context, listen: true); 314 personnelProvider = Provider.of<PersonnelProvider>(context, listen: true);
  315 +
  316 + Color wechatColor = data?.openid == null || data?.openid == 'null'
  317 + ? MyColours.color_438E93
  318 + : MyColours.color_8EBBBE;
315 return Scaffold( 319 return Scaffold(
316 backgroundColor: MyColours.color_ffffff, 320 backgroundColor: MyColours.color_ffffff,
317 appBar: SystemAppBar( 321 appBar: SystemAppBar(
@@ -424,62 +428,62 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -424,62 +428,62 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
424 Positioned( 428 Positioned(
425 top: ScreenUtil().setWidth(13 * 2), 429 top: ScreenUtil().setWidth(13 * 2),
426 left: ScreenUtil().setWidth(35 * 2), 430 left: ScreenUtil().setWidth(35 * 2),
427 - child:  
428 - data?.headimgurl != null && data?.headimgurl != 'null'  
429 - ? ClipRRect(  
430 - borderRadius: BorderRadius.circular(  
431 - ScreenUtil().setWidth(80)),  
432 - child: CachedNetworkImage(  
433 - imageUrl: data?.headimgurl, 431 + child: data?.headimgurl != null &&
  432 + data?.headimgurl != 'null' &&
  433 + data?.headimgurl != ''
  434 + ? ClipRRect(
  435 + borderRadius: BorderRadius.circular(
  436 + ScreenUtil().setWidth(80)),
  437 + child: CachedNetworkImage(
  438 + imageUrl: data?.headimgurl,
  439 + fit: BoxFit.cover,
  440 + width: ScreenUtil().setWidth(80 * 2),
  441 + height: ScreenUtil().setWidth(80 * 2),
  442 + ))
  443 + : Stack(alignment: Alignment.center, children: [
  444 + Container(
  445 + width: ScreenUtil().setWidth(80 * 2),
  446 + height: ScreenUtil().setWidth(80 * 2),
  447 + decoration: BoxDecoration(
  448 + color: MyColours.color_f3f3f3,
  449 + borderRadius: BorderRadius.circular(
  450 + ScreenUtil().setWidth(80)))),
  451 + Align(
  452 + alignment: Alignment.center,
  453 + child: Image.asset(
  454 + Utils.getImgPath('personnal_no_image'),
434 fit: BoxFit.cover, 455 fit: BoxFit.cover,
435 - width: ScreenUtil().setWidth(80 * 2),  
436 - height: ScreenUtil().setWidth(80 * 2),  
437 - ))  
438 - : Stack(alignment: Alignment.center, children: [  
439 - Container(  
440 - width: ScreenUtil().setWidth(80 * 2),  
441 - height: ScreenUtil().setWidth(80 * 2),  
442 - decoration: BoxDecoration(  
443 - color: MyColours.color_f3f3f3,  
444 - borderRadius: BorderRadius.circular(  
445 - ScreenUtil().setWidth(80)))),  
446 - Align(  
447 - alignment: Alignment.center,  
448 - child: Image.asset(  
449 - Utils.getImgPath('personnal_no_image'),  
450 - fit: BoxFit.cover,  
451 - width: ScreenUtil().setWidth(50 * 2),  
452 - height: ScreenUtil().setWidth(50 * 2)),  
453 - ),  
454 - ]), 456 + width: ScreenUtil().setWidth(50 * 2),
  457 + height: ScreenUtil().setWidth(50 * 2)),
  458 + ),
  459 + ]),
455 ) 460 )
456 ], 461 ],
457 ), 462 ),
458 VEmptyView(114), 463 VEmptyView(114),
459 - data?.openid == null || data?.openid == 'null'  
460 - ? RoundButton(  
461 - text: '绑定微信',  
462 - gradientStart: MyColours.color_438E93,  
463 - gradientEnd: MyColours.color_438E93,  
464 - borderColor: MyColours.color_438E93,  
465 - width: ScreenUtil().setWidth(80 * 2),  
466 - height: ScreenUtil().setWidth(30 * 2),  
467 - fontSize: 32,  
468 - isBold: true,  
469 - textColor: MyColours.color_ffffff,  
470 - radius: ScreenUtil().setWidth(12),  
471 - onPressed: () {  
472 - if (dcAdduserCode != '' && dcAdduserCode != null) {  
473 - DialogUtil.openAlertDialogImage(  
474 - context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);  
475 - } else {  
476 - _getWechatQrcode(need: true);  
477 - }  
478 - })  
479 - : SizedBox(),  
480 - data?.openid == null || data?.openid == 'null'  
481 - ? VEmptyView(48)  
482 - : SizedBox(), 464 +
  465 + RoundButton(
  466 + text: data?.openid == null || data?.openid == 'null'
  467 + ? '绑定微信'
  468 + : '更换微信',
  469 + gradientStart: wechatColor,
  470 + gradientEnd: wechatColor,
  471 + borderColor: wechatColor,
  472 + width: ScreenUtil().setWidth(80 * 2),
  473 + height: ScreenUtil().setWidth(30 * 2),
  474 + fontSize: 32,
  475 + isBold: true,
  476 + textColor: MyColours.color_ffffff,
  477 + radius: ScreenUtil().setWidth(12),
  478 + onPressed: () {
  479 + if (dcAdduserCode != '' && dcAdduserCode != null) {
  480 + DialogUtil.openAlertDialogImage(
  481 + context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);
  482 + } else {
  483 + _getWechatQrcode(need: true);
  484 + }
  485 + }),
  486 + VEmptyView(48),
483 InkWell( 487 InkWell(
484 onTap: () { 488 onTap: () {
485 NavigatorUtil.goPersonnelPasswordEditPage(context, 489 NavigatorUtil.goPersonnelPasswordEditPage(context,
@@ -312,7 +312,8 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> { @@ -312,7 +312,8 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> {
312 child: Row( 312 child: Row(
313 children: [ 313 children: [
314 model.headimgurl != null && 314 model.headimgurl != null &&
315 - model.headimgurl != 'null' 315 + model.headimgurl != 'null' &&
  316 + model.headimgurl != ''
316 ? ClipRRect( 317 ? ClipRRect(
317 borderRadius: 318 borderRadius:
318 BorderRadius.circular( 319 BorderRadius.circular(
@@ -268,8 +268,8 @@ class NavigatorUtil { @@ -268,8 +268,8 @@ class NavigatorUtil {
268 } 268 }
269 269
270 /// 优惠券历史列表 270 /// 优惠券历史列表
271 - static void goCouponHistoryPage(BuildContext context, {replace = false}) {  
272 - _navigateTo(context, "${Routes.coupon_history}", replace: replace); 271 + static void goCouponHistoryPage(BuildContext context,int index, {replace = false}) {
  272 + _navigateTo(context, "${Routes.coupon_history}?index=${index}", replace: replace);
273 } 273 }
274 274
275 /// 创建优惠券 275 /// 创建优惠券
@@ -635,9 +635,9 @@ var handleCouponPageHandler = new Handler( @@ -635,9 +635,9 @@ var handleCouponPageHandler = new Handler(
635 ///优惠券历史列表 635 ///优惠券历史列表
636 var handleCouponHistoryPageHandler = new Handler( 636 var handleCouponHistoryPageHandler = new Handler(
637 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 637 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
638 - // String rid = params["rid"].first; 638 + String index = params["index"].first;
639 // bool fromNotify = FluroConvertUtils.string2bool(params["fromNotify"].first); 639 // bool fromNotify = FluroConvertUtils.string2bool(params["fromNotify"].first);
640 - return CouponHistoryPage(); 640 + return CouponHistoryPage(index: int.parse(index));
641 }); 641 });
642 642
643 ///创建优惠券 643 ///创建优惠券
@@ -3234,10 +3234,11 @@ var smsTemplateSettingPageHandle = new Handler( @@ -3234,10 +3234,11 @@ var smsTemplateSettingPageHandle = new Handler(
3234 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 3234 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
3235 // String rid = params["rid"].first; 3235 // String rid = params["rid"].first;
3236 String smsTemplate = params["smsTemplate"].first; 3236 String smsTemplate = params["smsTemplate"].first;
3237 - String bookinginfo = params["bookinginfo"].first; 3237 + String bookinginfo = params["bookinginfo"].first;
3238 return ChangeNotifierProvider<MarketingCenterProvider>( 3238 return ChangeNotifierProvider<MarketingCenterProvider>(
3239 create: (_) => MarketingCenterProvider(), 3239 create: (_) => MarketingCenterProvider(),
3240 - child: SmsTemplateSettingPage(smsTemplate: smsTemplate,bookinginfo:bookinginfo)); 3240 + child: SmsTemplateSettingPage(
  3241 + smsTemplate: smsTemplate, bookinginfo: bookinginfo));
3241 }); 3242 });
3242 3243
3243 //优惠券海报 3244 //优惠券海报