From be5e129e4e675c6b258910f359285f2c2f8eeacc Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Sun, 14 Nov 2021 09:48:42 +0800 Subject: [PATCH] 1 --- .../config-manage/brand/brand.component.html | 1 + .../config-manage/brand/brand.component.scss | 0 .../brand/brand.component.spec.ts | 25 +++++ .../config-manage/brand/brand.component.ts | 15 +++ .../config-manage-routing.module.ts | 16 +++ .../config-manage/config-manage.module.ts | 27 +++++ .../goods-type/goods-type.component.html | 89 +++++++++++++++ .../goods-type/goods-type.component.scss | 4 + .../goods-type/goods-type.component.ts | 102 ++++++++++++++++++ src/app/services/config.service.ts | 79 ++++++++++++++ 10 files changed, 358 insertions(+) create mode 100644 src/app/admin/config-manage/brand/brand.component.html create mode 100644 src/app/admin/config-manage/brand/brand.component.scss create mode 100644 src/app/admin/config-manage/brand/brand.component.spec.ts create mode 100644 src/app/admin/config-manage/brand/brand.component.ts create mode 100644 src/app/admin/config-manage/config-manage-routing.module.ts create mode 100644 src/app/admin/config-manage/config-manage.module.ts create mode 100644 src/app/admin/config-manage/goods-type/goods-type.component.html create mode 100644 src/app/admin/config-manage/goods-type/goods-type.component.scss create mode 100644 src/app/admin/config-manage/goods-type/goods-type.component.ts create mode 100644 src/app/services/config.service.ts diff --git a/src/app/admin/config-manage/brand/brand.component.html b/src/app/admin/config-manage/brand/brand.component.html new file mode 100644 index 0000000..b45f4d0 --- /dev/null +++ b/src/app/admin/config-manage/brand/brand.component.html @@ -0,0 +1 @@ +

brand works!

