提交代码

pull/1/head
胡锐 3 years ago
parent d90aa2dfec
commit 02af4343a3
  1. 15
      src/app/admin/gz-sinopec/gz-sinopec-routing.module.ts
  2. 24
      src/app/admin/gz-sinopec/gz-sinopec.module.ts
  3. 92
      src/app/admin/gz-sinopec/offline-assign/offline-assign.component.html
  4. 0
      src/app/admin/gz-sinopec/offline-assign/offline-assign.component.scss
  5. 25
      src/app/admin/gz-sinopec/offline-assign/offline-assign.component.spec.ts
  6. 91
      src/app/admin/gz-sinopec/offline-assign/offline-assign.component.ts
  7. 80
      src/app/admin/gz-sinopec/use-order/use-order.component.html
  8. 0
      src/app/admin/gz-sinopec/use-order/use-order.component.scss
  9. 25
      src/app/admin/gz-sinopec/use-order/use-order.component.spec.ts
  10. 91
      src/app/admin/gz-sinopec/use-order/use-order.component.ts
  11. 5
      src/app/app-routing.module.ts
  12. 23
      src/app/services/coupon.service.ts

@ -0,0 +1,15 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {OfflineAssignComponent} from './offline-assign/offline-assign.component';
import {UseOrderComponent} from './use-order/use-order.component';
const routes: Routes = [
{ path: 'offline-assign-list', component: OfflineAssignComponent },
{ path: 'use-order-list', component: UseOrderComponent },
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class GzSinopecRoutingModule { }

@ -0,0 +1,24 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { GzSinopecRoutingModule } from './gz-sinopec-routing.module';
import { OfflineAssignComponent } from './offline-assign/offline-assign.component';
import { UseOrderComponent } from './use-order/use-order.component';
import {FormsModule, ReactiveFormsModule} from '_@angular_forms@9.0.7@@angular/forms';
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
import {AppCommonModule} from '../../app-common.module';
import {NgZorroAntdModule} from '_ng-zorro-antd@9.3.0@ng-zorro-antd';
@NgModule({
declarations: [OfflineAssignComponent, UseOrderComponent],
imports: [
CommonModule,
GzSinopecRoutingModule,
NgZorroAntdModule,
ReactiveFormsModule,
FormsModule,
BreadcrumbModule,
AppCommonModule,
]
})
export class GzSinopecModule { }

@ -0,0 +1,92 @@
<!-- 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="couponName" />
</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 nzShowSearch nzAllowClear formControlName="status" >
<nz-option nzLabel="待使用" nzValue="2"></nz-option>
<nz-option nzLabel="已使用" nzValue="3"></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-range-picker
[nzShowTime]="{ nzHideDisabledOptions: true }"
formControlName="assignTimeArray"
nzFormat="yyyy-MM-dd HH:mm:ss"
></nz-range-picker>
</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" (click)="excelData()"><i nz-icon nzType="import" 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="80px">序号</th>
<th nzWidth="150px">卡卷名称</th>
<th nzWidth="80px">卡券金额</th>
<th nzWidth="100px">分发时间</th>
<th nzWidth="100px">分发手机号</th>
<th nzWidth="100px">状态</th>
<!-- <th nzWidth="100px" nzRight="0px">操作</th>-->
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data;let i = index">
<td>{{i + 1}}</td>
<td>{{data.couponName}}</td>
<td>¥{{data.salesPrice}}</td>
<td>{{data.salesTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td>{{data.convertUserPhone}}</td>
<td>{{data.status == 2?'待使用':'已使用'}}</td>
<!-- <td nzRight="0px" class="table-td-operation">
</td>-->
</tr>
</tbody>
</nz-table>
</div>

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

@ -0,0 +1,91 @@
import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms';
import {NzMessageService, NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd';
import {TyAgentService} from '../../../services/ty-agent.service';
import {CouponService} from "../../../services/coupon.service";
import {environment} from "../../../../environments/environment";
@Component({
selector: 'app-offline-assign',
templateUrl: './offline-assign.component.html',
styleUrls: ['./offline-assign.component.scss']
})
export class OfflineAssignComponent implements OnInit {
FILE_URL = environment.imageUrl;
dataObject: any = {};
tableLoading = true;
searchForm: FormGroup;
pageNum: number;
whereObject: any = {};
constructor(private modal: NzModalService,
private message: NzMessageService,
private couponService: CouponService,
private form: FormBuilder) { }
ngOnInit(): void {
this.searchForm = this.form.group({
couponName: [null],
status: [null],
assignTimeArray: [null],
});
this.requestData(1);
}
/**
*
*/
requestData(pageNum) {
this.tableLoading = true;
this.whereObject['pageNum'] = pageNum;
this.whereObject['pageSize'] = 10;
this.couponService.getGzSinopecAssignList(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) {
if (whereObject['assignTimeArray'] != null && whereObject['assignTimeArray'].length > 0) {
whereObject['assignTimeS'] = new Date(whereObject['assignTimeArray'][0]).getTime();
whereObject['assignTimeE'] = new Date(whereObject['assignTimeArray'][1]).getTime();
} else {
whereObject['assignTimeS'] = null;
whereObject['assignTimeE'] = null;
}
this.whereObject = whereObject;
this.requestData(1);
}
/**
*
*/
resetForm(): void {
this.searchForm.reset();
}
/**
*
*/
excelData() {
this.couponService.importGzSinopecAssign(this.whereObject, data => {
if (data['return_code'] === '000000') {
window.location.href = this.FILE_URL + 'temporary/' + data['return_data'];
} else {
this.modal.error({
nzTitle: '提示',
nzContent: data['return_msg']
});
}
});
}
}

@ -0,0 +1,80 @@
<!-- 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="couponName" />
</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-range-picker
[nzShowTime]="{ nzHideDisabledOptions: true }"
formControlName="assignTimeArray"
nzFormat="yyyy-MM-dd HH:mm:ss"
></nz-range-picker>
</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" (click)="excelData()"><i nz-icon nzType="import" 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="80px">序号</th>
<th nzWidth="150px">卡卷名称</th>
<th nzWidth="80px">卡券金额</th>
<th nzWidth="100px">分发时间</th>
<th nzWidth="100px">分发手机号</th>
<th nzWidth="100px">状态</th>
<!-- <th nzWidth="100px" nzRight="0px">操作</th>-->
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data;let i = index">
<td>{{i + 1}}</td>
<td>{{data.couponName}}</td>
<td>¥{{data.salesPrice}}</td>
<td>{{data.salesTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td>{{data.convertUserPhone}}</td>
<td>{{data.status == 2?'待使用':'已使用'}}</td>
<!-- <td nzRight="0px" class="table-td-operation">
</td>-->
</tr>
</tbody>
</nz-table>
</div>

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

@ -0,0 +1,91 @@
import { Component, OnInit } from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms';
import {NzMessageService, NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd';
import {CouponService} from '../../../services/coupon.service';
@Component({
selector: 'app-use-order',
templateUrl: './use-order.component.html',
styleUrls: ['./use-order.component.scss']
})
export class UseOrderComponent implements OnInit {
FILE_URL = environment.imageUrl;
dataObject: any = {};
tableLoading = true;
searchForm: FormGroup;
pageNum: number;
whereObject: any = {};
constructor(private modal: NzModalService,
private message: NzMessageService,
private couponService: CouponService,
private form: FormBuilder) { }
ngOnInit(): void {
this.searchForm = this.form.group({
couponName: [null],
status: [null],
assignTimeArray: [null],
});
this.requestData(1);
}
/**
*
*/
requestData(pageNum) {
this.tableLoading = true;
this.whereObject['status'] = 2;
this.whereObject['pageNum'] = pageNum;
this.whereObject['pageSize'] = 10;
this.couponService.getGzSinopecAssignList(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) {
if (whereObject['assignTimeArray'] != null && whereObject['assignTimeArray'].length > 0) {
whereObject['assignTimeS'] = new Date(whereObject['assignTimeArray'][0]).getTime();
whereObject['assignTimeE'] = new Date(whereObject['assignTimeArray'][1]).getTime();
} else {
whereObject['assignTimeS'] = null;
whereObject['assignTimeE'] = null;
}
this.whereObject = whereObject;
this.requestData(1);
}
/**
*
*/
resetForm(): void {
this.searchForm.reset();
}
/**
*
*/
excelData() {
this.couponService.importGzSinopecAssign(this.whereObject, data => {
if (data['return_code'] === '000000') {
window.location.href = this.FILE_URL + 'temporary/' + data['return_data'];
} else {
this.modal.error({
nzTitle: '提示',
nzContent: data['return_msg']
});
}
});
}
}

@ -112,6 +112,11 @@ const routes: Routes = [
loadChildren: () => import('./admin/oil-card/oil-card.module').then(m => m.OilCardModule), loadChildren: () => import('./admin/oil-card/oil-card.module').then(m => m.OilCardModule),
canActivate: [InitGuardService] canActivate: [InitGuardService]
}, },
{
path: 'gz-sinopec',
loadChildren: () => import('./admin/gz-sinopec/gz-sinopec.module').then(m => m.GzSinopecModule),
canActivate: [InitGuardService]
},
], ],
}, },
]; ];

@ -132,5 +132,28 @@ export class CouponService {
}); });
} }
/**
*
*
* @param id id
* @param callBack
*/
public getGzSinopecAssignList(params: object, callBack) {
this.http.get(environment.baseUrl + 'couponCode/getGzSinopecAssignList?' + this.common.getWhereCondition(params)).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param id id
* @param callBack
*/
public importGzSinopecAssign(params: object, callBack) {
this.http.get(environment.baseUrl + 'couponCode/importGzSinopecAssign?' + this.common.getWhereCondition(params)).subscribe(data => {
callBack(data);
});
}
} }

Loading…
Cancel
Save