优化代码

This commit is contained in:
java110 2020-09-15 18:49:22 +08:00
parent 67404beb1d
commit ba462f80db
7 changed files with 259 additions and 30 deletions

8
app.js
View File

@ -36,12 +36,12 @@ let opts = {
//app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
app.use('/app',proxy('http://api.demo.winqi.cn:8012',opts));
//app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
//app.use('/app',proxy('http://api.demo.winqi.cn:8012',opts));
//app.use('/callComponent',proxy('http://192.168.1.16:8012',opts));
//app.use('/app',proxy('http://192.168.1.16:8012',opts));
app.use('/callComponent',proxy('http://192.168.1.16:8012',opts));
app.use('/app',proxy('http://192.168.1.16:8012',opts));
//app.listen(3000);
app.use(express.json());

View File

@ -0,0 +1,54 @@
<div id="confirmRentingModel" class="modal fade" tabindex="-1" 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 ">确认租房</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">租客</label>
<div class="col-sm-10">
<input v-model="confirmRentingInfo.tenantName" disabled="disabled" type="text"
placeholder="选填,请填写备注" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">小区</label>
<div class="col-sm-10">
<select class="custom-select" v-model="confirmRentingInfo.communityId" @change="_changeCommunity()">
<option selected disabled value="">必填,请选择小区</option>
<option v-for="(item,index) in confirmRentingInfo.communitys"
:value="item.communityId">
{{item.name}}</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">房源</label>
<div class="col-sm-8">
<select class="custom-select" v-model="confirmRentingInfo.rentingId">
<option selected disabled value="">必填,请选择房源</option>
<option v-for="(item,index) in confirmRentingInfo.rentingPools"
:value="item.rentingId">
{{item.roomName}}</option>
</select>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary float-right">手工输入</button>
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button"
v-on:click="confirmRenting()"><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>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,124 @@
(function (vc, vm) {
vc.extends({
data: {
confirmRentingInfo: {
msg: '',
appointmentId: '',
tenantName: '',
communityId: '',
communitys: [],
rentingPools: [],
rentingId: ''
}
},
_initMethod: function () {
$that._loadCommunitys();
},
_initEvent: function () {
vc.on('confirmRenting', 'openConfirmRentingModal', function (_params) {
//vc.component.confirmRentingInfo = _params;
vc.copyObject(_params, $that.confirmRentingInfo);
$('#confirmRentingModel').modal('show');
});
},
methods: {
confirmRenting: function () {
let data = {
appointmentId: $that.confirmRentingInfo.appointmentId,
rentingId: $that.confirmRentingInfo.rentingId
};
vc.http.apiPost(
'/rentingAppointment/confirmRenting',
JSON.stringify(data),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
//关闭model
$('#confirmRentingModel').modal('hide');
$that._clearRentingAppointment();
vc.emit('rentingAppointmentManage', 'listRentingAppointment', {});
return;
}
vc.message(_json.msg);
},
function (errInfo, error) {
console.log('请求失败处理');
vc.message(json);
});
},
closeConfirmRentingModel: function () {
$('#confirmRentingModel').modal('hide');
},
_clearRentingAppointment: function () {
let _communitys = $that.confirmRentingInfo.communitys;
$that.confirmRentingInfo = {
msg: '',
appointmentId: '',
tenantName: '',
communityId: '',
communitys: _communitys,
rentingPools: [],
rentingId: ''
}
},
_loadCommunitys: function () {
let param = {
params: {
_uId: 'ccdd00opikookjuhyyttvhnnjuuu',
page: 1,
row: 50
}
};
vc.http.get('initData',
'getCommunitys',
param,
function (json, res) {
if (res.status == 200) {
let _communityInfos = JSON.parse(json).communitys;
$that.confirmRentingInfo.communitys = _communityInfos;
}
}, function () {
console.log('请求失败处理');
vc.jumpToPage(_param.url);
}
);
},
_changeCommunity: function () {
$that._listRentingPoolsByConfirmRenting();
},
_listRentingPoolsByConfirmRenting: function (_page, _rows) {
var param = {
params: {
page: 1,
row: 100,
communityId: $that.confirmRentingInfo.communityId,
state: '1,2,3,4,5'
}
};
//发送get请求
vc.http.apiGet('/renting/queryRentingPool',
param,
function (json, res) {
var _rentingPoolManageInfo = JSON.parse(json);
vc.component.confirmRentingInfo.rentingPools = _rentingPoolManageInfo.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
}
});
})(window.vc, window.vc.component);

View File

@ -1,19 +1,36 @@
<div class="modal fade" id="deleteRentingAppointmentModel" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div id="deleteRentingAppointmentModel" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">请确认您的操作!</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<tr align="center"><th>确定删除租赁预约</th></tr>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" v-on:click="closeDeleteRentingAppointmentModel()">点错了</button>
<button type="button" class="btn btn-primary" v-on:click="deleteRentingAppointment()">确认删除</button>
<h3 class="m-t-none m-b ">放弃租房</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">租客</label>
<div class="col-sm-10">
<input v-model="deleteRentingAppointmentInfo.tenantName" disabled="disabled" type="text" placeholder="选填,请填写备注"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">原因</label>
<div class="col-sm-10">
<textarea v-model="deleteRentingAppointmentInfo.msg" placeholder="选填,请填写备注"
class="form-control"></textarea>
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button"
v-on:click="deleteRentingAppointment()"><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>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -3,7 +3,9 @@
vc.extends({
data: {
deleteRentingAppointmentInfo: {
msg: '',
appointmentId: '',
tenantName: ''
}
},
_initMethod: function () {
@ -12,17 +14,28 @@
_initEvent: function () {
vc.on('deleteRentingAppointment', 'openDeleteRentingAppointmentModal', function (_params) {
vc.component.deleteRentingAppointmentInfo = _params;
//vc.component.deleteRentingAppointmentInfo = _params;
vc.copyObject(_params, $that.deleteRentingAppointmentInfo);
$('#deleteRentingAppointmentModel').modal('show');
});
},
methods: {
deleteRentingAppointment: function () {
vc.component.deleteRentingAppointmentInfo.communityId = vc.getCurrentCommunity().communityId;
let data = {
appointmentId: $that.deleteRentingAppointmentInfo.appointmentId,
state: '2002',
msg: $that.deleteRentingAppointmentInfo.msg
};
if (data.msg == '') {
vc.toast('请填写原因');
return;
}
vc.http.apiPost(
'/rentingAppointment/deleteRentingAppointment',
JSON.stringify(vc.component.deleteRentingAppointmentInfo),
'/rentingAppointment/updateRentingAppointment',
JSON.stringify(data),
{
emulateJSON: true
},
@ -32,6 +45,7 @@
if (_json.code == 0) {
//关闭model
$('#deleteRentingAppointmentModel').modal('hide');
$that._clearRentingAppointment();
vc.emit('rentingAppointmentManage', 'listRentingAppointment', {});
return;
}
@ -45,6 +59,13 @@
},
closeDeleteRentingAppointmentModel: function () {
$('#deleteRentingAppointmentModel').modal('hide');
},
_clearRentingAppointment: function () {
$that.deleteRentingAppointmentInfo = {
msg: '',
appointmentId: '',
tenantName: ''
}
}
}
});

View File

@ -24,9 +24,12 @@
</div>
<div class="col-sm-3">
<div class="form-group">
<input type="text" placeholder="请输入预约房屋编号"
v-model="rentingAppointmentManageInfo.conditions.appointmentRoomId"
class=" form-control">
<select class="custom-select" v-model="rentingAppointmentManageInfo.conditions.state">
<option selected value="">请选择状态</option>
<option value="1001">未租房</option>
<option value="2002">租房失败</option>
<option value="3003">租房成功</option>
</select>
</div>
</div>
<div class="col-sm-1">
@ -65,6 +68,7 @@
<th class="text-center">租客电话</th>
<th class="text-center">预约时间</th>
<th class="text-center">预约房屋</th>
<th class="text-center">状态</th>
<th class="text-center">备注</th>
<th class="text-right">操作</th>
</tr>
@ -76,15 +80,20 @@
<td class="text-center">{{rentingAppointment.tenantTel}}</td>
<td class="text-center">{{rentingAppointment.appointmentTime}}</td>
<td class="text-center">{{rentingAppointment.appointmentRoomId}}</td>
<td class="text-center">{{rentingAppointment.stateName}}</td>
<td class="text-center">{{rentingAppointment.remark}}</td>
<td class="text-right">
<div class="btn-group" v-if="rentingAppointment.state == '1001'">
<button class="btn-white btn btn-xs"
v-on:click="_openRentingModel(rentingAppointment)">确认租房</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openEditRentingAppointmentModel(rentingAppointment)">修改</button>
</div>
<div class="btn-group">
<div class="btn-group" v-if="rentingAppointment.state == '1001'">
<button class="btn-white btn btn-xs"
v-on:click="_openDeleteRentingAppointmentModel(rentingAppointment)">删除</button>
v-on:click="_openDeleteRentingAppointmentModel(rentingAppointment)">放弃</button>
</div>
</td>
@ -110,5 +119,6 @@
<vc:create path="admin/addRentingAppointment" callBackListener="" callBackFunction=""></vc:create>
<vc:create path="admin/editRentingAppointment"></vc:create>
<vc:create path="admin/deleteRentingAppointment"></vc:create>
<vc:create path="admin/confirmRenting"></vc:create>
</div>

View File

@ -15,8 +15,7 @@
conditions: {
tenantName: '',
tenantTel: '',
appointmentRoomId: '',
state: '1001',
}
}
},
@ -77,6 +76,10 @@
} else {
vc.component.rentingAppointmentManageInfo.moreCondition = true;
}
},
_openRentingModel:function(_rentingAppointment){
//确认租房
vc.emit('confirmRenting', 'openConfirmRentingModal',_rentingAppointment);
}