parent
9ab860bff6
commit
60ba036449
@ -0,0 +1,118 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<app-breadcrumb></app-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
<!--条件搜索--> |
||||||
|
|
||||||
|
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}"> |
||||||
|
<div class="inner-content"> |
||||||
|
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||||
|
<div nz-row> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">联系人</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="contactName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">联系电话</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="contactPhone" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="24" class="search-button"> |
||||||
|
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button> |
||||||
|
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||||
|
<div class="operating-button"> |
||||||
|
<button nz-button nzType="primary" class="right-btn" (click)="downloadTemplate()"><i nz-icon nzType="vertical-align-bottom" nzTheme="outline"></i>下载导入模板</button> |
||||||
|
|
||||||
|
<nz-upload |
||||||
|
[nzAccept]="'.xls,.xlsx'" |
||||||
|
nzAction="{{WEB_SERVE_URL}}fleetOilCardCar/importData?cardNo={{fleetCardNo}}" |
||||||
|
[nzHeaders]="{ authorization: 'authorization-text' }" |
||||||
|
(nzChange)="handleChange($event)" |
||||||
|
[nzShowUploadList]="false" |
||||||
|
> |
||||||
|
<button nz-button nzType="primary" class="right-btn"><i nz-icon nzType="import" nzTheme="outline"></i>导入车辆</button> |
||||||
|
</nz-upload> |
||||||
|
</div> |
||||||
|
|
||||||
|
<!--数组表格 --> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="dataObject.list" |
||||||
|
[nzTotal]="dataObject.total" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzLoading]="tableLoading" |
||||||
|
[nzPageIndex]="whereObject.pageNum" |
||||||
|
(nzPageIndexChange)="requestData($event)" |
||||||
|
[nzScroll]="{ x: '1100px'}"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="60px">序号</th> |
||||||
|
<th nzWidth="110px">车辆车牌</th> |
||||||
|
<th nzWidth="110px">车主姓名</th> |
||||||
|
<th nzWidth="110px">车主电话</th> |
||||||
|
<th nzWidth="120px">创建时间</th> |
||||||
|
<th nzWidth="110px">创建人</th> |
||||||
|
<th nzWidth="110px" nzRight="0px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||||
|
<td>{{i+1}}</td> |
||||||
|
<td>{{data.carLicensePlate}}</td> |
||||||
|
<td>{{data.contactName}}</td> |
||||||
|
<td>{{data.contactPhone}}</td> |
||||||
|
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td>{{data.opUserName}}</td> |
||||||
|
<td nzRight="0px" class="table-td-operation"> |
||||||
|
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a> |
||||||
|
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||||
|
<ul nz-menu nzSelectable> |
||||||
|
<li nz-menu-item (click)="showDelConfirm(data.id)"><a>删除</a></li> |
||||||
|
<li nz-menu-item [routerLink]="['/admin/fleet-oil-card/order-list']" [queryParams]="{ cardNo: data.fleetOilCardNo, carLicensePlate: data.carLicensePlate }"><a>消费订单</a></li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
</nz-spin> |
||||||
|
|
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="importErrorDataModal" nzTitle="导入失败数据" (nzOnCancel)="closeImportErrorDataModal()" nzWidth="900px" [nzFooter]="null"> |
||||||
|
<nz-table #errorStudentTable [nzData]="errorDataArray"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="80px">序号</th> |
||||||
|
<th nzWidth="150px">客户姓名</th> |
||||||
|
<th nzWidth="150px">客户电话</th> |
||||||
|
<th nzWidth="300px">失败原因</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of errorStudentTable.data;let i = index"> |
||||||
|
<td>{{ i + 1}}</td> |
||||||
|
<td>{{data.contactName}}</td> |
||||||
|
<td>{{data.contactPhone}}</td> |
||||||
|
<td>{{data.errMsg}}</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</nz-modal> |
@ -0,0 +1,3 @@ |
|||||||
|
.table-td-operation a { |
||||||
|
padding: 0px 5px; |
||||||
|
} |
@ -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<FleetOilCardCarComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ FleetOilCardCarComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(FleetOilCardCarComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -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"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,241 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<app-breadcrumb></app-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
<!--条件搜索--> |
||||||
|
|
||||||
|
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}"> |
||||||
|
<div class="inner-content"> |
||||||
|
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="8" *ngIf="roleType == 5 && adminFlag == 1"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">所属部门</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select nzAllowClear formControlName="orgId"> |
||||||
|
<nz-option *ngFor="let item of orgArray" nzLabel="{{item.name}}" nzValue="{{item.id}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">油卡卡号</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="cardNo" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">联系人</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="contactName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">联系电话</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="contactPhone" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">油卡状态</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select nzAllowClear formControlName="status"> |
||||||
|
<nz-option nzValue="1" nzLabel="正常"></nz-option> |
||||||
|
<nz-option nzValue="2" nzLabel="禁用"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">生成时间</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-range-picker |
||||||
|
formControlName="createTime" |
||||||
|
[nzShowTime]="{ nzHideDisabledOptions: true}" |
||||||
|
nzFormat="yyyy-MM-dd HH:mm:ss" |
||||||
|
></nz-range-picker> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="24" class="search-button"> |
||||||
|
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button> |
||||||
|
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
<div *ngIf="roleType == 5 && adminFlag == 0" style="width: 100%;text-align: center;"> |
||||||
|
<nz-row [nzGutter]="16"> |
||||||
|
<nz-col [nzSpan]="24"> |
||||||
|
<nz-statistic [nzValue]="'¥' + accountObject['amounts']" [nzTitle]="'账户余额'"></nz-statistic> |
||||||
|
</nz-col> |
||||||
|
</nz-row> |
||||||
|
</div> |
||||||
|
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||||
|
<div class="operating-button"> |
||||||
|
<button nz-button nzType="primary" class="right-btn" (click)="showGenerateCardModal()" ><i nz-icon nzType="plus" nzTheme="outline"></i>生成油卡</button> |
||||||
|
<!-- <button nz-button nzType="primary" class="right-btn" (click)="excelCard()" ><i nz-icon nzType="import" nzTheme="outline"></i>导出油卡</button>--> |
||||||
|
</div> |
||||||
|
|
||||||
|
<!--数组表格 --> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="dataObject.list" |
||||||
|
[nzTotal]="dataObject.total" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzLoading]="tableLoading" |
||||||
|
[nzPageIndex]="whereObject.pageNum" |
||||||
|
(nzPageIndexChange)="requestData($event)" |
||||||
|
[nzScroll]="{ x: '1100px'}"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="60px">序号</th> |
||||||
|
<th nzWidth="120px" *ngIf="roleType == 5 && adminFlag == 1">所属部门</th> |
||||||
|
<th nzWidth="160px">卡号</th> |
||||||
|
<th nzWidth="110px">余额</th> |
||||||
|
<th nzWidth="110px">消费金额</th> |
||||||
|
<th nzWidth="100px">联系人</th> |
||||||
|
<th nzWidth="120px">联系电话</th> |
||||||
|
<th nzWidth="100px">油卡状态</th> |
||||||
|
<!-- <th nzWidth="80px">操作人</th>--> |
||||||
|
<th nzWidth="160px">生成时间</th> |
||||||
|
<th nzWidth="160px" nzRight="0px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||||
|
<td>{{i+1}}</td> |
||||||
|
<td *ngIf="roleType == 5 && adminFlag == 1">{{data.orgName}}</td> |
||||||
|
<td>{{data.cardNo}}</td> |
||||||
|
<td>¥{{data.amount}}</td> |
||||||
|
<td>¥{{data.amountConsume}}</td> |
||||||
|
<td>{{data.contactName?data.contactName:'未设置'}}</td> |
||||||
|
<td>{{data.contactPhone?data.contactPhone:'未设置'}}</td> |
||||||
|
<td>{{data.status | oilCardStatus}}</td> |
||||||
|
<!-- <td>{{data.opUserName}}</td>--> |
||||||
|
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td nzRight="0px" class="table-td-operation"> |
||||||
|
<a (click)="showRechargeModal(data.cardNo)"> 充值 </a> |
||||||
|
<a nz-dropdown [nzDropdownMenu]="menu"> 更多操作 <i nz-icon nzType="down"></i> </a> |
||||||
|
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||||
|
<ul nz-menu nzSelectable> |
||||||
|
<li nz-menu-item [routerLink]="['/admin/fleet-oil-card/user-list']" [queryParams]="{ cardNo: data.cardNo}"><a>客户列表</a></li> |
||||||
|
<li nz-menu-item [routerLink]="['/admin/fleet-oil-card/car-list']" [queryParams]="{ cardNo: data.cardNo}"><a>车辆列表</a></li> |
||||||
|
<li nz-menu-item *ngIf="!data.contactPhone" (click)="showEditContactModal(data)"><a >设置联系人</a></li> |
||||||
|
<li nz-menu-item *ngIf="data.contactPhone" (click)="showEditContactModal(data)"><a >更换联系人</a></li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 1" (click)="showDisabledConfirm(data.cardNo)"><a>禁用</a></li> |
||||||
|
<li nz-menu-item *ngIf="data.status == 2" (click)="showEnableConfirm(data.cardNo)"><a>启用</a></li> |
||||||
|
<li nz-menu-item [routerLink]="['/admin/fleet-oil-card/record-list']" [queryParams]="{ cardNo: data.cardNo}"><a>油卡账单</a></li> |
||||||
|
<li nz-menu-item [routerLink]="['/admin/fleet-oil-card/order-list']" [queryParams]="{ cardNo: data.cardNo}"><a>消费订单</a></li> |
||||||
|
<li nz-menu-item (click)="showRecycleAmountModal(data)"><a>回收余额</a></li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
</nz-spin> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="generateCardModal" nzTitle="生成油卡" (nzOnCancel)="closeGenerateCardModal()" nzWidth="500px" [nzFooter]="null"> |
||||||
|
<form nz-form [formGroup]="generateCardForm"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >生成数量</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-input-number style="width: 100%" formControlName="generateNum" [nzMin]="1" [nzMax]="1000" [nzStep]="1"></nz-input-number> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<div style="text-align: center;"> |
||||||
|
<button nz-button nzType="primary" style="width: 150px;" (click)="submitGenerateCard()">确定</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="editContactModal" nzTitle="设置联系人" (nzOnCancel)="closeEditContactModal()" nzWidth="500px" [nzFooter]="null"> |
||||||
|
<form nz-form [formGroup]="editContactForm"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >联系人</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="contactName" placeholder="请输入联系姓名" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >联系电话</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="contactPhone" placeholder="请输入联系电话" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<div style="text-align: center;"> |
||||||
|
<button nz-button nzType="primary" style="width: 150px;" (click)="submitEditContactData()">确定</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="rechargeModal" nzTitle="充值" (nzOnCancel)="closeRechargeModal()" nzWidth="500px" [nzFooter]="null"> |
||||||
|
<form nz-form [formGroup]="rechargeForm"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >卡号</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="cardNo" disabled /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >充值金额</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-input-number style="width: 100%" formControlName="price" [nzMin]="0.01" [nzMax]="9999999" [nzStep]="1" [nzPrecision]="2"></nz-input-number> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >支付密码</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input type="password" formControlName="twoPwd" nz-input placeholder="请输入支付密码" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<div style="text-align: center;"> |
||||||
|
<button nz-button nzType="primary" style="width: 150px;" [nzLoading]="rechargeBtnLoading" (click)="submitRecharge()">确定</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="recycleAmountModal" nzTitle="油卡余额回收" (nzOnCancel)="closeRecycleAmountModal()" nzWidth="500px" [nzFooter]="null"> |
||||||
|
<form nz-form [formGroup]="recycleAmountForm"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >卡号</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="cardNo" disabled /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >回收余额</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-input-number style="width: 100%" formControlName="amount"></nz-input-number> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6" nzRequired >支付密码</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input type="password" formControlName="twoPwd" nz-input placeholder="请输入支付密码" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
<div style="text-align: center;"> |
||||||
|
<button nz-button nzType="primary" style="width: 150px;" [nzLoading]="recycleAmountBtnLoading" (click)="submitRecycleAmount()">确定</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</nz-modal> |
@ -0,0 +1,3 @@ |
|||||||
|
.table-td-operation a { |
||||||
|
padding: 0px 5px; |
||||||
|
} |
@ -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<FleetOilCardListComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ FleetOilCardListComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(FleetOilCardListComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -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'] |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,167 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<app-breadcrumb></app-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
<!--条件搜索--> |
||||||
|
|
||||||
|
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}"> |
||||||
|
<div class="inner-content"> |
||||||
|
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="8" *ngIf="roleType == 5 && adminFlag == 1"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">部门</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select nzShowSearch nzAllowClear formControlName="orgId"> |
||||||
|
<nz-option *ngFor="let item of orgArray" nzLabel="{{item.name}}" nzValue="{{item.id}}"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8" *ngIf="this.cardNo == null"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">油卡卡号</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="cardNo" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8" *ngIf="this.phone == null"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">客户电话</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="memPhone" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8" *ngIf="this.carLicensePlate == null"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">车牌</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="carLicensePlate" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">加油站</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="goodsName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">交易状态</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select nzShowSearch nzAllowClear formControlName="status"> |
||||||
|
<nz-option nzLabel="已支付" nzValue="2"></nz-option> |
||||||
|
<nz-option nzLabel="已完成" nzValue="3"></nz-option> |
||||||
|
<nz-option nzLabel="已退款" nzValue="4"></nz-option> |
||||||
|
<nz-option nzLabel="退款中" nzValue="6"></nz-option> |
||||||
|
<nz-option nzLabel="退款失败" nzValue="7"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">支付时间</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-range-picker |
||||||
|
formControlName="payTime" |
||||||
|
[nzShowTime]="{ nzHideDisabledOptions: true}" |
||||||
|
nzFormat="yyyy-MM-dd HH:mm:ss" |
||||||
|
></nz-range-picker> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="24" class="search-button"> |
||||||
|
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button> |
||||||
|
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||||
|
<div class="operating-button"> |
||||||
|
<button nz-button nzType="primary" class="right-btn" (click)="excelCardOrder()"><i nz-icon nzType="import" nzTheme="outline"></i>导出交易</button> |
||||||
|
</div> |
||||||
|
|
||||||
|
<!--数组表格 --> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="dataObject.list" |
||||||
|
[nzTotal]="dataObject.total" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzLoading]="tableLoading" |
||||||
|
[nzPageIndex]="whereObject.pageNum" |
||||||
|
(nzPageIndexChange)="requestData($event)" |
||||||
|
[nzScroll]="{ x: '1100px'}"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="60px">序号</th> |
||||||
|
<th *ngIf="roleType == 5 && adminFlag == 1" nzWidth="150px">所属部门</th> |
||||||
|
<th nzWidth="120px">客户电话</th> |
||||||
|
<th nzWidth="100px">车牌</th> |
||||||
|
<th nzWidth="160px">油卡卡号</th> |
||||||
|
<th nzWidth="200px">交易单号</th> |
||||||
|
<th nzWidth="100px">加油金额</th> |
||||||
|
<th nzWidth="100px">优惠金额</th> |
||||||
|
<th nzWidth="100px">实付金额</th> |
||||||
|
<th nzWidth="200px">加油站</th> |
||||||
|
<th nzWidth="70px">油号</th> |
||||||
|
<th nzWidth="80px">油枪号</th> |
||||||
|
<th nzWidth="110px">油站枪价</th> |
||||||
|
<th nzWidth="120px">平台枪价</th> |
||||||
|
<th nzWidth="100px">交易状态</th> |
||||||
|
<th nzWidth="160px">创建时间</th> |
||||||
|
<th nzWidth="160px">支付时间</th> |
||||||
|
<th nzWidth="160px">退款时间</th> |
||||||
|
<!-- <th nzWidth="160px" nzRight="0px">操作</th>--> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||||
|
<td>{{i+1}}</td> |
||||||
|
<td *ngIf="roleType == 5 && adminFlag == 1">{{data.orgName}}</td> |
||||||
|
<td>{{data.merPhone}}</td> |
||||||
|
<td>{{data.carLicensePlate!=null?data.carLicensePlate:'未知'}}</td> |
||||||
|
<td>{{data.memCardNo}}</td> |
||||||
|
<td>{{data.orderNo}}</td> |
||||||
|
<!-- <td>{{data.gasOrderNo}}</td>--> |
||||||
|
<td>¥{{data.totalPrice}}</td> |
||||||
|
<td>¥{{data.deductionPrice}}</td> |
||||||
|
<td>¥{{data.payRealPrice}}</td> |
||||||
|
<td>{{data.goodsName}}</td> |
||||||
|
<td>{{data.gasOilNo}}</td> |
||||||
|
<td>{{data.gasGunNo}}</td> |
||||||
|
<td>{{data.gasPriceGun}}</td> |
||||||
|
<td>{{data.platformPriceGun}}</td> |
||||||
|
<td>{{data.statusName}}</td> |
||||||
|
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td>{{data.payTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td>{{data.refundTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<!-- <td nzRight="0px" class="table-td-operation"> |
||||||
|
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a> |
||||||
|
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||||
|
<ul nz-menu nzSelectable> |
||||||
|
<li nz-menu-item><a></a></li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu> |
||||||
|
</td>--> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
</nz-spin> |
@ -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<FleetOilCardOrderComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ FleetOilCardOrderComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(FleetOilCardOrderComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -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'] |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,145 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<app-breadcrumb></app-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
<!--条件搜索--> |
||||||
|
|
||||||
|
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}"> |
||||||
|
<div class="inner-content"> |
||||||
|
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||||
|
<div nz-row> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">流水类型</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select nzAllowClear formControlName="type"> |
||||||
|
<nz-option nzValue="1" nzLabel="进账"></nz-option> |
||||||
|
<nz-option nzValue="2" nzLabel="出账"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">来源类型</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select nzAllowClear formControlName="sourceType"> |
||||||
|
<nz-option nzValue="1" nzLabel="充值金额"></nz-option> |
||||||
|
<nz-option nzValue="2" nzLabel="订单消费"></nz-option> |
||||||
|
<nz-option nzValue="3" nzLabel="订单退款"></nz-option> |
||||||
|
<nz-option nzValue="4" nzLabel="回收余额"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">来源流水号</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="sourceOrderNo" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">操作人类型</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-select nzAllowClear formControlName="opUserType"> |
||||||
|
<nz-option nzValue="1" nzLabel="管理员"></nz-option> |
||||||
|
<nz-option nzValue="2" nzLabel="客户"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">创建时间</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<nz-range-picker |
||||||
|
formControlName="createTime" |
||||||
|
[nzShowTime]="{ nzHideDisabledOptions: true}" |
||||||
|
nzFormat="yyyy-MM-dd HH:mm:ss" |
||||||
|
></nz-range-picker> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="24" class="search-button"> |
||||||
|
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button> |
||||||
|
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||||
|
<div class="operating-button"> |
||||||
|
</div> |
||||||
|
|
||||||
|
<!--数组表格 --> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="dataObject.list" |
||||||
|
[nzTotal]="dataObject.total" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzLoading]="tableLoading" |
||||||
|
[nzPageIndex]="whereObject.pageNum" |
||||||
|
(nzPageIndexChange)="requestData($event)" |
||||||
|
[nzScroll]="{ x: '1100px'}"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="60px">序号</th> |
||||||
|
<th nzWidth="160px">油卡卡号</th> |
||||||
|
<th nzWidth="100px">账单类型</th> |
||||||
|
<th nzWidth="100px">交易金额</th> |
||||||
|
<th nzWidth="120px">交易前金额</th> |
||||||
|
<th nzWidth="120px">交易后金额</th> |
||||||
|
<th nzWidth="100px">来源类型</th> |
||||||
|
<th nzWidth="200px">来源流水号</th> |
||||||
|
<th nzWidth="400px">来源内容</th> |
||||||
|
<th nzWidth="120px">操作人类型</th> |
||||||
|
<th nzWidth="120px">操作人名称</th> |
||||||
|
<th nzWidth="120px">操作人电话</th> |
||||||
|
<th nzWidth="160px">创建时间</th> |
||||||
|
<!-- <th nzWidth="160px" nzRight="0px">操作</th>--> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||||
|
<td>{{i+1}}</td> |
||||||
|
<td>{{data.fleetOilCardNo}}</td> |
||||||
|
<td>{{data.type | oilCardRecordType}}</td> |
||||||
|
<td>¥{{data.transactionAmount}}</td> |
||||||
|
<td>¥{{data.beforeAmount}}</td> |
||||||
|
<td>¥{{data.afterAmount}}</td> |
||||||
|
<td>{{data.sourceType | oilCardRecordSourceType}}</td> |
||||||
|
<td>{{data.sourceOrderNo}}</td> |
||||||
|
<td>{{data.sourceContent}}</td> |
||||||
|
<td> |
||||||
|
<span *ngIf="data.opUserType == 0">未知</span> |
||||||
|
<span *ngIf="data.opUserType == 1">管理员</span> |
||||||
|
<span *ngIf="data.opUserType == 2">客户</span> |
||||||
|
</td> |
||||||
|
<td>{{data.opUserName}}</td> |
||||||
|
<td>{{data.opUserPhone}}</td> |
||||||
|
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<!-- <td nzRight="0px" class="table-td-operation"> |
||||||
|
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a> |
||||||
|
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||||
|
<ul nz-menu nzSelectable> |
||||||
|
<li nz-menu-item><a></a></li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu> |
||||||
|
</td>--> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
</nz-spin> |
@ -0,0 +1,3 @@ |
|||||||
|
.table-td-operation a { |
||||||
|
padding: 0px 5px; |
||||||
|
} |
@ -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<FleetOilCardRecordComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ FleetOilCardRecordComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(FleetOilCardRecordComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -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(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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 { } |
@ -0,0 +1,123 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<app-breadcrumb></app-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
<!--条件搜索--> |
||||||
|
|
||||||
|
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}"> |
||||||
|
<div class="inner-content"> |
||||||
|
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||||
|
<div nz-row> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">联系人</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="contactName" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="8">联系电话</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="14"> |
||||||
|
<input nz-input formControlName="contactPhone" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="24" class="search-button"> |
||||||
|
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button> |
||||||
|
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||||
|
<div class="operating-button"> |
||||||
|
<button nz-button nzType="primary" class="right-btn" (click)="downloadTemplate()"><i nz-icon nzType="vertical-align-bottom" nzTheme="outline"></i>下载导入模板</button> |
||||||
|
|
||||||
|
<nz-upload |
||||||
|
[nzAccept]="'.xls,.xlsx'" |
||||||
|
nzAction="{{WEB_SERVE_URL}}fleetOilCardUser/importData?cardNo={{fleetCardNo}}" |
||||||
|
[nzHeaders]="{ authorization: 'authorization-text' }" |
||||||
|
(nzChange)="handleChange($event)" |
||||||
|
[nzShowUploadList]="false" |
||||||
|
> |
||||||
|
<button nz-button nzType="primary" class="right-btn"><i nz-icon nzType="import" nzTheme="outline"></i>导入客户</button> |
||||||
|
</nz-upload> |
||||||
|
</div> |
||||||
|
|
||||||
|
<!--数组表格 --> |
||||||
|
<nz-table #basicTable |
||||||
|
[nzData]="dataObject.list" |
||||||
|
[nzTotal]="dataObject.total" |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzLoading]="tableLoading" |
||||||
|
[nzPageIndex]="whereObject.pageNum" |
||||||
|
(nzPageIndexChange)="requestData($event)" |
||||||
|
[nzScroll]="{ x: '1100px'}"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="60px">序号</th> |
||||||
|
<th nzWidth="110px">客户姓名</th> |
||||||
|
<th nzWidth="110px">客户电话</th> |
||||||
|
<th nzWidth="110px">消费总额</th> |
||||||
|
<th nzWidth="120px">最近消费</th> |
||||||
|
<th nzWidth="120px">创建时间</th> |
||||||
|
<th nzWidth="110px">创建人</th> |
||||||
|
<th nzWidth="110px" nzRight="0px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||||
|
<td>{{i+1}}</td> |
||||||
|
<td>{{data.contactName}}</td> |
||||||
|
<td>{{data.contactPhone}}</td> |
||||||
|
<td>¥{{data.amountConsume}}</td> |
||||||
|
<td> |
||||||
|
<span *ngIf="data.latelyConsumeTime == null">未消费</span> |
||||||
|
<span *ngIf="data.latelyConsumeTime != null">{{data.latelyConsumeTime | date : 'yyyy-MM-dd HH:mm:ss'}}</span> |
||||||
|
</td> |
||||||
|
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||||
|
<td>{{data.opUserName}}</td> |
||||||
|
<td nzRight="0px" class="table-td-operation"> |
||||||
|
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a> |
||||||
|
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||||
|
<ul nz-menu nzSelectable> |
||||||
|
<li nz-menu-item (click)="showDelConfirm(data.id)"><a>删除</a></li> |
||||||
|
<li nz-menu-item [routerLink]="['/admin/fleet-oil-card/order-list']" [queryParams]="{ cardNo: data.fleetOilCardNo, phone: data.contactPhone }"><a>消费订单</a></li> |
||||||
|
</ul> |
||||||
|
</nz-dropdown-menu> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
</nz-spin> |
||||||
|
|
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="importErrorDataModal" nzTitle="导入失败数据" (nzOnCancel)="closeImportErrorDataModal()" nzWidth="900px" [nzFooter]="null"> |
||||||
|
<nz-table #errorStudentTable [nzData]="errorDataArray"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th nzWidth="80px">序号</th> |
||||||
|
<th nzWidth="150px">客户姓名</th> |
||||||
|
<th nzWidth="150px">客户电话</th> |
||||||
|
<th nzWidth="300px">失败原因</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of errorStudentTable.data;let i = index"> |
||||||
|
<td>{{ i + 1}}</td> |
||||||
|
<td>{{data.contactName}}</td> |
||||||
|
<td>{{data.contactPhone}}</td> |
||||||
|
<td>{{data.errMsg}}</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</nz-modal> |
@ -0,0 +1,3 @@ |
|||||||
|
.table-td-operation a { |
||||||
|
padding: 0px 5px; |
||||||
|
} |
@ -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<FleetOilCardUserListComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ FleetOilCardUserListComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(FleetOilCardUserListComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -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"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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 { } |
Loading…
Reference in new issue