提交修改

pull/1/head
袁野 4 years ago
parent 0a2b69f11a
commit cd2e772c56
  1. 92
      src/app/admin/audit/audit-coupon/audit-coupon.component.html
  2. 0
      src/app/admin/audit/audit-coupon/audit-coupon.component.scss
  3. 84
      src/app/admin/audit/audit-coupon/audit-coupon.component.ts
  4. 14
      src/app/admin/audit/audit-routing.module.ts
  5. 26
      src/app/admin/audit/audit.module.ts
  6. 25
      src/app/admin/coupon/coupon-detail/coupon-detail.component.spec.ts
  7. 4
      src/app/admin/coupon/coupon-list/coupon-list.component.html
  8. 307
      src/app/admin/merchant-store/store-edit/store-edit.component.ts
  9. 2
      src/app/admin/merchant-store/store-list/store-list.component.html
  10. 1
      src/app/admin/merchant-store/store-list/store-list.component.ts
  11. 41
      src/app/app-common.module.ts
  12. 5
      src/app/app-routing.module.ts
  13. 19
      src/app/pipes/audit-status.pipe.ts
  14. 14
      src/app/pipes/audit-type.pipe.ts
  15. 2
      src/app/pipes/index.ts
  16. 40
      src/app/services/audit.service.ts
  17. 2
      src/app/services/icon.service.ts

@ -0,0 +1,92 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
<div nz-row>
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">审核对象名称</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="objectName"/>
</nz-form-control>
</nz-form-item>
</div>
<!-- <div nz-col nzSpan="6">-->
<!-- <nz-form-item>-->
<!-- <nz-form-label [nzSpan]="6">审核类型</nz-form-label>-->
<!-- <nz-form-control [nzSpan]="16">-->
<!-- <input nz-input formControlName="objectType"/>-->
<!-- </nz-form-control>-->
<!-- </nz-form-item>-->
<!-- </div>-->
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">审核流水号</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="approveSerialNo"/>
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
<div nz-col nzSpan="24" class="search-button">
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button>
</div>
</div>
</form>
</div>
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<nz-table
class="table"
#ajaxTable
nzShowSizeChanger
[nzFrontPagination]="false"
[nzData]="requestData"
[nzLoading]="loading"
[nzTotal]="total"
[(nzPageIndex)]="pageNum"
[(nzPageSize)]="pageSize"
[nzScroll]="{ x: '1200px' }"
(nzPageIndexChange)="getRequest(false , searchForm.value)"
(nzPageSizeChange)="getRequest(false , searchForm.value)">
<thead nzSingleSort>
<tr>
<th nzWidth="50px">编号</th>
<th nzWidth="120px">审核流水号</th>
<th nzWidth="80px">审核对象名称</th>
<th nzWidth="80px">审核类型</th>
<th nzWidth="100px">提交人员</th>
<th nzWidth="100px">创建时间</th>
<th nzWidth="80px">状态</th>
<th nzWidth="80px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i+1}}</td>
<td>{{data.approveSerialNo}}</td>
<td>{{data.objectName}}</td>
<td>{{data.objectType | auditType}}</td>
<td>{{data.submitOperatorName}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.status | auditStatus}}</td>
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-xiangqing'" nz-tooltip="审核详情"></i></a>
</td>
</tbody>
</nz-table>
</div>

@ -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));
}
}

@ -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 { }

@ -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 { }

@ -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<CouponDetailComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CouponDetailComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CouponDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -103,11 +103,12 @@
<th nzWidth="80px">卡券名称</th>
<th nzWidth="100px">卡券面值</th>
<th nzWidth="100px">销售价格</th>
<th nzWidth="100px">有效库存</th>
<th nzWidth="100px">卡券类型</th>
<th nzWidth="100px">卡券状态</th>
<th nzWidth="120px">销售截止时间</th>
<th nzWidth="120px">创建时间</th>
<th nzWidth="120px" nzRight="0px">操作</th>
<th nzWidth="150px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
@ -117,6 +118,7 @@
<td>{{data.couponName}}</td>
<td>¥{{data.couponPrice}}</td>
<td>¥{{data.salesPrice}}</td>
<td>{{data.stockCount}}</td>
<td>{{data.couponType === 1 ? '内部卷' : '外部卷'}}</td>
<td>{{data.status | couponStatus}}</td>
<td>{{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td>

@ -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
}));
});
}
}

@ -60,6 +60,7 @@
<thead nzSingleSort>
<tr>
<th nzWidth="50px">编号</th>
<th nzWidth="80px">所属地区</th>
<th nzWidth="80px">门店编号</th>
<th nzWidth="80px">门店名称</th>
<th nzWidth="100px">门店电话</th>
@ -70,6 +71,7 @@
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i+1}}</td>
<td>{{data.regionName}}</td>
<td>{{data.storeKey}}</td>
<td>{{data.storeName}}</td>
<td>{{data.telephone}}</td>

@ -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';

@ -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 {

@ -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),

@ -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 '通过';
}
}
}

@ -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 '卡券上架审批';
}
}
}

@ -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';

@ -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);
});
}
}

@ -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'
});
}
}

Loading…
Cancel
Save