provider.amount.control.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <link href="<?php echo ADMIN_TEMPLATES_URL; ?>/css/recharge.css?<?php echo rand(1, 10); ?>" rel="stylesheet" type="text/css" id="cssfile2" />
  2. <style>
  3. .batch {
  4. vertical-align: middle;
  5. display: inline-block;
  6. *display: inline
  7. /*IE7*/
  8. ;
  9. margin-left: 4px;
  10. position: relative;
  11. z-index: 1;
  12. *zoom: 1
  13. /*IE7*/
  14. ;
  15. }
  16. .batch i {
  17. cursor: pointer;
  18. }
  19. .batch-input {
  20. background-color: #FFF;
  21. white-space: nowrap;
  22. padding: 4px 9px;
  23. border: solid 1px #BCE8F1;
  24. position: absolute;
  25. z-index: 1;
  26. bottom: -75px;
  27. left: -88px;
  28. box-shadow: 3px 3px 0 rgba(153, 153, 153, 0.25);
  29. }
  30. .batch-input h6 {
  31. font-size: 12px;
  32. color: #555;
  33. }
  34. .batch-input .text {
  35. vertical-align: middle;
  36. clear: both;
  37. padding: 0 4px;
  38. vertical-align: middle;
  39. margin-right: 4px;
  40. }
  41. .batch-input .arrow {
  42. background: url(<?php echo SHOP_SITE_URL; ?>/templates/default/images/seller/ncsc_bg_img.png) no-repeat -240px -20px;
  43. display: block;
  44. width: 10px;
  45. height: 5px;
  46. margin-left: 1px;
  47. top: -5px;
  48. left: 50%;
  49. position: absolute;
  50. z-index: 2;
  51. transform: rotate(180deg);
  52. }
  53. .batch-input a.close {
  54. font-size: 11px;
  55. line-height: 12px;
  56. color: #BCE8F1;
  57. text-decoration: none;
  58. background-color: #FFF;
  59. text-align: center;
  60. display: block;
  61. width: 12px;
  62. height: 12px;
  63. border-radius: 7px;
  64. border: solid 1px #BCE8F1;
  65. top: -7px;
  66. right: -7px;
  67. position: absolute;
  68. z-index: 2;
  69. }
  70. .text.price {
  71. width: 40px;
  72. }
  73. .text.pricee {
  74. width: 40px;
  75. }
  76. .fixed-bar {
  77. width: 100%;
  78. }
  79. #price_table {
  80. table-layout: fixed;
  81. width: 100%;
  82. height: calc(100vh - 170px);
  83. overflow: auto;
  84. display: block;
  85. margin-top: 30px;
  86. }
  87. #price_table tr th:first-child {
  88. position: sticky;
  89. top: 0;
  90. left: 0;
  91. background: #fff;
  92. box-shadow: 2px 0 2px rgb(0 0 0 / 10%);
  93. z-index: 11;
  94. }
  95. #price_table tr:first-child {
  96. position: sticky;
  97. top: 0;
  98. z-index: 11;
  99. background: #fff;
  100. }
  101. #price_table tr:nth-child(2) {
  102. position: sticky;
  103. top: 38px;
  104. z-index: 11;
  105. background: #fff;
  106. }
  107. #price_table tr:nth-child(3) {
  108. position: sticky;
  109. top: 76px;
  110. z-index: 11;
  111. background: #fff;
  112. }
  113. #price_table tr td:first-child {
  114. display: block;
  115. position: sticky;
  116. left: 0;
  117. box-shadow: 2px 0 2px rgb(0 0 0 / 10%);
  118. z-index: 10;
  119. }
  120. #price_table tbody tr:hover .batch-td {
  121. background: #cbe9f3 !important;
  122. }
  123. .provider_amount_control .batch-td {
  124. min-width: auto !important;
  125. width: auto;
  126. white-space: nowrap;
  127. }
  128. </style>
  129. <?php defined('InShopNC') or exit('Access Invalid!'); ?>
  130. <div class="page provider_amount_control">
  131. <div class="fixed-bar">
  132. <div class="item-title">
  133. <h3>通道控制</h3>
  134. <ul class="tab-base">
  135. <li><a href="index.php?act=provider_ctl&op=index&type=2&form=common" class="classA" data-type="2-common"><span>普通话费单量控制</span></a></li>
  136. <li><a href="index.php?act=provider_ctl&op=index&type=2&form=fast" class="classA" data-type="2-fast"><span>快充话费单量控制</span></a></li>
  137. <li><a href="index.php?act=provider_ctl&op=index&type=2&form=card" class="classA" data-type="2-card"><span>卡密话费单量控制</span></a></li>
  138. <li><a href="index.php?act=provider_ctl&op=index&type=2&form=third" class="classA" data-type="2-third"><span>三方话费单量控制</span></a></li>
  139. <li><a href="index.php?act=provider_ctl&op=index&type=2&form=slow" class="classA" data-type="2-slow"><span>慢24话费单量控制</span></a></li>
  140. <li><a href="index.php?act=provider_ctl&op=index&type=2&form=slow6" class="classA" data-type="2-slow6"><span>慢6话费单量控制</span></a></li>
  141. <li><a href="index.php?act=provider_ctl&op=index&type=2&form=slow2" class="classA" data-type="2-slow2"><span>慢2话费单量控制</span></a></li>
  142. <li><a href="index.php?act=provider_ctl&op=index&type=2&form=slow48" class="classA" data-type="2-slow48"><span>慢48话费单量控制</span></a></li>
  143. <li><a href="index.php?act=provider_ctl&op=index&type=2&form=slow72" class="classA" data-type="2-slow72"><span>慢72话费单量控制</span></a></li>
  144. <li><a href="index.php?act=provider_ctl&op=index&type=2&form=fastest" class="classA" data-type="2-fastest"><span>速充话费单量控制</span></a></li>
  145. <li><a href="index.php?act=provider_ctl&op=index&type=1&form=common" class="classA" data-type="1-common"><span>无流水油卡单量控制</span></a></li>
  146. <li><a href="index.php?act=provider_ctl&op=index&type=1&form=slow" class="classA" data-type="1-slow"><span>有流水油卡单量控制</span></a></li>
  147. <li><a href="index.php?act=provider_ctl&op=index&type=1&form=card" class="classA" data-type="1-card"><span>卡密油卡单量控制</span></a></li>
  148. <li><a href="index.php?act=provider_ctl&op=index&type=1&form=fast" class="classA" data-type="1-fast"><span>快充油卡单量控制</span></a></li>
  149. </ul>
  150. </div>
  151. </div>
  152. <div class="fixed-empty"></div>
  153. <form id="price_form" enctype="multipart/form-data" method="post">
  154. <input type="hidden" name="form_submit" value="ok" />
  155. <table class="table tb-type2 tableFixed" style="top: 10px;">
  156. <tbody class="tbody">
  157. <tr>
  158. <td colspan="2" class="required"><label></label></td>
  159. </tr>
  160. <tr>
  161. <td class="tip_info">
  162. 单量:请输入大于等于-1的数字,-1表示不限;&nbsp;&nbsp;&nbsp;&nbsp;
  163. 优先级:请输入1-100的数字;&nbsp;&nbsp;&nbsp;&nbsp;是否启动:1-开启,0-关闭
  164. </td>
  165. </tr>
  166. <tr class="noborder">
  167. <table class="table tb-type2" id="price_table">
  168. <tbody class="tbody tableContent">
  169. <!-- 第一层表头开始 -->
  170. <tr>
  171. <th class="align-center w120 mw120">渠道名称</th>
  172. <?php foreach ($output['providers'] as $provider) { ?>
  173. <th class="align-center w165 mw165">
  174. <?php echo $provider['store_name'] ?>(<?php if ($provider['opened'] == 1) { ?>
  175. <span style="color: #0bb20c">开</span>
  176. <?php } ?><?php if ($provider['opened'] == 2) { ?>
  177. <span style="color: #f30707">关</span>
  178. <?php } ?>)
  179. <?php } ?>
  180. </th>
  181. </tr>
  182. <tr>
  183. <th class="align-center w120 mw120">通道单量</th>
  184. <?php foreach ($output['providers'] as $provider) { ?>
  185. <th class="align-center w165 mw165">
  186. <input type="text" value="<?php echo $provider['channel_speed'] || '-1' ?>" name="channel_speed[]" class="w32" />
  187. </th>
  188. <?php } ?>
  189. </tr>
  190. <!-- 第一层表头结束 -->
  191. <!-- 第二层表头开始 -->
  192. <tr>
  193. <th class="align-center w120 mw120" style="height:16px">类目</th>
  194. <?php foreach ($output['providers'] as $provider) { ?>
  195. <th class="batch-td">
  196. <div class="priority">
  197. 当前
  198. </div>
  199. <div class="listNum">
  200. 单量
  201. <div class="batch" style="display: inline-block"><i class="icon-edit" title="批量操作"></i>
  202. <div class="batch-input" style="display:none">
  203. <h6>批量设置单量(大于等于-1):</h6>
  204. <a href="javascript:void(0)" class="close">X</a>
  205. <input name="" type="number" class="text pricee quantity" />
  206. <a href="javascript:void(0)" class="ncsc-btn-quantity" data-type="pricee">设置</a><span class="arrow"></span>
  207. </div>
  208. </div>
  209. </div>
  210. <div class="priority">
  211. 优先级
  212. </div>
  213. <div class="priority">
  214. 开关
  215. <div class="batch" style="display: inline-block"><i class="icon-edit" title="批量操作"></i>
  216. <div class="batch-input" style="display:none">
  217. <h6>批量设置开关(0/1):</h6>
  218. <a href="javascript:void(0)" class="close">X</a>
  219. <input name="" type="number" class="text price" />
  220. <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="price">设置</a><span class="arrow"></span>
  221. </div>
  222. </div>
  223. </div>
  224. </th>
  225. <?php } ?>
  226. </tr>
  227. <!--第二层表头结束-->
  228. <!--表格内容开始-->
  229. <?php foreach ($output['form']['amountData'] as $key => $amount) { ?>
  230. <tr class="w500 trFlex">
  231. <td style="text-align: left;width: 120px;min-width:120px;" class="tbFlex" data-color="<?php echo $amount['type']; ?>">
  232. <?php echo $amount['text'] ?>
  233. </td>
  234. <?php foreach ($output['providers'] as $provider) { ?>
  235. <input type="hidden" name="str[]" value="<?php echo "{$provider['provider_id']}-{$amount['type']}-{$amount['amount']}-{$output['datas'][$provider['provider_id']][$key]['has']}"; ?>">
  236. <td class="batch-td" data-color="<?php echo $amount['type']; ?>">
  237. <div class="priority">
  238. <?php
  239. $keyName = "{$provider['name']}-{$amount['amount']}-{$amount['type']}";
  240. if (array_key_exists($keyName, $output['channel_ctl_model'])) {
  241. echo ceil($output['channel_ctl_model'][$keyName][0]);
  242. } else {
  243. echo 0;
  244. }
  245. ?>
  246. </div>
  247. <div class="listNum">
  248. <input type="text" class="input-one styleOne w46" name="speed[]" autocomplete="off" value="<?php echo $output['datas'][$provider['provider_id']][$key]['speed'] ?>" <?php if ($output['datas'][$provider['provider_id']][$key]['has'] == 0) { ?> readOnly style="background-color:#eaeaea;" <?php } ?>>
  249. </div>
  250. <div class="priority">
  251. <input type="text" class="input-tow styleTow w32" name="sort[]" autocomplete="off" value="<?php echo $output['datas'][$provider['provider_id']][$key]['sort'] ?>" <?php if ($output['datas'][$provider['provider_id']][$key]['has'] == 0) { ?> readOnly style="background-color:#eaeaea;" <?php } ?>>
  252. </div>
  253. <div class="priority">
  254. <input type="text" class="input-three styleTow w32" name="opened[]" autocomplete="off" value="<?php echo $output['datas'][$provider['provider_id']][$key]['opened'] ?>" <?php if ($output['datas'][$provider['provider_id']][$key]['has'] == 0) { ?> readOnly style="background-color:#eaeaea;" <?php } ?>>
  255. </div>
  256. </td>
  257. <?php } ?>
  258. </tr>
  259. <?php } ?>
  260. <!--表格内容结束-->
  261. </tbody>
  262. </table>
  263. </tr>
  264. </tbody>
  265. <tfoot>
  266. <tr class="tfoot">
  267. <td colspan="15"><a href="JavaScript:void(0);" class="btn" style="margin-top: 15px" id="submitBtn"><span><?php echo $lang['nc_submit']; ?></span></a></td>
  268. </tr>
  269. </tfoot>
  270. </table>
  271. </form>
  272. </div>
  273. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/dialog/dialog.js" id="dialog_js" charset="utf-8"></script>
  274. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
  275. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/ajaxfileupload/ajaxfileupload.js"></script>
  276. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.js"></script>
  277. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/refill/layer.js"></script>
  278. <link href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css" id="cssfile2" />
  279. <script type="text/javascript">
  280. $(function() {
  281. const navRealHeight = $('.fixed-bar').height();
  282. if(navRealHeight > 50) {
  283. $('.tb-type2.tableFixed').css('top','60px')
  284. $('#price_table').css({'height': 'calc(100vh - 220px)','margin-top':'80px'});
  285. }
  286. // console.log("$output['datas']", <?php echo json_encode($output['datas']) ?>, <?php echo json_encode($output['providers']) ?>);
  287. // $(window).scroll(function() {
  288. // let toLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
  289. // if (toLeft > 0) {
  290. // let headLeft = toLeft - 20
  291. // $('#tableHread')[0].style.left = '-' + headLeft + 'px'
  292. // } else if (toLeft == 0) {
  293. // $('#tableHread')[0].style.left = 20 + 'px'
  294. // }
  295. // });
  296. let isSubmit = true
  297. $('.input-one').blur(function() {
  298. let value = $(this)[0].value
  299. if (value >= -1) {
  300. isSubmit = true;
  301. $(this)[0].style['borderColor'] = ''
  302. } else {
  303. isSubmit = false
  304. $(this)[0].style['borderColor'] = '#e64444'
  305. }
  306. })
  307. $('.input-tow').blur(function() {
  308. let value = $(this)[0].value
  309. if (value >= 1 && value <= 100) {
  310. isSubmit = true;
  311. $(this)[0].style['borderColor'] = ''
  312. } else {
  313. isSubmit = false
  314. $(this)[0].style['borderColor'] = '#e64444'
  315. }
  316. })
  317. $('.input-three').blur(function() {
  318. let value = $(this)[0].value
  319. if (value == 0 || value == 1) {
  320. isSubmit = true
  321. $(this)[0].style['borderColor'] = ''
  322. } else {
  323. isSubmit = false
  324. $(this)[0].style['borderColor'] = '#e64444'
  325. }
  326. })
  327. // 开始获取当前地址
  328. let type = '<?php echo $_GET['type']; ?>';
  329. let form = '<?php echo $_GET['form']; ?>';
  330. $(".classA").each(function() {
  331. if (type + '-' + form == $(this).attr("data-type")) {
  332. $(this).addClass('current')
  333. $(this).attr('href', 'JavaScript:void(0);')
  334. }
  335. })
  336. // 提交
  337. $("#submitBtn").click(function() {
  338. console.log('isSubmit', isSubmit);
  339. if (isSubmit) {
  340. $("#price_form").submit();
  341. }
  342. })
  343. // tab样式
  344. $(".tab-base a").click(function() {
  345. $(this).addClass('current')
  346. $(this).siblings().removeClass('current')
  347. })
  348. // 表格hover时背景
  349. $('#price_table td').each(function() {
  350. let colorIndex = $(this).attr('data-color')
  351. const colorArr = ['#fff', '#f1dde6', '#c8c6f3', '#fff', '#f1dde6', '#c8c6f3', '#f2f3c6', '#fff'];
  352. if (colorArr[colorIndex]) {
  353. $(this).css('background', colorArr[colorIndex]);
  354. } else {
  355. $(this).css('background', '#fff');
  356. }
  357. // if (color == 4 || color == 1) {
  358. // $(this).css('background', '#f1dde6')
  359. // } else if (color == 5 || color == 2) {
  360. // $(this).css('background', '#c8c6f3')
  361. // } else if (color == 6) {
  362. // $(this).css('background', '#f2f3c6')
  363. // } else {
  364. // $(this).css('background', '#fff')
  365. // }
  366. })
  367. // $('#price_table .tableContent tr').hover(function() {
  368. // $(this)[0].style.backgroundColor = '#cbe9f3'
  369. // }, function() {
  370. // if (color == 4 || color == 1) {
  371. // $(this).css('background', '#f1dde6')
  372. // } else if (color == 5 || color == 2) {
  373. // $(this).css('background', '#c8c6f3')
  374. // } else if (color == 6) {
  375. // $(this).css('background', '#f2f3c6')
  376. // } else {
  377. // $(this).css('background', '#fff')
  378. // }
  379. // })
  380. // 批量设置开关
  381. $('.batch > .icon-edit').click(function() {
  382. $('.batch > .batch-input').hide();
  383. $(this).next().show();
  384. });
  385. $('.batch-input > .close').click(function() {
  386. $(this).parent().hide();
  387. });
  388. $('.price').change(function() {
  389. let val = $(this).val()
  390. if (val != '1' && val != '0') {
  391. layer.msg('开关只能设置0或1');
  392. }
  393. })
  394. // 点击设置
  395. $('.ncsc-btn-mini').click(function() {
  396. let price = $(this).siblings('.price').val()
  397. if (price != '1' && price != '0') {
  398. layer.msg('开关只能设置0或1');
  399. return
  400. }
  401. var lie = $(this).parents('.batch-td').prevAll().length
  402. $('.input-three').each(function() {
  403. let tdCon = $(this).parents('td').prevAll().length / 2
  404. let readOnly = $(this).attr('readOnly')
  405. if (lie == tdCon && !readOnly) {
  406. $(this).val(price)
  407. }
  408. })
  409. })
  410. // 单量设置开关
  411. $('.batch > .icon-edit').click(function() {
  412. $('.batch > .batch-input').hide();
  413. $(this).next().show();
  414. });
  415. $('.batch-input > .close').click(function() {
  416. $(this).parent().hide();
  417. });
  418. $('.pricee').change(function() {
  419. let val = $(this).val()
  420. if (val <= -2) {
  421. layer.msg('单量只能设置大于-1');
  422. }
  423. })
  424. // 点击设置
  425. $('.ncsc-btn-quantity').click(function() {
  426. let quantity = $(this).siblings('.quantity').val()
  427. if (quantity <= -2) {
  428. layer.msg('单量只能设置大于-1');
  429. return
  430. }
  431. let lie = $(this).parents('.batch-td').prevAll().length;
  432. $('.input-one').each(function(index, item) {
  433. let tdCon = $(this).parents('td').prevAll().length / 2
  434. let readOnly = $(this).attr('readOnly')
  435. if (lie == tdCon && !readOnly) {
  436. $(this).val(quantity)
  437. }
  438. })
  439. })
  440. });
  441. </script>