parent
54f895b577
commit
e1ad1bb533
@ -0,0 +1,129 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>设备类型</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="type" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of typeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>设备编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="deviceSn" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6" *ngIf="accountType == 1"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6" *ngIf="accountType == 1"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label *ngIf="accountType != 1"></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="showEditDeviceModal(null)">绑定设备</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1200px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="100px">设备类型</th> |
||||
<th nzWidth="100px">设备编号</th> |
||||
<th nzWidth="100px">设备key</th> |
||||
<th nzWidth="100px">使用油站编号</th> |
||||
<th nzWidth="100px">使用油站名称</th> |
||||
<th nzWidth="100px">创建时间</th> |
||||
<th nzRight nzWidth="70px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.type | dictionary: 'DEVICE_TYPE'}}</td> |
||||
<td>{{data.deviceSn}}</td> |
||||
<td>{{data.deviceKey}}</td> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td nzRight> |
||||
<a (click)="showEditDeviceModal(data)">修改</a> |
||||
<nz-divider nzType="vertical"></nz-divider> |
||||
<a (click)="delDevice(data.id)">删除</a> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="editDeviceModal" |
||||
[nzWidth]="700" |
||||
nzTitle="{{this.editDeviceForm.controls['id'].value!=null?'修改':'增加'}}" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeEditDeviceModal()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="editDeviceForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>设备类型</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="type" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of typeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>设备编号</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="deviceSn" placeholder="请输入设备SN号 / 机器码" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>设备秘钥</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="deviceKey" placeholder="请输入设备KEY / 校验码" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitData()" class="submit-btn">保存</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,6 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
@ -0,0 +1,232 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {DeviceService} from "../../../services/device/device.service"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-device-list', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule |
||||
], |
||||
templateUrl: './device-list.component.html', |
||||
styleUrl: './device-list.component.less' |
||||
}) |
||||
export class DeviceListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
accountType = null; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 编辑设备表单
|
||||
editDeviceForm: FormGroup; |
||||
// 编辑设备模态框
|
||||
editDeviceModal = false; |
||||
// 油站来源
|
||||
typeArray = new DictionaryPipe().getDictionaryList('DEVICE_TYPE'); |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private deviceService: DeviceService, |
||||
private modal: NzModalService) { |
||||
this.accountType = this.storage.get(DATA)['account']['objectType']; |
||||
|
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
type: [''], |
||||
merNo: [''], |
||||
merName: [''], |
||||
deviceSn: [''], |
||||
}); |
||||
|
||||
this.editDeviceForm = this.fb.group({ |
||||
id: [null], |
||||
type: [null, [Validators.required]], |
||||
merNo: [null], |
||||
deviceSn: [null, [Validators.required]], |
||||
deviceKey: [null, [Validators.required]], |
||||
}); |
||||
|
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.deviceService.getDeviceList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 删除设备 |
||||
* @param deviceId |
||||
*/ |
||||
delDevice(deviceId: number) { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定删除设备吗?', |
||||
nzOnOk: () => |
||||
this.deviceService.delDevice({deviceId: deviceId}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
this.message.create('success', '操作成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}) |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 打开编辑设备模态框 |
||||
* @param data |
||||
*/ |
||||
showEditDeviceModal(data: any) { |
||||
if (data != null) { |
||||
data['type'] = ''+data['type']; |
||||
this.editDeviceForm.patchValue(data); |
||||
} |
||||
this.editDeviceModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交数据 |
||||
*/ |
||||
submitData() { |
||||
if (this.accountType != 2) { |
||||
this.message.create('error', '只有油站角色才能绑定设备'); |
||||
return; |
||||
} |
||||
if (this.editDeviceForm.controls['merNo'].value == null) { |
||||
this.editDeviceForm.controls['merNo'].setValue(this.storage.get(DATA)['merchant']['merNo']); |
||||
} |
||||
if (this.editDeviceForm.valid) { |
||||
let param = this.editDeviceForm.value; |
||||
this.deviceService.editDevice(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeEditDeviceModal(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.editDeviceForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭编辑设备模态框 |
||||
*/ |
||||
closeEditDeviceModal() { |
||||
this.editDeviceForm.reset(); |
||||
this.editDeviceModal = false; |
||||
} |
||||
} |
@ -0,0 +1 @@ |
||||
<p>oil-discount works!</p> |
@ -0,0 +1,12 @@ |
||||
import { Component } from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'app-oil-discount', |
||||
standalone: true, |
||||
imports: [], |
||||
templateUrl: './oil-discount.component.html', |
||||
styleUrl: './oil-discount.component.less' |
||||
}) |
||||
export class OilDiscountComponent { |
||||
|
||||
} |
@ -0,0 +1,185 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>区域名称</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="regionId" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of regionArray" nzValue="{{item.regionId}}" nzLabel="{{item.regionName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油号</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="oilNo" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of oilNoArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>执行方式</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="executionType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of oilTaskExecutionTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>状态</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="status" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of oilTaskStatusArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
<button nz-button style="margin-right: 8px" (click)="showEditTaskModal()" [nzType]="'primary'" >新增任务</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '2400' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="100px">区域名称</th> |
||||
<th nzWidth="100px">区域价区</th> |
||||
<th nzWidth="100px">油站编号</th> |
||||
<th nzWidth="200px">油站名称</th> |
||||
<th nzWidth="100px">油品类型</th> |
||||
<th nzWidth="100px">油号</th> |
||||
<th nzWidth="100px">价格类型</th> |
||||
<th nzWidth="100px">执行价格</th> |
||||
<th nzWidth="100px">执行方式</th> |
||||
<th nzWidth="100px">任务状态</th> |
||||
<th nzWidth="200px">创建时间</th> |
||||
<th nzWidth="200px">执行时间</th> |
||||
<th nzRight nzWidth="80px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.regionName?data.regionName:'无'}}</td> |
||||
<td>{{data.oilPriceZoneName?data.oilPriceZoneName:'无'}}</td> |
||||
<td>{{data.merNo?data.merNo:'无'}}</td> |
||||
<td>{{data.merName?data.merName:'无'}}</td> |
||||
<td>{{data.oilTypeName}}</td> |
||||
<td>{{data.oilNo}}</td> |
||||
<td>{{data.priceType | dictionary: 'GAS_OIL_TASK_PRICE_TYPE'}}</td> |
||||
<td>¥{{data.price}}</td> |
||||
<td>{{data.executionType | dictionary : 'GAS_OIL_TASK_EXECUTION_TYPE'}}</td> |
||||
<td>{{data.status | dictionary : 'GAS_OIL_TASK_STATUS'}}</td> |
||||
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td>{{data.startTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td nzRight> |
||||
<!-- <button nz-button nzType="link" (click)="showDetail(data)" [nzSize]="'small'">详情</button> |
||||
<nz-divider nzType="vertical"></nz-divider>--> |
||||
<button nz-button nzType="link" (click)="delTask(data.id)" [nzSize]="'small'" disabled="{{data.status==1?false:true}}">删除</button> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template>x |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="editTaskModal" |
||||
[nzWidth]="500" |
||||
nzTitle="新增任务" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeEditTaskModal()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="editTaskForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>价格类型</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="priceType" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of oilTaskPriceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>区域</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="regionId" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of regionArray" nzValue="{{item.regionId}}" nzLabel="{{item.regionName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24">价区</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="oilPriceZoneId" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of oilPriceZoneArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油品</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="oilNo" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of oilNoArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>执行价格</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="price" [nzMin]="1" [nzMax]="10" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'执行价格'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>执行方式</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="executionType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of oilTaskExecutionTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item *ngIf="this.editTaskForm.controls['executionType'].value == 2"> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>执行时间</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-date-picker formControlName="startTime" nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss"></nz-date-picker> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitData()" class="submit-btn">保存</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,9 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
nz-date-picker { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
@ -0,0 +1,242 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||
import {OilTaskService} from "../../../services/mer-oil-price/oil-task.service"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-oil-task', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule |
||||
], |
||||
templateUrl: './oil-task.component.html', |
||||
styleUrl: './oil-task.component.less' |
||||
}) |
||||
export class OilTaskComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
accountType = null; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 地区
|
||||
regionArray: any = []; |
||||
// 油号
|
||||
oilNoArray = new DictionaryPipe().getDictionaryList('OIL_NO'); |
||||
// 价格类型
|
||||
oilTaskPriceTypeArray = new DictionaryPipe().getDictionaryList('GAS_OIL_TASK_PRICE_TYPE'); |
||||
// 执行方式
|
||||
oilTaskExecutionTypeArray = new DictionaryPipe().getDictionaryList('GAS_OIL_TASK_EXECUTION_TYPE'); |
||||
// 执行状态
|
||||
oilTaskStatusArray = new DictionaryPipe().getDictionaryList('GAS_OIL_TASK_STATUS'); |
||||
// 价区
|
||||
oilPriceZoneArray = new DictionaryPipe().getDictionaryList('OIL_PRICE_ZONE'); |
||||
// 编辑任务表单
|
||||
editTaskForm: FormGroup; |
||||
editTaskModal = false; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private oilTaskService: OilTaskService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
this.accountType = this.storage.get(DATA)['account']['objectType']; |
||||
|
||||
// 获取地区
|
||||
this.commonService.getRegion('',(data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.regionArray = data['return_data']; |
||||
} |
||||
}); |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
oilNo: [null], |
||||
executionType: [null], |
||||
regionId: [null], |
||||
merNo: [null], |
||||
merName: [null], |
||||
status: [null], |
||||
}); |
||||
|
||||
this.editTaskForm = this.fb.group({ |
||||
priceType: ['1', [Validators.required]], |
||||
regionId: [''], |
||||
oilPriceZoneId: [''], |
||||
oilNo: ['',[Validators.required]], |
||||
price: ['',[Validators.required]], |
||||
executionType: ['',[Validators.required]], |
||||
startTime: [''], |
||||
}); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.oilTaskService.getTaskList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
delTask(id: number) { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定删除任务吗?', |
||||
nzOnOk: () => |
||||
this.oilTaskService.delTask({taskId: id}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
this.message.create('success', '操作成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}) |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 打开编辑任务模态框 |
||||
*/ |
||||
showEditTaskModal() { |
||||
this.editTaskModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交数据 |
||||
*/ |
||||
submitData() { |
||||
if (this.editTaskForm.valid) { |
||||
let param = []; |
||||
param.push(this.editTaskForm.value); |
||||
this.oilTaskService.batchAddTask(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeEditTaskModal(); |
||||
// 表单重置
|
||||
this.editTaskForm.reset(); |
||||
this.editTaskForm.controls['priceType'].setValue('1'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.editTaskForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭编辑任务模态框 |
||||
*/ |
||||
closeEditTaskModal() { |
||||
this.editTaskModal = false; |
||||
} |
||||
} |
@ -0,0 +1,150 @@ |
||||
<!--<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form>--> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1200px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="100px">连锁名称</th> |
||||
<th nzWidth="100px">余额</th> |
||||
<th nzWidth="120px">创建时间</th> |
||||
<th nzRight nzWidth="50px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.name}}</td> |
||||
<td>{{data.amount}}</td> |
||||
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td nzRight> |
||||
<a (click)="showRechargeModal(data)">充值</a> |
||||
<nz-divider nzType="vertical"></nz-divider> |
||||
<a nz-dropdown [nzDropdownMenu]="menu"> |
||||
更多 |
||||
<span nz-icon nzType="down"></span> |
||||
</a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li nz-menu-item (click)="showRecordModal(data.id)"><a >动账记录</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="rechargeModal" |
||||
[nzWidth]="500" |
||||
nzTitle="充值" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeRechargeModal()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="rechargeForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>连锁名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="name"/> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>充值金额</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="amount" [nzMin]="1" [nzMax]="10" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'充值金额'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" class="submit-btn" (click)="rechargeConfirm()">确定</button> |
||||
</div> |
||||
|
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="recordModal" |
||||
[nzWidth]="1000" |
||||
nzTitle="动账记录" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="recordModal = !recordModal"> |
||||
<ng-container *nzModalContent> |
||||
<nz-table #recordTable |
||||
nzSize="middle" |
||||
[nzScroll]="{ x: '1000px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="recordTablePageNum" |
||||
(nzPageIndexChange)="queryRecord()" |
||||
[nzTotal]="recordData.total" |
||||
[nzData]="recordData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="90px">交易前金额</th> |
||||
<th nzWidth="80px">交易金额</th> |
||||
<th nzWidth="90px">交易后金额</th> |
||||
<th nzWidth="50px">交易类型</th> |
||||
<th nzWidth="100px">交易时间</th> |
||||
<th nzWidth="120px">交易来源</th> |
||||
<th nzWidth="120px">操作油站</th> |
||||
<!-- <th nzRight nzWidth="50px">操作</th>--> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of recordTable.data"> |
||||
<td>{{data.beforeAmount}}</td> |
||||
<td>{{data.transactionAmount}}</td> |
||||
<td>{{data.afterAmount}}</td> |
||||
<td>{{data.type==1?'入账':'出账'}}</td> |
||||
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td>{{data.sourceType | dictionary: 'MER_ACCOUNT_RECORD_SOURCE_TYPE'}}</td> |
||||
<td>{{data.merNo!=null?'【'+data.merNo+'】'+data.merName:''}}</td> |
||||
<!-- <td nzRight> |
||||
<a >详情</a> |
||||
</td>--> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,6 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
@ -0,0 +1,247 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import { NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzInputNumberComponent, NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {MerChainBrandAmountService} from "../../../services/merchant/mer-chain-brand-amount.service"; |
||||
import {MerChainBrandService} from "../../../services/merchant/mer-chain-brand.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-mer-chain-brand-amount', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule |
||||
], |
||||
templateUrl: './mer-chain-brand-amount.component.html', |
||||
styleUrl: './mer-chain-brand-amount.component.less' |
||||
}) |
||||
export class MerChainBrandAmountComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 充值表单
|
||||
rechargeForm: FormGroup; |
||||
rechargeModal = false; |
||||
|
||||
// 记录模态框
|
||||
recordModal = false; |
||||
recordChainBrandId: any = null; |
||||
// 表单页数
|
||||
recordTablePageNum = 1; |
||||
// 每页数量
|
||||
recordTablePageSize = 10; |
||||
recordData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private merChainBrandService: MerChainBrandService, |
||||
private merChainBrandAmountService: MerChainBrandAmountService, |
||||
private modalService: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
merNo: [''], |
||||
merName: [''], |
||||
}); |
||||
|
||||
// 初始化搜索框
|
||||
this.rechargeForm = this.fb.group({ |
||||
id: [null, [Validators.required]], |
||||
name: [null], |
||||
amount: [null, [Validators.required]], |
||||
}); |
||||
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.merChainBrandService.getList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打卡充值模态框 |
||||
* @param data |
||||
*/ |
||||
showRechargeModal(data: any) { |
||||
this.rechargeForm.patchValue(data); |
||||
this.rechargeForm.controls['amount'].setValue(0); |
||||
this.rechargeForm.controls['id'].disable(); |
||||
this.rechargeForm.controls['name'].disable(); |
||||
this.rechargeModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 充值确认框 |
||||
*/ |
||||
rechargeConfirm() { |
||||
if (this.rechargeForm.valid) { |
||||
this.modalService.confirm({ |
||||
nzTitle: '充值提醒', |
||||
nzContent: '确认为【' + this.rechargeForm.controls['name'].value + '】连锁余额充值:' +this.rechargeForm.controls['amount'].value + '元吗?', |
||||
nzOnOk: () => this.submitRecharge() |
||||
}); |
||||
} else { |
||||
Object.values(this.rechargeForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 提交表单数据 |
||||
*/ |
||||
submitRecharge() { |
||||
let param = this.rechargeForm.value; |
||||
param['chainBrandId'] = this.rechargeForm.controls['id'].value; |
||||
this.merChainBrandAmountService.recharge(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeRechargeModal(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 关闭充值模态框 |
||||
*/ |
||||
closeRechargeModal() { |
||||
this.rechargeForm.reset(); |
||||
this.rechargeModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 打开动账记录模态框 |
||||
* @param merNo |
||||
*/ |
||||
showRecordModal(recordChainBrandId: number) { |
||||
if (this.recordChainBrandId != recordChainBrandId) { |
||||
this.recordChainBrandId = recordChainBrandId; |
||||
// 查询数据
|
||||
this.queryRecord(); |
||||
} |
||||
this.recordModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryRecord() { |
||||
const param = { |
||||
chainBrandId: this.recordChainBrandId, |
||||
pageNum: this.recordTablePageNum, |
||||
pageSize: this.recordTablePageSize, |
||||
time: this.tablePageSize, |
||||
}; |
||||
this.merChainBrandAmountService.getRecordList(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.recordData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,95 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>连锁名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="name" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
<button nz-button (click)="showChainBrandModel(null)" [nzType]="'primary'">新增连锁</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1200px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="150px">连锁名称</th> |
||||
<th nzWidth="120px">负责人名称</th> |
||||
<th nzWidth="100px">负责人电话</th> |
||||
<th nzWidth="100px">创建时间</th> |
||||
<th nzRight nzWidth="50px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.name}}</td> |
||||
<td>{{data.contactsName}}</td> |
||||
<td>{{data.contactsTelephone}}</td> |
||||
<td>{{data.createTime | date : "yyyy-MM-dd HH:mm"}}</td> |
||||
<td nzRight> |
||||
<a (click)="showChainBrandModel(data)">修改</a> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
|
||||
<nz-modal [(nzVisible)]="editChainBrandModel" |
||||
[nzWidth]="700" |
||||
nzTitle="{{this.editChainBrandForm.controls['id']==null?'新增':'修改'}}" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeChainBrandModel()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="editChainBrandForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>连锁名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="name" placeholder="请输入连锁名称"/> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>负责人名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="contactsName" placeholder="请输入负责人名称"/> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>负责人电话</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="contactsTelephone" placeholder="请输入负责人电话,用于登录账户"/> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitChainBrandModel()" class="submit-btn">保存</button> |
||||
</div> |
||||
|
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,197 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {MerChainBrandService} from "../../../services/merchant/mer-chain-brand.service"; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzModalModule} from "ng-zorro-antd/modal"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent, NzRangePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio"; |
||||
import {NzToolTipModule} from "ng-zorro-antd/tooltip"; |
||||
import {NzTabsModule} from "ng-zorro-antd/tabs"; |
||||
import {NzTagModule} from "ng-zorro-antd/tag"; |
||||
import {NzCardModule} from "ng-zorro-antd/card"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzQRCodeModule} from "ng-zorro-antd/qr-code"; |
||||
import {RouterLink} from "@angular/router"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
|
||||
@Component({ |
||||
selector: 'app-mer-chain-brand-list', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
], |
||||
templateUrl: './mer-chain-brand-list.component.html', |
||||
styleUrl: './mer-chain-brand-list.component.less' |
||||
}) |
||||
export class MerChainBrandListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 更多搜索条件
|
||||
isCollapse = false; |
||||
// 编辑品牌表单
|
||||
editChainBrandForm: FormGroup; |
||||
editChainBrandModel = false; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private merChainBrandService: MerChainBrandService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
name: [''], |
||||
contactsName: [''], |
||||
contactsTelephone: [''], |
||||
}); |
||||
|
||||
// 初始化表单
|
||||
this.editChainBrandForm = this.fb.group({ |
||||
id: [null], |
||||
name: [null, [Validators.required]], |
||||
contactsName: [null, [Validators.required]], |
||||
contactsTelephone: [null, [Validators.required]], |
||||
}); |
||||
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.merChainBrandService.getList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打开编辑连锁品牌模态框 |
||||
* @param data |
||||
*/ |
||||
showChainBrandModel(data: any) { |
||||
this.editChainBrandForm.patchValue(data); |
||||
this.editChainBrandModel = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交表单 |
||||
*/ |
||||
submitChainBrandModel() { |
||||
if (this.editChainBrandForm.valid) { |
||||
let param = this.editChainBrandForm.value; |
||||
this.merChainBrandService.editChainBrand(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeChainBrandModel(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.editChainBrandForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭编辑连锁品牌模态框 |
||||
*/ |
||||
closeChainBrandModel() { |
||||
this.editChainBrandForm.reset(); |
||||
this.editChainBrandModel = false; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,158 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1200px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="80px">油站编号</th> |
||||
<th nzWidth="100px">油站名称</th> |
||||
<th nzWidth="120px">油站地址</th> |
||||
<th nzWidth="100px">余额</th> |
||||
<th nzRight nzWidth="50px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.address}}</td> |
||||
<td>{{data.amount}} 元</td> |
||||
<td nzRight> |
||||
<a (click)="showRechargeModal(data)">充值</a> |
||||
<nz-divider nzType="vertical"></nz-divider> |
||||
<a nz-dropdown [nzDropdownMenu]="menu"> |
||||
更多 |
||||
<span nz-icon nzType="down"></span> |
||||
</a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li nz-menu-item (click)="showRecordModal(data.merNo)"><a >动账记录</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="rechargeModal" |
||||
[nzWidth]="500" |
||||
nzTitle="充值" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeRechargeModal()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="rechargeForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油站编号</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="merNo"/> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油站名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="merName"/> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>充值金额</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="amount" [nzMin]="1" [nzMax]="10" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'充值金额'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" class="submit-btn" (click)="rechargeConfirm()">确定</button> |
||||
</div> |
||||
|
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="recordModal" |
||||
[nzWidth]="1000" |
||||
nzTitle="动账记录" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="recordModal = !recordModal"> |
||||
<ng-container *nzModalContent> |
||||
<nz-table #recordTable |
||||
nzSize="middle" |
||||
[nzScroll]="{ x: '1000px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="recordTablePageNum" |
||||
(nzPageIndexChange)="queryRecord()" |
||||
[nzTotal]="recordData.total" |
||||
[nzData]="recordData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="90px">交易前金额</th> |
||||
<th nzWidth="80px">交易金额</th> |
||||
<th nzWidth="90px">交易后金额</th> |
||||
<th nzWidth="50px">交易类型</th> |
||||
<th nzWidth="100px">交易时间</th> |
||||
<th nzWidth="120px">交易来源</th> |
||||
<!-- <th nzRight nzWidth="50px">操作</th>--> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of recordTable.data"> |
||||
<td>{{data.beforeAmount}}</td> |
||||
<td>{{data.transactionAmount}}</td> |
||||
<td>{{data.afterAmount}}</td> |
||||
<td>{{data.type==1?'入账':'出账'}}</td> |
||||
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td>{{data.sourceType | dictionary: 'MER_ACCOUNT_RECORD_SOURCE_TYPE'}}</td> |
||||
<!-- <td nzRight> |
||||
<a >详情</a> |
||||
</td>--> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
@ -0,0 +1,6 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
@ -0,0 +1,247 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {MerChainBrandService} from "../../../services/merchant/mer-chain-brand.service"; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {MerchantAccountService} from "../../../services/merchant/merchant-account.service"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
|
||||
@Component({ |
||||
selector: 'app-merchant-amount-list', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule |
||||
], |
||||
templateUrl: './merchant-amount-list.component.html', |
||||
styleUrl: './merchant-amount-list.component.less' |
||||
}) |
||||
export class MerchantAmountListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 充值表单
|
||||
rechargeForm: FormGroup; |
||||
rechargeModal = false; |
||||
|
||||
// 记录模态框
|
||||
recordModal = false; |
||||
recordMerNo = ''; |
||||
// 表单页数
|
||||
recordTablePageNum = 1; |
||||
// 每页数量
|
||||
recordTablePageSize = 10; |
||||
recordData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private merchantAccountService: MerchantAccountService, |
||||
private modalService: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
merNo: [''], |
||||
merName: [''], |
||||
}); |
||||
|
||||
// 初始化搜索框
|
||||
this.rechargeForm = this.fb.group({ |
||||
merNo: [null, [Validators.required]], |
||||
merName: [null], |
||||
amount: [null, [Validators.required]], |
||||
}); |
||||
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.merchantAccountService.getMerList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打卡充值模态框 |
||||
* @param data |
||||
*/ |
||||
showRechargeModal(data: any) { |
||||
this.rechargeForm.patchValue(data); |
||||
this.rechargeForm.controls['amount'].setValue(0); |
||||
this.rechargeForm.controls['merName'].disable(); |
||||
this.rechargeForm.controls['merNo'].disable(); |
||||
this.rechargeModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 充值确认框 |
||||
*/ |
||||
rechargeConfirm() { |
||||
if (this.rechargeForm.valid) { |
||||
this.modalService.confirm({ |
||||
nzTitle: '充值提醒', |
||||
nzContent: '确认为【' + this.rechargeForm.controls['merName'].value + '】油站余额充值:' +this.rechargeForm.controls['amount'].value + '元吗?', |
||||
nzOnOk: () => this.submitRecharge() |
||||
}); |
||||
} else { |
||||
Object.values(this.rechargeForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 提交表单数据 |
||||
*/ |
||||
submitRecharge() { |
||||
let param = this.rechargeForm.value; |
||||
param['merNo'] = this.rechargeForm.controls['merNo'].value; |
||||
this.merchantAccountService.recharge(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeRechargeModal(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 关闭充值模态框 |
||||
*/ |
||||
closeRechargeModal() { |
||||
this.rechargeForm.reset(); |
||||
this.rechargeModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 打开动账记录模态框 |
||||
* @param merNo |
||||
*/ |
||||
showRecordModal(merNo: string) { |
||||
if (this.recordMerNo != merNo) { |
||||
this.recordMerNo = merNo; |
||||
// 查询数据
|
||||
this.queryRecord(); |
||||
} |
||||
this.recordModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryRecord() { |
||||
const param = { |
||||
merNo: this.recordMerNo, |
||||
pageNum: this.recordTablePageNum, |
||||
pageSize: this.recordTablePageSize, |
||||
time: this.tablePageSize, |
||||
}; |
||||
this.merchantAccountService.getRecordList(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.recordData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
@ -1,8 +1,22 @@ |
||||
import { Routes } from '@angular/router'; |
||||
import {MerAddComponent} from "./mer-add/mer-add.component"; |
||||
import {MerListComponent} from "./mer-list/mer-list.component"; |
||||
import {MerChainBrandListComponent} from "./mer-chain-brand-list/mer-chain-brand-list.component"; |
||||
import {MerchantAccountService} from "../../services/merchant/merchant-account.service"; |
||||
import {MerchantAmountListComponent} from "./merchant-amount-list/merchant-amount-list.component"; |
||||
import {MerChainBrandAmountService} from "../../services/merchant/mer-chain-brand-amount.service"; |
||||
import {MerChainBrandAmountComponent} from "./mer-chain-brand-amount/mer-chain-brand-amount.component"; |
||||
import {DeviceListComponent} from "../device/device-list/device-list.component"; |
||||
import {OilTaskComponent} from "../mer-oil-price/oil-task/oil-task.component"; |
||||
import {OilDiscountComponent} from "../mer-oil-price/oil-discount/oil-discount.component"; |
||||
|
||||
export const MERCHANT_ROUTES: Routes = [ |
||||
{ path: 'mer-list', component: MerListComponent }, |
||||
{ path: 'mer-add', component: MerAddComponent } |
||||
{ path: 'mer-edit', component: MerAddComponent }, |
||||
{ path: 'mer-chain-brand-list', component: MerChainBrandListComponent }, |
||||
{ path: 'mer-chain-brand-account', component: MerChainBrandAmountComponent }, |
||||
{ path: 'mer-account', component: MerchantAmountListComponent }, |
||||
{ path: 'device-list', component: DeviceListComponent }, |
||||
{ path: 'oil-task-list', component: OilTaskComponent }, |
||||
{ path: 'oil-discount-list', component: OilDiscountComponent }, |
||||
]; |
||||
|
@ -0,0 +1,73 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class DeviceService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 编辑设备 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editDevice(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'device/editDevice', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除设备 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public delDevice(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'device/delDevice', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询设备列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getDeviceList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'device/getDeviceList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询小票打印内容 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getSettingReceipt(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'device/getSettingReceipt?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 设置小票打印内容 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public settingReceipt(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'device/settingReceipt', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,48 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class OilDiscountService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 批量增加任务 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public batchAddTask(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'gasOilPriceTask/batchAddTask', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除任务 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public delTask(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'gasOilPriceTask/delTask', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询任务列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getTaskList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'gasOilPriceTask/getTaskList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,49 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class OilTaskService { |
||||
|
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 批量增加任务 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public batchAddTask(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'gasOilPriceTask/batchAddTask', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除任务 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public delTask(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'gasOilPriceTask/delTask', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询任务列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getTaskList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'gasOilPriceTask/getTaskList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,49 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class MerChainBrandAmountService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 充值 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public recharge(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'merchantChainBrandAccount/recharge', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询账户详情 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getAccount(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'merchantChainBrandAccount/getAccount?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询商户列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getRecordList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'merchantChainBrandAccount/getRecordList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,36 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class MerChainBrandService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 编辑连锁品牌 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editChainBrand(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'merchantChainBrand/editChainBrand', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询连锁品牌 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'merchantChainBrand/getList?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,63 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class MerchantAccountService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 充值 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public recharge(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'merchantAccount/recharge', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询商户账户列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getMerList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'merchantAccount/getMerList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 查询账户详情 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getAccount(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'merchantAccount/getAccount?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询商户列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getRecordList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'merchantAccount/getRecordList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
} |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue