Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
10 changed files
with
67 additions
and
25 deletions
@@ -10,7 +10,7 @@ var $ = require('jquery'), | @@ -10,7 +10,7 @@ var $ = require('jquery'), | ||
10 | Handlebars = require('yoho.handlebars'), | 10 | Handlebars = require('yoho.handlebars'), |
11 | tip = require('../plugin/tip'), | 11 | tip = require('../plugin/tip'), |
12 | loading = require('../plugin/loading'), | 12 | loading = require('../plugin/loading'), |
13 | - orderInfo = require('./order-info').orderInfo; | 13 | + order = require('./order-info'); |
14 | 14 | ||
15 | var dispatchModeHammer, | 15 | var dispatchModeHammer, |
16 | dispatchTimeHammer, | 16 | dispatchTimeHammer, |
@@ -18,10 +18,15 @@ var dispatchModeHammer, | @@ -18,10 +18,15 @@ var dispatchModeHammer, | ||
18 | $price = $('.price-cal'), | 18 | $price = $('.price-cal'), |
19 | payType, | 19 | payType, |
20 | priceTmpl = Handlebars.compile($('#tmpl-price').html()), | 20 | priceTmpl = Handlebars.compile($('#tmpl-price').html()), |
21 | - queryString = $.queryString(); | 21 | + queryString = $.queryString(), |
22 | + orderInfo = order.orderInfo; | ||
22 | 23 | ||
23 | lazyLoad(); | 24 | lazyLoad(); |
24 | 25 | ||
26 | +if (window.getUid() !== orderInfo('uid')) { | ||
27 | + order.init(); | ||
28 | +} | ||
29 | + | ||
25 | function dispacthTapEvt(e) { | 30 | function dispacthTapEvt(e) { |
26 | var $cur = $(e.target).closest('li'); | 31 | var $cur = $(e.target).closest('li'); |
27 | 32 | ||
@@ -79,6 +84,12 @@ function orderCompute() { | @@ -79,6 +84,12 @@ function orderCompute() { | ||
79 | if (!res) { | 84 | if (!res) { |
80 | tip.show('网络出错'); | 85 | tip.show('网络出错'); |
81 | } else { | 86 | } else { |
87 | + if (res.order_amount) { | ||
88 | + res.order_amount = (+res.order_amount).toFixed(2); | ||
89 | + } | ||
90 | + if (res.discount_amount) { | ||
91 | + res.discount_amount = (+res.discount_amount).toFixed(2); | ||
92 | + } | ||
82 | if (res.last_order_amount) { | 93 | if (res.last_order_amount) { |
83 | res.last_order_amount = (+res.last_order_amount).toFixed(2); | 94 | res.last_order_amount = (+res.last_order_amount).toFixed(2); |
84 | } | 95 | } |
@@ -6,11 +6,9 @@ | @@ -6,11 +6,9 @@ | ||
6 | var $ = require('jquery'); | 6 | var $ = require('jquery'); |
7 | var info = window.cookie('order-info'); | 7 | var info = window.cookie('order-info'); |
8 | 8 | ||
9 | -// info 必须是 JSON 字符串 | ||
10 | -try { | ||
11 | - info = JSON.parse(info); | ||
12 | -} catch (e) { | 9 | +function init() { |
13 | info = { | 10 | info = { |
11 | + uid: window.getUid(), | ||
14 | deliveryId: 1, | 12 | deliveryId: 1, |
15 | deliveryTimeId: 1, | 13 | deliveryTimeId: 1, |
16 | paymentTypeId: 1, | 14 | paymentTypeId: 1, |
@@ -26,6 +24,15 @@ try { | @@ -26,6 +24,15 @@ try { | ||
26 | window.setCookie('order-info', JSON.stringify(info)); | 24 | window.setCookie('order-info', JSON.stringify(info)); |
27 | } | 25 | } |
28 | 26 | ||
27 | +// info 必须是 JSON 字符串 | ||
28 | +try { | ||
29 | + info = JSON.parse(info); | ||
30 | +} catch (e) { | ||
31 | + init(); | ||
32 | +} | ||
33 | + | ||
34 | +exports.init = init; | ||
35 | + | ||
29 | exports.orderInfo = function(key, value) { | 36 | exports.orderInfo = function(key, value) { |
30 | if (value === undefined) { | 37 | if (value === undefined) { |
31 | return info[key]; | 38 | return info[key]; |
@@ -22,18 +22,24 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), | @@ -22,18 +22,24 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), | ||
22 | ellipsis.init(); | 22 | ellipsis.init(); |
23 | 23 | ||
24 | $newCoupon.on('submit', function() { | 24 | $newCoupon.on('submit', function() { |
25 | + var $this = $(this); | ||
26 | + | ||
27 | + if (!$this.find('[name="couponCode"]').val()) { | ||
28 | + tip.show('请输入优惠券码'); | ||
29 | + return false; | ||
30 | + } | ||
25 | $.ajax({ | 31 | $.ajax({ |
26 | method: 'POST', | 32 | method: 'POST', |
27 | url: '/cart/index/couponSearch', | 33 | url: '/cart/index/couponSearch', |
28 | - data: $(this).serialize() | 34 | + data: $this.serialize() |
29 | }).then(function(res) { | 35 | }).then(function(res) { |
30 | if (res.code === 200) { | 36 | if (res.code === 200) { |
31 | tip.show('优惠券可用'); | 37 | tip.show('优惠券可用'); |
32 | orderInfo('couponCode', res.data.coupon_code); | 38 | orderInfo('couponCode', res.data.coupon_code); |
33 | orderInfo('couponValue', res.data.coupon_value); | 39 | orderInfo('couponValue', res.data.coupon_value); |
34 | - window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code; | 40 | + window.location.href = '/cart/index/orderEnsure'; |
35 | } else { | 41 | } else { |
36 | - tip.show(res.message); | 42 | + tip.show(res.message || '网络错误'); |
37 | } | 43 | } |
38 | }).fail(function() { | 44 | }).fail(function() { |
39 | tip.show('网络错误'); | 45 | tip.show('网络错误'); |
@@ -78,8 +78,14 @@ $.ajax({ | @@ -78,8 +78,14 @@ $.ajax({ | ||
78 | type: 'GET', | 78 | type: 'GET', |
79 | url: '/cart/index/count', | 79 | url: '/cart/index/count', |
80 | success: function(data) { | 80 | success: function(data) { |
81 | + var count; | ||
82 | + | ||
81 | if (data.code === 200) { | 83 | if (data.code === 200) { |
82 | - $cart.find('.num-tag').html(data.data.cart_goods_count).removeClass('hide'); | 84 | + count = data.data.cart_goods_count || 0; |
85 | + if (count > 99) { | ||
86 | + count = '99+'; | ||
87 | + } | ||
88 | + $cart.find('.num-tag').html(count).removeClass('hide'); | ||
83 | } | 89 | } |
84 | } | 90 | } |
85 | }); | 91 | }); |
1 | .order-failure { | 1 | .order-failure { |
2 | background-image: image-url('lazy-failure/order-good.jpg'); | 2 | background-image: image-url('lazy-failure/order-good.jpg'); |
3 | background-size: 100%; | 3 | background-size: 100%; |
4 | -} | ||
4 | +} | ||
5 | + | ||
6 | +.good-failure { | ||
7 | + background-image: image-url('lazy-failure/order-good.jpg'); | ||
8 | + background-size: 132rem / $pxConvertRem !important; | ||
9 | + background-position-x: 40%; | ||
10 | +} | ||
11 | + |
@@ -480,16 +480,19 @@ $basicBtnC:#eb0313; | @@ -480,16 +480,19 @@ $basicBtnC:#eb0313; | ||
480 | } | 480 | } |
481 | } | 481 | } |
482 | .num-tag { | 482 | .num-tag { |
483 | - position: absolute; | ||
484 | - left: pxToRem(66px); | ||
485 | - height: pxToRem(20px); | ||
486 | display: block; | 483 | display: block; |
487 | - width: pxToRem(36px); | ||
488 | - height: pxToRem(36px); | ||
489 | - background-color: $basicBtnC; | ||
490 | - border-radius: 50%; | 484 | + position: absolute; |
485 | + top: 0; | ||
486 | + left: pxToRem(48px); | ||
487 | + width: pxToRem(72px); | ||
488 | + height: pxToRem(72px); | ||
489 | + font-size: pxToRem(40px); | ||
490 | + line-height: pxToRem(72px); | ||
491 | color: #fff; | 491 | color: #fff; |
492 | - font-size: pxToRem(24px); | 492 | + background: $basicBtnC; |
493 | + text-align: center; | ||
494 | + border-radius: 50%; | ||
495 | + @include transform(scale(0.5)); | ||
493 | &.hide{ | 496 | &.hide{ |
494 | display: none; | 497 | display: none; |
495 | } | 498 | } |
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | {{/if}} | 10 | {{/if}} |
11 | 11 | ||
12 | <div class="info"> | 12 | <div class="info"> |
13 | - <img class="thumb lazy" data-original={{url}}> | 13 | + <img class="thumb lazy" data-original={{thumb}}> |
14 | {{#if isAdvanceBuy}} | 14 | {{#if isAdvanceBuy}} |
15 | <p class="few-tag plus-tag">加价购</p> | 15 | <p class="few-tag plus-tag">加价购</p> |
16 | {{^}} | 16 | {{^}} |
@@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
51 | {{/if}} | 51 | {{/if}} |
52 | 52 | ||
53 | 53 | ||
54 | - | 54 | + |
55 | <span class="iconfont icon-del"></span> | 55 | <span class="iconfont icon-del"></span> |
56 | </p> | 56 | </p> |
57 | <p class="row"> | 57 | <p class="row"> |
@@ -466,8 +466,10 @@ class HomeController extends AbstractAction | @@ -466,8 +466,10 @@ class HomeController extends AbstractAction | ||
466 | */ | 466 | */ |
467 | public function onlineServiceDetailAction() | 467 | public function onlineServiceDetailAction() |
468 | { | 468 | { |
469 | - $cateId = $this->get('cateId', 0); | ||
470 | - $cateName = $this->get('cateName', ''); | 469 | + $cateInfo = $this->get('cateInfo', ''); |
470 | + $cate = explode("_", $cateInfo); | ||
471 | + $cateId = intval($cate[0]); | ||
472 | + $cateName = $cate[1]; | ||
471 | if ($cateId > 0) { | 473 | if ($cateId > 0) { |
472 | $service = Home\OnlineModel::getOnlineServiceDetail($cateId); | 474 | $service = Home\OnlineModel::getOnlineServiceDetail($cateId); |
473 | } | 475 | } |
@@ -39,7 +39,7 @@ class OnlineModel | @@ -39,7 +39,7 @@ class OnlineModel | ||
39 | if ($sub) { | 39 | if ($sub) { |
40 | foreach ($sub as $sk => $sv) { | 40 | foreach ($sub as $sk => $sv) { |
41 | $qTmp[$sk]['title'] = $sv['category_name']; | 41 | $qTmp[$sk]['title'] = $sv['category_name']; |
42 | - $qTmp[$sk]['link'] = Helpers::url('/home/onlineservicedetail', array('cateId' => $sv['id'], 'cateName' => $sv['category_name'])); | 42 | + $qTmp[$sk]['link'] = Helpers::url('/home/onlineservicedetail', array('cateInfo' => $sv['id'].'_'.$sv['category_name'])); |
43 | } | 43 | } |
44 | } | 44 | } |
45 | $question[$key]['list'] = $qTmp; | 45 | $question[$key]['list'] = $qTmp; |
-
Please register or login to post a comment