对接 家政服务上传评价照片/评价接口

hmxc
张萌 3 years ago
parent c932bf8cba
commit 283c469840

@ -297,6 +297,9 @@ class _Manager {
///app ///app
String get housekeepingCancel => '/user/housekeepingService/cancel'; String get housekeepingCancel => '/user/housekeepingService/cancel';
///app
String get houseKeepingEvaluation => '/user/housekeepingService/evaluation';
} }
class _Community { class _Community {
@ -417,6 +420,10 @@ class _Upload {
/// ///
String get uploadHouseKeepingPhotos => String get uploadHouseKeepingPhotos =>
'/user/upload/uploadAppHousekeepingServiceSubmitPhone'; '/user/upload/uploadAppHousekeepingServiceSubmitPhone';
///
String get uploadHouseKeepingEvaluationPhotos =>
'/user/upload/uploadAppHousekeepingServiceEvaluationPhone';
} }
class _Message { class _Message {

@ -17,8 +17,8 @@ class HouseKeepingListModel extends Equatable {
final int status; final int status;
final int? completion; final int? completion;
final String? processDescription; final String? processDescription;
final String handlerName; final String? handlerName;
final String handlerTel; final String? handlerTel;
final String? handlingTime; final String? handlingTime;
final List<ImgModel> handlerImgList; final List<ImgModel> handlerImgList;
final double? payFee; final double? payFee;
@ -38,8 +38,8 @@ class HouseKeepingListModel extends Equatable {
required this.status, required this.status,
this.completion, this.completion,
this.processDescription, this.processDescription,
required this.handlerName, this.handlerName,
required this.handlerTel, this.handlerTel,
this.handlingTime, this.handlingTime,
required this.handlerImgList, required this.handlerImgList,
this.payFee, this.payFee,

@ -18,8 +18,8 @@ HouseKeepingListModel _$HouseKeepingListModelFromJson(
status: json['status'] as int, status: json['status'] as int,
completion: json['completion'] as int?, completion: json['completion'] as int?,
processDescription: json['processDescription'] as String?, processDescription: json['processDescription'] as String?,
handlerName: json['handlerName'] as String, handlerName: json['handlerName'] as String?,
handlerTel: json['handlerTel'] as String, handlerTel: json['handlerTel'] as String?,
handlingTime: json['handlingTime'] as String?, handlingTime: json['handlingTime'] as String?,
handlerImgList: (json['handlerImgList'] as List<dynamic>) handlerImgList: (json['handlerImgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>)) .map((e) => ImgModel.fromJson(e as Map<String, dynamic>))

@ -1,5 +1,8 @@
import 'dart:io'; import 'dart:io';
import 'package:aku_community/ui/manager/house_keeping/house_keeping_func.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -9,9 +12,12 @@ import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/picker/grid_image_picker.dart'; import 'package:aku_community/widget/picker/grid_image_picker.dart';
import 'package:get/get.dart';
import 'package:power_logger/power_logger.dart';
class EvaluatePage extends StatefulWidget { class EvaluatePage extends StatefulWidget {
EvaluatePage({Key? key}) : super(key: key); final int id;
EvaluatePage({Key? key, required this.id}) : super(key: key);
@override @override
_EvaluatePageState createState() => _EvaluatePageState(); _EvaluatePageState createState() => _EvaluatePageState();
@ -106,6 +112,24 @@ class _EvaluatePageState extends State<EvaluatePage> {
}), }),
], ],
), ),
bottomNavi: BottomButton(
onPressed: () async {
Function cancel = BotToast.showLoading();
List<String> _urls = [];
try {
_urls = await HouseKeepingFunc.uploadHouseKeepingEvaluationPhotos(
_files);
bool result = await HouseKeepingFunc.houseKeepingEvaluation(
widget.id, _rating, _textEditingController.text, _urls);
if (result) {
Get.back();
}
} catch (e) {
LoggerData.addData(e);
}
cancel();
},
child: '提交'.text.size(32.sp).black.bold.make()),
); );
} }
} }

