From e0fd00cc7ad154ad9e897adf2ad00285a9eefc50 Mon Sep 17 00:00:00 2001
From: hurui <177768073@qq.com>
Date: Thu, 2 Jun 2022 17:43:45 +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
---
.../oil-station-order.component.html | 219 +++++++++++-------
.../oil-station-order.component.ts | 132 +++++++++--
src/environments/environment.ts | 4 +-
tsconfig.json | 3 +-
4 files changed, 260 insertions(+), 98 deletions(-)
diff --git a/src/app/admin/order/oil-station-order/oil-station-order.component.html b/src/app/admin/order/oil-station-order/oil-station-order.component.html
index 01f2c81..b160fc1 100644
--- a/src/app/admin/order/oil-station-order/oil-station-order.component.html
+++ b/src/app/admin/order/oil-station-order/oil-station-order.component.html
@@ -110,7 +110,7 @@
{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}} |
{{data.status | orderCouponStatus}} |
-
+ 打印小票
操作列表
@@ -159,82 +159,143 @@
-
-
-
-
+
diff --git a/src/app/admin/order/oil-station-order/oil-station-order.component.ts b/src/app/admin/order/oil-station-order/oil-station-order.component.ts
index 0ef5a56..8f56b9f 100644
--- a/src/app/admin/order/oil-station-order/oil-station-order.component.ts
+++ b/src/app/admin/order/oil-station-order/oil-station-order.component.ts
@@ -10,7 +10,7 @@ import {MerchantService} from '../../../services/merchant.service';
import {LocalStorageService} from '../../../services/local-storage.service';
import {CommonsService} from '../../../services/commons.service';
import {WebsocketService} from '../../../services/websocket.service';
-import {ADMIN_INFO_OBJECT} from "../../../services/local-storage.namespace";
+import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
@Component({
selector: 'app-oil-station-order',
@@ -37,9 +37,15 @@ export class OilStationOrderComponent implements OnInit {
roleType: number;
secUser: object;
-
- printModal = false;
- printData = {};
+ printDataObject: PrintData = {
+ gasName: '',
+ orderNo: '',
+ createTime: '',
+ gasOilNo: '',
+ gasGunNo: '',
+ gasOilLiters: 0,
+ oilPrice: 0
+ };
constructor(
private form: FormBuilder,
@@ -158,19 +164,113 @@ export class OilStationOrderComponent implements OnInit {
});
}
- /**
- * 打开打印小票模态框
- */
- showPrintModal(data: object) {
- this.printData = data;
- this.printModal = true;
+ showPrintDiv(data: PrintData) {
+ data['createTime'] = new Date(data['createTime']).toLocaleString();
+ this.printDiv(data);
}
- /**
- * 关闭打印小票模态框
- */
- closePrintModal() {
- this.printData = {};
- this.printModal = false;
+ printDiv(data: object) {
+ const headstr = ' 打印小票';
+ const footstr = '';
+ const newstr = ' \n' +
+ ' \n' +
+ ' \n' +
+ ' ' + data['gasName'] + '\n' +
+ ' (客户存根)\n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' --------------------------------------------------- | \n' +
+ ' \n' +
+ ' 流水号:' + data['orderNo'] + ' | \n' +
+ ' \n' +
+ ' --------------------------------------------------- | \n' +
+ ' \n' +
+ ' 时间:' + data['createTime'] + ' | \n' +
+ ' \n' +
+ ' \n' +
+ ' 来源:嗨森逛 | \n' +
+ ' \n' +
+ ' \n' +
+ ' 油枪:' + data['gasGunNo'] + ' | \n' +
+ ' \n' +
+ ' \n' +
+ ' 油品:' + data['gasOilNo'] + ' | \n' +
+ ' \n' +
+ ' \n' +
+ ' 升数:' + data['gasOilLiters'] + '升 | \n' +
+ ' \n' +
+ ' \n' +
+ ' 实际加油升数以油站加油机为准! | \n' +
+ ' \n' +
+ ' 加油金额 | \n' +
+ ' ¥' + data['totalPrice'] + '元 | \n' +
+ ' --------------------------------------------------- | \n' +
+ ' 开心又省钱; 来”嗨森逛“ | \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' ' + data['gasName'] + '\n' +
+ ' (收银员存根)\n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' --------------------------------------------------- | \n' +
+ ' \n' +
+ ' 流水号:' + data['orderNo'] + ' | \n' +
+ ' \n' +
+ ' --------------------------------------------------- | \n' +
+ ' \n' +
+ ' 时间:' + data['createTime'] + ' | \n' +
+ ' \n' +
+ ' \n' +
+ ' 嗨森逛 | \n' +
+ ' \n' +
+ ' \n' +
+ ' 油枪:' + data['gasGunNo'] + ' | \n' +
+ ' \n' +
+ ' \n' +
+ ' 油品:' + data['gasOilNo'] + ' | \n' +
+ ' \n' +
+ ' \n' +
+ ' 升数:' + data['gasOilLiters'] + '升 | \n' +
+ ' \n' +
+ ' \n' +
+ ' 实际加油升数以油站加油机为准! | \n' +
+ ' \n' +
+ ' 加油金额 | \n' +
+ ' ¥' + data['totalPrice'] + '元 | \n' +
+ ' --------------------------------------------------- | \n' +
+ ' 开心又省钱; 来”嗨森逛“ | \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' ';
+ console.log(newstr);
+ // const oldstr = document.body.innerHTML;
+ document.body.innerHTML = headstr + newstr + footstr;
+ window.print();
+ // document.body.innerHTML = oldstr;
+ location.reload();
+ return false;
}
}
+
+export class PrintData {
+ // 油站名称
+ gasName = '';
+ // 订单号
+ orderNo = '';
+ // 下单时间
+ createTime = '';
+ // 油品
+ gasOilNo = '';
+ // 加油抢号
+ gasGunNo = '';
+ // 加油升数
+ gasOilLiters = 0;
+ // 加油金额
+ oilPrice = 0;
+}
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index c0bc8fa..ca22a39 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -6,8 +6,8 @@ export const environment = {
production: false,
/* baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'http://localhost:9302/filesystem/',*/
- baseUrl: 'https://hsg.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
- imageUrl: 'https://hsg.dctpay.com/filesystem/',
+ baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
+ imageUrl: 'https://hsgcs.dctpay.com/filesystem/',
key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=',
inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=',
};
diff --git a/tsconfig.json b/tsconfig.json
index 9ddd180..0d19327 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -16,7 +16,8 @@
],
"lib": [
"es2018",
- "dom"
+ "dom",
+ "scripthost"
],
"allowSyntheticDefaultImports": true
},
|