resolve confilct
Showing
20 changed files
with
280 additions
and
181 deletions
@@ -443,13 +443,13 @@ class Helpers | @@ -443,13 +443,13 @@ class Helpers | ||
443 | * @param string $areaMobile | 443 | * @param string $areaMobile |
444 | * @return boolean | 444 | * @return boolean |
445 | */ | 445 | */ |
446 | - public static function verifyAreaMobile($areaMobile) | 446 | + public static function verifyAreaMobile($areaMobile, $area) |
447 | { | 447 | { |
448 | if (empty($areaMobile)) { | 448 | if (empty($areaMobile)) { |
449 | return false; | 449 | return false; |
450 | } | 450 | } |
451 | if (!strpos($areaMobile, '-')) { | 451 | if (!strpos($areaMobile, '-')) { |
452 | - return self::areaMobielVerify($areaMobile); | 452 | + return self::areaMobielVerify($areaMobile, $area); |
453 | } else { | 453 | } else { |
454 | $mobileData = explode('-', $areaMobile); | 454 | $mobileData = explode('-', $areaMobile); |
455 | if (count($mobileData) != 2) { | 455 | if (count($mobileData) != 2) { |
@@ -601,7 +601,7 @@ class Helpers | @@ -601,7 +601,7 @@ class Helpers | ||
601 | } | 601 | } |
602 | 602 | ||
603 | /** | 603 | /** |
604 | - * 格式化加价购商品 | 604 | + * 格式化加价购和赠品商品 |
605 | * | 605 | * |
606 | * @param array $advanceGoods 加价购商品列表 | 606 | * @param array $advanceGoods 加价购商品列表 |
607 | * @param int $count 计商品件数 | 607 | * @param int $count 计商品件数 |
@@ -615,6 +615,7 @@ class Helpers | @@ -615,6 +615,7 @@ class Helpers | ||
615 | $oneGoods = array(); | 615 | $oneGoods = array(); |
616 | foreach ($advanceGoods as $value) { | 616 | foreach ($advanceGoods as $value) { |
617 | $gift = array(); | 617 | $gift = array(); |
618 | + $gift['promotionId'] = $value['promotion_id']; | ||
618 | $gift['promotionTitle'] = $value['promotion_title']; | 619 | $gift['promotionTitle'] = $value['promotion_title']; |
619 | 620 | ||
620 | foreach ($value['goods_list'] as $single) { | 621 | foreach ($value['goods_list'] as $single) { |
@@ -8,13 +8,13 @@ var $ = require('jquery'), | @@ -8,13 +8,13 @@ var $ = require('jquery'), | ||
8 | lazyLoad = require('yoho.lazyload'), | 8 | lazyLoad = require('yoho.lazyload'), |
9 | Hammer = require('yoho.hammer'); | 9 | Hammer = require('yoho.hammer'); |
10 | 10 | ||
11 | -var chosePanel = require('./chose-panel'), | ||
12 | - cartInfo = require('./cart-info').cartInfo; | 11 | +var chosePanel = require('./chose-panel'); |
13 | 12 | ||
14 | var $cartContent = $('.cart-content'); | 13 | var $cartContent = $('.cart-content'); |
15 | 14 | ||
16 | var navHammer, | 15 | var navHammer, |
17 | - cartType = 'ordinary'; | 16 | + cartType = 'ordinary', |
17 | + cartInfo; | ||
18 | 18 | ||
19 | require('./good'); | 19 | require('./good'); |
20 | 20 | ||
@@ -28,6 +28,12 @@ navHammer.on('tap', function(e) { | @@ -28,6 +28,12 @@ navHammer.on('tap', function(e) { | ||
28 | return; | 28 | return; |
29 | } | 29 | } |
30 | 30 | ||
31 | + if (cartType === 'ordinary') { | ||
32 | + cartType = 'advance'; | ||
33 | + } else { | ||
34 | + cartType = 'ordinary'; | ||
35 | + } | ||
36 | + | ||
31 | $this.siblings('.active').removeClass('active'); | 37 | $this.siblings('.active').removeClass('active'); |
32 | $this.addClass('active'); | 38 | $this.addClass('active'); |
33 | 39 | ||
@@ -41,7 +47,7 @@ navHammer.on('tap', function(e) { | @@ -41,7 +47,7 @@ navHammer.on('tap', function(e) { | ||
41 | 47 | ||
42 | 48 | ||
43 | $('.btn-balance').on('touchend', function() { | 49 | $('.btn-balance').on('touchend', function() { |
44 | - window.location.href = '/shoppingCart/orderEnsure?cartType=' + cartType; | 50 | + window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
45 | }); | 51 | }); |
46 | 52 | ||
47 | //$('.advance-buy').on('touchend', function() { | 53 | //$('.advance-buy').on('touchend', function() { |
@@ -66,4 +72,4 @@ $('.chose').on('touchend', function() { | @@ -66,4 +72,4 @@ $('.chose').on('touchend', function() { | ||
66 | 72 | ||
67 | 73 | ||
68 | 74 | ||
69 | -cartInfo = 0; | ||
75 | +cartInfo = 0; |
@@ -12,7 +12,25 @@ var $ = require('jquery'); | @@ -12,7 +12,25 @@ var $ = require('jquery'); | ||
12 | // var $page = $('.yoho-page'); | 12 | // var $page = $('.yoho-page'); |
13 | 13 | ||
14 | var $num, | 14 | var $num, |
15 | - $chosed; | 15 | + $chosed, |
16 | + re = /\d+/, | ||
17 | + leftNum, | ||
18 | + $colorList = $('.color-list ul>li'), | ||
19 | + $sizeList = $('.size-list ul>li'), | ||
20 | + firstColorId = $colorList.eq(0).data('id'), | ||
21 | + colorIndex; | ||
22 | + | ||
23 | +//初始化购物车面板显示 | ||
24 | +$sizeList.each(function() { | ||
25 | + colorIndex = $(this).data('colorid'); | ||
26 | + | ||
27 | + | ||
28 | + if (colorIndex === firstColorId) { | ||
29 | + $(this).removeClass('hide'); | ||
30 | + } | ||
31 | +}); | ||
32 | + | ||
33 | +// confirm; | ||
16 | 34 | ||
17 | // var tpl; | 35 | // var tpl; |
18 | 36 | ||
@@ -35,8 +53,11 @@ var $num, | @@ -35,8 +53,11 @@ var $num, | ||
35 | // $num = $('#good-num'); | 53 | // $num = $('#good-num'); |
36 | // } | 54 | // } |
37 | 55 | ||
56 | + | ||
57 | + | ||
38 | function show() { | 58 | function show() { |
39 | $('.chose-panel').show(); | 59 | $('.chose-panel').show(); |
60 | + | ||
40 | $('body').css('overflow', 'hidden'); | 61 | $('body').css('overflow', 'hidden'); |
41 | $num = $('#good-num'); | 62 | $num = $('#good-num'); |
42 | } | 63 | } |
@@ -58,10 +79,43 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -58,10 +79,43 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
58 | remove(); | 79 | remove(); |
59 | }).on('touchstart', '#chose-btn-sure', function() { | 80 | }).on('touchstart', '#chose-btn-sure', function() { |
60 | 81 | ||
61 | - //确定 | ||
62 | -}).on('touchstart', '.block', function(e) { | 82 | + // var productSku, |
83 | + // buyNumber = $('#good-num') - 0; | ||
84 | + // promotionId, | ||
85 | + // goodsType, | ||
86 | + // isEdit; | ||
87 | + | ||
88 | + // //确定 | ||
89 | + // $chosed = $('.block-list>ul>li.chosed'); | ||
90 | + | ||
91 | + // if (2 === $chosed.length && 2 !== $chosed.closest('.zero-stock').length) { | ||
92 | + | ||
93 | + // if (confirm) { | ||
94 | + // return false; | ||
95 | + // } | ||
96 | + | ||
97 | + // confirm = true; | ||
98 | + // loading.showLoadingMask(); | ||
99 | + // $.ajax({ | ||
100 | + // method: 'POST', | ||
101 | + // url: '/cart/index/add', | ||
102 | + // data: { | ||
103 | + // product_id: productId, | ||
104 | + // content: content | ||
105 | + // } | ||
106 | + // }).done(function(res) { | ||
107 | + // if (res.code === 200) { | ||
108 | + // loading.hideLoadingMask(); | ||
109 | + // confirm = false; | ||
110 | + // remove(); | ||
111 | + // } | ||
112 | + // }).fail(function() { | ||
113 | + // tip.show('网络出了点问题~'); | ||
114 | + // confirm = false; | ||
115 | + // }); | ||
116 | + // } | ||
63 | 117 | ||
64 | - //尺寸颜色点选 | 118 | +}).on('touchstart', '.block', function(e) { |
65 | var $this = $(this), | 119 | var $this = $(this), |
66 | $that = $(e.target).closest('.chose-items'), | 120 | $that = $(e.target).closest('.chose-items'), |
67 | numArray, | 121 | numArray, |
@@ -96,6 +150,19 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -96,6 +150,19 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
96 | } | 150 | } |
97 | }); | 151 | }); |
98 | } else if ($chosed.length === 1 && $this.hasClass('chosed')) { | 152 | } else if ($chosed.length === 1 && $this.hasClass('chosed')) { |
153 | + if ($this.closest('.block-list').hasClass('color-list')) { | ||
154 | + | ||
155 | + $sizeList.addClass('hide'); | ||
156 | + | ||
157 | + //切换尺码信息 | ||
158 | + $sizeList.each(function() { | ||
159 | + colorIndex = $(this).data('colorid'); | ||
160 | + if (colorIndex === $this.data('id')) { | ||
161 | + $(this).removeClass('hide'); | ||
162 | + } | ||
163 | + }); | ||
164 | + } | ||
165 | + | ||
99 | numArray = $chosed.data('numstr').split('/'); | 166 | numArray = $chosed.data('numstr').split('/'); |
100 | $siblingBlock.find('.block').removeClass('zero-stock'); | 167 | $siblingBlock.find('.block').removeClass('zero-stock'); |
101 | for (i = 0; i < numArray.length; i++) { | 168 | for (i = 0; i < numArray.length; i++) { |
@@ -104,6 +171,9 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -104,6 +171,9 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
104 | } | 171 | } |
105 | } | 172 | } |
106 | } else if ($chosed.length === 1 && !$this.hasClass('chosed')) { | 173 | } else if ($chosed.length === 1 && !$this.hasClass('chosed')) { |
174 | + $('#chose-btn-sure').css('background-color', '#eb0313'); | ||
175 | + $('#chose-btn-sure').html('确定'); | ||
176 | + | ||
107 | $siblingBlock.find('ul>li').each(function() { | 177 | $siblingBlock.find('ul>li').each(function() { |
108 | $(this).removeClass('zero-stock'); | 178 | $(this).removeClass('zero-stock'); |
109 | if (0 === $(this).data('num') - 0) { | 179 | if (0 === $(this).data('num') - 0) { |
@@ -123,19 +193,23 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -123,19 +193,23 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
123 | if (2 === $chosed.closest('.zero-stock').length) { | 193 | if (2 === $chosed.closest('.zero-stock').length) { |
124 | $('#chose-btn-sure').css('background-color', '#c0c0c0'); | 194 | $('#chose-btn-sure').css('background-color', '#c0c0c0'); |
125 | $('#chose-btn-sure').html('已售罄'); | 195 | $('#chose-btn-sure').html('已售罄'); |
196 | + } else { | ||
197 | + $('#chose-btn-sure').css('background-color', '#eb0313'); | ||
198 | + $('#chose-btn-sure').html('确定'); | ||
126 | } | 199 | } |
127 | } | 200 | } |
128 | 201 | ||
129 | }).on('touchstart', '.btn-minus', function() { | 202 | }).on('touchstart', '.btn-minus', function() { |
130 | var num = +$num.val(), | 203 | var num = +$num.val(), |
131 | - $chosed = $('.block-list>ul>li.chosed'); | 204 | + $chosed = $('.block-list>ul>li.chosed'), |
205 | + leftNum = re.exec($('.num .left-num').html()); | ||
132 | 206 | ||
133 | //若颜色和尺码没有被同时选中,则不能点击 | 207 | //若颜色和尺码没有被同时选中,则不能点击 |
134 | if ($chosed.length < 2) { | 208 | if ($chosed.length < 2) { |
135 | return; | 209 | return; |
136 | } | 210 | } |
137 | 211 | ||
138 | - if (num === 0) { | 212 | + if (num === 1 || 0 === leftNum - 0) { |
139 | return; | 213 | return; |
140 | } | 214 | } |
141 | 215 | ||
@@ -147,6 +221,10 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -147,6 +221,10 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
147 | if ($('.block-list>ul>li.chosed').length < 2) { | 221 | if ($('.block-list>ul>li.chosed').length < 2) { |
148 | return; | 222 | return; |
149 | } | 223 | } |
224 | + leftNum = re.exec($('.num .left-num').html()); | ||
225 | + if (num - 0 === leftNum - 0 || 0 === leftNum - 0) { | ||
226 | + return; | ||
227 | + } | ||
150 | 228 | ||
151 | //TODO:库存数验证 | 229 | //TODO:库存数验证 |
152 | $num.val(num + 1); | 230 | $num.val(num + 1); |
@@ -5,25 +5,52 @@ | @@ -5,25 +5,52 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | - lazyLoad = require('yoho.lazyload'); | 8 | + lazyLoad = require('yoho.lazyload'), |
9 | + Handlebars = require('yoho.handlebars'), | ||
10 | + tip = require('../plugin/tip'), | ||
11 | + chosePanel = require('./chose-panel'); | ||
9 | 12 | ||
10 | -//var chosePanel = require('./chose-panel'); | 13 | +var panelTmpl, |
14 | + $page = $('.gift-advance-page'), | ||
15 | + $chosePanel = $('#chose-panel'); | ||
11 | 16 | ||
12 | lazyLoad($('.lazy')); | 17 | lazyLoad($('.lazy')); |
13 | 18 | ||
14 | -//$('.gift-advance-page').on('touchstart', '.chose', function() { | ||
15 | -// var id = $(this).closest('.gift-advance-good').data('id'); | ||
16 | -// | ||
17 | -// $.ajax({ | ||
18 | -// type: 'GET', | ||
19 | -// url: '/shoppingCart/goodinfo', | ||
20 | -// data: { | ||
21 | -// id: id | ||
22 | -// }, | ||
23 | -// success: function(data) { | ||
24 | -// if (data.code === 200) { | ||
25 | -// chosePanel.show(data.data); | ||
26 | -// } | ||
27 | -// } | ||
28 | -// }); | ||
29 | -//}); | ||
19 | +$.get('/cart/index/giftinfoTpl', function(html) { | ||
20 | + if (!html) { | ||
21 | + tip.show('网络错误'); | ||
22 | + return; | ||
23 | + } | ||
24 | + panelTmpl = Handlebars.compile(html); | ||
25 | +}).fail(function() { | ||
26 | + tip.show('网络错误'); | ||
27 | +}); | ||
28 | + | ||
29 | +function getProductInfo(skn, promotionId) { | ||
30 | + $.get('/cart/index/giftinfo', { | ||
31 | + skn: skn, | ||
32 | + promotionId: promotionId | ||
33 | + }).then(function(res) { | ||
34 | + if (!res) { | ||
35 | + tip.show('网络错误'); | ||
36 | + return; | ||
37 | + } | ||
38 | + console.log(res); | ||
39 | + if (res.code === 200) { | ||
40 | + $chosePanel.html(panelTmpl(res.data)); | ||
41 | + chosePanel.show(); | ||
42 | + } else { | ||
43 | + tip.show(res.message || '网络错误'); | ||
44 | + } | ||
45 | + }).fail(function() { | ||
46 | + tip.show('网络错误'); | ||
47 | + }); | ||
48 | +} | ||
49 | + | ||
50 | +$page.on('touchend', '.chose', function() { | ||
51 | + var $this = $(this), | ||
52 | + id = $this.closest('.gift-advance-good').data('id'), | ||
53 | + promotionId = $this.closest('.advance-block').data('promotion-id'); | ||
54 | + | ||
55 | + getProductInfo(id, promotionId); | ||
56 | +}); |
@@ -47,7 +47,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -47,7 +47,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
47 | 47 | ||
48 | $.ajax({ | 48 | $.ajax({ |
49 | type: 'GET', | 49 | type: 'GET', |
50 | - url: '/shoppingCart/select', | 50 | + url: '/cart/index/select', |
51 | data: { | 51 | data: { |
52 | id: id | 52 | id: id |
53 | } | 53 | } |
@@ -61,7 +61,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -61,7 +61,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
61 | } | 61 | } |
62 | $.ajax({ | 62 | $.ajax({ |
63 | type: 'GET', | 63 | type: 'GET', |
64 | - url: '/shoppingCart/getCartData', | 64 | + url: '/cart/index/getCartData', |
65 | data: { | 65 | data: { |
66 | id: id | 66 | id: id |
67 | }, | 67 | }, |
@@ -82,18 +82,22 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -82,18 +82,22 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
82 | }); | 82 | }); |
83 | }).on('touchstart', '.icon-edit', function() { | 83 | }).on('touchstart', '.icon-edit', function() { |
84 | 84 | ||
85 | - var $this = $(this), | ||
86 | - $cartgood = $this.closest('.shopping-cart-good'), | ||
87 | - $viewGood = $cartgood.find('.deps'), | ||
88 | - $editGoot = $cartgood.find('.calculate-num'); | ||
89 | - | ||
90 | - if ($viewGood.hasClass('show')) { | ||
91 | - $viewGood.removeClass('show').addClass('hide'); | ||
92 | - $editGoot.removeClass('hide').addClass('show'); | ||
93 | - } else { | ||
94 | - $viewGood.removeClass('hide').addClass('show'); | ||
95 | - $editGoot.removeClass('show').addClass('hide'); | ||
96 | - } | 85 | + //var $this = $(this); |
86 | + // | ||
87 | + //var $cartgood = $this.closest('.shopping-cart-good'); | ||
88 | + // | ||
89 | + ////var id = $this.closest('.shopping-cart-good').data('id'); | ||
90 | + // | ||
91 | + //var $viewGood = $cartgood.find('.deps'); | ||
92 | + // $editGoot = $cartgood.find('.calculate-num'); | ||
93 | + // | ||
94 | + //if ($viewGood.hasClass('show')) { | ||
95 | + // $viewGood.removeClass('show').addClass('hide'); | ||
96 | + // $editGoot.removeClass('hide').addClass('show'); | ||
97 | + //} else { | ||
98 | + // $viewGood.removeClass('hide').addClass('show'); | ||
99 | + // $editGoot.removeClass('show').addClass('hide'); | ||
100 | + //} | ||
97 | 101 | ||
98 | 102 | ||
99 | }).on('touchstart', '.icon-del', function(e) { | 103 | }).on('touchstart', '.icon-del', function(e) { |
@@ -119,7 +123,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -119,7 +123,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
119 | 123 | ||
120 | $.ajax({ | 124 | $.ajax({ |
121 | method: 'post', | 125 | method: 'post', |
122 | - url: '/shoppingCart/del', | 126 | + url: '/cart/index/del', |
123 | data: { | 127 | data: { |
124 | id: id | 128 | id: id |
125 | } | 129 | } |
@@ -282,10 +286,6 @@ $selectAllBtn.on('touchend', function() { | @@ -282,10 +286,6 @@ $selectAllBtn.on('touchend', function() { | ||
282 | 286 | ||
283 | 287 | ||
284 | 288 | ||
285 | -$('.btn-balance').on('touchend', function() { | ||
286 | - window.location.href = '/shoppingCart/orderEnsure?cartType=' + 'ordinary'; | ||
287 | -}); | ||
288 | - | ||
289 | $('.down').on('touchend', function() { | 289 | $('.down').on('touchend', function() { |
290 | chosePanel.show(); | 290 | chosePanel.show(); |
291 | }); | 291 | }); |
@@ -294,7 +294,7 @@ $('.cut').on('touchend', function() { | @@ -294,7 +294,7 @@ $('.cut').on('touchend', function() { | ||
294 | 294 | ||
295 | $.ajax({ | 295 | $.ajax({ |
296 | type: 'GET', | 296 | type: 'GET', |
297 | - url: '/shoppingCart/modify', | 297 | + url: '/cart/index/modify', |
298 | data: { | 298 | data: { |
299 | old_product_sku: id, | 299 | old_product_sku: id, |
300 | new_product_sku: id, | 300 | new_product_sku: id, |
@@ -17,7 +17,8 @@ var dispatchModeHammer, | @@ -17,7 +17,8 @@ var dispatchModeHammer, | ||
17 | $invoice = $('.invoice'), | 17 | $invoice = $('.invoice'), |
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 | 22 | ||
22 | lazyLoad(); | 23 | lazyLoad(); |
23 | 24 | ||
@@ -101,7 +102,7 @@ function submitOrder() { | @@ -101,7 +102,7 @@ function submitOrder() { | ||
101 | url: '/cart/index/orderSub', | 102 | url: '/cart/index/orderSub', |
102 | data: { | 103 | data: { |
103 | addressId: orderInfo('addressId'), | 104 | addressId: orderInfo('addressId'), |
104 | - cartType: orderInfo('cartType'), | 105 | + cartType: queryString.cartType || queryString.carttype || 'ordinary', |
105 | deliveryId: orderInfo('deliveryId'), | 106 | deliveryId: orderInfo('deliveryId'), |
106 | deliveryTimeId: orderInfo('deliveryTimeId'), | 107 | deliveryTimeId: orderInfo('deliveryTimeId'), |
107 | invoiceText: $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'), | 108 | invoiceText: $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'), |
@@ -132,7 +133,7 @@ function submitOrder() { | @@ -132,7 +133,7 @@ function submitOrder() { | ||
132 | window.location.href = url; | 133 | window.location.href = url; |
133 | } else { | 134 | } else { |
134 | loading.hideLoadingMask(); | 135 | loading.hideLoadingMask(); |
135 | - tip.show(res.messege || '网络出错'); | 136 | + tip.show(res.message || '网络出错'); |
136 | } | 137 | } |
137 | }).fail(function() { | 138 | }).fail(function() { |
138 | loading.hideLoadingMask(); | 139 | loading.hideLoadingMask(); |
@@ -199,9 +199,9 @@ $yohoPage.on('touchstart', '.tap-hightlight', function() { | @@ -199,9 +199,9 @@ $yohoPage.on('touchstart', '.tap-hightlight', function() { | ||
199 | $(this).removeClass('highlight'); | 199 | $(this).removeClass('highlight'); |
200 | }); | 200 | }); |
201 | 201 | ||
202 | -$('.nav-home').on('touchstart', function() { | ||
203 | - $('.homebuttom').toggleClass('none'); | ||
204 | -}); | 202 | +// $('.nav-home').on('touchstart', function() { |
203 | +// $('.homebuttom').toggleClass('none'); | ||
204 | +// }); | ||
205 | 205 | ||
206 | (function() { | 206 | (function() { |
207 | var lastTime = 0, | 207 | var lastTime = 0, |
@@ -80,7 +80,7 @@ optHammer.on('tap', function(e) { | @@ -80,7 +80,7 @@ optHammer.on('tap', function(e) { | ||
80 | } else { | 80 | } else { |
81 | tip.show(res.message || '网络错误'); | 81 | tip.show(res.message || '网络错误'); |
82 | } | 82 | } |
83 | - window.location.reload(); | 83 | + window.location.href = '/home/orders'; |
84 | }).fail(function() { | 84 | }).fail(function() { |
85 | tip.show('网络错误'); | 85 | tip.show('网络错误'); |
86 | }); | 86 | }); |
@@ -8,7 +8,8 @@ | @@ -8,7 +8,8 @@ | ||
8 | right: 0; | 8 | right: 0; |
9 | background: rgba(0,0,0,.3); | 9 | background: rgba(0,0,0,.3); |
10 | z-index:3; | 10 | z-index:3; |
11 | - | 11 | + |
12 | + | ||
12 | .main { | 13 | .main { |
13 | position: absolute; | 14 | position: absolute; |
14 | height: pxToRem(610px); | 15 | height: pxToRem(610px); |
@@ -85,6 +86,10 @@ | @@ -85,6 +86,10 @@ | ||
85 | top: 20rem / $pxConvertRem; | 86 | top: 20rem / $pxConvertRem; |
86 | } | 87 | } |
87 | } | 88 | } |
89 | + | ||
90 | + .size-list li.hide { | ||
91 | + display: none; | ||
92 | + } | ||
88 | 93 | ||
89 | .block { | 94 | .block { |
90 | float: left; | 95 | float: left; |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <div class="gift-advance-page yoho-page"> | 2 | <div class="gift-advance-page yoho-page"> |
3 | {{#if advanceBuyPage}} | 3 | {{#if advanceBuyPage}} |
4 | {{# advanceBuy}} | 4 | {{# advanceBuy}} |
5 | - <div class="advance-block"> | 5 | + <div class="advance-block" data-promotion-id="{{promotionId}}"> |
6 | <p class="title">{{title}}</p> | 6 | <p class="title">{{title}}</p> |
7 | {{#goods}} | 7 | {{#goods}} |
8 | {{> cart/gift-advance-good}} | 8 | {{> cart/gift-advance-good}} |
@@ -10,11 +10,11 @@ | @@ -10,11 +10,11 @@ | ||
10 | </div> | 10 | </div> |
11 | {{/ advanceBuy}} | 11 | {{/ advanceBuy}} |
12 | {{else}} | 12 | {{else}} |
13 | - {{# gift}} | 13 | + {{# freebie}} |
14 | {{> cart/gift-advance-good}} | 14 | {{> cart/gift-advance-good}} |
15 | - {{/ gift}} | 15 | + {{/ freebie}} |
16 | {{/if}} | 16 | {{/if}} |
17 | 17 | ||
18 | - | 18 | +<div id="chose-panel"></div> |
19 | </div> | 19 | </div> |
20 | {{> layout/footer}} | 20 | {{> layout/footer}} |
1 | - | 1 | +{{#cartInfo}} |
2 | <div class="chose-panel"> | 2 | <div class="chose-panel"> |
3 | <div class="main"> | 3 | <div class="main"> |
4 | <div class="infos"> | 4 | <div class="infos"> |
5 | - <div class="basic-info"> | 5 | + <div class="basic-info" > |
6 | {{#thumbs}} | 6 | {{#thumbs}} |
7 | {{#if @first}} | 7 | {{#if @first}} |
8 | <img class="thumb" src={{img}}> | 8 | <img class="thumb" src={{img}}> |
@@ -25,17 +25,18 @@ | @@ -25,17 +25,18 @@ | ||
25 | <span>颜色</span> | 25 | <span>颜色</span> |
26 | <ul class="clearfix" data-type="color"> | 26 | <ul class="clearfix" data-type="color"> |
27 | {{# colors}} | 27 | {{# colors}} |
28 | - <li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}" data-numstr="{{sizeNumStr}}" data-skcid="{{skcId}}"> | 28 | + <li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}" data-id="{{id}}" data-numstr="{{sizeNumStr}}" data-skcid="{{skcId}}"> |
29 | {{name}} | 29 | {{name}} |
30 | </li> | 30 | </li> |
31 | {{/ colors}} | 31 | {{/ colors}} |
32 | </ul> | 32 | </ul> |
33 | </div> | 33 | </div> |
34 | <div class="size-list block-list"> | 34 | <div class="size-list block-list"> |
35 | - <span>尺码</span> | 35 | + <span>尺码</span> |
36 | + | ||
36 | <ul class="clearfix" data-type="size" > | 37 | <ul class="clearfix" data-type="size" > |
37 | {{# sizes}} | 38 | {{# sizes}} |
38 | - <li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodId}}"> | 39 | + <li class="block hide {{#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}}"> |
39 | {{name}} | 40 | {{name}} |
40 | </li> | 41 | </li> |
41 | {{/ sizes}} | 42 | {{/ sizes}} |
@@ -47,7 +48,7 @@ | @@ -47,7 +48,7 @@ | ||
47 | <a class="btn btn-minus" href="javascript:void(0);"> | 48 | <a class="btn btn-minus" href="javascript:void(0);"> |
48 | <span class="iconfont"></span> | 49 | <span class="iconfont"></span> |
49 | </a> | 50 | </a> |
50 | - <input id="good-num" class="good-num" type="text" value={{num}}> | 51 | + <input id="good-num" class="good-num" type="text" value="1"> |
51 | <a class="btn btn-plus" href="javascript:void(0);"> | 52 | <a class="btn btn-plus" href="javascript:void(0);"> |
52 | <span class="iconfont"></span> | 53 | <span class="iconfont"></span> |
53 | </a> | 54 | </a> |
@@ -57,7 +58,8 @@ | @@ -57,7 +58,8 @@ | ||
57 | </div> | 58 | </div> |
58 | </div> | 59 | </div> |
59 | <div class="btn-wrap"> | 60 | <div class="btn-wrap"> |
60 | - <button id="chose-btn-sure" class="btn btn-sure">加入购物车</button> | 61 | + <button id="chose-btn-sure" class="btn btn-sure">确定</button> |
61 | </div> | 62 | </div> |
62 | </div> | 63 | </div> |
63 | </div> | 64 | </div> |
65 | +{{/cartInfo}} |
@@ -6,19 +6,6 @@ | @@ -6,19 +6,6 @@ | ||
6 | <div class="deps"> | 6 | <div class="deps"> |
7 | <p class="name row">{{name}}</p> | 7 | <p class="name row">{{name}}</p> |
8 | <p class="row"> | 8 | <p class="row"> |
9 | - {{#if color}} | ||
10 | - <span class="color"> | ||
11 | - 颜色:{{color}} | ||
12 | - </span> | ||
13 | - {{/if}} | ||
14 | - | ||
15 | - {{#if size}} | ||
16 | - <span class="size"> | ||
17 | - 尺码:{{size}} | ||
18 | - </span> | ||
19 | - {{/if}} | ||
20 | - </p> | ||
21 | - <p class="row"> | ||
22 | <span class="price"> | 9 | <span class="price"> |
23 | ¥{{price}} | 10 | ¥{{price}} |
24 | </span> | 11 | </span> |
@@ -4,14 +4,17 @@ | @@ -4,14 +4,17 @@ | ||
4 | <a href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back"></a> | 4 | <a href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back"></a> |
5 | {{/navBack}} | 5 | {{/navBack}} |
6 | {{#navHome}} | 6 | {{#navHome}} |
7 | - <a class="iconfont nav-home"></a> | 7 | + <a href="{{.}}" class="iconfont nav-home"></a> |
8 | {{/navHome}} | 8 | {{/navHome}} |
9 | + {{#navPhone}} | ||
10 | + <a href="{{.}}" class="iconfont nav-home"></a> | ||
11 | + {{/navPhone}} | ||
9 | {{#navTitle}} | 12 | {{#navTitle}} |
10 | <p class="nav-title">{{.}}</p> | 13 | <p class="nav-title">{{.}}</p> |
11 | {{/navTitle}} | 14 | {{/navTitle}} |
12 | {{# navBtn}} | 15 | {{# navBtn}} |
13 | <!-- <span class="nav-btn">{{.}}</span> --> | 16 | <!-- <span class="nav-btn">{{.}}</span> --> |
14 | - <i class="iconfont nav-home"></i> | 17 | + <!-- <i class="iconfont nav-home"></i> --> |
15 | {{/ navBtn}} | 18 | {{/ navBtn}} |
16 | </header> | 19 | </header> |
17 | <div class="homebuttom none"> | 20 | <div class="homebuttom none"> |
@@ -34,4 +37,4 @@ | @@ -34,4 +37,4 @@ | ||
34 | </li> | 37 | </li> |
35 | </ul> | 38 | </ul> |
36 | </div> | 39 | </div> |
37 | -{{/pageHeader}} | ||
40 | +{{/pageHeader}} |
@@ -41,11 +41,12 @@ class HomeController extends AbstractAction | @@ -41,11 +41,12 @@ class HomeController extends AbstractAction | ||
41 | { | 41 | { |
42 | // 设置网站标题 | 42 | // 设置网站标题 |
43 | $this->setTitle('个人中心'); | 43 | $this->setTitle('个人中心'); |
44 | - $this->setNavHeader('个人中心', SITE_MAIN . '/?go=1', '', true); | 44 | + $this->setNavHeader('个人中心', SITE_MAIN . '/?go=1'); |
45 | 45 | ||
46 | $data = array( | 46 | $data = array( |
47 | 'myIndexPage' => true, | 47 | 'myIndexPage' => true, |
48 | 'showDownloadApp' => true, | 48 | 'showDownloadApp' => true, |
49 | + 'navHome' => true, | ||
49 | 'pageFooter' => true, | 50 | 'pageFooter' => true, |
50 | 'cartUrl' => Helpers::url('/cart/index/index', null), | 51 | 'cartUrl' => Helpers::url('/cart/index/index', null), |
51 | 'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))), | 52 | 'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))), |
@@ -848,10 +849,11 @@ class HomeController extends AbstractAction | @@ -848,10 +849,11 @@ class HomeController extends AbstractAction | ||
848 | } | 849 | } |
849 | 850 | ||
850 | $this->setTitle('订单详情'); | 851 | $this->setTitle('订单详情'); |
851 | - $this->setNavHeader('订单详情'); | 852 | + $this->setNavHeader('订单详情', true, false); |
852 | 853 | ||
853 | $this->_view->display('order-detail', array( | 854 | $this->_view->display('order-detail', array( |
854 | 'orderDetailPage' => true, | 855 | 'orderDetailPage' => true, |
856 | + 'navPhone' => 'tel:400-889-9646', | ||
855 | 'orderDetail' => $orderDetail, | 857 | 'orderDetail' => $orderDetail, |
856 | )); | 858 | )); |
857 | } | 859 | } |
@@ -189,50 +189,7 @@ class CartModel | @@ -189,50 +189,7 @@ class CartModel | ||
189 | $product = CartData::cartProductData($uid, $skn); | 189 | $product = CartData::cartProductData($uid, $skn); |
190 | if (isset($product['code']) && $product['code'] === 200) { | 190 | if (isset($product['code']) && $product['code'] === 200) { |
191 | $result['code'] = 200; | 191 | $result['code'] = 200; |
192 | - $data = array(); | ||
193 | - $productData = $product['data']; | ||
194 | - | ||
195 | - // 品牌信息 | ||
196 | - if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
197 | - $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
198 | - } | ||
199 | - | ||
200 | - $data['name'] = $productData['product_name']; | ||
201 | - $data['price'] = $productData['market_price']; | ||
202 | - $data['salePrice'] = $productData['sales_price']; | ||
203 | - $data['storage'] = $productData['storage_sum']; | ||
204 | - $data['num'] = $num; | ||
205 | - | ||
206 | - // 商品选择 | ||
207 | - if (isset($productData['goods_list'])) { | ||
208 | - $goodsList = $productData['goods_list']; | ||
209 | - | ||
210 | - $colors = array(); | ||
211 | - $oneColor = array(); | ||
212 | - $sizes = array(); | ||
213 | - $oneSize = array(); | ||
214 | - foreach ($goodsList as $val) { | ||
215 | - // 颜色 | ||
216 | - $oneColor = array(); | ||
217 | - $oneColor['id'] = $val['color_id']; | ||
218 | - $oneColor['name'] = $val['color_name']; | ||
219 | - | ||
220 | - // 尺码 | ||
221 | - foreach ($val['size_list'] as $one) { | ||
222 | - $oneSize = array(); | ||
223 | - $oneSize['id'] = $one['size_id']; | ||
224 | - $oneSize['name'] = $one['size_name']; | ||
225 | - } | ||
226 | - $sizes[] = $oneSize; | ||
227 | - | ||
228 | - $oneColor['sizes'] = $sizes; | ||
229 | - $colors[] = $oneColor; | ||
230 | - } | ||
231 | - | ||
232 | - $data['colors'] = $colors; | ||
233 | - } | ||
234 | - | ||
235 | - $result['data'] = $data; | 192 | + $result['data'] = self::procGoodsDetail($product['data'], $num); |
236 | } | 193 | } |
237 | 194 | ||
238 | return $result; | 195 | return $result; |
@@ -252,49 +209,7 @@ class CartModel | @@ -252,49 +209,7 @@ class CartModel | ||
252 | $product = CartData::giftProductData($skn, $promotionId); | 209 | $product = CartData::giftProductData($skn, $promotionId); |
253 | if (isset($product['code']) && $product['code'] === 200) { | 210 | if (isset($product['code']) && $product['code'] === 200) { |
254 | $result['code'] = 200; | 211 | $result['code'] = 200; |
255 | - $data = array(); | ||
256 | - $productData = $product['data']; | ||
257 | - | ||
258 | - // 品牌信息 | ||
259 | - if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
260 | - $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
261 | - } | ||
262 | - | ||
263 | - $data['name'] = $productData['product_name']; | ||
264 | - $data['price'] = $productData['market_price']; | ||
265 | - $data['salePrice'] = $productData['sales_price']; | ||
266 | - $data['storage'] = $productData['storage_sum']; | ||
267 | - | ||
268 | - // 商品选择 | ||
269 | - if (isset($productData['goods_list'])) { | ||
270 | - $goodsList = $productData['goods_list']; | ||
271 | - | ||
272 | - $colors = array(); | ||
273 | - $oneColor = array(); | ||
274 | - $sizes = array(); | ||
275 | - $oneSize = array(); | ||
276 | - foreach ($goodsList as $val) { | ||
277 | - // 颜色 | ||
278 | - $oneColor = array(); | ||
279 | - $oneColor['id'] = $val['color_id']; | ||
280 | - $oneColor['name'] = $val['color_name']; | ||
281 | - | ||
282 | - // 尺码 | ||
283 | - foreach ($val['size_list'] as $one) { | ||
284 | - $oneSize = array(); | ||
285 | - $oneSize['id'] = $one['size_id']; | ||
286 | - $oneSize['name'] = $one['size_name']; | ||
287 | - } | ||
288 | - $sizes[] = $oneSize; | ||
289 | - | ||
290 | - $oneColor['sizes'] = $sizes; | ||
291 | - $colors[] = $oneColor; | ||
292 | - } | ||
293 | - | ||
294 | - $data['colors'] = $colors; | ||
295 | - } | ||
296 | - | ||
297 | - $result['data'] = $data; | 212 | + $result['data'] = self::procGoodsDetail($product['data']); |
298 | } | 213 | } |
299 | 214 | ||
300 | return $result; | 215 | return $result; |
@@ -657,6 +572,65 @@ class CartModel | @@ -657,6 +572,65 @@ class CartModel | ||
657 | 572 | ||
658 | 573 | ||
659 | /** | 574 | /** |
575 | + * 处理购物车商品、加价购商品、赠品详情数据 | ||
576 | + * | ||
577 | + * @param array $productData 要处理的商品数据 | ||
578 | + * @param int $num 购买数目 | ||
579 | + * @return array $data 处理之后的数据 | ||
580 | + */ | ||
581 | + private static function procGoodsDetail($productData, $num = null) | ||
582 | + { | ||
583 | + $data = array(); | ||
584 | + | ||
585 | + // 品牌信息 | ||
586 | + if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
587 | + $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
588 | + } | ||
589 | + | ||
590 | + $data['name'] = $productData['product_name']; | ||
591 | + $data['price'] = $productData['market_price']; | ||
592 | + $data['salePrice'] = $productData['sales_price']; | ||
593 | + | ||
594 | + if (isset($productData['storage_sum'])) { | ||
595 | + $data['storage'] = $productData['storage_sum']; | ||
596 | + } | ||
597 | + if ($num !== null) { | ||
598 | + $data['num'] = $num; | ||
599 | + } | ||
600 | + | ||
601 | + // 商品选择 | ||
602 | + if (isset($productData['goods_list'])) { | ||
603 | + $goodsList = $productData['goods_list']; | ||
604 | + | ||
605 | + $colors = array(); | ||
606 | + $oneColor = array(); | ||
607 | + $sizes = array(); | ||
608 | + $oneSize = array(); | ||
609 | + foreach ($goodsList as $val) { | ||
610 | + // 颜色 | ||
611 | + $oneColor = array(); | ||
612 | + $oneColor['id'] = $val['color_id']; | ||
613 | + $oneColor['name'] = $val['color_name']; | ||
614 | + | ||
615 | + // 尺码 | ||
616 | + foreach ($val['size_list'] as $one) { | ||
617 | + $oneSize = array(); | ||
618 | + $oneSize['id'] = $one['size_id']; | ||
619 | + $oneSize['name'] = $one['size_name']; | ||
620 | + } | ||
621 | + $sizes[] = $oneSize; | ||
622 | + | ||
623 | + $oneColor['sizes'] = $sizes; | ||
624 | + $colors[] = $oneColor; | ||
625 | + } | ||
626 | + | ||
627 | + $data['colors'] = $colors; | ||
628 | + } | ||
629 | + | ||
630 | + return $data; | ||
631 | + } | ||
632 | + | ||
633 | + /** | ||
660 | * 处理不同类型的购物车数据 | 634 | * 处理不同类型的购物车数据 |
661 | * | 635 | * |
662 | * @param array $data 不同类型购物车数据 | 636 | * @param array $data 不同类型购物车数据 |
@@ -385,7 +385,11 @@ class UserModel | @@ -385,7 +385,11 @@ class UserModel | ||
385 | // 处理YOHO币数据 | 385 | // 处理YOHO币数据 |
386 | if(isset($yohoCoin['data']) && !empty($yohoCoin['data'])){ | 386 | if(isset($yohoCoin['data']) && !empty($yohoCoin['data'])){ |
387 | $coinList = $yohoCoin['data']['coinlist']; | 387 | $coinList = $yohoCoin['data']['coinlist']; |
388 | - $data['money'] = $yohoCoin['data']['total']; | 388 | + |
389 | + // 获取有货币总数 | ||
390 | + $total = self::getYohoCoinData($uid); | ||
391 | + $data['money'] = !empty($total) ? $total['yohoCoin']['coinNum'] : 0; | ||
392 | + | ||
389 | foreach($coinList as $key => $val){ | 393 | foreach($coinList as $key => $val){ |
390 | $result[$key]['title'] = $val['message']; | 394 | $result[$key]['title'] = $val['message']; |
391 | $result[$key]['time'] = $val['date']; | 395 | $result[$key]['time'] = $val['date']; |
@@ -167,7 +167,6 @@ class DetailModel | @@ -167,7 +167,6 @@ class DetailModel | ||
167 | $colorStorageNum = 0; | 167 | $colorStorageNum = 0; |
168 | $totalStorageNum = 0; // 总库存数 | 168 | $totalStorageNum = 0; // 总库存数 |
169 | foreach ($baseInfo['goodsList'] as $value) { | 169 | foreach ($baseInfo['goodsList'] as $value) { |
170 | - $sizeList = array(); | ||
171 | $colorStorageNum = 0; | 170 | $colorStorageNum = 0; |
172 | $sizeStorageStr = ''; | 171 | $sizeStorageStr = ''; |
173 | 172 |
@@ -191,6 +191,16 @@ class IndexController extends AbstractAction | @@ -191,6 +191,16 @@ class IndexController extends AbstractAction | ||
191 | } | 191 | } |
192 | 192 | ||
193 | /* | 193 | /* |
194 | + * 获取购物车加价购商品数据模板 | ||
195 | + */ | ||
196 | + public function giftinfoTplAction() | ||
197 | + { | ||
198 | + if ($this->isAjax()) { | ||
199 | + echo file_get_contents($this->_view->getScriptPath() . '/../partials/cart/chose-panel.phtml'); | ||
200 | + } | ||
201 | + } | ||
202 | + | ||
203 | + /* | ||
194 | * 获取购物车加价购商品数据 | 204 | * 获取购物车加价购商品数据 |
195 | */ | 205 | */ |
196 | public function giftinfoAction() | 206 | public function giftinfoAction() |
@@ -276,7 +286,7 @@ class IndexController extends AbstractAction | @@ -276,7 +286,7 @@ class IndexController extends AbstractAction | ||
276 | $uid = $this->getUid(true); | 286 | $uid = $this->getUid(true); |
277 | $cartGoods = CartModel::getCartData($uid, $shoppingKey); | 287 | $cartGoods = CartModel::getCartData($uid, $shoppingKey); |
278 | if (empty($cartGoods) || isset($cartGoods['isEmptyCart'])) { | 288 | if (empty($cartGoods) || isset($cartGoods['isEmptyCart'])) { |
279 | - $this->go(Helpers::url('/shoppingcart')); | 289 | + $this->go(Helpers::url('/cart/index/index')); |
280 | } | 290 | } |
281 | 291 | ||
282 | $cartType = $this->get('cartType', 'ordinary'); | 292 | $cartType = $this->get('cartType', 'ordinary'); |
@@ -113,7 +113,7 @@ class LoginController extends AbstractAction | @@ -113,7 +113,7 @@ class LoginController extends AbstractAction | ||
113 | 113 | ||
114 | /* 判断参数是否有效 */ | 114 | /* 判断参数是否有效 */ |
115 | $verifyEmail = Helpers::verifyEmail($profile); | 115 | $verifyEmail = Helpers::verifyEmail($profile); |
116 | - $verifyMobile = ($area === '86') ? Helpers::verifyMobile($profile) : Helpers::verifyAreaMobile($profile); | 116 | + $verifyMobile = ($area === '86') ? Helpers::verifyMobile($profile) : Helpers::verifyAreaMobile($profile, $area); |
117 | if (!$verifyEmail && !$verifyMobile) { | 117 | if (!$verifyEmail && !$verifyMobile) { |
118 | break; | 118 | break; |
119 | } | 119 | } |
-
Please register or login to post a comment