优化代码

This commit is contained in:
java110 2020-09-27 18:06:40 +08:00
parent c8f2af4199
commit 9dacec6949
6 changed files with 308 additions and 78 deletions

View File

@ -4,81 +4,97 @@
<div class="ibox-title">
<h5>房源信息</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" v-if="viewRentingPoolInfo.index != 2" class="btn btn-primary btn-sm" style="margin-right:10px;" v-on:click="_openSelectRentingPoolInfoModel()">
<i class="glyphicon glyphicon-search"></i> 选择房源</button>
<button type="button" v-if="viewRentingPoolInfo.index != 2" class="btn btn-primary btn-sm" v-on:click="_openAddRentingPoolInfoModel()">
<i class="glyphicon glyphicon-plus"></i> 添加房源</button>
<button type="button" class="btn btn-primary btn-sm" v-on:click="_goBack()">
返回
</button>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-4">
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >出租标题:</label>
<label class="col-form-label">出租标题:</label>
<label class="">{{viewRentingPoolInfo.rentingTitle}}</label>
</div>
</div>
<div class="col-sm-4">
</div>
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >租金:</label>
<label class="col-form-label">租金:</label>
<label class="">{{viewRentingPoolInfo.price}}</label>
</div>
</div>
<div class="col-sm-4">
</div>
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >预付类型:</label>
<label class="">{{viewRentingPoolInfo.paymentType}}</label>
<label class="col-form-label">预付类型:</label>
<label class="">{{viewRentingPoolInfo.paymentTypeName}}</label>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >入住时间:</label>
<label class="">{{viewRentingPoolInfo.checkInDate}}</label>
<label class="col-form-label">入住时间:</label>
<label class="">{{viewRentingPoolInfo.checkIn == '1001'?'立即入住':'预约入住'}}</label>
</div>
</div>
<div class="col-sm-4">
</div>
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >出租配置:</label>
<label class="">{{viewRentingPoolInfo.rentingConfigId}}</label>
<label class="col-form-label">出租配置:</label>
<label class="">{{viewRentingPoolInfo.rentingType=='3344'?'整租':'合租'}}</label>
</div>
</div>
<div class="col-sm-4">
</div>
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >备注:</label>
<label class="col-form-label">备注:</label>
<label class="">{{viewRentingPoolInfo.rentingDesc}}</label>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >业主名称:</label>
<label class="col-form-label">业主名称:</label>
<label class="">{{viewRentingPoolInfo.ownerName}}</label>
</div>
</div>
<div class="col-sm-4">
</div>
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >业主电话:</label>
<label class="col-form-label">业主电话:</label>
<label class="">{{viewRentingPoolInfo.ownerTel}}</label>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label">房屋:</label>
<label class="">{{viewRentingPoolInfo.roomName}}</label>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label">业主服务费:</label>
<label class="">{{viewRentingPoolInfo.serviceOwnerFee}}</label>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label">租客服务费:</label>
<label class="">{{viewRentingPoolInfo.serviceTenantFee}}</label>
</div>
</div>
</div>
</div>
</div>
</div>
<vc:create path="admin/addRentingPool"
callBackListener="viewRentingPoolInfo"
callBackFunction="chooseRentingPool"
></vc:create>
<vc:create path="admin/addRentingPool" callBackListener="viewRentingPoolInfo" callBackFunction="chooseRentingPool">
</vc:create>
<vc:create path="admin/chooseRentingPool"
emitChooseRentingPool="viewRentingPoolInfo"
emitLoadData="viewRentingPoolInfo"
></vc:create>
</div>
<vc:create path="admin/chooseRentingPool" emitChooseRentingPool="viewRentingPoolInfo"
emitLoadData="viewRentingPoolInfo"></vc:create>
</div>

View File

