Authored by Rock Zhang

Merge branch 'feature/wap323' into develop

@@ -88,6 +88,20 @@ class DetailData @@ -88,6 +88,20 @@ class DetailData
88 } 88 }
89 89
90 /** 90 /**
  91 + * 常见问题列表
  92 + *
  93 + * @return array
  94 + */
  95 + public static function commonConsultList()
  96 + {
  97 + $param = Yohobuy::param();
  98 + $param['method'] = 'app.consult.common';
  99 + $param['client_secret'] = Sign::getSign($param);
  100 +
  101 + return Yohobuy::get(Yohobuy::API_URL, $param);
  102 + }
  103 +
  104 + /**
91 * 评论内容列表 105 * 评论内容列表
92 * 106 *
93 * @param int $productId 产品ID 107 * @param int $productId 产品ID
@@ -94,7 +94,8 @@ if ($('.goods-consults-page').length > 0) { @@ -94,7 +94,8 @@ if ($('.goods-consults-page').length > 0) {
94 if (readmoreHammer) { 94 if (readmoreHammer) {
95 readmoreHammer.on('tap', function() { 95 readmoreHammer.on('tap', function() {
96 $('.readmore').hide(); 96 $('.readmore').hide();
97 - $('.goods-consults .consult-item').show(); 97 + $('.goods-consults.customer-consults').removeClass('customer-consults');
  98 +
98 return false; 99 return false;
99 }); 100 });
100 } 101 }
@@ -135,7 +135,7 @@ @@ -135,7 +135,7 @@
135 } 135 }
136 136
137 .banner-top { 137 .banner-top {
138 - padding-top: 178rem / $pxConvertRem; 138 + padding-top: 258rem / $pxConvertRem;
139 background-color:#f8f8f8; 139 background-color:#f8f8f8;
140 } 140 }
141 141
@@ -71,23 +71,26 @@ @@ -71,23 +71,26 @@
71 color: $subFontC; 71 color: $subFontC;
72 } 72 }
73 } 73 }
74 - .goods-consults {  
75 - margin-top: 5.25rem;  
76 - overflow: hidden; 74 + .goods-consults.customer-consults {
77 .consult-item:nth-child(1) { 75 .consult-item:nth-child(1) {
78 display: block; 76 display: block;
79 } 77 }
80 .consult-item:nth-child(2) { 78 .consult-item:nth-child(2) {
81 display: block; 79 display: block;
82 } 80 }
83 - 81 + .consult-item {
  82 + display: none;
  83 + }
  84 + }
  85 + .goods-consults {
  86 + margin-top: 5.25rem;
  87 + overflow: hidden;
84 .consult-item { 88 .consult-item {
85 margin-top: pxToRem(30px); 89 margin-top: pxToRem(30px);
86 padding: pxToRem(20px) pxToRem(28px); 90 padding: pxToRem(20px) pxToRem(28px);
87 background-color: #fff; 91 background-color: #fff;
88 border-bottom: 1px solid $borderC; 92 border-bottom: 1px solid $borderC;
89 border-top: 1px solid $borderC; 93 border-top: 1px solid $borderC;
90 - display:none;  
91 .question { 94 .question {
92 font-size: pxToRem(24px); 95 font-size: pxToRem(24px);
93 color: $mainFontC; 96 color: $mainFontC;
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <a href="{{link}}" class="iconfont enter-consult-page">&#xe604;</a> 6 <a href="{{link}}" class="iconfont enter-consult-page">&#xe604;</a>
7 </div> 7 </div>
8 {{# consults}} 8 {{# consults}}
9 - <div class="goods-consults" id="goods-consults"> 9 + <div class="goods-consults customer-consults" id="goods-consults">
10 {{#list}} 10 {{#list}}
11 <div class="consult-item" data-id="{{id}}"> 11 <div class="consult-item" data-id="{{id}}">
12 <div class="question"> 12 <div class="question">
@@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
55 55
56 {{#faq}} 56 {{#faq}}
57 <div class="goods-consults" style="margin-top:0"> 57 <div class="goods-consults" style="margin-top:0">
58 - {{#list}} 58 + {{#commonConsults}}
59 <div class="faq-item"> 59 <div class="faq-item">
60 <div class="question"> 60 <div class="question">
61 <span class="iconfont">&#xe639;</span> 61 <span class="iconfont">&#xe639;</span>
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
69 <p>{{answer}}</p> 69 <p>{{answer}}</p>
70 </div> 70 </div>
71 </div> 71 </div>
72 - {{/list}} 72 + {{/commonConsults}}
73 </div> 73 </div>
74 {{/faq}} 74 {{/faq}}
75 75
@@ -571,9 +571,9 @@ class DetailModel @@ -571,9 +571,9 @@ class DetailModel
571 $build['answer'] = $value['answer']; 571 $build['answer'] = $value['answer'];
572 $build['id'] = $value['id']; 572 $build['id'] = $value['id'];
573 $build['isLike'] = $value['is_like'] === 'Y'; 573 $build['isLike'] = $value['is_like'] === 'Y';
574 - $build['like'] = $value['like']; 574 + $build['like'] = intval($value['like']);
575 $build['isUseful'] = $value['is_useful'] === 'Y'; 575 $build['isUseful'] = $value['is_useful'] === 'Y';
576 - $build['useful'] = $value['useful']; 576 + $build['useful'] = intval($value['useful']);
577 $result[] = $build; 577 $result[] = $build;
578 } 578 }
579 } 579 }
@@ -584,6 +584,24 @@ class DetailModel @@ -584,6 +584,24 @@ class DetailModel
584 } 584 }
585 585
586 /** 586 /**
  587 + * 获取常见问题列表
  588 + *
  589 + * @return array
  590 + */
  591 + public static function getCommonConsults()
  592 + {
  593 + $result = array();
  594 +
  595 + $consults = DetailData::commonConsultList();
  596 + if (isset($consults['code']) && $consults['code'] === 200) {
  597 + $result['commonConsults'] = $consults['data'];
  598 + $consults = array();
  599 + }
  600 +
  601 + return $result;
  602 + }
  603 +
  604 + /**
587 * 咨询点赞 605 * 咨询点赞
588 * 606 *
589 * @param int $uid 用户ID 607 * @param int $uid 用户ID
@@ -158,6 +158,7 @@ class DetailController extends AbstractAction @@ -158,6 +158,7 @@ class DetailController extends AbstractAction
158 'consults' => array( 158 'consults' => array(
159 'list' => $consults 159 'list' => $consults
160 ), 160 ),
  161 + 'faq' => \Product\DetailModel::getCommonConsults(),
161 'showReadMore' => count($consults) > 2, 162 'showReadMore' => count($consults) > 2,
162 'link' => Helpers::url('/product/detail/consultform', array('product_id' => $productId)), 163 'link' => Helpers::url('/product/detail/consultform', array('product_id' => $productId)),
163 ); 164 );
@@ -166,6 +167,7 @@ class DetailController extends AbstractAction @@ -166,6 +167,7 @@ class DetailController extends AbstractAction
166 $this->_view->display('consults', $data); 167 $this->_view->display('consults', $data);
167 } 168 }
168 169
  170 +
169 /* 171 /*
170 * 咨询点赞 172 * 咨询点赞
171 */ 173 */