Commit ddda474a authored by xishifeng's avatar xishifeng

新增商铺修改

parent 9b99d169
......@@ -9,7 +9,7 @@
<div class="panel panel-default">
<div class="panel-heading">新增商铺</div>
<div class="panel-body">
<form class="form-inline">
<form class="form-inline" id="main_form">
<ul class="list-group">
<li class="list-group-item">
<div class="form-group">
......@@ -145,7 +145,7 @@
<li class="list-group-item">
<div class="form-group" id="li_landlord_phone_input">
<label>房东手机号</label>
<label>房东称呼和手机号</label>
<div class="landlord-form-group">
<div class="form-group phone-list-container">
<input type="text" class="form-control landlord-name-input" placeholder="请输入房东称呼" />
......@@ -441,8 +441,8 @@
<script id="my_tpl_landlord_phone1" type="text/template">
<div class="form-group phone-list-container">
<input type="text" class="form-control landlord-name-input" placeholder="请输入房东称呼" />
<input type="tel" class="form-control landlord-phone-input" placeholder="请输入房东手机号" name="landlordPhone" data-alert="请填写房东手机号!">
<input type="text" class="form-control landlord-name-input" value="{name}" placeholder="请输入房东称呼" />
<input type="tel" class="form-control landlord-phone-input" value="{phone}" placeholder="请输入房东手机号" name="landlordPhone" data-alert="请填写房东手机号!">
<img src="/resource/image/search_gb.png" class="input-cancel-pic"></div>
</div>
</script>
\ No newline at end of file
......@@ -8,6 +8,7 @@ require.config ({
'jquery': 'lib/js/jquery-2.0.3.min',
'axios': 'lib/js/axios.min',
'layer': 'lib/js/layer',
'validate': 'lib/js/jquery.validate.min',
'temp': (location.origin || location.protocol + '//' + location.hostname + (location.port == 80 ? '' : ':' + location.port)) + '/resource/template',
'style': 'css',
'doT': 'lib/js/doT',
......@@ -55,6 +56,10 @@ require.config ({
'deps': ['css!lib/js/need/layer.css'],
'exports': 'layer'
},
'validate': {
'deps': ['jquery'],
'exports': 'validate'
}
},
'map': {
......
define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart', 'bootstrapJs'], function(doT) {
define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart', 'validate'], function(doT) {
var user = {
init: function() {
//初始化dot
......@@ -13,7 +13,7 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart', 'bootstra
_source = getUrlParam('source'),
_sublet_id = getUrlParam('sublet_id'),
_doc = $(document),
_tpl_landlord_phone1 = $('#my_tpl_landlord_phone1').html(),
_tpl_landlord_phone1 = $('#my_tpl_landlord_phone1').html(),//手机号码添加的位置模板
_urlCut = location.origin + '/resource/lib/Attachments/images/', //要截取的部分url
_loadMainItem = $('#main_loading_pic'), //整个页面的加载图标
_shangpuTypeObj = $('#shangpuType'), //商铺类型
......@@ -236,16 +236,28 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart', 'bootstra
});
//房东手机号
var _landlordNum = 0;
$.each(_data['landlord_phone'].split(','), function(i, item) {
if(_landlordNum === 0) {
$('#landlord_tel_jia').prev().find('input').val(item);
// var _landlordNum = 0;
// $.each(_data['landlord_phone'].split(','), function(i, item) {
// if(_landlordNum === 0) {
// $('#landlord_tel_jia').prev().find('input').val(item);
// } else {
// $('#landlord_tel_jia').before('<div class="form-group phone-list-container landlord-form-group"><input type="tel" class="form-control phone_jia" placeholder="请输入" value="{0}"><img src="/resource/image/search_gb.png" class="input-cancel-pic"></div>'.stringFormatObj({
// '0': item
// }));
// };
// _landlordNum++;
// });
//房东手机号
_data['landlord_phone_array'] && $.each(_data['landlord_phone_array'], function(i, item) {
if(i === 0) {
$('#landlordPhone').val(item.phone).prev().val(item.name);
} else {
$('#landlord_tel_jia').before('<div class="form-group phone-list-container landlord-form-group"><input type="tel" class="form-control phone_jia" placeholder="请输入" value="{0}"><img src="/resource/image/search_gb.png" class="input-cancel-pic"></div>'.stringFormatObj({
'0': item
$('#landlord_tel_jia').prev().append(_tpl_landlord_phone1.stringFormatObj({
'name': item.name,
'phone': item.phone
}));
};
_landlordNum++;
});
_landlordPhoneObj.val(_data['landlord_phone']); //房东手机号
......@@ -656,7 +668,10 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart', 'bootstra
var _this = $(this);
var _maxLen = 3;
if(_this.prev().find('.landlord-phone-input').length < _maxLen) {
_this.prev().append(_tpl_landlord_phone1);
_this.prev().append(_tpl_landlord_phone1.stringFormatObj({
'name': '',
'phone': ''
}));
}else{
alert('最多添加' + _maxLen + '个');
return false;
......@@ -788,6 +803,8 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart', 'bootstra
$('#saveBtn').click(function(e) {
e.preventDefault();
e.stopPropagation();
$('#main_form').validate();
return false;
//多个input输入框验证标记
var _isBreakFlag = false;
......@@ -1055,8 +1072,9 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart', 'bootstra
// _data['phone['+i+']'] = item;
// });
$.each(_landlordPhoneArr, function(i, item) {
_data['landlord_phone['+i+'][name]'] = item.name;
_data['landlord_phone['+i+'][phone]'] = item.phone;
_data['landlord_phone['+i+']'] = item;
//_data['landlord_phone['+i+'][name]'] = item.name;
//_data['landlord_phone['+i+'][phone]'] = item.phone;
});
$.each(_liebiaoPicObj, function(i, item) {
_data['cover[' + i + ']'] = item.src.replace(_urlCut, '');
......@@ -1081,7 +1099,7 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart', 'bootstra
url: '/index/houseEdit',
data: _data,
timeout: 30000,
traditional: true,
// traditional: true,
dataType: 'json',
beforeSend: function() {
_loadMainItem.show();
......
This diff is collapsed.
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