From 60ba03644989cd75f35de25e4ea1031dcc8df8d8 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 10 Jan 2023 16:33:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fleet-oil-card-car.component.html | 118 +++++ .../fleet-oil-card-car.component.scss | 3 + .../fleet-oil-card-car.component.spec.ts | 25 + .../fleet-oil-card-car.component.ts | 252 ++++++++++ .../fleet-oil-card-list.component.html | 241 +++++++++ .../fleet-oil-card-list.component.scss | 3 + .../fleet-oil-card-list.component.spec.ts | 25 + .../fleet-oil-card-list.component.ts | 467 ++++++++++++++++++ .../fleet-oil-card-order.component.html | 167 +++++++ .../fleet-oil-card-order.component.scss | 0 .../fleet-oil-card-order.component.spec.ts | 25 + .../fleet-oil-card-order.component.ts | 147 ++++++ .../fleet-oil-card-record.component.html | 145 ++++++ .../fleet-oil-card-record.component.scss | 3 + .../fleet-oil-card-record.component.spec.ts | 25 + .../fleet-oil-card-record.component.ts | 100 ++++ .../fleet-oil-card-routing.module.ts | 22 + .../fleet-oil-card-user-list.component.html | 123 +++++ .../fleet-oil-card-user-list.component.scss | 3 + ...fleet-oil-card-user-list.component.spec.ts | 25 + .../fleet-oil-card-user-list.component.ts | 251 ++++++++++ .../fleet-oil-card/fleet-oil-card.module.ts | 29 ++ src/app/app-routing.module.ts | 5 + 23 files changed, 2204 insertions(+) create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.html create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.scss create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.spec.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.html create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.scss create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.spec.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.html create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.scss create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.spec.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.html create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.scss create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.spec.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-routing.module.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.html create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.scss create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.spec.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.ts create mode 100644 src/app/admin/fleet-oil-card/fleet-oil-card.module.ts diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.html b/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.html new file mode 100644 index 0000000..e14fb10 --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.html @@ -0,0 +1,118 @@ + + + + + + +
+
+
+ +
+ + 联系人 + + + + +
+ +
+ + 联系电话 + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ + + + + +
+ + + + + + 序号 + 车辆车牌 + 车主姓名 + 车主电话 + 创建时间 + 创建人 + 操作 + + + + + {{i+1}} + {{data.carLicensePlate}} + {{data.contactName}} + {{data.contactPhone}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.opUserName}} + + 操作列表 + + + + + + + +
+
+ + + + + + + 序号 + 客户姓名 + 客户电话 + 失败原因 + + + + + {{ i + 1}} + {{data.contactName}} + {{data.contactPhone}} + {{data.errMsg}} + + + + diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.scss b/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.scss new file mode 100644 index 0000000..690993b --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.scss @@ -0,0 +1,3 @@ +.table-td-operation a { + padding: 0px 5px; +} diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.spec.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.spec.ts new file mode 100644 index 0000000..0ec7d41 --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FleetOilCardCarComponent } from './fleet-oil-card-car.component'; + +describe('FleetOilCardCarComponent', () => { + let component: FleetOilCardCarComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FleetOilCardCarComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FleetOilCardCarComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.ts new file mode 100644 index 0000000..55d8bf6 --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-car/fleet-oil-card-car.component.ts @@ -0,0 +1,252 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {NzMessageService, NzModalService, NzUploadChangeParam} from 'ng-zorro-antd'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {FleetOilCardUserService} from '../../../services/fleet-oil-card-user.service'; +import {OrganizationService} from '../../../services/organization.service'; +import {CompanyAccountService} from '../../../services/company-account.service'; +import {ActivatedRoute, Router} from '@angular/router'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; +import {FleetOilCardCarService} from '../../../services/fleet-oil-card-car.service'; + +@Component({ + selector: 'app-fleet-oil-card-car', + templateUrl: './fleet-oil-card-car.component.html', + styleUrls: ['./fleet-oil-card-car.component.scss'] +}) +export class FleetOilCardCarComponent implements OnInit { + WEB_SERVE_URL = environment.baseUrl; + FILE_URL = environment.imageUrl; + roleType; + adminFlag; + loadingObject = { + spinning: false, + msg: '加载中' + }; + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + fleetCardNo: string; + + rechargeModal = false; + rechargeForm: FormGroup; + rechargeBtnLoading = false; + + orgArray = []; + accountObject = { + amounts: 0 + }; + + importErrorDataModal = false; + errorDataArray = []; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private store: LocalStorageService, + private fleetOilCardCarService: FleetOilCardCarService, + private organizationService: OrganizationService, + private companyAccountService: CompanyAccountService, + private activatedRoute: ActivatedRoute, + private router: Router, + private form: FormBuilder) { + this.roleType = Number(this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType); + this.adminFlag = Number(this.store.get(ADMIN_INFO_OBJECT)['secUser'].adminFlag); + } + + ngOnInit(): void { + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams.cardNo != null) { + this.fleetCardNo = queryParams.cardNo; + } + }); + + this.searchForm = this.form.group({ + contactName: [null], + contactPhone: [null], + }); + + this.rechargeForm = this.form.group({ + cardNo: [{ value: null, disabled: true }, [Validators.required]], + price: [100, [Validators.required]], + twoPwd: [null, [Validators.required]], + }); + + if (this.roleType === 5 && this.adminFlag === 1) { + this.organizationService.getOrganizationList(this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['id'], data => { + this.orgArray = data['return_data']; + }); + } + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['fleetOilCardNo'] = this.fleetCardNo; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.fleetOilCardCarService.getCarList(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; + if (this.searchForm.value.createTime != null) { + this.searchForm.value.createTimeS = new Date(this.searchForm.value.createTime[0]).getTime(); + this.searchForm.value.createTimeE = new Date(this.searchForm.value.createTime[1]).getTime(); + } else { + this.searchForm.value.createTimeS = null; + this.searchForm.value.createTimeE = null; + } + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /** + * 弹出删除对话框 + */ + showDelConfirm(id: number): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否删除该数据?', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.delData(id) + }); + } + + delData(id: number) { + this.fleetOilCardCarService.delete({ id: id }, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 弹出禁用对话框 + */ + showDisabledConfirm(cardNo: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否禁用油卡', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.disabledData(cardNo) + }); + } + + /** + * 禁用数据 + */ + disabledData(cardNo: string) { + /* this.fleetOilCardService.disabled({ cardNo: cardNo}, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + });*/ + } + + /** + * 弹出启用对话框 + */ + showEnableConfirm(cardNo: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否启用油卡', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.enableData(cardNo) + }); + } + + /** + * 启用数据 + */ + enableData(cardNo: string) { + /* this.fleetOilCardService.enable({ cardNo: cardNo}, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + });*/ + } + + handleChange(info: NzUploadChangeParam): void { + if (info.file.status === 'done') { + if (info.file.response.return_code === '000000') { + if (info.file.response.return_data == null || info.file.response.return_data.errorTotal === 0) { + + this.requestData(1); + this.message.success('导入成功'); + + } else { + this.modal.warning({ + nzTitle: '提示', + nzOkText: '查看失败数据', + nzContent: '只有部分数据导入成功', + nzOnOk: () => this.showImportErrorDataModal(info.file.response.return_data) + }); + } + } else { + this.message.error(info.file.response.return_msg); + } + } else if (info.file.status === 'error') { + this.message.error('上传错误'); + } + } + + // 打开模态框 + showImportErrorDataModal(data: []) { + this.errorDataArray = data['errorData']; + this.importErrorDataModal = true; + } + + closeImportErrorDataModal() { + this.importErrorDataModal = false; + } + + downloadTemplate() { + window.location.href = this.FILE_URL + "template/导入车辆模板.xlsx"; + } + +} diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.html b/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.html new file mode 100644 index 0000000..cce223b --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.html @@ -0,0 +1,241 @@ + + + + + + +
+
+
+
+ + 所属部门 + + + + + + +
+ +
+ + 油卡卡号 + + + + +
+ +
+ + 联系人 + + + + +
+ +
+ + 联系电话 + + + + +
+ +
+ + 油卡状态 + + + + + + + +
+ +
+ + 生成时间 + + + + +
+ +
+ +
+
+ + +
+
+
+
+ +
+
+ + + + + +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ + +
+ + + + + + 序号 + 所属部门 + 卡号 + 余额 + 消费金额 + 联系人 + 联系电话 + 油卡状态 + + 生成时间 + 操作 + + + + + {{i+1}} + {{data.orgName}} + {{data.cardNo}} + ¥{{data.amount}} + ¥{{data.amountConsume}} + {{data.contactName?data.contactName:'未设置'}} + {{data.contactPhone?data.contactPhone:'未设置'}} + {{data.status | oilCardStatus}} + + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + 充值 + 更多操作 + + + + + + + +
+
+ + +
+ + 生成数量 + + + + +
+ +
+
+
+ + +
+ + 联系人 + + + + + + 联系电话 + + + + +
+ +
+
+
+ + +
+ + 卡号 + + + + + + 充值金额 + + + + + + 支付密码 + + + + +
+ +
+
+
+ + +
+ + 卡号 + + + + + + 回收余额 + + + + + + 支付密码 + + + + +
+ +
+
+
diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.scss b/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.scss new file mode 100644 index 0000000..690993b --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.scss @@ -0,0 +1,3 @@ +.table-td-operation a { + padding: 0px 5px; +} diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.spec.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.spec.ts new file mode 100644 index 0000000..7f281f1 --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FleetOilCardListComponent } from './fleet-oil-card-list.component'; + +describe('FleetOilCardListComponent', () => { + let component: FleetOilCardListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FleetOilCardListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FleetOilCardListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.ts new file mode 100644 index 0000000..ef6a98d --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component.ts @@ -0,0 +1,467 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {OrganizationService} from '../../../services/organization.service'; +import {CompanyAccountService} from '../../../services/company-account.service'; +import {Router} from '@angular/router'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; +import {ValidatorsService} from '../../../services/validators.service'; +import {FleetOilCardService} from '../../../services/fleet-oil-card.service'; + +@Component({ + selector: 'app-fleet-oil-card-list', + templateUrl: './fleet-oil-card-list.component.html', + styleUrls: ['./fleet-oil-card-list.component.scss'] +}) +export class FleetOilCardListComponent implements OnInit { + FILE_URL = environment.imageUrl; + roleType; + adminFlag; + loadingObject = { + spinning: false, + msg: '加载中' + }; + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + generateCardModal = false; + generateCardForm: FormGroup; + + editContactModal = false; + editContactForm: FormGroup; + editContactData = {}; + + rechargeModal = false; + rechargeForm: FormGroup; + rechargeBtnLoading = false; + + recycleAmountModal = false; + recycleAmountForm: FormGroup; + recycleAmountBtnLoading = false; + + orgArray = []; + accountObject = { + amounts: 0 + }; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private store: LocalStorageService, + private fleetOilCardService: FleetOilCardService, + private organizationService: OrganizationService, + private companyAccountService: CompanyAccountService, + private router: Router, + private form: FormBuilder) { + this.roleType = Number(this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType); + this.adminFlag = Number(this.store.get(ADMIN_INFO_OBJECT)['secUser'].adminFlag); + } + + ngOnInit(): void { + this.searchForm = this.form.group({ + orgId: [null], + cardNo: [null], + contactName: [null], + contactPhone: [null], + createTime: [null], + createTimeS: [null], + createTimeE: [null], + bindTime: [null], + bindTimeS: [null], + bindTimeE: [null], + isConfigContact: [null], + status: [null], + bindStatus: [null], + }); + + this.editContactForm = this.form.group({ + cardNo: [null, [Validators.required]], + contactName: [null, [Validators.required]], + contactPhone: [null, [Validators.required, ValidatorsService.mobile]], + }); + + this.generateCardForm = this.form.group({ + generateNum: [1, [Validators.required]], + }); + + this.rechargeForm = this.form.group({ + cardNo: [{ value: null, disabled: true }, [Validators.required]], + price: [100, [Validators.required]], + twoPwd: [null, [Validators.required]], + }); + + this.recycleAmountForm = this.form.group({ + cardNo: [{ value: null, disabled: true }, [Validators.required]], + amount: [{ value: null, disabled: true }, [Validators.required]], + twoPwd: [null, [Validators.required]], + }); + + if (this.roleType === 5 && this.adminFlag === 1) { + this.organizationService.getOrganizationList(this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['id'], data => { + this.orgArray = data['return_data']; + }); + } + + if (this.roleType === 5 && this.adminFlag === 0) { + this.getAccount(); + } + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.fleetOilCardService.getCardList(this.whereObject, data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.modal.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + + /** + * 查询账户 + */ + getAccount() { + this.companyAccountService.getAccount(data => { + this.accountObject = data['return_data']; + }); + } + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + this.whereObject = whereObject; + if (this.searchForm.value.createTime != null) { + this.searchForm.value.createTimeS = new Date(this.searchForm.value.createTime[0]).getTime(); + this.searchForm.value.createTimeE = new Date(this.searchForm.value.createTime[1]).getTime(); + } else { + this.searchForm.value.createTimeS = null; + this.searchForm.value.createTimeE = null; + } + if (this.searchForm.value.bindTime != null) { + this.searchForm.value.bindTimeS = new Date(this.searchForm.value.bindTime[0]).getTime(); + this.searchForm.value.bindTimeE = new Date(this.searchForm.value.bindTime[1]).getTime(); + } else { + this.searchForm.value.bindTimeS = null; + this.searchForm.value.bindTimeE = null; + } + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /** + * 展示生成油卡模态框 + */ + showGenerateCardModal() { + this.generateCardModal = true; + } + + /** + * 关闭生成油卡模态框 + */ + closeGenerateCardModal() { + this.generateCardModal = false; + } + + /** + * 提交生成数量 + */ + submitGenerateCard() { + for (const i in this.generateCardForm.controls) { + this.generateCardForm.controls[i].markAsDirty(); + this.generateCardForm.controls[i].updateValueAndValidity(); + } + if (this.generateCardForm.status == null || this.generateCardForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + + this.loadingObject.spinning = true; + this.loadingObject.msg = '生成油卡中...'; + this.closeGenerateCardModal(); + + this.fleetOilCardService.generateCard(this.generateCardForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '生成成功', + }); + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.loadingObject.spinning = false; + }); + } + + /** + * 展示编辑联系人模态框 + */ + showEditContactModal(data: object) { + this.editContactForm.patchValue(data); + this.editContactData = data; + this.editContactModal = true; + } + + /** + * 关闭编辑联系人模态框 + */ + closeEditContactModal() { + this.editContactForm.reset(); + this.editContactModal = false; + } + + /** + * 提交编辑联系人数据 + */ + submitEditContactData() { + for (const i in this.editContactForm.controls) { + this.editContactForm.controls[i].markAsDirty(); + this.editContactForm.controls[i].updateValueAndValidity(); + } + if (this.editContactForm.status == null || this.editContactForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + this.fleetOilCardService.setContact(this.editContactForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '设置成功', + }); + this.closeEditContactModal(); + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + /** + * 弹出禁用对话框 + */ + showDisabledConfirm(cardNo: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否禁用油卡', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.disabledData(cardNo) + }); + } + + /** + * 禁用数据 + */ + disabledData(cardNo: string) { + this.fleetOilCardService.disabled({ cardNo: cardNo}, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 弹出启用对话框 + */ + showEnableConfirm(cardNo: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否启用油卡', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.enableData(cardNo) + }); + } + + /** + * 启用数据 + */ + enableData(cardNo: string) { + this.fleetOilCardService.enable({ cardNo: cardNo}, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 展示充值模态框 + */ + showRechargeModal(cardNo: string) { + this.rechargeForm.patchValue({cardNo: cardNo}); + this.rechargeModal = true; + } + + /** + * 关闭充值模态框 + */ + closeRechargeModal() { + this.rechargeModal = false; + } + + /** + * 提交充值 + */ + submitRecharge() { + for (const i in this.rechargeForm.controls) { + this.rechargeForm.controls[i].markAsDirty(); + this.rechargeForm.controls[i].updateValueAndValidity(); + } + if (this.rechargeForm.status == null || this.rechargeForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + this.rechargeBtnLoading = true; + this.rechargeForm.value['cardNo'] = this.rechargeForm.controls['cardNo']['value']; + this.fleetOilCardService.recharge(this.rechargeForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '充值成功', + }); + this.closeRechargeModal(); + this.getAccount(); + this.requestData(this.whereObject['pageNum']); + + } else if (data['return_code'] === '102136') { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + this.router.navigateByUrl('admin/company-amount/pay-pwd-config'); + this.closeRechargeModal(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.rechargeBtnLoading = false; + }); + } + + + /** + * 展示充值模态框 + */ + showRecycleAmountModal(cardData: object) { + this.recycleAmountForm.patchValue(cardData); + this.recycleAmountModal = true; + } + + /** + * 关闭充值模态框 + */ + closeRecycleAmountModal() { + this.recycleAmountModal = false; + } + + /** + * 提交回收余额 + */ + submitRecycleAmount() { + for (const i in this.recycleAmountForm.controls) { + this.recycleAmountForm.controls[i].markAsDirty(); + this.recycleAmountForm.controls[i].updateValueAndValidity(); + } + if (this.recycleAmountForm.status == null || this.recycleAmountForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + this.recycleAmountBtnLoading = true; + this.recycleAmountForm.value['cardNo'] = this.recycleAmountForm.controls['cardNo']['value']; + this.fleetOilCardService.recycleAmount(this.recycleAmountForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '回收成功', + }); + this.closeRecycleAmountModal(); + this.getAccount(); + this.requestData(this.whereObject['pageNum']); + + } else if (data['return_code'] === '102136') { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + this.router.navigateByUrl('admin/company-amount/pay-pwd-config'); + this.closeRecycleAmountModal(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.recycleAmountBtnLoading = false; + }); + } + + /** + * 导出油卡 + */ + excelCard() { + this.fleetOilCardService.exportCard(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/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.html b/src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.html new file mode 100644 index 0000000..2734158 --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.html @@ -0,0 +1,167 @@ + + + + + + +
+
+
+
+ + 部门 + + + + + + +
+ +
+ + 油卡卡号 + + + + +
+ +
+ + 客户电话 + + + + +
+ +
+ + 车牌 + + + + +
+ +
+ + 加油站 + + + + +
+ +
+ + 交易状态 + + + + + + + + + + +
+ +
+ + 支付时间 + + + + +
+ +
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 序号 + 所属部门 + 客户电话 + 车牌 + 油卡卡号 + 交易单号 + 加油金额 + 优惠金额 + 实付金额 + 加油站 + 油号 + 油枪号 + 油站枪价 + 平台枪价 + 交易状态 + 创建时间 + 支付时间 + 退款时间 + + + + + + {{i+1}} + {{data.orgName}} + {{data.merPhone}} + {{data.carLicensePlate!=null?data.carLicensePlate:'未知'}} + {{data.memCardNo}} + {{data.orderNo}} + + ¥{{data.totalPrice}} + ¥{{data.deductionPrice}} + ¥{{data.payRealPrice}} + {{data.goodsName}} + {{data.gasOilNo}} + {{data.gasGunNo}} + {{data.gasPriceGun}} + {{data.platformPriceGun}} + {{data.statusName}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.payTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.refundTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + + +
+
diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.scss b/src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.spec.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.spec.ts new file mode 100644 index 0000000..2881cec --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FleetOilCardOrderComponent } from './fleet-oil-card-order.component'; + +describe('FleetOilCardOrderComponent', () => { + let component: FleetOilCardOrderComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FleetOilCardOrderComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FleetOilCardOrderComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.ts new file mode 100644 index 0000000..7dacace --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-order/fleet-oil-card-order.component.ts @@ -0,0 +1,147 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {OrganizationService} from '../../../services/organization.service'; +import {NavigationComponent} from '../../navigation/navigation.component'; +import {CompanyAccountService} from '../../../services/company-account.service'; +import {ActivatedRoute} from '@angular/router'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; +import {FleetOilCardService} from '../../../services/fleet-oil-card.service'; + +@Component({ + selector: 'app-fleet-oil-card-order', + templateUrl: './fleet-oil-card-order.component.html', + styleUrls: ['./fleet-oil-card-order.component.scss'] +}) +export class FleetOilCardOrderComponent implements OnInit { + FILE_URL = environment.imageUrl; + roleType; + adminFlag; + loadingObject = { + spinning: false, + msg: '加载中' + }; + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + cardNo: string; + phone: string; + carLicensePlate: string; + orgArray = []; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private store: LocalStorageService, + private oilCardService: FleetOilCardService, + private organizationService: OrganizationService, + private navigationComponent: NavigationComponent, + private companyAccountService: CompanyAccountService, + private activatedRoute: ActivatedRoute, + private form: FormBuilder) { + this.roleType = Number(this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType); + this.adminFlag = Number(this.store.get(ADMIN_INFO_OBJECT)['secUser'].adminFlag); + } + + ngOnInit(): void { + this.searchForm = this.form.group({ + orgId: [null], + cardNo: [null], + goodsName: [null], + memPhone: [null], + carLicensePlate: [null], + status: [null], + payTime: [null], + payTimeS: [null], + payTimeE: [null], + }); + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams['cardNo'] != null) { + this.cardNo = queryParams['cardNo']; + } + if (queryParams['phone'] != null) { + this.phone = queryParams['phone']; + } + if (queryParams['carLicensePlate'] != null) { + this.carLicensePlate = queryParams['carLicensePlate']; + } + }); + + if (this.roleType === 5 && this.adminFlag === 1) { + this.organizationService.getOrganizationList(this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['id'], data => { + this.orgArray = data['return_data']; + }); + } + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + if (this.cardNo != null) { + this.whereObject['cardNo'] = this.cardNo; + } + if (this.phone != null) { + this.whereObject['phone'] = this.phone; + } + if (this.carLicensePlate != null) { + this.whereObject['carLicensePlate'] = this.carLicensePlate; + } + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.oilCardService.getCardOrderList(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; + if (this.searchForm.value.payTime != null) { + this.searchForm.value.payTimeS = new Date(this.searchForm.value.payTime[0]).getTime(); + this.searchForm.value.payTimeE = new Date(this.searchForm.value.payTime[1]).getTime(); + } else { + this.searchForm.value.payTimeS = null; + this.searchForm.value.payTimeE = null; + } + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /** + * 导出油卡订单 + */ + excelCardOrder() { + this.oilCardService.exportCardOrder(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/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.html b/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.html new file mode 100644 index 0000000..1417aec --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.html @@ -0,0 +1,145 @@ + + + + + + +
+
+
+ +
+ + 流水类型 + + + + + + + +
+ +
+ + 来源类型 + + + + + + + + + +
+ +
+ + 来源流水号 + + + + +
+ +
+ + 操作人类型 + + + + + + + +
+ +
+ + 创建时间 + + + + +
+ +
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+
+ + + + + + 序号 + 油卡卡号 + 账单类型 + 交易金额 + 交易前金额 + 交易后金额 + 来源类型 + 来源流水号 + 来源内容 + 操作人类型 + 操作人名称 + 操作人电话 + 创建时间 + + + + + + {{i+1}} + {{data.fleetOilCardNo}} + {{data.type | oilCardRecordType}} + ¥{{data.transactionAmount}} + ¥{{data.beforeAmount}} + ¥{{data.afterAmount}} + {{data.sourceType | oilCardRecordSourceType}} + {{data.sourceOrderNo}} + {{data.sourceContent}} + + 未知 + 管理员 + 客户 + + {{data.opUserName}} + {{data.opUserPhone}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + + +
+
diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.scss b/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.scss new file mode 100644 index 0000000..690993b --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.scss @@ -0,0 +1,3 @@ +.table-td-operation a { + padding: 0px 5px; +} diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.spec.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.spec.ts new file mode 100644 index 0000000..961d719 --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FleetOilCardRecordComponent } from './fleet-oil-card-record.component'; + +describe('FleetOilCardRecordComponent', () => { + let component: FleetOilCardRecordComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FleetOilCardRecordComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FleetOilCardRecordComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.ts new file mode 100644 index 0000000..afc44c4 --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-record/fleet-oil-card-record.component.ts @@ -0,0 +1,100 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {FleetOilCardService} from '../../../services/fleet-oil-card.service'; +import {ActivatedRoute, Router} from '@angular/router'; + +@Component({ + selector: 'app-fleet-oil-card-record', + templateUrl: './fleet-oil-card-record.component.html', + styleUrls: ['./fleet-oil-card-record.component.scss'] +}) +export class FleetOilCardRecordComponent implements OnInit { + FILE_URL = environment.imageUrl; + roleType; + adminFlag; + loadingObject = { + spinning: false, + msg: '加载中' + }; + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + fleetOilCardNo: string; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private store: LocalStorageService, + private fleetOilCardService: FleetOilCardService, + private activatedRoute: ActivatedRoute, + private router: Router, + private form: FormBuilder) { + } + + ngOnInit(): void { + this.searchForm = this.form.group({ + fleetOilCardNo: [null], + type: [null], + sourceOrderNo: [null], + sourceType: [null], + opUserPhone: [null], + opUserType: [null], + }); + + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams.cardNo != null) { + this.fleetOilCardNo = queryParams.cardNo; + this.requestData(1); + } + }); + + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['fleetOilCardNo'] = this.fleetOilCardNo; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.fleetOilCardService.getRecordList(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; + if (this.searchForm.value.createTime != null) { + this.searchForm.value.createTimeS = new Date(this.searchForm.value.createTime[0]).getTime(); + this.searchForm.value.createTimeE = new Date(this.searchForm.value.createTime[1]).getTime(); + } else { + this.searchForm.value.createTimeS = null; + this.searchForm.value.createTimeE = null; + } + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + +} diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-routing.module.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-routing.module.ts new file mode 100644 index 0000000..09c831f --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-routing.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {FleetOilCardListComponent} from './fleet-oil-card-list/fleet-oil-card-list.component'; +import {FleetOilCardUserListComponent} from './fleet-oil-card-user-list/fleet-oil-card-user-list.component'; +import {FleetOilCardCarComponent} from './fleet-oil-card-car/fleet-oil-card-car.component'; +import {FleetOilCardRecordComponent} from './fleet-oil-card-record/fleet-oil-card-record.component'; +import {FleetOilCardOrderComponent} from './fleet-oil-card-order/fleet-oil-card-order.component'; + + +const routes: Routes = [ + { path: 'list', component: FleetOilCardListComponent }, + { path: 'user-list', component: FleetOilCardUserListComponent }, + { path: 'car-list', component: FleetOilCardCarComponent }, + { path: 'record-list', component: FleetOilCardRecordComponent }, + { path: 'order-list', component: FleetOilCardOrderComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class FleetOilCardRoutingModule { } diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.html b/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.html new file mode 100644 index 0000000..f3eb7c0 --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.html @@ -0,0 +1,123 @@ + + + + + + +
+
+
+ +
+ + 联系人 + + + + +
+ +
+ + 联系电话 + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ + + + + +
+ + + + + + 序号 + 客户姓名 + 客户电话 + 消费总额 + 最近消费 + 创建时间 + 创建人 + 操作 + + + + + {{i+1}} + {{data.contactName}} + {{data.contactPhone}} + ¥{{data.amountConsume}} + + 未消费 + {{data.latelyConsumeTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.opUserName}} + + 操作列表 + + + + + + + +
+
+ + + + + + + 序号 + 客户姓名 + 客户电话 + 失败原因 + + + + + {{ i + 1}} + {{data.contactName}} + {{data.contactPhone}} + {{data.errMsg}} + + + + diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.scss b/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.scss new file mode 100644 index 0000000..690993b --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.scss @@ -0,0 +1,3 @@ +.table-td-operation a { + padding: 0px 5px; +} diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.spec.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.spec.ts new file mode 100644 index 0000000..dc56ada --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FleetOilCardUserListComponent } from './fleet-oil-card-user-list.component'; + +describe('FleetOilCardUserListComponent', () => { + let component: FleetOilCardUserListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FleetOilCardUserListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FleetOilCardUserListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.ts b/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.ts new file mode 100644 index 0000000..d1a42c0 --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card-user-list/fleet-oil-card-user-list.component.ts @@ -0,0 +1,251 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {NzMessageService, NzModalService, NzUploadChangeParam} from 'ng-zorro-antd'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {OrganizationService} from '../../../services/organization.service'; +import {CompanyAccountService} from '../../../services/company-account.service'; +import {ActivatedRoute, Router} from '@angular/router'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; +import {FleetOilCardUserService} from '../../../services/fleet-oil-card-user.service'; + +@Component({ + selector: 'app-fleet-oil-card-user-list', + templateUrl: './fleet-oil-card-user-list.component.html', + styleUrls: ['./fleet-oil-card-user-list.component.scss'] +}) +export class FleetOilCardUserListComponent implements OnInit { + WEB_SERVE_URL = environment.baseUrl; + FILE_URL = environment.imageUrl; + roleType; + adminFlag; + loadingObject = { + spinning: false, + msg: '加载中' + }; + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + fleetCardNo: string; + + rechargeModal = false; + rechargeForm: FormGroup; + rechargeBtnLoading = false; + + orgArray = []; + accountObject = { + amounts: 0 + }; + + importErrorDataModal = false; + errorDataArray = []; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private store: LocalStorageService, + private fleetOilCardUserService: FleetOilCardUserService, + private organizationService: OrganizationService, + private companyAccountService: CompanyAccountService, + private activatedRoute: ActivatedRoute, + private router: Router, + private form: FormBuilder) { + this.roleType = Number(this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType); + this.adminFlag = Number(this.store.get(ADMIN_INFO_OBJECT)['secUser'].adminFlag); + } + + ngOnInit(): void { + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams.cardNo != null) { + this.fleetCardNo = queryParams.cardNo; + } + }); + + this.searchForm = this.form.group({ + contactName: [null], + contactPhone: [null], + }); + + this.rechargeForm = this.form.group({ + cardNo: [{ value: null, disabled: true }, [Validators.required]], + price: [100, [Validators.required]], + twoPwd: [null, [Validators.required]], + }); + + if (this.roleType === 5 && this.adminFlag === 1) { + this.organizationService.getOrganizationList(this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['id'], data => { + this.orgArray = data['return_data']; + }); + } + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['fleetOilCardNo'] = this.fleetCardNo; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.fleetOilCardUserService.getUserList(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; + if (this.searchForm.value.createTime != null) { + this.searchForm.value.createTimeS = new Date(this.searchForm.value.createTime[0]).getTime(); + this.searchForm.value.createTimeE = new Date(this.searchForm.value.createTime[1]).getTime(); + } else { + this.searchForm.value.createTimeS = null; + this.searchForm.value.createTimeE = null; + } + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /** + * 弹出删除对话框 + */ + showDelConfirm(id: number): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否删除该用户?删除后用户无法使用车队油卡!', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.delData(id) + }); + } + + delData(id: number) { + this.fleetOilCardUserService.delete({ id: id }, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 弹出禁用对话框 + */ + showDisabledConfirm(cardNo: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否禁用油卡', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.disabledData(cardNo) + }); + } + + /** + * 禁用数据 + */ + disabledData(cardNo: string) { +/* this.fleetOilCardService.disabled({ cardNo: cardNo}, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + });*/ + } + + /** + * 弹出启用对话框 + */ + showEnableConfirm(cardNo: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否启用油卡', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.enableData(cardNo) + }); + } + + /** + * 启用数据 + */ + enableData(cardNo: string) { +/* this.fleetOilCardService.enable({ cardNo: cardNo}, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + });*/ + } + + handleChange(info: NzUploadChangeParam): void { + if (info.file.status === 'done') { + if (info.file.response.return_code === '000000') { + if (info.file.response.return_data == null || info.file.response.return_data.errorTotal === 0) { + + this.requestData(1); + this.message.success('导入成功'); + + } else { + this.modal.warning({ + nzTitle: '提示', + nzOkText: '查看失败数据', + nzContent: '只有部分数据导入成功', + nzOnOk: () => this.showImportErrorDataModal(info.file.response.return_data) + }); + } + } else { + this.message.error(info.file.response.return_msg); + } + } else if (info.file.status === 'error') { + this.message.error('上传错误'); + } + } + + // 打开模态框 + showImportErrorDataModal(data: []) { + this.errorDataArray = data['errorData']; + this.importErrorDataModal = true; + } + + closeImportErrorDataModal() { + this.importErrorDataModal = false; + } + + downloadTemplate() { + window.location.href = this.FILE_URL + "template/导入客户模板.xlsx"; + } + +} diff --git a/src/app/admin/fleet-oil-card/fleet-oil-card.module.ts b/src/app/admin/fleet-oil-card/fleet-oil-card.module.ts new file mode 100644 index 0000000..e173d53 --- /dev/null +++ b/src/app/admin/fleet-oil-card/fleet-oil-card.module.ts @@ -0,0 +1,29 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { FleetOilCardRoutingModule } from './fleet-oil-card-routing.module'; +import { FleetOilCardListComponent } from './fleet-oil-card-list/fleet-oil-card-list.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'; +import {NgxEchartsModule} from 'ngx-echarts'; +import { FleetOilCardUserListComponent } from './fleet-oil-card-user-list/fleet-oil-card-user-list.component'; +import { FleetOilCardCarComponent } from './fleet-oil-card-car/fleet-oil-card-car.component'; +import { FleetOilCardRecordComponent } from './fleet-oil-card-record/fleet-oil-card-record.component'; +import { FleetOilCardOrderComponent } from './fleet-oil-card-order/fleet-oil-card-order.component'; + +@NgModule({ + declarations: [FleetOilCardListComponent, FleetOilCardUserListComponent, FleetOilCardCarComponent, FleetOilCardRecordComponent, FleetOilCardOrderComponent], + imports: [ + CommonModule, + FleetOilCardRoutingModule, + NgZorroAntdModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + AppCommonModule, + NgxEchartsModule, + ] +}) +export class FleetOilCardModule { } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index c1fc476..c92c43a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -122,6 +122,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/oil-card/oil-card.module').then(m => m.OilCardModule), canActivate: [InitGuardService] }, + { + path: 'fleet-oil-card', + loadChildren: () => import('./admin/fleet-oil-card/fleet-oil-card.module').then(m => m.FleetOilCardModule), + canActivate: [InitGuardService] + }, { path: 'gz-sinopec', loadChildren: () => import('./admin/gz-sinopec/gz-sinopec.module').then(m => m.GzSinopecModule),