+(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)