pull/1/head
袁野 4 years ago
parent 68fa266189
commit 94d7b88224
  1. 1
      src/app/admin/coupon/coupon-detail/coupon-detail.component.html
  2. 0
      src/app/admin/coupon/coupon-detail/coupon-detail.component.scss
  3. 25
      src/app/admin/coupon/coupon-detail/coupon-detail.component.spec.ts
  4. 15
      src/app/admin/coupon/coupon-detail/coupon-detail.component.ts
  5. 1
      src/app/admin/coupon/coupon-edit/coupon-edit.component.html
  6. 0
      src/app/admin/coupon/coupon-edit/coupon-edit.component.scss
  7. 25
      src/app/admin/coupon/coupon-edit/coupon-edit.component.spec.ts
  8. 15
      src/app/admin/coupon/coupon-edit/coupon-edit.component.ts
  9. 89
      src/app/admin/coupon/coupon-list/coupon-list.component.html
  10. 0
      src/app/admin/coupon/coupon-list/coupon-list.component.scss
  11. 128
      src/app/admin/coupon/coupon-list/coupon-list.component.ts
  12. 18
      src/app/admin/coupon/coupon-routing.module.ts
  13. 25
      src/app/admin/coupon/coupon.module.ts
  14. 2
      src/app/admin/merchant-store/store-list/store-list.component.html
  15. 2
      src/app/admin/merchant/merchant-list/merchant-list.component.html
  16. 2
      src/app/services/icon.service.ts

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CouponDetailComponent } from './coupon-detail.component';
describe('CouponDetailComponent', () => {
let component: CouponDetailComponent;
let fixture: ComponentFixture<CouponDetailComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CouponDetailComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CouponDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-coupon-detail',
templateUrl: './coupon-detail.component.html',
styleUrls: ['./coupon-detail.component.scss']
})
export class CouponDetailComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CouponEditComponent } from './coupon-edit.component';
describe('CouponEditComponent', () => {
let component: CouponEditComponent;
let fixture: ComponentFixture<CouponEditComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CouponEditComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CouponEditComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-coupon-edit',
templateUrl: './coupon-edit.component.html',
styleUrls: ['./coupon-edit.component.scss']
})
export class CouponEditComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

@ -0,0 +1,89 @@
<!-- 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="storeName"/>
</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="telephone"/>
</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>
<span *ngIf="id != null" style="margin-left: 30px;;">
商戶名称:
<span style="font-weight: bold; font-size: 20px">{{name}}</span>
</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/merchantStore/store-edit']" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
</div>
<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="80px">门店编号</th>
<th nzWidth="80px">门店名称</th>
<th nzWidth="100px">门店电话</th>
<th nzWidth="100px">创建时间</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.storeKey}}</td>
<td>{{data.storeName}}</td>
<td>{{data.telephone}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</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>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getDelete(data.id)"><i nz-icon nzType="delete" nzTheme="outline" nz-tooltip="删除"></i></a>
</td>
</tbody>
</nz-table>
</div>

@ -0,0 +1,128 @@
import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormGroup} from '@angular/forms';
import {MerchantStoreService} from '../../../services/merchant-store.service';
import {IconService} from '../../../services/icon.service';
import {NzMessageService} from 'ng-zorro-antd';
import {ActivatedRoute, Router} from '@angular/router';
import {CommonsService} from '../../../services/commons.service';
@Component({
selector: 'app-coupon-list',
templateUrl: './coupon-list.component.html',
styleUrls: ['./coupon-list.component.scss']
})
export class CouponListComponent implements OnInit {
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
id = null;
name: string;
constructor(
private form: FormBuilder,
private merchantStore: MerchantStoreService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
private activatedRoute: ActivatedRoute,
private common: CommonsService
) {
}
ngOnInit(): void {
this.init();
}
public init(): void {
this.activatedRoute.queryParams.subscribe(queryParams => {
if (queryParams.merchantId != null) {
this.id = queryParams.merchantId;
this.name = queryParams.name;
}
});
this.searchForm = this.form.group({
storeName: [null],
telephone: [null],
});
this.getRequest(true, this.searchForm.value);
}
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
this.loading = false;
if (reset) {
this.pageNum = 1;
}
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
if (this.id == null) {
this.merchantStore.getStoreListByMerchant(whereObject, data => {
if (data['return_code'] === '000000') {
this.requestData = data['return_data'].list;
this.total = data['return_data'].total;
} else {
this.message.error(data['return_msg']);
}
});
} else {
whereObject['merchantId'] = this.id;
this.merchantStore.getStoreListByCompany(whereObject, data => {
if (data['return_code'] === '000000') {
this.requestData = data['return_data'].list;
this.total = data['return_data'].total;
} else {
this.message.error(data['return_msg']);
}
});
}
}
// 重置
public resetForm(): void {
this.searchForm.reset();
}
// 禁用门店
public getDelete(id): void {
const message = '是否删除门店';
this.common.showConfirm(message, data => {
if (data) {
this.merchantStore.deleteMerchantStore(id, dataReturn => {
if (dataReturn['return_code'] === '000000') {
this.message.success('操作成功');
this.getRequest(false , this.searchForm.value);
} else {
this.message.warning(dataReturn['return_msg']);
}
});
}
});
}
// 修改
public getEdit(id: number): void {
this.router.navigate(['/admin/merchantStore/store-edit'], {
queryParams: {
storeId: id
}
}).then(r => console.log(r));
}
// 查看详情
public getDetail(id: number): void {
this.router.navigate(['/admin/merchantStore/store-detail'], {
queryParams: {
storeId: id
}
}).then(r => console.log(r));
}
}

@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {CouponListComponent} from './coupon-list/coupon-list.component';
import {CouponEditComponent} from './coupon-edit/coupon-edit.component';
import {CouponDetailComponent} from './coupon-detail/coupon-detail.component';
const routes: Routes = [
{ path: 'coupon-list', component: CouponListComponent },
{ path: 'coupon-edit', component: CouponEditComponent },
{ path: 'coupon-detail', component: CouponDetailComponent },
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class CouponRoutingModule { }

@ -0,0 +1,25 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CouponRoutingModule } from './coupon-routing.module';
import { CouponListComponent } from './coupon-list/coupon-list.component';
import { CouponEditComponent } from './coupon-edit/coupon-edit.component';
import { CouponDetailComponent } from './coupon-detail/coupon-detail.component';
import {NgZorroAntdModule} from 'ng-zorro-antd';
import {SeparateModule} from '../../common/separate/separate.module';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
@NgModule({
declarations: [CouponListComponent, CouponEditComponent, CouponDetailComponent],
imports: [
CommonModule,
CouponRoutingModule,
NgZorroAntdModule,
SeparateModule,
ReactiveFormsModule,
FormsModule,
BreadcrumbModule
]
})
export class CouponModule { }

@ -77,7 +77,7 @@
<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-dingdanxiangqing_icon'" nz-tooltip="门店详情"></i></a>
<a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-xiangqing'" nz-tooltip="门店详情"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getDelete(data.id)"><i nz-icon nzType="delete" nzTheme="outline" nz-tooltip="删除"></i></a>
</td>

@ -97,7 +97,7 @@
<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-dingdanxiangqing_icon'" nz-tooltip="商户详情"></i></a>
<a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-xiangqing'" nz-tooltip="商户详情"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getList(data.id , data.merchantName)"><i nz-icon nzType="unordered-list" nzTheme="outline" nz-tooltip="门店列表"></i></a>
<nz-divider nzType="vertical"></nz-divider>

@ -12,7 +12,7 @@ export class IconService {
constructor(private iconService: NzIconService) {
this.iconService.fetchFromIconfont({
scriptUrl: 'https://at.alicdn.com/t/font_2413274_zk7ae4qcrvg.js'
scriptUrl: 'https://at.alicdn.com/t/font_2424521_y0mw6uv5r2.js'
});
}
}

Loading…
Cancel
Save