Authored by hf

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

... ... @@ -20,7 +20,7 @@ var requesting = false;
ellipsis.init();
lazyLoad({
try_again_css: 'order-failure'
try_again_css: 'good-failure'
});
... ...
... ... @@ -10,7 +10,7 @@ var $ = require('jquery'),
Handlebars = require('yoho.handlebars'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading'),
orderInfo = require('./order-info').orderInfo;
order = require('./order-info');
var dispatchModeHammer,
dispatchTimeHammer,
... ... @@ -18,10 +18,15 @@ var dispatchModeHammer,
$price = $('.price-cal'),
payType,
priceTmpl = Handlebars.compile($('#tmpl-price').html()),
queryString = $.queryString();
queryString = $.queryString(),
orderInfo = order.orderInfo;
lazyLoad();
if (window.getUid() !== orderInfo('uid')) {
order.init();
}
function dispacthTapEvt(e) {
var $cur = $(e.target).closest('li');
... ... @@ -79,6 +84,12 @@ function orderCompute() {
if (!res) {
tip.show('网络出错');
} else {
if (res.order_amount) {
res.order_amount = (+res.order_amount).toFixed(2);
}
if (res.discount_amount) {
res.discount_amount = (+res.discount_amount).toFixed(2);
}
if (res.last_order_amount) {
res.last_order_amount = (+res.last_order_amount).toFixed(2);
}
... ...
... ... @@ -6,11 +6,9 @@
var $ = require('jquery');
var info = window.cookie('order-info');
// info 必须是 JSON 字符串
try {
info = JSON.parse(info);
} catch (e) {
function init() {
info = {
uid: window.getUid(),
deliveryId: 1,
deliveryTimeId: 1,
paymentTypeId: 1,
... ... @@ -26,6 +24,15 @@ try {
window.setCookie('order-info', JSON.stringify(info));
}
// info 必须是 JSON 字符串
try {
info = JSON.parse(info);
} catch (e) {
init();
}
exports.init = init;
exports.orderInfo = function(key, value) {
if (value === undefined) {
return info[key];
... ...
... ... @@ -22,18 +22,24 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()),
ellipsis.init();
$newCoupon.on('submit', function() {
var $this = $(this);
if (!$this.find('[name="couponCode"]').val()) {
tip.show('请输入优惠券码');
return false;
}
$.ajax({
method: 'POST',
url: '/cart/index/couponSearch',
data: $(this).serialize()
data: $this.serialize()
}).then(function(res) {
if (res.code === 200) {
tip.show('优惠券可用');
orderInfo('couponCode', res.data.coupon_code);
orderInfo('couponValue', res.data.coupon_value);
window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code;
window.location.href = '/cart/index/orderEnsure';
} else {
tip.show(res.message);
tip.show(res.message || '网络错误');
}
}).fail(function() {
tip.show('网络错误');
... ...
... ... @@ -78,8 +78,14 @@ $.ajax({
type: 'GET',
url: '/cart/index/count',
success: function(data) {
var count;
if (data.code === 200) {
$cart.find('.num-tag').html(data.data.cart_goods_count).removeClass('hide');
count = data.data.cart_goods_count || 0;
if (count > 99) {
count = '99+';
}
$cart.find('.num-tag').html(count).removeClass('hide');
}
}
});
... ...
.order-failure {
background-image: image-url('lazy-failure/order-good.jpg');
background-size: 100%;
}
\ No newline at end of file
}
.good-failure {
background-image: image-url('lazy-failure/order-good.jpg');
background-size: 132rem / $pxConvertRem !important;
background-position-x: 40%;
}
... ...
... ... @@ -480,16 +480,19 @@ $basicBtnC:#eb0313;
}
}
.num-tag {
position: absolute;
left: pxToRem(66px);
height: pxToRem(20px);
display: block;
width: pxToRem(36px);
height: pxToRem(36px);
background-color: $basicBtnC;
border-radius: 50%;
position: absolute;
top: 0;
left: pxToRem(48px);
width: pxToRem(72px);
height: pxToRem(72px);
font-size: pxToRem(40px);
line-height: pxToRem(72px);
color: #fff;
font-size: pxToRem(24px);
background: $basicBtnC;
text-align: center;
border-radius: 50%;
@include transform(scale(0.5));
&.hide{
display: none;
}
... ...
... ... @@ -10,7 +10,7 @@
{{/if}}
<div class="info">
<img class="thumb lazy" data-original={{url}}>
<img class="thumb lazy" data-original={{thumb}}>
{{#if isAdvanceBuy}}
<p class="few-tag plus-tag">加价购</p>
{{^}}
... ... @@ -51,7 +51,7 @@
{{/if}}
<span class="iconfont icon-del">&#xe621;</span>
</p>
<p class="row">
... ...
... ... @@ -466,8 +466,10 @@ class HomeController extends AbstractAction
*/
public function onlineServiceDetailAction()
{
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
$cateInfo = $this->get('cateInfo', '');
$cate = explode("_", $cateInfo);
$cateId = intval($cate[0]);
$cateName = $cate[1];
if ($cateId > 0) {
$service = Home\OnlineModel::getOnlineServiceDetail($cateId);
}
... ...
... ... @@ -39,7 +39,7 @@ class OnlineModel
if ($sub) {
foreach ($sub as $sk => $sv) {
$qTmp[$sk]['title'] = $sv['category_name'];
$qTmp[$sk]['link'] = Helpers::url('/home/onlineservicedetail', array('cateId' => $sv['id'], 'cateName' => $sv['category_name']));
$qTmp[$sk]['link'] = Helpers::url('/home/onlineservicedetail', array('cateInfo' => $sv['id'].'_'.$sv['category_name']));
}
}
$question[$key]['list'] = $qTmp;
... ...