| 
														
															@@ -8,6 +8,9 @@ import { CommonModule } from '@angular/common'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { CloudObject, CloudQuery } from 'src/lib/ncloud'; 
														 | 
														
														 | 
														
															 import { CloudObject, CloudQuery } from 'src/lib/ncloud'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { Router } from '@angular/router'; 
														 | 
														
														 | 
														
															 import { Router } from '@angular/router'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { FmChatModalInput } from 'fmode-ng'; 
														 | 
														
														 | 
														
															 import { FmChatModalInput } from 'fmode-ng'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import { AllProductsModalComponent } from '../all-products-modal/all-products-modal.component'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import { DetailModalComponent } from '../detail-modal/detail-modal.component'; // 确保此组件已创建 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import { IonicModule } from '@ionic/angular'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 addIcons({ airplane, bluetooth, call, wifi }); 
														 | 
														
														 | 
														
															 addIcons({ airplane, bluetooth, call, wifi }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -17,15 +20,18 @@ addIcons({ airplane, bluetooth, call, wifi }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   styleUrls: ['tab3.page.scss'], 
														 | 
														
														 | 
														
															   styleUrls: ['tab3.page.scss'], 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   standalone: true, 
														 | 
														
														 | 
														
															   standalone: true, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   imports: [ 
														 | 
														
														 | 
														
															   imports: [ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    IonButton, IonGrid, IonRow, IonCol, IonCardHeader, IonItem, IonLabel, IonThumbnail, IonCardContent, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    IonCardTitle, IonCard, IonIcon, IonSearchbar, CommonModule, SaleCardComponent, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    FmChatModalInput, IonModal, IonButtons 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    IonicModule, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    CommonModule, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    AllProductsModalComponent, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    DetailModalComponent, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    ExploreContainerComponent, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    SaleCardComponent, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    FmChatModalInput 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   ] 
														 | 
														
														 | 
														
															   ] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 }) 
														 | 
														
														 | 
														
															 }) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 export class Tab3Page { 
														 | 
														
														 | 
														
															 export class Tab3Page { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  showDetailModal = false;  // 控制模态显示与否 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  currentProduct: any;      // 当前选择的商品信息 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  showDetailModal = false;  // 控制详情模态显示与否 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  currentProduct: any;      // 当前选择的药品信息 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															   categories = [ 
														 | 
														
														 | 
														
															   categories = [ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { name: '皮肤用药', image: '../../assets/image/doctor7.png' }, 
														 | 
														
														 | 
														
															     { name: '皮肤用药', image: '../../assets/image/doctor7.png' }, 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -41,11 +47,13 @@ export class Tab3Page { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   products: Array<CloudObject> = []; 
														 | 
														
														 | 
														
															   products: Array<CloudObject> = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   allProducts: Array<CloudObject> = []; // 存储所有药品数据,用于分类过滤 
														 | 
														
														 | 
														
															   allProducts: Array<CloudObject> = []; // 存储所有药品数据,用于分类过滤 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  hotProducts: Array<CloudObject> = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  specialProducts: Array<CloudObject> = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   constructor( 
														 | 
														
														 | 
														
															   constructor( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private modalCtrl: ModalController, 
														 | 
														
														 | 
														
															     private modalCtrl: ModalController, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private router: Router, 
														 | 
														
														 | 
														
															     private router: Router, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  ) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      addIcons({close}); } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  ) {} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															   async ngOnInit() { 
														 | 
														
														 | 
														
															   async ngOnInit() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     await this.loadProducts(); 
														 | 
														
														 | 
														
															     await this.loadProducts(); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -56,33 +64,30 @@ export class Tab3Page { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       const query = new CloudQuery('Drug'); 
														 | 
														
														 | 
														
															       const query = new CloudQuery('Drug'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       this.products = await query.find(); 
														 | 
														
														 | 
														
															       this.products = await query.find(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       this.allProducts = [...this.products]; // 初始化所有产品 
														 | 
														
														 | 
														
															       this.allProducts = [...this.products]; // 初始化所有产品 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      // 分类“热销”和“特价”药品 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      this.hotProducts = this.allProducts.filter(product => product.get('marketing') === 'hot'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      this.specialProducts = this.allProducts.filter(product => product.get('marketing') === 'special'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } catch (error) { 
														 | 
														
														 | 
														
															     } catch (error) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       console.error('加载药品数据失败', error); 
														 | 
														
														 | 
														
															       console.error('加载药品数据失败', error); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  // 打开详情模态窗口 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   openDetailModal(product: any) { 
														 | 
														
														 | 
														
															   openDetailModal(product: any) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     this.currentProduct = product; 
														 | 
														
														 | 
														
															     this.currentProduct = product; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     this.showDetailModal = true; 
														 | 
														
														 | 
														
															     this.showDetailModal = true; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  // 关闭详情模态窗口 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   closeDetailModal() { 
														 | 
														
														 | 
														
															   closeDetailModal() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     this.showDetailModal = false; 
														 | 
														
														 | 
														
															     this.showDetailModal = false; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     this.currentProduct = null; 
														 | 
														
														 | 
														
															     this.currentProduct = null; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  // 根据分类过滤产品 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  filterProducts(categoryName: string) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    if (categoryName === '全部') { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      this.products = [...this.allProducts]; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } else { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      this.products = this.allProducts.filter(product => product.get('category') === categoryName); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  // 分类点击事件 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  // 根据分类导航到 drug-category 页面 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   onCategoryClick(category: any) { 
														 | 
														
														 | 
														
															   onCategoryClick(category: any) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    this.filterProducts(category.name); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    this.router.navigate(['/drug-category', category.name]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															   // 分享链接功能(可选) 
														 | 
														
														 | 
														
															   // 分享链接功能(可选) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -102,19 +107,44 @@ export class Tab3Page { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }); 
														 | 
														
														 | 
														
															     }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  //搜索功能 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  // 搜索功能 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   searchTerm: string = ''; 
														 | 
														
														 | 
														
															   searchTerm: string = ''; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-async searchProducts(event: any) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  this.searchTerm = event.detail.value.toLowerCase(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  if (this.searchTerm) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    this.products = this.allProducts.filter(product => 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      product.get('name').toLowerCase().includes(this.searchTerm) || 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      product.get('function').toLowerCase().includes(this.searchTerm) || 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      product.get('composition').toLowerCase().includes(this.searchTerm) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    ); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  } else { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    this.products = [...this.allProducts]; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  async searchProducts(event: any) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    this.searchTerm = event.detail.value.toLowerCase(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    if (this.searchTerm) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      this.products = this.allProducts.filter(product => 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        product.get('name').toLowerCase().includes(this.searchTerm) || 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        product.get('function').toLowerCase().includes(this.searchTerm) || 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        product.get('composition').toLowerCase().includes(this.searchTerm) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      ); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      this.products = [...this.allProducts]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  // 查看更多功能,打开 AllProductsModalComponent 模态窗口 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  async viewMore(type: string) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    let filteredProducts: Array<CloudObject> = []; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    let title: string = ''; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    if (type === 'hot') { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      filteredProducts = this.hotProducts; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      title = '热销药品'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } else if (type === 'special') { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      filteredProducts = this.specialProducts; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      title = '特价药品'; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    const modal = await this.modalCtrl.create({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      component: AllProductsModalComponent, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      componentProps: { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        products: filteredProducts, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        title: title 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      cssClass: 'bottom-modal' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    return await modal.present(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-} 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |