From ba1288f11ecf1320c981ddf302e9f102e263aa6f Mon Sep 17 00:00:00 2001
From: Sum1Dream <418471657@qq.com>
Date: Sun, 30 May 2021 22:36:08 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=98=E6=83=A0=E5=88=B8?=
=?UTF-8?q?=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../coupon-list/coupon-list.component.html | 2 +-
src/app/admin/coupon/coupon.module.ts | 2 +-
.../order-coupons.component.html | 2 +-
src/app/app-common.module.ts | 8 +++++--
src/app/pipes/discount-code-status.pipe.ts | 21 +++++++++++++++++++
src/app/pipes/display-area.pipe.ts | 19 +++++++++++++++++
src/app/pipes/index.ts | 2 ++
7 files changed, 51 insertions(+), 5 deletions(-)
create mode 100644 src/app/pipes/discount-code-status.pipe.ts
create mode 100644 src/app/pipes/display-area.pipe.ts
diff --git a/src/app/admin/coupon/coupon-list/coupon-list.component.html b/src/app/admin/coupon/coupon-list/coupon-list.component.html
index fee7a3c..a533fe9 100644
--- a/src/app/admin/coupon/coupon-list/coupon-list.component.html
+++ b/src/app/admin/coupon/coupon-list/coupon-list.component.html
@@ -121,7 +121,7 @@
¥{{data.salesPrice}} |
¥{{data.discountPrice}} |
{{data.stockCount}} |
- {{data.displayArea === 1 ? '赠券专区' : '金币专区'}} |
+ {{data.displayArea | displayArea}} |
{{data.couponType === 1 ? '内部卷' : '外部卷'}} |
{{data.isPresent === true ? '赠券' : '无赠券'}} |
{{data.status | couponStatus}} |
diff --git a/src/app/admin/coupon/coupon.module.ts b/src/app/admin/coupon/coupon.module.ts
index fda519f..86ac4e0 100644
--- a/src/app/admin/coupon/coupon.module.ts
+++ b/src/app/admin/coupon/coupon.module.ts
@@ -14,7 +14,7 @@ import {AppCommonModule} from '../../app-common.module';
import { SalesCodeListComponent } from './sales-code-list/sales-code-list.component';
@NgModule({
- declarations: [CouponListComponent, CouponEditComponent, CouponDetailComponent, SalesCodeListComponent],
+ declarations: [CouponListComponent, CouponEditComponent, CouponDetailComponent, SalesCodeListComponent],
imports: [
CommonModule,
CouponRoutingModule,
diff --git a/src/app/admin/order/order-coupons/order-coupons.component.html b/src/app/admin/order/order-coupons/order-coupons.component.html
index eca3f17..e2b3578 100644
--- a/src/app/admin/order/order-coupons/order-coupons.component.html
+++ b/src/app/admin/order/order-coupons/order-coupons.component.html
@@ -115,7 +115,7 @@
{{data['highUser'] == null ? '暂无': data['highUser'].name}}
{{data.createTime | date: 'yyyy-MM-dd HH:mm'}} |
- {{data.status | couponCode}} |
+ {{data.status | discountCodeStatus}} |
diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts
index a3b12f4..f515adc 100644
--- a/src/app/app-common.module.ts
+++ b/src/app/app-common.module.ts
@@ -21,7 +21,9 @@ import {
PaytypePipe,
DiscountTypePipe,
OrderCouponStatusPipe,
- DiscountStatusPipe
+ DiscountStatusPipe,
+ DisplayAreaPipe,
+ DiscountCodeStatusPipe
} from './pipes';
@@ -37,7 +39,9 @@ const PIPES = [
PaymodelPipe,
PaytypePipe,
DiscountTypePipe,
- DiscountStatusPipe
+ DiscountStatusPipe,
+ DisplayAreaPipe,
+ DiscountCodeStatusPipe,
];
diff --git a/src/app/pipes/discount-code-status.pipe.ts b/src/app/pipes/discount-code-status.pipe.ts
new file mode 100644
index 0000000..2fc1341
--- /dev/null
+++ b/src/app/pipes/discount-code-status.pipe.ts
@@ -0,0 +1,21 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+@Pipe({
+ name: 'discountCodeStatus'
+})
+export class DiscountCodeStatusPipe implements PipeTransform {
+
+ transform(value: number): string {
+ switch (value) {
+ case 1:
+ return '待领取';
+ case 2:
+ return '待使用';
+ case 3:
+ return '已使用';
+ case 4:
+ return '已过期';
+ }
+ }
+
+}
diff --git a/src/app/pipes/display-area.pipe.ts b/src/app/pipes/display-area.pipe.ts
new file mode 100644
index 0000000..da04c95
--- /dev/null
+++ b/src/app/pipes/display-area.pipe.ts
@@ -0,0 +1,19 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+@Pipe({
+ name: 'displayArea'
+})
+export class DisplayAreaPipe implements PipeTransform {
+
+ transform(value: any): string {
+ switch (value) {
+ case 1:
+ return '赠券专区';
+ case 2:
+ return '金币专区';
+ case null:
+ return '消费券';
+ }
+ }
+
+}
diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts
index 98a80b9..ab2e7c8 100644
--- a/src/app/pipes/index.ts
+++ b/src/app/pipes/index.ts
@@ -10,3 +10,5 @@ export * from './paymodel.pipe';
export * from './paytype.pipe';
export * from './discount-type.pipe';
export * from './discount-status.pipe';
+export * from './display-area.pipe';
+export * from './discount-code-status.pipe';