@ -42,15 +42,14 @@ class _HouseKeepingDetailPageState extends State<HouseKeepingDetailPage> {
16.w.heightBox, 16.w.heightBox,
_buildProcess(), _buildProcess(),
16.w.heightBox, 16.w.heightBox,
Offstage( if (widget.model.handlingTime != null)
offstage: widget.model.handlingTime == null, Column(
child: Column(
children: [ children: [
16.w.heightBox, 16.w.heightBox,
_serviceFeedBack(), _serviceFeedBack(),
], ],
), ),
),
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w),
color: Colors.white, color: Colors.white,
@ -66,15 +65,14 @@ class _HouseKeepingDetailPageState extends State<HouseKeepingDetailPage> {
], ],
), ),
), ),
Offstage( if (widget.model.evaluationTime != null)
offstage: widget.model.evaluationTime == null, Column(
child: Column(
children: [ children: [
16.w.heightBox, 16.w.heightBox,
_buildEvaluate(), _buildEvaluate(),
], ],
), ),
),
// 40.w.heightBox, // 40.w.heightBox,
// _background(), // _background(),
], ],
@ -93,7 +91,9 @@ class _HouseKeepingDetailPageState extends State<HouseKeepingDetailPage> {
case 5: case 5:
return BottomButton( return BottomButton(
onPressed: () { onPressed: () {
Get.to(() => EvaluatePage()); Get.to(() => EvaluatePage(
id: widget.model.id,
));
}, },
child: '立即评价'.text.size(28.sp).bold.black.make()); child: '立即评价'.text.size(28.sp).bold.black.make());
default: default:
@ -265,7 +265,7 @@ class _HouseKeepingDetailPageState extends State<HouseKeepingDetailPage> {
8.w.widthBox, 8.w.widthBox,
'维修人'.text.size(28.sp).color(ktextSubColor).make(), '维修人'.text.size(28.sp).color(ktextSubColor).make(),
Spacer(), Spacer(),
widget.model.handlerName.text.size(28.sp).black.make(), widget.model.handlerName!.text.size(28.sp).black.make(),
], ],
), ),
16.w.heightBox, 16.w.heightBox,
@ -279,7 +279,7 @@ class _HouseKeepingDetailPageState extends State<HouseKeepingDetailPage> {
8.w.widthBox, 8.w.widthBox,
'联系电话'.text.size(28.sp).color(ktextSubColor).make(), '联系电话'.text.size(28.sp).color(ktextSubColor).make(),
Spacer(), Spacer(),
widget.model.handlerTel.text.size(28.sp).black.make(), widget.model.handlerTel!.text.size(28.sp).black.make(),
], ],
), ),
16.w.heightBox, 16.w.heightBox,
@ -300,92 +300,4 @@ class _HouseKeepingDetailPageState extends State<HouseKeepingDetailPage> {
), ),
); );
} }
// int _airPlane = 1;
// int _train = 2;
// int _xxx = 3;
// int _select = 1;
// Widget _background() {
// return Center(
// child: Container(
// width: 600.w,
// height: 600.w,
// decoration: BoxDecoration(
// color: Colors.transparent,
// borderRadius: BorderRadius.circular(16.w)),
// child: Column(
// children: [
// Row(
// children: [
// _header(
// _airPlane,
// _select,
// 'aaa',
// 'left'
// ).expand(),
// _header(_train, _select, 'bbb', 'mid').expand(),
// _header(_xxx, _select, 'ccc', 'right').expand(),
// ],
// ),
// Container(
// width: double.infinity,
// alignment: Alignment.center,
// child: 'xxxxxxxx'.text.size(36.sp).black.make(),
// color: Colors.white,
// ).expand(),
// ],
// ),
// ),
// );
// }
// Widget _header(int value, int selectValue, String title, String position) {
// bool isSelect = value == selectValue;
// return Column(
// children: [
// isSelect
// ? Container(
// height: 40.w,
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.only(
// topLeft: position == 'left'
// ? Radius.zero
// : Radius.circular(20.w),
// topRight: position == 'right'
// ? Radius.zero
// : Radius.circular(20.w))),
// )
// : Container(height: 40.w, color: Colors.transparent),
// isSelect
// ? Container(
// height: 120.w,
// alignment: Alignment.center,
// width: double.infinity,
// child: title.text.size(32.sp).red500.make(),
// color: Colors.white,
// )
// : GestureDetector(
// onTap: () {
// _select = value;
// setState(() {});
// },
// child: Container(
// height: 120.w,
// width: double.infinity,
// alignment: Alignment.center,
// child: title.text.size(30.sp).black.make(),
// decoration: BoxDecoration(
// color: Colors.pinkAccent,
// borderRadius: BorderRadius.only(
// topLeft:!(position=='right')? Radius.circular(16.w):Radius.zero,
// topRight: !(position=='left')?Radius.circular(16.w):Radius.zero,
// bottomLeft: !(position=='left')?Radius.circular(16.w):Radius.zero,
// bottomRight:!(position=='right')?Radius.circular(16.w):Radius.zero)),
// ),
// ),
// ],
// );
// }
} }

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:aku_community/constants/api.dart'; import 'package:aku_community/constants/api.dart';
@ -49,4 +51,30 @@ class HouseKeepingFunc {
return false; return false;
} }
} }
///
static Future<List<String>> uploadHouseKeepingEvaluationPhotos(
List<File> files) async {
List<String> urls = await NetUtil()
.uploadFiles(files, API.upload.uploadHouseKeepingEvaluationPhotos);
if (urls.isNotEmpty) {
return urls;
} else {
return [];
}
}
///
static Future<bool> houseKeepingEvaluation(int id, int evaluation,
String evaluationContent, List<String> imgs) async {
BaseModel baseModel =
await NetUtil().post(API.manager.houseKeepingEvaluation, params: {
"id": id,
"evaluation": evaluation,
"evaluationContent": evaluationContent,
" evaluationImgUrls": imgs,
});
return baseModel.status ?? false;
}
} }

Loading…
Cancel
Save