From 68709fbb7577c2ccb723a94e7d7cb855599966b5 Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Mon, 21 Jul 2025 15:02:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=BA=95=E9=98=BF=E5=AA=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gas-order-receipt.component.html | 53 ++++++++- .../gas-order-receipt.component.ts | 109 +++++++++++++++++- .../order-oil-list.component.ts | 6 +- .../gas-order-receipt.service.ts | 12 ++ 4 files changed, 172 insertions(+), 8 deletions(-) diff --git a/src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.html b/src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.html index 77a6e34..3ec8459 100644 --- a/src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.html +++ b/src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.html @@ -1,4 +1,5 @@ -
+ +
@@ -48,7 +49,8 @@
- + +
@@ -99,7 +101,7 @@ 总计 {{ total }} 条 - + @@ -124,3 +126,48 @@ + + + + + + + + 序号 + 申请单号 + 原因 + + + + + {{ i + 1}} + {{data.applyNo}} + {{data.errorMessage}} + + + + + + + + +
+ + 文件 + + + + + + +
+ +
+
+
+
diff --git a/src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.ts b/src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.ts index a142fa8..3581bb2 100644 --- a/src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.ts +++ b/src/app/pages/trade/gas-order-receipt/gas-order-receipt.component.ts @@ -34,6 +34,7 @@ import {DateMinutesDiffPipe} from "../../../pipes/common/date-minutes-diff.pipe" import {NzDividerComponent} from "ng-zorro-antd/divider"; import {NzTypographyComponent} from "ng-zorro-antd/typography"; import {environment} from "../../../../environments/environment"; +import {NzUploadModule} from "ng-zorro-antd/upload"; @Component({ selector: 'app-gas-order-receipt', @@ -84,15 +85,18 @@ import {environment} from "../../../../environments/environment"; NzTooltipDirective, DateMinutesDiffPipe, NzDividerComponent, - NzTypographyComponent + NzTypographyComponent, + NzUploadModule ], templateUrl: './gas-order-receipt.component.html', styleUrl: './gas-order-receipt.component.less' }) export class GasOrderReceiptComponent { imageUrl = environment.imageUrl; - loadingObject = { - title: "加载中...", + baseUrl = environment.baseUrl; + + loadingObject: any = { + title: "处理中...", status: false, }; // 表单页数 @@ -112,6 +116,12 @@ export class GasOrderReceiptComponent { failForm: FormGroup; failModel = false; + + importErrorModal = false; + importErrorData: any = []; + + importFleUrlForm: FormGroup; + importModal = false; constructor(private fb: NonNullableFormBuilder, private gasOrderReceiptService : GasOrderReceiptService, private storage: BrowserStorageService, @@ -124,6 +134,10 @@ export class GasOrderReceiptComponent { remark: ['',[Validators.required]], }); + this.importFleUrlForm = this.fb.group({ + fileUrl: [''], + }); + // 初始化搜索框 this.searchForm = this.fb.group({ orderNo: [''], @@ -262,5 +276,94 @@ export class GasOrderReceiptComponent { }); } + /** + * 打开导入模态框 + */ + showImport() { + this.importModal = true; + } + /** + * 提交导入设备 + */ + submitImport() { + this.loadingObject.spinning = true; + this.loadingObject.msg = '导入中...'; + if (this.importFleUrlForm.controls['fileUrl'].value == null) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请上传文件', + }); + this.loadingObject.spinning = false; + return; + } + + this.gasOrderReceiptService.importComplete(this.importFleUrlForm.value, (data: any) => { + this.loadingObject.spinning = false; + if (data['return_code'] === '000000') { + if (data['return_data'].length === 0) { + this.modal.success({ + nzTitle: '提示', + nzContent: '成功', + nzOnOk: () => this.queryData() + }); + } else { + this.modal.warning({ + nzTitle: '提示', + nzOkText: '导入失败数据', + nzContent: '只有部分数据导入成功', + nzOnOk: () => this.showImportErrorModal(data['return_data']) + }); + } + } else { + this.importModal = true; + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + /** + * 打开导入错误数据模态框 + * @param data + */ + showImportErrorModal(data:any) { + this.importErrorData = data; + this.importErrorModal = true; + } + /** + * 导入设备回调 + * @param fileInfo + */ + importDeviceChange(fileInfo: any) { + if (fileInfo.file.status !== 'uploading') { + + } + if (fileInfo.file.status === 'done') { + this.loadingObject.spinning = false; + if (fileInfo.file.response.return_code === '000000') { + if (fileInfo.file.response.return_data == null || fileInfo.file.response.return_data.length === 0) { + this.modal.error({ + nzTitle: '提示', + nzContent: '文件上传失败', + }); + } else { + this.importFleUrlForm.controls['fileUrl'].setValue(fileInfo.file.response.return_data[0]); + } + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: fileInfo.file.response.return_msg, + }); + } + } else if (fileInfo.file.status === 'error') { + this.loadingObject.spinning = false; + this.modal.error({ + nzTitle: '提示', + nzContent: '导入失败' + }); + } + } } diff --git a/src/app/pages/trade/order-oil-list/order-oil-list.component.ts b/src/app/pages/trade/order-oil-list/order-oil-list.component.ts index 5ba8f0f..38b4cf1 100644 --- a/src/app/pages/trade/order-oil-list/order-oil-list.component.ts +++ b/src/app/pages/trade/order-oil-list/order-oil-list.component.ts @@ -165,10 +165,11 @@ export class OrderOilListComponent { // 退款提示模态框 this.refundForm = this.fb.group({ orderNo: [{ value: null, disabled: true}, [Validators.required]], - childOrderNo: [{ value: null, disabled: true}, [Validators.required]], + orderChildNo: [null], merName: [{ value: null}], userPhone: [{ value: null}], gasRefuelPrice: [{ value: null}], + gasOilNo: [{ value: null}], payTime: [{ value: null}], remarks: [null,[Validators.required]], }); @@ -386,6 +387,7 @@ export class OrderOilListComponent { '加油油站:'+this.refundForm.controls['merName'].value+'
'+ '加油客户:'+(this.refundForm.controls['userPhone'].value!=null?this.refundForm.controls['userPhone'].value:'无')+'
'+ '加油金额:¥'+this.refundForm.controls['gasRefuelPrice'].value+'
'+ + '加油油号:'+this.refundForm.controls['gasOilNo'].value+'#
'+ '支付时间:'+ new Date(this.refundForm.controls['payTime'].value).toLocaleString()+'
'+ '确定退款吗?', nzOnOk: () => this.submitRefund() @@ -399,7 +401,7 @@ export class OrderOilListComponent { submitRefund() { this.loadingObject.status = true; this.loadingObject.title = '处理中...'; - this.orderRefundService.tradeOrderChild(this.refundForm.controls['childOrderNo'].value,1, this.refundForm.controls['remarks'].value, (data: any) => { + this.orderRefundService.tradeOrderChild(this.refundForm.controls['orderChildNo'].value,1, this.refundForm.controls['remarks'].value, (data: any) => { if (data['return_code'] === '000000') { this.modal.success({ nzTitle: '提示', diff --git a/src/app/services/trade-receipt/gas-order-receipt.service.ts b/src/app/services/trade-receipt/gas-order-receipt.service.ts index 90d738d..8d81b73 100644 --- a/src/app/services/trade-receipt/gas-order-receipt.service.ts +++ b/src/app/services/trade-receipt/gas-order-receipt.service.ts @@ -57,4 +57,16 @@ export class GasOrderReceiptService { callBack(data); }); } + + /** + * 导入成功开票数据 + * @param param + * @param callBack + */ + public importComplete(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'gasOrderReceipt/importComplete', param).subscribe(data => { + callBack(data); + }); + } }