diff --git a/src/app/admin/audit/audit-coupon/audit-coupon.component.html b/src/app/admin/audit/audit-coupon/audit-coupon.component.html new file mode 100644 index 0000000..62c67af --- /dev/null +++ b/src/app/admin/audit/audit-coupon/audit-coupon.component.html @@ -0,0 +1,92 @@ + + + + + +
+
+
+ +
+ + 审核对象名称 + + + + +
+ + + + + + + + +
+ + 审核流水号 + + + + +
+
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 + + + + 编号 + 审核流水号 + 审核对象名称 + 审核类型 + 提交人员 + 创建时间 + 状态 + 操作 + + + + + {{i+1}} + {{data.approveSerialNo}} + {{data.objectName}} + {{data.objectType | auditType}} + {{data.submitOperatorName}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.status | auditStatus}} + + + + + + + +
+ + + diff --git a/src/app/admin/audit/audit-coupon/audit-coupon.component.scss b/src/app/admin/audit/audit-coupon/audit-coupon.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/audit/audit-coupon/audit-coupon.component.ts b/src/app/admin/audit/audit-coupon/audit-coupon.component.ts new file mode 100644 index 0000000..e1a500c --- /dev/null +++ b/src/app/admin/audit/audit-coupon/audit-coupon.component.ts @@ -0,0 +1,84 @@ +import {Component, OnInit} from '@angular/core'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {IconService} from '../../../services/icon.service'; +import {NzMessageService} from 'ng-zorro-antd'; +import {ActivatedRoute, Router} from '@angular/router'; +import {AuditService} from '../../../services/audit.service'; + +@Component({ + selector: 'app-audit-coupon', + templateUrl: './audit-coupon.component.html', + styleUrls: ['./audit-coupon.component.scss'] +}) +export class AuditCouponComponent implements OnInit { + + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + + constructor( + private form: FormBuilder, + private audit: AuditService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private activatedRoute: ActivatedRoute, + ) { + } + + ngOnInit(): void { + this.init(); + + } + + public init(): void { + this.searchForm = this.form.group({ + objectType: [null], + objectName: [null], + approveSerialNo: [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.audit.getApproveList(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 getDetail(id: number): void { + this.audit.getApproveDetail(id, data => { + console.log(data); + }); + // this.router.navigate(['/admin/merchantStore/store-detail'], { + // queryParams: { + // storeId: id + // } + // }).then(r => console.log(r)); + } + +} diff --git a/src/app/admin/audit/audit-routing.module.ts b/src/app/admin/audit/audit-routing.module.ts new file mode 100644 index 0000000..dabb34a --- /dev/null +++ b/src/app/admin/audit/audit-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {AuditCouponComponent} from './audit-coupon/audit-coupon.component'; + + +const routes: Routes = [ + { path: 'coupon-audit', component: AuditCouponComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class AuditRoutingModule { } diff --git a/src/app/admin/audit/audit.module.ts b/src/app/admin/audit/audit.module.ts new file mode 100644 index 0000000..f207043 --- /dev/null +++ b/src/app/admin/audit/audit.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { AuditRoutingModule } from './audit-routing.module'; +import { AuditCouponComponent } from './audit-coupon/audit-coupon.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 {AppCommonModule} from '../../app-common.module'; + + +@NgModule({ + declarations: [AuditCouponComponent], + imports: [ + CommonModule, + AuditRoutingModule, + NgZorroAntdModule, + SeparateModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + AppCommonModule + ] +}) +export class AuditModule { } 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 deleted file mode 100644 index 8d721de..0000000 --- a/src/app/admin/coupon/coupon-detail/coupon-detail.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -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-list/coupon-list.component.html b/src/app/admin/coupon/coupon-list/coupon-list.component.html index 8b1b1ca..5c2988f 100644 --- a/src/app/admin/coupon/coupon-list/coupon-list.component.html +++ b/src/app/admin/coupon/coupon-list/coupon-list.component.html @@ -103,11 +103,12 @@ 卡券名称 卡券面值 销售价格 + 有效库存 卡券类型 卡券状态 销售截止时间 创建时间 - 操作 + 操作 @@ -117,6 +118,7 @@ {{data.couponName}} ¥{{data.couponPrice}} ¥{{data.salesPrice}} + {{data.stockCount}} {{data.couponType === 1 ? '内部卷' : '外部卷'}} {{data.status | couponStatus}} {{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}} diff --git a/src/app/admin/merchant-store/store-edit/store-edit.component.ts b/src/app/admin/merchant-store/store-edit/store-edit.component.ts index 4ec4c9d..43be6b1 100644 --- a/src/app/admin/merchant-store/store-edit/store-edit.component.ts +++ b/src/app/admin/merchant-store/store-edit/store-edit.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {environment} from '../../../../environments/environment'; import {MerchantService} from '../../../services/merchant.service'; @@ -7,174 +7,179 @@ import {ActivatedRoute} from '@angular/router'; import {ValidatorsService} from '../../../services/validators.service'; import {MerchantStoreService} from '../../../services/merchant-store.service'; -declare var AMap: any; // 一定要声明AMap,要不然报错找不到AMap +declare var AMap: any; // 一定要声明AMap,要不然报错找不到AMap declare var AMapUI: any; @Component({ - selector: 'app-store-edit', - templateUrl: './store-edit.component.html', - styleUrls: ['./store-edit.component.scss'] + selector: 'app-store-edit', + templateUrl: './store-edit.component.html', + styleUrls: ['./store-edit.component.scss'] }) export class StoreEditComponent implements OnInit { - validateForm!: FormGroup; - data: any; - editFlag = false; - id: number; - passwordVisible = false; - logoFile = []; - WEB_SERVE_URL = environment.baseUrl; - previewVisible = false; - constructor( - private fb: FormBuilder, - private merchantStore: MerchantStoreService, - private message: NzMessageService, // 信息提示 - private activatedRoute: ActivatedRoute, - ) { - } + validateForm!: FormGroup; + data: any; + editFlag = false; + id: number; + passwordVisible = false; + logoFile = []; + WEB_SERVE_URL = environment.baseUrl; + previewVisible = false; - ngOnInit(): void { - this.activatedRoute.queryParams.subscribe(queryParams => { - if (queryParams.storeId != null) { - this.editFlag = true; - this.id = queryParams.storeId; - this.getDetails(queryParams.storeId); - } else { - this.getMap (); - } - }); - this.validateForm = this.fb.group({ - telephone: [null, [Validators.required, ValidatorsService.mobile]], - password: [null, [Validators.required, ValidatorsService.minLength(6)]], - storeKey: [null, [Validators.required, ValidatorsService.maxLength(10)]], - storeName: [null, [Validators.required]], - address: [null, [Validators.required]], - latitude: [29.553134, [Validators.required]], - longitude: [106.565428, [Validators.required]], - status: [null], - companyId: [null], - merchantId: [null], - createTime: [null], - secUser: {}, - }); - - } + constructor( + private fb: FormBuilder, + private merchantStore: MerchantStoreService, + private message: NzMessageService, // 信息提示 + private activatedRoute: ActivatedRoute, + ) { + } - // 返回 - getBack() { - history.back(); - } + ngOnInit(): void { + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams.storeId != null) { + this.editFlag = true; + this.id = queryParams.storeId; + this.getDetails(queryParams.storeId); + } else { + this.getMap(); + } + }); + this.validateForm = this.fb.group({ + telephone: [null, [Validators.required, ValidatorsService.mobile]], + password: [null, [Validators.required, ValidatorsService.minLength(6)]], + storeKey: [null, [Validators.required, ValidatorsService.maxLength(10)]], + storeName: [null, [Validators.required]], + address: [null, [Validators.required]], + latitude: [29.553134, [Validators.required]], + longitude: [106.565428, [Validators.required]], + status: [null], + companyId: [null], + regionId: [null], + merchantId: [null], + createTime: [null], + secUser: {}, + }); - // 重置 - public resetForm(): void { - this.validateForm.reset(); - } + } - // 课程保存 - public getSave(): void { - // tslint:disable-next-line:forin - for (const i in this.validateForm.controls) { - this.validateForm.controls[i].markAsDirty(); - this.validateForm.controls[i].updateValueAndValidity(); - if (this.validateForm.controls[i].errors != null) { - this.message.error('必填项不能为空'); - return; - } + // 返回 + getBack() { + history.back(); } - console.log(this.validateForm.value); - this.validateForm.value['secUser']['telephone'] = this.validateForm.value.telephone; - this.validateForm.value['secUser']['password'] = this.validateForm.value.password; - if (this.logoFile.length !== 0) { - if (this.logoFile[0]['response'] != null) { - this.validateForm.value.merchantLogo = this.logoFile[0]['response']['return_data'][0]; - } else { - this.validateForm.value.merchantLogo = this.logoFile[0].name; - } + + // 重置 + public resetForm(): void { + this.validateForm.reset(); } - if (this.editFlag) { - this.validateForm.value.id = this.id; - this.merchantStore.updateMerchantStore(this.validateForm.value, data => { - if (data['return_code'] === '000000') { - this.getBack(); - this.message.success('修改成功'); - } else { - this.message.create('error', '修改失败'); - } - }); - } else { - this.merchantStore.insertMerchantStore(this.validateForm.value, data => { - if (data['return_code'] === '000000') { - this.getBack(); - this.message.success('添加成功'); + // 课程保存 + public getSave(): void { + // tslint:disable-next-line:forin + for (const i in this.validateForm.controls) { + this.validateForm.controls[i].markAsDirty(); + this.validateForm.controls[i].updateValueAndValidity(); + if (this.validateForm.controls[i].errors != null) { + this.message.error('必填项不能为空'); + return; + } + } + console.log(this.validateForm.value); + this.validateForm.value['secUser']['telephone'] = this.validateForm.value.telephone; + this.validateForm.value['secUser']['password'] = this.validateForm.value.password; + if (this.logoFile.length !== 0) { + if (this.logoFile[0]['response'] != null) { + this.validateForm.value.merchantLogo = this.logoFile[0]['response']['return_data'][0]; + } else { + this.validateForm.value.merchantLogo = this.logoFile[0].name; + } + } + if (this.editFlag) { + this.validateForm.value.id = this.id; + this.merchantStore.updateMerchantStore(this.validateForm.value, data => { + if (data['return_code'] === '000000') { + this.getBack(); + this.message.success('修改成功'); + } else { + this.message.create('error', '修改失败'); + } + }); } else { - this.message.create('error', '保存失败'); + + this.merchantStore.insertMerchantStore(this.validateForm.value, data => { + if (data['return_code'] === '000000') { + this.getBack(); + this.message.success('添加成功'); + } else { + this.message.create('error', '保存失败'); + } + }); } - }); } - } - public getDetails(id) { - this.merchantStore.getMerchantStoreById(id, data => { - if (data['return_code'] === '000000') { - data['return_data'].telephone = data['return_data'].secUser.loginName; - data['return_data'].password = data['return_data'].secUser.password; - this.validateForm.patchValue(data['return_data']); - this.getMap (); - } else { - this.message.create('error', data['return_msg']); - } - }); - } + public getDetails(id) { + this.merchantStore.getMerchantStoreById(id, data => { + if (data['return_code'] === '000000') { + data['return_data'].telephone = data['return_data'].secUser.loginName; + data['return_data'].password = data['return_data'].secUser.password; + this.validateForm.patchValue(data['return_data']); + this.getMap(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + // 地图要放到函数里。 + getMap() { + // tslint:disable-next-line:variable-name + AMapUI.loadUI(['misc/PositionPicker'], PositionPicker => { + console.log(this.validateForm.value); + const map = new AMap.Map('container', { + resizeEnable: true, + scrollWheel: false, + center: [this.validateForm.value.longitude, this.validateForm.value.latitude], // 初始化中心点坐标 + zoom: 13, + }); + AMap.plugin(['AMap.ToolBar', 'AMap.Autocomplete'], () => { + const toolbar = new AMap.ToolBar(); + map.addControl(toolbar); + }); + const autoOptions = { + // input 为绑定输入提示功能的input的DOM ID + input: 'input' + }; + const autoComplete = new AMap.Autocomplete(autoOptions); + const placeSearch = new AMap.PlaceSearch({ + map: map + }); // 构造地点查询类 + AMap.event.addListener(autoComplete, 'select', select); // 注册监听,当选中某条记录时会触发 + function select(e) { + placeSearch.setCity(e.poi.adcode); + placeSearch.search(e.poi.name); // 关键字查询查询 + } - // 地图要放到函数里。 - getMap() { - // tslint:disable-next-line:variable-name - AMapUI.loadUI(['misc/PositionPicker'], PositionPicker => { - console.log(this.validateForm.value); - const map = new AMap.Map('container', { - resizeEnable: true, - scrollWheel: false, - center: [this.validateForm.value.longitude, this.validateForm.value.latitude], // 初始化中心点坐标 - zoom: 13, - }); - AMap.plugin(['AMap.ToolBar', 'AMap.Autocomplete'], () => { - const toolbar = new AMap.ToolBar(); - map.addControl(toolbar); - }); - const autoOptions = { - // input 为绑定输入提示功能的input的DOM ID - input: 'input' - }; - const autoComplete = new AMap.Autocomplete(autoOptions); - const placeSearch = new AMap.PlaceSearch({ - map: map - }); // 构造地点查询类 - AMap.event.addListener(autoComplete, 'select', select); // 注册监听,当选中某条记录时会触发 - function select(e) { - placeSearch.setCity(e.poi.adcode); - placeSearch.search(e.poi.name); // 关键字查询查询 - } - const positionPicker = new PositionPicker({ - mode: 'dragMap', - map: map - }); - positionPicker.on('success', positionResult => { - positionResult['latitude'] = positionResult.position.lat; - positionResult['longitude'] = positionResult.position.lng; - this.validateForm.patchValue(positionResult); - }); - positionPicker.on('fail', positionResult => { - console.log(positionResult); - }); - positionPicker.setMode('dragMap'); - positionPicker.start(); - map.panBy(0, 1); + const positionPicker = new PositionPicker({ + mode: 'dragMap', + map: map + }); + positionPicker.on('success', positionResult => { + console.log(positionResult); + positionResult['latitude'] = positionResult.position.lat; + positionResult['longitude'] = positionResult.position.lng; + positionResult['regionId'] = positionResult.regeocode.addressComponent.adcode; + this.validateForm.patchValue(positionResult); + }); + positionPicker.on('fail', positionResult => { + console.log(positionResult); + }); + positionPicker.setMode('dragMap'); + positionPicker.start(); + map.panBy(0, 1); - map.addControl(new AMap.ToolBar({ - liteStyle: true - })); - }); - } + map.addControl(new AMap.ToolBar({ + liteStyle: true + })); + }); + } } 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 d907874..3e6e7de 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 @@ -60,6 +60,7 @@ 编号 + 所属地区 门店编号 门店名称 门店电话 @@ -70,6 +71,7 @@ {{i+1}} + {{data.regionName}} {{data.storeKey}} {{data.storeName}} {{data.telephone}} diff --git a/src/app/admin/merchant-store/store-list/store-list.component.ts b/src/app/admin/merchant-store/store-list/store-list.component.ts index f8c7d2a..6b7e0a6 100644 --- a/src/app/admin/merchant-store/store-list/store-list.component.ts +++ b/src/app/admin/merchant-store/store-list/store-list.component.ts @@ -1,6 +1,5 @@ import { Component, OnInit } from '@angular/core'; 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 {ActivatedRoute, Router} from '@angular/router'; diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index 2553f38..22e464e 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -9,21 +9,24 @@ import {NgZorroAntdModule} from 'ng-zorro-antd'; import {NgxNeditorModule} from '@notadd/ngx-neditor'; // 管道 -import {TimesPipe , TextareaPipe} from './pipes'; -import { SystemPipe } from './pipes/system.pipe'; -import { CouponStatusPipe } from './pipes/coupon-status.pipe'; -import { CouponCodePipe } from './pipes/coupon-code.pipe'; - - - +import { + TimesPipe, + TextareaPipe, + SystemPipe, + CouponStatusPipe, + CouponCodePipe, + AuditTypePipe, + AuditStatusPipe +} from './pipes'; const PIPES = [ - TimesPipe, - TextareaPipe, - SystemPipe, - CouponStatusPipe, - CouponCodePipe, - + TimesPipe, + TextareaPipe, + SystemPipe, + CouponStatusPipe, + CouponCodePipe, + AuditTypePipe, + AuditStatusPipe, ]; @@ -35,13 +38,13 @@ const PIPES = [ NgZorroAntdModule, NgxNeditorModule ], - declarations: [ - ...PIPES, - ], + declarations: [ + ...PIPES, + ], - exports: [ - ...PIPES, - ], + exports: [ + ...PIPES, + ], }) export class AppCommonModule { diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index b2cac53..de5010a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -46,6 +46,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/company/company.module').then(m => m.CompanyModule), canActivate: [InitGuardService] }, + { + path: 'audit', + loadChildren: () => import('./admin/audit/audit.module').then(m => m.AuditModule), + canActivate: [InitGuardService] + }, { path: 'system', loadChildren: () => import('./admin/system/system.module').then(m => m.SystemModule), diff --git a/src/app/pipes/audit-status.pipe.ts b/src/app/pipes/audit-status.pipe.ts new file mode 100644 index 0000000..fe078d0 --- /dev/null +++ b/src/app/pipes/audit-status.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'auditStatus' +}) +export class AuditStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '待审批'; + case 2: + return '驳回'; + case 3: + return '通过'; + } + } + +} diff --git a/src/app/pipes/audit-type.pipe.ts b/src/app/pipes/audit-type.pipe.ts new file mode 100644 index 0000000..77d791c --- /dev/null +++ b/src/app/pipes/audit-type.pipe.ts @@ -0,0 +1,14 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'auditType' +}) +export class AuditTypePipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '卡券上架审批'; + } + } +} diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index 5663590..e07dc9f 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -3,3 +3,5 @@ export * from './commons/textarea.pipe'; export * from './system.pipe'; export * from './coupon-status.pipe'; export * from './coupon-code.pipe'; +export * from './audit-status.pipe'; +export * from './audit-type.pipe'; diff --git a/src/app/services/audit.service.ts b/src/app/services/audit.service.ts new file mode 100644 index 0000000..e516314 --- /dev/null +++ b/src/app/services/audit.service.ts @@ -0,0 +1,40 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class AuditService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 查询审核列表列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getApproveList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'audit/getApproveList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 根据id查询审核详情 + * + * @param approveId 审核id + * @param callBack 回调 + */ + public getApproveDetail(approveId: number, callBack) { + this.http.get(environment.baseUrl + 'audit/getApproveDetail?approveId=' + approveId).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/icon.service.ts b/src/app/services/icon.service.ts index 7f9f424..99b4794 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_2fwfzlplp0d.js' + scriptUrl: 'https://at.alicdn.com/t/font_2424521_5v9iqxejc8h.js' }); } }