123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769 |
- $(function(){
-
- TransTpl = ''; RuleHead = ''; RuleCell = '';
- TransTpl += "<div class=\"ncsu-trans-type\" data-delivery=\"TRANSTYPE\">\n";
- TransTpl += "<div class=\"entity\">\n";
- TransTpl += "<div class=\"default J_DefaultSet\">\n";
- TransTpl += "默认运费:\n";
- TransTpl += "<input class=\"w30 mr5 text\" type=\"text\" aria-label=\"默认运费"+unit+"数\" maxlength=\"4\" autocomplete=\"off\" data-field=\"start\" value=\"1\" name=\"default[TRANSTYPE][start]\">\n";
- TransTpl += ""+unit+"内,\n";
- TransTpl += "<input class=\"w60 text\" type=\"text\" aria-label=\"默认运费价格\" maxlength=\"6\" autocomplete=\"off\" value=\"\" name=\"default[TRANSTYPE][postage]\" data-field=\"postage\">";
- TransTpl += "<em class=\"add-on\">";
- TransTpl += "<i class=\"icon-renminbi\"><\/i>";
- TransTpl += "<\/em>, 每增加\n";
- TransTpl += "<input class=\"w30 ml5 mr5 text\" type=\"text\" aria-label=\"每加重\" maxlength=\"4\" autocomplete=\"off\" value=\"1\" data-field=\"plus\" name=\"default[TRANSTYPE][plus]\">\n";
- TransTpl += ""+unit+", 增加运费\n";
- TransTpl += "<input class=\"w50 ml5 text\" type=\"text\" aria-label=\"加重运费\" maxlength=\"6\" autocomplete=\"off\" value=\"\" data-field=\"postageplus\" name=\"default[TRANSTYPE][postageplus]\">";
- TransTpl += "<em class=\"add-on\">";
- TransTpl += "<i class=\"icon-renminbi\"><\/i>";
- TransTpl += "<\/em>\n";
- TransTpl += "<div class=\"J_DefaultMessage\"><\/div>\n";
- TransTpl += "<\/div>\n";
- TransTpl += "<div class=\"tbl-except\">\n";
- TransTpl += "<\/div>\n";
- TransTpl += "<div class=\"batch\" style=\"display:none\">\n";
- TransTpl += "<label><input class=\"J_BatchCheck\" type=\"checkbox\" aria-label=\"全选\" value=\"\" name=\"\">\n";
- TransTpl += "全选<\/label>\n";
- TransTpl += " <a class=\"J_BatchSet ncsc-btn-mini\" href=\"JavaScript:void(0);\">批量设置<\/a>\n";
- TransTpl += "<a class=\"J_BatchDel ncsc-btn-mini\" href=\"JavaScript:void(0);\">批量删除<\/a>\n";
- TransTpl += "<\/div>\n";
- TransTpl += "<div class=\"tbl-attach\">\n";
- TransTpl += "<div class=\"J_SpecialMessage\"><\/div>\n";
- TransTpl += "<a class=\"J_AddRule ncsc-btn-mini ml5\" href=\"JavaScript:void(0);\">";
- TransTpl += "<i class=\"icon-map-marker\"></i>为指定地区城市设置运费<\/a>\n";
- TransTpl += "<a class=\"J_ToggleBatch ncsc-btn-mini\" style=\"display:none\" href=\"JavaScript:void(0);\">";
- TransTpl += "<i class=\"icon-map-marker\"></i>批量操作<\/a>\n";
- TransTpl += "<\/div>\n";
- TransTpl += "<\/div>\n";
- TransTpl += "<\/div>\n";
- SpecialMessage = '';
- SpecialMessage += "<span error_type=\"area\" class=\"msg J_Message\" style=\"display:none\"><i class=\"icon-exclamation-sign\"><\/i>指定地区城市为空或指定错误<\/span>\n";
- SpecialMessage += "<span error_type=\"start\" class=\"msg J_Message\" style=\"display:none\"><i class=\"icon-exclamation-sign\"><\/i>首重应输入1至9999的数字<\/span>\n";
- SpecialMessage += "<span error_type=\"postage\" class=\"msg J_Message\" style=\"display:none\"><i class=\"icon-exclamation-sign\"><\/i>首费应输入0.00至999.99的数字<\/span>\n";
- SpecialMessage += "<span error_type=\"plus\" class=\"msg J_Message\" style=\"display:none\"><i class=\"icon-exclamation-sign\"><\/i>续重应输入1至9999的数字<\/span>\n";
- SpecialMessage += "<span error_type=\"postageplus\" class=\"msg J_Message\" style=\"display:none\"><i class=\"icon-exclamation-sign\"><\/i>续费应输入0.00至999.99的数字<\/span>\n";
- DefaultMessage = '';
- DefaultMessage += "<span error_type=\"start\" class=\"msg J_Message\" style=\"display:none\"><i class=\"icon-exclamation-sign\"><\/i>首重应输入1至9999的数字<\/span>\n";
- DefaultMessage += "<span error_type=\"postage\" class=\"msg J_Message\" style=\"display:none\"><i class=\"icon-exclamation-sign\"><\/i>首费应输入0.00至999.99的数字<\/span>\n";
- DefaultMessage += "<span error_type=\"plus\" class=\"msg J_Message\" style=\"display:none\"><i class=\"icon-exclamation-sign\"><\/i>续重应输入1至9999的数字<\/span>\n";
- DefaultMessage += "<span error_type=\"postageplus\" class=\"msg J_Message\" style=\"display:none\"><i class=\"icon-exclamation-sign\"><\/i>续费应输入0.00至999.99的数字<\/span>\n";
-
- StartNum = $('.tbl-except>table>tbody>tr').size();
-
- RuleHead += "<table cellspacing=\"0\" class=\"ncsc-table-style\" cellpadding=\"0\" border=\"0\">\n";
- RuleHead += "<colgroup>\n";
- RuleHead += "<col class=\"col-area\">\n";
- RuleHead += "<col class=\"col-start\">\n";
- RuleHead += "<col class=\"col-postage\">\n";
- RuleHead += "<col class=\"col-plus\">\n";
- RuleHead += "<col class=\"col-postageplus\">\n";
- RuleHead += "<col class=\"col-action\">\n";
- RuleHead += "<\/colgroup>\n";
- RuleHead += "<thead>\n";
- RuleHead += "<tr>\n";
- RuleHead += "<th>运送到<\/th>\n";
- RuleHead += "<th class=\"w60\">首重("+unit+")<\/th>\n";
- RuleHead += "<th class=\"w110\">首费(元)<\/th>\n";
- RuleHead += "<th class=\"w60\">续重("+unit+")<\/th>\n";
- RuleHead += "<th class=\"w110\">续费(元)<\/th>\n";
- RuleHead += "<th class=\"w110\">操作<\/th>\n";
- RuleHead += "<\/tr>\n";
- RuleHead += "<\/thead>\n";
- RuleHead += "<tbody>\n";
- RuleHead += "<\/tbody>\n";
- RuleHead += "<\/table>\n";
-
- RuleCell += "<tr class=\"bd-line\" data-group=\"nCurNum\">\n";
- RuleCell += "<td class=\"cell-area\">\n";
- RuleCell += "<span class=\"area-group\">\n";
- RuleCell += "<input class=\"J_BatchField\" style=\"width:15px; display:none\" type=\"checkbox\" value=\"\" name=\"TRANSTYPE_nCurNum\">\n";
- RuleCell += "<p style=\"display:inline-block\">未添加地区<\/p><\/span>\n";
- RuleCell += "<input type=\"hidden\" value=\"\" name=\"areas[TRANSTYPE][CurNum]\">\n";
- RuleCell += "<\/td>\n";
- RuleCell += "<td>\n";
- RuleCell += "<input class=\"text w30\" type=\"text\" aria-label=\"首重\" maxlength=\"4\" autocomplete=\"off\" value=\"1\" data-field=\"start\" name=\"special[TRANSTYPE][CurNum][start]\">\n";
- RuleCell += "<\/td>\n";
- RuleCell += "<td>\n";
- RuleCell += "<input class=\"text w60\" type=\"text\" aria-label=\"首费\" maxlength=\"6\" autocomplete=\"off\" value=\"\" data-field=\"postage\" name=\"special[TRANSTYPE][CurNum][postage]\"><em class=\"add-on\">\n";
- RuleCell += "<i class=\"icon-renminbi\"><\/i>\n";
- RuleCell += "<\/em>\n";
- RuleCell += "<\/td>\n";
- RuleCell += "<td>\n";
- RuleCell += "<input class=\"text w30\" type=\"text\" aria-label=\"续重\" maxlength=\"4\" autocomplete=\"off\" value=\"1\" data-field=\"plus\" name=\"special[TRANSTYPE][CurNum][plus]\">\n";
- RuleCell += "<\/td>\n";
- RuleCell += "<td>\n";
- RuleCell += "<input class=\"text w60\" type=\"text\" aria-label=\"续费\" maxlength=\"6\" autocomplete=\"off\" value=\"\" data-field=\"postageplus\" name=\"special[TRANSTYPE][CurNum][postageplus]\"><em class=\"add-on\">\n";
- RuleCell += "<i class=\"icon-renminbi\"><\/i>\n";
- RuleCell += "<\/em>\n";
- RuleCell += "<\/td>\n";
- RuleCell += "<td class=\"nscs-table-handle\">\n";
- RuleCell += "<span>\n";
- RuleCell += "<a class=\"btn-red J_DeleteRule\" ncNum=\"nCurNum\" href=\"JavaScript:void(0);\">\n";
- RuleCell += "<i class=\"icon-trash\"><\/i><p>删除<\/p>\n";
- RuleCell += "<\/a>\n";
- RuleCell += "<\/span>\n";
- RuleCell += "<span>\n";
- RuleCell += "<a class=\"btn-blue\" data-group=\"nCurNum\" title=\"编辑运送区域\" area-haspopup=\"true\" area-controls=\"J_DialogArea\" entype=\'J_EditArea\' data-acc=\"event:enter\" href=\"JavaScript:void(0);\">\n";
- RuleCell += "<i class=\"icon-edit\"><\/i><p>编辑<\/p>\n";
- RuleCell += "<\/a>\n";
- RuleCell += "<\/span>\n";
- RuleCell += "<\/td>\n";
- RuleCell += "<\/tr>\n";
-
- var curDelNum;
-
- $('.trans-line').on('click','.J_AddRule',function(){
- StartNum +=1;
- if ($(this).parent().parent().find('.tbl-except').html().replace("\n",'') == ''){
- $(this).parent().parent().find('.tbl-except').append(RuleHead);
- }
- cell = RuleCell.replace(/CurNum/g,StartNum);
- cell = cell.replace(/TRANSTYPE/g,$(this).parent().parent().parent().attr('data-delivery'));
- $(this).parent().parent().find('.tbl-except').find('table').append(cell);
-
- if ($(this).parent().parent().find('input[type="checkbox"]').css('display') == 'none'){
- $(this).next().css('display','').html('批量操作');
- }else{
- $(this).next().css('display','').html('取消批量');
- $(this).parent().parent().find('.tbl-except').find('.J_BatchField:last').css('display','');
- }
- });
- jQuery.fn.toInt = function() {
- var s = parseInt(jQuery(this).val().replace( /^0*/,''));
- return isNaN(s) ? 0 : s;
- };
- $('#dialog_areas').on('click','.ks-ext-close',function(){
- $("#dialog_areas").css('display','none');
- $("#dialog_batch").css('display','none');
- $('.ks-ext-mask').css('display','none');
- return false;
- });
- $('#dialog_batch').on('click','.ks-ext-close',function(){
- $("#dialog_areas").css('display','none');
- $("#dialog_batch").css('display','none');
- $('.ks-ext-mask').css('display','none');
- return false;
- });
- $('#dialog_areas').on('click','.J_Cancel',function(){
- $("#dialog_areas").css('display','none');
- $("#dialog_batch").css('display','none');
- $('.ks-ext-mask').css('display','none');
- });
- $('#dialog_batch').on('click','.J_Cancel',function(){
- $("#dialog_areas").css('display','none');
- $("#dialog_batch").css('display','none');
- $('.ks-ext-mask').css('display','none');
- });
- $('#dialog_areas').on('click','.J_Submit',function (){
- var CityText = '', CityText2 = '', CityValue = '';
-
-
-
- $('#J_CityList').find('.ncsc-province-tab').each(function(){
- var a = $(this).find('input[type="checkbox"]').size();
- var b = $(this).find('input:checked').size();
-
- if (a == b){
- CityText += ($(this).find('.J_Province').next().html())+',';
- }else{
-
- $(this).find('.J_City').each(function(){
-
- if ($(this).attr('checked')){
- CityText2 += ($(this).next().html())+',';
- }
- });
- }
- });
- CityText += CityText2;
-
- $('#J_CityList').find('.ncsc-province-list').find('input[type="checkbox"]').each(function(){
- if ($(this).attr('checked')){
- CityValue += $(this).val()+',';
- }
- });
-
- CityText = CityText.replace(/(,*$)/g,'');
- CityValue = CityValue.replace(/(,*$)/g,'');
-
- if (CityText == '')CityText = '未添加地区';
- $(objCurlArea).find('.area-group>p').html(CityText);
-
- $('input[name="areas['+curTransType+']['+curIndex.substring(1)+']"]').val(CityValue+'|||'+CityText);
-
- $("#dialog_areas").css('display','none');
- $('.ks-ext-mask').css('display','none');
-
- $(".check_num").html('');
- $('#J_CityList').find('input[type="checkbox"]').attr('checked',false);
-
- isRemove = true;
- $('div[data-delivery="'+curTransType+'"]').find('input[type="hidden"]').each(function(){
- if ($(this).val()==''){
- isRemove = false;return false;
- }
- });
- if (isRemove == true){
- $('div[data-delivery="'+curTransType+'"]').find('span[error_type="area"]').css('display','none');
- }
- });
- $('#dialog_areas').on('click','.J_Province',function(){
- if ($(this).attr('checked')){
-
- $(this).parent().find('.ncsc-citys-sub').eq(0).find('input[type="checkbox"]').each(function(){
- if (!$(this).attr('disabled')){
- $(this).attr('checked',true);
- }else{
- $(this).attr('checked',false);
- }
- });
-
- num = '('+$(this).parent().find('.ncsc-citys-sub').eq(0).find('input:checked').size()+')';
- if (num == '(0)') num = '';
- $(this).parent().parent().find(".check_num").eq(0).html(num);
-
- input_checked = $(this).parent().parent().parent().find('input:checked').size();
- input_all = $(this).parent().parent().parent().find('input[type="checkbox"]').size();
- if (input_all == input_checked){
- $(this).parent().parent().parent().parent().find('.J_Group').attr('checked',true);
- }
- }else{
-
- $(this).parent().parent().find(".check_num").eq(0).html('');
- $(this).parent().find('.ncsc-citys-sub').eq(0).find('input[type="checkbox"]').attr('checked',false);
-
- $(this).parent().parent().parent().parent().find('.J_Group').attr('checked',false);
- }
- });
- $('#dialog_areas').on('click','.J_Group',function(){
- if ($(this).attr('checked')){
-
- $(this).parent().parent().parent().find('input[type="checkbox"]').each(function(){
- if (!$(this).attr('disabled')){
- $(this).attr('checked',true);
- }else{
- $(this).attr('checked',false);
- }
- });
-
- $(this).parent().parent().parent().find('.ncsc-province-list').find('.ncsc-province').each(function(){
-
- num = '('+$(this).find('.ncsc-citys-sub').find('input:checked').size()+')';
-
- if (num != '(0)'){
- $(this).find(".check_num").html(num);
- }
- });
- }else{
-
- $(this).parent().parent().parent().find('input[type="checkbox"]').attr('checked',false);
-
- $(this).parent().parent().parent().find('.ncsc-province-list').find('.ncsc-province').each(function(){
- $(this).find(".check_num").html('');
- });
- }
- });
- $('#dialog_areas').on('click','.close_button',function(){
- $(this).parent().parent().parent().parent().removeClass('showCityPop');
- });
- $('#dialog_areas').on('click','.J_City',function(){
-
- num = '('+$(this).parent().parent().find('input:checked').size()+')';
- if (num=='(0)')num='';
- $(this).parent().parent().parent().find(".check_num").eq(0).html(num);
-
- if (!$(this).attr('checked')){
-
- $(this).parent().parent().parent().find('.J_Province').attr('checked',false);
-
- $(this).parent().parent().parent().parent().parent().parent().find('.J_Group').attr('checked',false);
- }else{
-
- input_checked = $(this).parent().parent().find('input:checked').size();
- input_all = $(this).parent().parent().find('input[type="checkbox"]').size();
- if (input_all == input_checked){
- $(this).parent().parent().parent().find('.J_Province').attr('checked',true);
- }
-
- input_checked = $(this).parent().parent().parent().parent().parent().find('input:checked').size();
- input_all = $(this).parent().parent().parent().parent().parent().find('input[type="checkbox"]').size();
- if (input_all == input_checked){
- $(this).parent().parent().parent().parent().parent().parent().find('.J_Group').attr('checked',true);
- }
- }
- });
-
- $('#dialog_areas').on('click','.trigger',function () {
- objTrigger = this;objHead = $(this).parent();objPanel = $(this).next();
- if ($(this).next().css('display') == 'none'){
-
- $('.ks-contentbox').find('.ncsc-province').removeClass('showCityPop');
- $(this).parent().parent().addClass('showCityPop');
- }else{
-
- $(this).parent().parent().removeClass('showCityPop');
- }
-
- var oHandle = $(this);
- var de = document.documentElement?document.documentElement : document.body;
- de.onclick = function(e){
- var e = e || window.event;
- var target = e.target || e.srcElement;
- var getTar = target.getAttribute("id");
- while(target){
-
- try{
-
- if(target==$(objHead)[0])return true;
- if(target==$(objPanel)[0])return true;
-
- }catch(ex){};
- target = target.parentNode;
- }
- $(objTrigger).parent().parent().removeClass('showCityPop');
- }
- });
-
- $('.trans-line').on('click','a[entype="J_EditArea"]',function () {
- curTransType = 'kd';
-
- $('#J_CityList').find('input[type="checkbox"]').attr('checked',false).attr('disabled',false);
-
- $('#J_CityList').find('.check_num').html('');
-
- curIndex = $(this).attr('data-group');
-
- objCurlArea = $('tr[data-group="'+curIndex+'"]').children(1);
-
- SelectArea = new Array();
-
- var expAreas = $('input[name="areas['+curTransType+']['+curIndex.substring(1)+']"]').val();
- expAreas = expAreas.split('|||');
- expAreas = expAreas[0].split(',');
- try{
- if(expAreas[0] != ''){
- for(var v in expAreas){
- SelectArea[expAreas[v]] = true;
- }
- }
-
- $('#J_CityList').find('.ncsc-province').each(function(){
- var count = 0;
- $(this).find('input[type="checkbox"]').each(function(){
- if(SelectArea[$(this).val()]==true){
- $(this).attr('checked',true);
- if($(this)[0].className!='J_Province') count++;
- }
- });
- if (count > 0){
- $(this).find('.check_num').html('('+count+')');
- }
-
- });
-
- $('#J_CityList>li').each(function(){
- $(this).find('.J_Group').attr('checked',true);
- father = this;
- $(this).find('.J_Province').each(function(){
- if (!$(this).attr('checked')){
- $(father).find('.J_Group').attr('checked',false);
- return ;
- }
- });
- });
- }catch(ex){}
-
- $(objCurlArea).parent().parent().find('.area-group').each(function(){
- if ($(this).next().attr('name') != 'areas['+curTransType+']['+curIndex.substring(1)+']'){
- expAreas = $(this).next().val().split('|||');
- expAreas = expAreas[0].split(',');
-
- SelectArea = new Array();
- try{
- if(expAreas[0] != ''){
- for(var v in expAreas){
- SelectArea[expAreas[v]] = true;
- }
- }
-
- $('#J_CityList').find('input[type="checkbox"]').each(function(){
- if(SelectArea[$(this).val()]==true){
- $(this).attr('disabled',true).attr('checked',false);
- }
- });
-
- $('#J_CityList>li').each(function(){
- $(this).find('.J_Group').attr('disabled',true);
- father = this;
- $(this).find('.J_Province').each(function(){
- if (!$(this).attr('disabled')){
- $(father).find('.J_Group').attr('disabled',false);
- return ;
- }
- });
- });
- }catch(ex){}
- }
- });
-
- var pos = $(this).position();
- $("#dialog_areas").css({'position' : 'fixed','display' : 'block', 'z-index' : '9999'});
- $('.ks-ext-mask').css('display','block');
-
- });
- $('#title').blur(function(){
- if ($(this).val() !=''){
- $('p[error_type="title"]').css('display','none');
- }
- });
-
- $('.trans-line').on('blur','input[data-field="postage"]',function (){
- var oNum = new Number($(this).val());
- oNum = oNum.toFixed(2);
- if (oNum > 999.99) oNum = 999.99;
- if (oNum=='NaN') oNum = '0.00';
- $(this).val(oNum);
- if($(this)[0].className=='w50 mr5 text input-error') $(this).removeClass('input-error');
- if($(this)[0].className=='w50 ml5 mr5 text input-error') $(this).removeClass('input-error');
-
- if($(this).parent()[0].className=='default J_DefaultSet'){
-
- $(this).parent().find('.J_DefaultMessage').find('span[error_type="postage"]').css('display','none');
- }else{
-
- isRemove = true;
- $(this).parent().parent().parent().find('input[data-field="postage"]').each(function(){
- if ($(this).val()==''){
- isRemove = false;return false;
- }
- });
-
- if (isRemove == true){
- $(this).parent().parent().parent().parent().parent().parent().find('.tbl-attach').find('.J_SpecialMessage').find('span[error_type="postage"]').css('display','none');
- }
- }
- });
-
- $('.trans-line').on('blur','input[data-field="postageplus"]',function (){
- var oNum = new Number($(this).val());
- oNum = oNum.toFixed(2);
- if (oNum > 999.99) oNum = 999.99;
- if (oNum=='NaN') oNum = '0.00';
- $(this).val(oNum);
- if($(this)[0].className=='w50 mr5 text input-error') $(this).removeClass('input-error');
- if($(this)[0].className=='w50 ml5 mr5 text input-error') $(this).removeClass('input-error');
- if($(this).parent()[0].className=='default J_DefaultSet'){
-
- $(this).parent().find('.J_DefaultMessage').find('span[error_type="postageplus"]').css('display','none');
- }else{
-
- isRemove = true;
- $(this).parent().parent().parent().find('input[data-field="postageplus"]').each(function(){
- if ($(this).val()==''){
- isRemove = false;return false;
- }
- });
-
- if (isRemove == true){
- $(this).parent().parent().parent().parent().parent().parent().find('.tbl-attach').find('.J_SpecialMessage').find('span[error_type="postageplus"]').css('display','none');
- }
- }
- });
-
- $('.trans-line').on('blur','input[data-field="plus"]',function (){
- if ($(this).val() != ''){
- $(this).val($(this).toInt());
- }else{
- $(this).val(1);
- }
- });
-
-
- $('.trans-line').on('blur','input[data-field="start"]',function (){
- if ($(this).val() != ''){
- $(this).val($(this).toInt());
- }else{
- $(this).val(1);
- }
- });
-
- $('.trans-line').on('click','.J_DeleteRule',function (){
- curDelNum = $(this).attr('ncNum');
- showDialog('确认删除吗?', 'confirm','', function(){
- curTransType = 'kd';
- obj_parent = $('tr[data-group="'+curDelNum+'"]').parent();
- $('tr[data-group="'+curDelNum+'"]').remove();
- if ($(obj_parent).find('tr').html() == null){
- $(obj_parent).parent().parent().parent().find('.batch').css('display','none');
- $(obj_parent).parent().parent().parent().find('.J_ToggleBatch').css('display','none');
- $(obj_parent).parent().parent().parent().find('.batch').next().find('span').css('display','none');
- }else{
-
- isRemove = true;
- $('div[data-delivery="'+curTransType+'"]').find('input[type="hidden"]').each(function(){
- if ($(this).val()==''){
- isRemove = false;return false;
- }
- });
- if (isRemove == true){
- $('div[data-delivery="'+curTransType+'"]').find('span[error_type="area"]').css('display','none');
- }
- }
- });
- });
-
- $('.trans-line').on('click','.J_ToggleBatch',function(){
- if ($(this).parent().parent().find('.J_BatchField').eq(0).css('display')=='none'){
- $(this).parent().parent().find('.batch').css('display','');
- $(this).parent().parent().find('.batch').find('.J_BatchCheck').attr('checked',false);
- $(this).parent().parent().find('.J_BatchField').css('display','');
- $(this).html('取消批量');
- }else{
- $(this).parent().parent().find('.batch').css('display','none');
- $(this).parent().parent().find('.J_BatchField').css('display','none');
- $(this).html('批量操作');
- }
- });
-
-
- $('.trans-line').on('click','.J_BatchField',function(){
- if (!$(this).attr('checked')){
- obj_parent = $(this).parent().parent().parent().parent().parent().parent().parent();
- $(obj_parent).find('.J_BatchCheck').attr('checked',false);
- }else{
- obj_tbody = $(this).parent().parent().parent().parent();
- checkbox_count = $(obj_tbody).find('.J_BatchField').size();
- checked_count = $(obj_tbody).find('input:checked').size();
- if (checkbox_count == checked_count){
- obj_parent = $(this).parent().parent().parent().parent().parent().parent().parent();
- $(obj_parent).find('.J_BatchCheck').attr('checked',true);
- }
- }
- });
-
-
- $('.trans-line').on('click','.J_BatchCheck',function(){
- $('.J_BatchField').attr('checked',$(this).attr('checked') == 'checked' ? 'checked' : false);
- });
-
- $('.trans-line').on('click','.J_BatchSet',function(){
- if($('.tbl-except').find('input:checked').size()==0){
- showDialog('请选择要批量设置的地区', 'error','','','','','','','','',2);return false;
- }
-
-
- var pos = $(this).position();
- var pos_x = pos.left-20;
- var pos_y = pos.top+20;
- $("#dialog_batch").css({'position' : 'fixed','display' : 'block', 'z-index' : '9999'});
- $('.ks-ext-mask').css('display','block');
- });
-
-
- $('.trans-line').on('click','.J_BatchDel',function(){
- if($(this).parent().parent().find('.tbl-except').find('input:checked').size()==0){
- showDialog('请选择要批量处理的地区', 'error','','','','','','','','',2);return false;
- }
- showDialog('确认删除吗?', 'confirm','', function(){
- $('tr[class="bd-line"]').each(function(){
- if ($(this).find('.J_BatchField').attr('checked')){
- $(this).remove();
- }
- });
- if ($('.tbl-except').find('table>tbody>tr').length == 0){
- $('.entity').find('.batch').css('display','none');
- $('.J_ToggleBatch').css('display','none');
- $('.entity').find('.batch').next().find('span').css('display','none');
- }else{
- curTransType = 'kd';
-
- isRemove = true;
- $('div[data-delivery="'+curTransType+'"]').find('input[type="hidden"]').each(function(){
- if ($(this).val()==''){
- isRemove = false;return false;
- }
- });
- if (isRemove == true){
- $('div[data-delivery="'+curTransType+'"]').find('span[error_type="area"]').css('display','none');
- }
- }
- });
- });
-
-
- $('#dialog_batch').on('click','.J_SubmitPL',function(){
- var obj_this = $(this).parent().parent();
- $('.tbl-except>table>tbody>tr').each(function(){
- if ($(this).find('.J_BatchField').attr('checked')){
- $(this).find('input[data-field="start"]').val($(obj_this).find('input[data-field="start"]').val()).removeClass('input-error');
- $(this).find('input[data-field="postage"]').val($(obj_this).find('input[data-field="postage"]').val()).removeClass('input-error');
- $(this).find('input[data-field="plus"]').val($(obj_this).find('input[data-field="plus"]').val()).removeClass('input-error');
- $(this).find('input[data-field="postageplus"]').val($(obj_this).find('input[data-field="postageplus"]').val()).removeClass('input-error');
- }
- });
- $("#dialog_batch").css('display','none');
- $('.ks-ext-mask').css('display','none');
- });
-
-
- $('#submit_tpl').on('click',function(){
- $('.J_SpecialMessage').html(SpecialMessage);
- $('.J_DefaultSet').find('.J_DefaultMessage').html(DefaultMessage);
- isSubmit = true;
-
-
- father = $('.entity');
-
- var obj = $('.entity').find('.J_DefaultSet').find('input[data-field="postage"]');
- if(!$(obj).val()){
- isShowError = false;
- if($(obj).val()==''){
- $(obj).addClass('input-error'); isShowError = true; isSubmit = false;
- }else{
- $(obj).removeClass('input-error');
- }
- if (isShowError){
- $('.entity').find('.J_DefaultSet').find('span[error_type="postage"]').show();
- }
- }
-
-
- var obj = $('.entity').find('.J_DefaultSet').find('input[data-field="postageplus"]');
- if(!$(obj).val()){
- isShowError = false;
- if($(obj).val()==''){
- $(obj).addClass('input-error'); isShowError = true; isSubmit = false;
- }else{
- $(obj).removeClass('input-error');
- }
- if (isShowError){
- $('.entity').find('.J_DefaultSet').find('span[error_type="postageplus"]').show();
- }
- }
-
-
- if($('.tbl-except').find('.cell-area').html() != null){
- isShowError = false;
- $('.tbl-except').find('tbody>tr').each(function(){
- if($(this).find('input[type="hidden"]').val()==''){
- isShowError = true; isSubmit = false; return false;
- }
- });
- if (isShowError){
- $(father).find('.tbl-attach').find('span[error_type="area"]').css('display','');
- }
- }
-
-
- if($('.tbl-except').find('.cell-area').html() != null){
- isShowError = false;
- $('.tbl-except').find('input[data-field="postage"]').each(function(){
- if ($(this).val()==''){
- $(this).addClass('input-error');isShowError = true; isSubmit = false;
- }
- });
- if (isShowError){
- $('.tbl-attach').find('span[error_type="postage"]').show();
- }
- }
-
-
- if($('.tbl-except').find('.cell-area').html() != null){
- isShowError = false;
- $('.tbl-except').find('input[data-field="postageplus"]').each(function(){
- if ($(this).val()==''){
- $(this).addClass('input-error'); isShowError = true; isSubmit = false;
- }
- });
- if (isShowError){
- $('.tbl-attach').find('span[error_type="postageplus"]').css('display','');
- }
- }
-
- if ($('#title').val()==''){
- isSubmit = false;
- $('p[error_type="title"]').css('display','');
- }else{
- $('p[error_type="title"]').css('display','none');
- }
-
- i=0;
- $('input[name="tplType[]"]').each(function(){
- if (!$(this).attr('checked')){
- i++;
- }
- });
- if (i==3){
- isSubmit = false;
- $('p[error_type="trans_type"]').css('display','');
- }
- if (isSubmit == true){
- return true;
- }else{
- return false;
- }
- });
- });
|