Commit 6854965f9d747f4771042e608cf3b859ccf656e7

Authored by weixin_45529955
1 parent 05090e8c

预定安排页短信次数全局变量没有清零

@@ -755,6 +755,8 @@ class InvicationPageState extends State<InvicationPage> @@ -755,6 +755,8 @@ class InvicationPageState extends State<InvicationPage>
755 removeOverlay(); 755 removeOverlay();
756 Utils.changeStatusColor(); 756 Utils.changeStatusColor();
757 couponProvider.clearSelect(); 757 couponProvider.clearSelect();
  758 + couponProvider.sendSMS = 0;
  759 + couponProvider.errorSMS = '';
758 bus.off("refresh_coupon_invitation"); 760 bus.off("refresh_coupon_invitation");
759 bus.off("refresh_invitaion_info"); 761 bus.off("refresh_invitaion_info");
760 bus.off("refresh_photo_invication"); 762 bus.off("refresh_photo_invication");
@@ -430,6 +430,8 @@ class InvicationPageSimState extends State<InvicationPageSim> @@ -430,6 +430,8 @@ class InvicationPageSimState extends State<InvicationPageSim>
430 removeOverlay(); 430 removeOverlay();
431 Utils.changeStatusColor(); 431 Utils.changeStatusColor();
432 couponProvider.clearSelect(); 432 couponProvider.clearSelect();
  433 + couponProvider.sendSMS = 0;
  434 + couponProvider.errorSMS = '';
433 bus.off("refresh_coupon_invitation"); 435 bus.off("refresh_coupon_invitation");
434 bus.off("refresh_invitaion_info"); 436 bus.off("refresh_invitaion_info");
435 bus.off("refresh_photo_invication"); 437 bus.off("refresh_photo_invication");
@@ -1810,7 +1812,7 @@ class InvicationPageSimState extends State<InvicationPageSim> @@ -1810,7 +1812,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
1810 } 1812 }
1811 1813
1812 await customerProvider.setGuestInfo(context, pramas); 1814 await customerProvider.setGuestInfo(context, pramas);
1813 - } 1815 + }
1814 // else { 1816 // else {
1815 // Map<String, String?> pramas = { 1817 // Map<String, String?> pramas = {
1816 // 'sellerid': 1818 // 'sellerid':
@@ -4563,6 +4565,31 @@ class InvicationPageSimState extends State<InvicationPageSim> @@ -4563,6 +4565,31 @@ class InvicationPageSimState extends State<InvicationPageSim>
4563 } 4565 }
4564 } 4566 }
4565 4567
  4568 + _send() async {
  4569 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  4570 + Map<String, String?> params = {
  4571 + "rid": widget.rid,
  4572 + "sid": userModel.user!.sellerid
  4573 + };
  4574 +
  4575 + bool success = await couponProvider.sendSMSWxSendSms(context, params);
  4576 + print(success);
  4577 + if (success) {
  4578 + setState(() {
  4579 + smsTitle = '已发${couponProvider.sendSMS}次';
  4580 + });
  4581 + canSendSms = false;
  4582 + startCountdown(120);
  4583 + } else {
  4584 + if (couponProvider.errorSMS != '') {
  4585 + setState(() {
  4586 + showErroInfo = true;
  4587 + erroInfo = couponProvider.errorSMS;
  4588 + });
  4589 + }
  4590 + }
  4591 + }
  4592 +
