diff --git a/src/app/pipes/recharge-price/price-status.pipe.ts b/src/app/pipes/recharge-price/price-status.pipe.ts new file mode 100644 index 0000000..e110c73 --- /dev/null +++ b/src/app/pipes/recharge-price/price-status.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'priceStatus' +}) +export class PriceStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '上线中'; + case 2: + return '已售空'; + case 3: + return '编辑中'; + } + } + +} diff --git a/src/app/pipes/recharge-price/recharge-platform.pipe.ts b/src/app/pipes/recharge-price/recharge-platform.pipe.ts new file mode 100644 index 0000000..5897009 --- /dev/null +++ b/src/app/pipes/recharge-price/recharge-platform.pipe.ts @@ -0,0 +1,23 @@ +import {Pipe, PipeTransform} from '@angular/core'; + +@Pipe({ + name: 'rechargePlatform' +}) +export class RechargePlatformPipe implements PipeTransform { + + transform(value: string): unknown { + const array = value.split('-'); + let string = ''; + for (const i of array) { + if (Number(i) === 1) { + string = string + '尖椒,'; + } + if (Number(i) === 2) { + string = string + '龙阅,'; + } + + } + return string.substring(0 , string.length - 1); + } + +}