淘宝天猫阿里巴巴子账号页增强

统计询盘量,增加旺旺跳转功能等

  1. // ==UserScript==
  2. // @icon https://www.thfou.com/img/favicon.png
  3. // @name 淘宝天猫阿里巴巴子账号页增强
  4. // @namespace https://www.thfou.com/
  5. // @version 1.1.1
  6. // @description 统计询盘量,增加旺旺跳转功能等
  7. // @author 头号否
  8. // @match *://zzh.1688.com/subaccount/monitor/*
  9. // @match *://zizhanghao.taobao.com/subaccount/monitor/*
  10. // @require https://libs.baidu.com/jquery/1.10.2/jquery.min.js
  11. // @supportURL https://www.thfou.com/liuyan
  12. // @compatible Chrome
  13. // @compatible Firefox
  14. // @compatible Edge
  15. // @compatible Safari
  16. // @compatible Opera
  17. // @compatible UC
  18. // @license GPL-3.0-only
  19. // ==/UserScript==
  20.  
  21. (function() {
  22. 'use strict';
  23. var style = document.createElement('style');
  24. style.type = 'text/css';
  25. style.innerHTML="#thfou_xpl{padding:10px;}.kj{float: left; width: 295px;border-right: 1px solid #ececec;}.kjtitle{float: left; width: 100%; height: 30px;}.kjdata{font-size: 28px;color: #333;text-align: center;}.h-wrap{height:65px!important;}.wwuid{width:390px;}";
  26. document.getElementsByTagName('HEAD').item(0).appendChild(style);
  27.  
  28. var btn = document.createElement('button');
  29. btn.id = 'getdata';
  30. btn.className = 'ui-btn ui-btn-gray btn-search';
  31. btn.innerText = '高级查询';
  32. $('.btn-wrap').append(btn);
  33. $('#getdata').click(function(){
  34. $('#J_SearchBtn').click();
  35. $('#sjtzm').click();
  36. });
  37.  
  38. var urlpd = document.domain;
  39. var surl = urlpd.split('.')[0];
  40.  
  41. var wwbtn = document.createElement('button');
  42. wwbtn.id = 'wwbtn';
  43. wwbtn.className = 'ui-btn ui-btn-gray btn-search';
  44. wwbtn.innerText = '联系旺旺';
  45. $('.btn-wrap').append(wwbtn);
  46. $('#wwbtn').click(function(){
  47. var wwtext = document.getElementById('types');
  48. var index = wwtext.selectedIndex;
  49. var zhid = wwtext.options[index].text;
  50. var nick = zhid;
  51. if(nick == ''){
  52. alert('请先点击"高级查询"');
  53. } else if ( surl == 'zzh' ) {
  54. window.open('https://amos.alicdn.com/getcid.aw?spm=a360q.8234005.0.0.43727ac4nMsvXO&v=3&groupid=0&s=1&charset=utf-8&uid=' + nick + '&site=cnalichn&fromid=cnalichn');
  55. } else if ( surl == 'zizhanghao' ) {
  56. var nicks = encodeURI(nick);
  57. window.open('https://amos.alicdn.com/getcid.aw?spm=a1z09.1.0.0.6f903606LqQDvI&v=3&groupid=0&s=1&charset=utf-8&uid=' + nicks + '&site=cntaobao&fromid=cntaobao');
  58. }
  59. });
  60.  
  61. function aliwwdata(){
  62. var all = document.getElementById('J_CustomerList').innerText;
  63. if(all == ''){
  64. $('#types option').remove();
  65. document.getElementsByClassName('kjdata')[0].innerText = '0';
  66. }else{
  67. $('#types option').remove();
  68. var aliww = document.querySelectorAll('#J_CustomerList li');
  69. for(var i = 0; i<aliww.length; i++){
  70. aliww[i].index = i;
  71. var aliuid = aliww[i].innerText;
  72. var zhinfo = '<option value="' + aliww[i].index + '">' + aliuid + '</option>';
  73. $('#thfou_wwh select').append(zhinfo);
  74. }
  75.  
  76. if ( surl == 'zzh' ) {
  77. var alixpl = aliww.length-1;
  78. var alidata = document.createElement('div');
  79. alidata.innerHTML = '<div class="control-wrap btn-wrap h-wrap"><div id="thfou_xpl" class="kj"><span class="kjtitle">询盘量</span><span class="kjdata">' + alixpl + '</span></div></div>';
  80. $('.fm-search').append(alidata);
  81. $('#zzhdata').html(alidata);
  82. } else if ( surl == 'zizhanghao' ) {
  83. var tbxpl = aliww.length;
  84. var tbdata = document.createElement('div');
  85. tbdata.innerHTML = '<div class="control-wrap btn-wrap h-wrap"><div id="thfou_xpl" class="kj"><span class="kjtitle">询盘量</span><span class="kjdata">' + tbxpl + '</span></div></div>';
  86. $('.fm-search').append(tbdata);
  87. $('#zzhdata').html(tbdata);
  88. }
  89. }
  90. }
  91.  
  92. var kjdata = document.createElement('div');
  93. kjdata.id = 'zzhdata';
  94. kjdata.innerHTML = '<div class="control-wrap btn-wrap h-wrap"><div id="thfou_xpl" class="kj"><span class="kjtitle">询盘量</span><span class="kjdata">0</span></div></div>';
  95. $('.fm-search').append(kjdata);
  96.  
  97. var dumpww = document.createElement('div');
  98. dumpww.id = 'thfou_wwh';
  99. dumpww.className = 'control-wrap ipt-wrap';
  100. dumpww.innerHTML = '<label class="lb-title">旺旺号:</label><select id="types" name="types" class="wwuid"><option value=""></option></select>';
  101. $('.fm-search .btn-wrap')[0].before(dumpww);
  102.  
  103. var tips = document.createElement('span');
  104. tips.className = 'help-inline';
  105. tips.style = 'display:block;';
  106. tips.innerHTML = '<b class="red">* </b>' + '请先选择旺旺号,再点击下面“联系旺旺”';
  107. $('#thfou_wwh').append(tips);
  108.  
  109. var sjtzm = document.createElement('span');
  110. sjtzm.id = 'sjtzm';
  111. sjtzm.className = 'help-inline';
  112. sjtzm.style = 'display:block;';
  113. sjtzm.innerHTML = '<div onclick="sjtzms();">数据统计模块,头号否提供技术支持</div>';
  114. $('.btn-wrap')[0].append(sjtzm);
  115.  
  116. var sjtzls = document.getElementById('sjtzm');
  117. sjtzls.addEventListener('click', sjtzms, false);
  118. function sjtzms() {
  119. setTimeout (function () {
  120. aliwwdata();
  121. },100);
  122. }
  123. })();