Authored by mark

add consults

@@ -399,6 +399,12 @@ @@ -399,6 +399,12 @@
399 <div class="common-question"> 399 <div class="common-question">
400 <textarea id="textbox" placeholder="请输入您的问题"></textarea> 400 <textarea id="textbox" placeholder="请输入您的问题"></textarea>
401 <span id="submit-consult" class="btn">提交咨询</span> 401 <span id="submit-consult" class="btn">提交咨询</span>
  402 + <div class="success-msg hide">
  403 + <p>
  404 + <span class="iconfont">&#xe605;</span>
  405 + 咨询成功,请等待客服回复
  406 + </p>
  407 + </div>
402 </div> 408 </div>
403 409
404 </div> 410 </div>
@@ -1125,24 +1125,15 @@ function fetchComment() { @@ -1125,24 +1125,15 @@ function fetchComment() {
1125 // 提交咨询 1125 // 提交咨询
1126 $('#submit-consult').click(function() { 1126 $('#submit-consult').click(function() {
1127 var $this = $(this), 1127 var $this = $(this),
1128 - $parent = $this.closest('.new-consult'),  
1129 - $textarea = $parent.find('.my-consult'),  
1130 - content = $.trim($textarea.val());  
1131 -  
1132 - var $consultWarn = $parent.find('.consult-warn');  
1133 - 1128 + $textarea = $('#textbox'),
  1129 + content = $.trim($textarea.val()),
  1130 + $success = $('.success-msg');
1134 var pass = true; 1131 var pass = true;
1135 -  
1136 if (content === '') { 1132 if (content === '') {
1137 - $textarea.addClass('error');  
1138 - $consultWarn.removeClass('hide');  
1139 - 1133 + $textarea.attr('placeholder', '请输入咨询内容');
  1134 + $textarea.addClass('err');
1140 pass = false; 1135 pass = false;
1141 - } else {  
1142 - $textarea.removeClass('error');  
1143 - $consultWarn.addClass('hide');  
1144 } 1136 }
1145 -  
1146 if (pass === false) { 1137 if (pass === false) {
1147 return; 1138 return;
1148 } 1139 }
@@ -1158,20 +1149,21 @@ function fetchComment() { @@ -1158,20 +1149,21 @@ function fetchComment() {
1158 var code = data.code; 1149 var code = data.code;
1159 1150
1160 if (code === 200) { 1151 if (code === 200) {
1161 - $parent.addClass('hide');  
1162 -  
1163 - $parent.siblings('.consult-success').removeClass('hide'); 1152 + $textarea.removeClass('err');
  1153 + $success.removeClass('hide');
1164 1154
1165 - // 清空输入 1155 + // 清空输入
1166 $textarea.val(''); 1156 $textarea.val('');
1167 } else if (code === 400) { 1157 } else if (code === 400) {
1168 1158
1169 - // 跳转登录页 1159 + // 跳转登录页
1170 location.href = data.data.refer; 1160 location.href = data.data.refer;
1171 } 1161 }
1172 }); 1162 });
1173 }); 1163 });
1174 1164
  1165 +
  1166 +
1175 // 评论类型的切换 1167 // 评论类型的切换
1176 $('.comments').on('click', '.comment-tabs h2[data-comment-type]', function() { 1168 $('.comments').on('click', '.comment-tabs h2[data-comment-type]', function() {
1177 1169
@@ -1475,13 +1467,13 @@ $('.bottom-tab').on('click', '.bottom-title', function() { @@ -1475,13 +1467,13 @@ $('.bottom-tab').on('click', '.bottom-title', function() {
1475 // 店铺推荐 1467 // 店铺推荐
1476 $recommendComment.slideDown(SLIDETIME); 1468 $recommendComment.slideDown(SLIDETIME);
1477 $latestWalk.slideUp(SLIDETIME); 1469 $latestWalk.slideUp(SLIDETIME);
1478 - $('.change').css('display','inline-block'); 1470 + $('.change').css('display', 'inline-block');
1479 } else { 1471 } else {
1480 // 最近游览 1472 // 最近游览
1481 fetchLatestWalk(); // eslint-disable-line 1473 fetchLatestWalk(); // eslint-disable-line
1482 $recommendComment.slideUp(SLIDETIME); 1474 $recommendComment.slideUp(SLIDETIME);
1483 $latestWalk.slideDown(SLIDETIME); 1475 $latestWalk.slideDown(SLIDETIME);
1484 - $('.change').css('display','none'); 1476 + $('.change').css('display', 'none');
1485 } 1477 }
1486 1478
1487 }); 1479 });
@@ -1581,7 +1573,8 @@ $(window).scroll(function() { @@ -1581,7 +1573,8 @@ $(window).scroll(function() {
1581 1573
1582 }); 1574 });
1583 1575
1584 -$('.redcar').on('click', '.option', function() { 1576 +$('.redcar').on('click', '.option', function(e) {
  1577 + e.stopPropagation();
1585 var $this = $(this); 1578 var $this = $(this);
1586 1579
1587 if ($this.hasClass('fixed')) { 1580 if ($this.hasClass('fixed')) {
@@ -1592,14 +1585,18 @@ $('.redcar').on('click', '.option', function() { @@ -1592,14 +1585,18 @@ $('.redcar').on('click', '.option', function() {
1592 $this.addClass('fixed'); 1585 $this.addClass('fixed');
1593 }); 1586 });
1594 1587
1595 -$('.redcar').on('click', function(){  
1596 - var $addToCart = $('#add-to-cart');  
1597 - var sc = $(document);  
1598 - if(maxStock === -1){  
1599 - sc.scrollTop(0);  
1600 - }else{  
1601 - $addToCart.trigger('click');  
1602 - } 1588 +$('.redcar').on('click', function() {
  1589 + var $addToCart = $('#add-to-cart');
  1590 + var sc = $(document);
  1591 + if (maxStock === -1) {
  1592 + sc.scrollTop(0);
  1593 + } else {
  1594 + $addToCart.trigger('click');
  1595 + }
  1596 +});
  1597 +
  1598 +$('.redcar-nav').on('click', function(e){
  1599 + e.stopPropagation();
1603 }); 1600 });
1604 1601
1605 $(function() { 1602 $(function() {
@@ -1979,8 +1979,39 @@ @@ -1979,8 +1979,39 @@
1979 resize: none; 1979 resize: none;
1980 background-color: #fff; 1980 background-color: #fff;
1981 border: 1px solid #e0e0e0; 1981 border: 1px solid #e0e0e0;
  1982 + font-size: 16px;
  1983 + }
  1984 +
  1985 + .err{
  1986 + border: 1px solid #e01;
1982 } 1987 }
1983 1988
  1989 + .success-msg{
  1990 + border-top: 1px solid #eaeceb;
  1991 + margin-top: 30px;
  1992 + text-align: center;
  1993 + padding: 20px 0;
  1994 +
  1995 + p {
  1996 + width: 295px;
  1997 + height: 55px;
  1998 + line-height: 55px;
  1999 + margin: 0 auto;
  2000 + border: 2px solid #222;
  2001 + display: block;
  2002 + color: #222;
  2003 + font-weight: bold;
  2004 +
  2005 + span{
  2006 + display: inline;
  2007 + }
  2008 + }
  2009 + }
  2010 +
  2011 + .hide{
  2012 + display: none;
  2013 + }
  2014 +
1984 .btn{ 2015 .btn{
1985 display: block; 2016 display: block;
1986 width: 100%; 2017 width: 100%;