diff --git a/src/app/pipes/integral/integral-product.pipe.ts b/src/app/pipes/integral/integral-product.pipe.ts new file mode 100644 index 0000000..91a68fb --- /dev/null +++ b/src/app/pipes/integral/integral-product.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'integralProduct' +}) +export class IntegralProductPipe implements PipeTransform { + + array = { + 1: ['重庆中石化' , '', '', '贵州中石化'], + 2: ['在线加油' ], + 3: ['电信' , '移动' , '联通'], + 4: ['星巴克' , '肯德基' , '会员充值'] + }; + + transform(type: number , product: number): string { + return this.array[type][product - 1]; + } + +} diff --git a/src/app/pipes/integral/integral-type.pipe.ts b/src/app/pipes/integral/integral-type.pipe.ts new file mode 100644 index 0000000..1ad396d --- /dev/null +++ b/src/app/pipes/integral/integral-type.pipe.ts @@ -0,0 +1,21 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'integralType' +}) +export class IntegralTypePipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '卡券'; + case 2: + return '在线加油'; + case 3: + return '话费'; + case 4: + return '第三方'; + } + } + +}