提交代码

pull/1/head
胡锐 2 years ago
parent 0c31b1e012
commit e4fe6484dd
  1. 36
      src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.html
  2. 66
      src/app/admin/gas-class-group/gas-class-group-list/gas-class-group-list.component.ts
  3. 189
      src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.html
  4. 8
      src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.scss
  5. 375
      src/app/admin/gas-class-group/gas-class-group-task/gas-class-group-task.component.ts
  6. 3
      src/app/app-common.module.ts
  7. 17
      src/app/pipes/gas-class-group-task/gas-class-group-task-status.pipe.ts
  8. 1
      src/app/pipes/index.ts
  9. 26
      src/app/services/gas-class-group-task.service.ts

@ -1,8 +1,7 @@
<!--
&lt;!&ndash; start 面包屑 &ndash;&gt;
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
&lt;!&ndash; end 面包屑 &ndash;&gt;
&lt;!&ndash;条件搜索&ndash;&gt;
<!-- end 面包屑 -->
<!--条件搜索-->
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
@ -45,10 +44,10 @@
<div class="inner-content">
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
<button nz-button nzType="primary" class="right-btn" (click)="showEditClassGroup(null)"><i nz-icon nzType="plus" nzTheme="outline"></i>添加班组</button>
</div>
&lt;!&ndash;数组表格 &ndash;&gt;
<!--数组表格 -->
<nz-table #basicTable
[nzData]="dataObject.list"
[nzTotal]="dataObject.total"
@ -59,9 +58,9 @@
[nzScroll]="{ x: '1150px'}">
<thead>
<tr>
<th nzWidth="100px">序号</th>
<th nzWidth="80px">序号</th>
<th nzWidth="100px">班组名称</th>
<th nzWidth="150px">负责人名称</th>
<th nzWidth="100px">负责人名称</th>
<th nzWidth="100px">负责人电话</th>
<th nzWidth="120px">创建时间</th>
<th nzWidth="100px" nzRight="0px">操作</th>
@ -78,7 +77,7 @@
<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>
<li nz-menu-item><a (click)="showEditClassGroup(data)" >修改</a></li>
<li nz-menu-item><a (click)="showDeleteConfirm(data.id)">删除</a></li>
</ul>
</nz-dropdown-menu>
@ -88,29 +87,28 @@
</nz-table>
</div>
<nz-modal [(nzVisible)]="recycleAmountModal" nzTitle="油卡余额回收" (nzOnCancel)="closeRecycleAmountModal()" nzWidth="500px" [nzFooter]="null">
<form nz-form [formGroup]="recycleAmountForm">
<nz-modal [(nzVisible)]="classGroupModal" nzTitle="编辑班组" (nzOnCancel)="closeEditClassGroup()" nzWidth="500px" [nzFooter]="null">
<form nz-form [formGroup]="classGroupForm">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >卡号</nz-form-label>
<nz-form-label [nzSpan]="6" nzRequired >班组名称</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="cardNo" disabled />
<input nz-input formControlName="name" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >回收余额</nz-form-label>
<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>
<input nz-input formControlName="principalName" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >支付密码</nz-form-label>
<nz-form-label [nzSpan]="6" nzRequired >负责人电话</nz-form-label>
<nz-form-control [nzSpan]="14">
<input type="password" formControlName="twoPwd" nz-input placeholder="请输入支付密码" />
<input nz-input formControlName="principalPhone" />
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" [nzLoading]="recycleAmountBtnLoading" (click)="submitRecycleAmount()">确定</button>
<button nz-button nzType="primary" style="width: 150px;" (click)="submitEditClassGroup()">保存</button>
</div>
</form>
</nz-modal>
-->

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormGroup} from '@angular/forms';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {GasClassGroupService} from '../../../services/gas-class-group.service';
@ -16,6 +16,9 @@ export class GasClassGroupListComponent implements OnInit {
pageNum: number;
whereObject: any = {};
classGroupModal = false;
classGroupForm: FormGroup;
constructor(private modal: NzModalService,
private message: NzMessageService,
private gasClassGroupService: GasClassGroupService,
@ -27,6 +30,13 @@ export class GasClassGroupListComponent implements OnInit {
principalName: [null],
principalPhone: [null],
});
this.classGroupForm = this.form.group({
id: [null],
name: [null, [Validators.required]],
principalName: [null, [Validators.required]],
principalPhone: [null, [Validators.required]],
});
this.requestData(1);
}
@ -69,7 +79,7 @@ export class GasClassGroupListComponent implements OnInit {
showDeleteConfirm(groupId: number): void {
this.modal.confirm({
nzTitle: '警告',
nzContent: '是否删除该代理商',
nzContent: '是否删除班组',
nzOkText: '是',
nzCancelText: '否',
nzOkType: 'danger',
@ -94,4 +104,56 @@ export class GasClassGroupListComponent implements OnInit {
});
}
/**
*
*/
showEditClassGroup(data: object) {
if (data != null) {
this.classGroupForm.patchValue(data);
}
this.classGroupModal = true;
}
/**
*
*/
closeEditClassGroup() {
this.classGroupForm.reset();
this.classGroupModal = false;
}
/**
*
*/
submitEditClassGroup(){
for (const i in this.classGroupForm.controls) {
this.classGroupForm.controls[i].markAsDirty();
this.classGroupForm.controls[i].updateValueAndValidity();
}
if (this.classGroupForm.status == null || this.classGroupForm.status !== 'VALID') {
this.modal.warning({
nzTitle: '提示',
nzContent: '请填写所有必填项',
});
return;
}
// 提交数据
this.gasClassGroupService.editClassGroup(this.classGroupForm.value, data => {
if (data['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: '保存成功',
});
this.closeEditClassGroup();
this.requestData(this.whereObject['pageNum']);
} else {
this.modal.warning({
nzTitle: '提示',
nzContent: data['return_msg'],
});
}
});
}
}

