优化代码

This commit is contained in:
java110 2021-05-25 14:07:57 +08:00
parent 06bf2df1a0
commit 99f9673d7c
2 changed files with 91 additions and 23 deletions

View File

@ -6,16 +6,27 @@
<option disabled value="">请选择收费类型</option> <option disabled value="">请选择收费类型</option>
<option selected value="3333">房屋费</option> <option selected value="3333">房屋费</option>
<option value="6666">车位费</option> <option value="6666">车位费</option>
<option value="7777">合同费</option>
</select> </select>
</div> </div>
<div class="col-lg-2 padding-right-xs padding-left-xl" v-if="simplifyFeeReceiptInfo.objType == '6666'"> <div class="col-lg-2 padding-right-xs padding-left-xl" v-if="simplifyFeeReceiptInfo.objType == '6666'">
<select class="custom-select custom-select-sm" v-model="simplifyCarFeeInfo.carId" @change="changeSimplifyFeeReceiptCar()"> <select class="custom-select custom-select-sm" v-model="simplifyCarFeeInfo.carId"
@change="changeSimplifyFeeReceiptCar()">
<option disabled value="">请选择车辆</option> <option disabled value="">请选择车辆</option>
<option v-for="(item,index) in simplifyFeeReceiptInfo.ownerCars" :value="item.carId">{{item.carNum}} <option v-for="(item,index) in simplifyFeeReceiptInfo.ownerCars" :value="item.carId">{{item.carNum}}
</option> </option>
</select> </select>
</div> </div>
<div class="col-lg-2 padding-right-xs padding-left-xl"> <div class="col-lg-2 padding-right-xs padding-left-xl" v-else-if="simplifyFeeReceiptInfo.objType == '7777'">
<select class="custom-select custom-select-sm" v-model="simplifyCarFeeInfo.contractId"
@change="changeSimplifyFeeReceiptCar()">
<option disabled value="">请选择合同</option>
<option v-for="(item,index) in simplifyFeeReceiptInfo.ownerContracts" :value="item.contractId">
{{item.contractCode}}
</option>
</select>
</div>
<div class="col-lg-2 padding-right-xs padding-left-xl" v-if="simplifyFeeReceiptInfo.objType != '7777'">
<select class="custom-select custom-select-sm" v-model="simplifyFeeReceiptInfo.ownerFlag" <select class="custom-select custom-select-sm" v-model="simplifyFeeReceiptInfo.ownerFlag"
@change="_queryFeeReceiptMethod()"> @change="_queryFeeReceiptMethod()">
<option value="F">当前{{simplifyFeeReceiptInfo.objType == '6666'?'车辆':'房屋'}}</option> <option value="F">当前{{simplifyFeeReceiptInfo.objType == '6666'?'车辆':'房屋'}}</option>
@ -49,7 +60,7 @@
@click="checkAllReceipt($event)"> @click="checkAllReceipt($event)">
</th> </th>
<th class="text-center">费用类型</th> <th class="text-center">费用类型</th>
<th class="text-center">{{simplifyFeeReceiptInfo.objType == '3333'?'房屋':'车位'}}</th> <th class="text-center">{{_getFeeObjName(simplifyFeeReceiptInfo.objType)}}</th>
<th class="text-center">总金额</th> <th class="text-center">总金额</th>
<th class="text-center">缴费时间</th> <th class="text-center">缴费时间</th>
<th class="text-center">收据ID</th> <th class="text-center">收据ID</th>
@ -61,7 +72,7 @@
<input type="checkbox" class="i-checks checReceiptItem" v-bind:value="feeReceipt.receiptId" <input type="checkbox" class="i-checks checReceiptItem" v-bind:value="feeReceipt.receiptId"
v-model="simplifyFeeReceiptInfo.selectReceipts"> v-model="simplifyFeeReceiptInfo.selectReceipts">
</td> </td>
<td class="text-center">{{feeReceipt.objType == '3333'? '房屋费':'车位费'}}</td> <td class="text-center">{{_getFeeObjName(feeReceipt.objType)}}费</td>
<td class="text-center">{{feeReceipt.objName}}</td> <td class="text-center">{{feeReceipt.objName}}</td>
<td class="text-center">{{feeReceipt.amount}}</td> <td class="text-center">{{feeReceipt.amount}}</td>
<td class="text-center">{{feeReceipt.createTime}}</td> <td class="text-center">{{feeReceipt.createTime}}</td>

View File

@ -17,8 +17,10 @@
records: '', records: '',
ownerId: '', ownerId: '',
ownerCars: [], ownerCars: [],
ownerContracts: [],
selectReceipts: [], selectReceipts: [],
ownerFlag: 'F', ownerFlag: 'F',
contractId: '',
quan: false quan: false
} }
}, },
@ -65,9 +67,15 @@
_listSimplifyFeeReceipt: function (_page, _rows) { _listSimplifyFeeReceipt: function (_page, _rows) {
$that.simplifyFeeReceiptInfo.selectReceipts = []; $that.simplifyFeeReceiptInfo.selectReceipts = [];
$that.simplifyFeeReceiptInfo.quan = false; $that.simplifyFeeReceiptInfo.quan = false;
let _objId = $that.simplifyFeeReceiptInfo.objType == '3333' let _objId = '';
? $that.simplifyFeeReceiptInfo.roomId
: $that.simplifyFeeReceiptInfo.carId; if ($that.simplifyFeeReceiptInfo.objType == '3333') {
_objId = $that.simplifyFeeReceiptInfo.roomId
} else if ($that.simplifyFeeReceiptInfo.objType == '6666') {
_objId = $that.simplifyFeeReceiptInfo.carId
} else {
_objId = $that.simplifyFeeReceiptInfo.contractId
}
var param = { var param = {
params: { params: {
page: _page, page: _page,
@ -157,8 +165,10 @@
records: '', records: '',
ownerId: '', ownerId: '',
ownerCars: [], ownerCars: [],
ownerContracts: [],
selectReceipts: [], selectReceipts: [],
ownerFlag: 'F', ownerFlag: 'F',
contractId: '',
quan: false quan: false
} }
}, },
@ -166,14 +176,22 @@
if ($that.simplifyFeeReceiptInfo.objType == '3333') { if ($that.simplifyFeeReceiptInfo.objType == '3333') {
vc.emit('simplifyFeeReceipt', 'notify', {}); vc.emit('simplifyFeeReceipt', 'notify', {});
return; } else if ($that.simplifyFeeReceiptInfo.objType == '6666') {
}
$that._listSimplifyFeeReceiptOwnerCar() $that._listSimplifyFeeReceiptOwnerCar()
.then((data) => { .then((data) => {
vc.emit('simplifyFeeReceipt', 'notify', {}); vc.emit('simplifyFeeReceipt', 'notify', {});
}, (err) => { }, (err) => {
//vc.toast(err); //vc.toast(err);
}) })
} else {
$that._listSimplifyFeeReceiptOwnerContract()
.then((data) => {
vc.emit('simplifyFeeReceipt', 'notify', {});
}, (err) => {
//vc.toast(err);
})
}
}, },
changeSimplifyFeeReceiptCar: function () { changeSimplifyFeeReceiptCar: function () {
$that._changeSimplifyFeeReceiptFeeTypeCd(); $that._changeSimplifyFeeReceiptFeeTypeCd();
@ -204,6 +222,34 @@
reject(errInfo); reject(errInfo);
} }
); );
})
},
_listSimplifyFeeReceiptOwnerContract: function () {
return new Promise((resolve, reject) => {
let param = {
params: {
page: 1,
row: 50,
objId: $that.simplifyFeeReceiptInfo.ownerId,
communityId: vc.getCurrentCommunity().communityId
}
}
//发送get请求
vc.http.apiGet('/contract/queryContract',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.simplifyFeeReceiptInfo.ownerContracts = _json.data;
if (_json.data.length > 0) {
$that.simplifyFeeReceiptInfo.contractId = _json.data[0].contractId;
resolve(_json.data);
return;
}
reject("没有车位");
}, function (errInfo, error) {
reject(errInfo);
}
);
}) })
@ -219,6 +265,17 @@
} else { // 如果是去掉全选则清空checkbox选项绑定数组 } else { // 如果是去掉全选则清空checkbox选项绑定数组
vc.component.simplifyFeeReceiptInfo.selectReceipts = []; vc.component.simplifyFeeReceiptInfo.selectReceipts = [];
} }
},
_getFeeObjName:function(_feeTypeCd){
if(_feeTypeCd == '3333'){
return '房屋';
}else if(_feeTypeCd == '6666'){
return '车位';
}else{
return '合同';
}
} }
} }
}); });