diff --git a/src/app/admin/gz-sinopec/gz-sinopec-routing.module.ts b/src/app/admin/gz-sinopec/gz-sinopec-routing.module.ts new file mode 100644 index 0000000..3995936 --- /dev/null +++ b/src/app/admin/gz-sinopec/gz-sinopec-routing.module.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 { } diff --git a/src/app/admin/gz-sinopec/gz-sinopec.module.ts b/src/app/admin/gz-sinopec/gz-sinopec.module.ts new file mode 100644 index 0000000..514a618 --- /dev/null +++ b/src/app/admin/gz-sinopec/gz-sinopec.module.ts @@ -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 { } diff --git a/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.html b/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.html new file mode 100644 index 0000000..e72913f --- /dev/null +++ b/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.html @@ -0,0 +1,92 @@ + + + + + +
+
+
+
+ + 卡券名称 + + + + +
+ +
+ + 使用状态 + + + + + + + +
+ +
+ + 分发时间 + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 序号 + 卡卷名称 + 卡券金额 + 分发时间 + 分发手机号 + 状态 + + + + + + {{i + 1}} + {{data.couponName}} + ¥{{data.salesPrice}} + {{data.salesTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.convertUserPhone}} + {{data.status == 2?'待使用':'已使用'}} + + + + +
diff --git a/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.scss b/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.spec.ts b/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.spec.ts new file mode 100644 index 0000000..1e4bb30 --- /dev/null +++ b/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ OfflineAssignComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OfflineAssignComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.ts b/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.ts new file mode 100644 index 0000000..65c2475 --- /dev/null +++ b/src/app/admin/gz-sinopec/offline-assign/offline-assign.component.ts @@ -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'] + }); + } + }); + } +} diff --git a/src/app/admin/gz-sinopec/use-order/use-order.component.html b/src/app/admin/gz-sinopec/use-order/use-order.component.html new file mode 100644 index 0000000..0be41f9 --- /dev/null +++ b/src/app/admin/gz-sinopec/use-order/use-order.component.html @@ -0,0 +1,80 @@ + + + + + +
+
+
+
+ + 卡券名称 + + + + +
+ +
+ + 分发时间 + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 序号 + 卡卷名称 + 卡券金额 + 分发时间 + 分发手机号 + 状态 + + + + + + {{i + 1}} + {{data.couponName}} + ¥{{data.salesPrice}} + {{data.salesTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.convertUserPhone}} + {{data.status == 2?'待使用':'已使用'}} + + + + +
diff --git a/src/app/admin/gz-sinopec/use-order/use-order.component.scss b/src/app/admin/gz-sinopec/use-order/use-order.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/gz-sinopec/use-order/use-order.component.spec.ts b/src/app/admin/gz-sinopec/use-order/use-order.component.spec.ts new file mode 100644 index 0000000..08b561e --- /dev/null +++ b/src/app/admin/gz-sinopec/use-order/use-order.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ UseOrderComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UseOrderComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/gz-sinopec/use-order/use-order.component.ts b/src/app/admin/gz-sinopec/use-order/use-order.component.ts new file mode 100644 index 0000000..eb77271 --- /dev/null +++ b/src/app/admin/gz-sinopec/use-order/use-order.component.ts @@ -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'] + }); + } + }); + } +} diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 85c3b33..74cf71a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -112,6 +112,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/oil-card/oil-card.module').then(m => m.OilCardModule), canActivate: [InitGuardService] }, + { + path: 'gz-sinopec', + loadChildren: () => import('./admin/gz-sinopec/gz-sinopec.module').then(m => m.GzSinopecModule), + canActivate: [InitGuardService] + }, ], }, ]; diff --git a/src/app/services/coupon.service.ts b/src/app/services/coupon.service.ts index 70f41fd..f3a24af 100644 --- a/src/app/services/coupon.service.ts +++ b/src/app/services/coupon.service.ts @@ -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); + }); + } }