加入小票打印

This commit is contained in:
java110 2021-03-13 18:12:52 +08:00
parent 20528790c2
commit 16849e724a
5 changed files with 223 additions and 0 deletions

View File

@ -21,6 +21,10 @@
v-on:click="_printFeeReceipt()">
打印
</button>
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px"
v-on:click="_printFeeSmallReceipt()">
打印小票
</button>
</div>
</div>
<div class="margin-top">

View File

@ -108,6 +108,21 @@
}
window.open("/print.html#/pages/property/printPayFee?receiptIds=" + receiptids);
},
_printFeeSmallReceipt:function(){
if ($that.simplifyFeeReceiptInfo.selectReceipts.length < 1) {
vc.toast('请选择打印收据');
return;
}
let receiptids = '';
$that.simplifyFeeReceiptInfo.selectReceipts.forEach(item => {
receiptids += (item + ',');
})
if (receiptids.endsWith(',')) {
receiptids = receiptids.substring(0, receiptids.length - 1);
}
window.open("/smallPrint.html#/pages/property/printSmallPayFee?receiptIds=" + receiptids);
},
clearSimplifyFeeReceiptInfo: function () {
$that.simplifyFeeReceiptInfo = {
feeReceipts: [],

View File

@ -0,0 +1,37 @@
<div>
<startprint></startprint>
<div class="print_container">
<div style="color:#000;font-size:32px" class="text-center">缴费收据单</div>
<span>**************************</span>
<div class="section2" style="font-size: 12px; margin-left: 5px;" >
<div>单号:{{printSmallPayFeeInfo.receiptNum}}</div>
<div>房号:{{printSmallPayFeeInfo.roomName}}</div>
<div>时间:{{printSmallPayFeeInfo.feeTime}}</div>
</div>
<span>**************************</span>
<div class="section2" style="font-size: 12px; margin-left: 5px;" v-for="(item,index) in printSmallPayFeeInfo.fees">
<div>收费项目:{{item.feeName}}</div>
<div>收费范围:{{vc.dateFormat(item.startTime)}}至{{vc.dateSubOneDay(vc.dateFormat(item.startTime),vc.dateFormat(item.endTime),item.feeFlag)}}</div>
<div>单价/固定费:{{item.squarePrice}}</div>
<div>面积/用量:{{item.area}}</div>
<div>金额:{{item.amount}}</div>
<div>备注:{{item.remark}}</div>
<span>**************************</span>
</div>
<div class="section5" style="font-size: 12px; margin-left: 5px;">
<div>总计:{{printSmallPayFeeInfo.amount}}</div>
<div v-html="printSmallPayFeeInfo.content"></div>
<div><img :src="printSmallPayFeeInfo.qrImg" width="100px" height="100px"></div>
</div>
<span>**************************</span>
</div>
<endprint></endprint>
<div id="print-btn">
<button class="btn btn-primary float-right" type="button" v-on:click="_printPurchaseApplyDiv()">
<i class="fa fa-check"></i>&nbsp;打印
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" v-on:click="_closePage()">取消
</button>
</div>
</div>

View File

@ -0,0 +1,149 @@
(function (vc) {
vc.extends({
data: {
printSmallPayFeeInfo: {
communityName: '',
receiptId: '',
receiptIds: '',
roomName: '',
amount: 0.00,
fees: [],
feeTime: '',
wechatName: '',
content: '',
qrImg: ''
},
printFlag: '0'
},
_initMethod: function () {
//vc.component._initPrintPurchaseApplyDateInfo();
$that.printSmallPayFeeInfo.receiptId = vc.getParam('receiptId');
$that.printSmallPayFeeInfo.receiptIds = vc.getParam('receiptIds');
//$that.printSmallPayFeeInfo.feeTime = vc.dateTimeFormat(new Date());
$that.printSmallPayFeeInfo.communityName = vc.getCurrentCommunity().name;
$that._loadReceipt();
$that._loadPrintSpec();
},
_initEvent: function () {
},
methods: {
_initPayFee: function () {
},
_loadReceipt: function () {
var param = {
params: {
page: 1,
row: 30,
receiptId: $that.printSmallPayFeeInfo.receiptId,
receiptIds: $that.printSmallPayFeeInfo.receiptIds,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/feeReceipt/queryFeeReceipt',
param,
function (json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceipt = _feeReceiptManageInfo.data;
let _amount = 0;
_feeReceipt.forEach(item => {
_amount += parseFloat(item.amount)
});
$that.printSmallPayFeeInfo.amount = _amount;
$that.printSmallPayFeeInfo.roomName = _feeReceipt[0].objName;
$that.printSmallPayFeeInfo.feeTime = _feeReceipt[0].createTime;
$that.printSmallPayFeeInfo.receiptNum = _feeReceipt[0].receiptId;
$that._loadReceiptDetail();
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadReceiptDetail: function () {
var param = {
params: {
page: 1,
row: 100,
receiptId: $that.printSmallPayFeeInfo.receiptId,
receiptIds: $that.printSmallPayFeeInfo.receiptIds,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/feeReceipt/queryFeeReceiptDetail',
param,
function (json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
$that.printSmallPayFeeInfo.fees = _feeReceiptDetails;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadPrintSpec: function () {
var param = {
params: {
page: 1,
row: 1,
specCd: 2020,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/feePrintSpec/queryFeePrintSpec',
param,
function (json, res) {
var _json = JSON.parse(json);
var _data = _json.data;
if (_data.length > 0) {
$that.printSmallPayFeeInfo.content = _data[0].content;
$that.printSmallPayFeeInfo.qrImg = _data[0].qrImg;
}
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_printPurchaseApplyDiv: function () {
let bdhtml=window.document.body.innerHTML;
let sprnstr="<startprint></startprint>";
let eprnstr="<endprint></endprint>";
let prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+sprnstr.length);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
console.log(window.document.body.innerHTML)
window.print();
// window.print();
// //$that.printFlag = false;
window.opener = null;
window.close();
},
_closePage: function () {
window.opener = null;
window.close();
}
}
});
})(window.vc);

18
public/smallPrint.html Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>收据单</title>
</head>
<body>
<!-- 1231 -->
<div id="component">
</div>
</body>
<!-- import CSS -->
<link rel="stylesheet" href="/css/bootstrap/bootstrap.min.css" />
<script src="/js/bootstrap/jquery-3.3.1.min.js"></script>
<script src="/js/vue/vue.min.js"></script>
<script src="/js/vue/vue-resource.min.js"></script>
<script src="/vcCore/vcFramework.js"></script>
</html>