|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:one_key/constant/constant.dart';
|
|
|
|
import 'package:one_key/constant/error.dart';
|
|
...
|
...
|
@@ -126,7 +128,8 @@ class CouponProvider with ChangeNotifier { |
|
|
|
BuildContext context, Map<String, String> params,
|
|
|
|
{isShowLoading = true}) async {
|
|
|
|
BaseResp<dynamic> baseResp = await DioUtil()
|
|
|
|
.request<dynamic>(context, Method.post, HttpUrl.create_customer_activity,
|
|
|
|
.request<dynamic>(
|
|
|
|
context, Method.post, HttpUrl.create_customer_activity,
|
|
|
|
data: params, showLoading: isShowLoading)
|
|
|
|
.catchError((error) {
|
|
|
|
print(error.toString());
|
|
...
|
...
|
@@ -151,7 +154,7 @@ class CouponProvider with ChangeNotifier { |
|
|
|
// pageState = PageState.ConnectivityError;
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
couponId = baseResp.data['id'];
|
|
|
|
couponId = baseResp.data['id'];
|
|
|
|
// pageState = PageState.Success;
|
|
|
|
return true;
|
|
|
|
}
|
|
...
|
...
|
@@ -167,8 +170,6 @@ class CouponProvider with ChangeNotifier { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
///客户经理获取所创建活动列表
|
|
...
|
...
|
@@ -749,7 +750,8 @@ class CouponProvider with ChangeNotifier { |
|
|
|
BuildContext context, Map<String, String> params,
|
|
|
|
{isShowLoading = true}) async {
|
|
|
|
BaseResp<dynamic> baseResp = await DioUtil()
|
|
|
|
.request<dynamic>(context, Method.post, HttpUrl.get_order_recharge_by_id,
|
|
|
|
.request<dynamic>(
|
|
|
|
context, Method.post, HttpUrl.get_order_recharge_by_id,
|
|
|
|
data: params, showLoading: isShowLoading)
|
|
|
|
.catchError((error) {
|
|
|
|
print(error.toString());
|
|
...
|
...
|
@@ -785,9 +787,25 @@ class CouponProvider with ChangeNotifier { |
|
|
|
if (error is MyError) {}
|
|
|
|
});
|
|
|
|
if (baseResp.code == Constant.status_success) {
|
|
|
|
Utils.showToast("短信发送成功");
|
|
|
|
sendSMS++;
|
|
|
|
return true;
|
|
|
|
if (baseResp.data is String) {
|
|
|
|
if (jsonDecode(baseResp.data)['status'] == 'success') {
|
|
|
|
Utils.showToast("短信发送成功");
|
|
|
|
sendSMS++;
|
|
|
|
return true;
|
|
|
|
} else if (jsonDecode(baseResp.data)['status'] == '2') {
|
|
|
|
Utils.showToast("订单已到店,不可发送短信!");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
} else if (jsonDecode(baseResp.data)['status'] == '4') {
|
|
|
|
Utils.showToast("订单已取消,不可发送短信!");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
Utils.showToast("发送失败,请稍后重试!");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (baseResp.code == 396) {
|
|
|
|
//余量不足
|
...
|
...
|
|