|
@@ -1,13 +1,14 @@
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
-import { IonModal, IonHeader, IonToolbar, IonTitle, IonContent, IonList, IonItem, IonLabel, IonAvatar, IonButton, IonChip, IonIcon, IonBadge, IonText, IonCard, IonSegmentButton, IonSegment, IonCol, IonRow, IonGrid, IonButtons, IonFooter } from '@ionic/angular/standalone';
|
|
|
+import { IonModal, IonHeader, IonToolbar, IonTitle, IonContent, IonList, IonItem, IonLabel, IonAvatar, IonButton, IonChip, IonIcon, IonBadge, IonText, IonCard, IonSegmentButton, IonSegment, IonCol, IonRow, IonGrid, IonButtons, IonFooter, ToastController } from '@ionic/angular/standalone';
|
|
|
import { ExploreContainerComponent } from '../../explore-container/explore-container.component';
|
|
|
import { addIcons } from 'ionicons';
|
|
|
-import { airplane, bluetooth, call, wifi } from 'ionicons/icons';
|
|
|
+import { airplane, bluetooth, call, wifi, star, checkmarkCircle } from 'ionicons/icons';
|
|
|
import { Router } from '@angular/router';
|
|
|
import { CommonModule } from '@angular/common';
|
|
|
import { FormsModule } from '@angular/forms';
|
|
|
|
|
|
addIcons({ airplane, bluetooth, call, wifi });
|
|
|
+
|
|
|
interface Doctor {
|
|
|
avatar: string;
|
|
|
name: string;
|
|
@@ -29,6 +30,7 @@ interface Doctor {
|
|
|
isVerified?: boolean;
|
|
|
isExpert?: boolean;
|
|
|
}
|
|
|
+
|
|
|
interface ConsultOption {
|
|
|
id: number;
|
|
|
title: string;
|
|
@@ -45,13 +47,13 @@ interface ConsultOption {
|
|
|
styleUrls: ['./inquiry-human.component.scss'],
|
|
|
standalone: true,
|
|
|
imports: [
|
|
|
- IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent,CommonModule,
|
|
|
- IonLabel,IonItem,IonList,IonAvatar,IonLabel,IonButton,IonChip,IonIcon,IonBadge,
|
|
|
- IonText,IonCard,IonSegment,IonSegmentButton, FormsModule,IonCol,IonRow,IonGrid,
|
|
|
- IonModal,IonButtons,IonFooter
|
|
|
+ IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent, CommonModule,
|
|
|
+ IonLabel, IonItem, IonList, IonAvatar, IonButton, IonChip, IonIcon, IonBadge,
|
|
|
+ IonText, IonCard, IonSegment, IonSegmentButton, FormsModule, IonCol, IonRow, IonGrid,
|
|
|
+ IonModal, IonButtons, IonFooter
|
|
|
]
|
|
|
})
|
|
|
-export class InquiryHumanComponent implements OnInit {
|
|
|
+export class InquiryHumanComponent implements OnInit {
|
|
|
options: ConsultOption[] = [
|
|
|
{
|
|
|
id: 1,
|
|
@@ -95,38 +97,31 @@ export class InquiryHumanComponent implements OnInit {
|
|
|
isAvailable: false
|
|
|
}
|
|
|
];
|
|
|
+
|
|
|
selectOption(option: ConsultOption) {
|
|
|
if (!option.isAvailable) return;
|
|
|
-
|
|
|
this.options.forEach(opt => opt.isSelected = false);
|
|
|
option.isSelected = true;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
isModalOpen = false;
|
|
|
- doctor: any;
|
|
|
-
|
|
|
- openDetailModal(doctor?: any) {
|
|
|
- this.isModalOpen = true;
|
|
|
- this.doctor = doctor;
|
|
|
- }
|
|
|
- closeDetailModal() {
|
|
|
- this.isModalOpen = false;
|
|
|
- this.doctor = null;
|
|
|
- }
|
|
|
+ isPaymentModalOpen = false; // 新增状态变量
|
|
|
+ doctor: any;
|
|
|
|
|
|
constructor(
|
|
|
- private router: Router
|
|
|
- ) { }
|
|
|
+ private router: Router,
|
|
|
+ private toastController: ToastController // 注入 ToastController
|
|
|
+ ) {
|
|
|
+ addIcons({star,checkmarkCircle}); }
|
|
|
|
|
|
- ngOnInit() {}
|
|
|
- back:string = "<";
|
|
|
+ ngOnInit() { }
|
|
|
+
|
|
|
+ back: string = "<";
|
|
|
backhome(){
|
|
|
this.router.navigate(['/tabs/tab1']);
|
|
|
}
|
|
|
selectedSegment = '全部';
|
|
|
- segments = ['全部', '妇科', '儿科', '眼科', '内科',];
|
|
|
+ segments = ['全部', '妇科', '儿科', '皮肤性病科', '内科',];
|
|
|
|
|
|
doctors: Doctor[] = [
|
|
|
{
|
|
@@ -219,7 +214,28 @@ export class InquiryHumanComponent implements OnInit {
|
|
|
this.selectedSegment = event.detail.value;
|
|
|
console.log(this.selectedSegment);
|
|
|
}
|
|
|
- openConsult(){
|
|
|
- console.log("openConsult");
|
|
|
+
|
|
|
+ async openConsult(){
|
|
|
+ const selectedOption = this.options.find(option => option.isSelected);
|
|
|
+ if (!selectedOption) {
|
|
|
+ // 显示 Toast 提示用户选择咨询方式
|
|
|
+ const toast = await this.toastController.create({
|
|
|
+ message: '请先选择咨询方式',
|
|
|
+ duration: 2000,
|
|
|
+ position: 'bottom'
|
|
|
+ });
|
|
|
+ toast.present();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (selectedOption.title === '图文咨询' || selectedOption.title === '电话咨询') {
|
|
|
+ this.isPaymentModalOpen = true;
|
|
|
+ } else {
|
|
|
+ // 处理其他选项(如需要)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ closePaymentModal() {
|
|
|
+ this.isPaymentModalOpen = false;
|
|
|
}
|
|
|
-}
|
|
|
+}
|