优化商铺功能

This commit is contained in:
java110 2021-01-12 07:16:28 +08:00
parent 855afbd478
commit 8f2642e155
6 changed files with 263 additions and 16 deletions

View File

@ -19,11 +19,10 @@
vc.on('addShops', 'addShopsModel', function (_params) {
vc.component.refreshAddShopsInfo();
$('#addShopsModel').modal('show');
vc.component.addShopsInfo.floorId = _params.floorId;
vc.component.addShopsInfo.communityId = vc.getCurrentCommunity().communityId;
});
vc.on('addShops', 'notify', function (_param) {
vc.on('addShops', 'addShops', 'notify', function (_param) {
if (_param.hasOwnProperty('floorId')) {
$that.addShopsInfo.floorId = _param.floorId;
}
@ -122,8 +121,7 @@
if (res.status == 200) {
//关闭model
$('#addShopsModel').modal('hide');
vc.emit('room', 'loadData', {
floorId: vc.component.addShopsInfo.floorId
vc.emit('shops', 'loadData', {
});
return;
}

View File

@ -0,0 +1,53 @@
<div id="bindOwnerShopsModel" class="modal fade" 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="bindOwnerShopsInfo.shopsName" 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"><input v-model="bindOwnerShopsInfo.tel" @blur="_shopsLoadOwnerInfo" type="number"
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"><input v-model="bindOwnerShopsInfo.ownerName" 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"><input v-model="bindOwnerShopsInfo.startTime" type="text"
placeholder="必填,请填写起租时间" class="form-control hireStartTime"></div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">截租时间</label>
<div class="col-sm-10"><input v-model="bindOwnerShopsInfo.feeCoefficient" type="text"
placeholder="必填,请填写截租时间" class="form-control hireEndTime"></div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">备注</label>
<div class="col-sm-10">
<textarea v-model="bindOwnerShopsInfo.remark" placeholder="请填写备注信息"
class="form-control"></textarea>
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="bindOwnerShops()"><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,179 @@
(function (vc, vm) {
vc.extends({
data: {
bindOwnerShopsInfo: {
roomId: '',
roomNum: '',
shopsName: '',
ownerId: '',
ownerName: '',
tel: '',
startTime: '',
endTime: '',
remark: '',
communityId: '',
shopsState:'2006'
}
},
_initMethod: function () {
vc.initDate('hireStartTime', function (_startTime) {
$that.bindOwnerShopsInfo.startTime = _startTime;
});
vc.initDate('hireEndTime', function (_endTime) {
$that.bindOwnerShopsInfo.endTime = _endTime;
let start = Date.parse(new Date($that.bindOwnerShopsInfo.startTime))
let end = Date.parse(new Date($that.bindOwnerShopsInfo.endTime))
if (start - end >= 0) {
vc.toast("结束时间必须大于开始时间")
$that.bindOwnerShopsInfo.endTime = '';
}
});
},
_initEvent: function () {
vc.on('bindOwnerShops', 'bindOwnerShopsModel', function (_params) {
vc.component.refreshAddShopsInfo();
$that.bindOwnerShopsInfo.roomId = _params.roomId;
$that.bindOwnerShopsInfo.shopsState = _params.shopsState;
$that.bindOwnerShopsInfo.shopsName = _params.floorNum + '-' + _params.roomNum;
$('#bindOwnerShopsModel').modal('show');
vc.component.bindOwnerShopsInfo.communityId = vc.getCurrentCommunity().communityId;
});
},
methods: {
bindOwnerShopsValidate: function () {
return vc.validate.validate({
bindOwnerShopsInfo: vc.component.bindOwnerShopsInfo
}, {
'bindOwnerShopsInfo.roomId': [
{
limit: "required",
param: "",
errInfo: "商铺不能为空"
}
],
'bindOwnerShopsInfo.tel': [
{
limit: "required",
param: "",
errInfo: "手机号不能为空"
},
{
limit: "phone",
param: "",
errInfo: "手机号格式错误"
}
],
'bindOwnerShopsInfo.ownerName': [
{
limit: "required",
param: "",
errInfo: "租户名称不能为空"
}
],
'bindOwnerShopsInfo.startTime': [
{
limit: "required",
param: "",
errInfo: "起租时间不能为空"
}
],
'bindOwnerShopsInfo.endTime': [
{
limit: "required",
param: "",
errInfo: "截租时间不能为空"
}
],
'bindOwnerShopsInfo.remark': [
{
limit: "maxLength",
param: "200",
errInfo: "备注长度不能超过200位"
},
]
});
},
bindOwnerShops: function () {
if (!vc.component.bindOwnerShopsValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
vc.http.apiPost(
'room.saveOwnerShops',
JSON.stringify(vc.component.bindOwnerShopsInfo),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
//关闭model
$('#bindOwnerShopsModel').modal('hide');
vc.emit('shops', 'loadData', {
});
return;
}
vc.toast(json);
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
_shopsLoadOwnerInfo: function () {
if ($that.bindOwnerShopsInfo.tel == '') {
return;
}
let param = {
params: {
page: 1,
row: 1,
communityId: vc.getCurrentCommunity().communityId,
ownerTypeCd: 1001,
link: $that.bindOwnerShopsInfo.tel
}
}
//发送get请求
vc.http.get('listOwner',
'list',
param,
function (json, res) {
let listOwnerData = JSON.parse(json);
let owners = listOwnerData.owners;
if (listOwnerData.total > 0) {
$that.bindOwnerShopsInfo.ownerId = owners[0].ownerId;
$that.bindOwnerShopsInfo.ownerName = owners[0].name;
}else{
$that.bindOwnerShopsInfo.ownerId = '';
$that.bindOwnerShopsInfo.ownerName = '';
}
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
refreshAddShopsInfo: function () {
vc.component.bindOwnerShopsInfo = {
roomId: '',
roomNum: '',
shopsName: '',
ownerId: '',
ownerName: '',
tel: '',
startTime: '',
endTime: '',
remark: '',
communityId: '',
shopsState:'2006'
}
}
}
});
})(window.vc, window.vc.component);

View File

@ -22,11 +22,9 @@
<select class="form-control-sm form-control input-s-sm inline"
v-model="shopsInfo.conditions.state">
<option selected value="">请选择状态</option>
<option value="2002">未销售</option>
<option value="2001">已入住</option>
<option value="2003">已交房</option>
<option value="2004">未入住</option>
<option value="2005">已装修</option>
<option value="2006">已出租</option>
<option value="2007">已出售</option>
<option value="2008">空闲</option>
</select>
</div>
<div class="col-sm-4">
@ -107,7 +105,7 @@
<td class="text-right">
<div class="btn-group" v-if="vc.hasPrivilege('502020082493857941')">
<button class="btn-white btn btn-xs"
v-on:click="_openEditShopsModel(shops)">出租</button>
v-on:click="_openHireShopsModel(shops)">出租</button>
</div>
<div class="btn-group" v-if="vc.hasPrivilege('502020082493857941')">
<button class="btn-white btn btn-xs"
@ -141,6 +139,7 @@
</div>
<vc:create path="property/addShops" emitChooseFloor="shops" emitLoadData="shops"></vc:create>
<vc:create path="property/bindOwnerShops" emitChooseFloor="shops" emitLoadData="shops"></vc:create>
<!--
<vc:create path="property/editShops"></vc:create>
<vc:create path="property/deleteShops"></vc:create> -->

View File

@ -94,6 +94,10 @@
_openAddShops: function () {
vc.emit('addShops', 'addShopsModel',{});
},
_openHireShopsModel:function(_shops){
_shops.shopsState='2006';
vc.emit('bindOwnerShops', 'bindOwnerShopsModel',_shops);
},
_openEditShopsModel: function (_shops) {
//_shops.floorId = vc.component.shopsInfo.conditions.floorId;
vc.emit('editShops', 'openEditShopsModal', _shops);

View File

@ -1649,12 +1649,26 @@
//vc.component.addFeeConfigInfo.startTime = value;
_callBack(value);
});
//防止时间插件多次点击失去焦点
// $('.' + _dateStr)[0].addEventListener('click', myfunc)
//
// function myfunc(e) {
// e.currentTarget.blur();
// }
}
vcFramework.initDate = function (_dateStr, _callBack) {
$('.' + _dateStr).datetimepicker({
language: 'zh-CN',
minView: 'month',
fontAwesome: 'fa',
format: 'yyyy-mm-dd',
initTime: true,
initialDate: new Date(),
autoClose: 1,
todayBtn: true
});
$('.' + _dateStr).datetimepicker()
.on('changeDate', function (ev) {
var value = $('.' + _dateStr).val();
//vc.component.addFeeConfigInfo.startTime = value;
_callBack(value);
});
}
vcFramework.initDateMonth = function (_dateStr, _callBack) {