Showing
3 changed files
with
83 additions
and
66 deletions
1 | <script id="cancel-dialog-tpl" type="text/html"> | 1 | <script id="cancel-dialog-tpl" type="text/html"> |
2 | - <header>您取消订单的原因是:</header> | ||
3 | - <ul> | ||
4 | - <li> | ||
5 | - <input id="cancel-radio-1" type="radio" name="cancel-reason" value="1"> | ||
6 | - <label for="cancel-radio-1">支付不成功</label> | ||
7 | - </li> | ||
8 | - <li> | ||
9 | - <input id="cancel-radio-2" type="radio" name="cancel-reason" value="2"> | ||
10 | - <label for="cancel-radio-2">现在不想购买</label> | ||
11 | - </li> | ||
12 | - <li> | ||
13 | - <input id="cancel-radio-3" type="radio" name="cancel-reason" value="3"> | ||
14 | - <label for="cancel-radio-3">订单价格有问题</label> | ||
15 | - </li> | ||
16 | - <li> | ||
17 | - <input id="cancel-radio-4" type="radio" name="cancel-reason" value="4"> | ||
18 | - <label for="cancel-radio-4">修改订单信息</label> | ||
19 | - </li> | ||
20 | - <li> | ||
21 | - <input id="cancel-radio-5" type="radio" name="cancel-reason" value="5"> | ||
22 | - <label for="cancel-radio-5">错误或重复下单</label> | ||
23 | - </li> | ||
24 | - <li> | ||
25 | - <input id="cancel-radio-6" type="radio" name="cancel-reason" value="6"> | ||
26 | - <label for="cancel-radio-6">忘记使用优惠券或YOHO币</label> | ||
27 | - </li> | ||
28 | - <li> | ||
29 | - <input id="cancel-radio-7" type="radio" name="cancel-reason" value="7"> | ||
30 | - <label for="cancel-radio-7">等待发货时间过长</label> | ||
31 | - </li> | ||
32 | - <li> | ||
33 | - <input id="cancel-radio-8" type="radio" name="cancel-reason" value="8"> | ||
34 | - <label for="cancel-radio-8">商品价格较贵</label> | ||
35 | - </li> | ||
36 | - <li> | ||
37 | - <input id="cancel-radio-9" type="radio" name="cancel-reason" value="9"> | ||
38 | - <label for="cancel-radio-9">运费过高</label> | ||
39 | - </li> | ||
40 | - <li> | ||
41 | - <input id="cancel-radio-10" type="radio" name="cancel-reason" value="10"> | ||
42 | - <label for="cancel-radio-10">其他原因</label> | ||
43 | - <input type="text" placeholder="50字以内"> | ||
44 | - </li> | 2 | + <header>取消订单</header> |
3 | + <p class="tip">您取消订单的原因是:</p> | ||
4 | + <ul class="cancel-reason clearfix"> | ||
5 | + {{# cancelReason}} | ||
6 | + <li {{#if @last}}style="width:100%;"{{/if}}> | ||
7 | + <input id="cancel-radio-{{id}}" type="radio" name="cancel-reason" value="{{id}}"> | ||
8 | + <label for="cancel-radio-{{id}}">{{reason}}</label> | ||
9 | + {{#if @last}}<input type="text" id="reason_other" placeholder="50字以内" maxlength="50">{{/if}} | ||
10 | + </li> | ||
11 | + {{/ cancelReason}} | ||
12 | + </ul> | ||
13 | + <p class="tip reminder">温馨提示:</p> | ||
14 | + <ul class="info-prompt"> | ||
15 | + <li><i>*</i>订单成功取消后无法恢复</li> | ||
16 | + <li><i>*</i>该订单已付金额将原路返回</li> | ||
17 | + <li><i>*</i>取消订单后,存在促销关系的子订单及优惠可能会一并取消</li> | ||
45 | </ul> | 18 | </ul> |
46 | <p class="cancel-tip"></p> | 19 | <p class="cancel-tip"></p> |
20 | +</script> | ||
21 | +<script id="dialog-success" type="text/html"> | ||
22 | + | ||
47 | </script> | 23 | </script> |
@@ -28,18 +28,23 @@ function cancelFactory(id) { | @@ -28,18 +28,23 @@ function cancelFactory(id) { | ||
28 | cb: function() { | 28 | cb: function() { |
29 | var $checked = $('.cancel-dialog :checked'); | 29 | var $checked = $('.cancel-dialog :checked'); |
30 | var $tip = $('.cancel-dialog .cancel-tip'); | 30 | var $tip = $('.cancel-dialog .cancel-tip'); |
31 | - | 31 | + var text = ''; |
32 | + if ($checked.val() === '10') { | ||
33 | + text = $checked.parent().find('#reason_other').val(); | ||
34 | + }else{ | ||
35 | + text = $checked.siblings('label').text(); | ||
36 | + } | ||
32 | if ($checked.length === 0) { | 37 | if ($checked.length === 0) { |
33 | $tip.html('请选择要取消订单的原因'); | 38 | $tip.html('请选择要取消订单的原因'); |
34 | return; | 39 | return; |
35 | } | 40 | } |
36 | - | ||
37 | $.ajax({ | 41 | $.ajax({ |
38 | type: 'POST', | 42 | type: 'POST', |
39 | url: '/home/orders/cancelorder', | 43 | url: '/home/orders/cancelorder', |
40 | data: { | 44 | data: { |
41 | orderCode: id, | 45 | orderCode: id, |
42 | - reason: $checked.val() | 46 | + reasonId: $checked.val(), |
47 | + reason: text | ||
43 | } | 48 | } |
44 | }).then(function(data) { | 49 | }).then(function(data) { |
45 | if (data.code === 200) { | 50 | if (data.code === 200) { |
@@ -53,7 +58,7 @@ function cancelFactory(id) { | @@ -53,7 +58,7 @@ function cancelFactory(id) { | ||
53 | }, | 58 | }, |
54 | { | 59 | { |
55 | id: 'cancel-no', | 60 | id: 'cancel-no', |
56 | - name: '取消', | 61 | + name: '暂不取消', |
57 | btnClass: ['cancel-no'], | 62 | btnClass: ['cancel-no'], |
58 | cb: function() { | 63 | cb: function() { |
59 | active.close(); | 64 | active.close(); |
@@ -282,22 +282,32 @@ | @@ -282,22 +282,32 @@ | ||
282 | } | 282 | } |
283 | 283 | ||
284 | .cancel-dialog { | 284 | .cancel-dialog { |
285 | + width: 600px; | ||
286 | + background:#fff; | ||
287 | + padding:20px 30px 35px 30px; | ||
285 | header { | 288 | header { |
286 | - font-size: 14px; | ||
287 | - padding-bottom: 10px; | ||
288 | - border-bottom: 1px dotted #a7a7a7; | 289 | + font-size: 18px; |
290 | + padding-bottom: 20px; | ||
291 | + border-bottom:1px solid #e8e8e8; | ||
289 | color: #000; | 292 | color: #000; |
290 | text-align: left; | 293 | text-align: left; |
291 | } | 294 | } |
292 | - | ||
293 | - ul { | 295 | + .close{ |
296 | + top:15px; | ||
297 | + right:30px; | ||
298 | + .iconfont{ | ||
299 | + font-size:30px; | ||
300 | + } | ||
301 | + } | ||
302 | + .cancel-reason { | ||
294 | text-align: left; | 303 | text-align: left; |
295 | - padding: 10px 0 0 25px; | ||
296 | 304 | ||
297 | li { | 305 | li { |
306 | + float: left; | ||
307 | + width: 50%; | ||
298 | height: 28px; | 308 | height: 28px; |
299 | line-height: 28px; | 309 | line-height: 28px; |
300 | - font-size: 12px; | 310 | + font-size: 14px; |
301 | } | 311 | } |
302 | 312 | ||
303 | label { | 313 | label { |
@@ -314,35 +324,61 @@ | @@ -314,35 +324,61 @@ | ||
314 | .cancel-tip { | 324 | .cancel-tip { |
315 | margin-top: 20px; | 325 | margin-top: 20px; |
316 | color: #d60248; | 326 | color: #d60248; |
317 | - font-size: 12px; | ||
318 | - padding-left: 30px; | 327 | + font-size: 14px; |
328 | + padding-left: 17px; | ||
319 | text-align: left; | 329 | text-align: left; |
320 | } | 330 | } |
321 | 331 | ||
322 | .btns { | 332 | .btns { |
323 | - padding: 15px 30px; | ||
324 | - text-align: left; | 333 | + padding: 15px 30px 0; |
334 | + text-align: center; | ||
325 | 335 | ||
326 | .btn { | 336 | .btn { |
327 | height: 35px; | 337 | height: 35px; |
328 | - font-size: 12px; | 338 | + font-size: 15px; |
329 | line-height: 35px; | 339 | line-height: 35px; |
330 | } | 340 | } |
331 | 341 | ||
332 | .cancel-sure { | 342 | .cancel-sure { |
333 | width: 130px; | 343 | width: 130px; |
334 | - border-radius: 3px; | ||
335 | color: #fff; | 344 | color: #fff; |
336 | - background: #d60248; | 345 | + background: #000; |
337 | border: none; | 346 | border: none; |
338 | } | 347 | } |
339 | 348 | ||
340 | .cancel-no { | 349 | .cancel-no { |
341 | - background: #eaeaea; | ||
342 | - border-radius: 3px; | ||
343 | - color: #999; | ||
344 | - border-color: #ebebeb; | ||
345 | - width: 66px; | 350 | + margin-left:30px; |
351 | + background: #fff; | ||
352 | + color: #000; | ||
353 | + border-color: #000; | ||
354 | + width: 126px; | ||
355 | + } | ||
356 | + } | ||
357 | + .tip{ | ||
358 | + margin: 20px 0 ; | ||
359 | + font-size: 12px; | ||
360 | + text-align:left; | ||
361 | + color:#db3d50; | ||
362 | + } | ||
363 | + .reminder{ | ||
364 | + margin:20px 0 10px; | ||
365 | + } | ||
366 | + .info-prompt{ | ||
367 | + ul{ | ||
368 | + margin-top:-10px; | ||
369 | + } | ||
370 | + li{ | ||
371 | + margin:10px 0; | ||
372 | + font-size:14px; | ||
373 | + line-height:16px; | ||
374 | + text-align: left; | ||
375 | + } | ||
376 | + i{ | ||
377 | + color: #d70400; | ||
378 | + font-family: SimSun; | ||
379 | + font-size: 16px; | ||
380 | + margin-right: 10px; | ||
381 | + vertical-align:-6px; | ||
346 | } | 382 | } |
347 | } | 383 | } |
348 | } | 384 | } |
-
Please register or login to post a comment