Commit a912a25eaebf7175e9580d2cc2b8c15f8180fc20

Authored by wdn127929
1 parent 0c64b88a

微信支付:监听取消&&微信未安装提示安装微信

@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 archiveVersion = 1; 3 archiveVersion = 1;
4 classes = { 4 classes = {
5 }; 5 };
6 - objectVersion = 50; 6 + objectVersion = 46;
7 objects = { 7 objects = {
8 8
9 /* Begin PBXBuildFile section */ 9 /* Begin PBXBuildFile section */
@@ -659,7 +659,7 @@ @@ -659,7 +659,7 @@
659 CURRENT_PROJECT_VERSION = 490; 659 CURRENT_PROJECT_VERSION = 490;
660 DEVELOPMENT_TEAM = 8J59HM8B82; 660 DEVELOPMENT_TEAM = 8J59HM8B82;
661 ENABLE_BITCODE = NO; 661 ENABLE_BITCODE = NO;
662 - FLUTTER_BUILD_MODE = release; 662 + FLUTTER_BUILD_MODE = debug;
663 FRAMEWORK_SEARCH_PATHS = ( 663 FRAMEWORK_SEARCH_PATHS = (
664 "$(inherited)", 664 "$(inherited)",
665 "$(PROJECT_DIR)/Flutter", 665 "$(PROJECT_DIR)/Flutter",
@@ -216,7 +216,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -216,7 +216,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
216 GestureDetector( 216 GestureDetector(
217 onTap: () async { 217 onTap: () async {
218 Navigator.of(context).pop(); 218 Navigator.of(context).pop();
219 - Map temp = await NavigatorUtil.goSelectTablePage( 219 + Map temp = await NavigatorUtil.goSelectTableFPage(
220 context, 220 context,
221 widget.rid, 221 widget.rid,
222 int.parse(detailEntity.ddate) * 1000, 222 int.parse(detailEntity.ddate) * 1000,
@@ -424,257 +424,251 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -424,257 +424,251 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
424 ); 424 );
425 } else { 425 } else {
426 return DefaultTextStyle( 426 return DefaultTextStyle(
427 - style: TextStyle(decoration: TextDecoration.none),  
428 - child: Container(  
429 - color: MyColours.color_ffffff,  
430 - child: Column(  
431 - children: <Widget>[  
432 - Expanded(  
433 - child: SingleChildScrollView(  
434 - child: Container(  
435 - color: MyColours.color_ffffff,  
436 - padding: EdgeInsets.symmetric(  
437 - horizontal: ScreenUtil().setWidth(43)),  
438 - child: Column(  
439 - children: <Widget>[  
440 - RowMultiText(  
441 - "用餐时段", detailEntity.ddateMd),  
442 - Stack(  
443 - alignment: Alignment.center,  
444 - children: <Widget>[  
445 - Column(  
446 - children: <Widget>[  
447 - RowMultiText("用餐时间",  
448 - detailEntity.ddateHm),  
449 - Offstage(  
450 - offstage:  
451 - detailEntity.type == "0"  
452 - ? false  
453 - : true,  
454 - child: RowMultiText("用餐人数",  
455 - detailEntity.pnum),  
456 - )  
457 - ],  
458 - ),  
459 - Image.asset(  
460 - detailEntity.statuImgAssets,  
461 - width: ScreenUtil().setWidth(100),  
462 - height: ScreenUtil().setWidth(30),  
463 - )  
464 - ],  
465 - ),  
466 - RowMultiText(  
467 - "包间需求",  
468 - (detailEntity.demands.length  
469 - .toString() +  
470 - "个") ??  
471 - ""),  
472 - Align(  
473 - alignment: Alignment.centerRight,  
474 - child: Offstage(  
475 - offstage:  
476 - detailEntity.demands.length >  
477 - 0  
478 - ? false  
479 - : true,  
480 - child: Container(  
481 - height:  
482 - ScreenUtil().setHeight(210),  
483 - child: ListView.builder(  
484 - itemBuilder:  
485 - (BuildContext contxt,  
486 - int index) {  
487 - return NeedItem(detailEntity  
488 - .demands[index]);  
489 - },  
490 - itemCount: detailEntity  
491 - .demands.length,  
492 - shrinkWrap: true,  
493 - scrollDirection:  
494 - Axis.horizontal,  
495 - ),  
496 - ),  
497 - )),  
498 - RowMultiText(  
499 - "客户姓名", detailEntity.rnameStr),  
500 - RowMultiText("客户电话", formatPhone),  
501 - RowMultiText(  
502 - "备注信息", detailEntity.cusdem ?? ""),  
503 - MyDivider(double.infinity,  
504 - ScreenUtil().setHeight(1)),  
505 - Container(  
506 - color: MyColours.color_ffffff,  
507 - width: double.infinity,  
508 - height: ScreenUtil().setHeight(80),  
509 - alignment: Alignment.center,  
510 - child: Stack(  
511 - alignment: Alignment.center, 427 + style: TextStyle(decoration: TextDecoration.none),
  428 + child: Container(
  429 + color: MyColours.color_ffffff,
  430 + child: Column(
  431 + children: <Widget>[
  432 + Expanded(
  433 + child: SingleChildScrollView(
  434 + child: Container(
  435 + color: MyColours.color_ffffff,
  436 + padding: EdgeInsets.symmetric(
  437 + horizontal: ScreenUtil().setWidth(43)),
  438 + child: Column(
  439 + children: <Widget>[
  440 + RowMultiText(
  441 + "用餐时段", detailEntity.ddateMd),
  442 + Stack(
  443 + alignment: Alignment.center,
  444 + children: <Widget>[
  445 + Column(
512 children: <Widget>[ 446 children: <Widget>[
513 - Positioned(  
514 - left: 0,  
515 - child: Text(  
516 - "客户经理",  
517 - style: TextStyle(  
518 - color: MyColours  
519 - .color_828282,  
520 - fontSize: ScreenUtil()  
521 - .setSp(30)),  
522 - ),  
523 - ),  
524 - Positioned(  
525 - right: 0,  
526 - child: GestureDetector(  
527 - onTap: () async {  
528 - List<String> list = [];  
529 - for (Manager manager  
530 - in managers) {  
531 - list.add(  
532 - manager.roleUserName);  
533 - }  
534 - DialogUtil  
535 - .showSelectCusmanDialog(  
536 - context, list,  
537 - (value) {  
538 - if (value != null) {  
539 - setState(() {  
540 - cusmanText = managers[  
541 - value.first]  
542 - .userName;  
543 - });  
544 - _setCurrManager();  
545 - }  
546 - }).then((value) {});  
547 - },  
548 - child: Text(  
549 - cusmanText,  
550 - style: TextStyle(  
551 - color: MyColours  
552 - .color_353535,  
553 - fontSize: ScreenUtil()  
554 - .setSp(30),  
555 - decoration: TextDecoration  
556 - .underline,  
557 - ),  
558 - ),  
559 - ), 447 + RowMultiText(
  448 + "用餐时间", detailEntity.ddateHm),
  449 + Offstage(
  450 + offstage:
  451 + detailEntity.type == "0"
  452 + ? false
  453 + : true,
  454 + child: RowMultiText(
  455 + "用餐人数", detailEntity.pnum),
560 ) 456 )
561 ], 457 ],
562 ), 458 ),
563 - ),  
564 - ],  
565 - )),  
566 - ),  
567 - ),  
568 - Offstage(  
569 - offstage: detailEntity.status != "0",  
570 - child: Container(  
571 - margin: EdgeInsets.only(  
572 - top: ScreenUtil().setHeight(30),  
573 - bottom: ScreenUtil().setHeight(30)),  
574 - child: Column(  
575 - children: <Widget>[  
576 - CommonButton(  
577 - content: "安排包间",  
578 - width: 669,  
579 - height: 84,  
580 - fontSize: 34,  
581 - onPress: () async {  
582 - Map map = await NavigatorUtil  
583 - .goSelectTablePage(  
584 - context,  
585 - widget.rid,  
586 - int.parse(detailEntity.ddate) *  
587 - 1000,  
588 - detailEntity.ddate_solt);  
589 - if (map != null && map['tid'] != null) {  
590 - setReserveStatus("5",  
591 - tid: map['tid']);  
592 - }  
593 - },  
594 - ),  
595 - VEmptyView(20),  
596 - Container(  
597 - width: ScreenUtil().setWidth(669),  
598 - height: ScreenUtil().setWidth(84),  
599 - decoration: BoxDecoration(  
600 - border: Border.all(  
601 - color: MyColours.color_199095),  
602 - borderRadius: BorderRadius.circular(  
603 - ScreenUtil().setWidth(10)), 459 + Image.asset(
  460 + detailEntity.statuImgAssets,
  461 + width: ScreenUtil().setWidth(100),
  462 + height: ScreenUtil().setWidth(30),
  463 + )
  464 + ],
604 ), 465 ),
605 - child: Row(  
606 - crossAxisAlignment:  
607 - CrossAxisAlignment.center,  
608 - children: <Widget>[  
609 - Expanded(  
610 - child: GestureDetector(  
611 - child: Center( 466 + RowMultiText(
  467 + "包间需求",
  468 + (detailEntity.demands.length
  469 + .toString() +
  470 + "个") ??
  471 + ""),
  472 + Align(
  473 + alignment: Alignment.centerRight,
  474 + child: Offstage(
  475 + offstage:
  476 + detailEntity.demands.length > 0
  477 + ? false
  478 + : true,
  479 + child: Container(
  480 + height:
  481 + ScreenUtil().setHeight(210),
  482 + child: ListView.builder(
  483 + itemBuilder:
  484 + (BuildContext contxt,
  485 + int index) {
  486 + return NeedItem(detailEntity
  487 + .demands[index]);
  488 + },
  489 + itemCount:
  490 + detailEntity.demands.length,
  491 + shrinkWrap: true,
  492 + scrollDirection:
  493 + Axis.horizontal,
  494 + ),
  495 + ),
  496 + )),
  497 + RowMultiText(
  498 + "客户姓名", detailEntity.rnameStr),
  499 + RowMultiText("客户电话", formatPhone),
  500 + RowMultiText(
  501 + "备注信息", detailEntity.cusdem ?? ""),
  502 + MyDivider(double.infinity,
  503 + ScreenUtil().setHeight(1)),
  504 + Container(
  505 + color: MyColours.color_ffffff,
  506 + width: double.infinity,
  507 + height: ScreenUtil().setHeight(80),
  508 + alignment: Alignment.center,
  509 + child: Stack(
  510 + alignment: Alignment.center,
  511 + children: <Widget>[
  512 + Positioned(
  513 + left: 0,
612 child: Text( 514 child: Text(
613 - "拒绝订单", 515 + "客户经理",
614 style: TextStyle( 516 style: TextStyle(
615 color: 517 color:
616 - MyColours.color_199095, 518 + MyColours.color_828282,
617 fontSize: 519 fontSize:
618 - ScreenUtil().setSp(34)), 520 + ScreenUtil().setSp(30)),
619 ), 521 ),
620 ), 522 ),
621 - onTap: () {  
622 - _showRefuseDialog2();  
623 - },  
624 - )),  
625 - Offstage(  
626 - offstage: !isCallTel,  
627 - child: SizedBox(  
628 - width: ScreenUtil().setWidth(335),  
629 - height: ScreenUtil().setWidth(84),  
630 - child: Row(  
631 - children: [  
632 - MyDivider(  
633 - ScreenUtil().setWidth(2),  
634 - ScreenUtil().setHeight(52), 523 + Positioned(
  524 + right: 0,
  525 + child: GestureDetector(
  526 + onTap: () async {
  527 + List<String> list = [];
  528 + for (Manager manager
  529 + in managers) {
  530 + list.add(
  531 + manager.roleUserName);
  532 + }
  533 + DialogUtil
  534 + .showSelectCusmanDialog(
  535 + context, list,
  536 + (value) {
  537 + if (value != null) {
  538 + setState(() {
  539 + cusmanText = managers[
  540 + value.first]
  541 + .userName;
  542 + });
  543 + _setCurrManager();
  544 + }
  545 + }).then((value) {});
  546 + },
  547 + child: Text(
  548 + cusmanText,
  549 + style: TextStyle(
635 color: 550 color:
636 - MyColours.color_199095, 551 + MyColours.color_353535,
  552 + fontSize:
  553 + ScreenUtil().setSp(30),
  554 + decoration: TextDecoration
  555 + .underline,
637 ), 556 ),
638 - Expanded(  
639 - child: GestureDetector(  
640 - child: Center(  
641 - child: Text(  
642 - "联系顾客",  
643 - style: TextStyle(  
644 - color: MyColours  
645 - .color_199095,  
646 - fontSize:  
647 - ScreenUtil()  
648 - .setSp(34)),  
649 - ),  
650 - ),  
651 - onTap: () {  
652 - if (detailEntity.phone !=  
653 - null &&  
654 - detailEntity.phone  
655 - .isNotEmpty) {  
656 - Utils.goPhone(  
657 - detailEntity.phone);  
658 - } else {  
659 - Utils.showToast(  
660 - "没有客户电话!");  
661 - }  
662 - },  
663 - )),  
664 - ], 557 + ),
665 ), 558 ),
666 - ),  
667 - )  
668 - ], 559 + )
  560 + ],
  561 + ),
669 ), 562 ),
670 - )  
671 - ],  
672 - ), 563 + ],
  564 + )),
  565 + ),
  566 + ),
  567 + Offstage(
  568 + offstage: detailEntity.status != "0",
  569 + child: Container(
  570 + margin: EdgeInsets.only(
  571 + top: ScreenUtil().setHeight(30),
  572 + bottom: ScreenUtil().setHeight(30)),
  573 + child: Column(
  574 + children: <Widget>[
  575 + CommonButton(
  576 + content: "安排包间",
  577 + width: 669,
  578 + height: 84,
  579 + fontSize: 34,
  580 + onPress: () async {
  581 + Map map =
  582 + await NavigatorUtil.goSelectTableFPage(
  583 + context,
  584 + widget.rid,
  585 + int.parse(detailEntity.ddate) *
  586 + 1000,
  587 + detailEntity.ddate_solt);
  588 + if (map != null && map['tid'] != null) {
  589 + setReserveStatus("5", tid: map['tid']);
  590 + }
  591 + },
  592 + ),
  593 + VEmptyView(20),
  594 + Container(
  595 + width: ScreenUtil().setWidth(669),
  596 + height: ScreenUtil().setWidth(84),
  597 + decoration: BoxDecoration(
  598 + border: Border.all(
  599 + color: MyColours.color_199095),
  600 + borderRadius: BorderRadius.circular(
  601 + ScreenUtil().setWidth(10)),
  602 + ),
  603 + child: Row(
  604 + crossAxisAlignment:
  605 + CrossAxisAlignment.center,
  606 + children: <Widget>[
  607 + Expanded(
  608 + child: GestureDetector(
  609 + child: Center(
  610 + child: Text(
  611 + "拒绝订单",
  612 + style: TextStyle(
  613 + color: MyColours.color_199095,
  614 + fontSize:
  615 + ScreenUtil().setSp(34)),
  616 + ),
  617 + ),
  618 + onTap: () {
  619 + _showRefuseDialog2();
  620 + },
  621 + )),
  622 + Offstage(
  623 + offstage: !isCallTel,
  624 + child: SizedBox(
  625 + width: ScreenUtil().setWidth(335),
  626 + height: ScreenUtil().setWidth(84),
  627 + child: Row(
  628 + children: [
  629 + MyDivider(
  630 + ScreenUtil().setWidth(2),
  631 + ScreenUtil().setHeight(52),
  632 + color: MyColours.color_199095,
  633 + ),
  634 + Expanded(
  635 + child: GestureDetector(
  636 + child: Center(
  637 + child: Text(
  638 + "联系顾客",
  639 + style: TextStyle(
  640 + color: MyColours
  641 + .color_199095,
  642 + fontSize: ScreenUtil()
  643 + .setSp(34)),
  644 + ),
  645 + ),
  646 + onTap: () {
  647 + if (detailEntity.phone !=
  648 + null &&
  649 + detailEntity
  650 + .phone.isNotEmpty) {
  651 + Utils.goPhone(
  652 + detailEntity.phone);
  653 + } else {
  654 + Utils.showToast(
  655 + "没有客户电话!");
  656 + }
  657 + },
  658 + )),
  659 + ],
  660 + ),
  661 + ),
  662 + )
  663 + ],
  664 + ),
  665 + )
  666 + ],
673 ), 667 ),
674 - )  
675 - ],  
676 - )))  
677 - ; 668 + ),
  669 + )
  670 + ],
  671 + )));
678 } 672 }
679 }), 673 }),
680 onWillPop: () async { 674 onWillPop: () async {
@@ -114,7 +114,7 @@ class _SmsManagerPageState extends State<SmsManagerPage> { @@ -114,7 +114,7 @@ class _SmsManagerPageState extends State<SmsManagerPage> {
114 crossAxisAlignment: CrossAxisAlignment.center, 114 crossAxisAlignment: CrossAxisAlignment.center,
115 children: [ 115 children: [
116 Container( 116 Container(
117 - height: ScreenUtil().setWidth(40), 117 + // height: ScreenUtil().setWidth(40),
118 child: Text( 118 child: Text(
119 widget.infoData.lastNum, 119 widget.infoData.lastNum,
120 style: TextStyle( 120 style: TextStyle(
@@ -123,7 +123,7 @@ class _SmsManagerPageState extends State<SmsManagerPage> { @@ -123,7 +123,7 @@ class _SmsManagerPageState extends State<SmsManagerPage> {
123 fontSize: ScreenUtil().setSp(36)), 123 fontSize: ScreenUtil().setSp(36)),
124 )), 124 )),
125 Container( 125 Container(
126 - height: ScreenUtil().setWidth(30), 126 + // height: ScreenUtil().setWidth(40),
127 child: Text( 127 child: Text(
128 ' 条', 128 ' 条',
129 style: TextStyle( 129 style: TextStyle(
@@ -62,8 +62,10 @@ class _SmsRechargeItemPageState extends State<SmsRechargeItemPage> { @@ -62,8 +62,10 @@ class _SmsRechargeItemPageState extends State<SmsRechargeItemPage> {
62 : MyColours.color_333333)), 62 : MyColours.color_333333)),
63 ], 63 ],
64 ), 64 ),
65 - Container(  
66 - width: ScreenUtil().setWidth(150), 65 + Expanded(
  66 + child: Container(
  67 + // width: ScreenUtil().setWidth(150),
  68 + alignment: Alignment.centerRight,
67 margin: EdgeInsets.only(top: ScreenUtil().setWidth(30)), 69 margin: EdgeInsets.only(top: ScreenUtil().setWidth(30)),
68 child: Column( 70 child: Column(
69 crossAxisAlignment: CrossAxisAlignment.start, 71 crossAxisAlignment: CrossAxisAlignment.start,
@@ -89,7 +91,7 @@ class _SmsRechargeItemPageState extends State<SmsRechargeItemPage> { @@ -89,7 +91,7 @@ class _SmsRechargeItemPageState extends State<SmsRechargeItemPage> {
89 : MyColours.color_999999)), 91 : MyColours.color_999999)),
90 ], 92 ],
91 ), 93 ),
92 - ), 94 + )),
93 ], 95 ],
94 )), 96 )),
95 widget.meals.discount == '0' 97 widget.meals.discount == '0'
  1 +import 'dart:async';
