fengxiang
2018-07-11 12b04f145bae740e1971036b1e2dfc1bc224d17b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { Component } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
import { _HttpClient } from '@delon/theme';
import { SimpleTableColumn } from '@delon/abc';
import { tap } from 'rxjs/operators';
 
@Component({
  selector: 'pro-profile-basic',
  templateUrl: './basic.component.html',
})
export class ProProfileBaseComponent {
  basicNum = 0;
  amountNum = 0;
  goods = this.http.get('/profile/goods').pipe(
    tap((list: any[]) => {
      list.forEach(item => {
        this.basicNum += Number(item.num);
        this.amountNum += Number(item.amount);
      });
    }),
  );
  goodsColumns: SimpleTableColumn[] = [
    {
      title: '商品编号',
      index: 'id',
      type: 'link',
      click: (item: any) => this.msg.success(`show ${item.id}`),
    },
    { title: '商品名称', index: 'name' },
    { title: '商品条码', index: 'barcode' },
    { title: '单价', index: 'price', type: 'currency' },
    { title: '数量(件)', index: 'num', className: 'text-right' },
    { title: '金额', index: 'amount', type: 'currency' },
  ];
  progress = this.http.get('/profile/progress');
  progressColumns: SimpleTableColumn[] = [
    { title: '时间', index: 'time' },
    { title: '当前进度', index: 'rate' },
    { title: '状态', render: 'status' },
    { title: '操作员ID', index: 'operator' },
    { title: '耗时', index: 'cost' },
  ];
 
  constructor(private http: _HttpClient, private msg: NzMessageService) {}
}