优化代码

This commit is contained in:
java110 2022-02-09 13:15:48 +08:00
parent 4fc2a7e97e
commit ac8769cfc6
2 changed files with 260 additions and 0 deletions

View File

@ -0,0 +1,96 @@
<div>
<div>
<div>
<div class=" text-center">
<div style="color:#000;font-size:36px">{{printPayFeeInfo.communityName}} {{printPayFeeInfo.apply == 'Y'?'申请单':'收据单'}}
</div>
<span style="color:#000;font-size:20px">单号:{{printPayFeeInfo.receiptNum}}</span>
</div>
<div style="color:#000;font-size:20px;margin-left:20px">
<div class="float-right text-right">
<span>缴费时间:{{printPayFeeInfo.feeTime}}</span>
</div>
<div class="float-right" style="margin-right: 30%;">
<span>业主:{{printPayFeeInfo.payObjName}}</span>
</div>
</div>
<table class="table vc-table-border" style="color:#000;font-size:20px">
<thead>
<tr>
<th scope="col" class="text-center" width="80px">编号</th>
<th scope="col" class="text-center">收费项目</th>
<th scope="col" class="text-center">房屋/车辆</th>
<th scope="col" class="text-center">收费范围</th>
<th scope="col" class="text-center">周期</th>
<th scope="col" class="text-center">单价/固定费</th>
<th scope="col" class="text-center">面积/用量</th>
<th scope="col" class="text-center">单位</th>
<th scope="col" class="text-center">金额</th>
<th scope="col" class="text-center">备注</th>
</tr>
</thead>
<tbody class="vc-table-border" style="color:#000;font-size:20px">
<tr v-for="(item,index) in printPayFeeInfo.fees" class="vc-table-border">
<th scope="row" class="text-center">{{index +1}}</th>
<td class="text-center">{{item.feeName}}</td>
<td class="text-center">{{item.objName}}</td>
<td class="text-center" v-if="item.preDegrees">
{{vc.dateFormat(item.startTime)}}至{{vc.dateSubOneDay(vc.dateFormat(item.startTime),vc.dateFormat(item.endTime),item.feeFlag)}}</br>
{{item.preDegrees}} 至 {{item.curDegrees}}
</td>
<!-- 根据山东 需求 如果为押金时 显示为无-->
<td class="text-center" v-else-if="item.feeTypeCd == '888800010006'">
</td>
<td class="text-center" v-else>
{{vc.dateFormat(item.startTime)}}至{{vc.dateSubOneDay(vc.dateFormat(item.startTime),vc.dateFormat(item.endTime),item.feeFlag)}}
</td>
<!--<td class="text-center">{{item.startTime}}至{{item.endTime}}</td>-->
<td class="text-center">{{item.cycle}}</td>
<td class="text-center">{{item.squarePrice}}</td>
<td class="text-center">{{item.area}}</td>
<td class="text-center"></td>
<td class="text-center">{{item.amount}}</td>
<td class="text-center" width="200px">{{item.remark}}</td>
</tr>
<tr>
<td colspan="3" class="text-center ">大写人民币(元)</td>
<td colspan="4" class="text-center ">{{vc.changeNumMoneyToChinese(printPayFeeInfo.amount)}}
</td>
<td colspan="3" class="text-center ">{{printPayFeeInfo.amount}}</td>
</tr>
<tr height="60px">
<td colspan="6">
<p style="max-width: 600px;">
<!-- {{printPayFeeInfo.content}} -->
<div v-html="printPayFeeInfo.content"></div>
</p>
</td>
<td colspan="4">
<img :src="printPayFeeInfo.qrImg" width="100px" height="100px">
</td>
</tr>
</tbody>
</table>
</div>
<div class="row">
<div class="col-md-10">
<div class="row" style="color:#000;font-size:20px;margin-left: 10px;">
<div class="float-left" style="width: 20%;">部门负责人:</div>
<div class="float-left" style="width: 20%;">经办人:</div>
<div class="float-left" style="width: 20%;">财务收款:</div>
<div class="float-left" style="width: 20%;">客户确认:</div>
</div>
</div>
<div class="col-md-2" 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>
</div>
</div>

View File

@ -0,0 +1,164 @@
(function (vc) {
vc.extends({
data: {
printPayFeeInfo: {
communityName: '',
receiptId: '',
receiptIds: '',
roomName: '',
amount: 0.00,
fees: [],
feeTime: '',
wechatName: '',
content: '',
qrImg: '',
payObjName:'',
feeReceipt:[],
apply:'N'
},
printFlag: '0'
},
_initMethod: function () {
//vc.component._initPrintPurchaseApplyDateInfo();
$that.printPayFeeInfo.receiptId = vc.getParam('receiptId');
$that.printPayFeeInfo.receiptIds = vc.getParam('receiptIds');
$that.printPayFeeInfo.apply = vc.getParam('apply');
//$that.printPayFeeInfo.feeTime = vc.dateTimeFormat(new Date());
$that.printPayFeeInfo.communityName = vc.getCurrentCommunity().name;
$that._loadReceipt();
$that._loadPrintSpec();
},
_initEvent: function () {
},
methods: {
_initPayFee: function () {
},
_loadReceipt: function () {
var param = {
params: {
page: 1,
row: 30,
receiptId: $that.printPayFeeInfo.receiptId,
receiptIds: $that.printPayFeeInfo.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.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.payObjName = _feeReceipt[0].payObjName;
$that.printPayFeeInfo.feeReceipt = _feeReceipt;
$that._loadReceiptDetail();
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadReceiptDetail: function () {
var param = {
params: {
page: 1,
row: 100,
receiptId: $that.printPayFeeInfo.receiptId,
receiptIds: $that.printPayFeeInfo.receiptIds,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/feeReceipt/queryFeeReceiptDetail',
param,
function (json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
_feeReceiptDetails.forEach(item=>{
$that.printPayFeeInfo.feeReceipt.forEach(im =>{
if(item.receiptId == im.receiptId){
item.objName = im.objName;
item.feeTypeCd = im.feeTypeCd;
}
})
})
$that.printPayFeeInfo.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.printPayFeeInfo.content = _data[0].content;
$that.printPayFeeInfo.qrImg = _data[0].qrImg;
if(_data[0].printName){
$that.printPayFeeInfo.communityName = _data[0].printName;
}
}
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_printPurchaseApplyDiv: function () {
$that.printFlag = '1';
console.log('console.log($that.printFlag);', $that.printFlag);
document.getElementById("print-btn").style.display = "none";//隐藏
window.print();
//$that.printFlag = false;
window.opener = null;
window.close();
},
_closePage: function () {
window.opener = null;
window.close();
}
}
});
})(window.vc);