self_order.js
7.53 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
+(function($){
$.lie = $.lie || {version: "v1.0.0"};
$.extend($.lie, {
self:{
index:function(){
$.lie.droplist($('.droplist'));
// 搜索、导出条件
function orderListCommon(url) {
var order_type = $('#order_type').data('default'),
order_contain = $('input[name=order_contain]').val(),
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
order_status = $('#order_status').val() ? $('#order_status').val() : '',
sale_type = $('#sale_type').val() ? $('#sale_type').val() : '',
order_payment_mode = $('#order_payment_mode').val() ? $('#order_payment_mode').val() : ''
// order_send = $('#order_send').val(),
order_source_pf = $('#order_source_pf').val() ? $('#order_source_pf').val() : '',
order_invoice_status = $('#order_invoice_status').val() ? $('#order_invoice_status').val() : '',
order_source_adtag = $('input[name="order_source_adtag"]').val(),
order_source_ptag = $('input[name="order_source_ptag"]').val(),
test_order = $('input[name=test_order]'),
is_new = $('#is_new').val() ? $('#is_new').val() : '';
// is_new_order = $('#is_new_order').val() ? $('#is_new_order').val() : '';
if (url == '/export') {
if (test_order.length) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag && !is_new && !test_order.is(':checked')) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
} else {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag && !is_new) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
}
}
var listUrl = url;
listUrl += '?order_type=' + order_type;
if (order_contain) {
listUrl += '&order_contain=' + specialStr(order_contain);
}
if(time_start){
time_start = Date.parse(time_start) / 1000;
listUrl += '&time_start='+time_start;
}
if(time_end){
time_end = Date.parse(time_end) / 1000 + (24*60*60-1);
listUrl += '&time_end='+time_end;
}
if (order_status) {
listUrl += '&order_status=' + order_status;
}
if (sale_type) {
listUrl += '&sale_type=' + sale_type;
}
if (order_payment_mode) {
listUrl += '&order_payment_mode=' + order_payment_mode;
}
if (order_source_pf) {
listUrl += '&order_source_pf=' + order_source_pf;
}
if (order_invoice_status) {
listUrl += '&order_invoice_status=' + order_invoice_status;
}
if (order_source_adtag) {
listUrl += '&order_source_adtag=' + order_source_adtag;
}
if (order_source_ptag) {
listUrl += '&order_source_ptag=' + order_source_ptag;
}
if (is_new) {
listUrl += '&is_new=' + is_new;
}
// if (is_new_order) {
// listUrl += '&is_new_order=' + is_new_order;
// }
if (test_order.is(':checked')) {
listUrl += '&test_order=' + 1;
}
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag && (is_new === '') && !test_order.is(':checked')) {
listUrl = '/self_order';
}
if (url == '/export') {
listUrl += '&order_goods_type='+2;
}
location.href = listUrl;
}
$('.search_self_order').click(function(){
orderListCommon('/self_order');
})
// 导出订单
$('.self_export').click(function() {
orderListCommon('/export');
})
// 选择查看测试订单
$('input[name=test_order]').click(function(){
if ($(this).is(':checked')) {
$(this).val(1);
} else {
$(this).val('');
}
})
// 切换类型时,清空输入框内容
$('.dropdown-menu>li').click(function(){
var val = $(this).data('val'); // 当前值
var def = $(this).parents('.droplist').data('default'); // 默认值
if (val !== def) {
if ($(this).parents('.droplist').attr('name') == 'order_type') {
$('input[name=order_contain]').val(''); // 清空
}
console.log(val)
$(this).parents('.droplist').data('default', val); // 赋值
}
})
// 展示列表下的内容
$('.show-list').click(function(){
var nextTr = $(this).parent('tr').next('.show-other-content');
if (nextTr.css('display') == 'none') {
$(this).parent('tr').siblings('.show-other-content').hide();
nextTr.show();
} else {
nextTr.hide();
}
})
// 下载合同
$('.download-contract').click(function(){
var order_id = $(this).data('id');
$.ajax({
url: '/ajaxDownloadContract',
type: 'post',
data: {order_id:order_id},
dataType: 'json',
success: function(resp) {
if (resp.errcode != 0) {
layer.msg(resp.msg);
return false;
}
location.href = resp.data;
},
error: function(err) {
console.log(err)
}
})
})
}
}
});
})(jQuery)