@ -1,53 +1,94 @@
/**
房源 组件
**/
(function(vc){
(function (vc) {
vc.extends({
propTypes: {
callBackListener:vc.propTypes.string, //父组件名称
callBackFunction:vc.propTypes.string //父组件监听方法
},
data:{
viewRentingPoolInfo:{
index:0,
flowComponent:'viewRentingPoolInfo',
rentingTitle:'',
price:'',
paymentType:'',
checkInDate:'',
rentingConfigId:'',
rentingDesc:'',
ownerName:'',
ownerTel:'',
data: {
viewRentingPoolInfo: {
index: 0,
flowComponent: 'viewRentingPoolInfo',
rentingTitle: '',
price: '',
paymentType: '',
checkInDate: '',
rentingConfigId: '',
rentingDesc: '',
ownerName: '',
ownerTel: '',
paymentTypeName: '',
roomName: '',
serviceOwnerFee: 0.0,
serviceTenantFee: 0.0
}
},
_initMethod:function(){
_initMethod: function () {
//根据请求参数查询 查询 业主信息
vc.component._loadRentingPoolInfoData();
},
_initEvent:function(){
vc.on('viewRentingPoolInfo','chooseRentingPool',function(_app){
_initEvent: function () {
vc.on('viewRentingPoolInfo', 'chooseRentingPool', function (_app) {
vc.copyObject(_app, vc.component.viewRentingPoolInfo);
vc.emit($props.callBackListener,$props.callBackFunction,vc.component.viewRentingPoolInfo);
});
vc.on('viewRentingPoolInfo', 'onIndex', function(_index){
vc.on('viewRentingPoolInfo', 'onIndex', function (_index) {
vc.component.viewRentingPoolInfo.index = _index;
});
},
methods:{
methods: {
_openSelectRentingPoolInfoModel(){
vc.emit('chooseRentingPool','openChooseRentingPoolModel',{});
_openSelectRentingPoolInfoModel() {
vc.emit('chooseRentingPool', 'openChooseRentingPoolModel', {});
},
_openAddRentingPoolInfoModel(){
vc.emit('addRentingPool','openAddRentingPoolModal',{});
_openAddRentingPoolInfoModel() {
vc.emit('addRentingPool', 'openAddRentingPoolModal', {});
},
_loadRentingPoolInfoData:function(){
_loadRentingPoolInfoData: function () {
let _rentingId = vc.getParam('rentingId');
var param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
page: 1,
row: 1,
rentingId: _rentingId
}
};
//发送get请求
vc.http.apiGet('/renting/queryRentingPool',
param,
function (json, res) {
var _rentingPoolManageInfo = JSON.parse(json);
let total = _rentingPoolManageInfo.total;
if (total < 1) {
vc.toast('未查询到 房屋出租信息');
return;
}
vc.copyObject(_rentingPoolManageInfo.data[0], $that.viewRentingPoolInfo);
let _data = _rentingPoolManageInfo.data[0];
let _rentingFormula = _data.rentingFormula;
//收费计算公式,1001 固定值 2002 每月租金比例
if (_rentingFormula == '1001') {
$that.viewRentingPoolInfo.serviceOwnerFee = (_data.servicePrice * _data.serviceOwnerRate).toFixed(2);
$that.viewRentingPoolInfo.serviceTenantFee = (_data.servicePrice * _data.serviceTenantRate).toFixed(2);
} else {
let _monthPrice = _data.price;
$that.viewRentingPoolInfo.serviceOwnerFee = (_monthPrice * _data.servicePrice * _data.serviceOwnerRate).toFixed(2);
$that.viewRentingPoolInfo.serviceTenantFee = (_monthPrice * _data.servicePrice * _data.serviceTenantRate).toFixed(2);
}
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_goBack: function () {
vc.goBack();
}
}
});

View File

@ -68,7 +68,7 @@
if (photoFiles && photoFiles.length > 0) {
// 获取目前上传的文件
var file = photoFiles[0];// 文件大小校验的动作
if (file.size > 1024 * 1024 * 1) {
if (file.size > 1024 * 1024 * 2) {
vc.toast("图片大小不能超过 2MB!")
return false;
}

View File

@ -0,0 +1,78 @@
<div>
<vc:create path="admin/viewRentingPoolInfo"></vc:create>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>租房流转</h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<table class="table table-stripped">
<thead>
<tr>
<th scope="col">序号</th>
<th scope="col">处理人</th>
<th scope="col">电话</th>
<th scope="col">状态</th>
<th scope="col">处理时间</th>
<th scope="col">角色</th>
<th scope="col">意见</th>
</tr>
</thead>
<tbody>
<tr v-for="(item,index) in rentingDetailInfo.rentingFlows">
<th scope="row">{{index+1}}</th>
<td>{{item.useName}}</td>
<td>{{item.userTel}}</td>
<td>{{item.stateName}}</td>
<td>{{item.dealTime}}</td>
<td>{{_getUserRole(item.userRole)}}</td>
<td>{{item.context}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>服务费分成</h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<table class="table table-stripped">
<thead>
<tr>
<th scope="col">序号</th>
<th scope="col">费用名称</th>
<th scope="col">分成金额</th>
<th scope="col">支付时间</th>
<th scope="col">收款对象</th>
</tr>
</thead>
<tbody>
<tr v-for="(item,index) in rentingDetailInfo.fees">
<th scope="row">{{index+1}}</th>
<td>{{item.feeName}}</td>
<td>{{item.amount}}</td>
<td>{{item.startTime}}</td>
<td>{{item.incomeObjName}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,95 @@
/**
房源 组件
**/
(function (vc) {
vc.extends({
data: {
rentingDetailInfo: {
rentingFlows:[],
fees:[]
}
},
_initMethod: function () {
//根据请求参数查询 查询 业主信息
$that._loadRentingFlow();
$that._loadRentingFee();
},
_initEvent: function () {
},
methods: {
_loadRentingFlow:function(){
let _rentingId = vc.getParam('rentingId');
var param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
page: 1,
row: 50,
rentingId: _rentingId
}
};
//发送get请求
vc.http.apiGet('/rentingPoolFlow/queryRentingPoolFlow',
param,
function (json, res) {
var _rentingFlow = JSON.parse(json);
let total = _rentingFlow.total;
if (total < 1) {
return;
}
$that.rentingDetailInfo.rentingFlows = _rentingFlow.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_loadRentingFee:function(){
let _rentingId = vc.getParam('rentingId');
var param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
page: 1,
row: 50,
rentingId: _rentingId
}
};
//发送get请求
vc.http.apiGet('/rentingFee/queryFee',
param,
function (json, res) {
var _rentingFlow = JSON.parse(json);
let total = _rentingFlow.total;
if (total < 1) {
return;
}
$that.rentingDetailInfo.fees = _rentingFlow.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_getUserRole:function(_userRole){
if(_userRole == 1){
return "业主";
}else if(_userRole == 2){
return "租客";
}{
return "运营团队";
}
}
}
});
})(window.vc);

View File

@ -72,7 +72,7 @@
}
},
_toRentingHistory:function(rentingPool){
vc.jumpToPage('/admin.html#/pages/admin/rentingDetail?rentingId='+rentingPool.rentingId);
}
}
});