analysis.cov.system.php 13 KB

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