provider.amount.control.php 19 KB

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