From 94d7b882249d3a6ada65ac84212e65f7deff711c Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 16 Mar 2021 20:06:14 +0800 Subject: [PATCH] 1 --- .../coupon-detail.component.html | 1 + .../coupon-detail.component.scss | 0 .../coupon-detail.component.spec.ts | 25 ++++ .../coupon-detail/coupon-detail.component.ts | 15 ++ .../coupon-edit/coupon-edit.component.html | 1 + .../coupon-edit/coupon-edit.component.scss | 0 .../coupon-edit/coupon-edit.component.spec.ts | 25 ++++ .../coupon-edit/coupon-edit.component.ts | 15 ++ .../coupon-list/coupon-list.component.html | 89 ++++++++++++ .../coupon-list/coupon-list.component.scss | 0 .../coupon-list/coupon-list.component.ts | 128 ++++++++++++++++++ src/app/admin/coupon/coupon-routing.module.ts | 18 +++ src/app/admin/coupon/coupon.module.ts | 25 ++++ .../store-list/store-list.component.html | 2 +- .../merchant-list.component.html | 2 +- src/app/services/icon.service.ts | 2 +- 16 files changed, 345 insertions(+), 3 deletions(-) create mode 100644 src/app/admin/coupon/coupon-detail/coupon-detail.component.html create mode 100644 src/app/admin/coupon/coupon-detail/coupon-detail.component.scss create mode 100644 src/app/admin/coupon/coupon-detail/coupon-detail.component.spec.ts create mode 100644 src/app/admin/coupon/coupon-detail/coupon-detail.component.ts create mode 100644 src/app/admin/coupon/coupon-edit/coupon-edit.component.html create mode 100644 src/app/admin/coupon/coupon-edit/coupon-edit.component.scss create mode 100644 src/app/admin/coupon/coupon-edit/coupon-edit.component.spec.ts create mode 100644 src/app/admin/coupon/coupon-edit/coupon-edit.component.ts create mode 100644 src/app/admin/coupon/coupon-list/coupon-list.component.html create mode 100644 src/app/admin/coupon/coupon-list/coupon-list.component.scss create mode 100644 src/app/admin/coupon/coupon-list/coupon-list.component.ts create mode 100644 src/app/admin/coupon/coupon-routing.module.ts create mode 100644 src/app/admin/coupon/coupon.module.ts diff --git a/src/app/admin/coupon/coupon-detail/coupon-detail.component.html b/src/app/admin/coupon/coupon-detail/coupon-detail.component.html new file mode 100644 index 0000000..f40900f --- /dev/null +++ b/src/app/admin/coupon/coupon-detail/coupon-detail.component.html @@ -0,0 +1 @@ +

coupon-detail works!

