analysis.system.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <style>
  2. #checkChannel {
  3. border-spacing: 0;
  4. border-collapse: collapse;
  5. }
  6. #checkChannel td {
  7. height: 20px;
  8. padding: 2px;
  9. background: #F3FBFE;
  10. border: 1px solid #fff;
  11. display: block;
  12. white-space: nowrap;
  13. font-size: 10px;
  14. }
  15. #checkChannel tr {
  16. height: 20px;
  17. }
  18. #checkChannel thead tr {
  19. table-layout: fixed;
  20. top: 0;
  21. left: 0;
  22. }
  23. #checkChannel tbody {
  24. height: calc(100vh - 150px);
  25. display: block;
  26. overflow-y: scroll;
  27. }
  28. .echartsContent {
  29. display: flex;
  30. height: calc(100vh - 150px);
  31. }
  32. #echart {
  33. flex: 1;
  34. margin-left: 5px;
  35. }
  36. #echart img {
  37. width: 100%;
  38. }
  39. </style>
  40. <div class="page">
  41. <div class="fixed-bar">
  42. <div class="item-title">
  43. <h3>成功率监控列表</h3>
  44. <ul class="tab-base">
  45. <li><a href="?index.php&act=refill_analysis&op=index&type=provider"><span>通道按时段成功率监控</span></a></li>
  46. <li><a href="?index.php&act=refill_analysis&op=index&type=provider_speed"><span>通道单量与成功率监控</span></a></li>
  47. <li><a href="?index.php&act=refill_analysis&op=new_version&type=provider_succs"><span>通道按时段成功单量监控</span></a></li>
  48. <li><a href="?index.php&act=refill_analysis&op=new_version&type=provider"><span>通道累计成功率监控</span></a></li>
  49. <li><a href="?index.php&act=refill_analysis&op=index&type=network"><span>通道网络监控</span></a></li>
  50. <li><a href="JavaScript:void(0);" class="current"><span>机构成功率监控</span></a></li>
  51. <li><a href="?index.php&act=refill_analysis&op=new_version&type=system"><span>机构累计成功率监控</span></a></li>
  52. <li><a href="?index.php&act=refill_analysis&op=merchant_ratios"><span>机构成功率统计</span></a></li>
  53. <li><a href="?index.php&act=refill_analysis&op=new_version&type=mch_order_send"><span>机构单量监控</span></a></li>
  54. </ul>
  55. </div>
  56. </div>
  57. <div class="fixed-empty"></div>
  58. <!-- <div style="margin-top: 10px;color: #e60d0d;">
  59. 请先选择时间
  60. </div> -->
  61. <form method="get" action="index.php" name="formSearch" id="formSearch" style="min-width: 1200px;">
  62. <table class="tb-type1 noborder search tableFixed">
  63. <tr>
  64. <th><label for="query_start_time">统计时间</label></th>
  65. <td>
  66. <input class="txt date" type="text" value="<?php echo $_GET['query_start_time']; ?>" id="startTime" name="query_start_time" autocomplete="off" style="width:120px" />
  67. <label for="query_start_time">~</label>
  68. <input class="txt date" type="text" value="<?php echo $_GET['query_end_time']; ?>" id="endTime" name="query_end_time" autocomplete="off" style="width:120px" />
  69. </td>
  70. <!-- <th><label>机构选择</label></th>
  71. <td>
  72. <div id="select_merchants"></div>
  73. </td> -->
  74. <th><label>卡类型</label></th>
  75. <td>
  76. <div id="select_cardtypes"></div>
  77. </td>
  78. <th><label>面额</label></th>
  79. <td>
  80. <select name="amount">
  81. <option value=""><?php echo $lang['nc_please_choose']; ?></option>
  82. <option value="10" <?php if ($_GET['refill_amount'] == '10') { ?>selected<?php } ?>>10</option>
  83. <option value="20" <?php if ($_GET['refill_amount'] == '20') { ?>selected<?php } ?>>20</option>
  84. <option value="30" <?php if ($_GET['refill_amount'] == '30') { ?>selected<?php } ?>>30</option>
  85. <option value="50" <?php if ($_GET['refill_amount'] == '50') { ?>selected<?php } ?>>50</option>
  86. <option value="100" <?php if ($_GET['refill_amount'] == '100') { ?>selected<?php } ?>>100</option>
  87. <option value="200" <?php if ($_GET['refill_amount'] == '200') { ?>selected<?php } ?>>200</option>
  88. <option value="300" <?php if ($_GET['refill_amount'] == '300') { ?>selected<?php } ?>>300</option>
  89. <option value="500" <?php if ($_GET['refill_amount'] == '500') { ?>selected<?php } ?>>500</option>
  90. <option value="1000" <?php if ($_GET['refill_amount'] == '1000') { ?>selected<?php } ?>>1000</option>
  91. <option value="2000" <?php if ($_GET['refill_amount'] == '2000') { ?>selected<?php } ?>>2000</option>
  92. </select>
  93. </td>
  94. <th><label>窗口时长</label></th>
  95. <td>
  96. <select name="filter_wave">
  97. <option value=""><?php echo $lang['nc_please_choose']; ?></option>
  98. <option value="900">15分钟</option>
  99. <option value="1800">半小时</option>
  100. <option value="3600">1小时</option>
  101. <option value="7200">2小时</option>
  102. <option value="0" selected>关闭</option>
  103. </select>
  104. </td>
  105. <th><label>数据筛选</label></th>
  106. <td>
  107. <select name="show_all">
  108. <option value=""><?php echo $lang['nc_please_choose']; ?></option>
  109. <option value="1">只看all</option>
  110. </select>
  111. </td>
  112. <td>
  113. <a href="javascript:void(0);" id="ncsubmit" class="btn-search" title="<?php echo $lang['nc_query']; ?>">&nbsp;
  114. </a>
  115. </td>
  116. </tr>
  117. </table>
  118. </form>
  119. <div class="echartsContent">
  120. <table id="checkChannel">
  121. <thead>
  122. <tr>
  123. <td>
  124. <label>
  125. <input type="checkbox" id="checkAllChannel">
  126. 编号(机构列表)
  127. </label>
  128. </td>
  129. </tr>
  130. </thead>
  131. <tbody id="checkChannelContent">
  132. </tbody>
  133. </table>
  134. <div id="echart">
  135. </div>
  136. </div>
  137. <div id="box">
  138. <!-- <iframe
  139. src="https://www.xyzshops.cn/plot/index?time_stamp=1621488600&interval=60" scrolling="no" id="Iframe" frameborder="0"></iframe> -->
  140. </div>
  141. </div>
  142. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></script>
  143. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
  144. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/i18n/zh-CN.js" charset="utf-8"></script>
  145. <script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL; ?>/js/xm-select.js"></script>
  146. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/refill/layer.js"></script>
  147. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/refill/moment-with-locales.js"></script>
  148. <link rel="stylesheet" type="text/css" href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css" />
  149. <script type="text/javascript">
  150. $(function() {
  151. let ratios = [];
  152. let qualitys = [];
  153. laydate.render({
  154. elem: '#startTime',
  155. type: 'datetime'
  156. });
  157. laydate.render({
  158. elem: '#endTime',
  159. type: 'datetime'
  160. });
  161. function formatChannelTable(tableData) {
  162. $('#checkChannelContent').children().remove();
  163. let data;
  164. if (typeof tableData == 'object') {
  165. data = tableData;
  166. } else {
  167. data = JSON.parse(tableData)
  168. }
  169. let tableHTML = '';
  170. data.map(item => {
  171. tableHTML += `
  172. <tr>
  173. <td><label><input type="checkbox" name="channelValue" ${item.checked?'checked="checked"':''} value="${item.value}" />${item.name}${item.ratio?`<span style="color:red;">(${item.ratio})</span>`:''}</label></td>
  174. </tr>
  175. `;
  176. })
  177. $('#checkChannelContent').append(tableHTML);
  178. }
  179. function updateQualityTable() {
  180. const allQualityList = JSON.parse(JSON.stringify(qualitys));
  181. allQualityList.map(item => {
  182. item.checked = false;
  183. })
  184. function findItem(value) {
  185. const item = allQualityList.filter(item => {
  186. return item.value == value;
  187. })
  188. if (item.length > 0) {
  189. return item[0].name
  190. }
  191. return false
  192. }
  193. const ratioList = ratios.map(item => {
  194. return {
  195. name: findItem(item.split(':')[0]) || item.split(':')[0],
  196. value: item.split(':')[0],
  197. ratio: item.split(':')[1],
  198. checked: parseFloat(item.split(':')[1]) == 0 ? false : true
  199. }
  200. });
  201. let mergeQualitys = [...ratioList, ...allQualityList];
  202. const newArr = [];
  203. const obj = {};
  204. for (let i = 0; i < mergeQualitys.length; i++) {
  205. if (!obj[mergeQualitys[i].value]) {
  206. newArr.push(mergeQualitys[i]);
  207. obj[mergeQualitys[i].value] = true;
  208. }
  209. }
  210. formatChannelTable(newArr);
  211. }
  212. // let select_merchants
  213. $.get('index.php?act=refill_analysis&op=merchant_data', function(data) {
  214. data = JSON.parse(data)
  215. qualitys = data;
  216. formatChannelTable(data)
  217. // select_merchants = xmSelect.render({
  218. // el: '#select_merchants',
  219. // size: 'mini',
  220. // filterable: true,
  221. // style: {
  222. // minHeight: '27px',
  223. // lineHeight: '27px',
  224. // marginLeft: '4px',
  225. // width: '250px'
  226. // },
  227. // language: 'zn',
  228. // data: data
  229. // })
  230. })
  231. let select_cardtypes
  232. $.get('index.php?act=refill_analysis&op=card_type_data', function(data) {
  233. data = JSON.parse(data)
  234. select_cardtypes = xmSelect.render({
  235. el: '#select_cardtypes',
  236. size: 'mini',
  237. filterable: true,
  238. style: {
  239. minHeight: '27px',
  240. lineHeight: '27px',
  241. marginLeft: '4px',
  242. width: '250px'
  243. },
  244. language: 'zn',
  245. data: data
  246. })
  247. })
  248. function select_set(selectArr) {
  249. let selectStr = ''
  250. for (let i = 0; i < selectArr.length; i++) {
  251. selectStr += selectArr[i].value + ','
  252. }
  253. selectStr = selectStr.substr(0, selectStr.length - 1)
  254. return selectStr
  255. }
  256. $('#checkAllChannel').click(function() {
  257. if ($(this).get(0).checked) {
  258. $('input[name="channelValue"]').attr('checked', 'checked')
  259. } else {
  260. $('input[name="channelValue"]').removeAttr('checked')
  261. }
  262. })
  263. $('#ncsubmit').click(function() {
  264. let query_start_time = $("input[name=query_start_time]").val()
  265. let start_time = parseInt((new Date(query_start_time)).getTime() / 1000);
  266. let query_end_time = $("input[name=query_end_time]").val()
  267. let end_time = parseInt((new Date(query_end_time)).getTime() / 1000);
  268. if (!start_time && !end_time) {
  269. start_time = Date.parse(new Date()) / 1000 - 7200;
  270. end_time = Date.parse(new Date()) / 1000;
  271. }
  272. // let mchids = select_set(select_merchants.getValue())
  273. let mchidList = [];
  274. $('input[name="channelValue"]').each(function() {
  275. if ($(this).attr('checked')) {
  276. mchidList.push($(this).attr('value'))
  277. }
  278. })
  279. let mchids = mchidList.join(',');
  280. let card_types = select_cardtypes && select_set(select_cardtypes.getValue())
  281. let spec = $("select[name=amount]").val()
  282. let filter_wave = $("select[name=filter_wave]").val()
  283. let show_all = $("select[name=show_all]").val()
  284. let src = window.location.origin + "/plot/mch_covratio?"
  285. if (start_time) {
  286. src += "&start_time=" + start_time;
  287. }
  288. if (end_time) {
  289. if (end_time < start_time || !start_time) {
  290. layer.msg('日期有误,结束日期需大于开始日期');
  291. return
  292. }
  293. src += "&end_time=" + end_time;
  294. }
  295. if (mchids) {
  296. src += "&mchids=" + mchids;
  297. }
  298. if (card_types) {
  299. src += "&card_types=" + card_types;
  300. }
  301. if (spec) {
  302. src += "&spec=" + spec;
  303. }
  304. if (filter_wave > 0) {
  305. src += '&filter_wave=' + filter_wave;
  306. }
  307. if (show_all > 0) {
  308. src += '&show_all=' + true;
  309. }
  310. $.get(src, function(data) {
  311. if (data.state == 'success') {
  312. $('#echart').html(`<img src='data:image/png;base64,${data.img}'/>`)
  313. ratios = data.ratios;
  314. updateQualityTable()
  315. }
  316. });
  317. });
  318. $('#ncsubmit').trigger('click');
  319. const fixedHeight = $('.fixed-bar').height();
  320. $('.fixed-empty').css('cssText', 'height:' + (parseFloat(fixedHeight) + 8) + 'px !important');
  321. })
  322. </script>