Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

  1 +<?php
  2 +
  3 +namespace LibModels\Wap\Home;
  4 +
  5 +use Api\Sign;
  6 +use Api\Yohobuy;
  7 +
  8 +/**
  9 + * 在线客服数据模型
  10 + *
  11 + * @name OnlineData
  12 + * @package LibModels/Wap/Home
  13 + * @copyright yoho.inc
  14 + * @version 1.0 (2015-11-13)
  15 + * @author xiaowei
  16 + */
  17 +class OnlineData
  18 +{
  19 + const ONLINE_URI = 'operations/api/v1/help/';
  20 +
  21 + //获取帮助列表(分类)
  22 + public static function getOnlineServiceInfo($clientType='iphone')
  23 + {
  24 + return Yohobuy::get(Yohobuy::SERVICE_URL .self::ONLINE_URI.'getCategory', array('client_type'=>$clientType));
  25 + }
  26 +
  27 + //获取问题详情
  28 + public static function getOnlineServiceDetail($cateId, $clientType = 'iphone')
  29 + {
  30 + return Yohobuy::get(Yohobuy::SERVICE_URL .self::ONLINE_URI.'getHelp', array('category_id'=>$cateId,'client_type'=>$clientType));
  31 + }
  32 +
  33 +}
@@ -8,4 +8,5 @@ require('./order'); @@ -8,4 +8,5 @@ require('./order');
8 require('./order-detail'); 8 require('./order-detail');
9 require('./fav'); 9 require('./fav');
10 require('./index'); 10 require('./index');
11 -require('./coupons');  
  11 +require('./coupons');
  12 +require('./online-service');
  1 +/**
  2 + * 在线客服
  3 + * @author: bikai<kai.bi@yoho.cn>
  4 + * @date: 2015/11/16
  5 + */
  6 +var $ = require('jquery');
  7 +
  8 +var $questionTab = $('.question-tab .tab-item');
  9 +
  10 +$questionTab.on('touchend', function() {
  11 + var clickTab = $(this).data('tab');
  12 +
  13 + clickTab = '[data-tab-name="' + clickTab + '"]';
  14 +
  15 + $questionTab.removeClass('current');
  16 + $(this).addClass('current');
  17 +
  18 + $('.question-list').removeClass('current');
  19 + $(clickTab).addClass('current');
  20 +});
1 -@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "recommend-for-you", "fav", "suggest", "address";  
  1 +@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "recommend-for-you", "fav", "suggest", "address", "online-service";
@@ -2,7 +2,9 @@ @@ -2,7 +2,9 @@
2 @return $n / 40 * 1rem; 2 @return $n / 40 * 1rem;
3 } 3 }
4 4
5 -.online-service-detail-page{ 5 +.online-service-page{
  6 + background: #f0f0f0;
  7 +
6 .question { 8 .question {
7 background: #fff; 9 background: #fff;
8 } 10 }
@@ -20,11 +22,14 @@ @@ -20,11 +22,14 @@
20 line-height: rem(58); 22 line-height: rem(58);
21 text-align: center; 23 text-align: center;
22 color: #b0b0b0; 24 color: #b0b0b0;
  25 +
23 .current { 26 .current {
24 color: #444; 27 color: #444;
25 } 28 }
  29 +
26 .line { 30 .line {
27 - padding: 0 rem(32); 31 + margin: 0 rem(32);
  32 + border-left: 1px solid #b0b0b0;
28 } 33 }
29 } 34 }
30 35
@@ -32,24 +37,29 @@ @@ -32,24 +37,29 @@
32 display: none; 37 display: none;
33 border-top: 1px solid #ccc; 38 border-top: 1px solid #ccc;
34 border-bottom: 1px solid #ccc; 39 border-bottom: 1px solid #ccc;
  40 +
35 &.current { 41 &.current {
36 display: block; 42 display: block;
37 } 43 }
  44 +
