提交代码

master
胡锐 3 months ago
parent 6e2f6ea724
commit dc7a00a059
  1. 113
      src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.html
  2. 12
      src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.less
  3. 252
      src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.ts
  4. 2
      src/app/pages/trade/order-oil-list/order-oil-list.component.ts
  5. 2
      src/app/pages/trade/trade.routes.ts
  6. 48
      src/app/services/trade-receipt/gas-order-receipt.service.ts

@ -0,0 +1,113 @@
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="24">
<nz-form-item>
<nz-form-label>申请时间</nz-form-label>
<nz-form-control>
<nz-range-picker formControlName="createTimeArray" nzShowTime [nzAllowClear]="false" [nzFormat]="'yyyy/MM/dd HH:mm:ss'"></nz-range-picker>
<nz-radio-group nzButtonStyle="solid" formControlName="createTimeSelect" (ngModelChange)="createTimeInit()">
<label nz-radio-button *ngFor="let item of dateTypeSelect" nzValue="{{item.value}}">{{item.name}}</label>
</nz-radio-group>
</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 statusArray" 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="orderNo" 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="contactsPhone" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="24" class="search-area">
<button nz-button [nzType]="'primary'" (click)="searchFormSubmit()">查询</button>
<button nz-button (click)="searchFormReset()">重置</button>
</div>
</div>
</form>
<nz-table #basicTable
[nzScroll]="{ x: '2000px'}"
[nzBordered]="true"
[nzFrontPagination]="false"
[nzShowQuickJumper]="true"
[nzShowTotal]="totalTemplate"
[(nzPageIndex)]="tablePageNum"
(nzPageIndexChange)="queryData()"
[nzTotal]="tableData.total"
[nzData]="tableData.list" >
<thead>
<tr>
<th>交易单号</th>
<th>开票公司</th>
<th>开票税号</th>
<th>开票金额</th>
<th>联系电话</th>
<th>邮箱</th>
<th>申请时间</th>
<th>开票状态</th>
<th nzWidth="110px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data;let i = index" [style]="{ color: data.color}">
<td>{{data.orderNo}}</td>
<td>{{data.companyName}}</td>
<td>{{data.taxNo}}</td>
<td>{{data.amount}}</td>
<td>{{data.contactsPhone}}</td>
<td>{{data.email}}</td>
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td>{{data.status | dictionary: 'GAS_ORDER_RECEIPT_STATUS_MANAGE'}}</td>
<td nzRight="0px" class="table-td-operation">
<a *ngIf="data.status == 1" (click)="showSuccess(data.applyNo, data.orderNo)">成功</a>
<nz-divider *ngIf="data.status == 1" nzType="vertical"></nz-divider>
<a *ngIf="data.status == 1" (click)="showFail(data.applyNo, data.orderNo)">失败</a>
<span *ngIf="data.status != 1" nz-typography></span>
</tr>
</tbody>
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template>
</nz-table>
<nz-modal [(nzVisible)]="failModel" nzTitle="开票失败备注" (nzOnCancel)="failModel = false" [nzFooter]="null" nzWidth="800px">
<ng-container *nzModalContent>
<nz-spin [nzSpinning]="loadingObject.status" [nzTip]="loadingObject.title">
<form nz-form [formGroup]="failForm">
<nz-form-item>
<nz-form-label>交易单号</nz-form-label>
<nz-form-control>
<input nz-input formControlName="orderNo" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label nzRequired>备注</nz-form-label>
<nz-form-control>
<textarea rows="4" nz-input formControlName="remark" maxlength="50"></textarea>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button [nzType]="'primary'" (click)="submitRefundConfirm()">提交</button>
</div>
</form>
</nz-spin>
</ng-container>
</nz-modal>

@ -0,0 +1,12 @@
.search-area {
margin-bottom: 10px;
}
.search-area button {
margin-right: 8px;
}
.submit-btn {
width: 150px;
}
.collapse {
margin-left: 10px;
}

