refund-detail.page.js
2.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
* 退货详情页
* @author: yyqing<yanqing.yang@yoho.cn>
* @date: 2016/7/22
*/
var $ = require('yoho-jquery'),
lazyload = require('yoho-jquery-lazyload'),
Confirm = require('../plugins/dialog').Confirm;
var $mainWrap = $('.refund-datail-wrap'),
$submitExpress = $mainWrap.find('.submit-express'),
$showExpress = $mainWrap.find('.show-content'),
$editExpress = $mainWrap.find('.edit-content');
var $expressCompany = $('.express-company'),
$expressCode = $('.express-code');
var id = $mainWrap.data('id'),
expressList = $editExpress.data();
$('.blk-footer .return-top').remove(); // 移除通用的返回顶部组件
require('yoho-jquery-dotdotdot');
require('../common/header'); // header
require('../common/return-top'); // return-top
// dot
$('.goods-item .title').dotdotdot({
wrap: 'letter'
});
function cancelRefundApply() {
$.ajax({
type: 'POST',
url: '/me/return/cancel',
data: {
id: id,
type: 'refund'
},
success: function(data) {
if (data.code === 200) {
location.reload();
}
}
});
}
function setRefundEepress(eid, num) {
$.ajax({
type: 'POST',
url: '/me/return/setEepress',
data: {
id: id,
type: 'refund',
companyId: eid,
companyName: expressList[eid],
number: num
},
success: function(data) {
console.log(data);
if (data.code === 200) {
location.reload();
}
}
});
}
$('.cancel-btn').click(function() {
new Confirm({
content: '<h1 class="title">取消申请</h1><p>您确定要取消申请么?</p>',
cb: cancelRefundApply
}).show();
});
$submitExpress.click(function() {
var companyId = $expressCompany.val(),
code = parseInt($expressCode.val(), 10);
if (!companyId || !code) {
$submitExpress.siblings('.error-tip').removeClass('hide');
return;
}
setRefundEepress(companyId, code);
});
$showExpress.on('click', '.reset-express', function() {
var expressId = $showExpress.data('id');
$expressCode.val(expressId);
$showExpress.addClass('hide');
$editExpress.removeClass('hide');
});
lazyload($('img.lazy'));