Authored by hf

fixes bug to call product detail api and order status

... ... @@ -1261,9 +1261,9 @@
},{
'appIcon' : 'http://static.yohobuy.com/images/icon.png',
'payLink' : '/weixin/pay/',
'appId': 'baidu',
'app' : '百度支付',
'hint' : '需下载微信客户端',
'appId': 'alipay',
'app' : '支付宝支付',
'hint' : '需下载支付宝客户端',
'subHint' : '推荐使用'
}
]
... ...
... ... @@ -4721,7 +4721,7 @@ define("js/product/detail/detail", ["jquery","swiper","hammer","lazyload","index
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/10/20
*/
var $ = require("jquery"),
var $ = require("jquery"),
Swiper = require("swiper"),
Hammer = require("hammer"),
lazyLoad = require("lazyload");
... ... @@ -4733,6 +4733,8 @@ var goodsSwiper,
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
var $cart = $('.cart-bar');
require("js/product/detail/desc");
require("js/product/detail/comments-consults");
require("js/product/recommend-for-you-product-desc");
... ... @@ -4787,6 +4789,16 @@ if (goodsDiscountHammer) {
});
}
//购物车商品数量
$.ajax({
type: 'GET',
url: '/cart/index/count',
success: function(data) {
if (data.code === 200) {
$cart.find('.num-tag').html(data.data.cart_goods_count).removeClass('hide');
}
}
});
require("js/product/detail/like");
... ... @@ -4887,19 +4899,24 @@ $(window).scroll(function() {
});
define("js/product/detail/comments-consults", ["jquery"], function(require, exports, module){
define("js/product/detail/comments-consults", ["jquery","hammer"], function(require, exports, module){
/**
* 商品详情 --评论和咨询tab
* @author: Lynnic
* @date: 2015/11/18
*/
var $ = require("jquery"),
tip = require("js/plugin/tip");
var commentsNum;
tip = require("js/plugin/tip"),
Hammer = require("hammer");
var commentsNum,consultsNum;
var consultFooterEle = document.getElementById('consult-content-footer'),
consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle);
(function() {
var consultsNum = $('#nav-tab .consults-num').html() - 0;
consultsNum = $('#nav-tab .consults-num').html() - 0;
commentsNum = $('#nav-tab .comments-num').html() - 0;
... ... @@ -4941,6 +4958,12 @@ $('#nav-tab li').on('touchend', function() {
}
}
});
if (consultFooterHammer) {
consultFooterHammer.on('tap', function() {
location.href = $(consultFooterEle).find('a').attr('href');
});
}
});
define("js/product/recommend-for-you-product-desc", ["swiper","jquery","index"], function(require, exports, module){
/**
... ... @@ -4987,70 +5010,77 @@ var $ = require("jquery"),
Hammer = require("hammer"),
tip = require("js/plugin/tip");
var likeHammer = new Hammer(document.getElementById('likeBtn')),
addToCartHammer = new Hammer(document.getElementById('addtoCart')),
var likeEle = document.getElementById('likeBtn'),
likeHammer = likeEle && new Hammer(likeEle);
var addToCartEle = document.getElementById('addtoCart'),
addToCartHammer = addToCartEle && new Hammer(addToCartEle),
productId = $('#productId').val();
likeHammer.on('tap', function(e) {
var opt,
favorite;
if (likeHammer) {
likeHammer.on('tap', function(e) {
var opt,
favorite;
var $this = $(e.target);
var $this = $(e.target);
if ($this.hasClass('liked')) {
opt = 'cancel';
favorite = 0;
} else {
opt = 'ok';
favorite = 1;
}
$.ajax({
type: 'POST',
url: '/product/opt/favoriteProduct',
data: {
id: productId,
opt: opt
},
success: function(data) {
if (data.code === 200) {
$this.toggleClass('liked');
if ($this.hasClass('liked')) {
opt = 'cancel';
favorite = 0;
} else {
opt = 'ok';
favorite = 1;
}
$.ajax({
type: 'POST',
url: '/product/opt/favoriteProduct',
data: {
id: productId,
opt: opt
},
success: function(data) {
if (data.code === 200) {
$this.toggleClass('liked');
if ('cancel' === opt) {
tip.show('取消收藏成功');
} else if ('ok' === opt) {
tip.show('收藏成功');
if ('cancel' === opt) {
tip.show('取消收藏成功');
} else if ('ok' === opt) {
tip.show('收藏成功');
}
} else if (data.code === 400) {
location.href = data.data;//未登录跳转登录页
} else {
tip.show(data.message);
}
} else if (data.code === 400) {
location.href = data.data;//未登录跳转登录页
} else {
tip.show(data.message);
}
// 统计代码:用于统计用户加入或取消商品收藏的动作
if (window._yas) {
window._yas.sendCustomInfo({
pd: productId,
fa: favorite
});
// 统计代码:用于统计用户加入或取消商品收藏的动作
if (window._yas) {
window._yas.sendCustomInfo({
pd: productId,
fa: favorite
});
}
},
error: function() {
tip.show('网络断开连接了~');
}
},
error: function() {
tip.show('网络断开连接了~');
}
});
});
}
});
if (addToCartHammer) {
addToCartHammer.on('tap', function(e) {
addToCartHammer.on('tap', function(e) {
// 统计代码:用于统计用户加入购物车的动作
if (window._yas) {
window._yas.sendCustomInfo({
pd: productId,
by: 1
});
}
});
}
// 统计代码:用于统计用户加入购物车的动作
if (window._yas) {
window._yas.sendCustomInfo({
pd: productId,
by: 1
});
}
});
... ... @@ -5134,16 +5164,14 @@ $consultForm.on('submit', function() {
});
});
define("js/product/newsale/hot-rank", ["jquery","hammer","swiper","lazyload","index"], function(require, exports, module){
define("js/product/newsale/hot-rank", ["jquery","swiper","lazyload","index"], function(require, exports, module){
var $ = require("jquery"),
Hammer = require("hammer"),
Swiper = require("swiper"),
lazyLoad = require("lazyload"),
loading = require("js/plugin/loading");
var page = 1,
winH,
hotnav,
listTop,
navSwiper,
notab = 0,
... ... @@ -5152,42 +5180,6 @@ var page = 1,
hotrankNav,
noResult = '<p class="no-result">未找到相关搜索结果</p>';
// var renderRank = {
// errMsg: '<p class="no-result">未找到相关搜索结果</p>',
// navSelector: '.goods-nav',
// rankSelector: '#hotRank',
// navHTML: null,
// data: null,
// inited: 0,
// setData: function(data) {
// this.data = data;
// },
// showDataEmptyMsg: function() {
// $(this.rankSelector).append(this.errMsg);
// },
// isDataEmpty: function() {
// if (this.data.indexOf('>') === -1) {
// return true;
// } else {
// return false;
// }
// },
// appendData: function() {
// if (!this.inited) {
// this.inited = 1;
// }
// $(this.rankSelector).append(this.data);
// },
// render: function(data) {
// this.setData(data);
// if (!this.isDataEmpty()) {
// this.appendData();
// } else {
// this.showDataEmptyMsg();
// }
// }
// };
function hotrank(page, sort, tabId, notab) {
loading.showLoadingMask();
... ... @@ -5201,27 +5193,6 @@ function hotrank(page, sort, tabId, notab) {
notab: notab
},
success: function(data) {
// if (page === 1) {
// $('.no-result').remove();
// $('.rank-main').remove();
// }
// if (notab === 1) {
// if (data === ' ' && $('.rank-main').length < 1) {
// var hotrankNav = $('.goods-nav').prop("outerHTML");
// $('#hotRank').html(hotrankNav + noResult);
// } else {
// $('#hotRank').append(data);
// }
// } else {
// if (data === ' ') {
// $('#hotRank').html(noResult);
// } else {
// $('#hotRank').append(data);
// }
// }
if (data === ' ') {
if ($('.rank-main').length < 1 && $('.goods-nav').length < 1) {
$('#hotRank').html(noResult);
... ... @@ -5237,11 +5208,6 @@ function hotrank(page, sort, tabId, notab) {
$('.rank-main').remove();
$('#hotRank').append(data);
}
// renderRank.render(data);
lazyLoad($('img.lazy'));
$('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
winH = $(window).height();
... ... @@ -5273,14 +5239,12 @@ function scrollHandler() {
hotrank(page, sort, id, notab);
}
//srcoll to load more
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
hotrank(page, sort, id, notab);
hotnav = new Hammer(document.getElementById('hotRank'));
hotnav.on('tap', function(e) {
$('#hotRank').on('touchend touchcancel', function(e) {
var ev = ev || window.event;
var target = ev.target || ev.srcElement;
... ... @@ -5290,14 +5254,24 @@ hotnav.on('tap', function(e) {
id = target.getAttribute('data-id') ? target.getAttribute('data-id') : '';
sort = target.getAttribute('data-sort') ? target.getAttribute('data-sort') : '';
page = 1;
// notab = renderRank.inited;
notab = 1;
hotrank(page, sort, id, notab);
}
});
$('#hotRank').bind('contextmenu', function(e) {
return false;
});
$('#hotRank').on('touchstart', function(e) {
var ev = ev || window.event;
var target = ev.target || ev.srcElement;
if (target.nodeName.toLowerCase() === 'span') {
target.parentNode.className = 'bgActive ' + target.parentNode.className;
}
}).on('touchend touchcancel', function() {
$('.s-goods-nav .nav-item').removeClass('bgActive');
});
});
define("js/me/entry", ["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"], function(require, exports, module){
... ... @@ -7310,7 +7284,7 @@ $page.on('touchstart', '.del-icon', function() {
});
setTimeout(function() {
window.history.go(0);
}, 1000);
}, 2500);
}
},
complete: function() {
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -2,7 +2,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
Created by FontForge 20120731 at Mon Nov 23 16:04:11 2015
Created by FontForge 20120731 at Sat Dec 5 16:26:44 2015
By Ads
</metadata>
<defs>
... ... @@ -19,7 +19,7 @@ Created by FontForge 20120731 at Mon Nov 23 16:04:11 2015
bbox="-0.75 -224 3943 833"
underline-thickness="50"
underline-position="-100"
unicode-range="U+0078-E63E"
unicode-range="U+0078-E63F"
/>
<missing-glyph horiz-adv-x="374"
d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
... ... @@ -252,5 +252,10 @@ t-3.5 -16.5t-5.5 -16.5t-7.5 -15.5t-10 -15t-11.5 -14t-13 -12.5t-14.5 -11.5t-15.5
l-47 -98q-3 -6 -7 -11t-10 -8t-12.5 -4t-13 0.5t-12.5 5.5q-8 3 -13.5 9t-8 13.5t-1.5 16.5t5 16l47 99q23 42 62 64.5t83 16.5q45 -7 77 -39l141 -141q29 -28 38 -65t-4 -75q-17 -43 -34 -60l-72 -73q-5 -4 -9.5 -7t-9.5 -4t-11 -1zM602 87q-4 0 -9 1.5t-8 2.5t-9 4
q-77 58 -154 128q-76 77 -128 154q-9 12 -6 29.5t19 30.5q6 3 13 5t13.5 2t13 -2t11.5 -5.5t9 -8.5q15 -21 27 -36.5t27.5 -35t32 -37t32.5 -32.5q14 -12 21 -18.5t19.5 -17.5t20.5 -18t19.5 -17t20.5 -17.5t19.5 -15.5t20.5 -15q11 -7 16 -17t3 -21.5t-10 -21.5
q-6 -21 -34 -21z" />
<glyph glyph-name="uniE63F" unicode="&#xe63f;" horiz-adv-x="1025"
d="M512 -66q-10 0 -24.5 -0.5t-25 -1t-24 0t-24.5 1.5l-222 -146q0 227 5 243q-164 117 -192 282q-5 30 -5 60q0 122 68.5 223t186 158.5t257.5 57.5q104 0 199 -34t163.5 -92.5t109 -140t40.5 -172.5q0 -167 -126 -290q-124 -121 -312 -144q-37 -5 -74 -5zM512 763
q-91 0 -176.5 -31.5t-148.5 -83.5t-100.5 -124.5t-37.5 -150.5q0 -95 53 -179t142 -138v-170l146 97q16 -3 35.5 -4t49 0t37.5 1q41 0 81 6.5t77 18.5t72 29.5t65 39.5t56.5 47.5t47 55t35 61t22 66t7.5 69.5q0 104 -63.5 194.5t-170.5 143t-229 52.5zM768 300
q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5t45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5zM512 300q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5t45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5zM256 300q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5
t45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5z" />
</font>
</defs></svg>
... ...
... ... @@ -13,7 +13,7 @@
{{/isLogin}}
{{^isLogin}}
<div class="user-info">
<a class="login-btn" href="/signin.html">
<a class="login-btn" href="/signin.html?refer=/home">
登录/注册
</a>
</div>
... ...
... ... @@ -760,8 +760,8 @@ class HomeController extends AbstractAction
$this->setNavHeader('物流详情');
$orderCode = $this->get('order_code');
$data = OrderModel::Logistics($orderCode, $this->_uid);
$data = OrderModel::Logistics($orderCode, $this->_uid);
$data['logisticInfoPage'] = true;
$data['pageFooter'] = true;
... ... @@ -774,26 +774,37 @@ class HomeController extends AbstractAction
public function payAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
$this->setTitle('支付');
$this->setNavHeader('支付');
$orderCode = $this->get('order_code');
if (empty($orderCode)) {
$this->error();
}
$this->_view->display('pay', array(
'payAppInfo' => array(
0 => array(
'appIcon' => '',
'appId' => 'weixin',
'app' => '微信支付',
'hint' => '需下载微信客户端',
'payLink' => Helpers::url('/shopping/pay/index', array('order_code' => $orderCode, 'payment_type' => 18)),
'appId' => 'alipay',
'app' => '支付宝支付',
'hint' => '需下载支付宝客户端',
'subHint' => '推荐使用',
),
1 => array(
'appIcon' => '',
'appId' => 'baidu',
'app' => '百度支付',
'hint' => '需下载百度支付客户端',
'payLink' => '',
'appId' => 'weixin',
'app' => '微信支付',
'hint' => '需下载微信客户端',
'subHint' => '推荐使用',
),
),
'orderCode' => $orderCode,
));
}
... ...
... ... @@ -90,8 +90,9 @@ class OrderModel
//支付方式为非货到付款时,计算订单状态。
if ($vo['payment_type'] != 2) {
switch ($vo['status']) {
case 0: // 备货中
case 0: // 待付款
$result[$key]['unpaid'] = true;
$result[$key]['payUrl'] = Helpers::url('/home/pay', array('order_code' => $vo['order_code']));
break;
//未发货&未收货 状态,统一合并到待收货状态。
case 1:
... ... @@ -117,7 +118,7 @@ class OrderModel
//订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
switch ($vo['status']) {
case 0:
case 0: // 备货中
$result[$key]['unpaid'] = true;
break;
case 1:
... ...