@ -0,0 +1,252 @@
import { Component } from '@angular/core';
import {FormGroup, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms";
import {DateSelectType, DateUtils} from "../../../utils/dateUtils.service";
import {BrowserStorageService} from "../../../utils/localStorage.service";
import {NzMessageService} from "ng-zorro-antd/message";
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal";
import {GasOrderReceiptService} from "../../../services/trade-receipt/gas-order-receipt.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,
NzTbodyComponent, NzTheadComponent,
NzThMeasureDirective, NzTrDirective
} from "ng-zorro-antd/table";
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid";
import {NzDatePickerComponent, NzRangePickerComponent} from "ng-zorro-antd/date-picker";
import {NzDescriptionsComponent, NzDescriptionsItemComponent} from "ng-zorro-antd/descriptions";
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
import {NzInputDirective} from "ng-zorro-antd/input";
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select";
import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio";
import {NzTabComponent, NzTabSetComponent} from "ng-zorro-antd/tabs";
import {NzDropDownDirective, NzDropdownMenuComponent, NzDropDownModule} from "ng-zorro-antd/dropdown";
import {NzIconModule} from "ng-zorro-antd/icon";
import {NzCardModule} from "ng-zorro-antd/card";
import {NzSpinComponent} from "ng-zorro-antd/spin";
import {NzTimelineComponent, NzTimelineItemComponent} from "ng-zorro-antd/timeline";
import {NzBadgeComponent} from "ng-zorro-antd/badge";
import {NzTooltipDirective} from "ng-zorro-antd/tooltip";
import {DateMinutesDiffPipe} from "../../../pipes/common/date-minutes-diff.pipe";
import {NzDividerComponent} from "ng-zorro-antd/divider";
import {NzTypographyComponent} from "ng-zorro-antd/typography";
@Component({
selector: 'app-gas-order-receipt',
standalone: true,
imports: [
DatePipe,
DictionaryPipe,
NgForOf,
NgIf,
NzButtonComponent,
NzCellFixedDirective,
NzColDirective,
NzDatePickerComponent,
NzDescriptionsComponent,
NzDescriptionsItemComponent,
NzFormControlComponent,
NzFormDirective,
NzFormItemComponent,
NzFormLabelComponent,
NzInputDirective,
NzModalComponent,
NzOptionComponent,
NzRadioButtonDirective,
NzRadioComponent,
NzRadioGroupComponent,
NzRangePickerComponent,
NzRowDirective,
NzSelectComponent,
NzTabComponent,
NzTabSetComponent,
NzTableCellDirective,
NzTableComponent,
NzTbodyComponent,
NzThMeasureDirective,
NzTheadComponent,
NzTrDirective,
ReactiveFormsModule,
NzModalModule,
NzDropdownMenuComponent,
NzDropDownDirective,
NzDropDownModule,
NzIconModule,
NzCardModule,
NzSpinComponent,
NzTimelineItemComponent,
NzTimelineComponent,
NzBadgeComponent,
NzTooltipDirective,
DateMinutesDiffPipe,
NzDividerComponent,
NzTypographyComponent
],
templateUrl: './gas-order-receipt.component.html',
styleUrl: './gas-order-receipt.component.less'
})
export class GasOrderReceiptComponent {
loadingObject = {
title: "加载中...",
status: false,
};
// 表单页数
tablePageNum = 1;
// 表单数据
tableData: any = {
total: 0,
list: [],
};
// 搜索表单
searchForm: FormGroup;
// 状态数据
statusArray = new DictionaryPipe().getDictionaryList('GAS_ORDER_RECEIPT_STATUS_MANAGE');
// 时间类型选择
dateTypeSelect = DateSelectType;
// 失败模态框
failForm: FormGroup;
failModel = false;
constructor(private fb: NonNullableFormBuilder,
private gasOrderReceiptService : GasOrderReceiptService,
private storage: BrowserStorageService,
private message: NzMessageService,
private modal: NzModalService) {
// 初始化搜索框
this.failForm = this.fb.group({
applyNo: [{ value: null, disabled: true} ,[Validators.required]],
orderNo: [{ value: null, disabled: true} ,[Validators.required]],
remark: ['',[Validators.required]],
});
// 初始化搜索框
this.searchForm = this.fb.group({
orderNo: [''],
contactsPhone: [''],
status: [''],
createTimeArray: [[]],
createTimeSelect: ['1'],
createTimeS: [''],
createTimeE: [''],
});
// 初始化创建时间
this.createTimeInit();
// 查询数据
this.queryData();
}
/**
*
*/
queryData() {
if (this.searchForm.controls['createTimeArray'].value != null
&& this.searchForm.controls['createTimeArray'].value.length > 0) {
this.searchForm.controls['createTimeS'].setValue(new Date(this.searchForm.controls['createTimeArray'].value[0]).getTime());
this.searchForm.controls['createTimeE'].setValue(new Date(this.searchForm.controls['createTimeArray'].value[1]).getTime());
} else {
this.searchForm.controls['createTimeS'].setValue(null);
this.searchForm.controls['createTimeE'].setValue(null);
}
this.searchForm.value.pageNum = this.tablePageNum;
this.searchForm.value.pageSize = 10;
this.searchForm.value.time = new Date().getTime();
// 查询列表
this.gasOrderReceiptService.queryList(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();
}
/**
*
*/
createTimeInit() {
let createTimeSelect = this.searchForm.controls['createTimeSelect'].value;
if (createTimeSelect != null) {
let timeObj = DateUtils.getDate(new Date(), Number(createTimeSelect));
this.searchForm.controls['createTimeArray'].setValue([timeObj.timeS, timeObj.timeE]);
}
}
/**
*
* @param orderNo
*/
showSuccess(applyNo: string, orderNo: string) {
this.modal.confirm({
nzTitle: '提示',
nzContent: '交易单号:' + orderNo + ',是否已开票成功?',
nzOnOk: () => this.success(applyNo)
});
}
success(applyNo: string) {
this.gasOrderReceiptService.success({applyNo: applyNo}, (data: any) => {
if (data['return_code'] == '000000') {
this.message.success("操作成功");
this.queryData();
} else {
this.message.create('error', data['return_msg']);
}
});
}
showFail(applyNo: string, orderNo: string) {
this.failForm.patchValue({ applyNo: applyNo, orderNo: orderNo});
this.failModel = true;
}
submitRefundConfirm() {
for (const i in this.failForm.controls) {
this.failForm.controls[i].markAsDirty();
this.failForm.controls[i].updateValueAndValidity();
}
if (this.failForm.status == null || this.failForm.status !== 'VALID') {
this.modal.warning({
nzTitle: '提示',
nzContent: '请填写所有必填项',
});
return;
}
this.modal.confirm({
nzTitle: '提示',
nzContent: '确定对交易订号('+this.failForm.controls['orderNo'].value+')进行退款吗?',
nzOnOk: () => this.submitFail()
});
}
submitFail() {
const param = {
applyNo: this.failForm.controls['applyNo'].value,
orderNo: this.failForm.controls['orderNo'].value,
remark: this.failForm.controls['remark'].value,
};
this.gasOrderReceiptService.fail(param, (data: any) => {
if (data['return_code'] == '000000') {
this.message.success("操作成功");
this.queryData();
this.failModel = false;
} else {
this.message.create('error', data['return_msg']);
}
});
}
}

@ -426,6 +426,4 @@ export class OrderOilListComponent {
}
})
}
protected readonly Date = Date;
}

