优化代码

This commit is contained in:
java110 2023-06-07 09:54:01 +08:00
parent d2be6bbae6
commit 897aebc6a6
7 changed files with 89 additions and 84 deletions

View File

@ -84,7 +84,7 @@
},
_loadReceiptDetail: function() {
var param = {
let param = {
params: {
page: 1,
row: 100,
@ -101,7 +101,7 @@
function(json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
$that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].payOrderId;
$that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].receiptId + "(" + _feeReceiptDetails[0].payOrderId + ")";
_feeReceiptDetails.forEach(item => {
$that.printPayFeeInfo.feeReceipt.forEach(im => {
if (item.receiptId == im.receiptId) {

View File

@ -68,7 +68,7 @@
$that.printPayFeeInfo.amount = _amount.toFixed(2);
$that.printPayFeeInfo.roomName = _feeReceipt[0].objName;
$that.printPayFeeInfo.feeTime = _feeReceipt[0].createTime;
// $that.printPayFeeInfo.receiptNum = _feeReceipt[0].receiptId;
// $that.printPayFeeInfo.receiptNum = _feeReceipt[0].receiptId;
$that.printPayFeeInfo.payObjName = _feeReceipt[0].payObjName;
$that.printPayFeeInfo.feeReceipt = _feeReceipt;
@ -98,7 +98,7 @@
function(json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
$that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].payOrderId;
$that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].receiptId + "(" + _feeReceiptDetails[0].payOrderId + ")";
_feeReceiptDetails.forEach(item => {
$that.printPayFeeInfo.feeReceipt.forEach(im => {
if (item.receiptId == im.receiptId) {

View File

@ -110,7 +110,7 @@
function(json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
$that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].payOrderId;
$that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].receiptId + "(" + _feeReceiptDetails[0].payOrderId + ")";
_feeReceiptDetails.forEach(item => {
$that.printPayFeeInfo.feeReceipt.forEach(im => {
if (item.receiptId == im.receiptId) {

View File

@ -1,4 +1,4 @@
(function (vc) {
(function(vc) {
vc.extends({
data: {
@ -14,20 +14,20 @@
wechatName: '',
content: '',
qrImg: '',
payObjName:'',
feeReceipt:[],
apply:'N'
payObjName: '',
feeReceipt: [],
apply: 'N'
},
printFlag: '0'
},
_initMethod: function () {
_initMethod: function() {
//vc.component._initPrintPurchaseApplyDateInfo();
$that.printPayFeeInfo.receiptId = vc.getParam('receiptId');
$that.printPayFeeInfo.receiptIds = vc.getParam('receiptIds');
$that.printPayFeeInfo.detailIds = vc.getParam('detailIds');
$that.printPayFeeInfo.apply = vc.getParam('apply');
//$that.printPayFeeInfo.feeTime = vc.dateTimeFormat(new Date());
$that.printPayFeeInfo.communityName = vc.getCurrentCommunity().name;
@ -36,15 +36,15 @@
$that._loadPrintSpec();
},
_initEvent: function () {
_initEvent: function() {
},
methods: {
_initPayFee: function () {
_initPayFee: function() {
},
_loadReceipt: function () {
_loadReceipt: function() {
var param = {
params: {
@ -60,7 +60,7 @@
//发送get请求
vc.http.apiGet('/feeReceipt/queryFeeReceipt',
param,
function (json, res) {
function(json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceipt = _feeReceiptManageInfo.data;
let _amount = 0;
@ -77,12 +77,13 @@
$that._loadReceiptDetail();
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadReceiptDetail: function () {
_loadReceiptDetail: function() {
var param = {
params: {
@ -98,13 +99,13 @@
//发送get请求
vc.http.apiGet('/feeReceipt/queryFeeReceiptDetail',
param,
function (json, res) {
function(json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
$that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].payOrderId;
_feeReceiptDetails.forEach(item=>{
$that.printPayFeeInfo.feeReceipt.forEach(im =>{
if(item.receiptId == im.receiptId){
$that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].receiptId + "(" + _feeReceiptDetails[0].payOrderId + ")";
_feeReceiptDetails.forEach(item => {
$that.printPayFeeInfo.feeReceipt.forEach(im => {
if (item.receiptId == im.receiptId) {
item.objName = im.objName;
item.feeTypeCd = im.feeTypeCd;
}
@ -113,12 +114,13 @@
$that.printPayFeeInfo.fees = _feeReceiptDetails;
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadPrintSpec: function () {
_loadPrintSpec: function() {
var param = {
params: {
page: 1,
@ -131,39 +133,40 @@
//发送get请求
vc.http.apiGet('/feePrintSpec/queryFeePrintSpec',
param,
function (json, res) {
function(json, res) {
var _json = JSON.parse(json);
var _data = _json.data;
if (_data.length > 0) {
$that.printPayFeeInfo.content = _data[0].content;
$that.printPayFeeInfo.qrImg = _data[0].qrImg;
if(_data[0].printName){
if (_data[0].printName) {
$that.printPayFeeInfo.communityName = _data[0].printName;
}
}
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_printPurchaseApplyDiv: function () {
_printPurchaseApplyDiv: function() {
$that.printFlag = '1';
console.log('console.log($that.printFlag);', $that.printFlag);
document.getElementById("print-btn").style.display = "none";//隐藏
document.getElementById("print-btn").style.display = "none"; //隐藏
window.print();
//$that.printFlag = false;
window.opener = null;
window.close();
},
_closePage: function () {
_closePage: function() {
window.opener = null;
window.close();
}
}
});
})(window.vc);
})(window.vc);

View File

@ -70,7 +70,7 @@
$that.printPayFeeInfo.amount = _amount.toFixed(2);
$that.printPayFeeInfo.roomName = _feeReceipt[0].objName;
$that.printPayFeeInfo.feeTime = _feeReceipt[0].createTime;
// $that.printPayFeeInfo.receiptNum = _feeReceipt[0].receiptId;
// $that.printPayFeeInfo.receiptNum = _feeReceipt[0].receiptId;
$that.printPayFeeInfo.payObjName = _feeReceipt[0].payObjName;
$that.printPayFeeInfo.feeReceipt = _feeReceipt;
@ -105,7 +105,7 @@
function(json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
$that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].payOrderId;
$that.printPayFeeInfo.receiptNum = _feeReceiptDetails[0].receiptId + "(" + _feeReceiptDetails[0].payOrderId + ")";
_feeReceiptDetails.forEach(item => {
$that.printPayFeeInfo.feeReceipt.forEach(im => {
if (item.receiptId == im.receiptId) {

View File

@ -7,7 +7,10 @@
<span>**************************</span>
<div class="section2" style="font-size: 12px; margin-left: 5px;">
<div>
<span><vc:i18n name="单号" namespace="printSmallPayFee"></vc:i18n></span>{{printSmallPayFeeInfo.receiptNum}}
<span><vc:i18n name="收据号:" namespace="printSmallPayFee"></vc:i18n></span>{{printSmallPayFeeInfo.receiptNum}}
</div>
<div>
<span><vc:i18n name="订单号:" namespace="printSmallPayFee"></vc:i18n></span>{{printSmallPayFeeInfo.payOrderId}}
</div>
<div>
<span><vc:i18n name="房号" namespace="printSmallPayFee"></vc:i18n></span>{{printSmallPayFeeInfo.roomName}}
@ -20,8 +23,7 @@
</div>
</div>
<span>**************************</span>
<div class="section2" style="font-size: 12px; margin-left: 5px;"
v-for="(item,index) in printSmallPayFeeInfo.fees">
<div class="section2" style="font-size: 12px; margin-left: 5px;" v-for="(item,index) in printSmallPayFeeInfo.fees">
<div>
<span><vc:i18n name="收费项目" namespace="printSmallPayFee"></vc:i18n></span>{{item.feeName}}
</div>
@ -42,70 +44,69 @@
<span><vc:i18n name="表读数:" namespace="printSmallPayFee"></vc:i18n></span>{{item.preDegrees}} 至 {{item.curDegrees}}
</div>
<div>
<span><vc:i18n name="金额:" namespace="printSmallPayFee"></vc:i18n></span>
{{item.amount < 0 ? item.amount + "(退费)" : item.amount}}
<span><vc:i18n name="金额:" namespace="printSmallPayFee"></vc:i18n></span> {{item.amount
< 0 ? item.amount + "(退费)" : item.amount}} </div>
<div>
<span><vc:i18n name="备注" namespace="printSmallPayFee"></vc:i18n></span>{{item.remark}}
</div>
<span>**************************</span>
</div>
<div>
<span><vc:i18n name="备注" namespace="printSmallPayFee"></vc:i18n></span>{{item.remark}}
<div class="section5" style="font-size: 12px; margin-left: 5px;">
<div>
<span><vc:i18n name="总计" namespace="printSmallPayFee"></vc:i18n></span>{{printSmallPayFeeInfo.amount}}
</div>
<div>
<span><vc:i18n name="开票人" namespace="printSmallPayFee"></vc:i18n></span>{{vc.getData('/nav/getUserInfo').name}}
</div>
<div v-html="printSmallPayFeeInfo.content"></div>
<div><img :src="printSmallPayFeeInfo.qrImg" width="100px" height="100px"></div>
</div>
<span>**************************</span>
</div>
<div class="section5" style="font-size: 12px; margin-left: 5px;">
<div>
<span><vc:i18n name="总计" namespace="printSmallPayFee"></vc:i18n></span>{{printSmallPayFeeInfo.amount}}
</div>
<div>
<span><vc:i18n name="开票人" namespace="printSmallPayFee"></vc:i18n></span>{{vc.getData('/nav/getUserInfo').name}}
</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()">
<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 class="btn btn-white float-right margin-right" type="button" v-on:click="_openCloudPrint()">
<button class="btn btn-white float-right margin-right" type="button" v-on:click="_openCloudPrint()">
<i class="fa fa-check"></i>&nbsp;云打印
</button>
<button type="button" class="btn btn-white float-right margin-right" v-on:click="_closePage()">
<button type="button" class="btn btn-white float-right margin-right" v-on:click="_closePage()">
<span><vc:i18n name="取消" namespace="printSmallPayFee"></vc:i18n></span>
</button>
</div>
</div>
<div id="cloudPrintModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">
<span><vc:i18n name="云打印" namespace="printSmallPayFee"></vc:i18n></span>
</h3>
<div class="ibox-content">
<div>
<div id="cloudPrintModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">
<span><vc:i18n name="云打印" namespace="printSmallPayFee"></vc:i18n></span>
</h3>
<div class="ibox-content">
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="打印机" namespace="printSmallPayFee"></vc:i18n></span></label>
<div class="col-sm-10">
<select class="custom-select" v-model="printSmallPayFeeInfo.machineId">
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="打印机" namespace="printSmallPayFee"></vc:i18n></span></label>
<div class="col-sm-10">
<select class="custom-select" v-model="printSmallPayFeeInfo.machineId">
<option selected disabled value="">{{vc.i18n('必填,请选择打印机','printSmallPayFee')}}</option>
<option :value="item.machineId" v-for="(item,index) in printSmallPayFeeInfo.machines">{{item.machineName}}({{item.machineCode}})</option>
</select>
</select>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="数量" namespace="printSmallPayFee"></vc:i18n></span></label>
<div class="col-sm-10"><input v-model="printSmallPayFeeInfo.quantity" type="number" :placeholder="vc.i18n('必填,请填写数量','printSmallPayFee')" class="form-control"></div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="_cloudPrintPayFeeDetail()">
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="数量" namespace="printSmallPayFee"></vc:i18n></span></label>
<div class="col-sm-10"><input v-model="printSmallPayFeeInfo.quantity" type="number" :placeholder="vc.i18n('必填,请填写数量','printSmallPayFee')" class="form-control"></div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="_cloudPrintPayFeeDetail()">
<i class="fa fa-check"></i>&nbsp;提交
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" data-dismiss="modal">
<span><vc:i18n name="取消" namespace="addFloor"></vc:i18n></span>
</button>
</div>
</div>
</div>
</div>
@ -113,5 +114,4 @@
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -6,6 +6,7 @@
receiptId: '',
receiptIds: '',
receiptNum: '',
payOrderId: '',
roomName: '',
amount: 0.00,
fees: [],
@ -79,7 +80,8 @@
function(json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
$that.printSmallPayFeeInfo.receiptNum = _feeReceiptDetails[0].payOrderId;
$that.printSmallPayFeeInfo.receiptNum = _feeReceiptDetails[0].receiptId;
$that.printSmallPayFeeInfo.payOrderId = _feeReceiptDetails[0].payOrderId;
$that.printSmallPayFeeInfo.fees = _feeReceiptDetails;
},
function(errInfo, error) {