123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- 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<Map<String, dynamic>> 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");
- }
- }
- }
|