From 4fce4a95c1df5bb01b58374b76a877296b84b224 Mon Sep 17 00:00:00 2001 From: youmengting <2080639302@qq.com> Date: Fri, 14 Jul 2023 09:51:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=88=B8=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blx-coupon/blx-coupon.component.html | 66 +++++++++++++++++++ .../blx-coupon/blx-coupon.component.scss | 6 ++ .../coupon/blx-coupon/blx-coupon.component.ts | 61 +++++++++++++++++ src/app/admin/coupon/coupon-routing.module.ts | 2 + src/app/admin/coupon/coupon.module.ts | 4 +- src/app/app-common.module.ts | 5 ++ src/app/pipes/coupon-status.pipe.ts | 37 +++++++++++ src/app/services/coupon.service.ts | 11 ++++ 8 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 src/app/admin/coupon/blx-coupon/blx-coupon.component.html create mode 100644 src/app/admin/coupon/blx-coupon/blx-coupon.component.scss create mode 100644 src/app/admin/coupon/blx-coupon/blx-coupon.component.ts diff --git a/src/app/admin/coupon/blx-coupon/blx-coupon.component.html b/src/app/admin/coupon/blx-coupon/blx-coupon.component.html new file mode 100644 index 0000000..0a4a3e8 --- /dev/null +++ b/src/app/admin/coupon/blx-coupon/blx-coupon.component.html @@ -0,0 +1,66 @@ + + + + + + +
+ 共计 {{total}} 条数据 + + + + + + 编号 + 优惠券编码 + 优惠券名称 + 面额 + + 优惠券状态 + + + + + + {{i+1}} + {{data.couponCode}} + {{data.couponName}} + {{data.denomination}} + + + {{data.couponStatus | blxCouponStatus}} + + + + + + +
\ No newline at end of file diff --git a/src/app/admin/coupon/blx-coupon/blx-coupon.component.scss b/src/app/admin/coupon/blx-coupon/blx-coupon.component.scss new file mode 100644 index 0000000..4be59fa --- /dev/null +++ b/src/app/admin/coupon/blx-coupon/blx-coupon.component.scss @@ -0,0 +1,6 @@ +img { + width: 60px; + } + .fontColor { + color: red; + } \ No newline at end of file diff --git a/src/app/admin/coupon/blx-coupon/blx-coupon.component.ts b/src/app/admin/coupon/blx-coupon/blx-coupon.component.ts new file mode 100644 index 0000000..88ebb7b --- /dev/null +++ b/src/app/admin/coupon/blx-coupon/blx-coupon.component.ts @@ -0,0 +1,61 @@ +import { Component, OnInit } from '@angular/core'; + +import { CouponService } from '../../../services/coupon.service'; +import {CommonsService} from '../../../services/commons.service'; +import { FormBuilder, FormGroup } from '@angular/forms'; +import {NzMessageService} from 'ng-zorro-antd'; +@Component({ + selector: 'app-blx-coupon', + templateUrl: './blx-coupon.component.html', + styleUrls: ['./blx-coupon.component.scss'] +}) +export class BlxCouponComponent implements OnInit { + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + total: number = 0; // 总计条数 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = false; + + constructor( + private form: FormBuilder, + private coupon: CouponService, + private message: NzMessageService, + ) { } + + ngOnInit() { + this.searchForm = this.form.group({ + // merchantId: [null], + // couponName: [null], + // couponType: [null], + // goodsTypeId: [null], + // brandId: [null], + // displayArea: [null], + // status: [null], + }); + this.getRequest(true,this.searchForm.value) + } + + + // 查询列表 + public getRequest(reset: boolean = false, whereObject: object) { + + this.loading = true; + if (reset) { + this.pageNum = 1; + } + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.coupon.getBlxCouponList(whereObject, data => { + this.loading = false; + if (data['return_code'] === '000000') { + this.requestData = data['return_data'].list; + this.total = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + +} + +} diff --git a/src/app/admin/coupon/coupon-routing.module.ts b/src/app/admin/coupon/coupon-routing.module.ts index dd1794c..ccd9149 100644 --- a/src/app/admin/coupon/coupon-routing.module.ts +++ b/src/app/admin/coupon/coupon-routing.module.ts @@ -4,6 +4,7 @@ import {CouponListComponent} from './coupon-list/coupon-list.component'; import {CouponEditComponent} from './coupon-edit/coupon-edit.component'; import {CouponDetailComponent} from './coupon-detail/coupon-detail.component'; import {SalesCodeListComponent} from './sales-code-list/sales-code-list.component'; +import { BlxCouponComponent } from './blx-coupon/blx-coupon.component'; const routes: Routes = [ @@ -11,6 +12,7 @@ const routes: Routes = [ { path: 'coupon-edit', component: CouponEditComponent }, { path: 'coupon-detail', component: CouponDetailComponent }, { path: 'salesCode-list', component: SalesCodeListComponent }, + {path:'blx-coupon',component:BlxCouponComponent} ]; @NgModule({ diff --git a/src/app/admin/coupon/coupon.module.ts b/src/app/admin/coupon/coupon.module.ts index 86ac4e0..a583866 100644 --- a/src/app/admin/coupon/coupon.module.ts +++ b/src/app/admin/coupon/coupon.module.ts @@ -12,9 +12,11 @@ import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; import {RichtextModule} from '../../common/richtext/richtext.module'; import {AppCommonModule} from '../../app-common.module'; import { SalesCodeListComponent } from './sales-code-list/sales-code-list.component'; +import { BlxCouponComponent } from './blx-coupon/blx-coupon.component'; @NgModule({ - declarations: [CouponListComponent, CouponEditComponent, CouponDetailComponent, SalesCodeListComponent], + declarations: [CouponListComponent, CouponEditComponent, CouponDetailComponent, SalesCodeListComponent, + BlxCouponComponent], imports: [ CommonModule, CouponRoutingModule, diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index 9a536ce..4e16f70 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -73,6 +73,9 @@ import { PayCouponStatusPipe, OrderOilChannelTypePipe, VerifyProductTypePipe, + BlxCouponStatusPipe, + ReceiveTypePipe, + } from './pipes'; import {MsgTypePipe} from './pipes/msg/msg-type.pipe'; import { OrderProductTypePipe } from './pipes/order/order-product-type.pipe'; @@ -149,6 +152,8 @@ const PIPES = [ MsgTypePipe, OrderOilChannelTypePipe, VerifyProductTypePipe, + BlxCouponStatusPipe, + ReceiveTypePipe, LogisticsStatusPipe, OrderProductTypePipe, GoodsStatusPipe diff --git a/src/app/pipes/coupon-status.pipe.ts b/src/app/pipes/coupon-status.pipe.ts index c428fca..e580422 100644 --- a/src/app/pipes/coupon-status.pipe.ts +++ b/src/app/pipes/coupon-status.pipe.ts @@ -22,3 +22,40 @@ export class CouponStatusPipe implements PipeTransform { } } } + + + +@Pipe({ + name: 'blxCouponStatus' +}) +export class BlxCouponStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 0: + return '待审核'; + case 1: + return '审核通过'; + case 2: + return '强制结束'; + } + } +} + + +@Pipe({ + name: 'receiveType' +}) +export class ReceiveTypePipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '天数'; + case 2: + return '时间段'; + case null: + return '暂无数据'; + } + } +} diff --git a/src/app/services/coupon.service.ts b/src/app/services/coupon.service.ts index 5c085d9..9cb01bd 100644 --- a/src/app/services/coupon.service.ts +++ b/src/app/services/coupon.service.ts @@ -168,4 +168,15 @@ export class CouponService { }); } + /* + 获取停车券列表 + */ + public getBlxCouponList(params: object, callBack) { + this.http.get(environment.baseUrl + 'apiCoupon/getBlxCouponList?'+ this.common.getWhereCondition(params)).subscribe(data => { + + callBack(data); + }); + } + + }