优化代码

This commit is contained in:
java110 2022-06-14 14:01:17 +08:00
parent a512035f4a
commit 9fe45bda3e
3 changed files with 127 additions and 101 deletions

View File

@ -1,4 +1,4 @@
(function (vc) {
(function(vc) {
vc.extends({
data: {
prestoreAccountInfo: {
@ -8,21 +8,20 @@
amount: '',
remark: '',
acctTypes: [],
acctType: '',
acctType: '2003',
}
},
_initMethod: function () {
},
_initEvent: function () {
vc.on('prestoreAccount', 'openAddModal', function () {
_initMethod: function() {},
_initEvent: function() {
vc.on('prestoreAccount', 'openAddModal', function() {
$('#prestoreAccountModel').modal('show');
//与字典表单位关联
vc.getDict('account', "acct_type", function (_data) {
vc.getDict('account', "acct_type", function(_data) {
vc.component.prestoreAccountInfo.acctTypes = _data;
});
});
vc.on('prestoreAccount', 'openAddModalWithParams', function (_param) {
vc.on('prestoreAccount', 'openAddModalWithParams', function(_param) {
vc.component.prestoreAccountInfo.amount = _param.redepositAmount;
$('#prestoreAccountModel').modal('show');
});
@ -32,15 +31,12 @@
return vc.validate.validate({
prestoreAccountInfo: vc.component.prestoreAccountInfo
}, {
'prestoreAccountInfo.ownerId': [
{
limit: "required",
param: "",
errInfo: "业主不能为空"
}
],
'prestoreAccountInfo.amount': [
{
'prestoreAccountInfo.ownerId': [{
limit: "required",
param: "",
errInfo: "业主不能为空"
}],
'prestoreAccountInfo.amount': [{
limit: "required",
param: "",
errInfo: "金额不能为空"
@ -51,23 +47,19 @@
errInfo: "金额格式错误"
},
],
'prestoreAccountInfo.acctType': [
{
limit: "required",
param: "",
errInfo: "请选择账户类型"
}
],
'prestoreAccountInfo.remark': [
{
limit: "maxLength",
param: "200",
errInfo: "备注长度不能超过200位"
}
]
'prestoreAccountInfo.acctType': [{
limit: "required",
param: "",
errInfo: "请选择账户类型"
}],
'prestoreAccountInfo.remark': [{
limit: "maxLength",
param: "200",
errInfo: "备注长度不能超过200位"
}]
});
},
savePrestoreAccountInfo: function () {
savePrestoreAccountInfo: function() {
if (!vc.component.prestoreAccountValidate()) {
vc.toast(vc.validate.errInfo);
return;
@ -75,11 +67,10 @@
vc.component.prestoreAccountInfo.communityId = vc.getCurrentCommunity().communityId;
vc.http.apiPost(
'/account/ownerPrestoreAccount',
JSON.stringify(vc.component.prestoreAccountInfo),
{
JSON.stringify(vc.component.prestoreAccountInfo), {
emulateJSON: true
},
function (json, res) {
function(json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
//关闭model
@ -91,12 +82,12 @@
}
vc.component.prestoreAccountInfo.errorInfo = json;
},
function (errInfo, error) {
function(errInfo, error) {
console.log('请求失败处理');
vc.component.prestoreAccountInfo.errorInfo = errInfo;
});
},
clearPrestoreAccountInfo: function () {
clearPrestoreAccountInfo: function() {
vc.component.prestoreAccountInfo = {
tel: '',
ownerId: '',
@ -104,27 +95,28 @@
amount: '',
remark: '',
acctTypes: [],
acctType: '',
acctType: '2003',
};
},
_changeTel: function () {
_changeTel: function() {
var param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
row: 50,
page: 1,
link: $that.prestoreAccountInfo.tel,
ownerTypeCd: '1001'
params: {
communityId: vc.getCurrentCommunity().communityId,
row: 50,
page: 1,
link: $that.prestoreAccountInfo.tel,
ownerTypeCd: '1001'
}
}
}
//发送get请求
//发送get请求
vc.http.get('listOwner',
'list',
param,
function (json, res) {
function(json, res) {
var listOwnerData = JSON.parse(json);
vc.component.prestoreAccountInfo.owners = listOwnerData.owners;
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
vc.component.prestoreAccountInfo.owners = [];
}

View File

@ -5,19 +5,18 @@
<div class="float-left" style="width:600px;margin-left: 40px;">
<span>{{printPayFeeInfo.payObjName}}</span>
</div>
<div class="float-left text-center"
v-if="printPayFeeInfo.feeReceipt && printPayFeeInfo.feeReceipt.length>0">
<div class="float-left text-center" v-if="printPayFeeInfo.feeReceipt && printPayFeeInfo.feeReceipt.length>0">
<span>{{printPayFeeInfo.feeReceipt[0].objName}}</span>
</div>
</div>
<table class="table vc-table-border" style="color:#000;font-size:20px ;border:0">
<thead>
<tr style="border: 0px;">
<th scope="col" class="text-center" style="border: 0px;width: 30%"><span><vc:i18n name="收费项目" namespace="printPayFeeXinShiDai"></vc:i18n></span></th>
<th scope="col" class="text-center" style="border: 0px;width: 30%"><span><vc:i18n name="摘要" namespace="printPayFeeXinShiDai"></vc:i18n></span></th>
<th scope="col" class="text-center" style="border: 0px;width: 20%"><span><vc:i18n name="滞纳金" namespace="printPayFeeXinShiDai"></vc:i18n></span></th>
<th scope="col" class="text-left" style="border: 0px;width: 20%"><span><vc:i18n name="金额" namespace="printPayFeeXinShiDai"></vc:i18n></span></th>
<th scope="col" class="text-center" style="border: 0px;"></th>
<tr style="border: 0px;">
<th scope="col" class="text-center" style="border: 0px;width: 30%"><span><vc:i18n name="收费项目" namespace="printPayFeeXinShiDai"></vc:i18n></span></th>
<th scope="col" class="text-center" style="border: 0px;width: 30%"><span><vc:i18n name="摘要" namespace="printPayFeeXinShiDai"></vc:i18n></span></th>
<th scope="col" class="text-center" style="border: 0px;width: 20%"><span><vc:i18n name="滞纳金" namespace="printPayFeeXinShiDai"></vc:i18n></span></th>
<th scope="col" class="text-left" style="border: 0px;width: 20%"><span><vc:i18n name="金额" namespace="printPayFeeXinShiDai"></vc:i18n></span></th>
<th scope="col" class="text-center" style="border: 0px;"></th>
</tr>
</thead>
<tbody class="vc-table-border" style="color:#000;font-size:20px;border: 0px;">
@ -34,13 +33,13 @@
<td class="text-center" style="border: 0px;" v-else>
{{vc.dateFormat(item.startTime)}}<span><vc:i18n name="至" namespace="printPayFeeXinShiDai"></vc:i18n></span>{{vc.dateSubOneDay(vc.dateFormat(item.startTime),vc.dateFormat(item.endTime),item.feeFlag)}}
</td>
<td class="text-center" style="border: 0px;">0.00</td>
<td class="text-center" style="border: 0px;">{{item.discountPrice}}</td>
<td class="text-left" style="border: 0px;">{{item.amount}}</td>
<td class="text-center" style="border: 0px;"></td>
</tr>
<tr style="border: 0px;">
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;">
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;">
(大写){{vc.changeNumMoneyToChinese(printPayFeeInfo.amount)}}
</td>
<td class="text-center" style="border: 0px;">: </td>
@ -48,33 +47,33 @@
<td class="text-center" style="border: 0px;"></td>
</tr>
<tr style="border: 0px;">
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td colspan="1" class="text-center" style="border: 0px;">{{printPayFeeInfo.feeTime}}</td>
<td class="text-center" style="border: 0px;"></td>
</tr>
<tr style="border: 0px;">
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"><span><vc:i18n name="单号" namespace="printPayFeeXinShiDai"></vc:i18n></span></td>
<td colspan="1" class="text-center" style="border: 0px;">{{printPayFeeInfo.receiptNum}}</td>
<td class="text-center" style="border: 0px;"></td>
</tr>
<tr style="border: 0px;" v-if="printPayFeeInfo.carName">
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"><span><vc:i18n name="车辆" namespace="printPayFeeXinShiDai"></vc:i18n></span></td>
<td colspan="1" class="text-center" style="border: 0px;">{{printPayFeeInfo.carName}}</td>
<td class="text-center" style="border: 0px;"></td>
</tr>
<tr style="border: 0px;">
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td colspan="1" class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
</tr>
<tr style="border: 0px;">
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td class="text-center" style="border: 0px;"></td>
<td colspan="1" class="text-center" style="border: 0px;">{{printPayFeeInfo.userName}}</td>
<td class="text-center" style="border: 0px;"></td>
</tr>
@ -87,10 +86,9 @@
<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()"><span><vc:i18n name="取消" namespace="printPayFeeXinShiDai"></vc:i18n></span>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" v-on:click="_closePage()"><span><vc:i18n name="取消" namespace="printPayFeeXinShiDai"></vc:i18n></span>
</button>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
(function (vc) {
(function(vc) {
vc.extends({
data: {
@ -21,7 +21,7 @@
},
printFlag: '0'
},
_initMethod: function () {
_initMethod: function() {
//vc.component._initPrintPurchaseApplyDateInfo();
$that.printPayFeeInfo.receiptId = vc.getParam('receiptId');
@ -36,15 +36,15 @@
$that._loadPrintSpec();
},
_initEvent: function () {
_initEvent: function() {
},
methods: {
_initPayFee: function () {
_initPayFee: function() {
},
_loadReceipt: function () {
_loadReceipt: function() {
var param = {
params: {
@ -59,7 +59,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;
@ -82,14 +82,15 @@
$that._listOwnerCar(_feeReceipt[0].objId);
}
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadReceiptDetail: function () {
_loadReceiptDetail: function() {
var param = {
let param = {
params: {
page: 1,
row: 100,
@ -101,7 +102,7 @@
//发送get请求
vc.http.apiGet('/feeReceipt/queryFeeReceiptDetail',
param,
function (json, res) {
function(json, res) {
var _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
_feeReceiptDetails.forEach(item => {
@ -110,15 +111,48 @@
item.objName = im.objName;
item.feeTypeCd = im.feeTypeCd;
}
})
});
$that._queryFeeDetailDiscount(item.detailId, item);
})
$that.printPayFeeInfo.fees = _feeReceiptDetails;
}, function (errInfo, error) {
setTimeout(function() {
$that.$forceUpdate();
}, 2000)
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadPrintSpec: function () {
_queryFeeDetailDiscount: function(_detailId, _item) {
let param = {
params: {
page: 1,
row: 100,
detailId: _detailId,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/feeDiscount/queryFeeDetailDiscount',
param,
function(json, res) {
let _feeReceiptManageInfo = JSON.parse(json);
let _feeReceiptDetails = _feeReceiptManageInfo.data;
_feeReceiptDetails.forEach(data => {
if (data.discountType == '2002') {
_item.discountPrice = parseFloat(data.discountPrice) * -1;
}
})
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadPrintSpec: function() {
var param = {
params: {
page: 1,
@ -131,7 +165,7 @@
//发送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) {
@ -141,44 +175,46 @@
$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();
},
_listOwnerCar: function (_carId) {
_listOwnerCar: function(_carId) {
let param = {
params: {
page: 1,
row: 1,
communityId: vc.getCurrentCommunity().communityId,
carId: _carId
params: {
page: 1,
row: 1,
communityId: vc.getCurrentCommunity().communityId,
carId: _carId
}
}
}
//发送get请求
//发送get请求
vc.http.apiGet('owner.queryOwnerCars',
param,
function (json, res) {
function(json, res) {
let _json = JSON.parse(json);
let ownerCar = _json.data[0];
let _roomName = ownerCar.roomName.replace('栋','-').replace("单元",'-').replace('室','');
let _roomName = ownerCar.roomName.replace('栋', '-').replace("单元", '-').replace('室', '');
$that.printPayFeeInfo.feeReceipt[0].objName = _roomName;
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
@ -186,4 +222,4 @@
}
});
})(window.vc);
})(window.vc);