diff --git a/src/app/admin/company-amount/company-amount-record/company-amount-record.component.html b/src/app/admin/company-amount/company-amount-record/company-amount-record.component.html index bdce8ff..251ac96 100644 --- a/src/app/admin/company-amount/company-amount-record/company-amount-record.component.html +++ b/src/app/admin/company-amount/company-amount-record/company-amount-record.component.html @@ -35,7 +35,8 @@ - + + diff --git a/src/app/admin/company-amount/company-amount-routing.module.ts b/src/app/admin/company-amount/company-amount-routing.module.ts index dd5efb0..c91946f 100644 --- a/src/app/admin/company-amount/company-amount-routing.module.ts +++ b/src/app/admin/company-amount/company-amount-routing.module.ts @@ -4,10 +4,12 @@ import {CompanyAmountRecordComponent} from './company-amount-record/company-amou import {OilCardListComponent} from '../oil-card/oil-card-list/oil-card-list.component'; import {OilCardOrderComponent} from '../oil-card/oil-card-order/oil-card-order.component'; import {PayPwdComponent} from './pay-pwd/pay-pwd.component'; +import {FleetOilCardListComponent} from '../fleet-oil-card/fleet-oil-card-list/fleet-oil-card-list.component'; const routes: Routes = [ { path: 'list', component: CompanyAmountRecordComponent }, { path: 'oil-card', component: OilCardListComponent }, + { path: 'fleet-oil-card', component: FleetOilCardListComponent }, { path: 'oil-card-order', component: OilCardOrderComponent }, { path: 'pay-pwd-config', component: PayPwdComponent }, ]; 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/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts index 9befb57..092465d 100644 --- a/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts +++ b/src/app/admin/gas-oil-price/oil-price-task-edit/oil-price-task-edit.component.ts @@ -7,7 +7,6 @@ import {OilPriceTaskService} from '../../../services/oil-price/oil-price-task.se import {LocalStorageService} from "../../../services/local-storage.service"; import {ADMIN_INFO_OBJECT} from "../../../services/local-storage.namespace"; import {OilPriceOfficialService} from '../../../services/oil-price/oil-price-official.service'; -import {data} from 'jquery'; @Component({ selector: 'app-oil-price-task-edit', diff --git a/src/app/admin/oil-card/oil-card-order/oil-card-order.component.html b/src/app/admin/oil-card/oil-card-order/oil-card-order.component.html index 31953f2..fb8e1c3 100644 --- a/src/app/admin/oil-card/oil-card-order/oil-card-order.component.html +++ b/src/app/admin/oil-card/oil-card-order/oil-card-order.component.html @@ -97,15 +97,15 @@ 用户手机号 油卡卡号 平台订单号 - 团油订单号 + 加油金额 优惠金额 实付金额 加油站 油号 油枪号 - 团油油枪价 - 平台油枪价格 + 油站枪价 + 平台枪价 订单状态 创建时间 支付时间 @@ -120,7 +120,7 @@ {{data.merPhone}} {{data.memCardNo}} {{data.orderNo}} - {{data.gasOrderNo}} + ¥{{data.totalPrice}} ¥{{data.deductionPrice}} ¥{{data.payRealPrice}} diff --git a/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.ts b/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.ts index 9c691ad..67e1072 100644 --- a/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.ts +++ b/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.ts @@ -1,11 +1,9 @@ import { Component, OnInit } from '@angular/core'; import {environment} from '../../../../environments/environment'; -import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; import {IconService} from '../../../services/icon.service'; -import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; -import {Router} from '_@angular_router@9.0.7@@angular/router'; -import {CommonsService} from '../../../services/commons.service'; import {DistributionService} from '../../../services/distribution.service'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {NzMessageService} from 'ng-zorro-antd'; @Component({ selector: 'app-distribution-integral-list', diff --git a/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.ts b/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.ts index 401c83a..712d03d 100644 --- a/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.ts +++ b/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.ts @@ -1,9 +1,9 @@ import { Component, OnInit } from '@angular/core'; import {environment} from '../../../../environments/environment'; -import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; import {DistributionService} from '../../../services/distribution.service'; import {IconService} from '../../../services/icon.service'; -import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {NzMessageService} from 'ng-zorro-antd'; @Component({ selector: 'app-promotion-order-list', @@ -23,8 +23,6 @@ export class PromotionOrderListComponent implements OnInit { pageSize = 10; // 条码 loading = true; - - constructor( private form: FormBuilder, private distribution: DistributionService, diff --git a/src/app/admin/promotion/promotion.module.ts b/src/app/admin/promotion/promotion.module.ts index a4e6705..ddf99bf 100644 --- a/src/app/admin/promotion/promotion.module.ts +++ b/src/app/admin/promotion/promotion.module.ts @@ -4,10 +4,10 @@ import { CommonModule } from '@angular/common'; import { PromotionRoutingModule } from './promotion-routing.module'; import { DistributionIntegralListComponent } from './distribution-integral-list/distribution-integral-list.component'; import { PromotionOrderListComponent } from './promotion-order-list/promotion-order-list.component'; -import {NgZorroAntdModule} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; import {SeparateModule} from '../../common/separate/separate.module'; -import {FormsModule, ReactiveFormsModule} from '_@angular_forms@9.0.7@@angular/forms'; import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {NgZorroAntdModule} from 'ng-zorro-antd'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; @NgModule({ diff --git a/src/app/admin/system/system-msg/system-msg.component.ts b/src/app/admin/system/system-msg/system-msg.component.ts index b376b15..d065d65 100644 --- a/src/app/admin/system/system-msg/system-msg.component.ts +++ b/src/app/admin/system/system-msg/system-msg.component.ts @@ -1,11 +1,11 @@ import { Component, OnInit } from '@angular/core'; import {environment} from '../../../../environments/environment'; -import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; -import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; -import {NzMessageService, NzUploadFile} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; -import {Router} from '_@angular_router@9.0.7@@angular/router'; import {CommonsService} from '../../../services/commons.service'; import {MsgService} from '../../../services/msg.service'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {HttpClient} from '@angular/common/http'; +import {NzMessageService, NzUploadFile} from 'ng-zorro-antd'; +import {Router} from '@angular/router'; function getBase64(file: File): Promise { return new Promise((resolve, reject) => { diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 3877c1f..7ced521 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -117,6 +117,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), diff --git a/src/app/pipes/company-amount/company-amount-record-source-type.pipe.ts b/src/app/pipes/company-amount/company-amount-record-source-type.pipe.ts index d95af63..be219fd 100644 --- a/src/app/pipes/company-amount/company-amount-record-source-type.pipe.ts +++ b/src/app/pipes/company-amount/company-amount-record-source-type.pipe.ts @@ -10,9 +10,11 @@ export class CompanyAmountRecordSourceTypePipe implements PipeTransform { case 1: return '金额充值'; case 2: - return '油卡充值'; + return '个人油卡充值'; case 3: return '回收余额'; + case 4: + return '车队油卡充值'; } } diff --git a/src/app/services/distribution.service.ts b/src/app/services/distribution.service.ts index 159feab..ee720bd 100644 --- a/src/app/services/distribution.service.ts +++ b/src/app/services/distribution.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; -import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; import {CommonsService} from './commons.service'; import {environment} from '../../environments/environment'; +import {HttpClient} from '@angular/common/http'; @Injectable({ providedIn: 'root' diff --git a/src/app/services/fleet-oil-card-car.service.ts b/src/app/services/fleet-oil-card-car.service.ts new file mode 100644 index 0000000..6db2272 --- /dev/null +++ b/src/app/services/fleet-oil-card-car.service.ts @@ -0,0 +1,39 @@ +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 FleetOilCardCarService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 删除用户 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public delete(param: object, callBack) { + this.http.post(environment.baseUrl + 'fleetOilCardCar/delete', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询车辆列表 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getCarList(param: object, callBack) { + this.http.get(environment.baseUrl + 'fleetOilCardCar/getCarList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/fleet-oil-card-user.service.ts b/src/app/services/fleet-oil-card-user.service.ts new file mode 100644 index 0000000..100f452 --- /dev/null +++ b/src/app/services/fleet-oil-card-user.service.ts @@ -0,0 +1,39 @@ +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 FleetOilCardUserService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 删除用户 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public delete(param: object, callBack) { + this.http.post(environment.baseUrl + 'fleetOilCardUser/delete', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询用户列表 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getUserList(param: object, callBack) { + this.http.get(environment.baseUrl + 'fleetOilCardUser/getUserList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/fleet-oil-card.service.ts b/src/app/services/fleet-oil-card.service.ts new file mode 100644 index 0000000..df4551b --- /dev/null +++ b/src/app/services/fleet-oil-card.service.ts @@ -0,0 +1,148 @@ +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 FleetOilCardService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 车队油卡生成 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public generateCard(param: object, callBack) { + this.http.post(environment.baseUrl + 'fleetOilCard/generateCard', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 油卡充值 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public recharge(param: object, callBack) { + this.http.post(environment.baseUrl + 'fleetOilCard/recharge', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 回收余额 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public recycleAmount(param: object, callBack) { + this.http.post(environment.baseUrl + 'fleetOilCard/recycleAmount', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询油卡列表 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getCardList(param: object, callBack) { + this.http.get(environment.baseUrl + 'fleetOilCard/getCardList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询油卡记录列表 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getRecordList(param: object, callBack) { + this.http.get(environment.baseUrl + 'fleetOilCard/getRecordList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询订单列表 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getCardOrderList(param: object, callBack) { + this.http.get(environment.baseUrl + 'fleetOilCard/getCardOrderList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 导出油卡订单 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public exportCardOrder(param: object, callBack) { + this.http.get(environment.baseUrl + 'fleetOilCard/exportCardOrder' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 设置联系人 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public setContact(param: object, callBack) { + this.http.post(environment.baseUrl + 'fleetOilCard/setContact', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 禁用 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public disabled(param: object, callBack) { + this.http.post(environment.baseUrl + 'fleetOilCard/disabled', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 启用 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public enable(param: object, callBack) { + this.http.post(environment.baseUrl + 'fleetOilCard/enable', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 导出油卡 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public exportCard(param: object, callBack) { + this.http.post(environment.baseUrl + 'fleetOilCard/exportCard', param).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/msg.service.ts b/src/app/services/msg.service.ts index d9a59aa..2168ccb 100644 --- a/src/app/services/msg.service.ts +++ b/src/app/services/msg.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; -import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; import {CommonsService} from './commons.service'; import {environment} from '../../environments/environment'; +import {HttpClient} from '@angular/common/http'; @Injectable({ providedIn: 'root'