returns-refund.page.js
1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* 退货申请页
* @author: yyqing<yanqing.yang@yoho.cn>
* @date: 2016/7/15
*/
var $ = require('yoho-jquery'),
lazyload = require('yoho-jquery-lazyload');
var $check = $('.check'),
$refundType = $('.refund-type'),
$typeInfo = $refundType.children('dl');
var $applyBtn = $('#apply-btn');
var checked;
require('../plugins/check');
lazyload($('img.lazy'));
function restApplyBtn() {
if (checked.documents && checked.documents.length) {
$applyBtn.removeClass('disable');
} else {
$applyBtn.addClass('disable');
}
}
$check.check({
type: 'checkbox',
onChange: function() {
checked = $check.check('getChecked');
restApplyBtn();
}
});
$refundType.on('click', '.type-item', function() {
var $this = $(this),
index;
if (!$this.hasClass('cur')) {
index = $this.index();
$this.addClass('cur').siblings('.cur').removeClass('cur');
$typeInfo.addClass('hide');
$typeInfo.eq(index).removeClass('hide');
}
});
$applyBtn.click(function() {
$.ajax({
type: 'POST',
url: '/me/return/refund/apply',
data: {
id: 11
},
success: function(data) {
if (data.code === 200) {
console.log(data);
}
}
});
});