38 li { 45 li {
39 margin-left: rem(30); 46 margin-left: rem(30);
40 width: rem(610); 47 width: rem(610);
41 font-size: rem(28); 48 font-size: rem(28);
42 line-height: rem(90); 49 line-height: rem(90);
43 border-bottom: 1px solid #ccc; 50 border-bottom: 1px solid #ccc;
  51 +
44 a { 52 a {
45 display: block; 53 display: block;
46 color: #444; 54 color: #444;
47 } 55 }
  56 +
48 .iconfont { 57 .iconfont {
49 float: right; 58 float: right;
50 margin-right: rem(30); 59 margin-right: rem(30);
51 color: #ccc; 60 color: #ccc;
52 } 61 }
  62 +
53 &:last-child { 63 &:last-child {
54 border-bottom: none; 64 border-bottom: none;
55 } 65 }
@@ -63,14 +73,16 @@ @@ -63,14 +73,16 @@
63 background: #fff; 73 background: #fff;
64 border-top: 1px solid #ccc; 74 border-top: 1px solid #ccc;
65 border-bottom: 1px solid #ccc; 75 border-bottom: 1px solid #ccc;
  76 +
66 p { 77 p {
67 margin-top: rem(25); 78 margin-top: rem(25);
68 margin-left: rem(-72); 79 margin-left: rem(-72);
69 line-height: 1.5; 80 line-height: 1.5;
70 } 81 }
71 - .iconfont {  
72 - float: right; 82 +
  83 + .icon-yoho-enter {
73 color: #ccc; 84 color: #ccc;
  85 + float: right;
74 } 86 }
75 .connect-item { 87 .connect-item {
76 position: relative; 88 position: relative;
@@ -94,15 +106,9 @@ @@ -94,15 +106,9 @@
94 } 106 }
95 } 107 }
96 } 108 }
97 - .icon-chat {  
98 - @include retina-sprite($customerIcons, chat);  
99 - }  
100 - .icon-tel {  
101 - @include retina-sprite($customerIcons, tel);  
102 - }  
103 .icon { 109 .icon {
104 display: inline-block; 110 display: inline-block;
105 - margin-right: rem(14); 111 + margin-right: rem(28);
106 margin-left: rem(-70); 112 margin-left: rem(-70);
107 vertical-align:middle; 113 vertical-align:middle;
108 } 114 }
@@ -110,12 +116,14 @@ @@ -110,12 +116,14 @@
110 } 116 }
111 117
112 .online-service-detail-page { 118 .online-service-detail-page {
  119 + background: #f0f0f0;
  120 +
113 .qa-list { 121 .qa-list {
114 - background: #f0f0f0;  
115 .question-item { 122 .question-item {
116 margin-bottom: rem(32); 123 margin-bottom: rem(32);
117 border-top: 1px solid #c8c7cc; 124 border-top: 1px solid #c8c7cc;
118 border-bottom: 1px solid #c8c7cc; 125 border-bottom: 1px solid #c8c7cc;
  126 + color: #444;
119 background: #fff; 127 background: #fff;
120 &:last-child { 128 &:last-child {
121 margin-bottom: 0; 129 margin-bottom: 0;
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="online-service-page yoho-page"> 2 <div class="online-service-page yoho-page">
  3 + {{# service}}
3 <div class="question"> 4 <div class="question">
4 <div class="question-title">问题查询</div> 5 <div class="question-title">问题查询</div>
5 <div class="question-tab"> 6 <div class="question-tab">
6 <span class="tab-item" data-tab="order">订单问题</span> 7 <span class="tab-item" data-tab="order">订单问题</span>
7 - <span class="line">|</span> 8 + <span class="line"></span>
8 <span class="tab-item current" data-tab="shopping">购物问题</span> 9 <span class="tab-item current" data-tab="shopping">购物问题</span>
9 - <span class="line">|</span> 10 + <span class="line"></span>
10 <span class="tab-item" data-tab="other">其他问题</span> 11 <span class="tab-item" data-tab="other">其他问题</span>
11 </div> 12 </div>
12 {{#question}} 13 {{#question}}
@@ -15,24 +16,25 @@ @@ -15,24 +16,25 @@
15 <li class="question-item"> 16 <li class="question-item">
16 <a href="{{link}}" title="{{title}}"> 17 <a href="{{link}}" title="{{title}}">
17 {{title}} 18 {{title}}
18 - <span class="iconfont icon-yoho-enter"></span> 19 + <span class="iconfont icon-yoho-enter">&#xe604;</span>
19 </a> 20 </a>
20 </li> 21 </li>
21 {{/list}} 22 {{/list}}
22 </ul> 23 </ul>
23 {{/question}} 24 {{/question}}
24 </div> 25 </div>
  26 + {{/ service}}
25 <div class="connect-info"> 27 <div class="connect-info">
26 <div class="connect-item connect-online"> 28 <div class="connect-item connect-online">
27 <a href="#" title="在线客服"> 29 <a href="#" title="在线客服">
28 - <span class="icon icon-chat"></span> 30 + <span class="icon iconfont icon-chat">&#xe620;</span>
29 在线客服 31 在线客服
30 - <span class="iconfont icon-yoho-enter"></span> 32 + <span class="iconfont icon-yoho-enter">&#xe604;</span>
31 </a> 33 </a>
32 </div> 34 </div>
33 <div class="connect-item connect-tel"> 35 <div class="connect-item connect-tel">
34 <a href="tel:400-889-9649" title="电话客服"> 36 <a href="tel:400-889-9649" title="电话客服">
35 - <span class="icon icon-tel"></span> 37 + <span class="icon iconfont icon-tel">&#xe620;</span>
36 电话客服 38 电话客服
37 <p> 39 <p>
38 400-889-9649 &nbsp;&nbsp; 09:00 - 22:30 &nbsp; (周一至周日) 40 400-889-9649 &nbsp;&nbsp; 09:00 - 22:30 &nbsp; (周一至周日)
@@ -201,7 +201,6 @@ @@ -201,7 +201,6 @@
201 </script> 201 </script>
202 {{/if}} 202 {{/if}}
203 {{!-- 个人中心 --}} 203 {{!-- 个人中心 --}}
204 -{{!-- 个人中心首页 --}}  
205 {{#if myIndexPage}} 204 {{#if myIndexPage}}
206 <script> 205 <script>
207 seajs.use('js/me/index'); 206 seajs.use('js/me/index');
@@ -217,16 +216,18 @@ @@ -217,16 +216,18 @@
217 seajs.use('js/me/order-detail'); 216 seajs.use('js/me/order-detail');
218 </script> 217 </script>
219 {{/if}} 218 {{/if}}
220 -  
221 -{{!-- 个人中心: 商品收藏&品牌收藏 --}}  
222 {{#if favPage}} 219 {{#if favPage}}
223 <script> 220 <script>
224 seajs.use('js/me/fav'); 221 seajs.use('js/me/fav');
225 </script> 222 </script>
226 {{/if}} 223 {{/if}}
227 -  
228 {{#if couponsPage}} 224 {{#if couponsPage}}
229 <script> 225 <script>
230 seajs.use('js/me/coupons'); 226 seajs.use('js/me/coupons');
231 </script> 227 </script>
  228 +{{/if}}
  229 +{{#if onlineServicePage}}
  230 +<script>
  231 + seajs.use('js/me/online-service');
  232 +</script>
232 {{/if}} 233 {{/if}}
@@ -240,23 +240,35 @@ class HomeController extends AbstractAction @@ -240,23 +240,35 @@ class HomeController extends AbstractAction
240 )); 240 ));
241 } 241 }
242 242
243 - /**  
244 - * 在线客服  
245 - */  
246 - public function onlineServiceAction()  
247 - {  
248 - $service = \Index\UserModel::getOnlineServiceData(); 243 + //在线客服
  244 + public function onlineServiceAction()
  245 + {
  246 + // 设置网站标题
  247 + $this->setTitle('在线客服');
  248 + $this->setNavHeader('在线客服', true, SITE_MAIN);
249 249
250 - print_r($service); 250 + $service = home\OnlineModel::getOnlineServiceInfo();
251 251
252 $this->_view->display('online_service', array( 252 $this->_view->display('online_service', array(
253 'onlineServicePage' => true, 253 'onlineServicePage' => true,
254 - 'pageFooter' => true, 254 + // 'pageFooter' => true,
255 'service' => $service 255 'service' => $service
256 )); 256 ));
257 - } 257 + }
258 258
259 - /** 259 + //在线客服-具体详情
  260 + public function onlineServiceDetailAction()
  261 + {
  262 + $service = array();
  263 + $cateId = $this->get('cateId', 0);
  264 + if ($cateId > 0)
  265 + {
  266 + $service = home\OnlineModel::getOnlineServiceDetail($cateId);
  267 + }
  268 + $this->_view->display('online_service_detail', $service);
  269 + }
  270 +
  271 + /**
260 * 我的逛 272 * 我的逛
261 */ 273 */
262 public function myGuangAction() 274 public function myGuangAction()
  1 +<?php
  2 +
  3 +namespace home;
  4 +
  5 +use LibModels\Wap\Home\OnlineData;
  6 +use Action\AbstractAction;
  7 +use Plugin\Helpers;
  8 +
  9 +/**
  10 + * 在线客服相关数据处理
  11 + */
  12 +class OnlineModel
  13 +{
  14 +
  15 + //获取在线帮助分类
  16 + public static function getOnlineServiceInfo($clientType = 'iphone')
  17 + {
  18 + //调用接口获取数据
  19 + $res = OnlineData::getOnlineServiceInfo($clientType);
  20 + $cateInfo = $res['data'];
  21 + $question = array();
  22 + $tab = array();
  23 + if ($cateInfo)
  24 + {
  25 + foreach ($cateInfo as $key => $value)
  26 + {
  27 + //强制截成3个tab
  28 + if ($key > 2)
  29 + {
  30 + break;
  31 + }
  32 + $tab[$key]['tabid'] = 'tab' . $value['id'];
  33 + $tab[$key]['tabname'] = $value['category_name'];
  34 + $tab[$key]['iscut'] = true;
  35 + $tab[$key]['current'] = (!$key) ? TRUE : FALSE;
  36 + $question[$key]['name'] = 'tab' . $value['id'];
  37 + $question[$key]['current'] = (!$key) ? TRUE : FALSE;
  38 + $sub = $value['sub'];
  39 + $qTmp = array();
  40 + if ($sub)
  41 + {
  42 + foreach ($sub as $sk => $sv)
  43 + {
  44 + $qTmp[$sk]['title'] = $sv['category_name'];
  45 + $qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'];
  46 + }
  47 + }
  48 + $question[$key]['list'] = $qTmp;
  49 + }
  50 + $question[0]['current'] = true;
  51 + $tab[count($tab) - 1]['iscut'] = false;
  52 + }
  53 + //处理返回信息
  54 + $result = array(
  55 + 'header' => array('title' => '在线客服'),
  56 + 'tab' => $tab,
  57 + 'question' => $question
  58 + );
  59 +
  60 + return $result;
  61 + }
  62 +
  63 + //加载分类下的问题和解决方法
  64 + public static function getOnlineServiceDetail($cateId, $clinetType = 'iphone')
  65 + {
  66 + $result = array();
  67 + if (!$cateId)
  68 + {
  69 + return $result;
  70 + }
  71 + $res = OnlineData::getOnlineServiceDetail($cateId, $clinetType);
  72 + $questionInfo = $res['data'];
  73 + if ($questionInfo)
  74 + {
  75 + $list = array();
  76 + if ($questionInfo)
  77 + {
  78 + foreach ($questionInfo as $qk => $qv)
  79 + {
  80 + $list[$qk]['q'] = $qv['title'];
  81 + $list[$qk]['a'] = $qv['content'];
  82 + }
  83 + }
  84 + //处理返回信息
  85 + $result = array(
  86 + 'header' => array('title' => '在线客服'),
  87 + 'list' => $list
  88 + );
  89 + }
  90 + return $result;
  91 + }
  92 +
  93 +}