Commit 248b3c56 authored by xishifeng's avatar xishifeng

商铺编辑接口修改

parent bb7ec675
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="edit" />
<div id="page-content-wrapper">
<style type="text/css">
<!--不会有异步加载时,样式错乱的问题-->
<style type="text/css">
.form-group {
margin: 10px;
}
......@@ -31,23 +31,27 @@
width: 120px;
}
.input-add-tel{
.input-add-tel {
margin-top: 16px;
height: 20px;
}
.phone-list-container{
.phone-list-container {
overflow: hidden;
width: 196px;
vertical-align: top!important;
position: relative;
}
.phone-list-container>label{
.phone-list-container>label {
line-height: 30px;
}
.phone-list-container>input{
.phone-list-container>input {
float: left;
}
.phone-list-container>ul{
.phone-list-container>ul {
width: 196px;
list-style: none;
padding-left: 0;
......@@ -56,10 +60,12 @@
border-top: none;
background-color: white;
}
.phone-list-container>ul>li:hover{
.phone-list-container>ul>li:hover {
background-color: #e0e0e0;
}
.phone-list-container>img{
.phone-list-container>img {
position: absolute;
right: 5px;
top: 7px;
......@@ -190,17 +196,19 @@
display: none;
}
/**/
#li_dujia_area{
#li_dujia_area {
display: none;
}
/*上传图片预览区域*/
.img-pre-ul{
.img-pre-ul {
padding-left: 0;
overflow: hidden;
/*width: 100%;*/
}
.img-pre-ul>li{
.img-pre-ul>li {
list-style: no;
float: left;
width: 210px;
......@@ -209,27 +217,57 @@
margin-right: 10px;
margin-top: 10px;
}
.img-pre-ul>li.pdf-pre-li{
.img-pre-ul>li.pdf-pre-li {
height: 70px;
}
.img-pre-ul>li>img{
.img-pre-ul>li>img {
float: left;
width: 210px;
height: 140px;
object-fit: contain;
cursor: pointer;
}
.img-pre-ul>li>a{
.img-pre-ul>li>a {
float: left;
width: 210px;
text-align: center;
line-height: 30px;
}
.img-pre-ul>li>a.pdf-pre-a{
.img-pre-ul>li>a.pdf-pre-a {
line-height: 20px;
word-break: break-all;
}
</style>
/*图片点击放大预览区域的样式*/
#img_mask_area {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: 1001;
background-color: rgba(0, 0, 0, .3);
display: none;
}
#img_mask_area>img {
width: 900px;
height: 700px;
object-fit: contain;
position: absolute;
left: 50%;
top: 50%;
margin-left: -450px;
margin-top: -350px;
}
</style>
<div id="page-content-wrapper">
<div class="container">
<div class="row">
<div class="col-lg-10 col-lg-offset-0">
......@@ -640,4 +678,10 @@
</div>
</div>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=RTimRTxtj23AYTCkSsPvNDuQkGpR2fPX"></script>
<!--图片点击查看大图-->
<div id="img_mask_area" title="点击任意位置可关闭">
<img />
</div>
</div>
\ No newline at end of file
......@@ -5,50 +5,16 @@ define (['ckfinder','ckfinderStart', 'bootstrapJs'], function () {
user.event ();
},
event: function () {
var _id = getUrlParam('id');
if(_id != null){
$.ajax({
type: 'GET',
url: '/index/houseEdit',
data: {
'id': _id
},
timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(data) {
if(typeof data === 'object') {
if (data.code == 200) {
//fn(data);
}else {
alert(data['msg']);
};
}else{
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout'){
alert('请求超时');
};
}
});
}else{
//fn();
};
var _doc = $(document),
var _id = getUrlParam('id'),//地址栏获取的商铺或者街铺id
_doc = $(document),
_shangpuTypeObj = $('#shangpuType'),//商铺类型
_showCdObj = $('#showCd'),//显示给C端用户看
_exclusiveTypeObj = $('#exclusiveType'),//是否独家
_yetaiObj = $('.yetai'),//业态
_roomTagObj = $('.roomTag'),//商铺标签
_landlordPhoneObj = $('#landlordPhone'),//房东手机号
_internalNameObj = $('#internalName'),//对内商铺名称
_foreignNameObj = $('#foreignName'),//对外商铺名称
_landlordPhoneObj = $('#landlordPhone'),//房东手机号
_zujinTypeObj = $('#zujinType'),//租金模式
_moonPriceObj = $('#moonPrice'),//月租均价
_wuyePriceObj = $('#wuyePrice'),//物业管理费
......@@ -86,8 +52,76 @@ define (['ckfinder','ckfinderStart', 'bootstrapJs'], function () {
_dajiangtangObj = $('#dajiangtang'),//大讲堂
_exclusiveDate1Obj = $('#exclusiveDate1'),//独家代理有效期开始时间
_exclusiveDate2Obj = $('#exclusiveDate2'),//独家代理有效期结束时间
_exclusiveTelObj = $('#exclusiveTel');//独家方电话
_exclusiveTelObj = $('#exclusiveTel'),//独家方电话
_imgUploadDujia = $('#dujia_pic_ul'),//独家合同ul
_imgMaskObj = $('#img_mask_area');//预览大图的mask
if(_id != null){
$.ajax({
type: 'GET',
url: '/index/houseEdit',
data: {
'id': _id
},
timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(data) {
if(typeof data === 'object') {
if (data.code == 200) {
_shangpuTypeObj.val(data['data']['shop_type']).change().attr({
'disabled': 'disabled',
'title': '商铺类型暂不支持修改'
});
_showCdObj.val(data['data']['is_show']).change();
_exclusiveTypeObj.val(data['data']['is_exclusive_type']).change();
if(data['data']['shop_type'] == '0'){
//如果是商场
_roomArea2Obj.val(data['data']['shop_area_end']);
};
if(data['data']['is_show'] == '0'){
//如果是显示给C端用户看(对商户公开)
_foreignNameObj.val(data['data']['external_title']);
_addressExternalObj.val(data['data']['external_address']);
_foreignYoushiObj.val(data['data']['external_item_advantage']);
};
if(data['data']['is_exclusive_type'] == '1'){
//如果是独家
// _exclusiveDate1Obj.val(data['data']['external_title']);
// _addressExternalObj.val(data['data']['external_address']);
// _foreignYoushiObj.val(data['data']['external_item_advantage']);
};
$.each(_yetaiObj, function(i, item) {
~data['data']['industry_type'].indexOf(item.value) && (item.checked = 'checked');
});
$.each(_roomTagObj, function(i, item) {
~data['data']['shop_sign'].indexOf(item.value) && (item.checked = 'checked');
});
_landlordPhoneObj.val(data['data']['landlord_phone']);
_internalNameObj.val(data['data']['internal_title']);
_zujinTypeObj.val(data['data']['rent_type']);
_moonPriceObj.val(data['data']['rent_price']);
}else {
alert(data['msg']);
};
}else{
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout'){
alert('请求超时');
};
}
});
}else{
//fn();
};
//图片上传,附件上传处理事件
$(".upload-image-btn").click(function(){
......@@ -118,7 +152,7 @@ define (['ckfinder','ckfinderStart', 'bootstrapJs'], function () {
}
}else{
if(/(\.jpg|\.jpeg|\.png|\.gif|\.bmp)$/i.test(url)){
_this.parent().next().prepend('<li><img src="{0}" /><a href="javascript:;" class="delet-pic-btn">删除</a></li>'.stringFormatObj({
_this.parent().next().prepend('<li><img title="点击查看大图" src="{0}" /><a href="javascript:;" class="delet-pic-btn">删除</a></li>'.stringFormatObj({
'0': url
}));
}else{
......@@ -133,12 +167,20 @@ define (['ckfinder','ckfinderStart', 'bootstrapJs'], function () {
};
});
//图片上传删除键事件
_doc.on('click','.img-pre-ul>li>a',function(e){
e.preventDefault();
e.stopPropagation();
confirm('确定删除该文件吗?') && $(this).parent().hide();
});
//图片预览点击放大事件
_doc.on('click','.img-pre-ul>li>img',function(e){
_imgMaskObj.show().find('img').attr('src',this.src);
});
_imgMaskObj.click(function(e){
this.style.display = 'none';
});
/************************************************百度地址定位相关*************************************************************/
//从baidu-position.js移过来
var ulHtml = $('#main_ul>ul'),
......@@ -380,6 +422,7 @@ define (['ckfinder','ckfinderStart', 'bootstrapJs'], function () {
_this.before('<div class="form-group phone-list-container"><input type="tel" class="form-control phone_jia" placeholder="请输入"><ul></ul><img src="/resource/image/search_gb.png" class="input-cancel-pic" /></div>');
}else{
alert('最多添加5个');
return false;
};
});
......@@ -584,8 +627,10 @@ define (['ckfinder','ckfinderStart', 'bootstrapJs'], function () {
var _landlordPhoneVal = $.trim(_landlordPhoneObj.val());
if(_landlordPhoneVal == ''){
alert('请输入房东手机号码');
return false;
}else if(!/^[1][0-9]{10}$/.test(_landlordPhoneVal)){
alert('输入的房东手机号格式有误');
return false;
}
//多个input输入框验证
......@@ -734,6 +779,9 @@ define (['ckfinder','ckfinderStart', 'bootstrapJs'], function () {
_data['agent_start_time'] = _exclusiveDate1Obj.val();
_data['agent_end_time'] = _exclusiveDate2Obj.val();
_data['exclusive_ids'] = _exclusiveTelObj.attr('data-id');
$.each(_dujiaPicObj, function(i, item) {
_data['exclusive_img['+i+']'] = item.src.replace(_urlCut ,'');
});
};
var _urlCut = location.origin + '/resource/lib/Attachments/';//要截取的部分url
$.each(_acrPhoneArr, function(i, item) {
......@@ -748,9 +796,6 @@ define (['ckfinder','ckfinderStart', 'bootstrapJs'], function () {
$.each(_loucengPicObj, function(i, item) {
_data['plan['+i+']'] = item.src.replace(_urlCut ,'');
});
$.each(_dujiaPicObj, function(i, item) {
_data['exclusive_img['+i+']'] = item.src.replace(_urlCut ,'');
});
if(_fujianObj.length === 1){
_data['file_path'] = _fujianObj[0].href.replace(_urlCut ,'');//附件取得是herf值
};
......
......@@ -7,7 +7,7 @@ function BrowseServer(input_image,fun )
finder.selectActionData = input_image;
if($.isFunction(fun)){
window.fun = fun;
window.browseServerBackFun = fun;
}
finder.popup();
......@@ -26,8 +26,8 @@ function SetFileField( fileUrl , data )
document.getElementById( (data["selectActionData"] )).value = pic[1];
}
if($.isFunction(window.fun)){
window.fun(fileUrl);
if($.isFunction(window.browseServerBackFun)){
window.browseServerBackFun(fileUrl);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment