parent
215df782fa
commit
d3673c653d
@ -0,0 +1,45 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
part 'house_keeping_process_model.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class HouseKeepingProcessModel extends Equatable {
|
||||
final int id;
|
||||
final int housekeepingServiceId;
|
||||
final String operationDate;
|
||||
final int operationType;
|
||||
@JsonKey(name: 'operator')
|
||||
final int opName;
|
||||
final int operatorType;
|
||||
final String operatorContent;
|
||||
HouseKeepingProcessModel({
|
||||
required this.id,
|
||||
required this.housekeepingServiceId,
|
||||
required this.operationDate,
|
||||
required this.operationType,
|
||||
required this.opName,
|
||||
required this.operatorType,
|
||||
required this.operatorContent,
|
||||
});
|
||||
factory HouseKeepingProcessModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$HouseKeepingProcessModelFromJson(json);
|
||||
factory HouseKeepingProcessModel.fail() => HouseKeepingProcessModel(
|
||||
id: -1,
|
||||
housekeepingServiceId: -1,
|
||||
operationDate: '',
|
||||
opName: 0,
|
||||
operationType: 0,
|
||||
operatorContent: '',
|
||||
operatorType: 1);
|
||||
@override
|
||||
List<Object> get props {
|
||||
return [
|
||||
id,
|
||||
housekeepingServiceId,
|
||||
operationDate,
|
||||
operationType,
|
||||
operatorType,
|
||||
operatorContent,
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'house_keeping_process_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
HouseKeepingProcessModel _$HouseKeepingProcessModelFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return HouseKeepingProcessModel(
|
||||
id: json['id'] as int,
|
||||
housekeepingServiceId: json['housekeepingServiceId'] as int,
|
||||
operationDate: json['operationDate'] as String,
|
||||
operationType: json['operationType'] as int,
|
||||
opName: json['operator'] as int,
|
||||
operatorType: json['operatorType'] as int,
|
||||
operatorContent: json['operatorContent'] as String,
|
||||
);
|
||||
}
|
@ -1,20 +1,51 @@
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/models/house_keeping/house_keeping_process_model.dart';
|
||||
import 'package:aku_community/utils/network/base_model.dart';
|
||||
import 'package:aku_community/utils/network/net_util.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
|
||||
class HouseKeepingFunc {
|
||||
///提交新增家政服务
|
||||
static Future submitHouseKeeping(
|
||||
int estateId,
|
||||
int type,
|
||||
String content,
|
||||
List<String> urls
|
||||
) async {
|
||||
int estateId, int type, String content, List<String> urls) async {
|
||||
BaseModel baseModel = await NetUtil().post(API.manager.submitHouseKeeping,
|
||||
params: {"estateId": estateId, "type": type, "content": content,"submitImgUrls":urls});
|
||||
params: {
|
||||
"estateId": estateId,
|
||||
"type": type,
|
||||
"content": content,
|
||||
"submitImgUrls": urls
|
||||
});
|
||||
if (baseModel.status ?? false) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
///获取家政服务进程
|
||||
static Future getHouseKeepingProcess(int id) async {
|
||||
BaseModel baseModel = await NetUtil().get(API.manager.houseKeepingProcess,
|
||||
params: {"housekeepingServiceId": id});
|
||||
if (baseModel.status ?? false) {
|
||||
return (baseModel.data as List)
|
||||
.map((e) => HouseKeepingProcessModel.fromJson(e))
|
||||
.toList();
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
///取消家政服务
|
||||
static Future cancelHouseKeepingProcess(int id) async {
|
||||
BaseModel baseModel =
|
||||
await NetUtil().get(API.manager.housekeepingCancel, params: {
|
||||
"housekeepingServiceId": id,
|
||||
});
|
||||
if (baseModel.status ?? false) {
|
||||
BotToast.showText(text: '取消成功');
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue