|  | @@ -2,7 +2,11 @@ import { Component, OnInit, Input, ViewChild, ElementRef, ChangeDetectionStrateg
 | 
	
		
			
				|  |  |  import { CommonModule } from '@angular/common';
 | 
	
		
			
				|  |  |  import { FormsModule } from '@angular/forms';
 | 
	
		
			
				|  |  |  import { ActivatedRoute } from '@angular/router';
 | 
	
		
			
				|  |  | -import { FmodeObject, FmodeParse, WxworkSDK } from 'fmode-ng/core';
 | 
	
		
			
				|  |  | +import { FmodeObject, FmodeParse, WxworkAuth, WxworkSDK } from 'fmode-ng/core';
 | 
	
		
			
				|  |  | +import { MatDatepickerModule } from '@angular/material/datepicker';
 | 
	
		
			
				|  |  | +import { MatInputModule } from '@angular/material/input';
 | 
	
		
			
				|  |  | +import { MatNativeDateModule } from '@angular/material/core';
 | 
	
		
			
				|  |  | +import { MatFormFieldModule } from '@angular/material/form-field';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import { ProjectFileService } from '../../../services/project-file.service';
 | 
	
		
			
				|  |  |  import { ProductSpaceService, Project } from '../../../services/product-space.service';
 | 
	
	
		
			
				|  | @@ -35,7 +39,16 @@ const Parse = FmodeParse.with('nova');
 | 
	
		
			
				|  |  |  @Component({
 | 
	
		
			
				|  |  |    selector: 'app-stage-order',
 | 
	
		
			
				|  |  |    standalone: true,
 | 
	
		
			
				|  |  | -  imports: [CommonModule, FormsModule, QuotationEditorComponent, TeamAssignComponent],
 | 
	
		
			
				|  |  | +  imports: [
 | 
	
		
			
				|  |  | +    CommonModule,
 | 
	
		
			
				|  |  | +    FormsModule,
 | 
	
		
			
				|  |  | +    MatDatepickerModule,
 | 
	
		
			
				|  |  | +    MatInputModule,
 | 
	
		
			
				|  |  | +    MatNativeDateModule,
 | 
	
		
			
				|  |  | +    MatFormFieldModule,
 | 
	
		
			
				|  |  | +    QuotationEditorComponent,
 | 
	
		
			
				|  |  | +    TeamAssignComponent
 | 
	
		
			
				|  |  | +  ],
 | 
	
		
			
				|  |  |    templateUrl: './stage-order.component.html',
 | 
	
		
			
				|  |  |    styleUrls: ['./stage-order.component.scss'],
 | 
	
		
			
				|  |  |    changeDetection: ChangeDetectionStrategy.OnPush
 | 
	
	
		
			
				|  | @@ -54,22 +67,13 @@ export class StageOrderComponent implements OnInit {
 | 
	
		
			
				|  |  |      title: '',
 | 
	
		
			
				|  |  |      projectType: '', // 家装 | 工装
 | 
	
		
			
				|  |  |      renderType: '', // 静态单张 | 360全景
 | 
	
		
			
				|  |  | -    demoday: this.formatDate(),
 | 
	
		
			
				|  |  | -    deadline: this.formatDate(),
 | 
	
		
			
				|  |  | +    demoday: new Date() as Date | null,
 | 
	
		
			
				|  |  | +    deadline: new Date() as Date | null,
 | 
	
		
			
				|  |  |      description: '',
 | 
	
		
			
				|  |  |      priceLevel: '一级', // 一级(老客户) | 二级(中端组) | 三级(高端组)
 | 
	
		
			
				|  |  |      spaceType: 'single' // single | multi
 | 
	
		
			
				|  |  |    };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  formatDate (date = new Date()) {
 | 
	
		
			
				|  |  | -    const year = date.getFullYear();
 | 
	
		
			
				|  |  | -    // 月份从 0 开始,需 +1,并用 padStart 补零确保两位数
 | 
	
		
			
				|  |  | -    const month = String(date.getMonth() + 1).padStart(2, '0');
 | 
	
		
			
				|  |  | -    // 日期补零确保两位数
 | 
	
		
			
				|  |  | -    const day = String(date.getDate()).padStart(2, '0');
 | 
	
		
			
				|  |  | -    return `${year}-${month}-${day}`;
 | 
	
		
			
				|  |  | -  };
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |    
 | 
	
		
			
				|  |  |    // 空间管理
 | 
	
		
			
				|  |  |    projectSpaces: Project[] = [];
 | 
	
	
		
			
				|  | @@ -296,8 +300,8 @@ export class StageOrderComponent implements OnInit {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        if (!this.currentUser && this.cid) {
 | 
	
		
			
				|  |  | -        const wxwork = new WxworkSDK({ cid: this.cid, appId: 'crm' });
 | 
	
		
			
				|  |  | -        this.currentUser = await wxwork.getCurrentUser();
 | 
	
		
			
				|  |  | +        const wxwork = new WxworkAuth({ cid: this.cid, appId: 'crm' });
 | 
	
		
			
				|  |  | +        this.currentUser = await wxwork.currentProfile();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          const role = this.currentUser?.get('roleName') || '';
 | 
	
		
			
				|  |  |          this.canEdit = ['客服', '组员', '组长', '管理员'].includes(role);
 | 
	
	
		
			
				|  | @@ -308,8 +312,8 @@ export class StageOrderComponent implements OnInit {
 | 
	
		
			
				|  |  |          this.projectInfo.title = this.project.get('title') || '';
 | 
	
		
			
				|  |  |          this.projectInfo.projectType = this.project.get('projectType') || '';
 | 
	
		
			
				|  |  |          this.projectInfo.renderType = this.project.get('renderType') || '';
 | 
	
		
			
				|  |  | -        this.projectInfo.deadline = this.formatDate(this.project.get('deadline') || new Date());
 | 
	
		
			
				|  |  | -        this.projectInfo.demoday = this.formatDate(this.project.get('demoday') || new Date());
 | 
	
		
			
				|  |  | +        this.projectInfo.deadline = this.project.get('deadline') || new Date();
 | 
	
		
			
				|  |  | +        this.projectInfo.demoday = this.project.get('demoday') || new Date();
 | 
	
		
			
				|  |  |          this.projectInfo.description = this.project.get('description') || '';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          const data = this.project.get('data') || {};
 | 
	
	
		
			
				|  | @@ -750,8 +754,8 @@ export class StageOrderComponent implements OnInit {
 | 
	
		
			
				|  |  |        this.project.set('title', this.projectInfo.title);
 | 
	
		
			
				|  |  |        this.project.set('projectType', this.projectInfo.projectType);
 | 
	
		
			
				|  |  |        this.project.set('renderType', this.projectInfo.renderType);
 | 
	
		
			
				|  |  | -      this.project.set('deadline', new Date(this.projectInfo.deadline));
 | 
	
		
			
				|  |  | -      this.project.set('demoday', new Date(this.projectInfo.demoday));
 | 
	
		
			
				|  |  | +      this.project.set('deadline', this.projectInfo.deadline);
 | 
	
		
			
				|  |  | +      this.project.set('demoday', this.projectInfo.demoday);
 | 
	
		
			
				|  |  |        this.project.set('description', this.projectInfo.description);
 | 
	
		
			
				|  |  |        this.project.set('spaceType', this.projectInfo.spaceType);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -840,9 +844,9 @@ export class StageOrderComponent implements OnInit {
 | 
	
		
			
				|  |  |        approvalHistory.push({
 | 
	
		
			
				|  |  |          stage: '订单分配',
 | 
	
		
			
				|  |  |          submitter: {
 | 
	
		
			
				|  |  | -          id: this.currentUser!.id,
 | 
	
		
			
				|  |  | -          name: this.currentUser!.get('name'),
 | 
	
		
			
				|  |  | -          role: this.currentUser!.get('roleName')
 | 
	
		
			
				|  |  | +          id: this.currentUser?.id,
 | 
	
		
			
				|  |  | +          name: this.currentUser?.get('name'),
 | 
	
		
			
				|  |  | +          role: this.currentUser?.get('roleName')
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          submitTime: new Date(),
 | 
	
		
			
				|  |  |          status: 'confirm',
 |