Authored by mark

add consults

... ... @@ -399,6 +399,12 @@
<div class="common-question">
<textarea id="textbox" placeholder="请输入您的问题"></textarea>
<span id="submit-consult" class="btn">提交咨询</span>
<div class="success-msg hide">
<p>
<span class="iconfont">&#xe605;</span>
咨询成功,请等待客服回复
</p>
</div>
</div>
</div>
... ...
... ... @@ -1125,24 +1125,15 @@ function fetchComment() {
// 提交咨询
$('#submit-consult').click(function() {
var $this = $(this),
$parent = $this.closest('.new-consult'),
$textarea = $parent.find('.my-consult'),
content = $.trim($textarea.val());
var $consultWarn = $parent.find('.consult-warn');
$textarea = $('#textbox'),
content = $.trim($textarea.val()),
$success = $('.success-msg');
var pass = true;
if (content === '') {
$textarea.addClass('error');
$consultWarn.removeClass('hide');
$textarea.attr('placeholder', '请输入咨询内容');
$textarea.addClass('err');
pass = false;
} else {
$textarea.removeClass('error');
$consultWarn.addClass('hide');
}
if (pass === false) {
return;
}
... ... @@ -1158,20 +1149,21 @@ function fetchComment() {
var code = data.code;
if (code === 200) {
$parent.addClass('hide');
$parent.siblings('.consult-success').removeClass('hide');
$textarea.removeClass('err');
$success.removeClass('hide');
// 清空输入
// 清空输入
$textarea.val('');
} else if (code === 400) {
// 跳转登录页
// 跳转登录页
location.href = data.data.refer;
}
});
});
// 评论类型的切换
$('.comments').on('click', '.comment-tabs h2[data-comment-type]', function() {
... ... @@ -1475,13 +1467,13 @@ $('.bottom-tab').on('click', '.bottom-title', function() {
// 店铺推荐
$recommendComment.slideDown(SLIDETIME);
$latestWalk.slideUp(SLIDETIME);
$('.change').css('display','inline-block');
$('.change').css('display', 'inline-block');
} else {
// 最近游览
fetchLatestWalk(); // eslint-disable-line
$recommendComment.slideUp(SLIDETIME);
$latestWalk.slideDown(SLIDETIME);
$('.change').css('display','none');
$('.change').css('display', 'none');
}
});
... ... @@ -1581,7 +1573,8 @@ $(window).scroll(function() {
});
$('.redcar').on('click', '.option', function() {
$('.redcar').on('click', '.option', function(e) {
e.stopPropagation();
var $this = $(this);
if ($this.hasClass('fixed')) {
... ... @@ -1592,14 +1585,18 @@ $('.redcar').on('click', '.option', function() {
$this.addClass('fixed');
});
$('.redcar').on('click', function(){
var $addToCart = $('#add-to-cart');
var sc = $(document);
if(maxStock === -1){
sc.scrollTop(0);
}else{
$addToCart.trigger('click');
}
$('.redcar').on('click', function() {
var $addToCart = $('#add-to-cart');
var sc = $(document);
if (maxStock === -1) {
sc.scrollTop(0);
} else {
$addToCart.trigger('click');
}
});
$('.redcar-nav').on('click', function(e){
e.stopPropagation();
});
$(function() {
... ...
... ... @@ -1979,8 +1979,39 @@
resize: none;
background-color: #fff;
border: 1px solid #e0e0e0;
font-size: 16px;
}
.err{
border: 1px solid #e01;
}
.success-msg{
border-top: 1px solid #eaeceb;
margin-top: 30px;
text-align: center;
padding: 20px 0;
p {
width: 295px;
height: 55px;
line-height: 55px;
margin: 0 auto;
border: 2px solid #222;
display: block;
color: #222;
font-weight: bold;
span{
display: inline;
}
}
}
.hide{
display: none;
}
.btn{
display: block;
width: 100%;
... ...