Authored by 毕凯

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

... ... @@ -576,30 +576,31 @@ class Helpers
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 90, 100) : '';
$oneGoods['color'] = $value['color_name'];
$oneGoods['size'] = $value['size_name'];
$oneGoods['isSelected'] = $value['selected'] === 'Y';
$oneGoods['checked'] = $value['selected'] === 'Y';
$oneGoods['price'] = self::transPrice($value['sales_price']);
$oneGoods['count'] = $value['buy_number'];
if ($isValid) {
if ($isValid) { // 库存不足
$oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']);
}
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if (!isset($value['goods_type'])) {
$oneGoods['isSoldOut'] = true;
$oneGoods['inValid'] = true;
} elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
$oneGoods['isGift'] = true;
} elseif ($value['goods_type'] == 'price_gift') {
$oneGoods['isAdvanceBuy'] = true;
} else {
$oneGoods['showCheckbox'] = true;
}
// 上市期
if ($isAdvanceCart && !empty($value['expect_arrival_time'])) {
$oneGoods['appearDate'] = $value['expect_arrival_time'];
}
// 商品链接
if (isset($value['cn_alphabet'])) {
$oneGoods['url'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html');
}
$oneGoods['link'] = self::url('/product/show_' . $value['product_skn'] . '.html');
$arr[$key] = $oneGoods;
}
... ... @@ -629,7 +630,7 @@ class Helpers
$oneGoods['id'] = $single['product_skn'];
$oneGoods['name'] = $single['product_name'];
$oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : '';
$oneGoods['price'] = self::transPrice($single['last_price']);
$oneGoods['price'] = self::transPrice($single['sales_price']);
$oneGoods['marketPrice'] = self::transPrice($single['market_price']);
$oneGoods['count'] = $single['storage_number'];
... ...
... ... @@ -56,6 +56,10 @@ if ($('.cart-nav').length > 0) {
}, 3000);
}
$('.advance-buy').on('touchend', function() {
window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
});
$('.btn-balance').on('touchend', function() {
if (hasChecked) {
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
... ...
... ... @@ -17,9 +17,6 @@ var $chosePanel = $('#chose-panel'),
$num,
$chosed,
$imgsThumb,
// re = /\d+/,
$leftNum,
leftNum,
confirming,
... ... @@ -31,6 +28,7 @@ var $chosePanel = $('#chose-panel'),
$curSizeBlock,
$sizeRowList,
cbFn,
cartType,
$allChoseItems,
$yohoPage = $('.yoho-page');
... ... @@ -41,10 +39,10 @@ function init() {
hasChooseColor = false;
hasChooseSize = false;
$curSizeBlock = null;
$imgsThumb = $('.chose-panel').find('.thumb'),
$allChoseItems = $('.chose-items'),
$sizeRowList = $('.size-list ul'),
$leftNum = $('#left-num'),
$imgsThumb = $('.chose-panel').find('.thumb');
$allChoseItems = $('.chose-items');
$sizeRowList = $('.size-list ul');
$leftNum = $('#left-num');
$firstRow = $sizeRowList.eq(0);
$firstRow.toggleClass('hide');
$curSizeRow = $firstRow;
... ... @@ -77,7 +75,6 @@ function show(html, cb) {
//隐藏当前Panel
function hide() {
$('.chose-panel').hide();
cbFn = null;
}
//修改加入购物车的文字和背景
... ... @@ -168,7 +165,6 @@ $yohoPage.on('touchstart', '.color-list .block', function(e) {
// 之前选中的尺码去掉勾选样式
if ($preSiblingBlock.length > 0) {
$preSiblingBlock.removeClass('chosed');
}
curSizeBlock = $curSizeRow.children().get(scindex);
... ... @@ -328,7 +324,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
productSku: productSku,
buyNumber: buyNumber,
promotionId: promotionId,
isEdit: isEdit
isEdit: isEdit,
cartType: cartType
}
}).done(function(res) {
loading.hideLoadingMask();
... ... @@ -338,7 +335,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
hide();
if (cbFn) {
cbFn(res.location);
cbFn();
}
}
if (res.message) {
... ...
... ... @@ -10,7 +10,8 @@ var $ = require('jquery'),
loading = require('../plugin/loading'),
chosePanel = require('./chose-panel');
var $page = $('.gift-advance-page');
var $page = $('.gift-advance-page'),
queryString = $.queryString();
lazyLoad($('.lazy'));
... ... @@ -24,7 +25,9 @@ function getProductInfo(skn, promotionId) {
tip.show('网络错误');
return;
}
chosePanel.show(html);
chosePanel.show(html, function() {
window.location.href = '/cart/index/orderEnsure?cartType=' + queryString.cartType;
});
}, function() {
tip.show('网络错误');
}).always(function() {
... ...
... ... @@ -142,8 +142,8 @@ function submitOrder() {
cartType: queryString.cartType || queryString.carttype || 'ordinary',
deliveryId: orderInfo('deliveryId'),
deliveryTimeId: orderInfo('deliveryTimeId'),
invoiceText: invoiceText,
invoiceType: $invoice.find('.invoice-type').val() || orderInfo('invoiceType'),
invoiceText: orderInfo('invoice') ? invoiceText : null,
invoiceType: orderInfo('invoice') ? ($invoice.find('.invoice-type').val() || orderInfo('invoiceType')) : null,
msg: msg,
paymentTypeId: orderInfo('paymentTypeId'),
paymentType: orderInfo('paymentType'), //支付方式
... ...
... ... @@ -20,7 +20,15 @@ var api = require('../api'),
var trim = $.trim;
var showErrTip = tip.show;
var requesting = false;
function nextStep(url, mobileNo, areaCode) {
if (requesting) {
return false;
}
requesting = true;
$.ajax({
type: 'POST',
url: '/passport/bind/sendBindMsg',
... ... @@ -31,9 +39,13 @@ function nextStep(url, mobileNo, areaCode) {
success: function(res) {
console.log(res.data);
location.href = url;
requesting = false;
},
error: function() {
tip.show('出错了,请重试!');
requesting = false;
}
});
}
... ...
... ... @@ -65,7 +65,7 @@ if (navtabHammer) {
if (gotoConsultHammer) {
gotoConsultHammer.on('tap', function() {
location.href = $(gotoConsultEle).data('href');
location.href = $(gotoConsultEle).find('a').attr('href');
});
}
... ...
... ... @@ -40,7 +40,6 @@
.thumb {
float: left;
width: 80rem / $pxConvertRem;
height: 106rem / $pxConvertRem;
}
.text-info {
... ...
... ... @@ -119,6 +119,7 @@
<ul class="pay-mode">
{{# paymentWay}}
{{#if isSupport}}
<li class="{{#if recommend}}default{{/if}}" data-pay-type="{{paymentType}}" data-pay-id="{{id}}">
<span class="iconfont">
{{#if recommend}}
... ... @@ -129,6 +130,7 @@
</span>
{{name}}
</li>
{{/if}}
{{/ paymentWay}}
</ul>
{{/ orderEnsure}}
... ...
... ... @@ -93,9 +93,9 @@
{{#if consultsNum}}
{{> product/feedback-tab}}
{{else}}
<div class="nodata tap-hightlight">
<div class="nodata tap-hightlight" id="goto-consult">
<span>暂无商品评价和咨询</span>
<a href="{{link}}" class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a>
<a href="{{consultsUrl}}" class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a>
</div>
{{/if}}
{{/if}}
... ...
... ... @@ -25,7 +25,7 @@
<li class="advance-buy">
<span class="iconfont">&#xe61b;</span>
加价购
<a href="/cart/index/advanceBuy">
<a href="">
<span class="count">{{advanceBuyCount}}</span>
<span class="iconfont icon-right-arrow">&#xe614;</span>
</a>
... ...
... ... @@ -37,7 +37,7 @@
<ul class="size-row clearfix hide">
{{# size}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}">
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id="{{id}}" data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}">
{{name}}
</li>
{{/ size}}
... ...
... ... @@ -4,11 +4,13 @@
{{/if}}
{{#if showCheckbox}}
<span class="checkbox{{#if checked}} icon-cb-checked{{^}} icon-checkbox{{/if}}iconfont"></span>
<span class="checkbox{{#if checked}} icon-cb-checked{{^}} icon-checkbox{{/if}} iconfont"></span>
{{/if}}
<div class="info">
<a href="{{link}}">
<img class="thumb lazy" data-original="{{thumb}}">
</a>
{{#if isAdvanceBuy}}
<p class="few-tag plus-tag">加价购</p>
{{/if}}
... ... @@ -17,7 +19,7 @@
{{/if}}
<div class="deps show">
<p class="name row">{{name}}</p>
<a href="{{link}}" class="name row">{{name}}</a>
<span class="count">
×{{count}}
</span>
... ...
... ... @@ -424,6 +424,13 @@ class CartModel
$oneGoods['price'] = Helpers::transPrice($single['sales_price']);
$oneGoods['count'] = $single['buy_number'];
//gift=>是否赠品,advanceBuy=>是否加价购;
if ($single['goods_type'] == 'gift' && !isset($single['isAdvanceBuy'])) {
$oneGoods['isGift'] = true;
} elseif ($single['goods_type'] == 'price_gift') {
$oneGoods['isAdvanceBuy'] = true;
}
$result['goods'][] = $oneGoods;
}
}
... ... @@ -436,6 +443,7 @@ class CartModel
$onePay['id'] = $pay['payment_id'];
$onePay['paymentType'] = $pay['payment_type'];
$onePay['name'] = $pay['payment_type_name'];
$onePay['isSupport'] = $pay['is_support'] === 'Y';
// $onePay['default'] = ($pay['default'] === 'Y');
if ($onePay['paymentType'] == 1) {
$onePay['recommend'] = true;
... ... @@ -453,24 +461,6 @@ class CartModel
$result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list'];
$price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
$result['price'] = Helpers::transPrice($price);
/*$sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount'];
$freight = '¥0';
if (isset($orderCompute['promotion_formula_list'][1]['promotion_amount'])) {
$freight = $orderCompute['promotion_formula_list'][1]['promotion_amount'];
} elseif(isset($payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount'])) {
$freight = $payReturn['shopping_cart_data']['promotion_formula_list'][1]['promotion_amount'];
}
$couponPrice = isset($orderCompute['coupon_amount']) ? $orderCompute['coupon_amount'] : false;
$salePrice = isset($orderCompute['discount_amount']) ? $orderCompute['discount_amount'] : $payReturn['shopping_cart_data']['discount_amount'];
$price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
$result['sumPrice'] = Helpers::transPrice($sumPrice);
$result['salePrice'] = Helpers::transPrice($salePrice);
$result['price'] = Helpers::transPrice($price);
$result['freight'] = $freight;
$result['couponPrice'] = $couponPrice;*/
}
// 发票有关数据
... ...
... ... @@ -316,7 +316,7 @@ class UserModel
} else {
$data = $records['data']['product_list'];
foreach ($data as &$val) {
$val['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
$val['link'] = Helpers::url('/product/show_' . $val['product_skn'] . '.html');
$val['image'] = !empty($val['image']) ? Helpers::getImageUrl($val['image'], 447, 596) : '';
$val['sales_price'] = Helpers::transPrice($val['sales_price']);
$val['market_price'] = ($val['market_price'] - $val['sales_price'] > 0) ? $val['market_price'] . '.00' : false;
... ...
... ... @@ -149,7 +149,7 @@ class IndexController extends AbstractAction
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$cartType = $this->get('cartType', 'ordinary');
$data = array('giftPage' => true);
$data = array('giftPage' => true, 'cartType' => $cartType);
$data += CartModel::getCartData($uid, $shoppingKey, $cartType, true);
// 渲染模板
... ... @@ -167,7 +167,7 @@ class IndexController extends AbstractAction
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$cartType = $this->get('cartType', 'ordinary');
$data = array('advanceBuyPage' => true);
$data = array('advanceBuyPage' => true, 'cartType' => $cartType);
$data += CartModel::getCartData($uid, $shoppingKey, $cartType, false, true);
// 渲染模板
... ...