最新版
https://www.cnblogs.com/guxingy/p/14661143.html
不知道怎么的,他那个插件突然用不了了,就把核心代码拿出来稍微改了一下
var script = document.createElement('script');script.src = "https://cdn.bootcdn.net/ajax/libs/jquery/1.12.4/jquery.min.js";
document.head.appendChild(script);
var format = function(str) {
str = str.replace(/,d{6},/, ',');
arr = str.split(',');
let phone = arr[arr.length - 1];
let name = arr[arr.length - 2];
let address = '';
for (let i = 0; i <= arr.length - 3; i++) {
address += arr[i];
}
str = $.trim(name)+','+ $.trim(phone)+','+ $.trim(address);
return str;
};
var listDom = $('.consign-detail.batch');
var strHtml='';
listDom.each(function() {
let address = $.trim($(this).find('.receive-info .logis\:receInfo').text());
let order_id = $(this).find('tr.order-title').attr('order_id');
address = format(address);
strHtml += order_id+', '+address+'
';
})
console.log(strHtml);