From a3c925de4cc3c326bd07bdc18e9c45ecafe7a9cc Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 17 Nov 2023 19:00:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order-oil-list.component.html | 159 ++++++++++++++++++ .../order-oil-list.component.ts | 140 +++++++++++++++ src/app/services/order.service.ts | 2 +- src/environments/environment.ts | 2 +- 4 files changed, 301 insertions(+), 2 deletions(-) diff --git a/src/app/admin/order-manage/order-oil/order-oil-list/order-oil-list.component.html b/src/app/admin/order-manage/order-oil/order-oil-list/order-oil-list.component.html index f8eb180..b0f1ee9 100644 --- a/src/app/admin/order-manage/order-oil/order-oil-list/order-oil-list.component.html +++ b/src/app/admin/order-manage/order-oil/order-oil-list/order-oil-list.component.html @@ -299,6 +299,7 @@ @@ -488,3 +489,161 @@ + + + +
+ + + + + + + + + + + +
+
+ + diff --git a/src/app/admin/order-manage/order-oil/order-oil-list/order-oil-list.component.ts b/src/app/admin/order-manage/order-oil/order-oil-list/order-oil-list.component.ts index f114ef9..4eedd59 100644 --- a/src/app/admin/order-manage/order-oil/order-oil-list/order-oil-list.component.ts +++ b/src/app/admin/order-manage/order-oil/order-oil-list/order-oil-list.component.ts @@ -14,6 +14,7 @@ import {MerchantService} from '../../../../services/merchant.service'; import {OrderOilService} from '../../../../services/order/order-oil.service'; import {OrderManageService} from '../../../../services/order/order-manage.service'; import {ActivatedRoute} from '@angular/router'; +import {OrderService} from '../../../../services/order.service'; @Component({ selector: 'app-order-oil-list', @@ -66,6 +67,12 @@ export class OrderOilListComponent implements OnInit { // 退款按钮权限 REFUND_OIL_BTN = false; + printDataObject = { + orderNo: null, + printData: null + }; + printModal = false; + constructor(private modal: NzModalService, private message: NzMessageService, private commonsService: CommonsService, @@ -73,6 +80,7 @@ export class OrderOilListComponent implements OnInit { private merchantService: MerchantService, private store: LocalStorageService, private orderManageService: OrderManageService, + private orderService: OrderService, private orderOilService: OrderOilService, private tyAgentService: TyAgentService, private tySalesmanService: TySalesmanService, @@ -456,4 +464,136 @@ export class OrderOilListComponent implements OnInit { this.refundRecordModal = false; } + + showPrintModal(orderNo: string, data: PrintData) { + this.printDataObject.orderNo = orderNo; + this.printDataObject.printData = data; + this.printModal = true; + } + + cloudPrint() { + this.orderService.print(this.printDataObject.orderNo, 2, dataBack => { + if (dataBack['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '操作成功', + }); + } + }); + } + + showPrintDiv() { + const data = this.printDataObject.printData; + data['createTime'] = new Date(data['createTime']).toLocaleString(); + this.printDiv(data); + } + + printDiv(data: object) { + const headstr = '打印小票'; + const footstr = ''; + const newstr = '
\n' + + '
\n' + + '
\n' + + ' ' + data['storeName'] + '\n' + + ' (客户存根)\n' + + '
\n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + '
-------------------------------------------
流水号:' + data['orderNo'] + '
-------------------------------------------
时间:' + data['createTime'] + '
来源:嗨森逛
油枪:' + data['gasGunNo'] + '
油品:' + data['gasOilNo'] + '
升数:' + data['gasOilLiters'] + '升
实际加油升数以油站加油机为准!
-------------------------------------------
加油金额
¥' + data['gasRefuelPrice'] + '元
-------------------------------------------
开心又省钱; 来”嗨森逛“
\n' + + '
\n' + + '
\n' + + '
\n' + + ' ' + data['storeName'] + '\n' + + ' (收银员存根)\n' + + '
\n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + ' \n' + + '
-------------------------------------------
流水号:' + data['orderNo'] + '
-------------------------------------------
时间:' + data['createTime'] + '
来源:嗨森逛
油枪:' + data['gasGunNo'] + '
油品:' + data['gasOilNo'] + '
升数:' + data['gasOilLiters'] + '升
实际加油升数以油站加油机为准!
-------------------------------------------
加油金额
¥' + data['gasRefuelPrice'] + '元
-------------------------------------------
开心又省钱; 来”嗨森逛“
\n' + + '
\n' + + '
'; + // const oldstr = document.body.innerHTML; + // document.body.innerHTML = headstr + newstr + footstr; + const newWindow = window.open('', ''); + newWindow.document.write(headstr + newstr + footstr); + newWindow.print(); + newWindow.close(); + // document.body.innerHTML = oldstr; + // location.reload(); + return false; + } +} + +export class PrintData { + // 油站名称 + gasName = ''; + // 订单号 + orderNo = ''; + // 下单时间 + createTime = ''; + // 油品 + gasOilNo = ''; + // 加油抢号 + gasGunNo = ''; + // 加油升数 + gasOilLiters = 0; + // 加油金额 + oilPrice = 0; } diff --git a/src/app/services/order.service.ts b/src/app/services/order.service.ts index 3ea3e41..97d1495 100644 --- a/src/app/services/order.service.ts +++ b/src/app/services/order.service.ts @@ -22,7 +22,7 @@ export class OrderService { * @param callBack 回调 */ public print(orderId: number, printType: number, callBack) { - this.http.get(environment.baseUrl + 'highOrder/print?orderId=' + orderId + '&printType=' + printType).subscribe(data => { + this.http.get(environment.baseUrl + 'highOrder/print?orderNo=' + orderId + '&printType=' + printType).subscribe(data => { callBack(data); }); } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index fc4bf0d..3661fbd 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) + baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) // orderUrl: 'http://localhost:9304/order/', // 测试环境服务器地址(请求数据地址) // baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) // baseUrl: 'https://hsg.dctpay.com/brest/', // 正式环境服务器地址(请求数据地址)