import 'package:cpt_services/components/chooseVisitTimeTitle_vm.dart'; import 'package:cpt_services/modules/services/service_order_confirm/service_order_confirm_vm.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:plugin_platform/engine/toast/toast_engine.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:router/ext/auto_router_extensions.dart'; import 'package:shared/utils/log_utils.dart'; import 'package:widgets/dialog/dialog_content_wrap.dart'; import '../../../respository/services_respository.dart'; import 'chooseVisitTimeContent_vm.dart'; part 'chooseVisitTimeBottomFooter_vm.g.dart'; List> airConditionList = [ { "name": "Hanging air conditioner (unit)", "id": 1, "price": 40.0, }, { "name": "Cabinet air conditioner (unit)", "id": 2, "price": 50.0, }, { "name": "Cylindrical air conditioner (unit)", "id": 3, "price": 60.0, }, { "name": "Central air conditioning (group)", "id": 4, "price": 70.0, }, ]; @riverpod class ChooseVisitTimeBottomFooterVm extends _$ChooseVisitTimeBottomFooterVm { // late ServicesRespository serviceRespositoryInstance; @override build(){ // 引入数据仓库 // serviceRespositoryInstance = ref.read(servicesRespositoryProvider); final state = null; Log.d("--------------------------build---------------------"); return state; } handlerChangeNum(BuildContext context, int num, int index){ // state.airConditionList[index].num = num; // state = state.copyWith( // airConditionList: state.airConditionList, // ); } // 预约时间点击了confirm handlerClickVisitTimeConfirm(BuildContext context,{required int id, required String cleanServiceType} ){ Log.d("handlerClickVisitTimeConfirm"); final visitTimeContentVm = ref.read(chooseVisitTimeContentVmProvider.notifier); if(visitTimeContentVm.state.allSelectedTimeList !=null && visitTimeContentVm.state.allSelectedTimeList!.isNotEmpty ){ // 有选中的时间 // 关闭 visitTime 弹框 // 需要更新 confirmOrdervm 的 visitTime final serviceOrderConfrimVm = ref.read(serviceOrderConfirmVmProvider.notifier); final visitTimeTitleVm = ref.read(chooseVisitTimeTitleVmProvider.notifier); final visitTimeContentVm = ref.read(chooseVisitTimeContentVmProvider.notifier); // String visitTime = visitTimeTitleVm.state.currentSelectDayInfoItem.date! + ' ' + visitTimeContentVm.state.allSelectedTimeList!.first?.time!; String visitTime = visitTimeContentVm.state.allSelectedTimeList!.first?.time!??''; serviceOrderConfrimVm.handlerHideVisitTimeDialog(); serviceOrderConfrimVm.handlerUpdateVisitTime(visitTime); }else { // 没有选中预约时间 ToastEngine.show("Please Choose Visit Time"); } } }