Authored by 梁志锋

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

... ... @@ -23,15 +23,17 @@ class Yohobuy
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_URL = 'http://apih5.yoho.cn/';
const API_URL2 = 'http://apih5.yoho.cn/';
const SERVICE_URL = 'http://serviceh5.yoho.cn/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_URL = 'http://apih5.yoho.cn/';
// const API_URL2 = 'http://apih5.yoho.cn/';
// const SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
/* 测试环境 */
// const API_URL = 'http://testapi.yoho.cn:28078/';
// const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_URL = 'http://testapi.yoho.cn:28078/';
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://test2.open.yohobuy.com/';
/**
... ...
... ... @@ -38,7 +38,7 @@ class HelpData
$param['code'] = $code;
$param['return_type'] = 'html';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param, true);
return Yohobuy::post(Yohobuy::API_OLD, $param, true);
}
... ...
... ... @@ -129,7 +129,7 @@ class Helpers
*/
public static function getShoppingKeyByCookie()
{
$cookie = isset($_COOKIE['_Spk']) ? $_COOKIE['_Spk'] : '';
$cookie = isset($_COOKIE['_SPK']) ? $_COOKIE['_SPK'] : '';
return $cookie;
}
... ...
... ... @@ -9,6 +9,7 @@ var $ = require('jquery'),
Hammer = require('yoho.hammer');
var chosePanel = require('./chose-panel'),
dialog = require('../me/dialog'),
tip = require('../plugin/tip');
var $cartContent = $('.cart-content');
... ... @@ -20,6 +21,48 @@ var navHammer,
var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品
function shouldSelectGift() {
var $freebie = $('.freebie');
if ($freebie.length <= 0) {
return false;
}
return true;
}
function shouldLowStocks() {
var $lowStocks = $('.low-stocks'),
result = false;
if ($lowStocks.length <= 0) {
return result;
}
$lowStocks.each(function(idx, item) {
if ($(item).parent().parent().parent().siblings('.checkbox').hasClass('icon-cb-checked')) {
result = true;
return false;
}
});
return result;
}
function showChooseGifDialog() {
dialog.showDialog({
dialogText: '您还未选择赠品,是否去选择赠品',
hasFooter: {
leftBtnText: '我不要赠品',
rightBtnText: '去选择'
}
}, function() {
window.location.href = $('.freebie').find('a').attr('href');
}, function() {
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
});
}
require('./good');
lazyLoad($('img.lazy'));
... ... @@ -87,7 +130,11 @@ if ($('.freebie').length > 0) {
//});
$('.btn-balance').on('touchend', function() {
if ($('.low-stocks').length > 0) {
if (shouldSelectGift()) {
showChooseGifDialog();
return false;
}
if (shouldLowStocks()) {
tip.show('库存不足无法结算');
return false;
}
... ... @@ -103,7 +150,7 @@ $('.chose').on('touchend', function() {
chosePanel.show();
});
if ($('.cart-zero').length > 0) {
if ($('.shopping-cart-good').length <= 0) {
require('../product/recommend-for-you');
}
... ...
... ... @@ -23,7 +23,8 @@ var dispatchModeHammer,
payType,
priceTmpl = Handlebars.compile($('#tmpl-price').html()),
queryString = $.queryString(),
orderInfo = order.orderInfo;
orderInfo = order.orderInfo,
isSubmiting;
lazyLoad();
... ... @@ -127,6 +128,9 @@ function submitOrder() {
var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
msg = $('#msg').find('input').val() || orderInfo('msg');
if (isSubmiting) {
return false;
}
if (orderInfo('invoice')) {
if (!invoiceText) {
tip.show('请输入发票抬头');
... ... @@ -144,6 +148,7 @@ function submitOrder() {
}
}
loading.showLoadingMask();
isSubmiting = true;
$.ajax({
method: 'POST',
url: '/cart/index/orderSub',
... ... @@ -184,6 +189,7 @@ function submitOrder() {
}).fail(function() {
tip.show('网络出错');
}).always(function() {
isSubmiting = false;
loading.hideLoadingMask();
});
}
... ...
... ... @@ -191,8 +191,8 @@ function getCouponDate() {
getCouponDate();
$(window).scroll(function() {
if ($(window).scrollTop() + $(window).height() > $('body').height() * 0.9) {
getCouponDate();
}
});
// $(window).scroll(function() {
// if ($(window).scrollTop() + $(window).height() > $('body').height() * 0.9) {
// getCouponDate();
// }
// });
... ...
... ... @@ -33,7 +33,7 @@ dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' +
dialogTemplate = Handlebars.compile(dialogTpl);
exports.showDialog = function(data, callback) {
exports.showDialog = function(data, callback, callbackForLeft) {
var dialogStr = dialogTemplate(data),
$dialogBox,
... ... @@ -76,6 +76,9 @@ exports.showDialog = function(data, callback) {
dialogWrapperHammer.on('tap', function(event) {
if ($(event.target).hasClass('dialog-left-btn')) {
if (typeof callbackForLeft === 'function') {
callbackForLeft();
}
$dialogWrapper.fadeOut();
} else if ($(event.target).hasClass('dialog-right-btn')) {
callback();
... ...
... ... @@ -19,6 +19,9 @@ $.ajax({
if (count > 99) {
count = '99+';
}
if (count === 0) {
$('.cart-count').remove();
}
$cart.find('.cart-count').html(count).removeClass('hide');
}
}
... ...
... ... @@ -185,7 +185,7 @@
height: pxToRem(60px);
color: #444;
background: #efefef;
font-size: pxToRem(16px);
font-size: pxToRem(24px);
line-height: 1;
outline: 0;
border: 0;
... ...
... ... @@ -61,7 +61,7 @@
position: relative;
margin-top: pxToRem(30px);
margin-bottom: pxToRem(30px);
font-size: pxToRem(14px);
font-size: pxToRem(28px);
line-height: 2;
color: #b0b0b0;
text-align: center;
... ...
... ... @@ -33,3 +33,9 @@
}
}
}
.deal_main{
margin: .5rem 3%;
font-size:1.2em;
widows: 94%;
overflow: hidden;
}
\ No newline at end of file
... ...
... ... @@ -46,6 +46,9 @@
{{#if isAdvanceBuy}}
<span class="sale-price">¥{{salesPrice}}</span>
{{/if}}
{{#if isGift}}
<span class="sale-price">¥{{salesPrice}}</span>
{{/if}}
</p>
{{#if isVipPrice}}
<span class="vip">
... ...
... ... @@ -640,16 +640,13 @@ class HomeController extends AbstractAction
* 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
*
*/
public function ordersAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
$backUrl = Helpers::url('/home');
$this->setTitle('我的订单');
$this->setNavHeader('我的订单', $backUrl);
$this->setNavHeader('我的订单', Helpers::url('/home') );
$order = array();
//获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
... ... @@ -887,7 +884,7 @@ class HomeController extends AbstractAction
$this->setTitle($caption);
$this->setNavHeader($caption);
$this->_view->display('helpDetail', array(
$this->_view->display('help-detail', array(
'iHelp' => Home\HelpModel::serviceDetail($code),
));
}
... ...
... ... @@ -71,7 +71,7 @@ class HomeModel
/**
* 设置选择的频道保存到浏览器COOKIE
* (已废弃,改成JS设置)
* (已废弃,改成JS设置)
*
* @param string $cookie
* @return void
... ...
... ... @@ -289,7 +289,6 @@ class IndexController extends AbstractAction
$this->go(Helpers::url('/cart/index/index'));
}
$cookieData = $this->getCookie('order-info', null);
$uid = $this->getUid(true);
$data = array(
... ... @@ -457,8 +456,8 @@ class IndexController extends AbstractAction
$result = CartModel::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey);
// 设置加入购物车凭证到客户端浏览器
if (!$shoppingKey && isset($result['data']['shopping_key'])) {
$this->setCookie('_Spk', $result['data']['shopping_key']);
if (empty($shoppingKey) && isset($result['data']['shopping_key'])) {
$this->setCookie('_SPK', $result['data']['shopping_key'], time() + 86400 * 360);
}
}
... ...
... ... @@ -17,6 +17,10 @@ class LoginController extends AbstractAction
*/
public function indexAction()
{
// 清除客户端
$this->setCookie('_UID', '');
$this->setCookie('_TOKEN', '');
$refer = $this->get('refer');
if (!empty($refer)) {
$this->setCookie('refer', $refer);
... ... @@ -61,7 +65,6 @@ class LoginController extends AbstractAction
$data['isPassportPage'] = true; // 模板中模块标识
$data['areaCode'] = '+86'; // 默认区号
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
// 渲染模板
$this->_view->display('international', $data);
}
... ... @@ -74,6 +77,7 @@ class LoginController extends AbstractAction
// 清除客户端
$this->setCookie('_UID', '');
$this->setCookie('_TOKEN', '');
$this->setCookie('_SPK', '');
// 清除服务端会话
$this->setSession('_TOKEN', '');
... ...