var usd2rmb=6.49;var fedex = { //common goods ip:{ u:{f:256,c:75,k22:75,k45:75,k71:75,k100:75,tariff:true,residential:35}, //美,大陸聯邦包稅 2026/4/17 c:{f:256,c:42,k22:76,k45:76,k71:76,k100:76}, //加拿大 2026/7/21 K:{f:215,c:38,k22:55,k45:75,k71:75,k100:75}, //英西班牙 2026/4/17 m:{f:169,c:28.5,k22:68.9,k45:65.1,k71:64.1,k100:61.1}, F:{f:178,c:37.3,k22:72.6,k45:69.1,k71:68.1,k100:71.1},//芬兰 a:{f:179,c:38,k22:76,k45:76,k71:76,k100:76},//澳洲 E:{f:150,c:35.2,k22:65,k45:65,k71:65,k100:65},//关岛纽西兰 2026/6/18 t:{f:165,c:20,k22:58.2,k45:57.2,k71:53.8,k100:49.3},//泰 i:{f:203,c:21,k22:83.6,k45:82.6,k71:79.3,k100:75.9},//印尼 j:{f:176,c:27.6,k22:57.0,k45:56.0,k71:53.8,k100:49.3},//日 s:{f:146,c:22.7,k22:57.0,k45:56.0,k71:53.8,k100:49.3},//南韩 p:{f:165,c:22.7,k22:58.2,k45:57.2,k71:53.8,k100:49.3},//新加坡 v:{f:165,c:21,k22:83.6,k45:82.6,k71:79.3,k100:75.9},//越南 D:{f:297,c:55.7,k22:115,k45:108,k71:107,k100:104.3},//蒙古 O:{f:183,c:23.2,k22:57.0,k45:56.0,k71:53.8,k100:49.3},//印度 H:{f:176,c:38.5,k22:106.1,k45:105.1,k71:104.1,k100:100.7},//南非科威特 G:{f:289,c:45,k22:104.6,k45:102.8,k71:100.8,k100:98.1},//巴西智利阿根廷 s1:{f:28,c:18,ckg:1},//顺丰标快台湾 s2:{f:24,c:8,ckg:1}//顺丰标快港澳 }, country:{"Afghanistan":"H","Albania":"H","Algeria":"H","American Samoa":"E","Andorra":"F","Angola":"H","Anguilla":"G","Antigua":"G","Argentina":"G","Armenia":"H","Aruba":"G","Australia":"a","Austria":"m","Azerbaijan":"H","Bahamas":"G","Bahrain":"H","Bangladesh":"G","Barbados":"G","Barbuda":"G","Belarus":"H","Belgium":"K","Belize":"G","Benin":"H","Bermuda":"G","Bhutan":"G","Bolivia":"G","Bonaire":"G","Bosnia and Herzegovina":"H","Botswana":"H","Brazil":"G","British Virgin Islands":"G","Brunei":"E","Bulgaria":"F","Burkina Faso":"H","Burundi":"H","Cambodia":"E","Cameroon":"H","Canada":"c","Cape Verde":"H","Cayman Islands":"G","Central African Republic":"H","Chad":"H","Channel Islands (U.K.)":"K","Chile":"G","China":"s2","Colombia":"G","Congo, Democratic Republic Of":"H","Congo, Republic Of":"H","Cook Islands":"E","Costa Rica":"G","Croatia":"H","Curacao":"G","Cyprus":"H","Czech Republic":"F","Denmark":"m","Djibouti":"H","Dominica":"G","Dominican Republic":"G","East Timor":"E","Ecuador":"G","Egypt":"H","El Salvador":"G","England (U.K.)":"K","Equatorial Guinea":"H","Eritrea":"H","Estonia":"H","Ethiopia":"H","Faroe Islands":"F","Fiji":"E","Finland":"F","France":"K","French Guiana":"G","French Polynesia":"E","Gabon":"H","Gambia":"H","Georgia":"H","Germany":"K","Ghana":"H","Gibraltar":"H","Greece":"F","Greenland":"F","Grenada":"G","Guadeloupe":"G","Guam":"E","Guatemala":"G","Guinea":"H","Guinea Bissau":"H","Guyana":"G","Haiti":"G","Honduras":"G","Hong Kong SAR, China":"s2","Hungary":"F","Iceland":"H","India":"O","Indonesia":"i","Iraq":"H","Ireland, Northern (U.K.)":"m","Ireland, Republic Of":"m","Israel":"F","Italy":"K","Ivory Coast":"H","Jamaica":"G","Japan":"j","Jordan":"H","Kazakhstan":"H","Kenya":"H","Kuwait":"H","Kyrgyzstan":"H","Laos":"E","Latvia":"H","Lebanon":"H","Lesotho":"H","Liberia":"H","Libya":"H","Liechtenstein":"F","Lithuania":"F","Luxembourg":"m","Macau SAR, China":"s2","Macedonia":"H","Madagascar":"H","Malawi":"H","Malaysia":"t","Maldives, Republic Of":"G","Mali":"H","Malta":"F","Marshall Islands":"E","Martinique":"G","Mauritania":"H","Mauritius":"H","Mexico":"c","Micronesia":"E","Moldova":"H","Monaco":"m","Mongolia":"D","Montenegro":"H","Montserrat":"G","Morocco":"H","Mozambique":"H","Namibia":"H","Nepal":"G","Netherlands":"K","New Caledonia":"E","New Zealand":"E","Nicaragua":"G","Niger":"H","Nigeria":"H","Norway":"m","Oman":"H","Pakistan":"G","Palau":"E","Palestine Authority":"H","Panama":"G","Papua New Guinea":"E","Paraguay":"G","Peru":"G","Philippines":"t","Poland":"F","Portugal":"F","Puerto Rico":"c","Qatar":"H","Reunion Island":"H","Romania":"F","Russia":"H","Rwanda":"H","Saba":"G","Saipan":"E","Samoa":"E","San Marino":"K","Saudi Arabia":"H","Scotland (U.K.)":"K","Senegal":"H","Serbia":"H","Seychelles":"H","Sierra Leone":"H","Singapore":"p","Slovak Republic":"F","Slovenia":"H","South Africa":"H","South Korea":"s","Spain":"K","Sri Lanka":"G","St. Barthelemy":"G","St. Croix":"G","St. Eustatius":"G","St. John":"G","St. Kitts & Nevis":"G","St. Lucia":"G","St. Martin / St. Maarten":"G","St. Thomas":"G","St. Vincent":"G","Suriname":"G","Swaziland":"H","Sweden":"m","Switzerland":"m","Syria":"H","Tahiti":"E","Taiwan, China":"s1","Tanzania":"H","Thailand":"t","Togo":"H","Tonga":"E","Trinidad & Tobago":"G","Tunisia":"H","Turkey":"F","Turkmenistan":"H","Turks & Caicos Islands":"G","U.S. Virgin Islands":"G","Uganda":"H","Ukraine":"H","United Arab Emirates":"F","United Kingdom":"K","United States of America":"u","Uruguay":"G","Uzbekistan":"H","Vanuatu":"E","Vatican City":"K","Venezuela":"G","Vietnam":"v","Wales (U.K.)":"K","Wallis & Futuna":"E","Yemen, Republic Of":"H","Zambia":"H","Zimbabwe":"H"}, area_code:function(c){return this.country[c];}, include_tariff:function(c){ if(this.country[c]===undefined){return false;} let area=this.country[c]; if(this.ip[area].hasOwnProperty('tariff')){return this.ip[area].tariff;}else{return false;} }, price:function(c,kg){ let area=this.country[c]; if(area===undefined){return -1} let residential_charge=0; if(this.ip[area].hasOwnProperty('residential')){residential_charge=this.ip[area].residential;} if(this.ip[area].hasOwnProperty('ckg') && this.ip[area].ckg==1){//續重以1kg收 if (Math.ceil(kg)<=1){return this.ip[area].f;} else {return this.ip[area].f + ((Math.ceil(kg)-1)*this.ip[area].c);} } if (kg<=0.5){ return this.ip[area].f + residential_charge ; } else if (kg<10){ return this.ip[area].f + ((Math.ceil((kg-0.5)*2))*this.ip[area].c*1.1) + residential_charge ; } else if (kg<22){//small volume return this.ip[area].f + ((Math.ceil((kg-0.5)*2))*this.ip[area].c) + residential_charge ; } else if (kg<46) { return this.ip[area].k22 * Math.ceil(kg)+ residential_charge ; } else if (kg<71) { return this.ip[area].k45 * Math.ceil(kg)+ residential_charge ; } else if (kg<101) { return this.ip[area].k71 * Math.ceil(kg)+ residential_charge ; } else { return this.ip[area].k100 * Math.ceil(kg)+ residential_charge ; } }, channel:function(c){ let area=this.country[c]; if((area=="s1")||(area=="s2")){ return 'SF Express'; }else {return 'FedEx/UPS/DHL';} }, shipping_time:function(c){ if(this.country[c]===undefined){return "";} let area=this.country[c]; if((area=="s1")||(area=="s2")){ return '4-5';} else if(["u","c","K","m","F","j","s","p"].indexOf(area)!==-1){return '3-8';} else {return '4-10';} }, is_country_exist:function(c){if((c===undefined) || c=="" || (this.country[c]===undefined)){return false;}else{return true;}}, get_all_countries:function(){return Object.keys(this.country);}, last_modified_time:new Date(1792810255000) };var postal = { //postal service common goods country:{ //FZZXR, 联邮通标准挂号-普货(QC) "United States of America":{channel:"USPS",max_grams:10000, price:{0:161,101:161,201:159,301:158,451:157,701:156,2001:150}, misc:{0:23,101:21,201:19,301:19,451:19,701:12},days:"5-15",min_grams:30,tariff:true},//美國報價已含關稅 "United Kingdom":{channel:"Royal Mail",max_grams:10000,price:{0:70,301:72,1001:75},misc:16,days:"5-15"}, "Australia":{channel:"Australia Post",max_grams:4000,price:65,misc:{0:50,301:50,501:50,1001:50},days:"5-20"},//AYPZXR "Canada":{channel:"Canada Post",max_grams:10000, price:{0:93,151:95,451:95,751:96,2001:98}, misc:{0:21,451:22,1001:23},days:"5-15"}, "New Zealand":{channel:"NZ Post",max_grams:10000,price:93,misc:25.4,days:"6-15"}, "France":{channel:"La Poste",max_grams:6000,price:{0:79,501:79},misc:{0:20,501:23},days:"5-15",min_grams:250,EU:true,VAT:true,VAT_rate:0.22,tariff:true}, "Germany":{channel:"Deutsche Post",max_grams:6000,price:{0:73,301:68},misc:{0:22,301:22},days:"5-15",min_grams:250,EU:true,VAT:true,VAT_rate:0.21,tariff:true}, "Italy":{channel:"Poste Italiane",max_grams:6000,price:79,misc:25,days:"5-15",min_grams:250,EU:true,VAT:true,VAT_rate:0.24,tariff:true}, "Spain":{channel:"Correos",max_grams:6000,price:79,misc:18,days:"5-15",min_grams:250,EU:true,VAT:true,VAT_rate:0.23,tariff:true}, "Sweden":{channel:"PostNord Sverige",max_grams:6000,price:{0:89,301:79,2001:82},misc:{0:16,301:21},days:"5-12",EU:true,VAT:true,VAT_rate:0.27,tariff:true}, "Singapore":{channel:"Singapore Post",max_grams:6000,price:31,misc:16,days:"4-9"}, //欧盟27国免IOSS 联邮通欧盟标准挂号-带电(SI)包VAT //欧盟用云途全球专线挂号(特惠普货)THPHR "Austria":{channel:"Österreichische Post",max_grams:3000,price:84,misc:23,days:"5-15",EU:true,VAT:true,VAT_rate:0.22,tariff:true}, "Belgium":{channel:"Bpost",max_grams:2000,price:100,misc:21,days:"5-15",EU:true,VAT:true,VAT_rate:0.23,tariff:true}, "Netherlands":{channel:"PostNL",max_grams:6000,price:83,misc:23,days:"5-15",EU:true,VAT:true,VAT_rate:0.23,tariff:true}, "Poland":{channel:"Poczta Polska",max_grams:2000,price:88,misc:15,days:"6-10",EU:true,VAT:true,VAT_rate:0.25,tariff:true}, //欧盟27国 联邮通经济2挂号-带电(ED)客人自付税 改云途欧盟全部包VAT "Bulgaria":{channel:"Български пощи",max_grams:2000,price:129,misc:4,days:"12-15",EU:true,VAT:true,VAT_rate:0.22,tariff:true},//yun "Croatia":{channel:"Hrvatska pošta",max_grams:2000,price:94,misc:20.5,days:"12-15",EU:true,VAT:true,VAT_rate:0.27,tariff:true}, "Cyprus":{channel:"Κυπριακά Ταχυδρομεία",max_grams:2000,price:132,misc:30,days:"12-15",EU:true,VAT:true,VAT_rate:0.21,tariff:true}, "Czech Republic":{channel:"Česká pošta",max_grams:2000,price:87,misc:18.5,days:"12-15",EU:true,VAT:true,VAT_rate:0.23,tariff:true}, "Denmark":{channel:"PostNord",max_grams:2000,price:94,misc:28,days:"12-15",EU:true,VAT:true,VAT_rate:0.27,tariff:true}, "Estonia":{channel:"Omniva",max_grams:2000,price:107,misc:23,days:"12-15",EU:true,VAT:true,VAT_rate:0.24,tariff:true}, "Finland":{channel:"Posti Group",max_grams:2000,price:92,misc:31,days:"12-15",EU:true,VAT:true,VAT_rate:0.275,tariff:true}, "Greece":{channel:"Ελληνικά Ταχυδρομεία",max_grams:2000,price:84,misc:25,days:"12-15",EU:true,VAT:true,VAT_rate:0.26,tariff:true}, "Hungary":{channel:"Magyar Posta",max_grams:2000,price:91,misc:18.5,days:"12-15",EU:true,VAT:true,VAT_rate:0.29,tariff:true}, "Ireland":{channel:"An Post",max_grams:2000,price:109,misc:20.5,days:"12-15",EU:true,VAT:true,VAT_rate:0.25,tariff:true}, "Latvia":{channel:"Latvijas Pasts",max_grams:2000,price:92.5,misc:20.5,days:"12-15",EU:true,VAT:true,VAT_rate:0.23,tariff:true}, "Lithuania":{channel:"Lietuvos paštas",max_grams:2000,price:87,misc:18.5,days:"12-15",EU:true,VAT:true,VAT_rate:0.23,tariff:true}, "Luxembourg":{channel:"POST Luxembourg",max_grams:2000,price:79,misc:26,days:"12-15",EU:true,VAT:true,VAT_rate:0.19,tariff:true}, "Malta":{channel:"MaltaPost",max_grams:2000,price:117,misc:32,days:"12-15",EU:true,VAT:true,VAT_rate:0.2,tariff:true}, "Portugal":{channel:"CTT",max_grams:2000,price:90,misc:20,days:"9-15",EU:true,VAT:true,VAT_rate:0.25,tariff:true}, "Romania":{channel:"Poșta Română",max_grams:2000,price:82,misc:20,days:"12-15",EU:true,VAT:true,VAT_rate:0.21,tariff:true},//yun "Slovakia":{channel:"Slovenská pošta",max_grams:2000,price:89,misc:19,days:"12-15",EU:true,VAT:true,VAT_rate:0.25,tariff:true}, "Slovenia":{channel:"Pošta Slovenije",max_grams:2000,price:78,misc:24.5,days:"12-15",EU:true,VAT:true,VAT_rate:0.24,tariff:true}, "South Korea":{channel:"우정사업본부",max_grams:2000,price:40,misc:20,days:"5-15"}, "Israel":{channel:"דואר ישראל",max_grams:3000,price:60,misc:23,days:"5-15"}, //一带一路 "Kazakhstan":{channel:"Kazpost",max_grams:2000,price:78.4,misc:7.84,days:"7-20"}, "Kyrgyzstan":{channel:"KEP",max_grams:2000,price:55.45,misc:22.77,days:"15-35"},//F4 "Tajikistan":{channel:"Почтаи тоҷик",max_grams:2000,price:38.61,misc:22.77,days:"15-35"},//F4 "Uzbekistan":{channel:"O’zbеkiston pochtasi",max_grams:2000,price:55.44,misc:22.77,days:"15-35"},//F4 //河南本地E邮宝(PW) "Turkey":{channel:"PTT",max_grams:2000,price:77.3,misc:25,days:"5-20"}, "Saudi Arabia":{channel:"Saudi Post",max_grams:2000,price:52.3,misc:26,days:"5-20"}, "Philippines":{channel:"PHLPost",max_grams:2000,price:46,misc:14,days:"8-10"},//THPHR //广州E邮宝(EC) "Brazil":{channel:"Correios",max_grams:2000,price:110,misc:25,days:"8-20"}, "Japan":{channel:"郵便局",max_grams:2000,price:10,misc:35,days:"6-10"}, "Thailand":{channel:"ไปรษณีย์ไทย",max_grams:2000,price:42.3,misc:13.2,days:"6-14"}, //EUB-SZ yun "Russia":{channel:"Почта России",max_grams:2000,price:68.9,misc:15.9,days:"10-15"}, "Vietnam":{channel:"Bưu điện Việt Nam",max_grams:2000,price:54.5,misc:11.9,days:"10-15"}, "Indonesia":{channel:"Pos Indonesia",max_grams:2000,price:45.5,misc:14.2,days:"10-15"}, "Malaysia":{channel:"Pos Malaysia",max_grams:2000,price:42,misc:15.8,days:"10-15"}, //THPHR "Switzerland":{channel:"Swiss Post",max_grams:2000,price:{0:116,201:138,501:130},misc:{0:22,201:18},min_grams:166,days:"8-14"}, "Norway":{channel:"Posten Norge",max_grams:2000,price:91,misc:20,days:"8-10"}, //河南小包挂号(GF) "Mexico":{channel:"Correos de México",max_grams:2000,price:70,misc:30,days:"7-20"}, "Colombia":{channel:"4-72",max_grams:2000,price:97,misc:32,days:"7-20"}, "Argentina":{channel:"Correo Argentino",max_grams:2000,price:99,misc:27,days:"7-20"}, "Chile":{channel:"Correos de Chile",max_grams:2000,price:97,misc:25.8,days:"7-20"}, "Peru":{channel:"Servicios Postales del Perú",max_grams:2000,price:93.5,misc:27.5,days:"7-20"}, "South Africa":{channel:"South African Post Office",max_grams:2000,price:96,misc:23.7,days:"7-20"}, "Bahrain":{channel:"Bahrain Post",max_grams:2000,price:70.3,misc:23.7,days:"7-20"}, "Egypt":{channel:"Egypt Post",max_grams:2000,price:74.5,misc:32.9,days:"7-20"}, "Iran":{channel:"Iran Post",max_grams:2000,price:80.6,misc:23.7,days:"7-20"}, "Costa Rica":{channel:"Correos de Costa Rica",max_grams:2000,price:93,misc:23.7,days:"7-20"}, "Ecuador":{channel:"Correos del Ecuador",max_grams:2000,price:98.1,misc:25.8,days:"7-20"}, "Bangladesh":{channel:"Bangla Post",max_grams:2000,price:60,misc:23.7,days:"7-20"}, "Lebanon":{channel:"LibanPost",max_grams:2000,price:75.5,misc:32,days:"7-20"}, "Moldova":{channel:"Posta Moldovei",max_grams:2000,price:79,misc:23.7,days:"7-20"}, "Panama":{channel:"COTEL",max_grams:2000,price:99.2,misc:23.7,days:"7-20"}, "Puerto Rico":{channel:"USPS",max_grams:2000,price:197,misc:26.8,days:"7-20"}, "Pakistan":{channel:"USPS",max_grams:2000,price:55,misc:23,days:"7-25"},//yun DG "Morocco":{channel:"Poste Maroc",max_grams:2000,price:105.3,misc:15.5,days:"7-20"},//HQ "Trinidad & Tobago":{channel:"Poste Maroc",max_grams:2000,price:89,misc:23,days:"7-25"},//yun DG "United Arab Emirates":{channel:"Emirates Post",max_grams:4000,price:51,misc:25,days:"5-15",min_grams:100} }, in_service:function(c){ if(this.country[c]===undefined){return false;} else {return true;} }, channel:function(c){ if(this.country[c]===undefined){return "";} else {return this.country[c].channel;} }, shipping_time:function(c){ if(this.country[c]===undefined){return "";} else {return this.country[c].days;} }, EU_member:function(c){ if(this.country[c]===undefined){return false;} if(this.country[c].hasOwnProperty('EU')){return this.country[c].EU; } else {return false;} }, include_VAT:function(c){ if(this.country[c]===undefined){return false;} if(this.country[c].hasOwnProperty('VAT')){return this.country[c].VAT; } else {return false;} }, VAT_rate:function(c){ if(this.country[c]===undefined){return 0;} if(this.country[c].hasOwnProperty('VAT_rate')){return parseFloat(this.country[c].VAT_rate); } else {return 0.25;} }, get_VAT:function(c,declared_amount){ if (this.include_VAT(c)){ let r=this.VAT_rate(c),vat=declared_amount*r; console.log('VAT '+(r*100)+'% '+vat); return vat; } else {return 0;} }, include_tariff:function(c){ if(this.country[c]===undefined){return false;} if(this.country[c].hasOwnProperty('tariff')){return this.country[c].tariff; } else {return false;} }, //歐盟關稅150歐元以內 3歐元+欧盟处理费UHF 2歐元,150歐元以上衣服 12% get_tariff:function(c,declared_amount){ if (this.EU_member(c)){ let tariff=0; let uhf=2.4; if (declared_amount<180){tariff=uhf+3.6;} else{tariff=uhf+declared_amount*0.12;} console.log('Tariff '+tariff); return tariff; } else { return 0; } }, price:function(c,grams){ if(this.country[c]===undefined){return -1;} let temp_price=0,misc=0,kg_price=0,citem=this.country[c]; if (grams>citem.max_grams){ split_pkg=Math.floor(grams/citem.max_grams); if (typeof citem.misc==="object"){ for(const property in citem.misc){ if(grams>=property){misc=citem.misc[property];} } } else {misc=citem.misc;} if (typeof citem.price==="object"){ for(const property in citem.price){ if(grams>=property){kg_price=citem.price[property];} } } else {kg_price=citem.price;} temp_price=split_pkg*((citem.max_grams/1000*kg_price)+misc); grams=grams%citem.max_grams; } if(grams<=citem.max_grams){ if (citem.hasOwnProperty('min_grams')){//最低计费重 if (grams=property){misc=citem.misc[property];} } } else {misc=citem.misc;} if (typeof citem.price==="object"){ for(const property in citem.price){ if(grams>=property){kg_price=citem.price[property];} } } else {kg_price=citem.price;} temp_price+=(grams/1000*kg_price)+misc; } return temp_price; }, last_modified_time:new Date(1792810255000) };var postal_fast = { //YTYCPREG,云途全球云选专线挂号(特快普货) country:{ "United States of America":{channel:"USPS",max_grams:10000,price:{0:165,451:162,801:163,1001:163}, misc:{0:33,451:55,701:55},days:"5-8",min_grams:166,tariff:true}, "United Kingdom":{channel:"Royal Mail",max_grams:5000,price:{0:82,751:82,1001:84},misc:16,days:"3-8",min_grams:166}, //歐盟 "France":{channel:"La Poste",max_grams:6000,price:107,misc:25,days:"5-8",EU:true,VAT:true,VAT_rate:0.22,min_grams:166,tariff:true}, "Germany":{channel:"Deutsche Post",max_grams:5000,price:108,misc:25,days:"4-8",EU:true,VAT:true,VAT_rate:0.21,min_grams:166,tariff:true} }, in_service:function(c){ if(this.country[c]===undefined){return false;} else {return true;} }, channel:function(c){ if(this.country[c]===undefined){return "";} else {return this.country[c].channel;} }, shipping_time:function(c){ if(this.country[c]===undefined){return "";} else {return this.country[c].days;} }, EU_member:function(c){ if(this.country[c]===undefined){return false;} if(this.country[c].hasOwnProperty('EU')){return this.country[c].EU; } else {return false;} }, include_VAT:function(c){ if(this.country[c]===undefined){return false;} if(this.country[c].hasOwnProperty('VAT')){return this.country[c].VAT; } else {return false;} }, VAT_rate:function(c){ if(this.country[c]===undefined){return 0;} if(this.country[c].hasOwnProperty('VAT_rate')){return parseFloat(this.country[c].VAT_rate); } else {return 0.25;} }, get_VAT:function(c,declared_amount){ if (this.include_VAT(c)){ let r=this.VAT_rate(c),vat=declared_amount*r; console.log('VAT '+(r*100)+'% '+vat); return vat; } else {return 0;} }, include_tariff:function(c){ if(this.country[c]===undefined){return false;} if(this.country[c].hasOwnProperty('tariff')){return this.country[c].tariff; } else {return false;} }, //歐盟臨時關稅150歐元以內 3歐元,到2028年7月1日, 150歐元以上衣服 12% get_tariff:function(c,declared_amount){ if (this.EU_member(c)){ let tariff=0; if (declared_amount<180){tariff=3.6;} else{tariff=declared_amount*0.12;} console.log('Tariff '+tariff); return tariff; } else { return 0; } }, price:function(c,grams){ if(this.country[c]===undefined){return -1;} let temp_price=0,misc=0,kg_price=0,citem=this.country[c]; if (grams>citem.max_grams){ split_pkg=Math.floor(grams/citem.max_grams); if (typeof citem.misc==="object"){ for(const property in citem.misc){ if(grams>=property){misc=citem.misc[property];} } } else {misc=citem.misc;} if (typeof citem.price==="object"){ for(const property in citem.price){ if(grams>=property){kg_price=citem.price[property];} } } else {kg_price=citem.price;} temp_price=split_pkg*((citem.max_grams/1000*kg_price)+misc); grams=grams%citem.max_grams; } if(grams<=citem.max_grams){ if (citem.hasOwnProperty('min_grams')){//最低计费重 if (grams=property){misc=citem.misc[property];} } } else {misc=citem.misc;} if (typeof citem.price==="object"){ for(const property in citem.price){ if(grams>=property){ kg_price=citem.price[property];} } } else {kg_price=citem.price;} temp_price+=(grams/1000*kg_price)+misc; } return temp_price; }, last_modified_time:new Date(1783062486000) };var airfreight_ddp = { //空派包稅美國專用 country:{ "United States of America":{ channel:"UPS/FedEx", price:{0.5:175,1:195,1.5:220,2:262,2.5:292,3:328,3.5:363,4:399,4.5:431,5:449,5.5:490,6:516,6.5:547, 7:577,7.5:607,8:638,8.5:668,9:700,9.5:729,10:760, 10.5:790,11:821,11.5:852,12:882,12.5:912,13:943,13.5:973,14:1005,14.5:1035,15:1065,15.5:1095,16:1120, 16.5:1151,17:1187,17.5:1218, 18:1248,18.5:1281,19:1305,19.5:1340,20:1370,20.5:1400}, correction:1.05,//小貨調整比率,原基礎是用大貨60計算的 63/60=1.05 price21kg:65,price71kg:65, days:"8-15"}, }, in_service:function(c){ if(this.country[c]===undefined){return false;} else {return true;} }, channel:function(c){ if(this.country[c]===undefined){return "";} else {return this.country[c].channel;} }, shipping_time:function(c){ if(this.country[c]===undefined){return "";} else {return this.country[c].days;} }, include_duty:function(c){return true;}, price:function(c,kg){ if(this.country[c]===undefined){return -1;} let citem=this.country[c]; if (kg<=20.5){ for(const property in citem.price){ if(kg<=property){ let correction = citem.correction ? citem.correction : 1; return Math.round(citem.price[property] * correction); } } }else if (kg<=70){ return Math.ceil(kg)*citem.price21kg+30; }else{//私人地址+30 return Math.ceil(kg)*citem.price71kg+30; } }, channel:function(c){return 'UPS/FedEx';}, shipping_time:function(c){return '8-15';}, last_modified_time:new Date(1779092227000) };var oceanfreight_ddp = {//海派包稅美國加拿大專用 country:{ "United States of America":{ channel:"UPS/FedEx", price:{3:210,3.5:210,4:230,4.5:230,5:255,5.5:255,6:260,6.5:260, 7:270,7.5:275,8:280,8.5:290,9:295,9.5:300,10:310,10.5:320,11:330,11.5:335, 12:360,12.5:365,13:370,13.5:375,14:380,14.5:385,15:390,15.5:395,16:420,16.5:425, 17:440,17.5:445,18:450,18.5:455,19:465,19.5:470,20:475,20.5:480}, price21kg:38, days:"22-30"}, "Canada":{ channel:"UPS/FedEx", price21kg:27, days:"22-30"} }, in_service:function(c){ if(this.country[c]===undefined){return false;} else {return true;} }, channel:function(c){ if(this.country[c]===undefined){return "";} else {return this.country[c].channel;} }, shipping_time:function(c){ if(this.country[c]===undefined){return "";} else {return this.country[c].days;} }, include_duty:function(c){return true;}, price:function(c,kg){ if(this.country[c]===undefined){return -1;} let citem=this.country[c]; if (Object.hasOwn(citem,'price') && kg<=20.5){ //小貨查表 for(const property in citem.price){ if(kg<=property){ //偏遠+30,超級偏遠+50,分不清,查表完直接加30 return citem.price[property]+30; } } } else { //大貨,私人地址+1/kg,偏遠+25 if (kg<21){kg=21;}//最低21kg起算 return Math.ceil(kg)*(citem.price21kg+1)+25; } }, //海派以星,可以走液體和帶電+5/kg,私人+1/kg price4liquid:function(c,kg){ if(this.country[c]===undefined){return -1;} let citem=this.country[c]; if (kg<21){kg=21;}//最低21kg起算,大貨價格 return Math.ceil(kg)*(citem.price21kg+6)+25; }, last_modified_time:new Date(1774270931000) };var country_currency={ country_currency_code:{"US":"USD"}, usd_exchange_rate:{"success":false}, country_code:"US",local_currency:"USD",exchange_rate:1, set_country:function(country_code){ try { if(Object.hasOwn(this.country_currency_code,country_code)){ this.country_code=country_code; let local_currency=this.country_currency_code[country_code]; if (local_currency!==""){ this.local_currency=this.country_currency_code[country_code]; let rates=this.usd_exchange_rate.rates; if(Object.hasOwn(rates,this.local_currency)){ this.exchange_rate=rates[this.local_currency]; }else{this.local_currency="USD";this.exchange_rate=1;} }} } catch (error) {this.local_currency="USD";this.exchange_rate=1;} }, usd_to_local: function(usd_amout){ if (this.exchange_rate>100){return Math.round(usd_amout*this.exchange_rate); }else if (this.exchange_rate>10){return Math.round(usd_amout*this.exchange_rate*10)/10; }else{return Math.round(usd_amout*this.exchange_rate*100)/100;} }, ready:function(){ if ((Object.keys(this.country_currency_code).length >1) && (Object.keys(this.usd_exchange_rate).length >1)){ return true; } else {return false;} }, after_local_price_update:null //call back function }; var sitedir="https://www.ginifab.com"+"/neck_gaiter/"; async function update_exchange_rate_json() { try { const response = await fetch('https://api.fxratesapi.com/latest'); if (!response.ok){throw new Error(`HTTP error! status: ${response.status}`);} const data = await response.json(); if (data.success==true && Object.hasOwn(data,"timestamp") && Object.hasOwn(data,"rates") ){ fetch(sitedir+"usd_exchan"+"ge_rate_updage.p"+"hp", { method: 'POST',headers: {'Content-Type': 'application/json'},body: JSON.stringify(data)}) .then(response => {return response.text();}) .then(data => {console.log('update currency exchange rates success:', data);}) .catch(error => {console.error('Error:', error);}); } } catch (error) { console.error('Error fetching data:', error); } } fetch(sitedir+"usd_exchange"+"_rate.json",{cache:"no-cache"}) .then(response => { if (!response.ok) {throw new Error(`HTTP error! Status: ${response.status}`);} return response.json(); }) .then(data => { country_currency.usd_exchange_rate=data; let tSec=(Date.now()/1000)-data.timestamp;//秒差 //本地數據超過一小時,上網更新 if (tSec>3600){update_exchange_rate_json();} }) .catch(error => {console.error('Error during fetch operation:', error);}); fetch(sitedir+"country_curr"+"ency_code.json") .then(response => { if (!response.ok) {throw new Error(`HTTP error! Status: ${response.status}`);} return response.json(); }) .then(data => { country_currency.country_currency_code=data; }) .catch(error => {console.error('Error during fetch operation:', error);}); window.addEventListener('load', function(){ var tStart=Date.now(); var fqintervalID=setInterval(function(){ if ((typeof window.user_country !== 'undefined') && country_currency.ready()) { clearInterval(fqintervalID); //Best match country if (!fedex.is_country_exist(window.user_country)){ let all_countries=fedex.get_all_countries(),select_counrty=window.user_country.toUpperCase(); for (let i=0;i a.cost - b.cost); let sphint=""; aShippingCost.forEach((sc) => { if (sphint!==""){sphint+="\n";} sc.usd_price=Math.round(sc.cost/0.075/usd2rmb)/10; if (country_currency.local_currency=="USD"){ sc.local_price=sc.usd_price; sphint+=sc.channel+" : "+sc.usd_price+" USD"; }else{ sc.local_price=country_currency.usd_to_local(sc.usd_price); sphint+=sc.channel+" : "+sc.local_price+" "+country_currency.local_currency; } }); tdsc.innerHTML=aShippingCost[0].local_price; tdsc.title=sphint; bRefresh=true; } //價格日期 if (bRefresh){//成功更新 let spanCurrencies=document.getElementsByClassName("spanCurrency"); for (const spanC of spanCurrencies){spanC.innerHTML=country_currency.local_currency;} if (document.getElementById("spanDeliverTo")!==null){ document.getElementById("spanDeliverTo").innerHTML=window.user_country;} if (document.getElementById("spanPriceDate")!==null){ let lmd=[fedex.last_modified_time.getTime()]; if (postal.in_service(c)){lmd.push(postal.last_modified_time.getTime());} if (postal_fast.in_service(c)){lmd.push(postal_fast.last_modified_time.getTime());} if (airfreight_ddp.in_service(c)){lmd.push(airfreight_ddp.last_modified_time.getTime());} if (oceanfreight_ddp.in_service(c)){lmd.push(oceanfreight_ddp.last_modified_time.getTime());} let maxd=Math.max(...lmd),md=new Date(maxd); document.getElementById("spanPriceDate").innerHTML=md.getFullYear()+"/"+(md.getMonth()+1)+"/"+md.getDate(); } if (typeof country_currency.after_local_price_update=='function'){country_currency.after_local_price_update();}//call back } } else { if ((Date.now()-tStart)>600000){clearInterval(fqintervalID);} else{console.log(Date.now()-tStart);} } },1000); });