diff --git a/src/app/admin/config-manage/brand/brand.component.scss b/src/app/admin/config-manage/brand/brand.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/config-manage/brand/brand.component.spec.ts b/src/app/admin/config-manage/brand/brand.component.spec.ts new file mode 100644 index 0000000..54396a4 --- /dev/null +++ b/src/app/admin/config-manage/brand/brand.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BrandComponent } from './brand.component'; + +describe('BrandComponent', () => { + let component: BrandComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ BrandComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(BrandComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/config-manage/brand/brand.component.ts b/src/app/admin/config-manage/brand/brand.component.ts new file mode 100644 index 0000000..c99868c --- /dev/null +++ b/src/app/admin/config-manage/brand/brand.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-brand', + templateUrl: './brand.component.html', + styleUrls: ['./brand.component.scss'] +}) +export class BrandComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/admin/config-manage/config-manage-routing.module.ts b/src/app/admin/config-manage/config-manage-routing.module.ts new file mode 100644 index 0000000..def515b --- /dev/null +++ b/src/app/admin/config-manage/config-manage-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {GoodsTypeComponent} from './goods-type/goods-type.component'; +import {BrandComponent} from './brand/brand.component'; + + +const routes: Routes = [ + { path: 'goods-type', component: GoodsTypeComponent }, + { path: 'brand', component: BrandComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class ConfigManageRoutingModule { } diff --git a/src/app/admin/config-manage/config-manage.module.ts b/src/app/admin/config-manage/config-manage.module.ts new file mode 100644 index 0000000..603484c --- /dev/null +++ b/src/app/admin/config-manage/config-manage.module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { ConfigManageRoutingModule } from './config-manage-routing.module'; +import { GoodsTypeComponent } from './goods-type/goods-type.component'; +import { BrandComponent } from './brand/brand.component'; +import {NgZorroAntdModule} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {SeparateModule} from '../../common/separate/separate.module'; +import {FormsModule, ReactiveFormsModule} from '_@angular_forms@9.0.7@@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {RegionSelectorModule} from '../../common/region-selector/region-selector.module'; + + +@NgModule({ + declarations: [GoodsTypeComponent, BrandComponent], + imports: [ + CommonModule, + ConfigManageRoutingModule, + NgZorroAntdModule, + SeparateModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + RegionSelectorModule + ] +}) +export class ConfigManageModule { } diff --git a/src/app/admin/config-manage/goods-type/goods-type.component.html b/src/app/admin/config-manage/goods-type/goods-type.component.html new file mode 100644 index 0000000..181a32c --- /dev/null +++ b/src/app/admin/config-manage/goods-type/goods-type.component.html @@ -0,0 +1,89 @@ + + + + + +
+
+
+
+ + 标题 + + + + +
+
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 +
+ +
+ + + + 编号 + 标题 + 图片 + 创建时间 + 更新时间 + 操作 + + + + + {{i+1}} + {{data.titile}} + + + + {{data.createdTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.updatedTime | date: 'yyyy-MM-dd HH:mm'}} + + 编辑 + + + + +
+ + +
+ + 标题 + + + + + + 图片 + + + + +
+
diff --git a/src/app/admin/config-manage/goods-type/goods-type.component.scss b/src/app/admin/config-manage/goods-type/goods-type.component.scss new file mode 100644 index 0000000..8bee3fb --- /dev/null +++ b/src/app/admin/config-manage/goods-type/goods-type.component.scss @@ -0,0 +1,4 @@ +.head_img { + height: 60px; + width: 60px; +} diff --git a/src/app/admin/config-manage/goods-type/goods-type.component.ts b/src/app/admin/config-manage/goods-type/goods-type.component.ts new file mode 100644 index 0000000..9847adb --- /dev/null +++ b/src/app/admin/config-manage/goods-type/goods-type.component.ts @@ -0,0 +1,102 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; +import {IconService} from '../../../services/icon.service'; +import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {Router} from '_@angular_router@9.0.7@@angular/router'; +import {ConfigService} from '../../../services/config.service'; + +@Component({ + selector: 'app-goods-type', + templateUrl: './goods-type.component.html', + styleUrls: ['./goods-type.component.scss'] +}) +export class GoodsTypeComponent implements OnInit { + + WEB_SERVE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + isVisible = false; + id; + validateForm!: FormGroup; + + constructor( + private form: FormBuilder, + private config: ConfigService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private fb: FormBuilder, + ) { + } + + ngOnInit(): void { + this.init(); + } + + public init(): void { + this.searchForm = this.form.group({ + title: [null], + }); + this.validateForm = this.fb.group({ + title: [null, [Validators.required]], + img: [null, [Validators.required]], + }); + 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.config.getListGoodsType(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 getEdit(id?: number): void { + this.id = id; + this.isVisible = true; + } + + // 查看详情 + public getDetail(id: number): void { + this.router.navigate(['/admin/company/company-detail'], { + queryParams: { + companyId: id + } + }).then(r => console.log(r)); + } + + handleOk(): void { + this.isVisible = false; + } + + handleCancel(): void { + this.isVisible = false; + } + +} + diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts new file mode 100644 index 0000000..a75c513 --- /dev/null +++ b/src/app/services/config.service.ts @@ -0,0 +1,79 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class ConfigService { + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 查询公司列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getListGoodsType(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'highGoodsType/getListGoodsType?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 新增 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public addCompanyAndUser(params: object, callBack) { + this.http.post(environment.baseUrl + 'bsCompany/addCompanyAndUser', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改卡券 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public updateCompany(params: object, callBack) { + this.http.post(environment.baseUrl + 'bsCompany/updateCompany', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 根据id查询详情 + * + * @param companyId 公司id + * @param callBack 回调 + */ + public companyView(companyId: number, callBack) { + this.http.get(environment.baseUrl + 'bsCompany/companyView?companyId=' + companyId).subscribe(data => { + callBack(data); + }); + } + + + /** + * 修改公司状态 + * + * @param id 用户id + * @param status status + * @param callBack 返回参数 + */ + public editStatus(id: number, status: number , callBack) { + this.http.get(environment.baseUrl + 'bsCompany/editStatus?companyId=' + id + '&status=' + status).subscribe(data => { + callBack(data); + }); + } + +}