|
@@ -1,5 +1,6 @@
|
|
|
import 'package:cpt_services/components/chooseAirConditionContent.dart';
|
|
|
import 'package:cs_resources/generated/assets.dart';
|
|
|
+import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
|
import 'package:domain/entity/garage_sale_rent_detail_entity.dart';
|
|
|
import 'package:domain/entity/service_repair_detail_entity.dart';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
@@ -12,13 +13,16 @@ import 'package:router/ext/auto_router_extensions.dart';
|
|
|
import 'package:shared/utils/color_utils.dart';
|
|
|
import 'package:shared/utils/log_utils.dart';
|
|
|
import 'package:widgets/dialog/app_custom_dialog.dart';
|
|
|
+import 'package:widgets/dialog/dialog_content_wrap.dart';
|
|
|
import 'package:widgets/load_state_layout.dart';
|
|
|
+import 'package:widgets/my_button.dart';
|
|
|
import 'package:widgets/my_text_view.dart';
|
|
|
import 'package:widgets/widget_export.dart';
|
|
|
import 'package:flutter/src/widgets/framework.dart';
|
|
|
|
|
|
import '../../../respository/services_respository.dart';
|
|
|
import '../../../router/page/services_page_router.dart';
|
|
|
+import 'getQuoteDialogContent.dart';
|
|
|
import 'service_repair_detail_state.dart';
|
|
|
|
|
|
part 'service_repair_detail_vm.g.dart';
|
|
@@ -251,13 +255,108 @@ class ServiceRepairDetailVm extends _$ServiceRepairDetailVm {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- Future RepairServiceSubmit<T>(
|
|
|
+ changeGetQuoteFormData(BuildContext context,String userNotes){
|
|
|
+ state = state.copyWith(
|
|
|
+ userNotes: userNotes,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取 报价备注信息
|
|
|
+ String getUserNotes(){
|
|
|
+ String userNotes = "";
|
|
|
+ if(state.getQuoteFormData != null){
|
|
|
+ userNotes = state.getQuoteFormData!["userNotes"]!['controller'].text;
|
|
|
+ }
|
|
|
+ Log.d("报价备注信息: $userNotes");
|
|
|
+ return userNotes;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 提交 报价
|
|
|
+ void handlerGetQuote(BuildContext context, int id) async {
|
|
|
+ DialogEngine.show(
|
|
|
+ tag: "getQuote",
|
|
|
+ position: DialogPosition.center,
|
|
|
+ onDismiss: () {
|
|
|
+ // 清空报价备注信息
|
|
|
+ clearUserNotesInput();
|
|
|
+ },
|
|
|
+ widget: DialogContentWrap(
|
|
|
+ loadingState: LoadState.State_Success,
|
|
|
+ maxHeight: 400.0,
|
|
|
+ dialogWidth: 345.0,
|
|
|
+ isShowConfirmBtn: false,
|
|
|
+ isShowCancelBtn: false,
|
|
|
+ confirmTxt: "Confirm",
|
|
|
+ title: "Confirm Information",
|
|
|
+ titleBackgroundColor: context.appColors.textPrimary,
|
|
|
+ closeIconColor: context.appColors.textWhite,
|
|
|
+ titleTextStyle: TextStyle(
|
|
|
+ color: context.appColors.textWhite,
|
|
|
+ ),
|
|
|
+ messageBuilder: (context) {
|
|
|
+ return const GetQuoteDialogContent();
|
|
|
+ },
|
|
|
+ bottomFooterBuilder: (context) {
|
|
|
+ return Padding(
|
|
|
+ padding: const EdgeInsets.only(bottom: 40),
|
|
|
+ child: MyButton(
|
|
|
+ onPressed: () {
|
|
|
+ // 提交取消订单
|
|
|
+ submitQuote(context, id);
|
|
|
+ },
|
|
|
+ text: "Confirm",
|
|
|
+ minWidth: 305,
|
|
|
+ minHeight: 45,
|
|
|
+ fontSize: 16,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ backgroundColor: context.appColors.textPrimary,
|
|
|
+ textColor: context.appColors.textWhite,
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ bottomBtnRadius: 10,
|
|
|
+ bottomBtnSpace: 5,
|
|
|
+ topLeftRadius: 10.0,
|
|
|
+ topRightRadius: 10.0,
|
|
|
+ bottomLeftRadius: 10.0,
|
|
|
+ bottomRightRadius: 10.0,
|
|
|
+ contentPadding: const EdgeInsets.only(left: 20, right: 20, bottom: 20, top: 20),
|
|
|
+ bottomBtnSectionPadding: const EdgeInsets.only(left: 20, right: 20, bottom: 20, top: 20),
|
|
|
+ cancelAction: () {
|
|
|
+ DialogEngine.dismiss(tag: 'getQuote');
|
|
|
+ clearUserNotesInput();
|
|
|
+ },
|
|
|
+ confirmAction: () {
|
|
|
+ clearUserNotesInput();
|
|
|
+ },
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ clearUserNotesInput() {
|
|
|
+ state = state.copyWith(
|
|
|
+ userNotes: "",
|
|
|
+ getQuoteFormData: {
|
|
|
+ "userNotes": {
|
|
|
+ 'value': '',
|
|
|
+ 'controller': TextEditingController(),
|
|
|
+ 'hintText': '',
|
|
|
+ 'focusNode': FocusNode(),
|
|
|
+ 'obsecure': false,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Future submitQuote<T>(
|
|
|
BuildContext context, int id) async {
|
|
|
try {
|
|
|
- Map<String, dynamic> params = {"service_id": id, "user_notes": "test"};
|
|
|
+ Map<String, dynamic> params = {"service_id": id, "user_notes": getUserNotes()};
|
|
|
final result =
|
|
|
await serviceRespositoryInstance.fetchRepairServiceSubmit(params);
|
|
|
if (result.isSuccess) {
|
|
|
+ // 关闭 getQuote dialog
|
|
|
+ DialogEngine.dismiss(tag: 'getQuote');
|
|
|
+ // 弹出成功的提示dialog
|
|
|
handlerClickQuoteBtn(context, id);
|
|
|
} else {
|
|
|
ToastEngine.show(result.errorMsg ?? "Network Load Error");
|
|
@@ -267,10 +366,11 @@ class ServiceRepairDetailVm extends _$ServiceRepairDetailVm {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 报价提交成功后的 提示dialog
|
|
|
handlerClickQuoteBtn(
|
|
|
BuildContext context, int id) async {
|
|
|
await DialogEngine.show(
|
|
|
- tag: "gotoQuote",
|
|
|
+ tag: "gotoQuoteSuccess",
|
|
|
position: DialogPosition.center,
|
|
|
widget: AppCustomDialog(
|
|
|
message: '',
|