提交代码

dev
胡锐 1 year ago
parent c392dbeb6d
commit a3c925de4c
  1. 159
      src/app/admin/order-manage/order-oil/order-oil-list/order-oil-list.component.html
  2. 140
      src/app/admin/order-manage/order-oil/order-oil-list/order-oil-list.component.ts
  3. 2
      src/app/services/order.service.ts
  4. 2
      src/environments/environment.ts

@ -299,6 +299,7 @@
<ul nz-menu nzSelectable>
<li (click)="showOrderDetail(data.orderNo)" nz-menu-item>交易详情</li>
<li *ngIf="REFUND_OIL_BTN == true && data.status == 2" (click)="showRefund(data.orderNo)" nz-menu-item>交易退款</li>
<li *ngIf="data.status == 2" (click)="showPrintModal(data.orderNo, data)" nz-menu-item>打印小票</li>
<li (click)="showRefundRecord(data.orderNo)" nz-menu-item>退款记录</li>
</ul>
</nz-dropdown-menu>
@ -488,3 +489,161 @@
</tbody>
</nz-table>
</nz-modal>
<nz-modal [(nzVisible)]="printModal" nzTitle="选择打印方式" nzWidth="200" (nzOnCancel)="printModal = false" [nzFooter]="null">
<form nz-form>
<nz-form-item>
<nz-form-control>
<button nz-button nzType="primary" nzBlock (click)="showPrintDiv()">热敏打印机</button>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control>
<button nz-button nzType="primary" nzBlock (click)="cloudPrint()">云打印机</button>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>
<!--<div id="div_print">
<div style="float: left;margin-bottom: 150px;">
<div style="line-height: 30px; color:#000;">
<span style="font-size: 13px;float: left;width: 100%;">{{printDataObject.gasName}}</span>
<span style="font-size: 13px;float: left;width: 100%;margin-left: 60px;">(客户存根)</span>
</div>
<table style="width: 100%;">
<tbody>
<tr><td class="print_td">-&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;</td></tr>
<tr>
<td class="print_td">流水号:<span>{{printDataObject.orderNo}}</span></td>
</tr>
<tr><td class="print_td">-&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;</td></tr>
<tr>
<td class="print_td">时间:<span>{{printDataObject.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</span></td>
</tr>
<tr>
<td class="print_td">来源:<span>嗨森逛</span></td>
</tr>
<tr>
<td class="print_td">油枪:<span>{{printDataObject.gasGunNo}}</span></td>
</tr>
<tr>
<td class="print_td">油品:<span>{{printDataObject.gasOilNo}}</span></td>
</tr>
<tr>
<td class="print_td">升数:<span>{{printDataObject.gasOilLiters}}升</span></td>
</tr>
<tr>
<td class="print_td">实际加油升数以油站加油机为准!</td>
</tr>
<tr><td style="float: left;margin-top: 10px;font-size: 30px;color: black">加油金额</td></tr>
<tr><td style="font-size: 30px;color: black">¥{{printDataObject.oilPrice}}元</td></tr>
<tr><td class="print_td">-&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;</td></tr>
<tr><td style="float: left;color: black;margin-left: 35px;">开心又省钱; 来”嗨森逛“</td></tr>
</tbody>
</table>
</div>
<div style="float: left;margin-bottom: 50px;">
<div style="line-height: 30px; color:#000;">
<span style="font-size: 13px;float: left;width: 100%;">{{printDataObject.gasName}}</span>
<span style="font-size: 13px;float: left;width: 100%;margin-left: 60px;">(收银员存根)</span>
</div>
<table style="width: 100%;">
<tbody>
<tr><td class="print_td">-&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;</td></tr>
<tr>
<td class="print_td">流水号:<span>{{printDataObject.orderNo}}</span></td>
</tr>
<tr><td class="print_td">-&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;</td></tr>
<tr>
<td class="print_td">时间:<span>{{printDataObject.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</span></td>
</tr>
<tr>
<td class="print_td">来源:<span>嗨森逛</span></td>
</tr>
<tr>
<td class="print_td">油枪:<span>{{printDataObject.gasGunNo}}</span></td>
</tr>
<tr>
<td class="print_td">油品:<span>{{printDataObject.gasOilNo}}</span></td>
</tr>
<tr>
<td class="print_td">升数:<span>{{printDataObject.gasOilLiters}}升</span></td>
</tr>
<tr>
<td class="print_td">实际加油升数以油站加油机为准!</td>
</tr>
<tr><td style="float: left;margin-top: 10px;font-size: 30px;color: black">加油金额</td></tr>
<tr><td style="font-size: 30px;color: black">¥{{printDataObject.oilPrice}}元</td></tr>
<tr><td class="print_td">-&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;</td></tr>
<tr><td style="float: left;color: black;margin-left: 35px;">开心又省钱; 来”嗨森逛“</td></tr>
</tbody>
</table>
</div>
&lt;!&ndash; <table border=1 cellspacing=0 cellpadding=1 width="100%" style="border-collapse:collapse" bordercolor="#333333">
<thead>
<tr>
<td width="10%">
<div align=center><b>表格页眉</b></div>
</td>
<td width="25%">
<div align=center><b>品名</b></div>
</td>
<td width="10%">
<div align=center><b>颜色</b></div>
</td>
<td width="10%">
<div align=center><b>规格</b></div>
</td>
<td width="10%">
<div align=center><b>数量</b></div>
</td>
<td width="15%">
<div align=center><b>单价</b></div>
</td>
<td width="20%">
<div align=center><b>金额</b></div>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>&nbsp;1</td>
<td>名称01</td>
<td>浅灰色</td>
<td>185/10</td>
<td>1</td>
<td>248.00</td>
<td>248.00</td>
</tr>
<tr>
<td>&nbsp;2</td>
<td>名称02</td>
<td>浅灰色</td>
<td>185/10</td>
<td>1</td>
<td>248.00</td>
<td>248.00</td>
</tr>
<tr>
<td>&nbsp;3</td>
<td>名称03</td>
<td>浅灰色</td>
<td>185/10</td>
<td>1</td>
<td>248.00</td>
<td>248.00</td>
</tr>
<tr>
<td>&nbsp;4</td>
<td>名称04</td>
<td>浅灰色</td>
<td>185/10</td>
<td>1</td>
<td>248.00</td>
<td>248.00</td>
</tr>
</table>&ndash;&gt;
</div>-->

@ -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 = '<html><head><title>打印小票</title></head><body>';
const footstr = '</body>';
const newstr = '<div id="div_print" style="font-size: 16px;">\n' +
' <div style="float: left;margin-bottom: 150px;">\n' +
' <div style="line-height: 30px; color:#000;">\n' +
' <span style="font-size: 13px;float: left;width: 100%;">' + data['storeName'] + '</span>\n' +
' <span style="font-size: 13px;float: left;width: 100%;margin-left: 60px;">(客户存根)</span>\n' +
' </div>\n' +
' <table style="width: 100%;">\n' +
' <tbody>\n' +
' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">流水号:<span>' + data['orderNo'] + '</span></td>\n' +
' </tr>\n' +
' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">时间:<span>' + data['createTime'] + '</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">来源:<span>嗨森逛</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">油枪:<span>' + data['gasGunNo'] + '</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">油品:<span>' + data['gasOilNo'] + '</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">升数:<span>' + data['gasOilLiters'] + '升</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">实际加油升数以油站加油机为准!</td>\n' +
' </tr>\n' +
' <tr><td style="font-size: xx-small;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['gasRefuelPrice'] + '元</td></tr>\n' +
' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr><td style="float: left;font-size: xx-small;color: black;margin-left: 25px;">开心又省钱; 来”嗨森逛“</td></tr>\n' +
' </tbody>\n' +
' </table>\n' +
' </div>\n' +
' <div style="float: left;margin-bottom: 50px;">\n' +
' <div style="line-height: 30px; color:#000;">\n' +
' <span style="font-size: 13px;float: left;width: 100%;">' + data['storeName'] + '</span>\n' +
' <span style="font-size: 13px;float: left;width: 100%;margin-left: 60px;">(收银员存根)</span>\n' +
' </div>\n' +
' <table style="width: 100%;">\n' +
' <tbody>\n' +
' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">流水号:<span>' + data['orderNo'] + '</span></td>\n' +
' </tr>\n' +
' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">时间:<span>' + data['createTime'] + '</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">来源:<span>嗨森逛</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">油枪:<span>' + data['gasGunNo'] + '</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">油品:<span>' + data['gasOilNo'] + '</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">升数:<span>' + data['gasOilLiters'] + '升</span></td>\n' +
' </tr>\n' +
' <tr>\n' +
' <td style="font-size: xx-small;color: black;">实际加油升数以油站加油机为准!</td>\n' +
' </tr>\n' +
' <tr><td style="font-size: xx-small;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['gasRefuelPrice'] + '元</td></tr>\n' +
' <tr><td style="font-size: xx-small;color: black;">-------------------------------------------</td></tr>\n' +
' <tr><td style="float: left;font-size: xx-small;color: black;margin-left: 25px;">开心又省钱; 来”嗨森逛“</td></tr>\n' +
' </tbody>\n' +
' </table>\n' +
' </div>\n' +
'</div>';
// 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;
}

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

@ -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/', // 正式环境服务器地址(请求数据地址)

Loading…
Cancel
Save