Authored by 郝肖肖

Merge branch 'release/5.5' of git.yoho.cn:fe/yohobuywap-node into release/5.5

@@ -62,3 +62,32 @@ @@ -62,3 +62,32 @@
62 </div> 62 </div>
63 </div> 63 </div>
64 64
  65 +{{!-- 申请退款确认框 --}}
  66 +<div class="ymodal ymodal-alert" id="refundModal">
  67 + <div class="ymodal-dialog">
  68 + <div class="ymodal-content">
  69 + <div class="ymodal-body">
  70 + 申请退款后,本单享有的优惠可能会一并取消,确定申请吗?
  71 + </div>
  72 + <div class="modal-btn">
  73 + <button class="dis-miss-btn" data-dismiss="ymodal">返回</button>
  74 + <button id="sureRefund">确定</button>
  75 + </div>
  76 + </div>
  77 + </div>
  78 +</div>
  79 +
  80 +{{!-- 取消订单确认框 --}}
  81 +<div class="ymodal ymodal-alert" id="closeModal">
  82 + <div class="ymodal-dialog">
  83 + <div class="ymodal-content">
  84 + <div class="ymodal-body">
  85 + 取消订单后,本单享有的优惠可能会一并取消,确定申请吗?
  86 + </div>
  87 + <div class="modal-btn">
  88 + <button class="dis-miss-btn" data-dismiss="ymodal">返回</button>
  89 + <button id="sureClose">确定</button>
  90 + </div>
  91 + </div>
  92 + </div>
  93 +</div>