@ -1 +1,188 @@
<p>gas-class-group-task works!</p>
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<!--<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="name" />
</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">
<nz-row [nzGutter]="16">
<nz-col [nzSpan]="4">
<nz-statistic [nzValue]="currentClassGroupCountData['classNum'] == null ? '' : currentClassGroupCountData['classNum'] + ' '" [nzTitle]="'当前班次'"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="4">
<nz-statistic [nzValue]="currentClassGroupCountData['refuelPrice']" [nzTitle]="'加油总金额'" [nzSuffix]="''"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="4">
<nz-statistic [nzValue]="currentClassGroupCountData['refuelNum']" [nzTitle]="'加油总笔数'" [nzSuffix]="''"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="4">
<nz-statistic [nzValue]="currentClassGroupCountData['refuelLiters']" [nzTitle]="'加油总升数'" [nzSuffix]="''"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="4">
<nz-statistic [nzValue]="currentClassGroupCountData['refundPrice']" [nzTitle]="'退款总金额'" [nzSuffix]="''"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="4">
<nz-statistic [nzValue]="currentClassGroupCountData['refundNum']" [nzTitle]="'退款总笔数'" [nzSuffix]="''"></nz-statistic>
</nz-col>
</nz-row>
<div class="gas-count-btn">
<button nz-button nzType="primary" *ngIf="currentClassGroupCountData.status == 0" (click)="showStartClassGroupModal()"><i nz-icon nzType="sync" nzTheme="outline"></i>开启班次</button>
<button nz-button nzType="primary" *ngIf="currentClassGroupCountData.status == 1" (click)="getCurrentClassGroupCountData()"><i nz-icon nzType="sync" nzTheme="outline"></i>刷新数据</button>
<button nz-button nzType="primary" *ngIf="currentClassGroupCountData.status == 1" (click)="showSwapClassGroupModal()"><i nz-icon nzType="swap" nzTheme="outline"></i>交接班组</button>
<button nz-button nzType="primary" *ngIf="currentClassGroupCountData.status == 1" (click)="showEndClassGroupConfirm()"><i nz-icon nzType="poweroff" nzTheme="outline"></i>结束班次</button>
</div>
<nz-divider></nz-divider>
<span>历史班次,共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
<div class="operating-button">
<!-- <button nz-button nzType="primary" class="right-btn" (click)="showEditClassGroup(null)"><i nz-icon nzType="plus" 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: '1150px'}">
<thead>
<tr>
<th nzWidth="80px">班次</th>
<th nzWidth="100px">班组名称</th>
<th nzWidth="100px">开始时间</th>
<th nzWidth="100px">结束时间</th>
<th nzWidth="100px">状态</th>
<th nzWidth="100px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data;let i = index">
<td>{{data.classNum + ' 班'}}</td>
<td>{{data.gasClassGroupName}}</td>
<td>{{data.startTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td>
<span *ngIf="data.endTime != null">{{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}}</span>
<span *ngIf="data.endTime == null">未结束</span>
</td>
<td>{{data.status | gasClassGroupTaskStatus}}</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 nzDisabled *ngIf="data.status == 1">暂无操作</li>
<li nz-menu-item *ngIf="data.status == 2"><a (click)="showClassGroupTaskDataModal(data)">查看汇总</a></li>
</ul>
</nz-dropdown-menu>
</td>
</tr>
</tbody>
</nz-table>
</div>
<nz-modal [(nzVisible)]="classGroupCountDataModal" nzTitle="班次汇总" (nzOnCancel)="closeClassGroupTaskDataModal()" nzWidth="350px" [nzFooter]="null">
<nz-descriptions [nzColumn]="{ xxl: 1, xl: 1, lg: 1, md: 1, sm: 1, xs: 1 }">
<nz-descriptions-item nzTitle="开始时间">{{classGroupCountData['startTime'] | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="结束时间">{{classGroupCountData['endTime'] | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="加油金额汇总">{{classGroupCountData['refuelPrice']}} 元</nz-descriptions-item>
<nz-descriptions-item nzTitle="加油笔数汇总">{{classGroupCountData['refuelNum']}} 笔</nz-descriptions-item>
<nz-descriptions-item nzTitle="加油升数汇总">{{classGroupCountData['refuelLiters']}} 升</nz-descriptions-item>
<nz-descriptions-item nzTitle="退款金额汇总">{{classGroupCountData['refundPrice']}} 元</nz-descriptions-item>
<nz-descriptions-item nzTitle="退款笔数汇总">{{classGroupCountData['refundNum']}} 笔</nz-descriptions-item>
<nz-descriptions-item nzTitle="退款升数汇总">{{classGroupCountData['refundLiters']}} 升</nz-descriptions-item>
</nz-descriptions>
<nz-table #oilCountTable [nzData]="classGroupCountData['groupTaskOilCountList']" [nzShowPagination]="false">
<thead>
<tr>
<th>油号</th>
<th>金额</th>
<th>升数</th>
<th>笔数</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of oilCountTable.data">
<td>{{ item.oilNo }}#</td>
<td>{{ item.refuelPrice }}元</td>
<td>{{ item.refuelLiters }}升</td>
<td>{{ item.refuelNum }}笔</td>
</tr>
</tbody>
</nz-table>
<div style="width: 100%;text-align: center;margin-top: 10px;">
<button nz-button nzType="primary" (click)="showPrintModal(classGroupCountData)">打印小票</button>
</div>
</nz-modal>
<nz-modal [(nzVisible)]="printModal" nzTitle="选择打印方式" nzWidth="350" (nzOnCancel)="printModal = false" [nzFooter]="null">
<form nz-form>
<nz-form-item>
<nz-form-control>
<button nz-button nzType="primary" nzBlock (click)="showPrintDiv()">热敏打印机</button>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<button nz-button nzType="primary" nzBlock (click)="cloudPrint()">云打印机</button>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>
<nz-modal [(nzVisible)]="startClassGroupModal" nzTitle="开启班次" (nzOnCancel)="closeStartClassGroupModal()" nzWidth="500px" [nzFooter]="null">
<form nz-form [formGroup]="startClassGroupModalForm">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>班组</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select ngModel="lucy" [nzPlaceHolder]="'请选择班组'" formControlName="gasClassGroupId">
<nz-option *ngFor="let item of classGroupArray" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitStartClassGroup()">开启</button>
</div>
</form>
</nz-modal>
<nz-modal [(nzVisible)]="swapClassGroupModal" nzTitle="交换班次" (nzOnCancel)="closeSwapClassGroupModal()" nzWidth="500px" [nzFooter]="null">
<form nz-form [formGroup]="swapClassGroupModalForm">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>班组</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select ngModel="lucy" [nzPlaceHolder]="'请选择班组'" formControlName="gasClassGroupId">
<nz-option *ngFor="let item of classGroupArray" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitSwapClassGroupConfirm()">交换</button>
</div>
</form>
</nz-modal>

@ -0,0 +1,8 @@
.gas-count-btn {
text-align: center;
margin-top: 15px;
}
.gas-count-btn button {
margin-bottom: 15px;
margin-left: 10px;
}

@ -1,4 +1,10 @@
import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {GasClassGroupService} from '../../../services/gas-class-group.service';
import {GasClassGroupTaskService} from '../../../services/gas-class-group-task.service';
import {LocalStorageService} from '../../../services/local-storage.service';
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
@Component({
selector: 'app-gas-class-group-task',
@ -6,10 +12,377 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./gas-class-group-task.component.scss']
})
export class GasClassGroupTaskComponent implements OnInit {
userInfoObject: object;
constructor() { }
dataObject: any = {};
tableLoading = true;
searchForm: FormGroup;
pageNum: number;
whereObject: any = {};
classGroupArray = [];
startClassGroupModal = false;
startClassGroupModalForm: FormGroup;
swapClassGroupModal = false;
swapClassGroupModalForm: FormGroup;
currentClassGroupCountData = {
classNum: '无',
refuelPrice: '0',
refuelNum: '0',
refuelLiters: '0',
refundPrice: '0',
refundNum: '0',
status: null,
};
classGroupCountDataModal = false;
classGroupCountData = {};
printModal = false;
printData = {};
printTaskId: number;
constructor(private modal: NzModalService,
private localStorageService: LocalStorageService, // 数据缓存
private message: NzMessageService,
private gasClassGroupService: GasClassGroupService,
private gasClassGroupTaskService: GasClassGroupTaskService,
private form: FormBuilder) {
this.userInfoObject = this.localStorageService.get(ADMIN_INFO_OBJECT);
}
ngOnInit(): void {
this.searchForm = this.form.group({
name: [null],
principalName: [null],
principalPhone: [null],
});
this.startClassGroupModalForm = this.form.group({
gasId: [null],
gasClassGroupId: [null, [Validators.required]],
});
this.swapClassGroupModalForm = this.form.group({
gasId: [null],
gasClassGroupId: [null, [Validators.required]],
});
this.gasClassGroupService.getClassGroupList({pageNum: 1, pageSize: 9999}, data => {
if (data['return_code'] === '000000') {
this.classGroupArray = data['return_data']['list'];
}
});
this.getCurrentClassGroupCountData();
this.requestData(1);
}
/**
*
*/
requestData(pageNum) {
this.tableLoading = true;
this.whereObject['pageNum'] = pageNum;
this.whereObject['pageSize'] = 10;
this.gasClassGroupTaskService.getClassGroupTaskList(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;
this.requestData(1);
}
/**
*
*/
resetForm(): void {
this.searchForm.reset();
}
/**
*
*/
getCurrentClassGroupCountData() {
this.gasClassGroupTaskService.getCurrentClassGroupTask(this.userInfoObject['merchantStore']['id'], data => {
if (data['return_code'] === '000000') {
this.currentClassGroupCountData = data['return_data'];
} else {
this.modal.warning({
nzTitle: '提示',
nzContent: data['return_msg'],
});
}
});
}
/**
*
*/
showStartClassGroupModal() {
this.startClassGroupModal = true;
}
/**
*
*/
closeStartClassGroupModal() {
this.startClassGroupModalForm.reset();
this.startClassGroupModal = false;
}
/**
*
*/
submitStartClassGroup(){
for (const i in this.startClassGroupModalForm.controls) {
this.startClassGroupModalForm.controls[i].markAsDirty();
this.startClassGroupModalForm.controls[i].updateValueAndValidity();
}
if (this.startClassGroupModalForm.status == null || this.startClassGroupModalForm.status !== 'VALID') {
this.modal.warning({
nzTitle: '提示',
nzContent: '请填写所有必填项',
});
return;
}
this.startClassGroupModalForm.value.gasId = this.userInfoObject['merchantStore']['id'];
// 提交数据
this.gasClassGroupTaskService.startGroupTask(this.startClassGroupModalForm.value, data => {
if (data['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: '操作成功',
});
this.getCurrentClassGroupCountData();
this.requestData(this.whereObject['pageNum']);
this.closeStartClassGroupModal();
} else {
this.modal.warning({
nzTitle: '提示',
nzContent: data['return_msg'],
});
}
});
}
/**
*
*/
showSwapClassGroupModal() {
this.swapClassGroupModal = true;
}
/**
*
*/
closeSwapClassGroupModal() {
this.swapClassGroupModalForm.reset();
this.swapClassGroupModal = false;
}
/**
*
*/
submitSwapClassGroupConfirm() {
this.modal.confirm({
nzTitle: '警告',
nzContent: '确定交换班次吗?',
nzOkText: '是',
nzCancelText: '否',
nzOkType: 'danger',
nzOnOk: () => this.submitSwapClassGroup()
});
}
/**
*
*/
submitSwapClassGroup() {
for (const i in this.swapClassGroupModalForm.controls) {
this.swapClassGroupModalForm.controls[i].markAsDirty();
this.swapClassGroupModalForm.controls[i].updateValueAndValidity();
}
if (this.swapClassGroupModalForm.status == null || this.swapClassGroupModalForm.status !== 'VALID') {
this.modal.warning({
nzTitle: '提示',
nzContent: '请填写所有必填项',
});
return;
}
this.swapClassGroupModalForm.value.gasId = this.userInfoObject['merchantStore']['id'];
// 提交数据
this.gasClassGroupTaskService.swapGroupTask(this.swapClassGroupModalForm.value, data => {
if (data['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: '操作成功',
});
this.getCurrentClassGroupCountData();
this.requestData(this.whereObject['pageNum']);
this.closeSwapClassGroupModal();
} else {
this.modal.warning({
nzTitle: '提示',
nzContent: data['return_msg'],
});
}
});
}
/**
*
*/
showEndClassGroupConfirm(): void {
this.modal.confirm({
nzTitle: '警告',
nzContent: '确定结束本次班次吗?',
nzOkText: '是',
nzCancelText: '否',
nzOkType: 'danger',
nzOnOk: () => this.endClassGroupData()
});
}
/**
*
*
*/
endClassGroupData() {
this.gasClassGroupTaskService.endGroupTask( { gasId: this.userInfoObject['merchantStore']['id'] }, data => {
if (data['return_code'] === '000000') {
this.requestData(this.whereObject['pageNum']);
this.getCurrentClassGroupCountData();
} else {
this.modal.error({
nzTitle: '提示',
nzContent: data['return_msg']
});
}
});
}
/**
*
*/
showClassGroupTaskDataModal(data: object) {
this.classGroupCountData = JSON.parse(data['dataCount']);
this.printTaskId = data['id'];
this.classGroupCountDataModal = true;
}
/**
*
*/
closeClassGroupTaskDataModal() {
this.classGroupCountDataModal = false;
}
/**
*
* @param data
*/
showPrintModal(data: object) {
this.printData = data;
this.printModal = true;
}
/**
*
*/
cloudPrint() {
this.gasClassGroupTaskService.print(this.printTaskId, dataBack => {
if (dataBack['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: '操作成功',
});
}
});
}
/**
*
*/
showPrintDiv() {
this.printDiv(this.printData);
}
printDiv(data: object) {
const headstr = '<html><head><title>打印小票</title></head><body>';
const footstr = '</body>';
let newstr = '<div id="div_print" style="font-size: 16px;">\n' +
' <div style="float: left;margin-bottom: 50px;">\n' +
' <div style="line-height: 30px; color:#000;">\n' +
' <span style="font-size: 13px;float: left;width: 100%;margin-left: 90px;">'+data['classNum']+'班结流水</span>\n' +
' </div>\n' +
' <table style="width: 100%;">\n' +
' <tbody>\n' +
' <tr><td style="font-size: xx-small;color: black;">===========================================</td></tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">开始时间:<span>' + new Date(data['startTime']).toLocaleString() + '</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">结束时间:<span>' + new Date(data['endTime']).toLocaleString() + '</span></td>\n' +
' </tr>\n' +
' <tr><td style="font-size: xx-small;color: black;"></td></tr>' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">加油金额汇总:<span>' + data['refuelPrice'] + '元</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">加油笔数汇总:<span>' + data['refuelNum'] + '笔</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">加油升数汇总:<span>' + data['refuelLiters'] + '升</span></td>\n' +
' </tr><br/>\n' +
' <tr><td style="font-size: xx-small;color: black;"></td></tr>' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">退款金额汇总:<span>' + data['refundPrice'] + '元</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">退款笔数汇总:<span>' + data['refundNum'] + '笔</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">退款升数汇总:<span>' + data['refundLiters'] + '升</span></td>\n' +
' </tr>\n' +
' <tr><td style="font-size: xx-small;color: black;"></td></tr>' +
' <tr><td style="font-size: xx-small;color: black;">---------------------收款-------------------</td></tr>\n' +
' <tr><td style="font-size: xx-small;color: black;">油号&ensp; &ensp; &ensp; &ensp; 金额&ensp; &ensp; &ensp; &ensp; 升数&ensp; &ensp; &ensp; &ensp; 笔数</td></tr>\n';
for (let item of data['groupTaskOilCountList']) {
newstr += '<tr><td style="font-size: xx-small;color: black;">' + item['oilNo'] +'#&ensp; &ensp; &ensp; &ensp;'+ item['refuelPrice'] +'元&ensp; &ensp; &ensp; &ensp;'+ item['refuelLiters'] +'升&ensp; &ensp; &ensp; &ensp;'+ item['refuelNum'] +'笔</td></tr>\n';
}
newstr += '<tr><td style="font-size: xx-small;color: black;">===========================================</td></tr>\n' +
' <tr><td style="float: left;font-size: xx-small;color: black;margin-left: 80px;">' + new Date().toLocaleString() +'</td></tr>\n' +
' </tbody>\n' +
' </table>\n' +
' </div>\n' +
'</div>';
const newWindow = window.open('', '');
newWindow.document.write(headstr + newstr + footstr);
newWindow.print();
newWindow.close();
return false;
}
}

@ -48,7 +48,7 @@ import {
GasStaffStatusPipe,
PayStatusPipe,
ChlidRechargeStatusPipe,
SourceTypePipe
SourceTypePipe, GasClassGroupTaskStatusPipe
} from './pipes';
import {OilCardStatusPipe} from './pipes';
import {OilTypePipe} from './pipes/store/oil-type.pipe';
@ -102,6 +102,7 @@ const PIPES = [
PayStatusPipe,
ChlidRechargeStatusPipe,
SourceTypePipe,
GasClassGroupTaskStatusPipe,
];

@ -0,0 +1,17 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'gasClassGroupTaskStatus'
})
export class GasClassGroupTaskStatusPipe implements PipeTransform {
transform(value: number): string {
switch (value) {
case 1:
return '进行中';
case 2:
return '已结束';
}
}
}

@ -38,3 +38,4 @@ export * from './recharge-price/price-status.pipe';
export * from './pay-status.pipe';
export * from './chlid-recharge-status.pipe';
export * from './apiMerchant/source-type.pipe';
export * from './gas-class-group-task/gas-class-group-task-status.pipe';

@ -61,6 +61,18 @@ export class GasClassGroupTaskService {
});
}
/**
*
*
* @param param
* @param callBack
*/
public getCurrentClassGroupTask(gasId: number, callBack) {
this.http.get(environment.baseUrl + 'gasClassGroupTask/getCurrentClassGroupTask?gasId=' + gasId).subscribe(data => {
callBack(data);
});
}
/**
*
*
@ -68,7 +80,19 @@ export class GasClassGroupTaskService {
* @param callBack
*/
public getClassGroupTaskList(param: object, callBack) {
this.http.get(environment.baseUrl + 'gasClassGroupTask/getClassGroupTaskList' + this.common.getWhereCondition(param)).subscribe(data => {
this.http.get(environment.baseUrl + 'gasClassGroupTask/getClassGroupTaskList?' + this.common.getWhereCondition(param)).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param param
* @param callBack
*/
public print(gasClassGroupTaskId: number, callBack) {
this.http.get(environment.baseUrl + 'gasClassGroupTask/print?gasClassGroupTaskId=' + gasClassGroupTaskId).subscribe(data => {
callBack(data);
});
}

Loading…
Cancel
Save