|
@@ -1,10 +1,21 @@
|
|
|
import 'package:domain/constants/api_constants.dart';
|
|
|
+import 'package:domain/entity/garage_sale_history_entity.dart';
|
|
|
import 'package:domain/entity/garage_sale_rent_detail_entity.dart';
|
|
|
import 'package:domain/entity/garage_sale_rent_entity.dart';
|
|
|
import 'package:domain/entity/myposts_sale_rent_entity.dart';
|
|
|
import 'package:domain/entity/newsfeed_foryou_entity.dart';
|
|
|
import 'package:domain/entity/newsfeed_news_entity.dart';
|
|
|
+import 'package:domain/entity/paid_service_detail_entity.dart';
|
|
|
+import 'package:domain/entity/paid_service_entity.dart';
|
|
|
+import 'package:domain/entity/paid_service_pay_success_info_entity.dart';
|
|
|
+import 'package:domain/entity/repair_service_entity.dart';
|
|
|
import 'package:domain/entity/server_time.dart';
|
|
|
+import 'package:domain/entity/service_category_entity.dart';
|
|
|
+import 'package:domain/entity/service_in_progress_entity.dart';
|
|
|
+import 'package:domain/entity/service_time_period_entity.dart';
|
|
|
+import 'package:domain/entity/service_order_detail_entity.dart';
|
|
|
+import 'package:domain/entity/service_evaluate_list_entity.dart';
|
|
|
+import 'package:domain/entity/service_repair_detail_entity.dart';
|
|
|
import 'package:plugin_platform/engine/toast/toast_engine.dart';
|
|
|
import 'package:plugin_platform/platform_export.dart';
|
|
|
import 'package:plugin_platform/http/dio_engine.dart';
|
|
@@ -16,7 +27,6 @@ import 'package:shared/utils/util.dart';
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
import 'package:plugin_basic/provider/http_provider/http_provider.dart';
|
|
|
|
|
|
-
|
|
|
part 'services_respository.g.dart';
|
|
|
|
|
|
@Riverpod(keepAlive: true)
|
|
@@ -35,9 +45,9 @@ class ServicesRespository {
|
|
|
|
|
|
//服务 获取 分类 字典
|
|
|
Future<HttpResult<Object>> fetchServiceCateGoryList(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
@@ -50,20 +60,22 @@ class ServicesRespository {
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
method: HttpMethod.GET,
|
|
|
- isShowLoadingDialog: true, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: true,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
|
|
|
//根据返回的结果,封装原始数据为Bean/Entity对象
|
|
|
if (result.isSuccess) {
|
|
|
//重新赋值data或list
|
|
|
- final json = result.getDataJson();
|
|
|
- // var data = NewsfeedForyouEntity.fromJson(json!);
|
|
|
+ final listJson = result.getListJson();
|
|
|
+ var listData = listJson!.map((e) => ServiceCategoryEntity.fromJson(e!)).toList();
|
|
|
//重新赋值data或list
|
|
|
- return result.convert(data: json);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
+ return result.convert(list: listData);
|
|
|
+ }else {
|
|
|
+ if (result.errorMsg != null && result.errorMsg!.isNotEmpty) {
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
|
}
|
|
|
}
|
|
@@ -72,9 +84,9 @@ class ServicesRespository {
|
|
|
|
|
|
// 付费服务 获取 列表
|
|
|
Future<HttpResult<Object>> fetchPaidServiceDataList(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
@@ -82,13 +94,14 @@ class ServicesRespository {
|
|
|
headers["Accept"] = "application/x.yyjobs-api.v1+json";
|
|
|
|
|
|
final result = await dioEngine.requestNetResult(
|
|
|
- // ApiConstants.apiServerTime, // api 地址
|
|
|
'/api/v1/user/service/paid-service/index', // api 地址
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
method: HttpMethod.GET,
|
|
|
- isShowLoadingDialog: false, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: false,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
|
|
@@ -96,60 +109,58 @@ class ServicesRespository {
|
|
|
if (result.isSuccess) {
|
|
|
//重新赋值data或list
|
|
|
final json = result.getDataJson();
|
|
|
- var data = GarageSaleRentEntity.fromJson(json!);
|
|
|
+ var data = PaidServiceEntity.fromJson(json!);
|
|
|
//重新赋值data或list
|
|
|
return result.convert(data: data);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
+ } else {
|
|
|
+ if (result.errorMsg != null && result.errorMsg!.isNotEmpty) {
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
|
}
|
|
|
}
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 付费/维修 服务 列表 点赞/取消点赞
|
|
|
Future<HttpResult<Object>> fetchServiceLiked(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
|
- headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
|
- headers["Accept"] = "application/x.yyjobs-api.v1+json";
|
|
|
+ // headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
|
+ // headers["Accept"] = "application/x.yyjobs-api.v1+json";
|
|
|
|
|
|
final result = await dioEngine.requestNetResult(
|
|
|
- // ApiConstants.apiServerTime, // api 地址
|
|
|
- '/api/v1/user/service/paid-service/liked', // api 地址
|
|
|
+ '/api/v1/user/service/like/click', // api 地址
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
method: HttpMethod.POST,
|
|
|
- isShowLoadingDialog: true, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: true,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
//根据返回的结果,封装原始数据为Bean/Entity对象
|
|
|
if (result.isSuccess) {
|
|
|
//重新赋值data或list
|
|
|
- final json = result.getDataDynamic();
|
|
|
- // var data = NewsfeedForyouEntity.fromJson(json!);
|
|
|
+ final boolData = result.getDataDynamic();
|
|
|
//重新赋值data或list
|
|
|
- return result.convert(data: json);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
+ return result.convert(data: boolData);
|
|
|
+ } else {
|
|
|
+ if (result.errorMsg != null && result.errorMsg!.isNotEmpty) {
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
|
}
|
|
|
}
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 提交评价
|
|
|
Future<HttpResult<Object>> fetchPublishEvaluation(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
@@ -174,8 +185,10 @@ class ServicesRespository {
|
|
|
paths: files,
|
|
|
headers: headers,
|
|
|
method: HttpMethod.POST,
|
|
|
- isShowLoadingDialog: true, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: true,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
//根据返回的结果,封装原始数据为Bean/Entity对象
|
|
@@ -185,20 +198,19 @@ class ServicesRespository {
|
|
|
// var data = NewsfeedForyouEntity.fromJson(json!);
|
|
|
//重新赋值data或list
|
|
|
return result.convert(data: json);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
+ } else {
|
|
|
+ if (result.errorMsg != null && result.errorMsg!.isNotEmpty) {
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
|
}
|
|
|
}
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 评价列表
|
|
|
Future<HttpResult<Object>> fetchEvaluationDataList(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
@@ -211,8 +223,10 @@ class ServicesRespository {
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
method: HttpMethod.GET,
|
|
|
- isShowLoadingDialog: false, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: false,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
|
|
@@ -220,11 +234,11 @@ class ServicesRespository {
|
|
|
if (result.isSuccess) {
|
|
|
//重新赋值data或list
|
|
|
final json = result.getDataJson();
|
|
|
- var data = GarageSaleRentEntity.fromJson(json!);
|
|
|
+ var data = ServiceEvaluateListEntity.fromJson(json!);
|
|
|
//重新赋值data或list
|
|
|
return result.convert(data: data);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
+ } else {
|
|
|
+ if (result.errorMsg != null && result.errorMsg!.isNotEmpty) {
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
|
}
|
|
|
}
|
|
@@ -233,9 +247,9 @@ class ServicesRespository {
|
|
|
|
|
|
// 获取 付费服务 详情信息
|
|
|
Future<HttpResult<Object>> fetchPaidServiceCleanDetailInfo(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
@@ -243,13 +257,14 @@ class ServicesRespository {
|
|
|
// headers["Accept"] = "application/x.yyjobs-api.v1+json";
|
|
|
|
|
|
final result = await dioEngine.requestNetResult(
|
|
|
- // ApiConstants.apiServerTime, // api 地址
|
|
|
'/api/v1/user/service/paid-service/detail', // api 地址
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
method: HttpMethod.GET,
|
|
|
- isShowLoadingDialog: false, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: false,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
|
|
@@ -257,9 +272,9 @@ class ServicesRespository {
|
|
|
if (result.isSuccess) {
|
|
|
//重新赋值data或list
|
|
|
final json = result.getDataJson();
|
|
|
- // var data = GarageSaleRentDetailEntity.fromJson(json!);
|
|
|
+ var data = PaidServiceDetailEntity.fromJson(json!);
|
|
|
//重新赋值data或list
|
|
|
- return result.convert(data: json);
|
|
|
+ return result.convert(data: data);
|
|
|
}else {
|
|
|
if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
@@ -268,34 +283,34 @@ class ServicesRespository {
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
- // 付费服务 下单
|
|
|
- Future<HttpResult<Object>> fetchPaidServiceBook(
|
|
|
+ // 获取 付费服务 时间段
|
|
|
+ Future<HttpResult<Object>> fetchPaidServiceTimePeriod(
|
|
|
Map<String, dynamic>? data, {
|
|
|
CancelToken? cancelToken,
|
|
|
}) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
|
- headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
|
- headers["Accept"] = "application/x.yyjobs-api.v1+json";
|
|
|
+ // headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
|
+ // headers["Accept"] = "application/x.yyjobs-api.v1+json";
|
|
|
|
|
|
final result = await dioEngine.requestNetResult(
|
|
|
- // ApiConstants.apiServerTime, // api 地址
|
|
|
- '/api/v1/user/service/paid-service-order/book', // api 地址
|
|
|
+ '/api/v1/user/service/paid-service/time-period', // api 地址
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
- method: HttpMethod.POST,
|
|
|
- isShowLoadingDialog: true, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ method: HttpMethod.GET,
|
|
|
+ isShowLoadingDialog: false, //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: false, //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
+
|
|
|
//根据返回的结果,封装原始数据为Bean/Entity对象
|
|
|
if (result.isSuccess) {
|
|
|
//重新赋值data或list
|
|
|
- final json = result.getDataJson();
|
|
|
- // var data = NewsfeedForyouEntity.fromJson(json!);
|
|
|
+ final list = result.getListJson();
|
|
|
+ List<ServiceTimePeriodEntity> listEntity= list!.map((e)=>ServiceTimePeriodEntity.fromJson(e)).toList();
|
|
|
//重新赋值data或list
|
|
|
- return result.convert(data: json);
|
|
|
+ return result.convert(list: listEntity);
|
|
|
}else {
|
|
|
if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
@@ -304,12 +319,11 @@ class ServicesRespository {
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- // 付费服务 订单列表
|
|
|
- Future<HttpResult<Object>> fetchPaidServiceOrderList(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ // 付费服务 下单
|
|
|
+ Future<HttpResult<Object>> fetchPaidServiceBook(
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
@@ -318,74 +332,93 @@ class ServicesRespository {
|
|
|
|
|
|
final result = await dioEngine.requestNetResult(
|
|
|
// ApiConstants.apiServerTime, // api 地址
|
|
|
- '/api/v1/user/service/paid-service-order/index', // api 地址
|
|
|
+ '/api/v1/user/service/paid-service-order/book', // api 地址
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
- method: HttpMethod.GET,
|
|
|
- isShowLoadingDialog: false, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ method: HttpMethod.POST,
|
|
|
+ isShowLoadingDialog: true,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
-
|
|
|
//根据返回的结果,封装原始数据为Bean/Entity对象
|
|
|
if (result.isSuccess) {
|
|
|
//重新赋值data或list
|
|
|
final json = result.getDataJson();
|
|
|
- var data = GarageSaleRentEntity.fromJson(json!);
|
|
|
+ var data = PaidServicePaySuccessInfoEntity.fromJson(json!);
|
|
|
//重新赋值data或list
|
|
|
- return result.convert(data: data);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
+ return result.convert(data: json);
|
|
|
+ } else {
|
|
|
+ if (result.errorMsg != null && result.errorMsg!.isNotEmpty) {
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
|
}
|
|
|
}
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
+ // 付费服务 订单列表
|
|
|
+ Future<HttpResult<GarageSaleHistoryEntity>> fetchPaidServiceOrderList({
|
|
|
+ required String type,
|
|
|
+ required int curPage,
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
+ Map<String, String> params = {};
|
|
|
+ params['type'] = type;
|
|
|
+ params['page'] = curPage.toString();
|
|
|
+ params['limit'] = "10";
|
|
|
+
|
|
|
+ final result = await dioEngine.requestNetResult(
|
|
|
+ '/api/v1/user/service/paid-service-order/index',
|
|
|
+ params: params,
|
|
|
+ method: HttpMethod.GET,
|
|
|
+ isShowLoadingDialog: false,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
+ cancelToken: cancelToken,
|
|
|
+ );
|
|
|
+
|
|
|
+ if (result.isSuccess) {
|
|
|
+ final json = result.getDataJson();
|
|
|
+ var data = GarageSaleHistoryEntity.fromJson(json!);
|
|
|
+ return result.convert<GarageSaleHistoryEntity>(data: data);
|
|
|
+ }
|
|
|
+ return result.convert();
|
|
|
+ }
|
|
|
|
|
|
// 获取 付费服务 订单详情
|
|
|
- Future<HttpResult<Object>> fetchPaidServiceCleanOrderDetailInfo(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Future<HttpResult<ServiceOrderDetailEntity>> fetchPaidServiceCleanOrderDetail({
|
|
|
+ required String id,
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
- params = data!;
|
|
|
- Map<String, String> headers = {};
|
|
|
- // headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
|
- // headers["Accept"] = "application/x.yyjobs-api.v1+json";
|
|
|
+ params['id'] = id;
|
|
|
|
|
|
final result = await dioEngine.requestNetResult(
|
|
|
- // ApiConstants.apiServerTime, // api 地址
|
|
|
- '/api/v1/user/service/paid-service-order/detail', // api 地址
|
|
|
+ '/api/v1/user/service/paid-service-order/detail',
|
|
|
params: params,
|
|
|
- headers: headers,
|
|
|
method: HttpMethod.GET,
|
|
|
- isShowLoadingDialog: false, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: false,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
|
|
|
- //根据返回的结果,封装原始数据为Bean/Entity对象
|
|
|
if (result.isSuccess) {
|
|
|
- //重新赋值data或list
|
|
|
final json = result.getDataJson();
|
|
|
- // var data = GarageSaleRentDetailEntity.fromJson(json!);
|
|
|
- //重新赋值data或list
|
|
|
- return result.convert(data: json);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
- ToastEngine.show("${result.errorMsg}");
|
|
|
- }
|
|
|
+ var data = ServiceOrderDetailEntity.fromJson(json!);
|
|
|
+ return result.convert<ServiceOrderDetailEntity>(data: data);
|
|
|
}
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 获取 付费订单实际需要支付的价格
|
|
|
Future<HttpResult<Object>> fetchPaidServiceCleanOrderPrice(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
@@ -398,8 +431,10 @@ class ServicesRespository {
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
method: HttpMethod.GET,
|
|
|
- isShowLoadingDialog: false, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: false,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
|
|
@@ -410,60 +445,46 @@ class ServicesRespository {
|
|
|
// var data = GarageSaleRentDetailEntity.fromJson(json!);
|
|
|
//重新赋值data或list
|
|
|
return result.convert(data: json);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
+ } else {
|
|
|
+ if (result.errorMsg != null && result.errorMsg!.isNotEmpty) {
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
|
}
|
|
|
}
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 付费服务 取消订单
|
|
|
- Future<HttpResult<Object>> fetchCancelPaidServiceOrder(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
- Map<String, dynamic> params = {};
|
|
|
- params = data!;
|
|
|
- Map<String, String> headers = {};
|
|
|
- headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
|
- headers["Accept"] = "application/x.yyjobs-api.v1+json";
|
|
|
+ Future<HttpResult> fetchCancelPaidServiceOrder({
|
|
|
+ required String? id,
|
|
|
+ required String? reason,
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
+ Map<String, String> params = {};
|
|
|
+ params['id'] = id ?? "";
|
|
|
+ params['cancel_reason'] = reason ?? "";
|
|
|
|
|
|
final result = await dioEngine.requestNetResult(
|
|
|
- // ApiConstants.apiServerTime, // api 地址
|
|
|
- '/api/v1/user/service/paid-service-order/cancel', // api 地址
|
|
|
+ '/api/v1/user/service/paid-service-order/cancel',
|
|
|
params: params,
|
|
|
- headers: headers,
|
|
|
method: HttpMethod.POST,
|
|
|
- isShowLoadingDialog: true, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: true,
|
|
|
+ networkDebounce: true,
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
- //根据返回的结果,封装原始数据为Bean/Entity对象
|
|
|
+
|
|
|
if (result.isSuccess) {
|
|
|
- //重新赋值data或list
|
|
|
- final json = result.getDataJson();
|
|
|
- // var data = NewsfeedForyouEntity.fromJson(json!);
|
|
|
- //重新赋值data或list
|
|
|
- return result.convert(data: json);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
- ToastEngine.show("${result.errorMsg}");
|
|
|
- }
|
|
|
+ return result.convert();
|
|
|
}
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
///-------------------咨询类---------------------------------
|
|
|
|
|
|
-
|
|
|
// 维修服务 列表
|
|
|
Future<HttpResult<Object>> fetchRepairServiceList(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
@@ -476,8 +497,10 @@ class ServicesRespository {
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
method: HttpMethod.GET,
|
|
|
- isShowLoadingDialog: false, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: false,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
|
|
@@ -485,11 +508,11 @@ class ServicesRespository {
|
|
|
if (result.isSuccess) {
|
|
|
//重新赋值data或list
|
|
|
final json = result.getDataJson();
|
|
|
- var data = GarageSaleRentEntity.fromJson(json!);
|
|
|
+ var data = RepairServiceEntity.fromJson(json!);
|
|
|
//重新赋值data或list
|
|
|
return result.convert(data: data);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
+ } else {
|
|
|
+ if (result.errorMsg != null && result.errorMsg!.isNotEmpty) {
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
|
}
|
|
|
}
|
|
@@ -498,9 +521,9 @@ class ServicesRespository {
|
|
|
|
|
|
// 获取 repair 详情信息
|
|
|
Future<HttpResult<Object>> fetchServiceRepairDetailInfo(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
@@ -513,8 +536,10 @@ class ServicesRespository {
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
method: HttpMethod.GET,
|
|
|
- isShowLoadingDialog: false, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: false,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
|
|
@@ -522,23 +547,22 @@ class ServicesRespository {
|
|
|
if (result.isSuccess) {
|
|
|
//重新赋值data或list
|
|
|
final json = result.getDataJson();
|
|
|
- var data = GarageSaleRentDetailEntity.fromJson(json!);
|
|
|
+ var data = ServiceRepairDetailEntity.fromJson(json!);
|
|
|
//重新赋值data或list
|
|
|
return result.convert(data: data);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
+ } else {
|
|
|
+ if (result.errorMsg != null && result.errorMsg!.isNotEmpty) {
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
|
}
|
|
|
}
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 维修服务 提交咨询
|
|
|
Future<HttpResult<Object>> fetchRepairServiceSubmit(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
+ Map<String, dynamic>? data, {
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
Map<String, dynamic> params = {};
|
|
|
params = data!;
|
|
|
Map<String, String> headers = {};
|
|
@@ -551,8 +575,10 @@ class ServicesRespository {
|
|
|
params: params,
|
|
|
headers: headers,
|
|
|
method: HttpMethod.POST,
|
|
|
- isShowLoadingDialog: true, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: true,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
//根据返回的结果,封装原始数据为Bean/Entity对象
|
|
@@ -562,51 +588,41 @@ class ServicesRespository {
|
|
|
// var data = NewsfeedForyouEntity.fromJson(json!);
|
|
|
//重新赋值data或list
|
|
|
return result.convert(data: json);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
+ } else {
|
|
|
+ if (result.errorMsg != null && result.errorMsg!.isNotEmpty) {
|
|
|
ToastEngine.show("${result.errorMsg}");
|
|
|
}
|
|
|
}
|
|
|
return result.convert();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 维修服务 订单列表
|
|
|
- Future<HttpResult<Object>> fetchRepairServiceOrderList(
|
|
|
- Map<String, dynamic>? data, {
|
|
|
- CancelToken? cancelToken,
|
|
|
- }) async {
|
|
|
- Map<String, dynamic> params = {};
|
|
|
- params = data!;
|
|
|
- Map<String, String> headers = {};
|
|
|
- headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
|
- headers["Accept"] = "application/x.yyjobs-api.v1+json";
|
|
|
+ Future<HttpResult<ServiceInProgressEntity>> fetchRepairServiceOrderList({
|
|
|
+ required int status,
|
|
|
+ required int curPage,
|
|
|
+ CancelToken? cancelToken,
|
|
|
+ }) async {
|
|
|
+ Map<String, String> params = {};
|
|
|
+ params['status'] = status.toString();
|
|
|
+ params['page'] = curPage.toString();
|
|
|
+ params['limit'] = "10";
|
|
|
|
|
|
final result = await dioEngine.requestNetResult(
|
|
|
- // ApiConstants.apiServerTime, // api 地址
|
|
|
- '/api/v1/user/service/inquiry-service-order/index', // api 地址
|
|
|
+ '/api/v1/user/service/inquiry-service-order/index',
|
|
|
params: params,
|
|
|
- headers: headers,
|
|
|
method: HttpMethod.GET,
|
|
|
- isShowLoadingDialog: false, //是否展示默认的Loading弹窗
|
|
|
- networkDebounce: true, //是否防抖防止重复请求
|
|
|
+ isShowLoadingDialog: false,
|
|
|
+ //是否展示默认的Loading弹窗
|
|
|
+ networkDebounce: true,
|
|
|
+ //是否防抖防止重复请求
|
|
|
cancelToken: cancelToken,
|
|
|
);
|
|
|
|
|
|
- //根据返回的结果,封装原始数据为Bean/Entity对象
|
|
|
if (result.isSuccess) {
|
|
|
- //重新赋值data或list
|
|
|
final json = result.getDataJson();
|
|
|
- var data = GarageSaleRentEntity.fromJson(json!);
|
|
|
- //重新赋值data或list
|
|
|
- return result.convert(data: data);
|
|
|
- }else {
|
|
|
- if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
|
|
|
- ToastEngine.show("${result.errorMsg}");
|
|
|
- }
|
|
|
+ var data = ServiceInProgressEntity.fromJson(json!);
|
|
|
+ return result.convert<ServiceInProgressEntity>(data: data);
|
|
|
}
|
|
|
return result.convert();
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|