|
|
|
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
|
//余量不足
|