抖音小店订单管理

方便抖音订单查看,必须要打开抖音小店的订单管理界面,才能显示

  1. // ==UserScript==
  2. // @name 抖音小店订单管理
  3. // @version 4.7
  4. // @author 大师兄 476116973@qq.com
  5. // @namespace https://gf.qytechs.cn/zh-CN/users/724782-caogen1207
  6. // @match *://fxg.jinritemai.com/ffa/morder/order/list
  7. // @date 05/27/2021
  8. // @description 方便抖音订单查看,必须要打开抖音小店的订单管理界面,才能显示
  9. // @icon https://mms0.baidu.com/it/u=685985501,228922170&fm=27&gp=0.jpg&fmt=auto
  10. // @run-at document-end
  11. // @note 2.5 @updateURL/@installURL/@downloadURL https://gf.qytechs.cn/zh-CN/scripts/431480
  12. // @require https://code.jquery.com/jquery-3.6.0.min.js
  13. // @require https://cdn.staticfile.org/datatables/1.10.9/js/jquery.dataTables.min.js
  14. // @resource dashixiongCSS https://gitee.com/da-shixiong/ajax/raw/master/hs/dataTables/min.css
  15. // @grant GM_addStyle
  16. // @grant GM_getResourceText
  17. // @grant GM_getValue
  18. // @grant GM_setValue
  19. // @grant GM_deleteValue
  20. // @grant GM_xmlhttpRequest
  21. // @grant window.close
  22. // @grant window.focus
  23. // @grant window.onurlchange
  24. // @connect *
  25. // ==/UserScript==
  26.  
  27. window.onload = (function() {
  28. "use strict";
  29.  
  30. GM_addStyle(GM_getResourceText("dashixiongCSS"));
  31. var dsx = {
  32. xiaodianming:"",
  33. xiaodianID:"",
  34.  
  35. baocunshuju: function(obj){
  36. let jsonshuju = dsx.shujuzhuanshuzu(obj);
  37. GM_xmlhttpRequest({
  38. method: 'POST',
  39. url: "http://ftp6485842.host120.sanfengyun.cn/server/csv.php",
  40. headers: {
  41. 'Accept': 'application/json; charset=utf-8'
  42. },
  43. data : JSON.stringify(jsonshuju),
  44. cookie : "zhujiwusysdomain=ftp6485842.host120.sanfengyun.cn",
  45. onload: function(res) {
  46. //console.log(res.responseText);
  47. }
  48. });
  49. },
  50.  
  51. jiazaishuju: function(name,offset,len){
  52. GM_xmlhttpRequest({
  53. method: 'POST',
  54. url: "http://ftp6485842.host120.sanfengyun.cn/server/getdata.php",
  55. headers: {
  56. 'Accept': 'application/json; charset=utf-8'
  57. },
  58. data : JSON.stringify({"name":name,"offset":offset,"len":len}),
  59. cookie : "zhujiwusysdomain=ftp6485842.host120.sanfengyun.cn",
  60. onload: function(res) {
  61. console.log("php返回数据:",dsx.xiaodianming,res.responseText);
  62. }
  63. });
  64. },
  65.  
  66. shujuzhuanshuzu: function(obj){
  67. let jsonshuju = {"name": dsx.xiaodianming};
  68. let arr = new Array();
  69. if($.isPlainObject(obj)){
  70. arr[0] = dsx.jiexijsonshuju(obj);
  71. }else if($.isArray(obj)){
  72. $.each(obj,function(i,item){
  73. arr[i] = dsx.jiexijsonshuju(item);
  74. });
  75. };
  76. jsonshuju.data = arr;
  77. return jsonshuju;
  78. },
  79.  
  80. jiexijsonshuju: function(item){
  81. //{"name":"幸福的人-123","data":[["0抖音昵称","1收件人","2手机号","3省份","4城市","5城镇/区","6街道","7详细地址","8订单id","9订单金额","10订单时间","11订单状态","12订单详情","13user_id","14支付类型","15运费"]]}
  82. let arr = new Array();
  83. arr[0] = item.user_nickname;
  84. try{arr[1] = item.receiver_info.post_receiver}catch(e){arr[1] = "没有"};
  85. try{arr[2] = item.receiver_info.post_tel}catch(e){arr[2] = "没有"};
  86. try{arr[3] = item.receiver_info.post_addr.province.name}catch(e){arr[3] = "没有"};
  87. try{arr[4] = item.receiver_info.post_addr.city.name}catch(e){arr[4] = "没有"};
  88. try{arr[5] = item.receiver_info.post_addr.town.name}catch(e){arr[5] = "没有"};
  89. try{arr[6] = item.receiver_info.post_addr.street.name}catch(e){arr[6] = "没有"};
  90. try{arr[7] = item.receiver_info.post_addr.detail}catch(e){arr[7] = "没有"};
  91. arr[8] = item.shop_order_id;
  92. arr[9] = item.pay_amount / 100;
  93. try{arr[10] = dsx.formatDate(item.create_time)}catch(e){arr[10] = "没有"};
  94. arr[11] = item.order_status_info.order_status_text;
  95. let dingdanxinxi = "";
  96. $.each(item.product_item, function(j, d){
  97. let biaoti = "【" + (j+1) + "标题】" + d.product_name;
  98. let sku = "【" + (j+1) + "SKU】" + d.merchant_sku_code;
  99. let img = "【" + (j+1) + "首图】" + d.img;
  100. let id = "【" + (j+1) + "订单ID】" + d.item_order_id;
  101. let huaxianjia = "【" + (j+1) + "划线价】" + d.combo_amount/100;
  102. let jiage = "【" + (j+1) + "价格】" + d.total_amount /100;
  103. dingdanxinxi += biaoti + "\n" + sku + "\n" + img + "\n" + id + "\n" + huaxianjia + "\n" + jiage + "\n";
  104. let xingzhi = "";
  105. $.each(d.properties, function(k, e){
  106. xingzhi += "【" + (j+1) +"性质"+ (k+1) + "】" + e.text + "\n";
  107. });
  108. dingdanxinxi += xingzhi;
  109. let biaoqian = "";
  110. $.each(d.tags, function(k, e){
  111. biaoqian += "【" + (j+1) +"标签"+ (k+1) + "】" + e.text + "\n";
  112. });
  113. dingdanxinxi += biaoqian;
  114. });
  115. arr[12] = dingdanxinxi;
  116. arr[13] = item.user_id;
  117. arr[14] = item.pay_type_desc;
  118. let yunfei = "";
  119. $.each(item.pay_amount_detail, function(j, d){
  120. let name = d.name;
  121. let amount = d.amount;
  122. yunfei += name + amount + "\n";
  123. });
  124. arr[15] = yunfei;
  125. //console.log(arr);
  126. return arr;
  127. },
  128.  
  129. formatDate: function(data) {
  130. //时间戳转格式
  131. let timestamp = new Date(data * 1000);
  132. let year = timestamp.getFullYear();
  133. let month = timestamp.getMonth() + 1;
  134. let date = timestamp.getDate();
  135. let hour = timestamp.getHours();
  136. let minute = timestamp.getMinutes();
  137. let second = timestamp.getSeconds();
  138. return (year + "-" + th(month) + "-" + th(date) + " " + th(hour) + ":" + th(minute) + ":" + th(second));
  139. function th(num) {
  140. return num < 10 ? "0" + num : num;
  141. }
  142. },
  143.  
  144. Toast: function(msg, duration) {
  145. duration = isNaN(duration) ? 1000 : duration;
  146. let m = document.createElement('div');
  147. m.innerHTML = msg;
  148. m.style.cssText = "max-width:60%;min-width: 150px;padding:0 14px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999999999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
  149. document.body.appendChild(m);
  150. setTimeout(function() {
  151. let d = 0.5;
  152. m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
  153. m.style.opacity = '0';
  154. setTimeout(function() {
  155. document.body.removeChild(m)
  156. },d * 1000);
  157. },duration);
  158. },
  159.  
  160. movedom: function(domstr){
  161. $(domstr).mousemove(function(e){
  162. $(domstr).unbind("mousedown");
  163. $(domstr).css("cursor","default");
  164. //$("span > b").text(parseInt($("div").width()));
  165. var left = $(domstr).offset().left - $(document).scrollLeft();
  166. var top = $(domstr).offset().top - $(document).scrollTop();
  167.  
  168. // 如果鼠标在中间
  169. if(e.clientX - left > 10 && e.clientX-left < parseInt($(domstr).width()) - 10
  170. && e.clientY - top > 10 && e.clientY-top < 60) {
  171. $(domstr).css("cursor","move");
  172. $(domstr).mousedown(function(e) {
  173. var ismove = true;
  174. var x = e.pageX - $(domstr).offset().left + $(document).scrollLeft();
  175. var y = e.pageY - $(domstr).offset().top + $(document).scrollTop();
  176. $(document).mousemove(function(e) {
  177. if(ismove) {
  178. $(domstr).css({"left":e.pageX - x, "top":e.pageY - y});
  179. }
  180. }).mouseup(function() {
  181. ismove = false;
  182. });
  183. });
  184. }
  185.  
  186. //如果鼠标在左上角
  187. if(e.clientX - left < 10 && e.clientY - top < 10) {
  188. $(domstr).css("cursor","nw-resize");
  189. $(domstr).mousedown(function(e) {
  190. var ismove = true;
  191. var y = e.pageY - $(domstr).offset().top + $(document).scrollTop();
  192. var h = e.pageY + parseInt($(domstr).css("height"));
  193. $(document).mousemove(function(e) {
  194. if(ismove) {
  195. $(domstr).css({"height":h - e.pageY, "top":e.pageY - y});
  196. }
  197. }).mouseup(function() {
  198. ismove = false;
  199. });
  200. });
  201. $(domstr).mousedown(function(e) {
  202. var ismove = true;
  203. var x = e.pageX - $(domstr).offset().left + $(document).scrollLeft();
  204. var w = e.pageX + parseInt($(domstr).css("width"));
  205. $(document).mousemove(function(e) {
  206. if(ismove) {
  207. $(domstr).css({"width":w - e.pageX, "left":e.pageX - x});
  208. }
  209. }).mouseup(function() {
  210. ismove = false;
  211. });
  212. });
  213. };
  214.  
  215. //如果鼠标在上
  216. if(e.clientY - top < 10 && e.clientX - left > 10 && e.clientX-left < parseInt($(domstr).width()) - 10) {
  217. $(domstr).css("cursor","n-resize");
  218. $(domstr).mousedown(function(e) {
  219. var ismove = true;
  220. var y = e.pageY - $(domstr).offset().top + $(document).scrollTop();
  221. var h = e.pageY + parseInt($(domstr).css("height"));
  222. $(document).mousemove(function(e) {
  223. if(ismove) {
  224. $(domstr).css({"height":h - e.pageY, "top":e.pageY - y});
  225. }
  226. }).mouseup(function() {
  227. ismove = false;
  228. });
  229. });
  230. };
  231.  
  232. //如果鼠标在右上角
  233. if(e.clientY - top < 10 && e.clientX-left > parseInt($(domstr).width()) - 10) {
  234. $(domstr).css("cursor","ne-resize");
  235. $(domstr).mousedown(function(e) {
  236. var ismove = true;
  237. var y = e.pageY - $(domstr).offset().top + $(document).scrollTop();
  238. var h = e.pageY + parseInt($(domstr).css("height"));
  239. $(document).mousemove(function(e) {
  240. if(ismove) {
  241. $(domstr).css({"height":h - e.pageY, "top":e.pageY - y});
  242. }
  243. }).mouseup(function() {
  244. ismove = false;
  245. });
  246. });
  247. $(domstr).mousedown(function(e) {
  248. var ismove = true;
  249. var x = e.pageX - $(domstr).offset().left + $(document).scrollLeft();
  250. var w = e.pageX - parseInt($(domstr).css("width"));
  251. $(document).mousemove(function(e) {
  252. if(ismove) {
  253. $(domstr).css({"width":e.pageX - w});
  254. }
  255. }).mouseup(function() {
  256. ismove = false;
  257. });
  258. });
  259. };
  260.  
  261. //如果鼠标在右
  262. if(e.clientX-left > parseInt($(domstr).width()) - 10 && e.clientY - top > 10 && e.clientY-top < parseInt($(domstr).height()) - 10) {
  263. $(domstr).css("cursor","e-resize");
  264. $(domstr).mousedown(function(e) {
  265. var ismove = true;
  266. var x = e.pageX - $(domstr).offset().left + $(document).scrollLeft();
  267. var w = e.pageX - parseInt($(domstr).css("width"));
  268. $(document).mousemove(function(e) {
  269. if(ismove) {
  270. $(domstr).css({"width":e.pageX - w});
  271. }
  272. }).mouseup(function() {
  273. ismove = false;
  274. });
  275. });
  276. };
  277.  
  278. //如果鼠标在右下
  279. if(e.clientX-left > parseInt($(domstr).width()) - 10 && e.clientY-top > parseInt($(domstr).height()) - 10) {
  280. $(domstr).css("cursor","se-resize");
  281. $(domstr).mousedown(function(e) {
  282. var ismove = true;
  283. var x = e.pageX - $(domstr).offset().left + $(document).scrollLeft();
  284. var w = e.pageX - parseInt($(domstr).css("width"));
  285. $(document).mousemove(function(e) {
  286. if(ismove) {
  287. $(domstr).css({"width":e.pageX - w});
  288. }
  289. }).mouseup(function() {
  290. ismove = false;
  291. });
  292. });
  293. $(domstr).mousedown(function(e) {
  294. var ismove = true;
  295. var y = e.pageY - $(domstr).offset().top + $(document).scrollTop();
  296. var h = e.pageY - parseInt($(domstr).css("height"));
  297. $(document).mousemove(function(e) {
  298. if(ismove) {
  299. $(domstr).css({"height":e.pageY - h});
  300. }
  301. }).mouseup(function() {
  302. ismove = false;
  303. });
  304. });
  305. };
  306.  
  307. //如果鼠标在下
  308. if(e.clientY-top > parseInt($(domstr).height()) - 10 && e.clientX - left > 10 && e.clientX-left < parseInt($(domstr).width()) - 10) {
  309. $(domstr).css("cursor","s-resize");
  310. $(domstr).mousedown(function(e) {
  311. var ismove = true;
  312. var y = e.pageY - $(domstr).offset().top + $(document).scrollTop();
  313. var h = e.pageY - parseInt($(domstr).css("height"));
  314. $(document).mousemove(function(e) {
  315. if(ismove) {
  316. $(domstr).css({"height":e.pageY - h});
  317. }
  318. }).mouseup(function() {
  319. ismove = false;
  320. });
  321. });
  322. };
  323.  
  324. //如果鼠标在左下
  325. if(e.clientY-top > parseInt($(domstr).height()) - 10 && e.clientX - left < 10) {
  326. $(domstr).css("cursor","sw-resize");
  327. $(domstr).mousedown(function(e) {
  328. var ismove = true;
  329. var x = e.pageX - $(domstr).offset().left + $(document).scrollLeft();
  330. var w = e.pageX + parseInt($(domstr).css("width"));
  331. $(document).mousemove(function(e) {
  332. if(ismove) {
  333. $(domstr).css({"width":w - e.pageX, "left":e.pageX - x});
  334. }
  335. }).mouseup(function() {
  336. ismove = false;
  337. });
  338. });
  339. $(domstr).mousedown(function(e) {
  340. var ismove = true;
  341. var y = e.pageY - $(domstr).offset().top + $(document).scrollTop();
  342. var h = e.pageY - parseInt($(domstr).css("height"));
  343. $(document).mousemove(function(e) {
  344. if(ismove) {
  345. $(domstr).css({"height":e.pageY - h});
  346. }
  347. }).mouseup(function() {
  348. ismove = false;
  349. });
  350. });
  351. };
  352.  
  353. //如果鼠标在左
  354. if(e.clientX - left < 10 && e.clientY - top > 10 && e.clientY-top < parseInt($(domstr).height()) - 10) {
  355. $(domstr).css("cursor","w-resize");
  356. $(domstr).mousedown(function(e) {
  357. var ismove = true;
  358. var x = e.pageX - $(domstr).offset().left + $(document).scrollLeft();
  359. var w = e.pageX + parseInt($(domstr).css("width"));
  360. $(document).mousemove(function(e) {
  361. if(ismove) {
  362. $(domstr).css({"width":w - e.pageX, "left":e.pageX - x});
  363. }
  364. }).mouseup(function() {
  365. ismove = false;
  366. });
  367. });
  368. }
  369. });
  370. },
  371.  
  372. tianjiawangluojianting:function (callback) {
  373. window.addEventListener('ajaxReadyStateChange', function(e){
  374. // console.log("【整体】:", e.detail);
  375. // console.log("【请求方式】:", e.detail._byted_method);
  376. // console.log("【请求链接】:", e.detail.responseURL);
  377. // console.log("【请求主体】:", e.detail.responseText);
  378. // console.log("【请求数据】:", e.detail._data); // XMLHttpRequest Object
  379. if(e.detail.readyState == 4 && e.detail.status >= 200 && e.detail.status < 300){
  380. callback(e);
  381. }
  382. });
  383. },
  384.  
  385. panduanshuju:function(e){
  386. if(e.detail.responseURL.indexOf("/fxg.jinritemai.com/api/order/searchlist?tab=all") != -1){
  387. let obj = JSON.parse(e.detail.responseText).data;
  388. console.log("监听到的订单数据是:",obj);
  389. dsx.chulidingdanshuju(obj);
  390. dsx.xiaodianming = $(".headerShopName").text();
  391. dsx.jiazaishuju(dsx.xiaodianming,1,10);
  392.  
  393. }else if(e.detail.responseURL.indexOf("/fxg.jinritemai.com/api/order/receiveinfo") != -1){
  394. let obj = JSON.parse(e.detail.responseText).data;
  395. console.log(obj);
  396. if(obj != null){
  397. let id = e.detail.responseURL.match(/order_id=(\d*)&/)[1];
  398. $.each(dsx.shuju, function(i,item){
  399. if(id==item.shop_order_id){
  400. dsx.shuju[i].receiver_info = obj.receive_info;
  401. dsx.shuju[i].user_nickname = obj.nick_name;
  402. dsx.chongxinhuizhibiaoge(dsx.shuju);
  403. return;
  404. };
  405. });
  406. }
  407. };
  408. /* else if(e.detail.responseURL.indexOf("https://mcs.snssdk.com/v1/list") != -1){//小店信息
  409. //console.log($.parseJSON( e.detail._data ));
  410. try{
  411. let obj = $.parseJSON($.parseJSON(e.detail._data)[0].events[0].params);
  412. if(obj.shop_name != undefined && obj.toutiao_id != undefined && obj.shop_name != ""){
  413. console.log(obj.shop_name,"-",obj.toutiao_id);
  414. dsx.xiaodianming = obj.shop_name;
  415. dsx.xiaodianID = obj.toutiao_id;
  416. };
  417. }catch(e){
  418. console.log("获取店名失败",e);
  419. };
  420.  
  421. }; */
  422. },
  423.  
  424.  
  425. shuju:{},
  426.  
  427. saveshuju:function(obj){
  428. GM_setValue("dingdanshuju", obj);
  429. },
  430.  
  431. getshuju:function(){
  432. dsx.shuju = GM_getValue("dingdanshuju", "没有储存数据");
  433. return dsx.shuju;
  434. },
  435.  
  436. tiqushuju:function(obj,i) {
  437. let kehunicheng = obj[i].user_nickname;
  438. let dingdanjine = obj[i].pay_amount / 100;
  439. let dingdanzhuangtai = obj[i].order_status_info.order_status_text;
  440. let xiadanshijian = this.formatDate(obj[i].create_time);
  441. let dingdanbianhao = obj[i].shop_order_id;
  442. let lianjiebiaoti = obj[i].product_item[0].product_name;
  443. /* let daihuodaren;
  444. let kehushoujianren;
  445. try{kehushoujianren = obj[i].receiver_info.post_receiver}catch(e){kehushoujianren = "没有"};
  446. let shoujihao = obj[i].receiver_info.post_tel;
  447. let dizhi = obj[i].receiver_info.post_addr.province.name + obj[i].receiver_info.post_addr.city.name + obj[i].receiver_info.post_addr.town.name + obj[i].receiver_info.post_addr.street.name;
  448. try{daihuodaren = obj[i].product_item[0].properties[2].text}catch(e){daihuodaren = "没有"}; */
  449. return {kehunicheng:kehunicheng,dingdanjine:dingdanjine,dingdanzhuangtai:dingdanzhuangtai,xiadanshijian:xiadanshijian,dingdanbianhao:dingdanbianhao,lianjiebiaoti:lianjiebiaoti};
  450. },
  451.  
  452. duquhuizhidingdanshuju:function(){
  453. let obj = dsx.getshuju();
  454. if(obj != "没有储存数据"){
  455. dsx.shaixuanshujuhuizhibiaoge(obj);
  456. };
  457. },
  458.  
  459. shaixuanshujuhuizhibiaoge:function(obj){
  460. let shuzu = [];
  461. let dlength = obj.length;
  462. for (let i = 0; i < dlength; i++) {
  463. let d = dsx.tiqushuju(obj,i);
  464. shuzu[i] = [dlength-i,d.kehunicheng,d.dingdanjine,d.dingdanzhuangtai,d.xiadanshijian,d.lianjiebiaoti,d.dingdanbianhao];
  465. };
  466. dsx.huizhibiaoge([{ title: "序号" },{ title: "昵称" },{ title: "金额" },{ title: "状态" },{ title: "下单时间" },{ title: "链接标题" },{ title: "订单编号" }],shuzu);
  467. },
  468.  
  469.  
  470. dashixiongtimer: 300000,
  471.  
  472. shifouyincangbiaoge: false,
  473.  
  474. table:{},
  475.  
  476. huizhibiaoge : function(datehead,dataSet) {
  477. dsx.saveshuju(dsx.shuju);
  478. dsx.table = $('#dashixiongtable').DataTable({
  479. data: dataSet,
  480. columns: datehead,
  481. oLanguage: {
  482. "sLengthMenu": "每页显示 _MENU_ 条记录",
  483. "sZeroRecords": "对不起,查询不到任何相关数据",
  484. "sInfo": "当前显示 _START_ 到 _END_ 条,共 _TOTAL_条记录",
  485. "sInfoEmtpy": "找不到相关数据",
  486. "sInfoFiltered": " 数据表中共为 _MAX_ 条记录",
  487. "sProcessing": "正在加载中...",
  488. "sSearch": "搜索",
  489. "oPaginate": {
  490. "sFirst": "第一页",
  491. "sPrevious": " 上一页 ",
  492. "sNext": " 下一页 ",
  493. "sLast": " 最后一页 "
  494. },
  495. },
  496. order:[4,"desc"],
  497. scrollX: true,
  498. scrollY: $(window).height() - 300,
  499. scrollCollapse: true,//滚动折叠
  500. paging: false,
  501. createdRow: function ( row, data, index ) {
  502. if ( data[2] * 1 >= 396 ) {
  503. $('td', row).eq(2).css('font-weight',"bold").css("color","red");
  504. }
  505. }
  506.  
  507. });
  508. $("#dashixiongtable_filter").before($('<button id="dashixiongbiaogeyincang" display="[object Object]" type="button" class="auxo-btn auxo-btn-default auxo-btn-sm index_button__fQrwe"><span>表格固定</span></button>'));
  509. $("#dashixiongtable_filter").before($('<label style="border: 1px solid #dcdee1; border-radius: 4px; padding: 6px 12px; height: 28px; font-size: 12px; vertical-align: middle; line-height: 14px; color: #252931;">每隔<select id="dashixiongtimer"><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>10</option><option>30</option><option>60</option><option>120</option></select>分钟刷新表格</label>'));
  510. console.log("表格对象",dsx.table);
  511. },
  512.  
  513. chongxinhuizhibiaoge: function (obj) {
  514. dsx.saveshuju(dsx.shuju);
  515. let shuzu = [];
  516. let dlength = obj.length;
  517. for (let i = 0; i < dlength; i++) {
  518. let d = dsx.tiqushuju(obj,i);
  519. shuzu[i] = [dlength-i,d.kehunicheng,d.dingdanjine,d.dingdanzhuangtai,d.xiadanshijian,d.lianjiebiaoti,d.dingdanbianhao];
  520. };
  521. //dsx.table.data(shuzu).draw();
  522. dsx.table.clear().rows.add(shuzu).draw();
  523. /* $(".dataTables_scrollHead").onload=function(){
  524. let aa = $(".dataTables_scrollBody tbody").width();
  525. $(".dataTables_scrollHead").css("cssText", "width:" + aa + "px !important;");
  526. //$(".dataTables_scrollHead").width($(".dataTables_scrollBody tbody").width());
  527. }; */
  528. },
  529.  
  530. chulidingdanshuju : function(obj) {
  531. if(!($("#dashixiongtable tbody tr").length > 0)){
  532. //第一次运行
  533. dsx.shaixuanshujuhuizhibiaoge(obj);
  534. dsx.shuju = obj;
  535. dsx.saveshuju(dsx.shuju);
  536. //setTimeout(function(){dsx.huoqudizhi()},2000);
  537. //dsx.sleep(3000);
  538. location.reload();
  539. }else{
  540. dsx.gengxinshuju(obj);
  541. }
  542. },
  543.  
  544. gengxinshuju : function(obj) {
  545. let result;
  546. //obj.sort((a,b) => {return b.exp_ship_time - a.exp_ship_time});
  547. $.each(obj, function(obji, objitem){
  548. result = false;
  549. $.each(dsx.shuju, function(i, shujuitem){
  550. if (dsx.shuju[i].shop_order_id == objitem.shop_order_id) {
  551. //console.log(shujuitem);
  552. objitem.receiver_info = shujuitem.receiver_info;
  553. objitem.user_nickname = shujuitem.user_nickname;
  554. dsx.shuju[i] = objitem;
  555. result = true;
  556. return;
  557. };
  558. });
  559. if (!result){
  560. dsx.shuju.unshift(objitem);
  561. //dsx.huoqudizhi(objitem.shop_order_id);//点击敏感信息
  562. setTimeout(function(){dsx.huoqudizhi(objitem.shop_order_id)},obji * 2000);
  563. };
  564.  
  565. });
  566. dsx.shuju = dsx.shuju.sort((a,b) => {return b.exp_ship_time - a.exp_ship_time});
  567. dsx.chongxinhuizhibiaoge(dsx.shuju);
  568. dsx.Toast("更新完毕");
  569. },
  570.  
  571. huoqudizhi:function(id) {
  572. if(id){
  573. $(".index_content__3R2D9").each(function(){
  574. if($(this).text().indexOf(id)>-1){
  575. let zhudom = $(this).parent().parent().parent().parent().parent().parent();
  576. let ydom = zhudom.find(".index_viewIconWrapper__1pa53").find("a").find("span");
  577. if(ydom.length > 0 && zhudom.text().indexOf("已关闭") == -1){
  578. ydom.click();
  579. };
  580. return;
  581. }
  582. });
  583. }else{
  584. $(".index_content__3R2D9").each(function(){
  585. let zhudom = $(this).parent().parent().parent().parent().parent().parent();
  586. let ydom = zhudom.find(".index_viewIconWrapper__1pa53").find("a").find("span");
  587. if(ydom.length > 0 && zhudom.text().indexOf("已关闭") == -1){
  588. ydom.click();
  589. };
  590. });
  591. }
  592. },
  593.  
  594. sleep: function(time) {
  595. let startTime = new Date().getTime() + parseInt(time, 10);
  596. while(new Date().getTime() < startTime) {}
  597. },
  598.  
  599. dizhixianshi:function() {
  600. let nicname,name,tel,dizhi;
  601. let id = $(this).parent().children().eq(6).text();
  602. $.each(dsx.shuju, function(i, item){
  603. if(id==item.shop_order_id){
  604. nicname = item.user_nickname;
  605. name = item.receiver_info.post_receiver;
  606. tel = item.receiver_info.post_tel;
  607. dizhi = item.receiver_info.post_addr.province.name + item.receiver_info.post_addr.city.name + item.receiver_info.post_addr.town.name + item.receiver_info.post_addr.street.name + item.receiver_info.post_addr.detail;
  608. };
  609. });
  610. $("#dashixiongdizhi div:nth-child(1)").html(nicname);
  611. $("#dashixiongdizhi div:nth-child(2)").html(name + "," + tel + "," + dizhi);
  612. let X = $(this).offset().top - $(document).scrollTop() - $("#dashixiongdizhi").outerHeight();
  613. let Y = $(this).parent().offset().left - $(document).scrollLeft();
  614. $("#dashixiongdizhi").css({"top": X , "left": Y}).show();
  615. $(this).parent().css("background-color", "rgba(200, 200, 200, 0.9)");
  616. $(this).on("mouseleave", function(e) {
  617. $("#dashixiongdizhi").hide();
  618. $(this).parent().css("background-color", "rgba(255, 255, 255, 1)");
  619. });
  620. },
  621.  
  622. dingshiqiid:0,
  623.  
  624. duqushezhi:function(){
  625. let time = GM_getValue("dashixiongtimer","无");
  626. if(time == "无"){
  627. GM_setValue("dashixiongtimer",300000);
  628. $('#dashixiongtimer').val(5);
  629. }else{
  630. $('#dashixiongtimer').val(time/60000);
  631. dsx.dashixiongtimer = time;
  632. }
  633.  
  634. dsx.shifouyincangbiaoge = GM_getValue("shifouyincangbiaoge","无");
  635. if(dsx.shifouyincangbiaoge == "无"){
  636. GM_setValue("shifouyincangbiaoge",false)
  637. dsx.shifouyincangbiaoge = false;
  638. }
  639. },
  640.  
  641. xiangyingshijian : function () {
  642. $("#dashixiongXuanFu").click(function() {
  643. $(".auxo-btn.auxo-btn-primary.auxo-btn-sm").click();
  644. });
  645. $("#dashixiongXuanFu").mouseenter(function() {
  646. $("#dashixiongDIV").stop(true, false).show();
  647. });
  648. $("#dashixiong-main").mouseleave(function() {
  649. if(dsx.shifouyincangbiaoge){
  650. $("#dashixiongDIV").stop(true, false).hide();
  651. }
  652. });
  653. $("body").on("mouseenter", "#dashixiongtable>tbody tr td:nth-child(2)",dsx.dizhixianshi);
  654.  
  655. $("#dashixiongbiaogeyincang").on("click",function(){
  656. if(dsx.shifouyincangbiaoge){
  657. dsx.Toast("已固定表格");
  658. dsx.shifouyincangbiaoge = false;
  659. GM_setValue("shifouyincangbiaoge",false);
  660. }else{
  661. dsx.Toast("鼠标离开表格自动隐藏");
  662. dsx.shifouyincangbiaoge = true;
  663. GM_setValue("shifouyincangbiaoge",true);
  664. };
  665. });
  666.  
  667. $('#dashixiongtimer').change(function() {
  668. dsx.dashixiongtimer = $(this).val() * 60 *1000;
  669. GM_setValue("dashixiongtimer",$(this).val() * 60 *1000);
  670. window.clearInterval(dsx.dingshiqiid);
  671. dsx.dingshiqiid = window.setInterval(function() {
  672. $(".auxo-btn.auxo-btn-primary.auxo-btn-sm").click();
  673. },dsx.dashixiongtimer);
  674. });
  675.  
  676. dsx.dingshiqiid = window.setInterval(function() {
  677. $(".auxo-btn.auxo-btn-primary.auxo-btn-sm").click();
  678. },dsx.dashixiongtimer);
  679. },
  680.  
  681. addhtml:function(){
  682. let a = `
  683. <div id="dashixiong-main">
  684. <div id="dashixiongXuanFu"></div>
  685. <div id="dashixiongDIV">
  686. <table id="dashixiongtable"></table>
  687. </div>
  688. </div>
  689. <div id="dashixiongdizhi">
  690. <div></div>
  691. <div></div>
  692. </div>
  693. `;
  694. $("body").eq(0).prepend(a);
  695. },
  696.  
  697. addcss:function(){
  698. let css = `
  699. /* 悬浮标 */
  700. #dashixiongXuanFu {
  701. position: fixed;
  702. top: 60px;
  703. right: 10px;
  704. text-align: center;
  705. z-index: 9999;
  706. cursor: pointer;
  707. vertical-align: middle;
  708. margin-top: 4px;
  709. height: 34px;
  710. width: 34px;
  711. line-height: 34px;
  712. display: inline-block;
  713. border-radius: 50px;
  714. background-color: rgba(0, 0, 0, 0.5);
  715. }
  716.  
  717. #dashixiongDIV {
  718. position: fixed;
  719. width: 600px;
  720. top: 10px;
  721. right: 0px;
  722. z-index: 9998;
  723. margin-top: 4px;
  724. /* line-height: 34px; */
  725. border-radius: 15px;
  726. border: 1px solid #dcdee1;
  727. background-color: rgba(255, 255, 255, 1);
  728. color: #000;
  729. font-size: 15px;
  730. padding: 15px 15px;
  731. overflow-x: auto;
  732. overflow-y: auto;
  733. }
  734.  
  735. #dashixiongtable {
  736. width: 100%;
  737. height: 100%;
  738. white-space: nowrap;
  739. -webkit-overflow-scrolling: touch; /*移动端手指滚动更流畅*/
  740. }
  741.  
  742. #dashixiongdizhi{
  743. display: none;
  744. pointer-events:none;
  745. position: fixed;
  746. width: 186px;
  747. text-align: left;
  748. z-index: 9999;
  749. border-radius: 3px;
  750. background-color: rgba(200, 200, 200, 0.9);
  751. color: #000;
  752. font-size: 12px;
  753. line-height: 16px;
  754. padding: 10px 10px;
  755. }
  756. `;
  757. GM_addStyle(css);
  758. //$("body").eq(0).prepend(a);
  759. },
  760.  
  761. addscript : function(){
  762. let a = `
  763. <script>
  764. (function () {
  765. function ajaxEventTrigger(event) {
  766. var ajaxEvent = new CustomEvent(event, { detail: this });
  767. window.dispatchEvent(ajaxEvent);
  768. }
  769. var oldXHR = window.XMLHttpRequest;
  770. function newXHR() {
  771. var realXHR = new oldXHR();
  772.  
  773. realXHR.addEventListener('abort', function () { ajaxEventTrigger.call(this, 'ajaxAbort'); }, false);
  774.  
  775. realXHR.addEventListener('error', function () { ajaxEventTrigger.call(this, 'ajaxError'); }, false);
  776.  
  777. realXHR.addEventListener('load', function () { ajaxEventTrigger.call(this, 'ajaxLoad'); }, false);
  778.  
  779. realXHR.addEventListener('loadstart', function () { ajaxEventTrigger.call(this, 'ajaxLoadStart'); }, false);
  780.  
  781. realXHR.addEventListener('progress', function () { ajaxEventTrigger.call(this, 'ajaxProgress'); }, false);
  782.  
  783. realXHR.addEventListener('timeout', function () { ajaxEventTrigger.call(this, 'ajaxTimeout'); }, false);
  784.  
  785. realXHR.addEventListener('loadend', function () { ajaxEventTrigger.call(this, 'ajaxLoadEnd'); }, false);
  786.  
  787. realXHR.addEventListener('readystatechange', function() { ajaxEventTrigger.call(this, 'ajaxReadyStateChange'); }, false);
  788.  
  789. return realXHR;
  790. };
  791. window.XMLHttpRequest = newXHR;
  792. })();
  793. </script>`;
  794. $("body").eq(0).prepend(a);
  795.  
  796. }
  797.  
  798.  
  799. };
  800. //GM_deleteValue("dingdanshuju");
  801. //console.log("读取数据",dsx.getshuju());
  802. dsx.addhtml();
  803. dsx.addcss();
  804. dsx.addscript();
  805. dsx.duquhuizhidingdanshuju();
  806. dsx.duqushezhi();
  807. dsx.tianjiawangluojianting((d) => {dsx.panduanshuju(d)});
  808. dsx.xiangyingshijian();
  809. dsx.movedom("#dashixiongDIV");
  810.  
  811. $(window).bind('beforeunload', function () {
  812. dsx.baocunshuju(dsx.shuju);
  813. return '您输入的内容尚未保存,确定离开此页面吗?';
  814. });
  815.  
  816. /*
  817. $(document).ready(function(){
  818. alert("ready() 加载完成!!");
  819. });
  820.  
  821.  
  822. $(window).bind('beforeunload', function () {
  823. dsx.baocunshuju(dsx.shuju);
  824. return '您输入的内容尚未保存,确定离开此页面吗?';
  825. });
  826.  
  827. window.onbeforeunload=function(){
  828. alert("网页刷新了");
  829. dsx.baocunshuju(dsx.shuju);
  830. return "你确定要离开吗?";
  831. };
  832. window.addEventListener("beforeunload", function (e) {
  833. var confirmationMessage = '确定离开此页吗?本页不需要刷新或后退';
  834. (e || window.event).returnValue = confirmationMessage; // Gecko and Trident
  835. return confirmationMessage; // Gecko and WebKit
  836. });
  837. if (window.onurlchange === null) {
  838. // feature is supported
  839. window.addEventListener('urlchange', (info) => console.log(info));
  840. } */
  841.  
  842.  
  843. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址