6 Star Table Tennis Racket 2PCS Professional Ping Pong Racket Set Pimples-in Rubber Hight Quality Blade Bat Paddle with Bag
Item: 2Pcs Table Tennis Racket / Bat / Paddle Set
2 Types:
Long Handle / Horizontal Grip / Shakehand Grip Type
Short Handle / Straight Grip / Penhold Type
Blade: 5 Layer Wenge Wood + 2 Layer Carbon Fiber
Rubber: Double Face Pimples-in Type Hard Rubber + High Energy Sponge.
Packing: 2Pcs Table Tennis Racket with Bag
'; skuObjList.map(function(item,index){ myhtml+='
'; }); myhtml+='
'; $('#popSkuCon').length>0&&$('.showSweetAlert #popSkuCon').remove(); $('.showSweetAlert .pop2Smt .popContent').prepend(myhtml); } //选择sku的全选按钮事件 $('body').on('click','#popSkuCon label',function(e){ var tarObj=$(e.target); if (tarObj.is('input')) { if (tarObj.parent().parent().is('p')) { if (tarObj.parent().hasClass('all')) { //全选 var childInput=tarObj.closest('div').siblings().find('input'); tarObj.is(':checked')?childInput.prop('checked','checked'):childInput.removeAttr('checked'); } else { //子类型全选 var childInput=tarObj.closest('div').find('ul input'); tarObj.is(':checked')?childInput.prop('checked','checked'):childInput.removeAttr('checked'); } } if (!tarObj.is(':checked')) { tarObj.closest('#popSkuCon').children("div").eq(0).find("input").removeAttr("checked"); if (tarObj.parent().parent().is("li")) { tarObj.closest('ul').siblings("p").find("input").removeAttr("checked"); } } } }); //选择区域定价国家的全选按钮事件 $('body').on('click','#popCountry label',function(e){ var tarObj=$(e.target); if (tarObj.is('input')) { if (tarObj.parent().hasClass('all')) { //全选 var childInput=tarObj.closest('div').find('ul').find('input'); tarObj.is(':checked')?childInput.prop('checked','checked'):childInput.removeAttr('checked'); } if (!tarObj.is(':checked')) { tarObj.closest('div').children("p").find("input").removeAttr("checked"); } } }); function getSelectSkus(){ // 获取弾层中所有选择的SKU var selectSkulist=[]; if ($('.showSweetAlert #popSkuCon > div').eq(0).find("input").is(':checked')) { return selectSkulist; } $('.showSweetAlert #popSkuCon > div').map(function(index,item){ if(index>0){ var skulist=[];//速卖通原始名称,用于填充定价 var skuNameList=[];//重命名后的名称,用于保持产品 $(item).find('li').map(function(index2,item2){ if($(item2).find('input').is(':checked')){ var itemValue = $(item2).find('input').val(); skulist.push(itemValue.replace("@", "\"")); skuNameList.push($(item2).text()); } }); selectSkulist.push({ title:$(item).find('p label').text(), skulist:skulist, skuNameList:skuNameList }); } }); return selectSkulist; } $('body').on('click','#btnpop2cancel,#pop2cancelSmt',function(){ $('.showSweetAlert .pop2con,.showSweetAlert .pop2freeNotice,.showSweetAlert .pop2Smt,.showSweetAlert .colorNotice,.showSweetAlert .pop2overlay').hide(); }); $('body').on('click','#btnpop2ok',function(e){ hideHint(); if($(e.target).attr('data-type')!='error'){ // 如果成功,就关闭顶级弾层 $('.showSweetAlert').hide(); $('.sweet-overlay').hide(); var currentUrl = location.href; if (currentUrl.indexOf("mangoerp.com") > -1) { $('body').attr('class','no-skin modal-open'); } else { $('body').attr('class','aside-expanded-true pace-done'); } } }); function showHint(type, msg) { if (type == "error") $('.showSweetAlert .pop2Hint .sa-error').show(); else $('.showSweetAlert .pop2Hint .sa-success').show(); $('.showSweetAlert .pop2Hint p').html(msg); $('.showSweetAlert .pop2Hint,.showSweetAlert .pop2overlay').show(); if (type == "sync") { type = "error"; //为了同步模板下拉框成功后,不关闭计算器弹框 } $('.showSweetAlert .pop2Hint #btnpop2ok').attr('data-type',type); } function hideHint() { $('.showSweetAlert .pop2Hint .sa-error').hide(); $('.showSweetAlert .pop2Hint .sa-success').hide(); $('.showSweetAlert .pop2Hint,.showSweetAlert .pop2overlay').hide(); $('.showSweetAlert .pop2con,.showSweetAlert .pop2Smt,.showSweetAlert .pop2overlay').hide(); } //下拉框切换运费模板事件 $('body').on('change', '#selectRegionPercentTemplate', function () { var templateId = $(this).children('option:selected').val(); if (templateId == "") { for (var i = 2; i < tableRowSize; i++) { percentSheet.setRowData(i, ["","","","","","","","","","","","","","","","",""]); } return; } var param={ method:'ajax', params: { url: domain + '/seller/getTeamplateById?templateId=' + templateId, xhrFields: {withCredentials: true} } }; chrome.runtime.sendMessage(param,function(t){ ($('.showSweetAlert #percentSheet')[0]).jexcel = null; $('.showSweetAlert #percentSheet').html(""); percentSheet = jexcel($('.showSweetAlert #percentSheet')[0], regionOptions(regionDataPercen)); if (!t.message && t.result) { //初始化海外仓下拉框 initOverseasCountries(t.result, percentSheet); logisticsDiscount = t.result.logisticsDiscount; var template = JSON.parse(t.result.data); template.type = t.result.templateType; template.shippingCountry = "CN"; template.volumeSize = t.result.volumeSize; templateData = template; initOptions(template); jisuan(template.fee ? template.fee : "0"); $($('.showSweetAlert #nav span')[0]).click(); //当有体积时,显示体积table if (templateData.volumeSize) { var threeSide = templateData.volumeSize.split("x"); $(".showSweetAlert #txtLength").val(threeSide[0]); $(".showSweetAlert #txtWidth").val(threeSide[1]); $(".showSweetAlert #txtHeight").val(threeSide[2]); $(".showSweetAlert #divVolumeSize").css("display", "flex"); } else { $(".showSweetAlert #divVolumeSize").hide(); } //只有有包邮国家时才需要初始化两个table if (template.fee) { $('.showSweetAlert #nav').show(); initDataTable(template); } else { $('.showSweetAlert #nav').hide(); } hotCountries = sortCountrys(template.countrys); for (var j = 0; j < (tableRowSize - 2); j++) { var rowData = createLogistis(j + 3,"percent", "CN"); percentSheet.setRowData(j + 2, rowData); } //执行无忧集运判断逻辑 consolidationFunction(); //区域零售价红色自动纠正 autoCorrectLowestPrice(); //计算折扣上限 resetDiscountLimit(); //不符合网规时标黄 changeValueYellow(); } else { swal("", t.message, "error"); } }); }); //product_save button 定价计算器上的产品管理保存按钮 window.isGetRetailOK = false;//标记零售价是否获取完成 window.isGetRegionOK = false;//标记区域定价是否获取完成 function saveProduct() { $("#saveProductBtn").prop("disabled", true); var currentUrls = location.search ? location.search.substr(1) : ""; if (currentUrls) { $('.sweetAlert').removeClass('zndjpop').removeClass('qydjlre').removeClass('qydjlrl').removeClass('diy100'); var baseSkuDatas = $("input[name='baseSkuDatas']"); if (baseSkuDatas.length == 0) { $("#saveProductBtn").prop("disabled", false); swal({ title: "", text: "只有点击定价计算器里的填充定价按钮后才能使用此功能,请先点击定价计算器里的填充定价按钮!", type: "error", customClass: "sweetAlertNormal", allowOutsideClick: true }); return; } var productId = ""; var queryParams = currentUrls.split('&'); for (var idi = 0; idi < queryParams.length; idi++) { var arr = queryParams[idi].split("="); if (arr[0] == "productId" || arr[0] == "switchId" || arr[0] == "draftId") { productId = arr[1]; break; } } var title = $("#struct-content #base-card #struct-title #title").val(); var uploader = $("#struct-content #base-card #struct-mainImage .info-content .image-upload-wrap .image-uploader"); var imgUrl = ""; if (uploader.length > 0) { var imgs = $(uploader[0]).find(".sell-o-image-item-preview img"); if (imgs.length > 0) { for (var ii = 0; ii < imgs.length; ii++) { var src = $(imgs[ii]).attr("src"); if (src.indexOf("http") == 0 && src.indexOf("XXXX") == -1) { imgUrl = src; break; } } } } var skuPrices = []; var skuNamesSet = []; //零售价 // 每次填充价格前,一定要把滚动条回到顶部 var prictmainobj = $("table.sell-sku-inner-table.sell-sku-body-table").eq(0); var scrollobj=prictmainobj.closest('.ver-scroll-wrap'); scrollobj.animate({ scrollTop: "0" }, 0,function(){ setTimeout(function(){ getRetailPrice(skuPrices, skuNamesSet); },200) }); // 区域定价 // 每次填充价格前,一定要把滚动条回到顶部 // 记住:这里滑动到顶部,只在最开始执行一次 var regionPrices = {}; var skutableobj = $("table.sell-sku-inner-table.sell-sku-body-table").eq(1); if (skutableobj.find('tr').length > 0) { var regionTimer = setInterval(function () { if (window.isGetRetailOK) { clearInterval(regionTimer); var regionscrollobj = skutableobj.closest('.ver-scroll-wrap'); regionscrollobj.animate({ scrollTop: "0" }, 0,function(){ setTimeout(function(){ getRegionPrice(regionPrices) },200) }); } }, 100); } else { window.isGetRegionOK = true; } var timer = setInterval(function () { if (window.isGetRetailOK && window.isGetRegionOK) { clearInterval(timer); window.isGetRetailOK = false; window.isGetRegionOK = false; if (JSON.stringify(regionPrices) != "{}") { for (var skuI = 0; skuI < skuPrices.length; skuI++) { if (regionPrices[skuPrices[skuI]["skuName"]]){ skuPrices[skuI]["regionPrices"] = regionPrices[skuPrices[skuI]["skuName"]]; } } } var product = {"aeId":productId, "title":title, "imgUrl":imgUrl, "skus":skuPrices}; //补充成本,重量,运费模板等信息 for (var m = 0; m < baseSkuDatas.length; m++) { var baseData = JSON.parse($(baseSkuDatas[m]).val()); var selectSkus = baseData.selectSkus; var weightStr = Number(baseData.weight).toFixed(0); if (selectSkus && selectSkus.length > 0) { for (var j = 0; j < skuPrices.length; j++) { var skuNameList = skuPrices[j]["skuNameList"]; if (skuNameList.length == selectSkus.length) { var tempFlag = true; for (var n = 0; n < selectSkus.length; n++) { var tempSkus = selectSkus[n]["skuNameList"]; var skuName = skuNameList[n]; if (tempSkus && tempSkus.length > 0 && tempSkus.indexOf(skuName) == -1) { tempFlag = false; break; } } if (tempFlag) { skuPrices[j]["cost"] = baseData.cost; skuPrices[j]["weight"] = weightStr; } } else { skuPrices[j]["cost"] = baseData.cost; skuPrices[j]["weight"] = weightStr; } } } else { for (var o = 0; o < skuPrices.length; o++) { skuPrices[o]["cost"] = baseData.cost; skuPrices[o]["weight"] = weightStr; } } if (baseData.templateName) { product.templateName = baseData.templateName; } if (baseData.serviceRate) { product.serviceRate = baseData.serviceRate; } if (baseData.wreckRate) { product.wreckRate = baseData.wreckRate; } if (baseData.discountRate) { product.discountRate = baseData.discountRate; } } var param={ method:'ajax', params: { url: domain + '/seller/product/saveProduct', data: JSON.stringify(product), type: "POST", contentType: "application/json", xhrFields: {withCredentials: true} } }; chrome.runtime.sendMessage(param, function(response) { $('.showSweetAlert').removeClass("aezsmain"); if (response.status == "FAIL" || response.message) { swal({ title: "", text: response.message, type: "error", customClass: "sweetAlertNormal", allowOutsideClick: true }, function () { $("div[data-custom-class='sweetAlertNormal']").remove(); }); } else { swal({ title: "", text: "保存成功", type: "success", customClass: "sweetAlertNormal", allowOutsideClick: true }, function () { $("div[data-custom-class='sweetAlertNormal']").remove(); }); } $("#saveProductBtn").prop("disabled", false); }); } }, 100); } else { $("#saveProductBtn").prop("disabled", false); } } function saveProductDxm() { $("#saveProductBtn").prop("disabled", true); // $('.sweetAlert').removeClass('zndjpop').removeClass('qydjlre').removeClass('qydjlrl').removeClass('diy100'); var baseSkuDatas = $("input[name='baseSkuDatas']"); if (baseSkuDatas.length == 0) { $("#saveProductBtn").prop("disabled", false); swal({ title: "", text: "只有点击定价计算器里的填充定价按钮后才能使用此功能,请先点击定价计算器里的填充定价按钮!", type: "error", customClass: "sweetAlertNormal", allowOutsideClick: true }); return; } var productId = "temp" + new Date().getTime(); var title = $("#subject").val(); var imgEle = $("#img_show").find("img").first(); var imgUrl = ""; if (imgEle.length > 0) { imgUrl = imgEle.attr("src"); } var purchaseUrl = $("#sourceUrl11").val(); var skuPrices = []; //全球零售价 if ($("#skuVariantList tr[trcid]").length > 0) { $("#skuVariantList tr[trcid]").each(function () { var skuPrice = {}; skuPrice.originalPrice = $(this).find("input").first().val(); skuPrice.sku = $(this).find("input").last().val();//商品编码 var skuNames = []; $(this).find("td[data-names='property']").each(function (index, elem) { var property = $(elem).html(); if (property.indexOf("(") > -1 && property.indexOf(")") > -1) { skuNames.push(property.match(/\(.+\)/g)[0].replace(/\(|\)/g, "")); } else { skuNames.push(property); } }); skuPrice.skuName = skuNames.join("-"); skuPrice.skuNameList = skuNames.slice(); skuPrices.push(skuPrice); }); } else if ($("#retail #skuPrice:visible").length > 0) { var skuPrice = {}; skuPrice.originalPrice = $("#retail #skuPrice:visible").val(); skuPrice.sku = ""; skuPrice.skuName = ""; skuPrice.skuNameList = []; skuPrices.push(skuPrice); } // 区域定价 // 每次填充价格前,一定要把滚动条回到顶部 // 记住:这里滑动到顶部,只在最开始执行一次 var regionPrices = {}; var skuTrs = $("#setNationalProductPrice table tbody tr"); if (skuTrs.length > 0) { skuTrs.each(function () { var countriesTds = $(this).find("td[data-coun]"); if (countriesTds.length > 0) { var skuNames = []; $(this).find("td[cid]").each(function (index, elem) { var property = $(elem).html(); if (property.indexOf("(") > -1 && property.indexOf(")") > -1) { skuNames.push(property.match(/\(.+\)/g)[0].replace(/\(|\)/g, "")); } else { skuNames.push(property); } }); var nationalPrice = {}; countriesTds.each(function (index, elem) { var country =$(elem).attr("data-coun").toLowerCase(); nationalPrice[country == "id" ? "idd" : country] = $(elem).find("input").val(); }); regionPrices[skuNames.join("-")] = nationalPrice; } }); } if (JSON.stringify(regionPrices) != "{}") { for (var skuI = 0; skuI < skuPrices.length; skuI++) { if (regionPrices[skuPrices[skuI]["skuName"]]){ skuPrices[skuI]["regionPrices"] = regionPrices[skuPrices[skuI]["skuName"]]; } } } var product = {"aeId":productId, "title":title, "imgUrl":imgUrl, "skus":skuPrices,"purchaseUrl":purchaseUrl}; //补充成本,重量,运费模板等信息 for (var m = 0; m < baseSkuDatas.length; m++) { var baseData = JSON.parse($(baseSkuDatas[m]).val()); var selectSkus = baseData.selectSkus; var weightStr = Number(baseData.weight).toFixed(0); if (selectSkus && selectSkus.length > 0) { for (var j = 0; j < skuPrices.length; j++) { var skuNameList = skuPrices[j]["skuNameList"]; if (skuNameList.length == selectSkus.length) { var tempFlag = true; for (var n = 0; n < selectSkus.length; n++) { var tempSkus = selectSkus[n]["skuNameList"]; var skuName = skuNameList[n]; if (tempSkus && tempSkus.length > 0 && tempSkus.indexOf(skuName) == -1) { tempFlag = false; break; } } if (tempFlag) { skuPrices[j]["cost"] = baseData.cost; skuPrices[j]["weight"] = weightStr; } } else { skuPrices[j]["cost"] = baseData.cost; skuPrices[j]["weight"] = weightStr; } } } else { for (var o = 0; o < skuPrices.length; o++) { skuPrices[o]["cost"] = baseData.cost; skuPrices[o]["weight"] = weightStr; } } if (baseData.templateName) { product.templateName = baseData.templateName; } if (baseData.serviceRate) { product.serviceRate = baseData.serviceRate; } if (baseData.wreckRate) { product.wreckRate = baseData.wreckRate; } if (baseData.discountRate) { product.discountRate = baseData.discountRate; } } var param={ method:'ajax', params: { url: domain + '/seller/product/saveProduct', data: JSON.stringify(product), type: "POST", contentType: "application/json", xhrFields: {withCredentials: true} } }; chrome.runtime.sendMessage(param, function(response) { $('.showSweetAlert').removeClass("aezsmain"); if (response.status == "FAIL" || response.message) { swal({ title: "", text: response.message, type: "error", customClass: "sweetAlertNormal", allowOutsideClick: true }, function () { $("div[data-custom-class='sweetAlertNormal']").remove(); }); } else { swal({ title: "", text: "保存成功", type: "success", customClass: "sweetAlertNormal", allowOutsideClick: true }, function () { $("div[data-custom-class='sweetAlertNormal']").remove(); }); } $("#saveProductBtn").prop("disabled", false); }); } // function getCustomedColorMap() { // var colorMap = {}; // var colorDiv = $("#struct-saleProp>div>div").eq(0); // var label = colorDiv.children("div").eq(0).text(); // // var colorDiv = $("#struct-saleProp").children("div").eq(0); // // var label = colorDiv.children("div").eq(0).text(); // if (label == "颜色") { // var items = colorDiv.children("div").eq(1).find(".info-content").find(".item"); // for (var i = 0; i < items.length; i++) { // var colorSpans = $(items[i]).find(".posting-feild-color-item").children("span"); // var value = colorSpans.eq(0).find("em").text(); // var key = colorSpans.eq(1).find("input").val(); // if (key && key != "" && value && value != "") { // colorMap[key] = value; // } // } // } // return colorMap; // } function getRetailPrice(skuPrices, skuNamesSet) { var prictmainobj = $("table.sell-sku-inner-table.sell-sku-body-table").eq(0); var trs = prictmainobj.find("tr"); if (trs.length > 0) { var skuNames = []; for (var j = 0; j < trs.length; j++) { var tds = $(trs[j]).find("td"); var tdSpCount = $(trs[j]).find("td.col-skuPrice").index();//当前行shu属性数量.默认零售价前面的单元格均为属性 var skuPrice = {}; for (var k = 0; k < tds.length; k++) { if (k < tdSpCount) { if (j === 0) { if($(tds[k]).find("p").length>0) skuNames.push($(tds[k]).find("p").text()); else skuNames.push($(tds[k]).find(".ae-sku-cell-text-content").text()); } else { if($(tds[k]).find("p").length>0) skuNames.splice(skuNames.length - tdSpCount + k, 1, $(tds[k]).find("p").text()); else skuNames.splice(skuNames.length - tdSpCount + k, 1, $(tds[k]).find(".ae-sku-cell-text-content").text()); } } else { if (k === (tdSpCount)) { skuPrice.originalPrice = $(tds[k]).find("input").val(); } else if ($(tds[k]).find("input[name='skuOuterId']").length != 0) { skuPrice.sku = $(tds[k]).find("input[name='skuOuterId']").val(); } } } if (skuNamesSet.indexOf(skuNames.join("-")) == -1) { skuPrice.skuName = skuNames.join("-"); skuPrice.skuNameList = skuNames.slice(); skuPrices.push(skuPrice); skuNamesSet.push(skuPrice.skuName); } } } // 滚动到下一屏 var scrollobj = prictmainobj.closest('.ver-scroll-wrap'); if (scrollobj.scrollTop() + scrollobj.height() >= scrollobj[0].scrollHeight) { window.isGetRetailOK = true; return; } scrollobj.animate({ scrollTop: "+="+190 }, 0,function(){ setTimeout(function(){ getRetailPrice(skuPrices, skuNamesSet); },200); }); } function getRegionPrice(regionPrices) { var tables = $("table.sell-sku-inner-table.sell-sku-body-table").eq(1); var trs = tables.find("tr"); if (trs.length > 0) { var skuNames = []; var inputSize = $(trs[0]).find(".sell-sku-cell-money").length; for (var j = 0; j < trs.length; j++) { var tds = $(trs[j]).find("td"); var nationalPrice = {}; for (var k = 0; k < tds.length; k++) { if ($(tds[k]).hasClass("sell-sku-cell-money")) { var priceInput = $(tds[k]).find("input"); if (priceInput.length != 0) { var tdClass = $(tds[k]).attr("class").match(/col-price-\w{2}/); if (tdClass != null && tdClass.length > 0) { var country = tdClass[0].replace("col-price-","").toLowerCase(); nationalPrice[country == "id" ? "idd" : country] = priceInput.val(); } } } else { if (j == 0) { if($(tds[k]).find("p").length>0) skuNames.push($(tds[k]).find("p").text()); else skuNames.push($(tds[k]).find(".ae-sku-cell-text-content").text()); } else { if($(tds[k]).find("p").length>0) skuNames.splice(skuNames.length - (tds.length - inputSize) + k, 1, $(tds[k]).find("p").text()); else skuNames.splice(skuNames.length - (tds.length - inputSize) + k, 1, $(tds[k]).find(".ae-sku-cell-text-content").text()); } } } var skuName = skuNames.join("-"); regionPrices[skuName] = nationalPrice; } } // 滚动到下一屏 var scrollobj = tables.closest('.ver-scroll-wrap'); if (scrollobj.scrollTop() + scrollobj.height() >= scrollobj[0].scrollHeight) { window.isGetRegionOK = true; return; } scrollobj.animate({ scrollTop: "+="+190 }, 0,function(){ setTimeout(function(){ getRegionPrice(regionPrices); },200); }); } //红色和黄色代表什么意思? $("body").on("click", ".colorTip", function () { $('.showSweetAlert .colorNotice,.showSweetAlert .pop2overlay').show(); }); function convertPrice(exchangeRate, price) { if (exchangeRate <= 1=""> -1) { var shopId = $(this).children('option:selected').val(); if (shopId != "") { syncTemplates('?dxmId=' + shopId); } } else if (location.href.indexOf("mangoerp.com/erp") > -1) { var shopId = $(this).children('option:selected').attr("data-shopid"); if (shopId != "" && shopId != undefined) { syncTemplates('?wdtId=' + shopId); } } }); //------------------------旺店通监听店铺切换模块---------------------- $('body').on('click', '#shopCn .el-radio__label', function () { var shopId = $(this).parent().attr("data-shopcn"); if (shopId != "" && shopId != undefined) { syncTemplates('?wdtId=' + shopId); } }); //------------------------通途需授权模块---------------------- //监控通途发布产品页面店铺下拉框变更事件,刷新模板下拉框 $(function() { storeChange(); }); function storeChange(){ var currentVal=getStoreId(); setInterval(function() { var nowVal=getStoreId(); if(nowVal != currentVal && nowVal !== "") { syncTemplates('?ttId=' + nowVal); currentVal=nowVal; } },1000); } function getStoreId(){ return $("#baseInfoDiv .bg-title:contains('基本信息')").next().find('.left label:contains("Aliexpress店铺")') .siblings('span.textbox.combo').find('input[type=hidden].textbox-value').val(); } //------------------------通途需授权模块-------------------end //计算器页面同步按钮事件 $("body").on("click", ".syncTemplates", function () { if (chrome.runtime.getManifest().version < "1.1.4") { showHint("error", "此功能需要更新插件到1.1.4及以上版本才能使用.升级教程:https://www.yuque.com/helps/aeoptools/tquc69"); return; } var currentUrl = location.hostname; if (currentUrl.indexOf("mabangerp.com") > -1) { var value = $('input[name="shopId"]:checked').val(); if (value != "") { syncTemplates('?mbId=' + value); } } else if (currentUrl.indexOf("dianxiaomi.com") > -1) { var shopId = $('#shopId').children('option:selected').val(); if (shopId != "") { syncTemplates('?dxmId=' + shopId); } } else if (currentUrl.indexOf("tongtool.com") > -1) { $("#rootEle tr:first .pdtb5").each(function (i) { if ($(this).text().indexOf("Aliexpress店铺") > -1) { var shopId = $(this).find(".textbox-value").val(); if (shopId !== "") { syncTemplates('?ttId=' + shopId); } return false; } }); } else if (currentUrl.indexOf("qizhishangke.com") > -1) { var value = $("#shopCn").attr("data-cn"); if (value != "") { syncTemplates('?wdtId=' + value); } } else if (currentUrl.indexOf("mangoerp.com") > -1) { var shopId = $('#shopId').children('option:selected').attr("data-shopid"); if (shopId != "" && shopId != undefined) { syncTemplates('?wdtId=' + shopId); } } else if (currentUrl.indexOf("wxwerp.com") > -1 && currentUrl.indexOf("www.wxwerp.com") === -1 || window.hasOwnProperty('wxwIndDomain') && wxwIndDomain.indexOf(currentUrl) > -1) {//旺销王v3版本 var shopId = $('#v3-aliexpress-shop').attr("cnid"); if (shopId != "" && shopId != undefined) { syncTemplates('?wdtId=' + shopId); } } else if (currentUrl.indexOf("damaijiaerp.com") > -1) { var shopId = $('#shopId').val(); if (shopId != "" && shopId != undefined) { syncTemplates('?wdtId=' + shopId); } } else { syncTemplates(''); } }) //有两个填充地方,另一个在price_menu.html function syncTemplates(params) { var param={ method:'ajax', params: { url: domain + '/seller/querySampleTemplates' + params, xhrFields: {withCredentials: true} } }; chrome.runtime.sendMessage(param,function(t){ if (!t.message && t.result) { if (t.result["NORMAL"] && t.result["NORMAL"].length > 0) { $("#selectNormalTemplate").empty(); $("#selectNormalTemplate").append("请选择运费模板"); for (var i = 0; i < t.result["NORMAL"].length; i++) { var template = t.result["NORMAL"][i]; $("#selectNormalTemplate").append("" + template.templateName + ""); } //至少弹过一次计算器框时 $('.showSweetAlert #selectNormalTemplate').empty(); $('.showSweetAlert #selectNormalTemplate').append("请选择运费模板"); for (var i = 0; i < t.result["NORMAL"].length; i++) { var template = t.result["NORMAL"][i]; $('.showSweetAlert #selectNormalTemplate').append("" + template.templateName + ""); } $('.showSweetAlert #selectNormalTemplate').trigger("chosen:updated"); $('.showSweetAlert #selectNormalTemplate').chosen(); } else { $("#selectNormalTemplate").empty(); $("#selectNormalTemplate").append("请选择运费模板"); //至少弹过一次计算器框时 $('.showSweetAlert #selectNormalTemplate').empty(); $('.showSweetAlert #selectNormalTemplate').append("请选择运费模板"); $('.showSweetAlert #selectNormalTemplate').trigger("chosen:updated"); $('.showSweetAlert #selectNormalTemplate').chosen(); } if (t.result["REGION"] && t.result["REGION"].length > 0) { $("#selectRegionAmountTemplate").empty(); $("#selectRegionPercentTemplate").empty(); $("#selectRegionAmountTemplate").append("请选择运费模板"); $("#selectRegionPercentTemplate").append("请选择运费模板"); for (var j = 0; j < t.result["REGION"].length; j++) { var template = t.result["REGION"][j]; $("#selectRegionAmountTemplate").append("" + template.templateName + ""); $("#selectRegionPercentTemplate").append("" + template.templateName + ""); } //至少弹过一次计算器框时 $('.showSweetAlert #selectRegionAmountTemplate').empty(); $(".showSweetAlert #selectRegionPercentTemplate").empty(); $(".showSweetAlert #selectRegionAmountTemplate").append("请选择运费模板"); $(".showSweetAlert #selectRegionPercentTemplate").append("请选择运费模板"); for (var j = 0; j < t.result["REGION"].length; j++) { var template = t.result["REGION"][j]; $(".showSweetAlert #selectRegionAmountTemplate").append("" + template.templateName + ""); $(".showSweetAlert #selectRegionPercentTemplate").append("" + template.templateName + ""); } $(".showSweetAlert #selectRegionAmountTemplate").trigger("chosen:updated"); $(".showSweetAlert #selectRegionAmountTemplate").chosen(); $(".showSweetAlert #selectRegionPercentTemplate").trigger("chosen:updated"); $(".showSweetAlert #selectRegionPercentTemplate").chosen(); } else { $("#selectRegionAmountTemplate").empty(); $("#selectRegionPercentTemplate").empty(); $("#selectRegionAmountTemplate").append("请选择运费模板"); $("#selectRegionPercentTemplate").append("请选择运费模板"); //至少弹过一次计算器框时 $('.showSweetAlert #selectRegionAmountTemplate').empty(); $(".showSweetAlert #selectRegionPercentTemplate").empty(); $(".showSweetAlert #selectRegionAmountTemplate").append("请选择运费模板"); $(".showSweetAlert #selectRegionPercentTemplate").append("请选择运费模板"); $(".showSweetAlert #selectRegionAmountTemplate").trigger("chosen:updated"); $(".showSweetAlert #selectRegionAmountTemplate").chosen(); $(".showSweetAlert #selectRegionPercentTemplate").trigger("chosen:updated"); $(".showSweetAlert #selectRegionPercentTemplate").chosen(); } $(".syncTemplates").show(); $(".authorizeBtn").hide(); $(".buyStore").hide(); //主动点击同步时才需要提示 if (params == '') { showHint("sync", "同步成功"); } } else if (t.message) { $("#selectNormalTemplate").empty(); $("#selectNormalTemplate").append("" + t.message + ""); //至少弹过一次计算器框时 $('.showSweetAlert #selectNormalTemplate').empty(); $('.showSweetAlert #selectNormalTemplate').append("" + t.message + ""); $('.showSweetAlert #selectNormalTemplate').trigger("chosen:updated"); $('.showSweetAlert #selectNormalTemplate').chosen(); $("#selectRegionAmountTemplate").empty(); $("#selectRegionPercentTemplate").empty(); $("#selectRegionAmountTemplate").append("" + t.message + ""); $("#selectRegionPercentTemplate").append("" + t.message + ""); //至少弹过一次计算器框时 $('.showSweetAlert #selectRegionAmountTemplate').empty(); $(".showSweetAlert #selectRegionPercentTemplate").empty(); $(".showSweetAlert #selectRegionAmountTemplate").append("" + t.message + ""); $(".showSweetAlert #selectRegionPercentTemplate").append("" + t.message + ""); $(".showSweetAlert #selectRegionAmountTemplate").trigger("chosen:updated"); $(".showSweetAlert #selectRegionAmountTemplate").chosen(); $(".showSweetAlert #selectRegionPercentTemplate").trigger("chosen:updated"); $(".showSweetAlert #selectRegionPercentTemplate").chosen(); if (t.message.indexOf("授权") > -1) { $(".syncTemplates").hide(); $(".buyStore").hide(); if (params.indexOf("dxmId") > -1) { $(".authorizeBtn").attr("href", "https://www.dianxiaomi.com/sys/index.htm?go=m407"); } else if (params.indexOf("mbId") > -1) { $(".authorizeBtn").attr("href", "https://www.mabangerp.com/index.php?mod=shop.list"); } else { $(".authorizeBtn").attr("href", "https://listing.tongtool.com/listing/account/index.htm"); } $(".authorizeBtn").show(); } else { //账号已过期 $(".syncTemplates").hide(); $(".authorizeBtn").hide(); $(".buyStore").show(); } } else { console.log(t.message); } }); } //------------------------定制100g计算器模块start---------------------- //定制100g计算器菜单事件,弹出对话框 $("body").on("click", "#btnDiy100", function () { if($(".diy100").length){ $(".diy100").show(); $('.sweet-overlay').show(); $('body').attr('class','aside-expanded-true pace-done stop-scrolling'); }else{ $('.sweetAlert').removeClass('zndjpop').removeClass('qydjlre').removeClass('qydjlrl').removeClass('diy100'); $('.aeplgcon ul li.nav').removeClass('now'); $('#btnDiy100').parent().addClass('now'); swal({ title: "定制计算器", showConfirmButton: false, text: $('#region_diy_div').html(), html: true, customClass: "sweetAlert aezsmain diy100", allowOutsideClick: false }); if ($(".showSweetAlert select[name='selectTemplate']").chosen) { $(".showSweetAlert select[name='selectTemplate']").chosen(); } if ($(".showSweetAlert .locationCountry #locationSelect").chosen) { $(".showSweetAlert .locationCountry #locationSelect").chosen(); } } }); //选择模板下拉框后的事件 $('body').on('change', '#selectDiyTemplate', function () { var templateId = $(this).children('option:selected').val(); diySheet.setValue("G2", "", true); for (var i = 3; i < tableRowSizeDiy; i++) { diySheet.setRowData(i, ["","","","","","","","","","",""]); } if (templateId == "") { return; } var param={ method:'ajax', params: { url: domain + '/seller/getTeamplateById?templateId=' + templateId, xhrFields: {withCredentials: true} } }; chrome.runtime.sendMessage(param,function(t){ ($('.showSweetAlert #diySheet')[0]).jexcel = null; $('.showSweetAlert #diySheet').html(""); diySheet = jexcel($('.showSweetAlert #diySheet')[0], diyOptions()); if (!t.message && t.result) { var template = JSON.parse(t.result.data); //合并所有发货地的热门国家,用来勾选区域定价的国家 getPriceHotCountry(t.result); //初始化海外仓下拉框 var html = "中国"; if (t.result.overseasData) { var overseas = JSON.parse(t.result.overseasData); for (var key in overseas) { html += "" + overseas[key]["cnName"] + ""; } } $(".showSweetAlert .locationCountry #locationSelect").html(html); $(".showSweetAlert .locationCountry #locationSelect").trigger("chosen:updated"); $(".showSweetAlert .locationCountry #locationSelect").off("change").on('change', function (e, params) { if (params.selected == "CN") { template.shippingCountry = "CN"; template.type = t.result.templateType; template.volumeSize = t.result.volumeSize; templateData = template; } else { var tempOverseasAll = JSON.parse(t.result.overseasData); var temp = tempOverseasAll[params.selected]; temp.type = t.result.templateType; temp.shippingCountry = params.selected; templateData = temp; } if(templateData){ initDiyData(templateData, templateData.shippingCountry); } }); logisticsDiscount = t.result.logisticsDiscount; template.type = t.result.templateType; template.shippingCountry = "CN"; templateData = template; initDiyData(template, "CN"); } else { swal("", t.message, "error"); } }); }); function initDiyData(template, shippingCountry) { var exchangeRate = template.exchangeRate; var serviceRate = localStorage.getItem("serviceRate"); var wreckRate = localStorage.getItem("wreckRate"); if (exchangeRate == undefined || exchangeRate == "") { exchangeRate = localStorage.getItem("exchangeRate"); exchangeRate = exchangeRate ? exchangeRate : 6.6; } if (serviceRate == undefined || serviceRate == "" || serviceRate == "undefined") { serviceRate = 5; } if (wreckRate == undefined || wreckRate == "" || wreckRate == "undefined") { wreckRate = 2; } diySheet.setValue("A2", exchangeRate, true); diySheet.setValue("B2", serviceRate, true); diySheet.setValue("C2", 0, true); diySheet.setValue("D2", template.goodsWeight, true); diySheet.setValue("F2", wreckRate, true); diySheet.setValue("G2", template.fee, true); diySheet.setValue("H2", '=ROUNDUP(C2/A2+G2+E2*(B2+F2)/100, 2)', true); diySheet.setValue("I2", '=ROUNDUP(J2/A2/E2*100,2)', true); diySheet.setValue("J2", '=ROUNDUP((E2-H2)*A2,2)', true); diySheet.setValue("K2", '=E2', true); for (var i = 3; i < tableRowSizeDiy; i++) { diySheet.setRowData(i, ["","","","","","","","","","",""]); } if (template.type != "NORMAL" && template.type != "NORMAL_100") { hotCountries = sortCountrys(template.countrys); for (var j = 0; j < hotCountries.length; j++) { var row = j + 4; var countryLogis = []; var countryLogistic = hotCountries[j]; countryLogis.push(countryLogistic.countryName); //A countryLogis.push(countryLogistic.country); //B countryLogis.push(countryLogistic.logisName); //C countryLogis.push(countryLogistic.firstWeight); //D countryLogis.push(countryLogistic.firstWeightFee); //E if (countryLogistic.overWeight == undefined || countryLogistic.overWeight == "") { countryLogis.push(1); //F countryLogis.push((countryLogistic.overWeightFee/1000).toFixed(4));//G } else { countryLogis.push(countryLogistic.overWeight); //F countryLogis.push(countryLogistic.overWeightFee); //G } countryLogis.push(countryLogistic.registrationFee); //H countryLogis.push("=ROUNDUP(E" + row + "+H" + row + "+ROUNDUP((D2-D" + row + ">0 ? D2-D" + row + ":0)/F" + row + ",0)*G" + row + ",2)");//I countryLogis.push("=ROUNDUP(I" + row + "/A2-G2>0.01 ? I" + row + "/A2-G2:0,2)"); countryLogis.push(""); diySheet.setRowData(j + 3, countryLogis); } } } // 填充报价使用 function assemblePricesForDiy() { var prices = {}; prices.templateName = $(".showSweetAlert [name='selectTemplate']").children('option:selected').html(); prices.global = diySheet.getValue("K2"); prices.serviceRate = diySheet.getValue("B2"); prices.cost = diySheet.getValue("C2"); prices.weight = diySheet.getValue("D2"); prices.discountRate = 0; prices.wreckRate = diySheet.getValue("F2"); prices.globalSwitch = true; for (var i = 4; i < (tableRowSizeDiy + 1); i++) { var country = diySheet.getValue("B" + i); if (country) { prices["price-" + country] = diySheet.getValue("J" + i); } } return prices; } // 当修改重量后重新计算包邮费用 function recomputeFreeFee(el, records) { var skip = true; for (var ri = 0; ri < records.length; ri++) { if (records[ri].row == 1 && records[ri].col == 3) { skip = false; break; } } if (skip) return; var weight = diySheet.getValue("D2"); var exchangeRate = diySheet.getValue("A2"); if (templateData.otherCountrys && templateData.otherCountrys.length > 0) { for (var i = 0; i < templateData.otherCountrys.length; i++) { var otherCountry = templateData.otherCountrys[i]; if (otherCountry.countryName == templateData.feeFreeCountry) { var fee; var firstWeight = otherCountry.firstWeight; var firstWeightFee = otherCountry.firstWeightFee; var registrationFee = otherCountry.registrationFee; var overWeight = otherCountry.overWeight; var overWeightFee = otherCountry.overWeightFee; if (overWeight == undefined || overWeight == "") { var size = maltose.complexEval((weight - firstWeight > 0 ? weight - firstWeight : 0),0); fee = maltose.complexEval((firstWeightFee + registrationFee + size * overWeightFee / 1000) / exchangeRate, 2); } else { var size = Math.ceil(maltose.complexEval((weight - firstWeight > 0 ? weight - firstWeight : 0) + '/' + overWeight,2), 0); fee = maltose.complexEval((firstWeightFee + registrationFee + size * overWeightFee) / exchangeRate, 2); } diySheet.setValue("G2", fee, true); return; } } } } //------------------------定制100g计算器模块end------------------------.aeplgcon {
position: fixed;
top: 35%;
right: 5px;
background: #000000ad;
color: #fff;
z-index: 9999999;
width: 190px;
}
.aeplgcon p {
padding: 10px 0;
margin: 0;
line-height: normal;
text-align: center;
font-size: 16px;
background: #FF5959;
}
.aeplgcon ul {
padding-left: 0;
text-align: left;
margin-left: 0;
margin-bottom: 0;
}
.aeplgcon ul li.nav {
padding: 0 15px;
border-top: 1px solid #595959;
}
.aeplgcon ul li.nav:last-child {
border-bottom: 1px solid #595959;
}
.aeplgcon ul li.nav:hover {
background: #00000059;
}
.aeplgcon ul li a {
color: #fff;
padding: 10px 0;
display: block;
font-size: 13px;
}
.aeplgcon i {
font-style: inherit;
color: #ffc100;
line-height: 34px;
display: block;
}
.aeplgcon em:hover {
background: #d25353;
}
.aeplgcon em {
font-style: normal;
width: 22px;
height: 20px;
display: inline-block;
text-align: center;
position: absolute;
top: 0;
left: 0px;
color: #fff;
cursor: pointer;
font-size: 15px;
}
.aeplgcon em.showPOP {
left: -68px;
background: #FF5959;
width: 62px;
padding: 1px;
font-size: 14px;
text-align: center;
border-radius: 3px;
}