analysis.cov.mch_order_send.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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="?index.php&act=refill_analysis&op=index&type=system"><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="JavaScript:void(0);" class="current"><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. <td>
  106. <a href="javascript:void(0);" id="ncsubmit" class="btn-search" title="<?php echo $lang['nc_query']; ?>">&nbsp;
  107. </a>
  108. </td>
  109. </tr>
  110. </table>
  111. </form>
  112. <div class="echartsContent">
  113. <table id="checkChannel">
  114. <thead>
  115. <tr>
  116. <td>
  117. <label>
  118. <input type="checkbox" id="checkAllChannel">
  119. 编号(机构列表)
  120. </label>
  121. </td>
  122. </tr>
  123. </thead>
  124. <tbody id="checkChannelContent">
  125. </tbody>
  126. </table>
  127. <div id="echart">
  128. </div>
  129. </div>
  130. <div id="box">
  131. <!-- <iframe
  132. src="https://www.xyzshops.cn/plot/index?time_stamp=1621488600&interval=60" scrolling="no" id="Iframe" frameborder="0"></iframe> -->
  133. </div>
  134. </div>
  135. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></script>
  136. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
  137. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/i18n/zh-CN.js" charset="utf-8"></script>
  138. <script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL; ?>/js/xm-select.js"></script>
  139. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/refill/layer.js"></script>
  140. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/refill/moment-with-locales.js"></script>
  141. <link rel="stylesheet" type="text/css" href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css" />
  142. <script type="text/javascript">
  143. $(function() {
  144. laydate.render({
  145. elem: '#startTime',
  146. type: 'datetime'
  147. });
  148. laydate.render({
  149. elem: '#endTime',
  150. type: 'datetime'
  151. });
  152. let allMchid;
  153. let qualitys;
  154. function updateQualityTable() {
  155. const allQualityList = JSON.parse(JSON.stringify(qualitys));
  156. allQualityList.map(item => {
  157. item.active = false;
  158. })
  159. function findItem(value) {
  160. const item = allQualityList.filter(item => {
  161. return item.value == value;
  162. })
  163. if (item.length > 0) {
  164. return item[0].name
  165. }
  166. return false
  167. }
  168. const mchidArr = allMchid.map(item => {
  169. return {
  170. name: findItem(item) || item,
  171. value: item,
  172. active: true
  173. }
  174. });
  175. let mergeQualitys = [...mchidArr, ...allQualityList];
  176. const newArr = [];
  177. const obj = {};
  178. for (let i = 0; i < mergeQualitys.length; i++) {
  179. if (!obj[mergeQualitys[i].value]) {
  180. newArr.push(mergeQualitys[i]);
  181. obj[mergeQualitys[i].value] = true;
  182. }
  183. }
  184. formatChannelTable(newArr);
  185. }
  186. function formatChannelTable(tableData) {
  187. $('#checkChannelContent').children().remove();
  188. let data;
  189. if (typeof tableData == 'object') {
  190. data = tableData;
  191. } else {
  192. data = JSON.parse(tableData)
  193. }
  194. let tableHTML = '';
  195. data.map(item => {
  196. tableHTML += `
  197. <tr>
  198. <td><label><input type="checkbox" name="channelValue"" ${item.active?'checked="checked"':''} value="${item.value}" />${item.active?`<span style="color:red;">${item.name}</span>`:item.name}</label></td>
  199. </tr>
  200. `;
  201. })
  202. $('#checkChannelContent').append(tableHTML);
  203. }
  204. // let select_merchants
  205. $.get('index.php?act=refill_analysis&op=merchant_data', function(data) {
  206. data = JSON.parse(data)
  207. qualitys = data;
  208. formatChannelTable(data)
  209. // select_merchants = xmSelect.render({
  210. // el: '#select_merchants',
  211. // size: 'mini',
  212. // filterable: true,
  213. // style: {
  214. // minHeight: '27px',
  215. // lineHeight: '27px',
  216. // marginLeft: '4px',
  217. // width: '250px'
  218. // },
  219. // language: 'zn',
  220. // data: data
  221. // })
  222. })
  223. let select_cardtypes
  224. $.get('index.php?act=refill_analysis&op=card_type_data', function(data) {
  225. data = JSON.parse(data)
  226. select_cardtypes = xmSelect.render({
  227. el: '#select_cardtypes',
  228. size: 'mini',
  229. filterable: true,
  230. style: {
  231. minHeight: '27px',
  232. lineHeight: '27px',
  233. marginLeft: '4px',
  234. width: '250px'
  235. },
  236. language: 'zn',
  237. data: data
  238. })
  239. })
  240. function select_set(selectArr) {
  241. let selectStr = ''
  242. for (let i = 0; i < selectArr.length; i++) {
  243. selectStr += selectArr[i].value + ','
  244. }
  245. selectStr = selectStr.substr(0, selectStr.length - 1)
  246. return selectStr
  247. }
  248. $('#checkAllChannel').click(function() {
  249. if ($(this).get(0).checked) {
  250. $('input[name="channelValue"]').attr('checked', 'checked')
  251. } else {
  252. $('input[name="channelValue"]').removeAttr('checked')
  253. }
  254. })
  255. $('#ncsubmit').click(function() {
  256. let query_start_time = $("input[name=query_start_time]").val()
  257. let start_time = parseInt((new Date(query_start_time)).getTime() / 1000);
  258. let query_end_time = $("input[name=query_end_time]").val()
  259. let end_time = parseInt((new Date(query_end_time)).getTime() / 1000);
  260. if (!start_time && !end_time) {
  261. start_time = Date.parse(new Date()) / 1000 - 7200;
  262. end_time = Date.parse(new Date()) / 1000;
  263. }
  264. // let mchids = select_set(select_merchants.getValue())
  265. let mchidList = [];
  266. $('input[name="channelValue"]').each(function() {
  267. if ($(this).attr('checked')) {
  268. mchidList.push($(this).attr('value'))
  269. }
  270. })
  271. let mchids = mchidList.join(',');
  272. let card_types = select_cardtypes && select_set(select_cardtypes.getValue())
  273. let spec = $("select[name=amount]").val()
  274. let filter_wave = $("select[name=filter_wave]").val()
  275. let src = window.location.origin + "/plot/mch_order_send?"
  276. if (start_time) {
  277. src += "&start_time=" + start_time;
  278. }
  279. if (end_time) {
  280. if (end_time < start_time || !start_time) {
  281. layer.msg('日期有误,结束日期需大于开始日期');
  282. return
  283. }
  284. src += "&end_time=" + end_time;
  285. }
  286. if (mchids) {
  287. src += "&mchids=" + mchids;
  288. }
  289. if (card_types) {
  290. src += "&card_types=" + card_types;
  291. }
  292. if (spec) {
  293. src += "&spec=" + spec;
  294. }
  295. if (filter_wave > 0) {
  296. src += '&filter_wave=' + filter_wave;
  297. }
  298. $.get(src, function(data) {
  299. if (data.state == 'success') {
  300. $('#echart').html(`<img src='data:image/png;base64,${data.img}'/>`)
  301. allMchid = data.mchids;
  302. updateQualityTable()
  303. }
  304. });
  305. });
  306. $('#ncsubmit').trigger('click');
  307. const fixedHeight = $('.fixed-bar').height();
  308. $('.fixed-empty').css('cssText', 'height:' + (parseFloat(fixedHeight) + 8) + 'px !important');
  309. })
  310. </script>