Commit d04993d6d63c59aac9a4a9f9100687ab342f3f8b

Authored by wdn127929
1 parent c5e456df

接口返回状态判断修改

@@ -548,7 +548,7 @@ @@ -548,7 +548,7 @@
548 CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; 548 CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements;
549 CODE_SIGN_IDENTITY = "Apple Development"; 549 CODE_SIGN_IDENTITY = "Apple Development";
550 CODE_SIGN_STYLE = Automatic; 550 CODE_SIGN_STYLE = Automatic;
551 - CURRENT_PROJECT_VERSION = 52493; 551 + CURRENT_PROJECT_VERSION = 52495;
552 DEVELOPMENT_TEAM = 8J59HM8B82; 552 DEVELOPMENT_TEAM = 8J59HM8B82;
553 ENABLE_BITCODE = NO; 553 ENABLE_BITCODE = NO;
554 FLUTTER_BUILD_MODE = release; 554 FLUTTER_BUILD_MODE = release;
@@ -696,7 +696,7 @@ @@ -696,7 +696,7 @@
696 CODE_SIGN_ENTITLEMENTS = "Runner/一键订Debug.entitlements"; 696 CODE_SIGN_ENTITLEMENTS = "Runner/一键订Debug.entitlements";
697 CODE_SIGN_IDENTITY = "Apple Development"; 697 CODE_SIGN_IDENTITY = "Apple Development";
698 CODE_SIGN_STYLE = Automatic; 698 CODE_SIGN_STYLE = Automatic;
699 - CURRENT_PROJECT_VERSION = 52493; 699 + CURRENT_PROJECT_VERSION = 52495;
700 DEVELOPMENT_TEAM = 8J59HM8B82; 700 DEVELOPMENT_TEAM = 8J59HM8B82;
701 ENABLE_BITCODE = NO; 701 ENABLE_BITCODE = NO;
702 FLUTTER_BUILD_MODE = debug; 702 FLUTTER_BUILD_MODE = debug;
@@ -732,7 +732,7 @@ @@ -732,7 +732,7 @@
732 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 732 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
733 CODE_SIGN_IDENTITY = "Apple Development"; 733 CODE_SIGN_IDENTITY = "Apple Development";
734 CODE_SIGN_STYLE = Automatic; 734 CODE_SIGN_STYLE = Automatic;
735 - CURRENT_PROJECT_VERSION = 52493; 735 + CURRENT_PROJECT_VERSION = 52495;
736 DEVELOPMENT_TEAM = 8J59HM8B82; 736 DEVELOPMENT_TEAM = 8J59HM8B82;
737 ENABLE_BITCODE = NO; 737 ENABLE_BITCODE = NO;
738 FLUTTER_BUILD_MODE = release; 738 FLUTTER_BUILD_MODE = release;
  1 +import 'dart:convert';
  2 +
1 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
2 import 'package:one_key/constant/constant.dart'; 4 import 'package:one_key/constant/constant.dart';
3 import 'package:one_key/constant/error.dart'; 5 import 'package:one_key/constant/error.dart';
@@ -126,7 +128,8 @@ class CouponProvider with ChangeNotifier { @@ -126,7 +128,8 @@ class CouponProvider with ChangeNotifier {
126 BuildContext context, Map<String, String> params, 128 BuildContext context, Map<String, String> params,
127 {isShowLoading = true}) async { 129 {isShowLoading = true}) async {
128 BaseResp<dynamic> baseResp = await DioUtil() 130 BaseResp<dynamic> baseResp = await DioUtil()
129 - .request<dynamic>(context, Method.post, HttpUrl.create_customer_activity, 131 + .request<dynamic>(
  132 + context, Method.post, HttpUrl.create_customer_activity,
130 data: params, showLoading: isShowLoading) 133 data: params, showLoading: isShowLoading)
131 .catchError((error) { 134 .catchError((error) {
132 print(error.toString()); 135 print(error.toString());
@@ -151,7 +154,7 @@ class CouponProvider with ChangeNotifier { @@ -151,7 +154,7 @@ class CouponProvider with ChangeNotifier {
151 // pageState = PageState.ConnectivityError; 154 // pageState = PageState.ConnectivityError;
152 return false; 155 return false;
153 } else { 156 } else {
154 - couponId = baseResp.data['id']; 157 + couponId = baseResp.data['id'];
155 // pageState = PageState.Success; 158 // pageState = PageState.Success;
156 return true; 159 return true;
157 } 160 }
@@ -167,8 +170,6 @@ class CouponProvider with ChangeNotifier { @@ -167,8 +170,6 @@ class CouponProvider with ChangeNotifier {
167 } 170 }
168 } 171 }
169 172
170 -  
171 -  
172 // 173 //
173 174
174 ///客户经理获取所创建活动列表 175 ///客户经理获取所创建活动列表
@@ -749,7 +750,8 @@ class CouponProvider with ChangeNotifier { @@ -749,7 +750,8 @@ class CouponProvider with ChangeNotifier {
749 BuildContext context, Map<String, String> params, 750 BuildContext context, Map<String, String> params,
750 {isShowLoading = true}) async { 751 {isShowLoading = true}) async {
751 BaseResp<dynamic> baseResp = await DioUtil() 752 BaseResp<dynamic> baseResp = await DioUtil()
752 - .request<dynamic>(context, Method.post, HttpUrl.get_order_recharge_by_id, 753 + .request<dynamic>(
  754 + context, Method.post, HttpUrl.get_order_recharge_by_id,
753 data: params, showLoading: isShowLoading) 755 data: params, showLoading: isShowLoading)
754 .catchError((error) { 756 .catchError((error) {
755 print(error.toString()); 757 print(error.toString());
@@ -785,9 +787,25 @@ class CouponProvider with ChangeNotifier { @@ -785,9 +787,25 @@ class CouponProvider with ChangeNotifier {
785 if (error is MyError) {} 787 if (error is MyError) {}
786 }); 788 });
787 if (baseResp.code == Constant.status_success) { 789 if (baseResp.code == Constant.status_success) {
788 - Utils.showToast("短信发送成功");  
789 - sendSMS++;  
790 - return true; 790 + if (baseResp.data is String) {
  791 + if (jsonDecode(baseResp.data)['status'] == 'success') {
  792 + Utils.showToast("短信发送成功");
  793 + sendSMS++;
  794 + return true;
  795 + } else if (jsonDecode(baseResp.data)['status'] == '2') {
  796 + Utils.showToast("订单已到店,不可发送短信!");
  797 +
  798 + return false;
  799 + } else if (jsonDecode(baseResp.data)['status'] == '4') {
  800 + Utils.showToast("订单已取消,不可发送短信!");
  801 +
  802 + return false;
  803 + } else {
  804 + Utils.showToast("发送失败,请稍后重试!");
  805 +
  806 + return false;
  807 + }
  808 + }
791 } else { 809 } else {
792 if (baseResp.code == 396) { 810 if (baseResp.code == 396) {
793 //余量不足 811 //余量不足