Authored by xuqi

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

<?php
namespace LibModels\Wap\Home;
use Api\Sign;
use Api\Yohobuy;
/**
* 在线客服数据模型
*
* @name OnlineData
* @package LibModels/Wap/Home
* @copyright yoho.inc
* @version 1.0 (2015-11-13)
* @author xiaowei
*/
class OnlineData
{
const ONLINE_URI = 'operations/api/v1/help/';
//获取帮助列表(分类)
public static function getOnlineServiceInfo($clientType='iphone')
{
return Yohobuy::get(Yohobuy::SERVICE_URL .self::ONLINE_URI.'getCategory', array('client_type'=>$clientType));
}
//获取问题详情
public static function getOnlineServiceDetail($cateId, $clientType = 'iphone')
{
return Yohobuy::get(Yohobuy::SERVICE_URL .self::ONLINE_URI.'getHelp', array('category_id'=>$cateId,'client_type'=>$clientType));
}
}
... ...
... ... @@ -8,4 +8,5 @@ require('./order');
require('./order-detail');
require('./fav');
require('./index');
require('./coupons');
\ No newline at end of file
require('./coupons');
require('./online-service');
\ No newline at end of file
... ...
/**
* 在线客服
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/16
*/
var $ = require('jquery');
var $questionTab = $('.question-tab .tab-item');
$questionTab.on('touchend', function() {
var clickTab = $(this).data('tab');
clickTab = '[data-tab-name="' + clickTab + '"]';
$questionTab.removeClass('current');
$(this).addClass('current');
$('.question-list').removeClass('current');
$(clickTab).addClass('current');
});
... ...
@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "recommend-for-you", "fav", "suggest", "address";
\ No newline at end of file
@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "recommend-for-you", "fav", "suggest", "address", "online-service";
... ...
... ... @@ -2,7 +2,9 @@
@return $n / 40 * 1rem;
}
.online-service-detail-page{
.online-service-page{
background: #f0f0f0;
.question {
background: #fff;
}
... ... @@ -20,11 +22,14 @@
line-height: rem(58);
text-align: center;
color: #b0b0b0;
.current {
color: #444;
}
.line {
padding: 0 rem(32);
margin: 0 rem(32);
border-left: 1px solid #b0b0b0;
}
}
... ... @@ -32,24 +37,29 @@
display: none;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
&.current {
display: block;
}
li {
margin-left: rem(30);
width: rem(610);
font-size: rem(28);
line-height: rem(90);
border-bottom: 1px solid #ccc;
a {
display: block;
color: #444;
}
.iconfont {
float: right;
margin-right: rem(30);
color: #ccc;
}
&:last-child {
border-bottom: none;
}
... ... @@ -63,14 +73,16 @@
background: #fff;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
p {
margin-top: rem(25);
margin-left: rem(-72);
line-height: 1.5;
}
.iconfont {
float: right;
.icon-yoho-enter {
color: #ccc;
float: right;
}
.connect-item {
position: relative;
... ... @@ -94,15 +106,9 @@
}
}
}
.icon-chat {
@include retina-sprite($customerIcons, chat);
}
.icon-tel {
@include retina-sprite($customerIcons, tel);
}
.icon {
display: inline-block;
margin-right: rem(14);
margin-right: rem(28);
margin-left: rem(-70);
vertical-align:middle;
}
... ... @@ -110,12 +116,14 @@
}
.online-service-detail-page {
background: #f0f0f0;
.qa-list {
background: #f0f0f0;
.question-item {
margin-bottom: rem(32);
border-top: 1px solid #c8c7cc;
border-bottom: 1px solid #c8c7cc;
color: #444;
background: #fff;
&:last-child {
margin-bottom: 0;
... ...
{{> layout/header}}
<div class="online-service-page yoho-page">
{{# service}}
<div class="question">
<div class="question-title">问题查询</div>
<div class="question-tab">
<span class="tab-item" data-tab="order">订单问题</span>
<span class="line">|</span>
<span class="line"></span>
<span class="tab-item current" data-tab="shopping">购物问题</span>
<span class="line">|</span>
<span class="line"></span>
<span class="tab-item" data-tab="other">其他问题</span>
</div>
{{#question}}
... ... @@ -15,24 +16,25 @@
<li class="question-item">
<a href="{{link}}" title="{{title}}">
{{title}}
<span class="iconfont icon-yoho-enter"></span>
<span class="iconfont icon-yoho-enter">&#xe604;</span>
</a>
</li>
{{/list}}
</ul>
{{/question}}
</div>
{{/ service}}
<div class="connect-info">
<div class="connect-item connect-online">
<a href="#" title="在线客服">
<span class="icon icon-chat"></span>
<span class="icon iconfont icon-chat">&#xe620;</span>
在线客服
<span class="iconfont icon-yoho-enter"></span>
<span class="iconfont icon-yoho-enter">&#xe604;</span>
</a>
</div>
<div class="connect-item connect-tel">
<a href="tel:400-889-9649" title="电话客服">
<span class="icon icon-tel"></span>
<span class="icon iconfont icon-tel">&#xe620;</span>
电话客服
<p>
400-889-9649 &nbsp;&nbsp; 09:00 - 22:30 &nbsp; (周一至周日)
... ...
... ... @@ -201,7 +201,6 @@
</script>
{{/if}}
{{!-- 个人中心 --}}
{{!-- 个人中心首页 --}}
{{#if myIndexPage}}
<script>
seajs.use('js/me/index');
... ... @@ -217,16 +216,18 @@
seajs.use('js/me/order-detail');
</script>
{{/if}}
{{!-- 个人中心: 商品收藏&品牌收藏 --}}
{{#if favPage}}
<script>
seajs.use('js/me/fav');
</script>
{{/if}}
{{#if couponsPage}}
<script>
seajs.use('js/me/coupons');
</script>
{{/if}}
{{#if onlineServicePage}}
<script>
seajs.use('js/me/online-service');
</script>
{{/if}}
\ No newline at end of file
... ...
... ... @@ -240,23 +240,35 @@ class HomeController extends AbstractAction
));
}
/**
* 在线客服
*/
public function onlineServiceAction()
{
$service = \Index\UserModel::getOnlineServiceData();
//在线客服
public function onlineServiceAction()
{
// 设置网站标题
$this->setTitle('在线客服');
$this->setNavHeader('在线客服', true, SITE_MAIN);
print_r($service);
$service = home\OnlineModel::getOnlineServiceInfo();
$this->_view->display('online_service', array(
'onlineServicePage' => true,
'pageFooter' => true,
// 'pageFooter' => true,
'service' => $service
));
}
}
/**
//在线客服-具体详情
public function onlineServiceDetailAction()
{
$service = array();
$cateId = $this->get('cateId', 0);
if ($cateId > 0)
{
$service = home\OnlineModel::getOnlineServiceDetail($cateId);
}
$this->_view->display('online_service_detail', $service);
}
/**
* 我的逛
*/
public function myGuangAction()
... ...
<?php
namespace home;
use LibModels\Wap\Home\OnlineData;
use Action\AbstractAction;
use Plugin\Helpers;
/**
* 在线客服相关数据处理
*/
class OnlineModel
{
//获取在线帮助分类
public static function getOnlineServiceInfo($clientType = 'iphone')
{
//调用接口获取数据
$res = OnlineData::getOnlineServiceInfo($clientType);
$cateInfo = $res['data'];
$question = array();
$tab = array();
if ($cateInfo)
{
foreach ($cateInfo as $key => $value)
{
//强制截成3个tab
if ($key > 2)
{
break;
}
$tab[$key]['tabid'] = 'tab' . $value['id'];
$tab[$key]['tabname'] = $value['category_name'];
$tab[$key]['iscut'] = true;
$tab[$key]['current'] = (!$key) ? TRUE : FALSE;
$question[$key]['name'] = 'tab' . $value['id'];
$question[$key]['current'] = (!$key) ? TRUE : FALSE;
$sub = $value['sub'];
$qTmp = array();
if ($sub)
{
foreach ($sub as $sk => $sv)
{
$qTmp[$sk]['title'] = $sv['category_name'];
$qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'];
}
}
$question[$key]['list'] = $qTmp;
}
$question[0]['current'] = true;
$tab[count($tab) - 1]['iscut'] = false;
}
//处理返回信息
$result = array(
'header' => array('title' => '在线客服'),
'tab' => $tab,
'question' => $question
);
return $result;
}
//加载分类下的问题和解决方法
public static function getOnlineServiceDetail($cateId, $clinetType = 'iphone')
{
$result = array();
if (!$cateId)
{
return $result;
}
$res = OnlineData::getOnlineServiceDetail($cateId, $clinetType);
$questionInfo = $res['data'];
if ($questionInfo)
{
$list = array();
if ($questionInfo)
{
foreach ($questionInfo as $qk => $qv)
{
$list[$qk]['q'] = $qv['title'];
$list[$qk]['a'] = $qv['content'];
}
}
//处理返回信息
$result = array(
'header' => array('title' => '在线客服'),
'list' => $list
);
}
return $result;
}
}
... ...