Authored by 梁志锋

4.6.0

Showing 31 changed files with 238 additions and 52 deletions
... ... @@ -43,8 +43,10 @@ class OrderData
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $channel;
$param['reasonId'] = $reasonId;
$param['reasons'] = $reason;
if ($reasonId) {
$param['reasonId'] = $reasonId;
$param['reasons'] = $reason;
}
$param['method'] = 'app.SpaceOrders.close';
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
... ... @@ -199,4 +201,20 @@ class OrderData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/** 再次购买
* @param type $uid
* @param type $orderCode
* @return type
*/
public static function reAddData($uid, $orderCode)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.readd';
$param['uid'] = $uid;
$param['order_code'] = $orderCode;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -36,7 +36,7 @@ class SearchData
// return 'http://101.200.31.165/yohosearch/search.json';
return 'http://192.168.10.64:8080/yohosearch/search.json';
case 'testing':
return 'http://testing.yohoops.org/yohosearch/search.json';
// return 'http://testing.yohoops.org/yohosearch/search.json';
case 'developer':
default:
return 'http://searchyohoops.yohobuy.com/yohosearch/search.json';
... ...
... ... @@ -215,7 +215,6 @@ class FloorProcess
foreach ($data['list'] as &$one) {
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
// isset(self::$channel[$type]) && $one['url'] .= '?gender=' . self::$channel[$type];
}
$one['img'] = Helpers::getImageUrl($one['src'], 158, 174);
unset($one['src']);
... ... @@ -226,7 +225,7 @@ class FloorProcess
'src' => 'http://cdn.yoho.cn/myohobuy/assets/img/more-brand.png',
'url' => '/brands?channel=' . $type,
);
if (isset($data['image'])) {
if (!empty($data['image'])) {
$data['moreImg'] = array(
'alt' => $data['image']['alt'],
'src' => Helpers::getImageUrl($data['image']['src'], 320, 172),
... ...
... ... @@ -81,6 +81,7 @@ $couponList.on('touchstart', '.employ-main', function() {
$('body').on('touchend', '.not-use', function() {
orderInfo('couponCode', null);
orderInfo('couponName', null);
location.href = '/cart/index/orderEnsure';
});
... ...
... ... @@ -102,6 +102,19 @@ function searchInput() {
searchResult();
}
function isLocalStorageSupported() {
var testKey = 'test',
storage = Window.prototype.localStorage;
try {
storage.setItem(testKey, 'testValue');
storage.removeItem(testKey);
return true;
} catch (error) {
return false;
}
}
//绑定提交前的存local操作
function bindWirteLocal($brandList, list) {
$brandList.on('click', 'p , li', function(e) {
... ... @@ -137,8 +150,9 @@ function bindWirteLocal($brandList, list) {
}
if (localStorage) {
historys = localStorage.getItem('historys-brand');
if (isLocalStorageSupported) {
historys = localStorage.getItem('historys-brand');
}
historys = historys ? historys : '';
... ... @@ -232,7 +246,6 @@ function searchResult() {
loading.showLoadingMask();
lazyLoad($('img.lazy'));
$('.yoho-header').css({
'z-index': 2,
... ... @@ -463,7 +476,9 @@ if ($('.brand-search-page').length > 0) {
if (localStorage) {
historys = localStorage.getItem('historys-brand');
if (isLocalStorageSupported) {
historys = localStorage.getItem('historys-brand');
}
if (historys && historys.length > 0) {
historys = historys.split(ranToken);
... ...
... ... @@ -70,7 +70,9 @@ function initInfosEvt($container) {
if (typeof $container === 'undefined') {
return;
}
if (typeof $container[0] === 'undefined') {
return;
}
cHammer = new Hammer($container[0]);
//点赞或者收藏事件
... ...
... ... @@ -53,9 +53,9 @@ setTimeout(function() {
info.initInfosEvt($infosContainer);
//文字介绍收起与展开
moreHammer = new Hammer(document.getElementById('more-intro'));
moreHammer = new Hammer(document.getElementById('more-intro-click-range'));
moreHammer.on('tap', function(e) {
var $this = $(e.target).closest('#more-intro');
var $this = $(e.target).closest('#more-intro-click-range');
$this.toggleClass('spread');
... ...
... ... @@ -60,6 +60,19 @@ $('#search').on('touchend', function() {
return false;
});
function isLocalStorageSupported() {
var testKey = 'test',
storage = Window.prototype.localStorage;
try {
storage.setItem(testKey, 'testValue');
storage.removeItem(testKey);
return true;
} catch (error) {
return false;
}
}
//初始化历史搜索的内容
(function() {
var html = '',
... ... @@ -89,4 +102,8 @@ $('#search').on('touchend', function() {
}
}());
writeSearch.bindWirteLocal($form);
if (isLocalStorageSupported) {
writeSearch.bindWirteLocal($form);
}
... ...
... ... @@ -110,6 +110,21 @@ optHammer.on('tap', function(e) {
});
} else if ($cur.hasClass('btn-cancel')) {
$reaMask.css('visibility', 'visible');
} else if ($cur.hasClass('btn-rebuy')) {
$.ajax({
type: 'GET',
url: '/home/readd',
data: {
orderCode: orderId
},
success: function(res) {
tip.show(res.message);
location.href = '/cart/index/index';
},
error: function(res) {
tip.show(res.message);
}
});
}
});
... ...
... ... @@ -223,6 +223,21 @@ orderHammer.on('tap', function(e) {
//Location to order detail
url = $order.data('href');
location.href = url;
} else if ($cur.closest('.rebuy').length > 0) {
$.ajax({
type: 'GET',
url: '/home/readd',
data: {
orderCode: id
},
success: function(res) {
tip.show(res.message);
location.href = '/cart/index/index';
},
error: function(res) {
tip.show(res.message);
}
});
}
});
... ...
... ... @@ -41,6 +41,7 @@ var navtabEle = document.getElementById('nav-tab'),
$('#feedback-content .consult-content').removeClass('hide');
}
$('.goods-consults .consult-item:lt(2)').removeClass('hide');
})();
if (navtabHammer) {
... ... @@ -91,7 +92,7 @@ if ($('.goods-consults-page').length > 0) {
if (readmoreHammer) {
readmoreHammer.on('tap', function() {
$('.readmore').hide();
$('.goods-consults').find('.consult-item').removeClass('hide');
return false;
});
}
... ...
... ... @@ -32,7 +32,7 @@ var $input = $('#search-input input'),
$icon = $('.search-icon'),
$clear = $('#search-input .clear-input');
var shopId,sort,brand;
var shopId,sort,brand,outlets;
//默认筛选条件
var defaultOpt = require('./query-param');
... ... @@ -105,6 +105,7 @@ function getQueryString(name) {
shopId = getQueryString('shop_id');
sort = getQueryString('sort');
outlets = getQueryString('outlets');
/**
* 筛选注册的回调,筛选子项点击后逻辑
... ... @@ -178,6 +179,11 @@ function search(opt) {
discount: opt.id
};
break;
case 'outlets':
ext = {
outlets: opt.id
};
break;
}
$.extend(defaultOpt, ext); //扩展筛选项
... ... @@ -221,6 +227,10 @@ function search(opt) {
params.brand = brand;
}
if (outlets) {
params.outlets = outlets;
}
$.extend(setting, defaultOpt, params);
searching = true;
... ...
... ... @@ -189,6 +189,11 @@
border-top: none;
line-height: 40px;
height: auto;
a {
width: 100%;
text-align: right;
}
}
.mg-text {
... ...
... ... @@ -263,4 +263,8 @@
}
}
}
.btn-rebuy {
margin-left: 10px;
}
}
... ...
... ... @@ -159,6 +159,9 @@
font-size: 24px;
line-height: 24px;
}
}
.rebuy {
margin-left: 20px;
}
}
}
... ...
... ... @@ -96,20 +96,22 @@
<a href="{{#if isLimit}}javascript:void(0);{{else}}/cart/index/selectCoupon{{/if}}">
<span class="title">优惠券</span>
{{# coupon}}
<span class="coupon-count">
{{count}}张可用
</span>
{{#if couponName}}
<span class="used coupon-use" data-name="{{couponName}}">
{{couponName}}
<i class="iconfont">&#xe614;</i>
</span>
{{^}}
<span class="not-used coupon-use">
{{#if isLimit}}该商品不可使用优惠券{{else}}未使用{{/if}}
<i class="iconfont">&#xe614;</i>
</span>
{{/if}}
{{#if isCoupon}}
<span class="coupon-count">
{{count}}张可用
</span>
{{/if}}
{{#if couponName}}
<span class="used coupon-use" data-name="{{couponName}}">
{{couponName}}
<i class="iconfont">&#xe614;</i>
</span>
{{^}}
<span class="not-used coupon-use">
{{#if isLimit}}该商品不可使用优惠券{{else}}未使用{{/if}}
<i class="iconfont">&#xe614;</i>
</span>
{{/if}}
{{/coupon}}
</a>
</li>
... ...
... ... @@ -20,7 +20,7 @@
</a>
\{{/ notAvailable}}
\{{/coupons}}
<a class="not-use" href="/cart/index/orderEnsure">不使用任何优惠券</a>
<a class="not-use" href="javascript:void(0);">不使用任何优惠券</a>
</script>
<script id="tmpl-coupon-not-avaliable" type="text/tmpl">
\{{# notAvailableCoupons}}
... ...
... ... @@ -2,7 +2,7 @@
<div class="brand-page brand-search-page yoho-page">
<div class="newbrand-search">
<form class="search-box clearfix">
<input type="text" class="search-input" id="keyword" placeholder="查找品牌" autofocus>
<input type="text" class="search-input" id="keyword" placeholder="查找品牌">
<i class="search-icon iconfont">&#xe60f;</i>
<div class="search-action">
<span class="iconfont clear-text">&#xe623;</span>
... ...
... ... @@ -11,15 +11,17 @@
&#xe605;
</a>
</p>
<p id="intro" class="intro">
{{intro}}
</p>
{{#if intro}}
<span id="more-intro" class="more-intro">
<span id="intro-more-txt">more</span>
<i class="icon iconfont">&#xe609;</i>
</span>
{{/if}}
<div id="more-intro-click-range" class="clearfix">
<p id="intro" class="intro">
{{intro}}
</p>
{{#if intro}}
<span id="more-intro" class="more-intro">
<span id="intro-more-txt">more</span>
<i class="icon iconfont">&#xe609;</i>
</span>
{{/if}}
</div>
</div>
</div>
{{# newArrival}}
... ...
... ... @@ -75,6 +75,7 @@
{{#unless unreceived}}
{{#unless unpaid}}
<span class="btn btn-del">删除订单</span>
<span class="btn btn-rebuy">再次购买</span>
{{/unless}}
{{/unless}}
... ...
... ... @@ -8,7 +8,7 @@
{{# consults}}
<div class="goods-consults customer-consults" id="goods-consults">
{{#list}}
<div class="consult-item" data-id="{{id}}">
<div class="consult-item hide" data-id="{{id}}">
<div class="question">
<span class="iconfont">&#xe644;</span>
<p>
... ...
... ... @@ -20,6 +20,7 @@
{{#unless unreceived}}
<div class="order-opt">
<span class="btn del">删除订单</span>
<span class="btn rebuy">再次购买</span>
</div>
{{/unless}}
{{/unless}}
... ...
<ul id="nav-tab" class="nav-tab clearfix">
<li class="comment-nav tap-hightlight">商品评价(<span class="comments-num">{{commentsNum}}</span>)</li>
{{#if commonConsults}}
<li class="consult-nav tap-hightlight">常见问题</li>
{{^}}
<li class="consult-nav tap-hightlight">购买咨询(<span class="consults-num">{{consultsNum}}</span>)</li>
{{/if}}
</ul>
<div id="feedback-content" >
<div class="comment-content content ">
... ...
... ... @@ -68,4 +68,8 @@
{{#if limit}}
<input class="query-param" type="hidden" data-attr="limit" value="{{limit}}">
{{/if}}
{{#if outlets}}
<input class="query-param" type="hidden" data-attr="outlets" value="{{outlets}}">
{{/if}}
\ No newline at end of file
... ...
... ... @@ -829,6 +829,40 @@ class HomeController extends AbstractAction
//渲染模板
$this->_view->display('order-content', $order);
}
/**
* 我的订单——再次购买
*/
public function reAddAction()
{
$result = array('code' => 401, 'message' => '商品加入购物车失败', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
//获取相关参数
$uid = $this->getUid(true);
$orderCode = $this->get('orderCode', '');
if (!$uid || !$orderCode) {
$result = array('code' => 400, 'message' => '缺失参数', 'data' => '');
break;
}
$reAddData = OrderData::reAddData($uid, $orderCode);
if(!isset($reAddData['code']) || $reAddData['code'] != 200){
break;
}
$result = array('code' => 200, 'message' => '商品已重新加入购物车', 'data' => $reAddData['data']);
if (!isset($result['code'])) {
break;
}
}
while (false);
$this->echoJson($result);
}
/*
* 我的订单-取消订单
... ... @@ -1063,6 +1097,8 @@ class HomeController extends AbstractAction
/* 判断订单信息是否存在 */
$orderDetail = OrderModel::orderDetail($orderCode, $this->_uid, $this->_usession);
// $readd = OrderData::reAddData($this->_uid, 1611143210);
// print_r($readd);
if (empty($orderDetail)) {
$this->error();
}
... ...
... ... @@ -30,7 +30,6 @@ class SearchController extends AbstractAction
/**
* 搜索列表页
*
* tar mark
*/
public function listAction()
{
... ... @@ -51,6 +50,7 @@ class SearchController extends AbstractAction
'price' => FILTER_DEFAULT,
'discount' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'outlets' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
if (isset($condition['shop_id'])) {
$condition['shopId'] = $condition['shop_id'];
... ... @@ -197,7 +197,7 @@ class SearchController extends AbstractAction
$listData = array();
}
if(isset($condition['title'])){
if (isset($condition['title'])) {
$this->setTitle($condition['title']);
$this->setNavHeader($condition['title'], true, SITE_MAIN);
}
... ... @@ -235,9 +235,10 @@ class SearchController extends AbstractAction
'discount' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'outlets' => FILTER_DEFAULT,
'page' => FILTER_VALIDATE_INT,), false);
if(!empty($condition['shop_id'])){
if (!empty($condition['shop_id'])) {
$condition['shop'] = $condition['shop_id'];
}
// 转义分类
... ... @@ -287,6 +288,11 @@ class SearchController extends AbstractAction
$condition['query'] = rawurldecode($condition['query']);
}
// 转义奥莱
if (isset($condition['outlets'])) {
$condition['outlets'] = rawurldecode($condition['outlets']);
}
// 转换排序方式
$type = $this->get('type', '');
$order = $this->get('order', 0);
... ... @@ -322,6 +328,13 @@ class SearchController extends AbstractAction
$data = Product\SearchModel::getSearchData($condition, $showTag, $tagNew, $tagSale);
} while (false);
//奥莱商品过滤新品标签
if (isset($condition['outlets']) && $condition['outlets'] === '1') {
foreach ($data['new'] as $outletskey => $outletsval) {
unset($data['new'][$outletskey]['tags']);
}
}
if (empty($data['new'])) {
echo ' ';
} else {
... ...
... ... @@ -594,11 +594,17 @@ class CartModel
// 优惠券数据
$coupons = array(
'couponName' => '',
'isCoupon' => false,
'count' => self::getValidCouponCount($uid)
);
if (isset($orderCompute['coupon_amount']) && (!empty($orderCompute['coupon_amount']) || ($orderCompute['coupon_amount'] === 0 && $orderCompute['shipping_cost'] === 0))) {
$coupons['couponName'] = $orderInfo['couponName'];
}
//选中已使用的优惠劵,则剩余多少张优惠劵,不提示
if (empty($coupons['couponName']) || $coupons['count'] === 0) {
$coupons['isCoupon'] = true;
}
$result['coupon'] = $coupons;
}
while (false);
... ...
... ... @@ -126,7 +126,7 @@ class DetailModel
// 商品咨询
$result['feedbacks']['consultsNum'] = 0;
if (!empty($baseInfo['consultBoWrapper'])) {
if (!empty($baseInfo['consultBoWrapper']) && $baseInfo['consultBoWrapper']['consultTotal'] !== 0) {
$result['feedbacks']['consultsNum'] = $baseInfo['consultBoWrapper']['consultTotal'];
$result['feedbacks']['consults'] = array();
$build = array();
... ... @@ -139,7 +139,12 @@ class DetailModel
$result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum']));
} // 暂无咨询
else {
$result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consultform', array('product_id' => $productId));
// tar modified 201606141155 常見問題恢復
$result['feedbacks']['consults'] = array_slice(self::getCommonConsults()['commonConsults'], 0, 2);
$result['feedbacks']['consultsNum'] = 2; // 数字无意义,兼容原来的前端模板代码使用,不能为 0
$result['feedbacks']['commonConsults'] = true; // 用来标记是否是常见问题的
$result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum']));
// $result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consultform', array('product_id' => $productId));
}
// 商品评价
... ... @@ -306,7 +311,7 @@ class DetailModel
'numInCart' => 0,
'goodsInstore' => $baseInfo['storage'], // 库存量
);
$soldOut = ($baseInfo['storage'] == 0) || ($baseInfo['status'] == 0 || $totalStorageNum === 0);
$soldOut = ($baseInfo['status'] == 0 || $totalStorageNum === 0);
$notForSale = $baseInfo['attribute'] == 2;
// 显示加入购物车链接
... ...
... ... @@ -189,8 +189,15 @@ class IndexController extends AbstractAction
// 构建资讯文章内容
if (!empty($article['data']['list']['artList'])) {
$build = array();
foreach ($article['data']['list']['artList'] as $article) {
$build[] = Helpers::formatArticle($article, true, $isApp, false, $uid);
// foreach ($article['data']['list']['artList'] as $article) {
// $build[] = Helpers::formatArticle($article, true, $isApp, $showAuthor, $uid);
// }
//逛作者列表页跳转链接修改
foreach ($article['data']['list']['artList'] as $articlekey =>$article) {
$build[$articlekey ] = Helpers::formatArticle($article, true, $isApp, false, $uid);
if($this->isApp()){
$build[$articlekey]['url'] = Helpers::url('/author/index', array('id' => $id, 'app_version' => $this->get('app_version', '')), 'guang');
}
}
$data['guang']['infos'] = $build;
}
... ...
... ... @@ -180,13 +180,13 @@ class RecomController extends AbstractAction
$templateId = $this->get('template_id', 0);
/* 创意生活只有一页数据 */
$page = $this->get('page', 1);
if (intval($page) > 1 || empty($templateId)) {
$page = intval($this->get('page', 1));
if (empty($page) || empty($templateId)) {
break;
}
/* 取可能喜欢的数据 */
$recom = RecomData::newPreference($templateId);
$recom = RecomData::newPreference($templateId, '', $page);
/* 构建人气单品数据 */
if (empty($recom) || empty($recom['data']['product_list'])) {
... ...