import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AccountLogComponent } from './account-log/account-log.component';
import { BankcardComponent } from './bankcard/bankcard.component';
import { NoticeLogComponent } from './notice-log/notice-log.component';
import { DetailComponent } from './order/detail/detail.component';
import { OrderComponent } from './order/order.component';
import { RechargeComponent } from './recharge/recharge.component';
import { RecordsComponent } from './records/records.component';
import { WattleComponent } from './wattle/wattle.component';
import { WithdrawalComponent } from './withdrawal/withdrawal.component';
import { RecDetailComponent } from './records/detail/detail.component';
import { LeaveGuard } from '../../services/leave.guard';

const routes: Routes = [
  {
    path: '',
    redirectTo: 'wattle',
    pathMatch: 'full',
  },
  {
    path: 'wattle', //钱包
    component: WattleComponent,
  },
  {
    path: 'bankcard',
    component: BankcardComponent,
  },
  {
    path: 'recharge',
    canDeactivate: [LeaveGuard],
    component: RechargeComponent,
  },
  {
    path: 'log',
    component: AccountLogComponent,
  },
  {
    path: 'order',
    component: OrderComponent,
  },
  {
    path: 'order/detail/:id',
    component: DetailComponent,
  },
  {
    path: 'noticelog',
    component: NoticeLogComponent,
  },
  {
    path: 'withdrawal',
    component: WithdrawalComponent,
  },
  {
    path: 'records',
    component: RecordsComponent,
  },
  {
    path: 'records/detail/:id',
    component: RecDetailComponent,
  },
];
@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class AccountRoutingModule {}
