Merge branch 'feature/shoppingCart' of http://git.yoho.cn/fe/yohobuy-node into feature/shoppingCart
Showing
5 changed files
with
44 additions
and
18 deletions
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <p class="prompt">\{{title}}、电话为选填项,其他均为必填项</p> | 3 | <p class="prompt">\{{title}}、电话为选填项,其他均为必填项</p> |
4 | <ul class="info-wrap"> | 4 | <ul class="info-wrap"> |
5 | <li> | 5 | <li> |
6 | - <span class="left-rd"><i class="red">*</i>收货人:</span> | 6 | + <span class="left-rd"><i class="red">*</i>收<i class="mg">货</i>人:</span> |
7 | <input type="text" name="consignee" value="\{{info.consignee}}" placeholder="请输入您的姓名"> | 7 | <input type="text" name="consignee" value="\{{info.consignee}}" placeholder="请输入您的姓名"> |
8 | <p class="caveat-tip"></p> | 8 | <p class="caveat-tip"></p> |
9 | </li> | 9 | </li> |
@@ -243,6 +243,7 @@ payWay = { | @@ -243,6 +243,7 @@ payWay = { | ||
243 | } | 243 | } |
244 | }; | 244 | }; |
245 | 245 | ||
246 | +// 配送方式 | ||
246 | deliveryWay = { | 247 | deliveryWay = { |
247 | $deliveryType: $('.delivery-way-wrap .check-btn'), | 248 | $deliveryType: $('.delivery-way-wrap .check-btn'), |
248 | $deliveryTime: $('.delivery-time-wrap .check-btn'), | 249 | $deliveryTime: $('.delivery-time-wrap .check-btn'), |
@@ -350,6 +351,7 @@ deliveryWay = { | @@ -350,6 +351,7 @@ deliveryWay = { | ||
350 | } | 351 | } |
351 | }; | 352 | }; |
352 | 353 | ||
354 | +// jit拆单 | ||
353 | multiPackage = { | 355 | multiPackage = { |
354 | $el: $('.multi-package-row'), | 356 | $el: $('.multi-package-row'), |
355 | init: function() { | 357 | init: function() { |
@@ -426,6 +428,7 @@ multiPackage = { | @@ -426,6 +428,7 @@ multiPackage = { | ||
426 | } | 428 | } |
427 | }; | 429 | }; |
428 | 430 | ||
431 | +// 优惠券 | ||
429 | coupon = { | 432 | coupon = { |
430 | $el: $('#use-coupons'), | 433 | $el: $('#use-coupons'), |
431 | init: function() { | 434 | init: function() { |
@@ -537,6 +540,7 @@ coupon = { | @@ -537,6 +540,7 @@ coupon = { | ||
537 | } | 540 | } |
538 | }; | 541 | }; |
539 | 542 | ||
543 | +// 有货币 | ||
540 | yohoCoin = { | 544 | yohoCoin = { |
541 | $el: $('#yoho-coin-box'), | 545 | $el: $('#yoho-coin-box'), |
542 | init: function() { | 546 | init: function() { |
@@ -559,18 +563,21 @@ yohoCoin = { | @@ -559,18 +563,21 @@ yohoCoin = { | ||
559 | var that = this; | 563 | var that = this; |
560 | 564 | ||
561 | this.$el.on('click', '.coin-use-btn', function() { | 565 | this.$el.on('click', '.coin-use-btn', function() { |
562 | - if (order.coin * 1 === this.maxCoin * 1) { | ||
563 | - return; | 566 | + if (order.coin * 1 !== this.maxCoin * 1) { |
567 | + compute(that.maxCoin); | ||
564 | } | 568 | } |
565 | 569 | ||
566 | - compute(that.maxCoin); | 570 | + that.close(); |
567 | }).on('click', '.coin-cancel-btn', function() { | 571 | }).on('click', '.coin-cancel-btn', function() { |
568 | - if (order.coin * 1 === 0) { | ||
569 | - return; | 572 | + if (order.coin * 1 !== 0) { |
573 | + compute(); | ||
570 | } | 574 | } |
571 | 575 | ||
572 | - compute(); | 576 | + that.close(); |
573 | }); | 577 | }); |
578 | + }, | ||
579 | + close: function() { | ||
580 | + this.$el.prev().children('.locker-switch').trigger('click'); | ||
574 | } | 581 | } |
575 | }; | 582 | }; |
576 | 583 |
@@ -26,6 +26,7 @@ var addrList = {}, | @@ -26,6 +26,7 @@ var addrList = {}, | ||
26 | 26 | ||
27 | var addrSelect; | 27 | var addrSelect; |
28 | 28 | ||
29 | +// 获取地址数据 | ||
29 | $('.addr-item').each(function() { | 30 | $('.addr-item').each(function() { |
30 | var data = $(this).data(); | 31 | var data = $(this).data(); |
31 | 32 | ||
@@ -66,6 +67,16 @@ Dialog.prototype.packageInfo = function() { | @@ -66,6 +67,16 @@ Dialog.prototype.packageInfo = function() { | ||
66 | return data; | 67 | return data; |
67 | }; | 68 | }; |
68 | 69 | ||
70 | +function syncShowMoreBtn() { | ||
71 | + setTimeout(function() { | ||
72 | + if ($addrWrap.children().length > 4) { | ||
73 | + $addrWrap.addClass('more'); | ||
74 | + } else { | ||
75 | + $addrWrap.removeClass('more'); | ||
76 | + } | ||
77 | + }, 0); | ||
78 | +} | ||
79 | + | ||
69 | // 地址校验,支持单个字段与多字段 | 80 | // 地址校验,支持单个字段与多字段 |
70 | function validateAddress(data) { | 81 | function validateAddress(data) { |
71 | var regx = { | 82 | var regx = { |
@@ -235,6 +246,8 @@ function handelAddrInfo(data, reqData, $el) { | @@ -235,6 +246,8 @@ function handelAddrInfo(data, reqData, $el) { | ||
235 | $items.first().before($dom); | 246 | $items.first().before($dom); |
236 | $dom.trigger('click'); | 247 | $dom.trigger('click'); |
237 | 248 | ||
249 | + syncShowMoreBtn(); | ||
250 | + | ||
238 | if (reqData.setDefault) { | 251 | if (reqData.setDefault) { |
239 | $dom.find('.set-default').trigger('click'); | 252 | $dom.find('.set-default').trigger('click'); |
240 | } | 253 | } |
@@ -370,6 +383,7 @@ $addrWrap.on('click', '.addr-item', function() { | @@ -370,6 +383,7 @@ $addrWrap.on('click', '.addr-item', function() { | ||
370 | if (data.code === 200) { | 383 | if (data.code === 200) { |
371 | $item.remove(); | 384 | $item.remove(); |
372 | diaCf.close(); | 385 | diaCf.close(); |
386 | + syncShowMoreBtn(); | ||
373 | } | 387 | } |
374 | }); | 388 | }); |
375 | } | 389 | } |
@@ -393,6 +407,7 @@ $('.addr-opt').on('click', 'span', function() { | @@ -393,6 +407,7 @@ $('.addr-opt').on('click', 'span', function() { | ||
393 | $this.toggleClass('open'); | 407 | $this.toggleClass('open'); |
394 | }); | 408 | }); |
395 | 409 | ||
410 | +syncShowMoreBtn(); | ||
396 | setShowDeliveryAddr(); | 411 | setShowDeliveryAddr(); |
397 | 412 | ||
398 | // 获取地址信息 | 413 | // 获取地址信息 |
@@ -234,8 +234,7 @@ var areaSelect = { | @@ -234,8 +234,7 @@ var areaSelect = { | ||
234 | className += ' on'; | 234 | className += ' on'; |
235 | } | 235 | } |
236 | _h += '<span class="' + className + '" data-id="' + data[i][j].id + | 236 | _h += '<span class="' + className + '" data-id="' + data[i][j].id + |
237 | - '" data-text="' + data[i][j].caption + '">' + | ||
238 | - (data[i][j].is_support_express === 'Y' ? '*' : '') + data[i][j].caption + '</span>'; | 237 | + '" data-text="' + data[i][j].caption + '">' + data[i][j].caption + '</span>'; |
239 | } | 238 | } |
240 | _h += '</p>'; | 239 | _h += '</p>'; |
241 | } | 240 | } |
@@ -254,8 +253,7 @@ var areaSelect = { | @@ -254,8 +253,7 @@ var areaSelect = { | ||
254 | className += ' on'; | 253 | className += ' on'; |
255 | } | 254 | } |
256 | _h += '<span class="' + className + '" data-id="' + data[j].id + | 255 | _h += '<span class="' + className + '" data-id="' + data[j].id + |
257 | - '" data-text="' + data[j].caption + '">' + | ||
258 | - (data[j].is_support_express === 'Y' ? '*' : '') + data[j].caption + '</span>'; | 256 | + '" data-text="' + data[j].caption + '">' + data[j].caption + '</span>'; |
259 | } | 257 | } |
260 | 258 | ||
261 | if (type === 'city') { | 259 | if (type === 'city') { |
@@ -336,20 +336,21 @@ | @@ -336,20 +336,21 @@ | ||
336 | 336 | ||
337 | > * { | 337 | > * { |
338 | cursor: pointer; | 338 | cursor: pointer; |
339 | - } | ||
340 | - | ||
341 | - .hide-more-btn { | ||
342 | display: none; | 339 | display: none; |
343 | } | 340 | } |
344 | } | 341 | } |
345 | 342 | ||
346 | - .addr-opt.open { | ||
347 | - | 343 | + .more + .addr-opt { |
348 | .more-addr-btn { | 344 | .more-addr-btn { |
345 | + display: inline; | ||
346 | + } | ||
347 | + | ||
348 | + | ||
349 | + &.open > .more-addr-btn { | ||
349 | display: none; | 350 | display: none; |
350 | } | 351 | } |
351 | 352 | ||
352 | - .hide-more-btn { | 353 | + &.open > .hide-more-btn { |
353 | display: inline; | 354 | display: inline; |
354 | } | 355 | } |
355 | } | 356 | } |
@@ -1032,7 +1033,6 @@ | @@ -1032,7 +1033,6 @@ | ||
1032 | 1033 | ||
1033 | } | 1034 | } |
1034 | 1035 | ||
1035 | - | ||
1036 | .balance-wrap { | 1036 | .balance-wrap { |
1037 | font-size: 13px; | 1037 | font-size: 13px; |
1038 | line-height: 2; | 1038 | line-height: 2; |
@@ -1094,9 +1094,11 @@ | @@ -1094,9 +1094,11 @@ | ||
1094 | font-weight: 700; | 1094 | font-weight: 700; |
1095 | background: #d90025; | 1095 | background: #d90025; |
1096 | border: none; | 1096 | border: none; |
1097 | + outline: none; | ||
1097 | padding: 0; | 1098 | padding: 0; |
1098 | margin-left: 10px; | 1099 | margin-left: 10px; |
1099 | vertical-align: super; | 1100 | vertical-align: super; |
1101 | + cursor: pointer; | ||
1100 | } | 1102 | } |
1101 | } | 1103 | } |
1102 | } | 1104 | } |
@@ -1200,6 +1202,10 @@ | @@ -1200,6 +1202,10 @@ | ||
1200 | color: #ce0b24; | 1202 | color: #ce0b24; |
1201 | margin-right: 10px; | 1203 | margin-right: 10px; |
1202 | } | 1204 | } |
1205 | + | ||
1206 | + .mg { | ||
1207 | + padding: 0 7px; | ||
1208 | + } | ||
1203 | } | 1209 | } |
1204 | 1210 | ||
1205 | .caveat-tip { | 1211 | .caveat-tip { |
-
Please register or login to post a comment