|
|
|
@ -10,7 +10,8 @@ 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'; |
|
|
|
|
import {MerchantStoreService} from "../../../services/merchant-store.service"; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-oil-station-order', |
|
|
|
@ -36,6 +37,9 @@ export class OilStationOrderComponent implements OnInit { |
|
|
|
|
refundContent: string; |
|
|
|
|
roleType: number; |
|
|
|
|
secUser: object; |
|
|
|
|
|
|
|
|
|
gasArray = []; |
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
|
private form: FormBuilder, |
|
|
|
|
private order: OrderService, |
|
|
|
@ -45,6 +49,8 @@ export class OilStationOrderComponent implements OnInit { |
|
|
|
|
private router: Router, |
|
|
|
|
private company: CompanyService, |
|
|
|
|
private merchant: MerchantService, |
|
|
|
|
private merchantStoreService: MerchantStoreService, |
|
|
|
|
private orderService: OrderService, |
|
|
|
|
private store: LocalStorageService, // 数据请求
|
|
|
|
|
private common: CommonsService |
|
|
|
|
) { |
|
|
|
@ -52,6 +58,13 @@ export class OilStationOrderComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.secUser = this.store.get(ADMIN_INFO_OBJECT)['secUser']; |
|
|
|
|
if (this.secUser['objectType'] === 2) { |
|
|
|
|
this.merchantStoreService.getStoreListByMerchant({ pageNum: 1, pageSize: 100}, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.gasArray = data['return_data']['list']; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
this.init(); |
|
|
|
|
// 接收消息
|
|
|
|
|
this.webSocketService.messageSubject.subscribe( |
|
|
|
@ -65,6 +78,7 @@ export class OilStationOrderComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
public init(): void { |
|
|
|
|
this.searchForm = this.form.group({ |
|
|
|
|
storeId: [null], |
|
|
|
|
orderNo: [null], |
|
|
|
|
status: [null], |
|
|
|
|
createTime: [null], |
|
|
|
@ -152,4 +166,122 @@ export class OilStationOrderComponent implements OnInit { |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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 = '<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['gasName'] + '</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="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: 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['gasName'] + '</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="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: 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; |
|
|
|
|
} |
|
|
|
|