parent
47a9b2d0d2
commit
24ed2cfc1f
@ -0,0 +1,82 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<nz-breadcrumb> |
||||||
|
<nz-breadcrumb-item> |
||||||
|
代理商 |
||||||
|
</nz-breadcrumb-item> |
||||||
|
<nz-breadcrumb-item> |
||||||
|
添加代理商 |
||||||
|
</nz-breadcrumb-item> |
||||||
|
</nz-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
<div class="inner-content"> |
||||||
|
<div class="main"> |
||||||
|
<form nz-form [formGroup]="companyForm"> |
||||||
|
<div class="title">账户信息</div> |
||||||
|
<div nz-row> |
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8" nzRequired>账户名称</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<input nz-input type="text" formControlName="loginName" placeholder="请输入账户" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8" nzRequired>账户密码</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<input nz-input type="text" formControlName="password" placeholder="请输入密码" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="title">公司信息</div> |
||||||
|
<div nz-row> |
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8" nzRequired>地区</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<nz-select formControlName="regionId" nzShowSearch nzAllowClear [nzPlaceHolder]="'请选择公司地区'"> |
||||||
|
<nz-option *ngFor="let item of provinceArray" nzValue="{{item.regionId}}" nzLabel="{{item.regionName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8" nzRequired>公司名称</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<input nz-input type="text" formControlName="name" placeholder="请输入公司名称" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">联系电话</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<input nz-input formControlName="phone" placeholder="联系电话"/> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">所在地址</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<textarea nz-input rows="4" maxlength="100" formControlName="address" placeholder="详细地址"></textarea> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="btn-div"> |
||||||
|
<button class="btn-post" nz-button nzType="primary" (click)="submitFrom()" [nzLoading]="btnLoading" nzBlock>保存</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,46 @@ |
|||||||
|
.main { |
||||||
|
width: 90%; |
||||||
|
margin-left: 5%; |
||||||
|
.title { |
||||||
|
width: 100%; |
||||||
|
height: 46px; |
||||||
|
line-height: 46px; |
||||||
|
font-size: 16px; |
||||||
|
text-align: center; |
||||||
|
color: #1890ff; |
||||||
|
background-color: #f3f9ff; |
||||||
|
margin-bottom: 20px; |
||||||
|
} |
||||||
|
.idCard { |
||||||
|
img { |
||||||
|
width: 100px; |
||||||
|
} |
||||||
|
.userImg { |
||||||
|
width: 90px; |
||||||
|
} |
||||||
|
} |
||||||
|
.post_p_l { |
||||||
|
//margin-left: 5% ; |
||||||
|
} |
||||||
|
.main_post_p { |
||||||
|
font-size: 12px; |
||||||
|
color: #999999; |
||||||
|
margin-top: -10px; |
||||||
|
} |
||||||
|
.btn { |
||||||
|
margin-top: 20px; |
||||||
|
} |
||||||
|
.bottom_solid { |
||||||
|
border-bottom: 1px solid #e4e4e4; |
||||||
|
} |
||||||
|
.btn-div { |
||||||
|
width: 100%; |
||||||
|
text-align: center; |
||||||
|
} |
||||||
|
.btn-post { |
||||||
|
width: 25%; |
||||||
|
} |
||||||
|
nz-date-picker { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||||
|
|
||||||
|
import { CompanyAddComponent } from './company-add.component'; |
||||||
|
|
||||||
|
describe('CompanyAddComponent', () => { |
||||||
|
let component: CompanyAddComponent; |
||||||
|
let fixture: ComponentFixture<CompanyAddComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ CompanyAddComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(CompanyAddComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,73 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
||||||
|
import {NzModalService} from 'ng-zorro-antd'; |
||||||
|
import {ActivatedRoute, Router} from '@angular/router'; |
||||||
|
import {ValidatorsService} from '../../../services/validators.service'; |
||||||
|
import {CompanyService} from '../../../services/company.service'; |
||||||
|
import {CommonsService} from '../../../services/commons.service'; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-company-add', |
||||||
|
templateUrl: './company-add.component.html', |
||||||
|
styleUrls: ['./company-add.component.scss'] |
||||||
|
}) |
||||||
|
export class CompanyAddComponent implements OnInit { |
||||||
|
|
||||||
|
companyForm: FormGroup; |
||||||
|
btnLoading = false; |
||||||
|
provinceArray = []; |
||||||
|
|
||||||
|
constructor(private form: FormBuilder, |
||||||
|
private modal: NzModalService, |
||||||
|
private companyService: CompanyService, |
||||||
|
private commonsService: CommonsService, |
||||||
|
private activatedRoute: ActivatedRoute, |
||||||
|
private router: Router) { } |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.commonsService.getProvinceList(data => { |
||||||
|
this.provinceArray = data['return_data']; |
||||||
|
}); |
||||||
|
|
||||||
|
this.companyForm = this.form.group({ |
||||||
|
regionId: [null, [Validators.required]], |
||||||
|
name: [null, [Validators.required]], |
||||||
|
loginName: [null, [Validators.required, ValidatorsService.minLength(6), ValidatorsService.maxLength(20)]], |
||||||
|
password: [null, [Validators.required, ValidatorsService.minLength(6), ValidatorsService.maxLength(20)]], |
||||||
|
address: [null], |
||||||
|
phone: [null], |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
submitFrom() { |
||||||
|
this.btnLoading = true; |
||||||
|
for (const i in this.companyForm.controls) { |
||||||
|
this.companyForm.controls[i].markAsDirty(); |
||||||
|
this.companyForm.controls[i].updateValueAndValidity(); |
||||||
|
} |
||||||
|
if (this.companyForm.status == null || this.companyForm.status !== 'VALID') { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '请规范填写所有的必填项信息', |
||||||
|
}); |
||||||
|
this.btnLoading = false; |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
this.companyService.insertCompany(this.companyForm.value, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.modal.success({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '添加成功', |
||||||
|
nzOnOk: () => this.router.navigateByUrl('admin/company/list') |
||||||
|
}); |
||||||
|
} else { |
||||||
|
this.modal.error({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'], |
||||||
|
}); |
||||||
|
} |
||||||
|
this.btnLoading = false; |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<app-breadcrumb></app-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
<!--条件搜索--> |
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">公司名称</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="name" /> |
||||||
|
</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>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||||
|
<div class="operating-button"> |
||||||
|
<button nz-button nzType="primary" class="right-btn" [routerLink]="'/admin/company/add'"><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button> |
||||||
|
</div> |
||||||
|
|
||||||
|
<!--数组表格 --> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="dataObject.list" |
||||||
|
[nzTotal]="dataObject.total" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzLoading]="tableLoading" |
||||||
|
[nzPageIndex]="whereObject.pageNum" |
||||||
|
(nzPageIndexChange)="requestData($event)" |
||||||
|
[nzScroll]="{ x: '1150px'}"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="100px">序号</th> |
||||||
|
<th nzWidth="200px">公司地区</th> |
||||||
|
<th nzWidth="200px">公司名称</th> |
||||||
|
<th nzWidth="150px">联系电话</th> |
||||||
|
<th nzWidth="200px">详细地址</th> |
||||||
|
<th nzWidth="160px">创建时间</th> |
||||||
|
<th nzWidth="150px" nzRight="0px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||||
|
<td>{{i + 1}}</td> |
||||||
|
<td>{{data.regionName}}</td> |
||||||
|
<td>{{data.name}}</td> |
||||||
|
<td>{{data.phone?data.phone:'未填写'}}</td> |
||||||
|
<td>{{data.address?data.address:'未填写'}}</td> |
||||||
|
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td nzRight="0px" class="table-td-operation"> |
||||||
|
<!--<a [routerLink]="['/admin/agent/detail']" [queryParams]="{agentId: data.id}">详情</a>--> |
||||||
|
<a [routerLink]="['/admin/company/update']" [queryParams]="{companyId: data.id}">修改</a> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
@ -0,0 +1,25 @@ |
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||||
|
|
||||||
|
import { CompanyListComponent } from './company-list.component'; |
||||||
|
|
||||||
|
describe('CompanyListComponent', () => { |
||||||
|
let component: CompanyListComponent; |
||||||
|
let fixture: ComponentFixture<CompanyListComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ CompanyListComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(CompanyListComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,64 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
import {FormBuilder, FormGroup} from '@angular/forms'; |
||||||
|
import {NzMessageService, NzModalService} from 'ng-zorro-antd'; |
||||||
|
import {CompanyService} from '../../../services/company.service'; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-company-list', |
||||||
|
templateUrl: './company-list.component.html', |
||||||
|
styleUrls: ['./company-list.component.scss'] |
||||||
|
}) |
||||||
|
export class CompanyListComponent implements OnInit { |
||||||
|
|
||||||
|
dataObject: any = {}; |
||||||
|
tableLoading = true; |
||||||
|
searchForm: FormGroup; |
||||||
|
pageNum: number; |
||||||
|
whereObject: any = {}; |
||||||
|
|
||||||
|
constructor(private modal: NzModalService, |
||||||
|
private message: NzMessageService, |
||||||
|
private companyService: CompanyService, |
||||||
|
private form: FormBuilder) { } |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.searchForm = this.form.group({ |
||||||
|
name: [null], |
||||||
|
}); |
||||||
|
this.requestData(1); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 请求数据 |
||||||
|
*/ |
||||||
|
requestData(pageNum) { |
||||||
|
this.tableLoading = true; |
||||||
|
this.whereObject['pageNum'] = pageNum; |
||||||
|
this.whereObject['pageSize'] = 10; |
||||||
|
this.companyService.selectCompanyList(this.whereObject, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.dataObject = data['return_data']; |
||||||
|
} else { |
||||||
|
this.modal.error(data['return_msg']); |
||||||
|
} |
||||||
|
this.tableLoading = false; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 搜索 |
||||||
|
* @param whereObject 条件 |
||||||
|
*/ |
||||||
|
search(whereObject: object) { |
||||||
|
this.whereObject = whereObject; |
||||||
|
this.requestData(1); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 重置 |
||||||
|
*/ |
||||||
|
resetForm(): void { |
||||||
|
this.searchForm.reset(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
import { NgModule } from '@angular/core'; |
||||||
|
import { Routes, RouterModule } from '@angular/router'; |
||||||
|
import {CompanyListComponent} from './company-list/company-list.component'; |
||||||
|
import {CompanyAddComponent} from './company-add/company-add.component'; |
||||||
|
import {CompanyUpdateComponent} from './company-update/company-update.component'; |
||||||
|
|
||||||
|
|
||||||
|
const routes: Routes = [ |
||||||
|
{ path: 'list', component: CompanyListComponent }, |
||||||
|
{ path: 'add', component: CompanyAddComponent }, |
||||||
|
{ path: 'update', component: CompanyUpdateComponent }, |
||||||
|
]; |
||||||
|
|
||||||
|
@NgModule({ |
||||||
|
imports: [RouterModule.forChild(routes)], |
||||||
|
exports: [RouterModule] |
||||||
|
}) |
||||||
|
export class CompanyRoutingModule { } |
@ -0,0 +1,72 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<nz-breadcrumb> |
||||||
|
<nz-breadcrumb-item> |
||||||
|
代理商 |
||||||
|
</nz-breadcrumb-item> |
||||||
|
<nz-breadcrumb-item> |
||||||
|
添加代理商 |
||||||
|
</nz-breadcrumb-item> |
||||||
|
</nz-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
<div class="inner-content"> |
||||||
|
<div class="main"> |
||||||
|
<form nz-form [formGroup]="companyForm"> |
||||||
|
<div class="title">账户信息</div> |
||||||
|
<div nz-row> |
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8" nzRequired>账户名称</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<input nz-input type="text" formControlName="loginName" placeholder="请输入账户" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="title">公司信息</div> |
||||||
|
<div nz-row> |
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8" nzRequired>地区</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<nz-select formControlName="regionId" nzShowSearch nzAllowClear [nzPlaceHolder]="'请选择公司地区'"> |
||||||
|
<nz-option *ngFor="let item of provinceArray" nzValue="{{item.regionId}}" nzLabel="{{item.regionName}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8" nzRequired>公司名称</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<input nz-input type="text" formControlName="name" placeholder="请输入公司名称" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">联系电话</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<input nz-input formControlName="phone" placeholder="联系电话"/> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col class="gutter-row" [nzSpan]="24"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">所在地址</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="8"> |
||||||
|
<textarea nz-input rows="4" maxlength="100" formControlName="address" placeholder="详细地址"></textarea> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="btn-div"> |
||||||
|
<button class="btn-post" nz-button nzType="primary" (click)="submitFrom()" [nzLoading]="btnLoading" nzBlock>保存</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,46 @@ |
|||||||
|
.main { |
||||||
|
width: 90%; |
||||||
|
margin-left: 5%; |
||||||
|
.title { |
||||||
|
width: 100%; |
||||||
|
height: 46px; |
||||||
|
line-height: 46px; |
||||||
|
font-size: 16px; |
||||||
|
text-align: center; |
||||||
|
color: #1890ff; |
||||||
|
background-color: #f3f9ff; |
||||||
|
margin-bottom: 20px; |
||||||
|
} |
||||||
|
.idCard { |
||||||
|
img { |
||||||
|
width: 100px; |
||||||
|
} |
||||||
|
.userImg { |
||||||
|
width: 90px; |
||||||
|
} |
||||||
|
} |
||||||
|
.post_p_l { |
||||||
|
//margin-left: 5% ; |
||||||
|
} |
||||||
|
.main_post_p { |
||||||
|
font-size: 12px; |
||||||
|
color: #999999; |
||||||
|
margin-top: -10px; |
||||||
|
} |
||||||
|
.btn { |
||||||
|
margin-top: 20px; |
||||||
|
} |
||||||
|
.bottom_solid { |
||||||
|
border-bottom: 1px solid #e4e4e4; |
||||||
|
} |
||||||
|
.btn-div { |
||||||
|
width: 100%; |
||||||
|
text-align: center; |
||||||
|
} |
||||||
|
.btn-post { |
||||||
|
width: 25%; |
||||||
|
} |
||||||
|
nz-date-picker { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||||
|
|
||||||
|
import { CompanyUpdateComponent } from './company-update.component'; |
||||||
|
|
||||||
|
describe('CompanyUpdateComponent', () => { |
||||||
|
let component: CompanyUpdateComponent; |
||||||
|
let fixture: ComponentFixture<CompanyUpdateComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ CompanyUpdateComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(CompanyUpdateComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,87 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
||||||
|
import {NzModalService} from 'ng-zorro-antd'; |
||||||
|
import {CompanyService} from '../../../services/company.service'; |
||||||
|
import {CommonsService} from '../../../services/commons.service'; |
||||||
|
import {ActivatedRoute, Params, Router} from '@angular/router'; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-company-update', |
||||||
|
templateUrl: './company-update.component.html', |
||||||
|
styleUrls: ['./company-update.component.scss'] |
||||||
|
}) |
||||||
|
export class CompanyUpdateComponent implements OnInit { |
||||||
|
|
||||||
|
companyForm: FormGroup; |
||||||
|
btnLoading = false; |
||||||
|
provinceArray = []; |
||||||
|
|
||||||
|
dataObject: any = {}; |
||||||
|
|
||||||
|
|
||||||
|
constructor(private form: FormBuilder, |
||||||
|
private modal: NzModalService, |
||||||
|
private companyService: CompanyService, |
||||||
|
private commonsService: CommonsService, |
||||||
|
private activatedRoute: ActivatedRoute, |
||||||
|
private router: Router) { } |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.commonsService.getProvinceList(data => { |
||||||
|
this.provinceArray = data['return_data']; |
||||||
|
}); |
||||||
|
|
||||||
|
this.activatedRoute.queryParams.subscribe((queryParams: Params) => { |
||||||
|
if (queryParams['companyId'] != null && queryParams['companyId'].length > 0) { |
||||||
|
this.companyService.companyView(queryParams['companyId'], data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.dataObject = data['return_data']['company']; |
||||||
|
this.dataObject['loginName'] = data['return_data']['user']['loginName']; |
||||||
|
this.dataObject['password'] = data['return_data']['user']['password']; |
||||||
|
this.companyForm.patchValue(this.dataObject); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
this.companyForm = this.form.group({ |
||||||
|
regionId: [null, [Validators.required]], |
||||||
|
name: [null, [Validators.required]], |
||||||
|
loginName: [{ value: null, disabled: true}], |
||||||
|
address: [null], |
||||||
|
phone: [null], |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
submitFrom() { |
||||||
|
this.btnLoading = true; |
||||||
|
for (const i in this.companyForm.controls) { |
||||||
|
this.companyForm.controls[i].markAsDirty(); |
||||||
|
this.companyForm.controls[i].updateValueAndValidity(); |
||||||
|
} |
||||||
|
if (this.companyForm.status == null || this.companyForm.status !== 'VALID') { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '请规范填写所有的必填项信息', |
||||||
|
}); |
||||||
|
this.btnLoading = false; |
||||||
|
return; |
||||||
|
} |
||||||
|
this.companyForm.value['companyId'] = this.dataObject['id']; |
||||||
|
this.companyService.updateCompany(this.companyForm.value, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.modal.success({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '修改成功', |
||||||
|
nzOnOk: () => this.router.navigateByUrl('admin/company/list') |
||||||
|
}); |
||||||
|
} else { |
||||||
|
this.modal.error({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'], |
||||||
|
}); |
||||||
|
} |
||||||
|
this.btnLoading = false; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
import { NgModule } from '@angular/core'; |
||||||
|
import { CommonModule } from '@angular/common'; |
||||||
|
|
||||||
|
import { CompanyRoutingModule } from './company-routing.module'; |
||||||
|
import { CompanyAddComponent } from './company-add/company-add.component'; |
||||||
|
import { CompanyListComponent } from './company-list/company-list.component'; |
||||||
|
import { CompanyUpdateComponent } from './company-update/company-update.component'; |
||||||
|
import {NgZorroAntdModule} from 'ng-zorro-antd'; |
||||||
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; |
||||||
|
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; |
||||||
|
import {AppCommonModule} from '../../app-common.module'; |
||||||
|
|
||||||
|
|
||||||
|
@NgModule({ |
||||||
|
declarations: [CompanyAddComponent, CompanyListComponent, CompanyUpdateComponent], |
||||||
|
imports: [ |
||||||
|
CommonModule, |
||||||
|
CompanyRoutingModule, |
||||||
|
NgZorroAntdModule, |
||||||
|
ReactiveFormsModule, |
||||||
|
FormsModule, |
||||||
|
BreadcrumbModule, |
||||||
|
AppCommonModule, |
||||||
|
] |
||||||
|
}) |
||||||
|
export class CompanyModule { } |
@ -1,3 +1,7 @@ |
|||||||
.table-td-operation a { |
.table-td-operation a { |
||||||
padding: 0px 5px; |
padding: 0px 5px; |
||||||
} |
} |
||||||
|
.collapse { |
||||||
|
margin-left: 8px; |
||||||
|
font-size: 12px; |
||||||
|
} |
||||||
|
@ -0,0 +1,183 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<app-breadcrumb></app-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
<!--条件搜索--> |
||||||
|
|
||||||
|
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}"> |
||||||
|
<div class="inner-content"> |
||||||
|
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">订单号</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="orderNo" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">订单类型</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select nzAllowClear formControlName="orderType"> |
||||||
|
<nz-option *ngFor="let item of deviceOrderTypeArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">设备类型</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select nzAllowClear formControlName="deviceType"> |
||||||
|
<nz-option *ngFor="let item of deviceTypeArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div nz-row *ngIf="isCollapse"> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">订单状态</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select nzAllowClear formControlName="status"> |
||||||
|
<nz-option *ngFor="let item of deviceOrderStatusArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="8" *ngIf="roleType == 1"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">公司</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="companyName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="8" *ngIf="roleType == 1 || roleType == 6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">代理商</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="agentName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="8" *ngIf="roleType == 1 || roleType == 2 || roleType == 6"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">业务员</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="salesmanName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">商户</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="merName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">门店</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="storeName" /> |
||||||
|
</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> |
||||||
|
<a class="collapse" (click)="toggleCollapse()">更多条件 |
||||||
|
<i nz-icon [nzType]="isCollapse ? 'down' : 'up'"></i> |
||||||
|
</a> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||||
|
<div class="operating-button"> |
||||||
|
</div> |
||||||
|
|
||||||
|
<!--数组表格 --> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="dataObject.list" |
||||||
|
[nzTotal]="dataObject.total" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzLoading]="tableLoading" |
||||||
|
[nzPageIndex]="whereObject.pageNum" |
||||||
|
(nzPageIndexChange)="requestData($event)" |
||||||
|
[nzScroll]="{ x: '1150px'}"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="200px">商户</th> |
||||||
|
<th nzWidth="150px">门店</th> |
||||||
|
<th nzWidth="200px">订单编号</th> |
||||||
|
<th nzWidth="100px">订单类型</th> |
||||||
|
<th nzWidth="130px">设备类型</th> |
||||||
|
<th nzWidth="100px">需求数量</th> |
||||||
|
<th nzWidth="100px">支付金额</th> |
||||||
|
<th nzWidth="100px">支付方式</th> |
||||||
|
<th nzWidth="160px">创建时间</th> |
||||||
|
<th nzWidth="160px">支付时间</th> |
||||||
|
<th nzWidth="100px">订单状态</th> |
||||||
|
<th nzWidth="120px" nzRight="0px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||||
|
<td>{{data.merName}}</td> |
||||||
|
<td>{{data.storeName}}</td> |
||||||
|
<td>{{data.orderNo}}</td> |
||||||
|
<td>{{data.orderType | deviceOrderType}}</td> |
||||||
|
<td>{{data.deviceType | deviceType}}</td> |
||||||
|
<td>{{data.deviceNum}}</td> |
||||||
|
<td>{{data.payPrice}}</td> |
||||||
|
<td>{{data.payType | deviceOrderPayType}}</td> |
||||||
|
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td>{{data.payTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td>{{data.status |deviceOrderStatus}}</td> |
||||||
|
<td nzRight="0px" class="table-td-operation"> |
||||||
|
<a nz-dropdown [nzDropdownMenu]="menu">操作列表 <i nz-icon nzType="down"></i> </a> |
||||||
|
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||||
|
<ul nz-menu nzSelectable> |
||||||
|
<li (click)="showDeviceListModal(data.orderAssignList)" nz-menu-item>设备列表</li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
</nz-spin> |
||||||
|
<nz-modal [(nzVisible)]="deviceListModal" nzTitle="已分配设备" (nzOnCancel)="closeDeviceListModal()" nzWidth="700px" [nzFooter]="null"> |
||||||
|
<nz-table #errorStudentTable [nzData]="orderAssignList"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="150px">订单类型</th> |
||||||
|
<th nzWidth="150px">设备类型</th> |
||||||
|
<th nzWidth="150px">设备编号</th> |
||||||
|
<th nzWidth="150px">状态</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of errorStudentTable.data;let i = index"> |
||||||
|
<td>{{data.orderType | deviceOrderType}}</td> |
||||||
|
<td>{{data.deviceType | deviceType}}</td> |
||||||
|
<td>{{data.deviceNo}}</td> |
||||||
|
<td> |
||||||
|
<span *ngIf="data.status == 1">使用中</span> |
||||||
|
<span *ngIf="data.status == 2">退款中</span> |
||||||
|
<span *ngIf="data.status == 3">已退款</span> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</nz-modal> |
@ -0,0 +1,7 @@ |
|||||||
|
.table-td-operation a { |
||||||
|
padding: 0px 5px; |
||||||
|
} |
||||||
|
.collapse { |
||||||
|
margin-left: 8px; |
||||||
|
font-size: 12px; |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||||
|
|
||||||
|
import { DeviceOrderListComponent } from './device-order-list.component'; |
||||||
|
|
||||||
|
describe('DeviceOrderListComponent', () => { |
||||||
|
let component: DeviceOrderListComponent; |
||||||
|
let fixture: ComponentFixture<DeviceOrderListComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ DeviceOrderListComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(DeviceOrderListComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,127 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
import {NzMessageService, NzModalService} from 'ng-zorro-antd'; |
||||||
|
import {CommonsService} from '../../../services/commons.service'; |
||||||
|
import {LocalStorageService} from '../../../services/local-storage.service'; |
||||||
|
import {FormBuilder, FormGroup} from '@angular/forms'; |
||||||
|
import {DeviceOrderService} from '../../../services/device-order.service'; |
||||||
|
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; |
||||||
|
import {environment} from '../../../../environments/environment'; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-device-order-list', |
||||||
|
templateUrl: './device-order-list.component.html', |
||||||
|
styleUrls: ['./device-order-list.component.scss'] |
||||||
|
}) |
||||||
|
export class DeviceOrderListComponent implements OnInit { |
||||||
|
// 角色类型 0:超级管理员 1:公司 2:代理商 3:业务员 4:商户 5:门店
|
||||||
|
roleType: number; |
||||||
|
|
||||||
|
baseUrl = environment.baseUrl; |
||||||
|
|
||||||
|
loadingObject = { |
||||||
|
spinning: false, |
||||||
|
msg: '加载中' |
||||||
|
}; |
||||||
|
|
||||||
|
dataObject: any = {}; |
||||||
|
tableLoading = true; |
||||||
|
searchForm: FormGroup; |
||||||
|
pageNum: number; |
||||||
|
whereObject: any = {}; |
||||||
|
isCollapse = false; |
||||||
|
deviceOrderStatusArray = []; |
||||||
|
deviceOrderTypeArray = []; |
||||||
|
deviceTypeArray = []; |
||||||
|
deviceListModal = false; |
||||||
|
orderAssignList = []; |
||||||
|
|
||||||
|
constructor(private modal: NzModalService, |
||||||
|
private message: NzMessageService, |
||||||
|
private commonsService: CommonsService, |
||||||
|
private deviceOrderService: DeviceOrderService, |
||||||
|
private store: LocalStorageService, |
||||||
|
private form: FormBuilder) { } |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.roleType = this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType; |
||||||
|
|
||||||
|
this.searchForm = this.form.group({ |
||||||
|
companyName: [null], |
||||||
|
agentName: [null], |
||||||
|
salesmanName: [null], |
||||||
|
merName: [null], |
||||||
|
storeName: [null], |
||||||
|
orderNo: [null], |
||||||
|
orderType: [null], |
||||||
|
deviceType: [null], |
||||||
|
status: [null], |
||||||
|
}); |
||||||
|
|
||||||
|
this.commonsService.getDictionary('DEVICE_ORDER_TYPE', data => { |
||||||
|
this.deviceOrderTypeArray = data['return_data']; |
||||||
|
}); |
||||||
|
|
||||||
|
this.commonsService.getDictionary('DEVICE_ORDER_STATUS', data => { |
||||||
|
this.deviceOrderStatusArray = data['return_data']; |
||||||
|
}); |
||||||
|
|
||||||
|
this.commonsService.getDictionary('DEVICE_TYPE', data => { |
||||||
|
this.deviceTypeArray = data['return_data']; |
||||||
|
}); |
||||||
|
|
||||||
|
this.requestData(1); |
||||||
|
} |
||||||
|
|
||||||
|
toggleCollapse(): void { |
||||||
|
this.isCollapse = !this.isCollapse; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 请求数据 |
||||||
|
*/ |
||||||
|
requestData(pageNum) { |
||||||
|
this.tableLoading = true; |
||||||
|
this.whereObject['pageNum'] = pageNum; |
||||||
|
this.whereObject['pageSize'] = 10; |
||||||
|
this.deviceOrderService.getOrderList(this.whereObject, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.dataObject = data['return_data']; |
||||||
|
} else { |
||||||
|
this.modal.error(data['return_msg']); |
||||||
|
} |
||||||
|
this.tableLoading = false; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 搜索 |
||||||
|
* @param whereObject 条件 |
||||||
|
*/ |
||||||
|
search(whereObject: object) { |
||||||
|
this.whereObject = whereObject; |
||||||
|
this.requestData(1); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 重置 |
||||||
|
*/ |
||||||
|
resetForm(): void { |
||||||
|
this.searchForm.reset(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 展示设备列表模态框 |
||||||
|
*/ |
||||||
|
showDeviceListModal(dataList: []) { |
||||||
|
this.orderAssignList = dataList; |
||||||
|
this.deviceListModal = true; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭设备列表模态框 |
||||||
|
*/ |
||||||
|
closeDeviceListModal() { |
||||||
|
this.orderAssignList = []; |
||||||
|
this.deviceListModal = false; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,70 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<nz-breadcrumb> |
||||||
|
<nz-breadcrumb-item> |
||||||
|
优惠活动 |
||||||
|
</nz-breadcrumb-item> |
||||||
|
<nz-breadcrumb-item> |
||||||
|
配置活动 |
||||||
|
</nz-breadcrumb-item> |
||||||
|
</nz-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
|
||||||
|
<nz-content class="inner-content"> |
||||||
|
<form nz-form [formGroup]="dataForm" > |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>门店</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="6" [nzXs]="24"> |
||||||
|
<nz-select [formControlName]="'storeId'" [nzPlaceHolder]="'请选择门店'"> |
||||||
|
<nz-option *ngFor="let item of storeArray" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠活动名称</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="6" [nzXs]="24"> |
||||||
|
<input nz-input placeholder="请输入优惠券名称..." [formControlName]="'name'" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠券类型</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="6" [nzXs]="24"> |
||||||
|
<nz-select [formControlName]="'discountType'" [nzPlaceHolder]="'请选择优惠券类型'"> |
||||||
|
<nz-option nzValue="1" nzLabel="满减"></nz-option> |
||||||
|
<nz-option nzValue="2" nzLabel="立减"></nz-option> |
||||||
|
<nz-option nzValue="3" nzLabel="折扣"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item *ngIf="dataForm.value.discountType === '1'"> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>满减条件金额</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="6" [nzXs]="24"> |
||||||
|
<input nz-input [type]="'number'" placeholder="请输入满减条件金额" [formControlName]="'discountCondition'" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" [nzFor]="'discountPrice'" nzRequired>{{dataForm.value.discountType === '3' ? '优惠折扣' : '优惠金额'}}</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="6" [nzXs]="24" nzErrorTip="{{dataForm.value.discountType === '3' ? '请输入优惠折扣' : '请输入优惠金额'}}"> |
||||||
|
<input nz-input [type]="'number'" placeholder="{{dataForm.value.discountType === '3' ? '请输入优惠折扣' : '请输入优惠金额'}}" [formControlName]="'discountPrice'"/> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>活动结束时间</nz-form-label> |
||||||
|
<nz-form-control [nzSm]="6" [nzXs]="24"> |
||||||
|
<nz-date-picker nzFormat="yyyy-MM-dd " [nzPlaceHolder]="'请选择活动结束时间'" [formControlName]="'endTime'"></nz-date-picker> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
|
||||||
|
<nz-form-item nz-row class="register-area"> |
||||||
|
<nz-form-control [nzSpan]="14" [nzOffset]="6"> |
||||||
|
<button nz-button nzType="primary" (click)="submitFrom()">提交</button> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</form> |
||||||
|
|
||||||
|
</nz-content> |
@ -0,0 +1,6 @@ |
|||||||
|
nz-date-picker { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
.register-are { |
||||||
|
margin-bottom: 8px; |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||||
|
|
||||||
|
import { StoreDiscountActivityEditComponent } from './store-discount-activity-edit.component'; |
||||||
|
|
||||||
|
describe('StoreDiscountActivityEditComponent', () => { |
||||||
|
let component: StoreDiscountActivityEditComponent; |
||||||
|
let fixture: ComponentFixture<StoreDiscountActivityEditComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ StoreDiscountActivityEditComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(StoreDiscountActivityEditComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,85 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
||||||
|
import {NzModalService} from 'ng-zorro-antd'; |
||||||
|
import {ActivatedRoute, Router} from '@angular/router'; |
||||||
|
import {ValidatorsService} from '../../../services/validators.service'; |
||||||
|
import {StoreDiscountActivityService} from '../../../services/store-discount-activity.service'; |
||||||
|
import {StoreService} from '../../../services/store.service'; |
||||||
|
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-store-discount-activity-edit', |
||||||
|
templateUrl: './store-discount-activity-edit.component.html', |
||||||
|
styleUrls: ['./store-discount-activity-edit.component.scss'] |
||||||
|
}) |
||||||
|
export class StoreDiscountActivityEditComponent implements OnInit { |
||||||
|
|
||||||
|
dataForm: FormGroup; |
||||||
|
btnLoading = false; |
||||||
|
|
||||||
|
storeArray = []; |
||||||
|
|
||||||
|
constructor(private form: FormBuilder, |
||||||
|
private modal: NzModalService, |
||||||
|
private storeDiscountActivityService: StoreDiscountActivityService, |
||||||
|
private storeService: StoreService, |
||||||
|
private activatedRoute: ActivatedRoute, |
||||||
|
private router: Router) { } |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.dataForm = this.form.group({ |
||||||
|
id: [null], |
||||||
|
storeId: [null, [Validators.required]], |
||||||
|
name: [null, [Validators.required]], |
||||||
|
discountType: [1, [Validators.required]], |
||||||
|
discountCondition: [0, [Validators.required]], |
||||||
|
discountPrice: [0, [Validators.required]], |
||||||
|
endTime: [null, [Validators.required]], |
||||||
|
}); |
||||||
|
|
||||||
|
this.activatedRoute.queryParams.subscribe(queryParams => { |
||||||
|
if (queryParams['id'] != null) { |
||||||
|
this.storeDiscountActivityService.getActivityDetail(queryParams['id'], data => { |
||||||
|
data['return_data']['storeId'] = String(data['return_data']['storeId']); |
||||||
|
data['return_data']['discountType'] = String(data['return_data']['discountType']); |
||||||
|
this.dataForm.patchValue(data['return_data']); |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
this.storeService.getStoreList({pageNum: 1, pageSize: 99999}, data => { |
||||||
|
this.storeArray = data['return_data']['list']; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
submitFrom() { |
||||||
|
this.btnLoading = true; |
||||||
|
for (const i in this.dataForm.controls) { |
||||||
|
this.dataForm.controls[i].markAsDirty(); |
||||||
|
this.dataForm.controls[i].updateValueAndValidity(); |
||||||
|
} |
||||||
|
if (this.dataForm.status == null || this.dataForm.status !== 'VALID') { |
||||||
|
this.modal.warning({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '请规范填写所有的必填项信息', |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.storeDiscountActivityService.configActivity(this.dataForm.value, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.modal.success({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: '提交成功', |
||||||
|
nzOnOk: () => this.router.navigateByUrl('admin/store-discount-activity/list') |
||||||
|
}); |
||||||
|
} else { |
||||||
|
this.modal.error({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'], |
||||||
|
}); |
||||||
|
} |
||||||
|
this.btnLoading = false; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,112 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<app-breadcrumb></app-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
<!--条件搜索--> |
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">活动名称</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="name" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">参与门店</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="storeName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">状态</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select [formControlName]="'status'" [nzPlaceHolder]="''"> |
||||||
|
<nz-option nzValue="1" nzLabel="编辑中"></nz-option> |
||||||
|
<nz-option nzValue="2" nzLabel="进行中"></nz-option> |
||||||
|
<nz-option nzValue="3" nzLabel="已结束"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</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>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||||
|
<div class="operating-button"> |
||||||
|
<button *ngIf="BTN_STORE_DISCOUNT_ACTIVITY_ADD" nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/store-discount-activity/edit']"><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button> |
||||||
|
</div> |
||||||
|
|
||||||
|
<!--数组表格 --> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="dataObject.list" |
||||||
|
[nzTotal]="dataObject.total" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzLoading]="tableLoading" |
||||||
|
[nzPageIndex]="whereObject.pageNum" |
||||||
|
(nzPageIndexChange)="requestData($event)" |
||||||
|
[nzScroll]="{ x: '1150px'}"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="70px">序号</th> |
||||||
|
<th nzWidth="150px">参与门店</th> |
||||||
|
<th nzWidth="150px">优惠名称</th> |
||||||
|
<th nzWidth="100px">优惠类型</th> |
||||||
|
<th nzWidth="130px">参与优惠条件</th> |
||||||
|
<th nzWidth="100px">优惠金额</th> |
||||||
|
<th nzWidth="150px">结束时间</th> |
||||||
|
<th nzWidth="100px">优惠状态</th> |
||||||
|
<th nzWidth="160px">创建时间</th> |
||||||
|
<th nzWidth="150px" nzRight="0px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||||
|
<td>{{i + 1}}</td> |
||||||
|
<td>{{data.storeName}}</td> |
||||||
|
<td>{{data.name}}</td> |
||||||
|
<td> |
||||||
|
<span *ngIf="data.discountType == 1">满减</span> |
||||||
|
<span *ngIf="data.discountType == 2">立减</span> |
||||||
|
<span *ngIf="data.discountType == 3">折扣</span> |
||||||
|
</td> |
||||||
|
<td>¥ {{data.discountCondition}}</td> |
||||||
|
<td>¥ {{data.discountPrice}}</td> |
||||||
|
<td>{{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td> |
||||||
|
<span *ngIf="data.status == 1">编辑中</span> |
||||||
|
<span *ngIf="data.status == 2">进行中</span> |
||||||
|
<span *ngIf="data.status == 3">已结束</span> |
||||||
|
</td> |
||||||
|
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td nzRight="0px" class="table-td-operation"> |
||||||
|
<a nz-dropdown [nzDropdownMenu]="menu">操作列表 <i nz-icon nzType="down"></i></a> |
||||||
|
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||||
|
<ul nz-menu nzSelectable> |
||||||
|
<li nz-menu-item *ngIf="data.status != 3 && BTN_STORE_DISCOUNT_ACTIVITY_UPDATE"> |
||||||
|
<a [routerLink]="['/admin/store-discount-activity/edit']" [queryParams]="{id: data.id}">修改</a> |
||||||
|
</li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 1 && BTN_STORE_DISCOUNT_ACTIVITY_UPDATE"><a (click)="showUpOnlineConfirm(data.id)">上线</a></li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 2 && BTN_STORE_DISCOUNT_ACTIVITY_UPDATE"><a (click)="showLowerOnlineConfirm(data.id)">下线</a></li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 1 && BTN_STORE_DISCOUNT_ACTIVITY_DEL"><a (click)="showDelConfirm(data.id)">删除</a></li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
|
@ -0,0 +1,25 @@ |
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||||
|
|
||||||
|
import { StoreDiscountActivityListComponent } from './store-discount-activity-list.component'; |
||||||
|
|
||||||
|
describe('StoreDiscountActivityListComponent', () => { |
||||||
|
let component: StoreDiscountActivityListComponent; |
||||||
|
let fixture: ComponentFixture<StoreDiscountActivityListComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ StoreDiscountActivityListComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(StoreDiscountActivityListComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,172 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
||||||
|
import {ActivatedRoute} from '@angular/router'; |
||||||
|
import {LocalStorageService} from '../../../services/local-storage.service'; |
||||||
|
import {NzMessageService, NzModalService} from 'ng-zorro-antd'; |
||||||
|
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; |
||||||
|
import {StoreDiscountActivityService} from '../../../services/store-discount-activity.service'; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-store-discount-activity-list', |
||||||
|
templateUrl: './store-discount-activity-list.component.html', |
||||||
|
styleUrls: ['./store-discount-activity-list.component.scss'] |
||||||
|
}) |
||||||
|
export class StoreDiscountActivityListComponent implements OnInit { |
||||||
|
dataObject: any = {}; |
||||||
|
storeId: number; |
||||||
|
tableLoading = true; |
||||||
|
searchForm: FormGroup; |
||||||
|
pageNum: number; |
||||||
|
whereObject: any = {}; |
||||||
|
|
||||||
|
BTN_STORE_DISCOUNT_ACTIVITY_ADD = false; |
||||||
|
BTN_STORE_DISCOUNT_ACTIVITY_UPDATE = false; |
||||||
|
BTN_STORE_DISCOUNT_ACTIVITY_DEL = false; |
||||||
|
|
||||||
|
constructor(private activatedRoute: ActivatedRoute, |
||||||
|
private store: LocalStorageService, // 数据请求
|
||||||
|
private modal: NzModalService, |
||||||
|
private message: NzMessageService, |
||||||
|
private storeDiscountActivityService: StoreDiscountActivityService, |
||||||
|
private form: FormBuilder) { } |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.BTN_STORE_DISCOUNT_ACTIVITY_ADD = this.store.isBtnCompetence('BTN_STORE_DISCOUNT_ACTIVITY_ADD'); // 增加按钮权限
|
||||||
|
this.BTN_STORE_DISCOUNT_ACTIVITY_UPDATE = this.store.isBtnCompetence('BTN_STORE_DISCOUNT_ACTIVITY_UPDATE'); // 修改按钮权限
|
||||||
|
this.BTN_STORE_DISCOUNT_ACTIVITY_DEL = this.store.isBtnCompetence('BTN_STORE_DISCOUNT_ACTIVITY_DEL'); // 删除按钮权限
|
||||||
|
|
||||||
|
|
||||||
|
this.searchForm = this.form.group({ |
||||||
|
name: [null], |
||||||
|
status: [null], |
||||||
|
}); |
||||||
|
this.requestData(1); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 请求数据 |
||||||
|
*/ |
||||||
|
requestData(pageNum) { |
||||||
|
this.tableLoading = true; |
||||||
|
this.whereObject['storeId'] = this.storeId; |
||||||
|
this.whereObject['pageNum'] = pageNum; |
||||||
|
this.whereObject['pageSize'] = 10; |
||||||
|
this.storeDiscountActivityService.getActivityList(this.whereObject, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.dataObject = data['return_data']; |
||||||
|
} else { |
||||||
|
this.modal.error(data['return_msg']); |
||||||
|
} |
||||||
|
this.tableLoading = false; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 搜索 |
||||||
|
* @param whereObject 条件 |
||||||
|
*/ |
||||||
|
search(whereObject: object) { |
||||||
|
this.whereObject = whereObject; |
||||||
|
this.requestData(1); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 重置 |
||||||
|
*/ |
||||||
|
resetForm(): void { |
||||||
|
this.searchForm.reset(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 弹出上线对话框 |
||||||
|
*/ |
||||||
|
showUpOnlineConfirm(id: number): void { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '警告', |
||||||
|
nzContent: '是否删除优惠活动?<br/>', |
||||||
|
nzOkText: '是', |
||||||
|
nzCancelText: '否', |
||||||
|
nzOkType: 'danger', |
||||||
|
nzOnOk: () => this.upOnline(id) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 活动上线数据 |
||||||
|
* |
||||||
|
*/ |
||||||
|
upOnline(id: number) { |
||||||
|
this.storeDiscountActivityService.upOnline(id, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.requestData(this.whereObject['pageNum']); |
||||||
|
} else { |
||||||
|
this.modal.error({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'] |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 弹出活动下线对话框 |
||||||
|
*/ |
||||||
|
showLowerOnlineConfirm(id: number): void { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '警告', |
||||||
|
nzContent: '是否删除优惠活动?<br/>', |
||||||
|
nzOkText: '是', |
||||||
|
nzCancelText: '否', |
||||||
|
nzOkType: 'danger', |
||||||
|
nzOnOk: () => this.lowerOnline(id) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 活动下线数据 |
||||||
|
* |
||||||
|
*/ |
||||||
|
lowerOnline(id: number) { |
||||||
|
this.storeDiscountActivityService.lowerOnline(id, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.requestData(this.whereObject['pageNum']); |
||||||
|
} else { |
||||||
|
this.modal.error({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'] |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 弹出删除对话框 |
||||||
|
*/ |
||||||
|
showDelConfirm(id: number): void { |
||||||
|
this.modal.confirm({ |
||||||
|
nzTitle: '警告', |
||||||
|
nzContent: '是否删除优惠活动?<br/>', |
||||||
|
nzOkText: '是', |
||||||
|
nzCancelText: '否', |
||||||
|
nzOkType: 'danger', |
||||||
|
nzOnOk: () => this.delete(id) |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除数据 |
||||||
|
* |
||||||
|
*/ |
||||||
|
delete(id: number) { |
||||||
|
this.storeDiscountActivityService.delete(id, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.requestData(this.whereObject['pageNum']); |
||||||
|
} else { |
||||||
|
this.modal.error({ |
||||||
|
nzTitle: '提示', |
||||||
|
nzContent: data['return_msg'] |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
import { NgModule } from '@angular/core'; |
||||||
|
import { Routes, RouterModule } from '@angular/router'; |
||||||
|
import {StoreDiscountActivityListComponent} from './store-discount-activity-list/store-discount-activity-list.component'; |
||||||
|
import {StoreDiscountActivityEditComponent} from './store-discount-activity-edit/store-discount-activity-edit.component'; |
||||||
|
|
||||||
|
|
||||||
|
const routes: Routes = [ |
||||||
|
{ path: 'list', component: StoreDiscountActivityListComponent }, |
||||||
|
{ path: 'edit', component: StoreDiscountActivityEditComponent }, |
||||||
|
]; |
||||||
|
|
||||||
|
@NgModule({ |
||||||
|
imports: [RouterModule.forChild(routes)], |
||||||
|
exports: [RouterModule] |
||||||
|
}) |
||||||
|
export class StoreDiscountActivityRoutingModule { } |
@ -0,0 +1,25 @@ |
|||||||
|
import { NgModule } from '@angular/core'; |
||||||
|
import { CommonModule } from '@angular/common'; |
||||||
|
|
||||||
|
import { StoreDiscountActivityRoutingModule } from './store-discount-activity-routing.module'; |
||||||
|
import { StoreDiscountActivityListComponent } from './store-discount-activity-list/store-discount-activity-list.component'; |
||||||
|
import { StoreDiscountActivityEditComponent } from './store-discount-activity-edit/store-discount-activity-edit.component'; |
||||||
|
import {NgZorroAntdModule} from 'ng-zorro-antd'; |
||||||
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; |
||||||
|
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; |
||||||
|
import {AppCommonModule} from '../../app-common.module'; |
||||||
|
|
||||||
|
|
||||||
|
@NgModule({ |
||||||
|
declarations: [StoreDiscountActivityListComponent, StoreDiscountActivityEditComponent], |
||||||
|
imports: [ |
||||||
|
CommonModule, |
||||||
|
StoreDiscountActivityRoutingModule, |
||||||
|
NgZorroAntdModule, |
||||||
|
ReactiveFormsModule, |
||||||
|
FormsModule, |
||||||
|
BreadcrumbModule, |
||||||
|
AppCommonModule, |
||||||
|
] |
||||||
|
}) |
||||||
|
export class StoreDiscountActivityModule { } |
@ -0,0 +1,17 @@ |
|||||||
|
import { Pipe, PipeTransform } from '@angular/core'; |
||||||
|
|
||||||
|
@Pipe({ |
||||||
|
name: 'deviceOrderPayType' |
||||||
|
}) |
||||||
|
export class DeviceOrderPayTypePipe implements PipeTransform { |
||||||
|
|
||||||
|
transform(type: number): string { |
||||||
|
switch (type) { |
||||||
|
case 1: |
||||||
|
return '微信'; |
||||||
|
default: |
||||||
|
return '未知'; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
import { Pipe, PipeTransform } from '@angular/core'; |
||||||
|
|
||||||
|
@Pipe({ |
||||||
|
name: 'deviceOrderStatus' |
||||||
|
}) |
||||||
|
export class DeviceOrderStatusPipe implements PipeTransform { |
||||||
|
|
||||||
|
transform(status: number): string { |
||||||
|
switch (status) { |
||||||
|
case 1: |
||||||
|
return '待支付'; |
||||||
|
case 2: |
||||||
|
return '已支付'; |
||||||
|
case 3: |
||||||
|
return '已完成'; |
||||||
|
case 4: |
||||||
|
return '已退款'; |
||||||
|
default: |
||||||
|
return '未知'; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
import { Pipe, PipeTransform } from '@angular/core'; |
||||||
|
|
||||||
|
@Pipe({ |
||||||
|
name: 'deviceOrderType' |
||||||
|
}) |
||||||
|
export class DeviceOrderTypePipe implements PipeTransform { |
||||||
|
|
||||||
|
transform(type: number): string { |
||||||
|
switch (type) { |
||||||
|
case 1: |
||||||
|
return '押金'; |
||||||
|
case 2: |
||||||
|
return '购买'; |
||||||
|
default: |
||||||
|
return '未知'; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
import { Pipe, PipeTransform } from '@angular/core'; |
||||||
|
|
||||||
|
@Pipe({ |
||||||
|
name: 'deviceType' |
||||||
|
}) |
||||||
|
export class DeviceTypePipe implements PipeTransform { |
||||||
|
|
||||||
|
transform(statusNum: number): string { |
||||||
|
switch (statusNum) { |
||||||
|
case 1: |
||||||
|
return '4G收款音响'; |
||||||
|
default: |
||||||
|
return '未知'; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,60 @@ |
|||||||
|
import { Injectable } from '@angular/core'; |
||||||
|
import {HttpClient} from '@angular/common/http'; |
||||||
|
import {environment} from '../../environments/environment'; |
||||||
|
import {CommonsService} from './commons.service'; |
||||||
|
|
||||||
|
@Injectable({ |
||||||
|
providedIn: 'root' |
||||||
|
}) |
||||||
|
export class CompanyService { |
||||||
|
|
||||||
|
constructor( |
||||||
|
private http: HttpClient, |
||||||
|
private commonsService: CommonsService, |
||||||
|
) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 增加公司 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
insertCompany(paramObject: object, callBack) { |
||||||
|
this.http.post(environment.baseUrl + 'bsCompany/insert', paramObject).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改公司 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
updateCompany(paramObject: object, callBack) { |
||||||
|
this.http.post(environment.baseUrl + 'bsCompany/update', paramObject).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取公司列表 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
selectCompanyList(paramObject: object, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'bsCompany/selectCompanyList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 公司详情 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
companyView(companyId: number, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'bsCompany/companyView?companyId=' + companyId).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
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 DeviceOrderService { |
||||||
|
|
||||||
|
constructor( |
||||||
|
private http: HttpClient, |
||||||
|
private commonsService: CommonsService |
||||||
|
) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 分配设备订单 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
assignOrder(paramObject: object, callBack) { |
||||||
|
this.http.post(environment.baseUrl + 'deviceOrder/assignOrder?orderNo', paramObject).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 设备订单详情 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
getOrderDetail(orderNo: string, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'deviceOrder/getOrderDetail?orderNo' + orderNo).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 设备订单列表 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
getOrderList(paramObject: object, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'deviceOrder/getOrderList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,81 @@ |
|||||||
|
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 StoreDiscountActivityService { |
||||||
|
|
||||||
|
constructor( |
||||||
|
private http: HttpClient, |
||||||
|
private commonsService: CommonsService |
||||||
|
) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 配置优惠活动 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
configActivity(paramObject: object, callBack) { |
||||||
|
this.http.post(environment.baseUrl + 'storeDiscountActivity/configActivity', paramObject).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 配置优惠活动 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
getActivityDetail(activityId: number, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'storeDiscountActivity/getActivityDetail?activityId=' + activityId).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 活动上线 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
upOnline(activityId: number, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'storeDiscountActivity/upOnline?activityId=' + activityId).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 活动下线 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
lowerOnline(activityId: number, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'storeDiscountActivity/lowerOnline?activityId=' + activityId).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
delete(activityId: number, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'storeDiscountActivity/delete?activityId=' + activityId).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询优惠活动列表 |
||||||
|
* @param paramObject 参数 |
||||||
|
* @param callBack |
||||||
|
*/ |
||||||
|
getActivityList(paramObject: object, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'storeDiscountActivity/getActivityList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue