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 b160fc1..4ab5db6 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,8 @@
{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}} |
{{data.status | orderCouponStatus}} |
- 打印小票
+ 打印小票
+ 已打印({{data.printNum+'次'}})
操作列表
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 8f56b9f..ce79676 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
@@ -56,6 +56,7 @@ export class OilStationOrderComponent implements OnInit {
private router: Router,
private company: CompanyService,
private merchant: MerchantService,
+ private orderService: OrderService,
private store: LocalStorageService, // 数据请求
private common: CommonsService
) {
@@ -164,15 +165,21 @@ export class OilStationOrderComponent implements OnInit {
});
}
- showPrintDiv(data: PrintData) {
+ showPrintDiv(orderId: number, data: PrintData) {
data['createTime'] = new Date(data['createTime']).toLocaleString();
this.printDiv(data);
+
+ this.orderService.print(orderId, dataBack => {
+ if (dataBack['return_code'] === '000000') {
+ this.getRequest(false, this.searchForm.value);
+ }
+ });
}
printDiv(data: object) {
const headstr = '打印小票';
const footstr = '';
- const newstr = '\n' +
+ const newstr = ' \n' +
' \n' +
' \n' +
' ' + data['gasName'] + '\n' +
@@ -180,33 +187,33 @@ export class OilStationOrderComponent implements OnInit {
' \n' +
' \n' +
' \n' +
- ' --------------------------------------------------- | \n' +
+ ' ------------------------------------------- | \n' +
' \n' +
- ' 流水号:' + data['orderNo'] + ' | \n' +
+ ' 流水号:' + data['orderNo'] + ' | \n' +
' \n' +
- ' --------------------------------------------------- | \n' +
+ ' ------------------------------------------- | \n' +
' \n' +
- ' 时间:' + data['createTime'] + ' | \n' +
+ ' 时间:' + data['createTime'] + ' | \n' +
' \n' +
' \n' +
- ' 来源:嗨森逛 | \n' +
+ ' 来源:嗨森逛 | \n' +
' \n' +
' \n' +
- ' 油枪:' + data['gasGunNo'] + ' | \n' +
+ ' 油枪:' + data['gasGunNo'] + ' | \n' +
' \n' +
' \n' +
- ' 油品:' + data['gasOilNo'] + ' | \n' +
+ ' 油品:' + data['gasOilNo'] + ' | \n' +
' \n' +
' \n' +
- ' 升数:' + data['gasOilLiters'] + '升 | \n' +
+ ' 升数:' + data['gasOilLiters'] + '升 | \n' +
' \n' +
' \n' +
- ' 实际加油升数以油站加油机为准! | \n' +
+ ' 实际加油升数以油站加油机为准! | \n' +
' \n' +
' 加油金额 | \n' +
' ¥' + data['totalPrice'] + '元 | \n' +
- ' --------------------------------------------------- | \n' +
- ' 开心又省钱; 来”嗨森逛“ | \n' +
+ ' ------------------------------------------- | \n' +
+ ' 开心又省钱; 来”嗨森逛“ | \n' +
' \n' +
' \n' +
' \n' +
@@ -217,43 +224,45 @@ export class OilStationOrderComponent implements OnInit {
' \n' +
' \n' +
' \n' +
- ' --------------------------------------------------- | \n' +
+ ' ------------------------------------------- | \n' +
' \n' +
- ' 流水号:' + data['orderNo'] + ' | \n' +
+ ' 流水号:' + data['orderNo'] + ' | \n' +
' \n' +
- ' --------------------------------------------------- | \n' +
+ ' ------------------------------------------- | \n' +
' \n' +
- ' 时间:' + data['createTime'] + ' | \n' +
+ ' 时间:' + data['createTime'] + ' | \n' +
' \n' +
' \n' +
- ' 嗨森逛 | \n' +
+ ' 来源:嗨森逛 | \n' +
' \n' +
' \n' +
- ' 油枪:' + data['gasGunNo'] + ' | \n' +
+ ' 油枪:' + data['gasGunNo'] + ' | \n' +
' \n' +
' \n' +
- ' 油品:' + data['gasOilNo'] + ' | \n' +
+ ' 油品:' + data['gasOilNo'] + ' | \n' +
' \n' +
' \n' +
- ' 升数:' + data['gasOilLiters'] + '升 | \n' +
+ ' 升数:' + data['gasOilLiters'] + '升 | \n' +
' \n' +
' \n' +
- ' 实际加油升数以油站加油机为准! | \n' +
+ ' 实际加油升数以油站加油机为准! | \n' +
' \n' +
' 加油金额 | \n' +
' ¥' + data['totalPrice'] + '元 | \n' +
- ' --------------------------------------------------- | \n' +
- ' 开心又省钱; 来”嗨森逛“ | \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 = headstr + newstr + footstr;
+ const newWindow = window.open('', '');
+ newWindow.document.write(headstr + newstr + footstr);
+ newWindow.print();
+ newWindow.close();
// document.body.innerHTML = oldstr;
- location.reload();
+ // location.reload();
return false;
}
}
diff --git a/src/app/services/order.service.ts b/src/app/services/order.service.ts
index fe68ecf..b6613fc 100644
--- a/src/app/services/order.service.ts
+++ b/src/app/services/order.service.ts
@@ -14,6 +14,19 @@ export class OrderService {
) {
}
+ /**
+ * 打印
+ *
+ * @param paramsObject 对象
+ * @param callBack 回调
+ */
+ public print(orderId: number, callBack) {
+ this.http.get(environment.baseUrl + 'highOrder/print?orderId=' + orderId).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+
/**
* 查询订单列表
*
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index ca22a39..0f97376 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -4,10 +4,10 @@
export const environment = {
production: false,
-/* baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
- imageUrl: 'http://localhost:9302/filesystem/',*/
- baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
- imageUrl: 'https://hsgcs.dctpay.com/filesystem/',
+ baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
+ imageUrl: 'http://localhost:9302/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=',
};
|