1 import 'dart:convert'; 2 import 'dart:convert';
2 3
3 import 'package:flutter/material.dart'; 4 import 'package:flutter/material.dart';
4 import 'package:flutter_screenutil/flutter_screenutil.dart'; 5 import 'package:flutter_screenutil/flutter_screenutil.dart';
  6 +import 'package:fluwx/fluwx.dart';
5 import 'package:one_key/models/sms_info.dart'; 7 import 'package:one_key/models/sms_info.dart';
6 import 'package:one_key/pages/my/sms_recharge_item_page.dart'; 8 import 'package:one_key/pages/my/sms_recharge_item_page.dart';
7 import 'package:one_key/provider/sms_recharge_provider.dart'; 9 import 'package:one_key/provider/sms_recharge_provider.dart';
@@ -29,10 +31,14 @@ class _SmsRechargePageState extends State<SmsRechargePage> { @@ -29,10 +31,14 @@ class _SmsRechargePageState extends State<SmsRechargePage> {
29 ScrollController controller = ScrollController(); 31 ScrollController controller = ScrollController();
30 Meals mealsSelected; 32 Meals mealsSelected;
31 SmsRechargeModel rechargeModel; 33 SmsRechargeModel rechargeModel;
  34 +
  35 + StreamSubscription _wxPay;
  36 +
32 @override 37 @override
33 void initState() { 38 void initState() {
34 super.initState(); 39 super.initState();
35 - fluwx.weChatResponseEventHandler.listen((res) { 40 + _wxPay = fluwx.weChatResponseEventHandler.listen((res) {
  41 + _wxPay?.cancel();
36 if (res is fluwx.WeChatPaymentResponse) { 42 if (res is fluwx.WeChatPaymentResponse) {
37 print("pay :${res.isSuccessful}"); 43 print("pay :${res.isSuccessful}");
38 if (res.errCode == 0) { 44 if (res.errCode == 0) {
@@ -49,6 +55,15 @@ class _SmsRechargePageState extends State<SmsRechargePage> { @@ -49,6 +55,15 @@ class _SmsRechargePageState extends State<SmsRechargePage> {
49 }); 55 });
50 } 56 }
51 57
  58 + void wxSubscriptionClose() => _wxPay?.cancel();
  59 +
  60 + @override
  61 + void dispose() {
  62 + super.dispose();
  63 +
  64 + wxSubscriptionClose();
  65 + }
  66 +
52 @override 67 @override
53 Widget build(BuildContext context) { 68 Widget build(BuildContext context) {
54 rechargeModel = Provider.of<SmsRechargeModel>(context, listen: true); 69 rechargeModel = Provider.of<SmsRechargeModel>(context, listen: true);
@@ -153,6 +168,12 @@ class _SmsRechargePageState extends State<SmsRechargePage> { @@ -153,6 +168,12 @@ class _SmsRechargePageState extends State<SmsRechargePage> {
153 height: ScreenUtil().setWidth(70), 168 height: ScreenUtil().setWidth(70),
154 textColor: MyColours.color_F0F0F0, 169 textColor: MyColours.color_F0F0F0,
155 onPressed: () async { 170 onPressed: () async {
  171 + //是否安装微信
  172 + bool isInstalled = await fluwx.isWeChatInstalled;
  173 + if (!isInstalled) {
  174 + Utils.showToast("请先安装微信");
  175 + return;
  176 + }
156 if (mealsSelected == null) { 177 if (mealsSelected == null) {
157 Utils.showToast('请选择您要购买的短信套餐'); 178 Utils.showToast('请选择您要购买的短信套餐');
158 return; 179 return;
@@ -199,7 +220,7 @@ class _SmsRechargePageState extends State<SmsRechargePage> { @@ -199,7 +220,7 @@ class _SmsRechargePageState extends State<SmsRechargePage> {
199 print('nonceStr${rechargeModel.sunModel.nonceStr}'); 220 print('nonceStr${rechargeModel.sunModel.nonceStr}');
200 print('timeStamp${rechargeModel.sunModel.timeStamp}'); 221 print('timeStamp${rechargeModel.sunModel.timeStamp}');
201 print('sign${sign}'); 222 print('sign${sign}');
202 - 223 +
203 //掉起微信支付 224 //掉起微信支付
204 fluwx 225 fluwx
205 .payWithWeChat( 226 .payWithWeChat(