Showing
8 changed files
with
98 additions
and
17 deletions
@@ -570,3 +570,16 @@ exports.changeDate = function(req, res, next) { | @@ -570,3 +570,16 @@ exports.changeDate = function(req, res, next) { | ||
570 | res.json(result); | 570 | res.json(result); |
571 | }).catch(next); | 571 | }).catch(next); |
572 | }; | 572 | }; |
573 | + | ||
574 | +exports.getAbleTime = function(req, res, next) { | ||
575 | + | ||
576 | + let params = { | ||
577 | + activityType: req.query.activityType, | ||
578 | + activityId: req.query.activityId, | ||
579 | + isFront: req.query.isFront || req.cookies.isFront | ||
580 | + }; | ||
581 | + | ||
582 | + trendModel.getAbleTime(params).then((result) => { | ||
583 | + res.json(result); | ||
584 | + }).catch(next); | ||
585 | +}; |
@@ -25,6 +25,11 @@ const _MYDHm = (day) => { | @@ -25,6 +25,11 @@ const _MYDHm = (day) => { | ||
25 | return moment(day, 'YYYY/MM/DD').format('YYYY年MM月DD日 HH:mm'); | 25 | return moment(day, 'YYYY/MM/DD').format('YYYY年MM月DD日 HH:mm'); |
26 | }; | 26 | }; |
27 | 27 | ||
28 | +// 月日时分 | ||
29 | +const _MDHm = (day) => { | ||
30 | + return moment(day, 'YYYY/MM/DD').format('MM月DD日 HH:mm'); | ||
31 | +}; | ||
32 | + | ||
28 | // 格式年月日2 | 33 | // 格式年月日2 |
29 | const _formatDay2 = (day) => { | 34 | const _formatDay2 = (day) => { |
30 | return moment(day, 'YYYY/MM/DD').format('YY年MM月DD日'); | 35 | return moment(day, 'YYYY/MM/DD').format('YY年MM月DD日'); |
@@ -583,7 +588,7 @@ const getTimeList = (params) => { | @@ -583,7 +588,7 @@ const getTimeList = (params) => { | ||
583 | time: _HM(new Date(item * 1000)), | 588 | time: _HM(new Date(item * 1000)), |
584 | originTime: item, | 589 | originTime: item, |
585 | use: result.data.timeMap[item], | 590 | use: result.data.timeMap[item], |
586 | - date: _MYDHm(new Date(item * 1000)), | 591 | + date: _MDHm(new Date(item * 1000)), |
587 | }); | 592 | }); |
588 | } | 593 | } |
589 | resu.appointNum = result.data.appointNum; | 594 | resu.appointNum = result.data.appointNum; |
@@ -693,6 +698,8 @@ const packageDetail = (params) => { | @@ -693,6 +698,8 @@ const packageDetail = (params) => { | ||
693 | free: result[0].data.isFree === 1, | 698 | free: result[0].data.isFree === 1, |
694 | price: result[0].data.price, | 699 | price: result[0].data.price, |
695 | img: result[0].data.image, | 700 | img: result[0].data.image, |
701 | + limit: result[0].data.styleNumber, | ||
702 | + styleId: result[0].data.styleList | ||
696 | }; | 703 | }; |
697 | resu.isAppointment = result[0].data.isAppointment === 1; | 704 | resu.isAppointment = result[0].data.isAppointment === 1; |
698 | resu.content = result[0].data.detail; | 705 | resu.content = result[0].data.detail; |
@@ -833,6 +840,7 @@ const chosenTime = (params) => { | @@ -833,6 +840,7 @@ const chosenTime = (params) => { | ||
833 | let resu = { | 840 | let resu = { |
834 | dateList: [], | 841 | dateList: [], |
835 | needAdv: params.activityType === '3', | 842 | needAdv: params.activityType === '3', |
843 | + hide: params.activityType === '1', | ||
836 | }; | 844 | }; |
837 | 845 | ||
838 | let build = []; | 846 | let build = []; |
@@ -1254,6 +1262,17 @@ const changeDate = (params) => { | @@ -1254,6 +1262,17 @@ const changeDate = (params) => { | ||
1254 | }); | 1262 | }); |
1255 | }; | 1263 | }; |
1256 | 1264 | ||
1265 | +// 获取可用时间 | ||
1266 | +const getAbleTime = (params) => { | ||
1267 | + return service.get('ActivityConfigController/getAppointTime4Activity', { | ||
1268 | + activityType: params.activityType, | ||
1269 | + activityId: params.activityId, | ||
1270 | + isFront: params.isFront | ||
1271 | + }).then(result => { | ||
1272 | + return result; | ||
1273 | + }); | ||
1274 | +}; | ||
1275 | + | ||
1257 | module.exports = { | 1276 | module.exports = { |
1258 | store, | 1277 | store, |
1259 | articleDetail, | 1278 | articleDetail, |
@@ -1279,5 +1298,6 @@ module.exports = { | @@ -1279,5 +1298,6 @@ module.exports = { | ||
1279 | cutter, | 1298 | cutter, |
1280 | delOrder, | 1299 | delOrder, |
1281 | changeDate, | 1300 | changeDate, |
1282 | - kids | 1301 | + kids, |
1302 | + getAbleTime | ||
1283 | }; | 1303 | }; |
@@ -191,6 +191,7 @@ router.get('/trend/need-know', trend.needKnow); | @@ -191,6 +191,7 @@ router.get('/trend/need-know', trend.needKnow); | ||
191 | 191 | ||
192 | // 获取时间列表 | 192 | // 获取时间列表 |
193 | router.get('/trend/getTimeList', trend.getTimeList); | 193 | router.get('/trend/getTimeList', trend.getTimeList); |
194 | +router.get('/trend/getAbleTime', trend.getAbleTime); | ||
194 | 195 | ||
195 | // 增加预约订单 | 196 | // 增加预约订单 |
196 | router.get('/trend/addOrder', trend.addOrder); | 197 | router.get('/trend/addOrder', trend.addOrder); |
@@ -111,7 +111,7 @@ | @@ -111,7 +111,7 @@ | ||
111 | </div> | 111 | </div> |
112 | </div> | 112 | </div> |
113 | <div class="textarea"> | 113 | <div class="textarea"> |
114 | - <textarea class="cookie" id="note">添加备注(选填)</textarea> | 114 | + <textarea class="cookie disabled" id="note">添加备注(选填)</textarea> |
115 | </div> | 115 | </div> |
116 | </div> | 116 | </div> |
117 | <div class="need-know"> | 117 | <div class="need-know"> |
1 | <div class="trend-c"> | 1 | <div class="trend-c"> |
2 | - <p class="date-tip"><span class="icon-pic tip"></span>如更换{{#if needAdv}}顾问{{else}}套餐{{/ if}}请重新选择</p> | 2 | + <p class="date-tip {{#if hide}}hide{{/if}}"><span class="icon-pic tip"></span>如更换{{#if needAdv}}顾问{{else}}套餐{{/ if}}请重新选择</p> |
3 | <div class="side-main"> | 3 | <div class="side-main"> |
4 | <div class="time-nav wrapper clearfix"> | 4 | <div class="time-nav wrapper clearfix"> |
5 | <ul class="nav-ul"> | 5 | <ul class="nav-ul"> |
@@ -14,6 +14,8 @@ | @@ -14,6 +14,8 @@ | ||
14 | <p>{{summary}}</p> | 14 | <p>{{summary}}</p> |
15 | </div> | 15 | </div> |
16 | </div> | 16 | </div> |
17 | + <input class="limit" type="hidden" value="{{limit}}" /> | ||
18 | + <input class="styleid" type="hidden" value="{{styleId}}" /> | ||
17 | {{/ detail}} | 19 | {{/ detail}} |
18 | <div class="content content-padding">{{{content}}}</div> | 20 | <div class="content content-padding">{{{content}}}</div> |
19 | {{#if isAppointment}} | 21 | {{#if isAppointment}} |
@@ -2,7 +2,8 @@ require('../common'); | @@ -2,7 +2,8 @@ require('../common'); | ||
2 | var tip = require('../plugin/tip'), | 2 | var tip = require('../plugin/tip'), |
3 | IScroll = require('yoho-iscroll'), | 3 | IScroll = require('yoho-iscroll'), |
4 | diaLog = require('../plugin/dialog'), | 4 | diaLog = require('../plugin/dialog'), |
5 | - Swiper = require('yoho-swiper'); | 5 | + Swiper = require('yoho-swiper'), |
6 | + moment = require('moment'); | ||
6 | 7 | ||
7 | var $num = $('.num'), | 8 | var $num = $('.num'), |
8 | $navUl = $('.nav-ul'); | 9 | $navUl = $('.nav-ul'); |
@@ -95,10 +96,13 @@ $( | @@ -95,10 +96,13 @@ $( | ||
95 | $('.swiper-slide img').each( | 96 | $('.swiper-slide img').each( |
96 | function() { | 97 | function() { |
97 | if ($(this).height() > w_height) { | 98 | if ($(this).height() > w_height) { |
98 | - $(this).css('max-height', '100%'); | ||
99 | - $(this).css('top', '0'); | 99 | + $(this).css('height', '90%'); |
100 | + $(this).css('width', 'auto'); | ||
101 | + var newTop = (w_height - $(this).height()) / 2; | ||
102 | + $(this).css('margin-top', newTop + 'px'); | ||
100 | } else { | 103 | } else { |
101 | - $(this).css('margin-top', '-' + $(this).height()/2 + 'px'); | 104 | + var newTop = (w_height - $(this).height()) / 2; |
105 | + $(this).css('margin-top', newTop + 'px'); | ||
102 | } | 106 | } |
103 | } | 107 | } |
104 | ); | 108 | ); |
@@ -113,6 +117,7 @@ $( | @@ -113,6 +117,7 @@ $( | ||
113 | var boxWidth = box.eq(0).width(); | 117 | var boxWidth = box.eq(0).width(); |
114 | var num = 2; | 118 | var num = 2; |
115 | var boxArr = []; | 119 | var boxArr = []; |
120 | + var maxHeight = 0; | ||
116 | box.each(function(index, value) { | 121 | box.each(function(index, value) { |
117 | var boxHeight = box.eq(index).height(); | 122 | var boxHeight = box.eq(index).height(); |
118 | if (index < num) { | 123 | if (index < num) { |
@@ -126,8 +131,11 @@ $( | @@ -126,8 +131,11 @@ $( | ||
126 | 'left': box.eq(minBoxIndex).position().left | 131 | 'left': box.eq(minBoxIndex).position().left |
127 | }); | 132 | }); |
128 | boxArr[minBoxIndex] += box.eq(index).height(); | 133 | boxArr[minBoxIndex] += box.eq(index).height(); |
129 | - var pullHeight = minBoxHeight + box.eq(index).height(); | ||
130 | - $('.pull-pic-list').css('height', pullHeight + 'px'); | 134 | + var newHeight = $(this).position().top + box.eq(index).height(); |
135 | + if (newHeight > maxHeight) { | ||
136 | + maxHeight = newHeight; | ||
137 | + } | ||
138 | + $('.pull-pic-list').css('height', maxHeight + 'px'); | ||
131 | } | 139 | } |
132 | }); | 140 | }); |
133 | } | 141 | } |
@@ -284,6 +292,9 @@ $( | @@ -284,6 +292,9 @@ $( | ||
284 | $('.chosen-cutter').val(window.cookie('chosenCutter')); | 292 | $('.chosen-cutter').val(window.cookie('chosenCutter')); |
285 | $('.chosen-adviser').val(window.cookie('chosenAdviser')); | 293 | $('.chosen-adviser').val(window.cookie('chosenAdviser')); |
286 | $('.chosen-class').val(window.cookie('chosenClass')); | 294 | $('.chosen-class').val(window.cookie('chosenClass')); |
295 | + if (window.cookie('chosenClass')) { | ||
296 | + getAbleTime(); | ||
297 | + } | ||
287 | if (!window.cookie('chosenCutter') && window.cookie('chosenPackage')) { | 298 | if (!window.cookie('chosenCutter') && window.cookie('chosenPackage')) { |
288 | $('.chosen-cutter').val('不预约发型师'); | 299 | $('.chosen-cutter').val('不预约发型师'); |
289 | } | 300 | } |
@@ -325,7 +336,7 @@ $( | @@ -325,7 +336,7 @@ $( | ||
325 | 336 | ||
326 | $('.textarea textarea').on('focus', function() { | 337 | $('.textarea textarea').on('focus', function() { |
327 | if ($(this).val() === '添加备注(选填)') { | 338 | if ($(this).val() === '添加备注(选填)') { |
328 | - $(this).val(''); | 339 | + $(this).val('').removeClass('disabled'); |
329 | } | 340 | } |
330 | }); | 341 | }); |
331 | 342 | ||
@@ -343,6 +354,8 @@ $( | @@ -343,6 +354,8 @@ $( | ||
343 | } | 354 | } |
344 | if ($('.package-detail').length > 0) { | 355 | if ($('.package-detail').length > 0) { |
345 | window.setCookie('chosenPackage', $('.package-detail').find('.name').text()); | 356 | window.setCookie('chosenPackage', $('.package-detail').find('.name').text()); |
357 | + window.setCookie('packageLimit', $('.package-detail').find('.limit').val()); | ||
358 | + window.setCookie('packageStyle', $('.package-detail').find('.styleid').val()); | ||
346 | } | 359 | } |
347 | 360 | ||
348 | // 立即预约按钮 | 361 | // 立即预约按钮 |
@@ -565,7 +578,7 @@ function autoScroll (thisPo) { | @@ -565,7 +578,7 @@ function autoScroll (thisPo) { | ||
565 | $navUl.find('.nav-item:eq(' + thisPo + ')').addClass('active').siblings('li').removeClass('active'); | 578 | $navUl.find('.nav-item:eq(' + thisPo + ')').addClass('active').siblings('li').removeClass('active'); |
566 | if (thisPo >= 2) { | 579 | if (thisPo >= 2) { |
567 | // 倒数三个不触发效果 | 580 | // 倒数三个不触发效果 |
568 | - if ((sNum - thisPo) > 3) { | 581 | + if ((sNum - thisPo) >= 3) { |
569 | myScroll.scrollTo((0 - (thisPo - 2) * sWidth), 0, 400); | 582 | myScroll.scrollTo((0 - (thisPo - 2) * sWidth), 0, 400); |
570 | } | 583 | } |
571 | } | 584 | } |
@@ -782,6 +795,33 @@ function limitInp (obj, limit, show) { | @@ -782,6 +795,33 @@ function limitInp (obj, limit, show) { | ||
782 | } | 795 | } |
783 | } | 796 | } |
784 | 797 | ||
798 | +function getAbleTime() { | ||
799 | + $.ajax({ | ||
800 | + url: '/activity/trend/getAbleTime', | ||
801 | + data: { | ||
802 | + activityType: window.queryString.typeStatus, | ||
803 | + activityId: window.cookie('packageId') | ||
804 | + }, | ||
805 | + success: function(result) { | ||
806 | + if (result.code === 200) { | ||
807 | + if (result.data) { | ||
808 | + $('.chosen-time').val(_formatDay(new Date(result.data * 1000))).addClass('disabled'); | ||
809 | + $('.chosen-time').parents('a').attr('href', 'javascript:void(0)'); | ||
810 | + } | ||
811 | + } else { | ||
812 | + tip.show('网络断开了~~~'); | ||
813 | + } | ||
814 | + }, | ||
815 | + error: function() { | ||
816 | + tip.show('网络断开了~~~'); | ||
817 | + } | ||
818 | + }); | ||
819 | +} | ||
820 | + | ||
821 | +function _formatDay(day) { | ||
822 | + return moment(day).format('MM月DD日 HH:mm'); | ||
823 | +}; | ||
824 | + | ||
785 | // 清除cookie | 825 | // 清除cookie |
786 | function clearCookieArr (type) { | 826 | function clearCookieArr (type) { |
787 | switch (type) { | 827 | switch (type) { |
@@ -812,6 +852,7 @@ function clearCookieArr (type) { | @@ -812,6 +852,7 @@ function clearCookieArr (type) { | ||
812 | window.setCookie('limitPerson', ''); | 852 | window.setCookie('limitPerson', ''); |
813 | window.setCookie('packageLimit', ''); | 853 | window.setCookie('packageLimit', ''); |
814 | window.setCookie('packageStyle', ''); | 854 | window.setCookie('packageStyle', ''); |
855 | + window.setCookie('chosenClass', ''); | ||
815 | break; | 856 | break; |
816 | } | 857 | } |
817 | } | 858 | } |
@@ -12,6 +12,14 @@ | @@ -12,6 +12,14 @@ | ||
12 | background-color: #ebebeb; | 12 | background-color: #ebebeb; |
13 | padding-bottom: 88px; | 13 | padding-bottom: 88px; |
14 | 14 | ||
15 | + input.disabled { | ||
16 | + color: #aaa; | ||
17 | + } | ||
18 | + | ||
19 | + textarea.disabled{ | ||
20 | + color: #aaa; | ||
21 | + } | ||
22 | + | ||
15 | img { | 23 | img { |
16 | width: 100%; | 24 | width: 100%; |
17 | } | 25 | } |
@@ -986,11 +994,7 @@ | @@ -986,11 +994,7 @@ | ||
986 | padding: 0; | 994 | padding: 0; |
987 | 995 | ||
988 | img { | 996 | img { |
989 | - position: absolute; | ||
990 | - width: 700px; | ||
991 | - left: 50%; | ||
992 | - margin-left: -350px; | ||
993 | - top: 50%; | 997 | + width: 90%; |
994 | height: auto; | 998 | height: auto; |
995 | } | 999 | } |
996 | } | 1000 | } |
-
Please register or login to post a comment