4566 ///微信通知、发短信 4593 ///微信通知、发短信
4567 Widget _btnWidget() { 4594 Widget _btnWidget() {
4568 return Padding( 4595 return Padding(
@@ -4680,30 +4707,31 @@ class InvicationPageSimState extends State<InvicationPageSim> @@ -4680,30 +4707,31 @@ class InvicationPageSimState extends State<InvicationPageSim>
4680 showErroInfo = false; 4707 showErroInfo = false;
4681 erroInfo = ''; 4708 erroInfo = '';
4682 }); 4709 });
4683 - UserModel userModel = Provider.of<UserModel>(  
4684 - context,  
4685 - listen: false);  
4686 - Map<String, String?> params = {  
4687 - "rid": widget.rid,  
4688 - "sid": userModel.user!.sellerid  
4689 - };  
4690 - bool success = await couponProvider  
4691 - .sendSMSWxSendSms(context, params);  
4692 - print(success);  
4693 - if (success) {  
4694 - setState(() {  
4695 - smsTitle = '已发${couponProvider.sendSMS}次';  
4696 - });  
4697 - canSendSms = false;  
4698 - startCountdown(120);  
4699 - } else {  
4700 - if (couponProvider.errorSMS != '') {  
4701 - setState(() {  
4702 - showErroInfo = true;  
4703 - erroInfo = couponProvider.errorSMS;  
4704 - });  
4705 - }  
4706 - } 4710 + JhCommonUtils.debounce(() => _send());
  4711 + // UserModel userModel = Provider.of<UserModel>(
  4712 + // context,
  4713 + // listen: false);
  4714 + // Map<String, String?> params = {
  4715 + // "rid": widget.rid,
  4716 + // "sid": userModel.user!.sellerid
  4717 + // };
  4718 + // bool success = await couponProvider
  4719 + // .sendSMSWxSendSms(context, params);
  4720 + // print(success);
  4721 + // if (success) {
  4722 + // setState(() {
  4723 + // smsTitle = '已发${couponProvider.sendSMS}次';
  4724 + // });
  4725 + // canSendSms = false;
  4726 + // startCountdown(120);
  4727 + // } else {
  4728 + // if (couponProvider.errorSMS != '') {
  4729 + // setState(() {
  4730 + // showErroInfo = true;
  4731 + // erroInfo = couponProvider.errorSMS;
  4732 + // });
  4733 + // }
  4734 + // }
4707 // if (success) { 4735 // if (success) {
4708 // Utils.showToast('短信已经发送成功!'); 4736 // Utils.showToast('短信已经发送成功!');
4709 // } else { 4737 // } else {
@@ -4762,29 +4790,7 @@ class InvicationPageSimState extends State<InvicationPageSim> @@ -4762,29 +4790,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
4762 showErroInfo = false; 4790 showErroInfo = false;
4763 erroInfo = ''; 4791 erroInfo = '';
4764 }); 4792 });
4765 - UserModel userModel =  
4766 - Provider.of<UserModel>(context, listen: false);  
4767 - Map<String, String?> params = {  
4768 - "rid": widget.rid,  
4769 - "sid": userModel.user!.sellerid  
4770 - };  
4771 - bool success = await couponProvider.sendSMSWxSendSms(  
4772 - context, params);  
4773 - print(success);  
4774 - if (success) {  
4775 - setState(() {  
4776 - smsTitle = '已发${couponProvider.sendSMS}次';  
4777 - });  
4778 - canSendSms = false;  
4779 - startCountdown(120);  
4780 - } else {  
4781 - if (couponProvider.errorSMS != '') {  
4782 - setState(() {  
4783 - showErroInfo = true;  
4784 - erroInfo = couponProvider.errorSMS;  
4785 - });  
4786 - }  
4787 - } 4793 + JhCommonUtils.debounce(() => _send());
4788 } 4794 }
4789 } else { 4795 } else {
4790 //显示2分钟只能发1次短信 4796 //显示2分钟只能发1次短信
@@ -65,7 +65,7 @@ class CouponProvider with ChangeNotifier { @@ -65,7 +65,7 @@ class CouponProvider with ChangeNotifier {
65 notifyListeners(); 65 notifyListeners();
66 } 66 }
67 67
68 - ///清楚选择 68 + ///清除选择
69 clearSelect() { 69 clearSelect() {
70 coupons = []; 70 coupons = [];
71 // couponsShow = []; 71 // couponsShow = [];