online_check_edit_provider.dart
4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/constant/error.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/new_reserve_list_model.dart';
import 'package:one_key/models/order_info_model.dart';
import 'package:one_key/models/qiniu_info_model.dart';
import 'package:one_key/models/upload_img_model.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/utils/utils.dart';
class OnlineCheckEditProvider extends ChangeNotifier {
// List<UploadImgModel> imageList = []; //图片信息列表
// List<String> imageQiniuUrlList = []; //七牛云地址列表
// QiniuInfoSunModel qiniuInfoSunModel;
OrderInfoSunModel? orderInfoSunModel;
List<NewReserveListSunModel>? reserveList = [];
/// 获取七牛上传token信息
// Future<QiniuInfoSunModel> getQiniuInfo(
// BuildContext context, Map<String, String> params,
// {isShowLoading = true}) async {
// BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
// .request<Map<String, dynamic>>(
// context, Method.post, HttpUrl.get_qiniu_info,
// data: params, showLoading: false)
// !!.catchError((error) {});
// if (baseResp.code == Constant.status_success) {
// if (baseResp.data.isEmpty) {
// } else {
// //解析解析
// qiniuInfoSunModel = QiniuInfoModel.fromJson(baseResp.responseData).data;
// return qiniuInfoSunModel;
// }
// } else {
// if (baseResp != null) {
// Utils.showToast(baseResp.msg ?? "");
// }
// }
// }
///获取账单详情
getOrderInfo(BuildContext context, Map<String, String?> params,
{isShowLoading = true}) async {
try {
BaseResp<Map<String, dynamic>?> baseResp = await DioUtil()
.request<Map<String, dynamic>>(
context, Method.post, HttpUrl.get_order_info,
data: params, showLoading: false);
if (baseResp.code == Constant.status_success) {
if (baseResp.data == null) {
} else {
//解析解析
orderInfoSunModel = OrderInfoModel.fromJson(
baseResp.responseData as Map<String, dynamic>)
.data;
}
notifyListeners();
} else {
Utils.showToast(baseResp.msg ?? "");
}
} catch (error) {}
}
///商家确认账单
updateOrderInfo(BuildContext context, Map<String, String?> params,
{isShowLoading = true}) async {
try {
BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
context, Method.post, HttpUrl.update_order_info,
data: params, showLoading: isShowLoading);
if (baseResp.code == Constant.status_success) {
//解析解析
if (baseResp.data == 1) {
print('成功');
return true;
} else {
Utils.showToast(baseResp.msg ?? "");
}
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
} catch (error) {}
}
//商家预订本列表【2019-11-26】
getNewReserveList(BuildContext context, Map<String, String> params) async {
try {
BaseResp<List?> baseResp = await DioUtil().request<List>(
context, Method.post, HttpUrl.new_get_reserve_list,
data: params, showLoading: false);
if (baseResp.code == Constant.status_success) {
if (baseResp.data!.isEmpty) {
} else {
//解析解析
reserveList = NewReserveListModel.fromJson(
baseResp.responseData as Map<String, dynamic>)
.data!
.cast<NewReserveListSunModel>();
}
notifyListeners();
} else {
Utils.showToast(baseResp.msg ?? "");
}
} catch (error) {
print(error.toString());
if (error is MyError) {
// switch (error.type) {
// case 1:
// pageState = PageState.ConnectivityError;
// break;
// case 2:
// pageState = PageState.ConnectivityTimeOut;
// break;
// default:
// pageState = PageState.ConnectivityError;
// break;
// }
}
notifyListeners();
}
}
}