diff --git a/src/app/admin/coupon/coupon-detail/coupon-detail.component.scss b/src/app/admin/coupon/coupon-detail/coupon-detail.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/coupon/coupon-detail/coupon-detail.component.spec.ts b/src/app/admin/coupon/coupon-detail/coupon-detail.component.spec.ts new file mode 100644 index 0000000..8d721de --- /dev/null +++ b/src/app/admin/coupon/coupon-detail/coupon-detail.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CouponDetailComponent } from './coupon-detail.component'; + +describe('CouponDetailComponent', () => { + let component: CouponDetailComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CouponDetailComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CouponDetailComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/coupon/coupon-detail/coupon-detail.component.ts b/src/app/admin/coupon/coupon-detail/coupon-detail.component.ts new file mode 100644 index 0000000..2ceccc5 --- /dev/null +++ b/src/app/admin/coupon/coupon-detail/coupon-detail.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-coupon-detail', + templateUrl: './coupon-detail.component.html', + styleUrls: ['./coupon-detail.component.scss'] +}) +export class CouponDetailComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/admin/coupon/coupon-edit/coupon-edit.component.html b/src/app/admin/coupon/coupon-edit/coupon-edit.component.html new file mode 100644 index 0000000..2f8962a --- /dev/null +++ b/src/app/admin/coupon/coupon-edit/coupon-edit.component.html @@ -0,0 +1 @@ +

coupon-edit works!

diff --git a/src/app/admin/coupon/coupon-edit/coupon-edit.component.scss b/src/app/admin/coupon/coupon-edit/coupon-edit.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/coupon/coupon-edit/coupon-edit.component.spec.ts b/src/app/admin/coupon/coupon-edit/coupon-edit.component.spec.ts new file mode 100644 index 0000000..02c399b --- /dev/null +++ b/src/app/admin/coupon/coupon-edit/coupon-edit.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CouponEditComponent } from './coupon-edit.component'; + +describe('CouponEditComponent', () => { + let component: CouponEditComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CouponEditComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CouponEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts b/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts new file mode 100644 index 0000000..29d0406 --- /dev/null +++ b/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-coupon-edit', + templateUrl: './coupon-edit.component.html', + styleUrls: ['./coupon-edit.component.scss'] +}) +export class CouponEditComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/admin/coupon/coupon-list/coupon-list.component.html b/src/app/admin/coupon/coupon-list/coupon-list.component.html new file mode 100644 index 0000000..d907874 --- /dev/null +++ b/src/app/admin/coupon/coupon-list/coupon-list.component.html @@ -0,0 +1,89 @@ + + + + + +
+
+
+ +
+ + 门店名称 + + + + +
+
+ + 门店电话 + + + + +
+
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 + + 商戶名称: + {{name}} + +
+ +
+ + + + 编号 + 门店编号 + 门店名称 + 门店电话 + 创建时间 + 操作 + + + + + {{i+1}} + {{data.storeKey}} + {{data.storeName}} + {{data.telephone}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + + + + + + + + + +
+ + + diff --git a/src/app/admin/coupon/coupon-list/coupon-list.component.scss b/src/app/admin/coupon/coupon-list/coupon-list.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/coupon/coupon-list/coupon-list.component.ts b/src/app/admin/coupon/coupon-list/coupon-list.component.ts new file mode 100644 index 0000000..45cb387 --- /dev/null +++ b/src/app/admin/coupon/coupon-list/coupon-list.component.ts @@ -0,0 +1,128 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {MerchantStoreService} from '../../../services/merchant-store.service'; +import {IconService} from '../../../services/icon.service'; +import {NzMessageService} from 'ng-zorro-antd'; +import {ActivatedRoute, Router} from '@angular/router'; +import {CommonsService} from '../../../services/commons.service'; + +@Component({ + selector: 'app-coupon-list', + templateUrl: './coupon-list.component.html', + styleUrls: ['./coupon-list.component.scss'] +}) +export class CouponListComponent implements OnInit { + + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + id = null; + name: string; + constructor( + private form: FormBuilder, + private merchantStore: MerchantStoreService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private activatedRoute: ActivatedRoute, + private common: CommonsService + ) { + } + + ngOnInit(): void { + this.init(); + + } + + public init(): void { + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams.merchantId != null) { + this.id = queryParams.merchantId; + this.name = queryParams.name; + } + }); + this.searchForm = this.form.group({ + storeName: [null], + telephone: [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; + if (this.id == null) { + this.merchantStore.getStoreListByMerchant(whereObject, data => { + if (data['return_code'] === '000000') { + this.requestData = data['return_data'].list; + this.total = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + } else { + whereObject['merchantId'] = this.id; + this.merchantStore.getStoreListByCompany(whereObject, data => { + if (data['return_code'] === '000000') { + 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 getDelete(id): void { + const message = '是否删除门店'; + this.common.showConfirm(message, data => { + if (data) { + this.merchantStore.deleteMerchantStore(id, dataReturn => { + if (dataReturn['return_code'] === '000000') { + this.message.success('操作成功'); + this.getRequest(false , this.searchForm.value); + } else { + this.message.warning(dataReturn['return_msg']); + } + }); + } + }); + } + + // 修改 + public getEdit(id: number): void { + this.router.navigate(['/admin/merchantStore/store-edit'], { + queryParams: { + storeId: id + } + }).then(r => console.log(r)); + } + + // 查看详情 + public getDetail(id: number): void { + this.router.navigate(['/admin/merchantStore/store-detail'], { + queryParams: { + storeId: id + } + }).then(r => console.log(r)); + } + +} diff --git a/src/app/admin/coupon/coupon-routing.module.ts b/src/app/admin/coupon/coupon-routing.module.ts new file mode 100644 index 0000000..ab68db5 --- /dev/null +++ b/src/app/admin/coupon/coupon-routing.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {CouponListComponent} from './coupon-list/coupon-list.component'; +import {CouponEditComponent} from './coupon-edit/coupon-edit.component'; +import {CouponDetailComponent} from './coupon-detail/coupon-detail.component'; + + +const routes: Routes = [ + { path: 'coupon-list', component: CouponListComponent }, + { path: 'coupon-edit', component: CouponEditComponent }, + { path: 'coupon-detail', component: CouponDetailComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class CouponRoutingModule { } diff --git a/src/app/admin/coupon/coupon.module.ts b/src/app/admin/coupon/coupon.module.ts new file mode 100644 index 0000000..669ccf0 --- /dev/null +++ b/src/app/admin/coupon/coupon.module.ts @@ -0,0 +1,25 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { CouponRoutingModule } from './coupon-routing.module'; +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 {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'; + +@NgModule({ + declarations: [CouponListComponent, CouponEditComponent, CouponDetailComponent], + imports: [ + CommonModule, + CouponRoutingModule, + NgZorroAntdModule, + SeparateModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule + ] +}) +export class CouponModule { } diff --git a/src/app/admin/merchant-store/store-list/store-list.component.html b/src/app/admin/merchant-store/store-list/store-list.component.html index ad94c54..d907874 100644 --- a/src/app/admin/merchant-store/store-list/store-list.component.html +++ b/src/app/admin/merchant-store/store-list/store-list.component.html @@ -77,7 +77,7 @@ - + diff --git a/src/app/admin/merchant/merchant-list/merchant-list.component.html b/src/app/admin/merchant/merchant-list/merchant-list.component.html index 9ac6b71..307cce4 100644 --- a/src/app/admin/merchant/merchant-list/merchant-list.component.html +++ b/src/app/admin/merchant/merchant-list/merchant-list.component.html @@ -97,7 +97,7 @@ - + diff --git a/src/app/services/icon.service.ts b/src/app/services/icon.service.ts index d5e0a2d..88d52dc 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_2413274_zk7ae4qcrvg.js' + scriptUrl: 'https://at.alicdn.com/t/font_2424521_y0mw6uv5r2.js' }); } }