From a0cf8b95b86204e1ae8a677f46573bbcd3049f6c Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Sun, 28 Mar 2021 10:12:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order-list/order-list.component.html | 87 +++++++++++++++++++ .../order-list/order-list.component.scss | 4 + .../order/order-list/order-list.component.ts | 84 ++++++++++++++++++ src/app/admin/order/order-routing.module.ts | 14 +++ src/app/admin/order/order.module.ts | 28 ++++++ src/app/app-common.module.ts | 2 + src/app/app-routing.module.ts | 5 ++ src/app/pipes/index.ts | 1 + .../pipes/order/order-coupon-status.pipe.ts | 18 ++++ src/app/services/icon.service.ts | 2 +- src/app/services/order.service.ts | 27 ++++++ 11 files changed, 271 insertions(+), 1 deletion(-) create mode 100644 src/app/admin/order/order-list/order-list.component.html create mode 100644 src/app/admin/order/order-list/order-list.component.scss create mode 100644 src/app/admin/order/order-list/order-list.component.ts create mode 100644 src/app/admin/order/order-routing.module.ts create mode 100644 src/app/admin/order/order.module.ts create mode 100644 src/app/pipes/order/order-coupon-status.pipe.ts create mode 100644 src/app/services/order.service.ts diff --git a/src/app/admin/order/order-list/order-list.component.html b/src/app/admin/order/order-list/order-list.component.html new file mode 100644 index 0000000..945ec4d --- /dev/null +++ b/src/app/admin/order/order-list/order-list.component.html @@ -0,0 +1,87 @@ + + + + + +
+
+
+
+ + 销售码 + + + + +
+ + + + + + + + +
+ + 状态 + + + + + + + + +
+
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 + + + + 编号 + 销售码 + 销售截止时间 + 使用截止时间 + 创建时间 + 状态 + + + + + {{i+1}} + {{data.salesCode}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.useEndTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.status | orderCouponStatus}} + + +
+ + + diff --git a/src/app/admin/order/order-list/order-list.component.scss b/src/app/admin/order/order-list/order-list.component.scss new file mode 100644 index 0000000..8bee3fb --- /dev/null +++ b/src/app/admin/order/order-list/order-list.component.scss @@ -0,0 +1,4 @@ +.head_img { + height: 60px; + width: 60px; +} diff --git a/src/app/admin/order/order-list/order-list.component.ts b/src/app/admin/order/order-list/order-list.component.ts new file mode 100644 index 0000000..b23cb2f --- /dev/null +++ b/src/app/admin/order/order-list/order-list.component.ts @@ -0,0 +1,84 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {MerchantService} from '../../../services/merchant.service'; +import {IconService} from '../../../services/icon.service'; +import {NzMessageService} from 'ng-zorro-antd'; +import {Router} from '@angular/router'; +import {CommonsService} from '../../../services/commons.service'; +import {OrderService} from '../../../services/order.service'; + +@Component({ + selector: 'app-order-list', + templateUrl: './order-list.component.html', + styleUrls: ['./order-list.component.scss'] +}) +export class OrderListComponent implements OnInit { + + WEB_SERVE_URL = environment.baseUrl; + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + + constructor( + private form: FormBuilder, + private order: OrderService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private common: CommonsService + ) { + } + + ngOnInit(): void { + this.init(); + } + + public init(): void { + this.searchForm = this.form.group({ + couponId: [null], + salesCode: [null], + status: [null], + }); + this.getRequest(true, this.searchForm.value); + } + + // 查询列表 + public getRequest(reset: boolean = false, whereObject: object) { + + this.loading = false; + if (reset) { + this.pageNum = 1; + } + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.order.getOrderCouponList(whereObject, data => { + if (data['return_code'] === '000000') { + console.log(data); + this.requestData = data['return_data'].list; + this.total = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 重置 + public resetForm(): void { + this.searchForm.reset(); + } + + + // 查看详情 + public getDetail(id: number): void { + this.router.navigate(['/admin/merchant/merchant-detail'], { + queryParams: { + merchantId: id + } + }).then(r => console.log(r)); + } + +} diff --git a/src/app/admin/order/order-routing.module.ts b/src/app/admin/order/order-routing.module.ts new file mode 100644 index 0000000..67bba9b --- /dev/null +++ b/src/app/admin/order/order-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {OrderListComponent} from './order-list/order-list.component'; + + +const routes: Routes = [ + { path: 'order-list', component: OrderListComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class OrderRoutingModule { } diff --git a/src/app/admin/order/order.module.ts b/src/app/admin/order/order.module.ts new file mode 100644 index 0000000..6f9c393 --- /dev/null +++ b/src/app/admin/order/order.module.ts @@ -0,0 +1,28 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { OrderRoutingModule } from './order-routing.module'; +import { OrderListComponent } from './order-list/order-list.component'; +import {NgZorroAntdModule} from 'ng-zorro-antd'; +import {SeparateModule} from '../../common/separate/separate.module'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {RegionSelectorModule} from '../../common/region-selector/region-selector.module'; +import {AppCommonModule} from "../../app-common.module"; + + +@NgModule({ + declarations: [OrderListComponent], + imports: [ + CommonModule, + OrderRoutingModule, + NgZorroAntdModule, + SeparateModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + RegionSelectorModule, + AppCommonModule + ] +}) +export class OrderModule { } diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index 22e464e..dfb3e53 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -18,6 +18,7 @@ import { AuditTypePipe, AuditStatusPipe } from './pipes'; +import { OrderCouponStatusPipe } from './pipes/order/order-coupon-status.pipe'; const PIPES = [ TimesPipe, @@ -27,6 +28,7 @@ const PIPES = [ CouponCodePipe, AuditTypePipe, AuditStatusPipe, + OrderCouponStatusPipe, ]; diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 6e6afe7..d9efb45 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -56,6 +56,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/audit/audit.module').then(m => m.AuditModule), canActivate: [InitGuardService] }, + { + path: 'order', + loadChildren: () => import('./admin/order/order.module').then(m => m.OrderModule), + canActivate: [InitGuardService] + }, { path: 'system', loadChildren: () => import('./admin/system/system.module').then(m => m.SystemModule), diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index e07dc9f..ddadb9b 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -5,3 +5,4 @@ export * from './coupon-status.pipe'; export * from './coupon-code.pipe'; export * from './audit-status.pipe'; export * from './audit-type.pipe'; +export * from './order/order-coupon-status.pipe'; diff --git a/src/app/pipes/order/order-coupon-status.pipe.ts b/src/app/pipes/order/order-coupon-status.pipe.ts new file mode 100644 index 0000000..d5b9963 --- /dev/null +++ b/src/app/pipes/order/order-coupon-status.pipe.ts @@ -0,0 +1,18 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'orderCouponStatus' +}) +export class OrderCouponStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '待销售'; + case 2: + return '未使用'; + case 3: + return '已使用'; + } + } +} diff --git a/src/app/services/icon.service.ts b/src/app/services/icon.service.ts index 28e4b80..e9882fc 100644 --- a/src/app/services/icon.service.ts +++ b/src/app/services/icon.service.ts @@ -12,7 +12,7 @@ export class IconService { constructor(private iconService: NzIconService) { this.iconService.fetchFromIconfont({ - scriptUrl: 'https://at.alicdn.com/t/font_2424521_j7tpclfptw.js' + scriptUrl: 'https://at.alicdn.com/t/font_2424521_9lbh3xk0u0h.js' }); } } diff --git a/src/app/services/order.service.ts b/src/app/services/order.service.ts new file mode 100644 index 0000000..2df09ad --- /dev/null +++ b/src/app/services/order.service.ts @@ -0,0 +1,27 @@ +import { Injectable } from '@angular/core'; +import {environment} from '../../environments/environment'; +import {HttpClient} from '@angular/common/http'; +import {CommonsService} from './commons.service'; + +@Injectable({ + providedIn: 'root' +}) +export class OrderService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 查询卡券订单列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getOrderCouponList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'highOrder/getOrderCouponList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } +}