提交代码

pull/1/head
胡锐 2 years ago
parent e0fd00cc7a
commit ce0cb0f91b
  1. 3
      src/app/admin/order/oil-station-order/oil-station-order.component.html
  2. 65
      src/app/admin/order/oil-station-order/oil-station-order.component.ts
  3. 13
      src/app/services/order.service.ts
  4. 8
      src/environments/environment.ts

@ -110,7 +110,8 @@
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td> <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td>
<td nzRight>{{data.status | orderCouponStatus}}</td> <td nzRight>{{data.status | orderCouponStatus}}</td>
<td nzRight class="table-td-operation"> <td nzRight class="table-td-operation">
<a style="float: left;width: 100%;margin-bottom: 10px;" (click)="showPrintDiv(data)">打印小票</a> <a style="float: left;width: 100%;margin-bottom: 10px;" *ngIf="data.printStatus == false" (click)="showPrintDiv(data.orderId, data)">打印小票</a>
<a style="float: left;width: 100%;margin-bottom: 10px;" *ngIf="data.printStatus == true" (click)="showPrintDiv(data.orderId, data)">已打印({{data.printNum+'次'}})</a>
<a nz-dropdown [nzDropdownMenu]="menu">操作列表<i nz-icon nzType="down"></i></a> <a nz-dropdown [nzDropdownMenu]="menu">操作列表<i nz-icon nzType="down"></i></a>
<nz-dropdown-menu #menu="nzDropdownMenu"> <nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable> <ul nz-menu nzSelectable>

@ -56,6 +56,7 @@ export class OilStationOrderComponent implements OnInit {
private router: Router, private router: Router,
private company: CompanyService, private company: CompanyService,
private merchant: MerchantService, private merchant: MerchantService,
private orderService: OrderService,
private store: LocalStorageService, // 数据请求 private store: LocalStorageService, // 数据请求
private common: CommonsService 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(); data['createTime'] = new Date(data['createTime']).toLocaleString();
this.printDiv(data); this.printDiv(data);
this.orderService.print(orderId, dataBack => {
if (dataBack['return_code'] === '000000') {
this.getRequest(false, this.searchForm.value);
}
});
} }
printDiv(data: object) { printDiv(data: object) {
const headstr = '<html><head><title>打印小票</title></head><body>'; const headstr = '<html><head><title>打印小票</title></head><body>';
const footstr = '</body>'; const footstr = '</body>';
const newstr = '<div id="div_print">\n' + const newstr = '<div id="div_print" style="font-size: 16px;">\n' +
' <div style="float: left;margin-bottom: 150px;">\n' + ' <div style="float: left;margin-bottom: 150px;">\n' +
' <div style="line-height: 30px; color:#000;">\n' + ' <div style="line-height: 30px; color:#000;">\n' +
' <span style="font-size: 13px;float: left;width: 100%;">' + data['gasName'] + '</span>\n' + ' <span style="font-size: 13px;float: left;width: 100%;">' + data['gasName'] + '</span>\n' +
@ -180,33 +187,33 @@ export class OilStationOrderComponent implements OnInit {
' </div>\n' + ' </div>\n' +
' <table style="width: 100%;">\n' + ' <table style="width: 100%;">\n' +
' <tbody>\n' + ' <tbody>\n' +
' <tr><td style="font-size: smaller;color: black;">---------------------------------------------------</td></tr>\n' + ' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">流水号:<span>' + data['orderNo'] + '</span></td>\n' + ' <td style="font-size: xx-small;color: black;">流水号:<span>' + data['orderNo'] + '</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr><td style="font-size: smaller;color: black;">---------------------------------------------------</td></tr>\n' + ' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">时间:<span>' + data['createTime'] + '</span></td>\n' + ' <td style="font-size: xx-small;color: black;">时间:<span>' + data['createTime'] + '</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">来源:<span>嗨森逛</span></td>\n' + ' <td style="font-size: xx-small;color: black;">来源:<span>嗨森逛</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">油枪:<span>' + data['gasGunNo'] + '</span></td>\n' + ' <td style="font-size: xx-small;color: black;">油枪:<span>' + data['gasGunNo'] + '</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">油品:<span>' + data['gasOilNo'] + '</span></td>\n' + ' <td style="font-size: xx-small;color: black;">油品:<span>' + data['gasOilNo'] + '</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">升数:<span>' + data['gasOilLiters'] + '升</span></td>\n' + ' <td style="font-size: xx-small;color: black;">升数:<span>' + data['gasOilLiters'] + '升</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">实际加油升数以油站加油机为准!</td>\n' + ' <td style="font-size: xx-small;color: black;">实际加油升数以油站加油机为准!</td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr><td style="float: left;margin-top: 10px;font-size: 30px;color: black">加油金额</td></tr>\n' + ' <tr><td style="float: left;margin-top: 10px;font-size: 30px;color: black">加油金额</td></tr>\n' +
' <tr><td style="font-size: 30px;color: black">¥' + data['totalPrice'] + '元</td></tr>\n' + ' <tr><td style="font-size: 30px;color: black">¥' + data['totalPrice'] + '元</td></tr>\n' +
' <tr><td style="font-size: smaller;color: black;">---------------------------------------------------</td></tr>\n' + ' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr><td style="float: left;color: black;margin-left: 35px;">开心又省钱; 来”嗨森逛“</td></tr>\n' + ' <tr><td style="float: left;font-size: xx-small;color: black;margin-left: 25px;">开心又省钱; 来”嗨森逛“</td></tr>\n' +
' </tbody>\n' + ' </tbody>\n' +
' </table>\n' + ' </table>\n' +
' </div>\n' + ' </div>\n' +
@ -217,43 +224,45 @@ export class OilStationOrderComponent implements OnInit {
' </div>\n' + ' </div>\n' +
' <table style="width: 100%;">\n' + ' <table style="width: 100%;">\n' +
' <tbody>\n' + ' <tbody>\n' +
' <tr><td style="font-size: smaller;color: black;">---------------------------------------------------</td></tr>\n' + ' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">流水号:<span>' + data['orderNo'] + '</span></td>\n' + ' <td style="font-size: xx-small;color: black;">流水号:<span>' + data['orderNo'] + '</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr><td style="font-size: smaller;color: black;">---------------------------------------------------</td></tr>\n' + ' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">时间:<span>' + data['createTime'] + '</span></td>\n' + ' <td style="font-size: xx-small;color: black;">时间:<span>' + data['createTime'] + '</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;"来源:<span>嗨森逛</span></td>\n' + ' <td style="font-size: xx-small;color: black;">来源:<span>嗨森逛</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">油枪:<span>' + data['gasGunNo'] + '</span></td>\n' + ' <td style="font-size: xx-small;color: black;">油枪:<span>' + data['gasGunNo'] + '</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">油品:<span>' + data['gasOilNo'] + '</span></td>\n' + ' <td style="font-size: xx-small;color: black;">油品:<span>' + data['gasOilNo'] + '</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">升数:<span>' + data['gasOilLiters'] + '升</span></td>\n' + ' <td style="font-size: xx-small;color: black;">升数:<span>' + data['gasOilLiters'] + '升</span></td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr>\n' + ' <tr>\n' +
' <td style="font-size: smaller;color: black;">实际加油升数以油站加油机为准!</td>\n' + ' <td style="font-size: xx-small;color: black;">实际加油升数以油站加油机为准!</td>\n' +
' </tr>\n' + ' </tr>\n' +
' <tr><td style="float: left;margin-top: 10px;font-size: 30px;color: black">加油金额</td></tr>\n' + ' <tr><td style="float: left;margin-top: 10px;font-size: 30px;color: black">加油金额</td></tr>\n' +
' <tr><td style="font-size: 30px;color: black">¥' + data['totalPrice'] + '元</td></tr>\n' + ' <tr><td style="font-size: 30px;color: black">¥' + data['totalPrice'] + '元</td></tr>\n' +
' <tr><td style="font-size: smaller;color: black;">---------------------------------------------------</td></tr>\n' + ' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr><td style="float: left;color: black;margin-left: 35px;">开心又省钱; 来”嗨森逛“</td></tr>\n' + ' <tr><td style="float: left;font-size: xx-small;color: black;margin-left: 25px;">开心又省钱; 来”嗨森逛“</td></tr>\n' +
' </tbody>\n' + ' </tbody>\n' +
' </table>\n' + ' </table>\n' +
' </div>\n' + ' </div>\n' +
'</div>'; '</div>';
console.log(newstr);
// const oldstr = document.body.innerHTML; // const oldstr = document.body.innerHTML;
document.body.innerHTML = headstr + newstr + footstr; // document.body.innerHTML = headstr + newstr + footstr;
window.print(); const newWindow = window.open('', '');
newWindow.document.write(headstr + newstr + footstr);
newWindow.print();
newWindow.close();
// document.body.innerHTML = oldstr; // document.body.innerHTML = oldstr;
location.reload(); // location.reload();
return false; return false;
} }
} }

@ -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);
});
}
/** /**
* *
* *

@ -4,10 +4,10 @@
export const environment = { export const environment = {
production: false, production: false,
/* baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'http://localhost:9302/filesystem/',*/ imageUrl: 'http://localhost:9302/filesystem/',
baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) /* baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'https://hsgcs.dctpay.com/filesystem/', imageUrl: 'https://hsgcs.dctpay.com/filesystem/',*/
key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=', key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=',
inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=', inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=',
}; };

Loading…
Cancel
Save