@ -1,8 +1,10 @@
import { Routes } from '@angular/router';
import {OrderRefundComponent} from "./order-refund/order-refund.component";
import {OrderOilListComponent} from "./order-oil-list/order-oil-list.component";
import {GasOrderReceiptComponent} from "./gas-order-receipt/gas-order-receipt.component";
export const TRADE_ROUTES: Routes = [
{ path: 'order-refund', component: OrderRefundComponent },
{ path: 'order-oil', component: OrderOilListComponent },
{ path: 'gas-order', component: GasOrderReceiptComponent },
];

@ -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 GasOrderReceiptService {
constructor(private http: HttpClient) { }
/**
*
* @param param
* @param callBack
*/
public queryList(param: any, callBack:any) {
param.tm = new Date().getTime();
this.http.get(environment.baseUrl + 'gasOrderReceipt/queryReceiptList?'+ObjectData.objectByString(param)).subscribe(data => {
callBack(data);
});
}
/**
*
* @param param
* @param callBack
*/
public success(param: any, callBack:any) {
param.tm = new Date().getTime();
this.http.post(environment.baseUrl + 'gasOrderReceipt/success', param).subscribe(data => {
callBack(data);
});
}
/**
*
* @param param
* @param callBack
*/
public fail(param: any, callBack:any) {
param.tm = new Date().getTime();
this.http.post(environment.baseUrl + 'gasOrderReceipt/fail', param).subscribe(data => {
callBack(data);
});
}
}
Loading…
Cancel
Save