@@ -143,7 +143,7 @@ @@ -143,7 +143,7 @@
143 {{/unless}} 143 {{/unless}}
144 144
145 {{#if unpaid}} 145 {{#if unpaid}}
146 - <span class="btn btn-cancel">取消订单</span> 146 + <span class="btn btn-cancel" data-toggle="ymodal" data-target="#closeModal">取消订单</span>
147 {{#if payUrl}} 147 {{#if payUrl}}
148 <a class="btn btn-pay" href="{{payUrl}}">立即付款</a> 148 <a class="btn btn-pay" href="{{payUrl}}">立即付款</a>
149 {{/if}} 149 {{/if}}
@@ -163,7 +163,7 @@ @@ -163,7 +163,7 @@
163 163
164 {{!-- 申请退款 --}} 164 {{!-- 申请退款 --}}
165 {{#if refundApply}} 165 {{#if refundApply}}
166 - <span class="btn btn-refund">申请退款</span> 166 + <span class="btn btn-refund" data-toggle="ymodal" data-target="#refundModal">申请退款</span>
167 {{/if}} 167 {{/if}}
168 {{/if}} 168 {{/if}}
169 </div> 169 </div>
@@ -200,6 +200,38 @@ @@ -200,6 +200,38 @@
200 </div> 200 </div>
201 </div> 201 </div>
202 </div> 202 </div>
  203 +
  204 +{{!-- 申请退款确认框 --}}
  205 +<div class="ymodal ymodal-alert" id="refundModal">
  206 + <div class="ymodal-dialog">
  207 + <div class="ymodal-content">
  208 + <div class="ymodal-body">
  209 + 申请退款后,本单享有的优惠可能会一并取消,确定申请吗?
  210 + </div>
  211 + <div class="modal-btn">
  212 + <button class="dis-miss-btn" data-dismiss="ymodal">返回</button>
  213 + <button id="sureRefund">确定</button>
  214 + </div>
  215 + </div>
  216 + </div>
  217 +</div>
  218 +
  219 +{{!-- 取消订单确认框 --}}
  220 +<div class="ymodal ymodal-alert" id="closeModal">
  221 + <div class="ymodal-dialog">
  222 + <div class="ymodal-content">
  223 + <div class="ymodal-body">
  224 + 取消订单后,本单享有的优惠可能会一并取消,确定申请吗?
  225 + </div>
  226 + <div class="modal-btn">
  227 + <button class="dis-miss-btn" data-dismiss="ymodal">返回</button>
  228 + <button id="sureClose">确定</button>
  229 + </div>
  230 + </div>
  231 + </div>
  232 +</div>
  233 +
  234 +
203 <script>_ozprm = "orderid={{orderCode}}&ordertotal={{orderTotal}}";</script> 235 <script>_ozprm = "orderid={{orderCode}}&ordertotal={{orderTotal}}";</script>
204 <script type="text/javascript" src="//static.yohobuy.com/m/v1/js/AG_Tracking.js"></script> 236 <script type="text/javascript" src="//static.yohobuy.com/m/v1/js/AG_Tracking.js"></script>
205 <script type="text/javascript"> 237 <script type="text/javascript">
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 40
41 {{!-- 申请退款 --}} 41 {{!-- 申请退款 --}}
42 {{#if refundApply}} 42 {{#if refundApply}}
43 - <span class="btn refund">申请退款</span> 43 + <span class="btn refund" data-toggle="ymodal" data-target="#refundModal">申请退款</span>
44 {{/if}} 44 {{/if}}
45 {{!-- 修改地址 --}} 45 {{!-- 修改地址 --}}
46 {{#if modifyAddress.modifyAddress}} 46 {{#if modifyAddress.modifyAddress}}
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 <span class="hours">{{leftTime}}</span> 63 <span class="hours">{{leftTime}}</span>
64 </li> 64 </li>
65 </ul> 65 </ul>
66 - <span class="btn cancel">取消订单</span> 66 + <span class="btn cancel" data-toggle="ymodal" data-target="#closeModal">取消订单</span>
67 {{#if payUrl}} 67 {{#if payUrl}}
68 <a class="locHref" href="{{payUrl}}"> 68 <a class="locHref" href="{{payUrl}}">
69 <span class="btn pay">立即付款</span> 69 <span class="btn pay">立即付款</span>
@@ -13,6 +13,10 @@ var $ = require('yoho-jquery'), @@ -13,6 +13,10 @@ var $ = require('yoho-jquery'),
13 var $navLi = $('#order-nav > li'), 13 var $navLi = $('#order-nav > li'),
14 $orderContainer = $('#order-container'); 14 $orderContainer = $('#order-container');
15 15
  16 +var $sureClose = $('#sureClose'); // 确定删除订单
  17 +var $sureRefund = $('#sureRefund'); // 确定申请退款
  18 +var $disMissBtn = $('.dis-miss-btn'); // 返回
  19 +
16 var $curContainer = $orderContainer.children('.orders:not(.hide)');// 保存当前显示的order-container 20 var $curContainer = $orderContainer.children('.orders:not(.hide)');// 保存当前显示的order-container
17 21
18 var winH = $(window).height(); 22 var winH = $(window).height();
@@ -40,6 +44,8 @@ var orderHammer, @@ -40,6 +44,8 @@ var orderHammer,
40 var firstScreen = $('.firstscreen-orders').children().size() > 0; 44 var firstScreen = $('.firstscreen-orders').children().size() > 0;
41 45
42 require('../common'); 46 require('../common');
  47 +require('../plugin/modal.alert');
  48 +require('../../scss/layout/_modal.css');
43 49
44 require('home/order-list.page.css'); 50 require('home/order-list.page.css');
45 51
@@ -241,10 +247,11 @@ orderHammer.on('tap', function(e) { @@ -241,10 +247,11 @@ orderHammer.on('tap', function(e) {
241 }); 247 });
242 } else if ($cur.closest('.cancel').length > 0) { 248 } else if ($cur.closest('.cancel').length > 0) {
243 // 取消订单 249 // 取消订单
244 - $reaMask.css('visibility', 'visible'); 250 + // $reaMask.css('visibility', 'visible');
245 } else if ($cur.closest('.refund').length > 0) { 251 } else if ($cur.closest('.refund').length > 0) {
  252 +
246 // 申请退款 253 // 申请退款
247 - $refundReaMask.css('visibility', 'visible'); 254 + // $refundReaMask.css('visibility', 'visible');
248 255
249 /** 256 /**
250 * 埋点 257 * 埋点
@@ -381,16 +388,28 @@ $reaMask.find('.box-cmp').on('touchend', function() { @@ -381,16 +388,28 @@ $reaMask.find('.box-cmp').on('touchend', function() {
381 reasonId: reasonId 388 reasonId: reasonId
382 } 389 }
383 }).then(function(res) { 390 }).then(function(res) {
384 - $reaMask.fadeOut(); 391 + $reaMask.css('visibility', 'visible');
385 if ($.type(res) !== 'object') { 392 if ($.type(res) !== 'object') {
386 return; 393 return;
387 } 394 }
  395 +
  396 + if (res.code === 200) {
  397 + dialog.showDialog({
  398 + dialogText: '您的取消订单申请已提交,请耐心等待',
  399 + hasFooter: {
  400 + leftBtnText: '返回',
  401 + rightBtnText: '确定'
  402 + }
  403 + }, function() {
  404 + window.location.href = '/home/orders';
  405 + });
  406 +
  407 + return false;
  408 + }
  409 +
388 if (res.message) { 410 if (res.message) {
389 tip.show(res.message); 411 tip.show(res.message);
390 } 412 }
391 - setTimeout(function() {  
392 - window.location.href = '/home/orders';  
393 - }, 2000);  
394 }).fail(function() { 413 }).fail(function() {
395 tip.show('网络错误'); 414 tip.show('网络错误');
396 }); 415 });
@@ -411,16 +430,28 @@ $refundReaMask.find('.box-cmp').on('touchend', function() { @@ -411,16 +430,28 @@ $refundReaMask.find('.box-cmp').on('touchend', function() {
411 reasonId: reasonId 430 reasonId: reasonId
412 } 431 }
413 }).then(function(res) { 432 }).then(function(res) {
414 - $refundReaMask.fadeOut(); 433 + $refundReaMask.css('visibility', 'hidden');
415 if ($.type(res) !== 'object') { 434 if ($.type(res) !== 'object') {
416 return; 435 return;
417 } 436 }
  437 +
  438 + if (res.code === 200) {
  439 + dialog.showDialog({
  440 + dialogText: '您的退款申请已提交,请耐心等待退款',
  441 + hasFooter: {
  442 + leftBtnText: '返回',
  443 + rightBtnText: '确定'
  444 + }
  445 + }, function() {
  446 + window.location.href = '/home/orders';
  447 + });
  448 +
  449 + return false;
  450 + }
  451 +
418 if (res.message) { 452 if (res.message) {
419 tip.show(res.message); 453 tip.show(res.message);
420 } 454 }
421 - setTimeout(function() {  
422 - window.location.href = '/home/orders';  
423 - }, 2000);  
424 }).fail(function() { 455 }).fail(function() {
425 tip.show('网络错误'); 456 tip.show('网络错误');
426 }); 457 });
@@ -435,9 +466,21 @@ $reaMask.on('touchend', function(event) { @@ -435,9 +466,21 @@ $reaMask.on('touchend', function(event) {
435 event.stopPropagation(); 466 event.stopPropagation();
436 }); 467 });
437 468
  469 +// 弹出取消订单提示框
  470 +$sureClose.on('click', function() {
  471 + $disMissBtn.trigger('click');
  472 + $reaMask.css('visibility', 'visible');
  473 +});
  474 +
  475 +// 弹出申请退款提示框
  476 +$sureRefund.on('click', function() {
  477 + $disMissBtn.trigger('click');
  478 + $refundReaMask.css('visibility', 'visible');
  479 +});
  480 +
438 // 申请退款 481 // 申请退款
439 $refundReaMask.on('touchend', function(event) { 482 $refundReaMask.on('touchend', function(event) {
440 - if (event.target.className !== 'reason-mask') { 483 + if (event.target.className !== 'refund-reason-mask') {
441 return false; 484 return false;
442 } 485 }
443 486
@@ -22,8 +22,15 @@ var orderId = $('#order-detail').data('id'), @@ -22,8 +22,15 @@ var orderId = $('#order-detail').data('id'),
22 optHammer, 22 optHammer,
23 $createTime = new Date($('.createTime').text() * 1000); 23 $createTime = new Date($('.createTime').text() * 1000);
24 24
  25 +var $sureClose = $('#sureClose'); // 确定删除订单
  26 +var $sureRefund = $('#sureRefund'); // 确定申请退款
  27 +var $disMissBtn = $('.dis-miss-btn'); // 返回
  28 +
  29 +
25 require('home/order-detail-index.page.css'); 30 require('home/order-detail-index.page.css');
26 require('../common'); 31 require('../common');
  32 +require('../plugin/modal.alert');
  33 +require('../../scss/layout/_modal.css');
27 34
28 lazyLoad({ 35 lazyLoad({
29 try_again_css: 'order-failure' 36 try_again_css: 'order-failure'
@@ -117,9 +124,9 @@ optHammer.on('tap', function(e) { @@ -117,9 +124,9 @@ optHammer.on('tap', function(e) {
117 }); 124 });
118 }); 125 });
119 } else if ($cur.hasClass('btn-cancel')) { 126 } else if ($cur.hasClass('btn-cancel')) {
120 - $reaMask.css('visibility', 'visible'); 127 + // $reaMask.css('visibility', 'visible');
121 } else if ($cur.hasClass('btn-refund')) { 128 } else if ($cur.hasClass('btn-refund')) {
122 - $refundReaMask.css('visibility', 'visible'); 129 + // $refundReaMask.css('visibility', 'visible');
123 130
124 /** 131 /**
125 * 埋点 132 * 埋点
@@ -238,6 +245,9 @@ $(function() { @@ -238,6 +245,9 @@ $(function() {
238 }); 245 });
239 }); 246 });
240 247
  248 +/**
  249 + * 取消订单
  250 + */
241 $reaMask.find('.box-cmp').on('touchend', function() { 251 $reaMask.find('.box-cmp').on('touchend', function() {
242 var selSolid = reasonSwiper.slides[reasonSwiper.activeIndex], 252 var selSolid = reasonSwiper.slides[reasonSwiper.activeIndex],
243 reason = $(selSolid).text(), 253 reason = $(selSolid).text(),
@@ -252,16 +262,27 @@ $reaMask.find('.box-cmp').on('touchend', function() { @@ -252,16 +262,27 @@ $reaMask.find('.box-cmp').on('touchend', function() {
252 reasonId: reasonId 262 reasonId: reasonId
253 } 263 }
254 }).then(function(res) { 264 }).then(function(res) {
255 - $reaMask.fadeOut(); 265 + $reaMask.css('visibility', 'visible');
256 if ($.type(res) !== 'object') { 266 if ($.type(res) !== 'object') {
257 return; 267 return;
258 } 268 }
  269 +
  270 + if (res.code === 200) {
  271 + dialog.showDialog({
  272 + dialogText: '您的取消订单申请已提交,请耐心等待',
  273 + hasFooter: {
  274 + leftBtnText: '返回',
  275 + rightBtnText: '确定'
  276 + }
  277 + }, function() {
  278 + window.location.href = '/home/orders';
  279 + });
  280 +
  281 + return false;
  282 + }
259 if (res.message) { 283 if (res.message) {
260 tip.show(res.message); 284 tip.show(res.message);
261 } 285 }
262 - setTimeout(function() {  
263 - window.location.href = '/home/orders';  
264 - }, 2000);  
265 }).fail(function() { 286 }).fail(function() {
266 tip.show('网络错误'); 287 tip.show('网络错误');
267 }); 288 });
@@ -282,16 +303,27 @@ $refundReaMask.find('.box-cmp').on('touchend', function() { @@ -282,16 +303,27 @@ $refundReaMask.find('.box-cmp').on('touchend', function() {
282 reasonId: reasonId 303 reasonId: reasonId
283 } 304 }
284 }).then(function(res) { 305 }).then(function(res) {
285 - $refundReaMask.fadeOut(); 306 + $refundReaMask.css('visibility', 'visible');
286 if ($.type(res) !== 'object') { 307 if ($.type(res) !== 'object') {
287 return; 308 return;
288 } 309 }
  310 +
  311 + if (res.code === 200) {
  312 + dialog.showDialog({
  313 + dialogText: '您的退款申请已提交,请耐心等待退款',
  314 + hasFooter: {
  315 + leftBtnText: '返回',
  316 + rightBtnText: '确定'
  317 + }
  318 + }, function() {
  319 + window.location.href = '/home/orders';
  320 + });
  321 +
  322 + return false;
  323 + }
289 if (res.message) { 324 if (res.message) {
290 tip.show(res.message); 325 tip.show(res.message);
291 } 326 }
292 - setTimeout(function() {  
293 - window.location.href = '/home/orders';  
294 - }, 2000);  
295 }).fail(function() { 327 }).fail(function() {
296 tip.show('网络错误'); 328 tip.show('网络错误');
297 }); 329 });
@@ -308,7 +340,7 @@ $reaMask.on('touchend', function(event) { @@ -308,7 +340,7 @@ $reaMask.on('touchend', function(event) {
308 340
309 // 申请退款 341 // 申请退款
310 $refundReaMask.on('touchend', function(event) { 342 $refundReaMask.on('touchend', function(event) {
311 - if (event.target.className !== 'reason-mask') { 343 + if (event.target.className !== 'refund-reason-mask') {
312 return false; 344 return false;
313 } 345 }
314 346
@@ -316,6 +348,19 @@ $refundReaMask.on('touchend', function(event) { @@ -316,6 +348,19 @@ $refundReaMask.on('touchend', function(event) {
316 event.stopPropagation(); 348 event.stopPropagation();
317 }); 349 });
318 350
  351 +
  352 +// 弹出取消订单提示框
  353 +$sureClose.on('click', function() {
  354 + $disMissBtn.trigger('click');
  355 + $reaMask.css('visibility', 'visible');
  356 +});
  357 +
  358 +// 弹出申请退款提示框
  359 +$sureRefund.on('click', function() {
  360 + $disMissBtn.trigger('click');
  361 + $refundReaMask.css('visibility', 'visible');
  362 +});
  363 +
319 function formatDate(objD) { 364 function formatDate(objD) {
320 var str, 365 var str,
321 yy = objD.getYear(), 366 yy = objD.getYear(),
@@ -155,11 +155,12 @@ setTimeout(() => { @@ -155,11 +155,12 @@ setTimeout(() => {
155 155
156 $('#addtoCart').on('touchstart', function() { 156 $('#addtoCart').on('touchstart', function() {
157 let productCode = $('#limitProductCode').val(); 157 let productCode = $('#limitProductCode').val();
  158 + let seckill = $('.seckill-time').length;
158 159
159 $('.cart-bar').hide(); 160 $('.cart-bar').hide();
160 chosePanel.show({ 161 chosePanel.show({
161 data: data, 162 data: data,
162 - disableNum: productCode 163 + disableNum: productCode || seckill
163 }).then(result => { 164 }).then(result => {
164 $('.cart-bar').show(); 165 $('.cart-bar').show();
165 if (result && result.sku) { 166 if (result && result.sku) {
@@ -358,3 +358,30 @@ @@ -358,3 +358,30 @@
358 color: #f00; 358 color: #f00;
359 } 359 }
360 } 360 }
  361 +
  362 +.modal-btn {
  363 + width: 100%;
  364 + height: 60px;
  365 + border-bottom-left-radius: 4px;
  366 + border-bottom-right-radius: 4px;
  367 + display: inline-block;
  368 +
  369 + button {
  370 + width: 268px;
  371 + border: 0;
  372 + float: left;
  373 + height: 68px;
  374 + background-color: #fff;
  375 + border-top: 1px solid #ccc;
  376 + }
  377 +
  378 + button:first-child {
  379 + border-bottom-left-radius: 4px;
  380 + border-right: 1px solid #ccc;
  381 + }
  382 +
  383 + button:last-child {
  384 + border-bottom-right-radius: 4px;
  385 + color: #d0021b;
  386 + }
  387 +}