Showing
2 changed files
with
82 additions
and
69 deletions
@@ -62,27 +62,7 @@ $( | @@ -62,27 +62,7 @@ $( | ||
62 | 62 | ||
63 | // 风格详情页图片点击放大 | 63 | // 风格详情页图片点击放大 |
64 | $('.pull-pic-list').on('click', function() { | 64 | $('.pull-pic-list').on('click', function() { |
65 | - var w_height = $(window).height(); | ||
66 | - | ||
67 | - $('.big-pic').show(); | ||
68 | - $('.swiper-slide img').each( | ||
69 | - function() { | ||
70 | - var newTop = 0; | ||
71 | - | ||
72 | - if ($(this).height() > w_height) { | ||
73 | - $(this).css('height', '90%'); | ||
74 | - $(this).css('width', 'auto'); | ||
75 | - newTop = (w_height - $(this).height()) / 2; | ||
76 | - $(this).css('margin-top', newTop + 'px'); | ||
77 | - } else { | ||
78 | - newTop = (w_height - $(this).height()) / 2; | ||
79 | - $(this).css('margin-top', newTop + 'px'); | ||
80 | - } | ||
81 | - } | ||
82 | - ); | ||
83 | - $('.swiper-slide').on('click', function() { | ||
84 | - $('.big-pic').hide(); | ||
85 | - }); | 65 | + indexAct.pullPicBig(); |
86 | }); | 66 | }); |
87 | 67 | ||
88 | // 瀑布流 | 68 | // 瀑布流 |
@@ -357,25 +337,7 @@ $( | @@ -357,25 +337,7 @@ $( | ||
357 | }); | 337 | }); |
358 | 338 | ||
359 | // 默认选中菜单 | 339 | // 默认选中菜单 |
360 | - if ($('.class-detail').length > 0) { | ||
361 | - window.setCookie('chosenClass', $('.class-detail').find('.name').text()); | ||
362 | - window.setCookie('packageId', $('.class-detail').find('.name').attr('id')); | ||
363 | - } | ||
364 | - if ($('.adviser-info').find('.name').length > 0) { | ||
365 | - window.setCookie('chosenCutter', $('.adviser-info').find('.name').text()); | ||
366 | - window.setCookie('chosenAdviser', $('.adviser-info').find('.name').text()); | ||
367 | - window.setCookie('cutterId', $('.cutter-id').val()); | ||
368 | - } | ||
369 | - if ($('.style-detail').length > 0) { | ||
370 | - window.setCookie('styleId', window.queryString.id); | ||
371 | - window.setCookie('chosenStyle', ' ' + decodeURI(window.queryString.styleName) + ' '); | ||
372 | - } | ||
373 | - if ($('.package-detail').length > 0) { | ||
374 | - window.setCookie('chosenPackage', $('.package-detail').find('.name').text()); | ||
375 | - window.setCookie('packageLimit', $('.package-detail').find('.limit').val()); | ||
376 | - window.setCookie('packageStyle', $('.package-detail').find('.styleid').val()); | ||
377 | - window.setCookie('packageId', window.queryString.id); | ||
378 | - } | 340 | + indexAct.chosenDefault(); |
379 | 341 | ||
380 | // 立即预约按钮 | 342 | // 立即预约按钮 |
381 | $('.chosen-btn').on('click', function() { | 343 | $('.chosen-btn').on('click', function() { |
@@ -443,35 +405,7 @@ $( | @@ -443,35 +405,7 @@ $( | ||
443 | 405 | ||
444 | // 取消订单 | 406 | // 取消订单 |
445 | $('.order-btn a').on('click', function() { | 407 | $('.order-btn a').on('click', function() { |
446 | - diaLog.showDialog({ | ||
447 | - dialogText: '确认取消预约吗?', | ||
448 | - hasFooter: { | ||
449 | - leftBtnText: '我再想想', | ||
450 | - rightBtnText: '确认取消' | ||
451 | - } | ||
452 | - }, function() { | ||
453 | - $.ajax({ | ||
454 | - url: '/activity/trend/delOrder', | ||
455 | - data: { | ||
456 | - id: $('.order-btn a').attr('id') | ||
457 | - }, | ||
458 | - success: function(result) { | ||
459 | - if (result.code === 200) { | ||
460 | - document.location.href = '//m.yohobuy.com/activity/trend/order-list?storeId=' + | ||
461 | - window.queryString.storeId; | ||
462 | - } else { | ||
463 | - tip.show(result.message); | ||
464 | - } | ||
465 | - }, | ||
466 | - error: function() { | ||
467 | - tip.show('网络断开了~~~'); | ||
468 | - } | ||
469 | - }); | ||
470 | - }); | ||
471 | - | ||
472 | - // 修改弹框样式 | ||
473 | - $('.dialog-left-btn').css('color', '#999'); | ||
474 | - $('.dialog-right-btn').css('color', '#007aff'); | 408 | + indexAct.cancelOrder(); |
475 | }); | 409 | }); |
476 | 410 | ||
477 | // 加减人数按钮 | 411 | // 加减人数按钮 |
@@ -415,6 +415,82 @@ function _formatDay(day) { | @@ -415,6 +415,82 @@ function _formatDay(day) { | ||
415 | return moment(day).format('MM月DD日 HH:mm'); | 415 | return moment(day).format('MM月DD日 HH:mm'); |
416 | } | 416 | } |
417 | 417 | ||
418 | +function pullPicBig(){ | ||
419 | + var w_height = $(window).height(); | ||
420 | + | ||
421 | + $('.big-pic').show(); | ||
422 | + $('.swiper-slide img').each( | ||
423 | + function() { | ||
424 | + var newTop = (w_height - $(this).height()) / 2; | ||
425 | + | ||
426 | + if ($(this).height() > w_height) { | ||
427 | + $(this).css('height', '90%'); | ||
428 | + $(this).css('width', 'auto'); | ||
429 | + $(this).css('margin-top', newTop + 'px'); | ||
430 | + } else { | ||
431 | + $(this).css('margin-top', newTop + 'px'); | ||
432 | + } | ||
433 | + } | ||
434 | + ); | ||
435 | + $('.swiper-slide').on('click', function() { | ||
436 | + $('.big-pic').hide(); | ||
437 | + }); | ||
438 | +} | ||
439 | + | ||
440 | +function cancelOrder(){ | ||
441 | + diaLog.showDialog({ | ||
442 | + dialogText: '确认取消预约吗?', | ||
443 | + hasFooter: { | ||
444 | + leftBtnText: '我再想想', | ||
445 | + rightBtnText: '确认取消' | ||
446 | + } | ||
447 | + }, function() { | ||
448 | + $.ajax({ | ||
449 | + url: '/activity/trend/delOrder', | ||
450 | + data: { | ||
451 | + id: $('.order-btn a').attr('id') | ||
452 | + }, | ||
453 | + success: function(result) { | ||
454 | + if (result.code === 200) { | ||
455 | + document.location.href = '//m.yohobuy.com/activity/trend/order-list?storeId=' + | ||
456 | + window.queryString.storeId; | ||
457 | + } else { | ||
458 | + tip.show(result.message); | ||
459 | + } | ||
460 | + }, | ||
461 | + error: function() { | ||
462 | + tip.show('网络断开了~~~'); | ||
463 | + } | ||
464 | + }); | ||
465 | + }); | ||
466 | + | ||
467 | + // 修改弹框样式 | ||
468 | + $('.dialog-left-btn').css('color', '#999'); | ||
469 | + $('.dialog-right-btn').css('color', '#007aff'); | ||
470 | +} | ||
471 | + | ||
472 | +function chosenDefault() { | ||
473 | + if ($('.class-detail').length > 0) { | ||
474 | + window.setCookie('chosenClass', $('.class-detail').find('.name').text()); | ||
475 | + window.setCookie('packageId', $('.class-detail').find('.name').attr('id')); | ||
476 | + } | ||
477 | + if ($('.adviser-info').find('.name').length > 0) { | ||
478 | + window.setCookie('chosenCutter', $('.adviser-info').find('.name').text()); | ||
479 | + window.setCookie('chosenAdviser', $('.adviser-info').find('.name').text()); | ||
480 | + window.setCookie('cutterId', $('.cutter-id').val()); | ||
481 | + } | ||
482 | + if ($('.style-detail').length > 0) { | ||
483 | + window.setCookie('styleId', window.queryString.id); | ||
484 | + window.setCookie('chosenStyle', ' ' + decodeURI(window.queryString.styleName) + ' '); | ||
485 | + } | ||
486 | + if ($('.package-detail').length > 0) { | ||
487 | + window.setCookie('chosenPackage', $('.package-detail').find('.name').text()); | ||
488 | + window.setCookie('packageLimit', $('.package-detail').find('.limit').val()); | ||
489 | + window.setCookie('packageStyle', $('.package-detail').find('.styleid').val()); | ||
490 | + window.setCookie('packageId', window.queryString.id); | ||
491 | + } | ||
492 | +} | ||
493 | + | ||
418 | module.exports = { | 494 | module.exports = { |
419 | getTimeList: getTimeList, | 495 | getTimeList: getTimeList, |
420 | clearCookieArr: clearCookieArr, | 496 | clearCookieArr: clearCookieArr, |
@@ -427,5 +503,8 @@ module.exports = { | @@ -427,5 +503,8 @@ module.exports = { | ||
427 | removeByValue: removeByValue, | 503 | removeByValue: removeByValue, |
428 | limitInp: limitInp, | 504 | limitInp: limitInp, |
429 | pullPic: pullPic, | 505 | pullPic: pullPic, |
506 | + pullPicBig: pullPicBig, | ||
507 | + cancelOrder: cancelOrder, | ||
508 | + chosenDefault: chosenDefault, | ||
430 | _formatDay: _formatDay | 509 | _formatDay: _formatDay |
431 | }; | 510 | }; |
-
Please register or login to post a comment