provider.amount.control.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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. </style>
  69. <?php defined('InShopNC') or exit('Access Invalid!'); ?>
  70. <div class="page provider_amount_control">
  71. <div class="fixed-bar">
  72. <div class="item-title">
  73. <h3>通道管理</h3>
  74. <ul class="tab-base">
  75. <li><a href="index.php?act=provider&op=index"><span><?php echo $lang['nc_manage'] ?></span></a></li>
  76. <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>
  77. <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>
  78. <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>
  79. <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>
  80. <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=slow" class="classA" data-type="2-slow"><span>慢充二十四小时话费单量控制</span></a></li>
  81. <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=slow6" class="classA" data-type="2-slow6"><span>慢充六小时话费单量控制</span></a></li>
  82. <li><a href="index.php?act=merchant&op=provider_amount_control&type=2&form=slow2" class="classA" data-type="2-slow2"><span>慢充两小时话费单量控制</span></a></li>
  83. <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>
  84. <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>
  85. </ul>
  86. </div>
  87. </div>
  88. <div class="fixed-empty"></div>
  89. <form id="price_form" enctype="multipart/form-data" method="post">
  90. <input type="hidden" name="form_submit" value="ok"/>
  91. <table class="table tb-type2 tableFixed">
  92. <tbody class="tbody" >
  93. <tr>
  94. <td colspan="2" class="required" ><label>单量设置:</label></td>
  95. </tr>
  96. <tr>
  97. <td class="tip_info">
  98. 单量:请输入大于-1的数字,-1表示不限;&nbsp;&nbsp;&nbsp;&nbsp;
  99. 优先级:请输入1-100的数字;&nbsp;&nbsp;&nbsp;&nbsp;是否启动:1-开启,0-关闭
  100. </td>
  101. </tr>
  102. <tr class="noborder">
  103. <table class="table tb-type2" style="margin-top: 77px;">
  104. <thead id="tableHread">
  105. <tr class="w550" style="display:block;">
  106. <th class="align-center w120 mw120"></th>
  107. <?php foreach ($output['providers'] as $provider) { ?>
  108. <th class="align-center w165 mw165"><?php echo $provider['store_name']?>(<?php if($provider['opened'] == 1){?>
  109. <span style="color: #0bb20c">开启</span>
  110. <?php }?><?php if($provider['opened'] == 2){?>
  111. <span style="color: #f30707">关闭</span>
  112. <?php }?>)
  113. <?php }?>
  114. </tr>
  115. <tr class="w500" style="display:block;">
  116. <td class="align-center w120 mw120" style="height:16px"></td>
  117. <?php foreach ($output['providers'] as $provider) { ?>
  118. <td class="batch-td">
  119. <div class="listNum">
  120. 单量
  121. </div>
  122. <div class="priority">
  123. 优先级
  124. </div>
  125. <div class="priority">
  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>批量设置开关(0/1):</h6>
  130. <a href="javascript:void(0)" class="close">X</a>
  131. <input name="" type="number" class="text price"/>
  132. <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="price">设置</a><span
  133. class="arrow"></span>
  134. </div>
  135. </div>
  136. </div>
  137. </td>
  138. <?php }?>
  139. </tr>
  140. </thead>
  141. <tbody class="tbody tableContent">
  142. <?php foreach ($output['form']['amountData'] as $key => $amount) { ?>
  143. <tr class="w500 trFlex">
  144. <td style="text-align: center;width: 120px;min-width:120px;" class="tbFlex">
  145. <?php echo $amount['text']?>
  146. </td>
  147. <?php foreach ($output['providers'] as $provider) { ?>
  148. <input type="hidden" name="pid[]" value="<?php echo $provider['provider_id'];?>">
  149. <input type="hidden" name="name[]" value="<?php echo $provider['name'];?>">
  150. <input type="hidden" name="types[]" value="<?php echo $amount['type'];?>">
  151. <input type="hidden" name="amount[]" value="<?php echo $amount['amount'];?>">
  152. <input type="hidden" name="has[]" value="<?php echo $output['datas'][$provider['provider_id']][$key]['has'];?>">
  153. <td class="batch-td">
  154. <div class="listNum">
  155. <input type="text" class="input-one styleOne w46" name="speed[]" autocomplete="off"
  156. value="<?php echo $output['datas'][$provider['provider_id']][$key]['speed']?>"
  157. <?php if($output['datas'][$provider['provider_id']][$key]['has'] == 0){?>
  158. readOnly
  159. style="background-color:#eaeaea;"
  160. <?php }?>
  161. >
  162. </div>
  163. <div class="priority">
  164. <input type="text" class="input-tow styleTow w32" name="sort[]" autocomplete="off"
  165. value="<?php echo $output['datas'][$provider['provider_id']][$key]['sort']?>"
  166. <?php if($output['datas'][$provider['provider_id']][$key]['has'] == 0){?>
  167. readOnly
  168. style="background-color:#eaeaea;"
  169. <?php }?>
  170. >
  171. </div>
  172. <div class="priority">
  173. <input type="text" class="input-three styleTow w32" name="opened[]" autocomplete="off"
  174. value="<?php echo $output['datas'][$provider['provider_id']][$key]['opened']?>"
  175. <?php if($output['datas'][$provider['provider_id']][$key]['has'] == 0){?>
  176. readOnly
  177. style="background-color:#eaeaea;"
  178. <?php }?>
  179. >
  180. </div>
  181. </td>
  182. <?php }?>
  183. </tr>
  184. <?php }?>
  185. </tbody>
  186. </table>
  187. </tr>
  188. </tbody>
  189. <tfoot>
  190. <tr class="tfoot">
  191. <td colspan="15"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit']; ?></span></a></td>
  192. </tr>
  193. </tfoot>
  194. </table>
  195. </form>
  196. </div>
  197. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/dialog/dialog.js" id="dialog_js"
  198. charset="utf-8"></script>
  199. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
  200. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/ajaxfileupload/ajaxfileupload.js"></script>
  201. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.js"></script>
  202. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/refill/layer.js"></script>
  203. <link href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css"
  204. id="cssfile2"/>
  205. <script type="text/javascript">
  206. $(function () {
  207. $(window).scroll(function() {
  208. let toLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
  209. // let toTop = document.documentElement.scrollTop || document.body.scrollTop;
  210. // console.log('toTop',toTop);
  211. if (toLeft>0) {
  212. let headLeft = toLeft - 20
  213. $('#tableHread')[0].style.left = '-'+headLeft+'px'
  214. } else if (toLeft == 0) {
  215. $('#tableHread')[0].style.left = 20+'px'
  216. }
  217. // if (toTop>0) {
  218. // console.log('11', $('.tbFlex')[0].offsetTop);
  219. // $('.tbFlex').each(function () {
  220. // let trTop = $(this)[0].offsetTop
  221. // $(this)[0].style.top = trTop - toTop + 'px'
  222. // })
  223. // } else if (toTop == 0) {
  224. // $('.tbFlex').each(function () {
  225. // $(this)[0].style.top = 'auto'
  226. // })
  227. // }
  228. });
  229. let isSubmit = true
  230. $('.input-one').blur(function () {
  231. // console.log('$(this).value', ($(this)));
  232. let value = $(this)[0].value
  233. if (value >= -1 ) {
  234. isSubmit = true;
  235. $(this)[0].style['borderColor'] = ''
  236. } else {
  237. isSubmit = false
  238. $(this)[0].style['borderColor'] = '#e64444'
  239. }
  240. })
  241. $('.input-tow').blur(function () {
  242. let value = $(this)[0].value
  243. // console.log(value);
  244. if (value >= 1 && value <= 100) {
  245. isSubmit = true;
  246. $(this)[0].style['borderColor'] = ''
  247. } else {
  248. isSubmit = false
  249. $(this)[0].style['borderColor'] = '#e64444'
  250. }
  251. })
  252. $('.input-three').blur(function () {
  253. let value = $(this)[0].value
  254. if (value == 0 || value == 1) {
  255. isSubmit = true
  256. $(this)[0].style['borderColor'] = ''
  257. } else {
  258. isSubmit = false
  259. $(this)[0].style['borderColor'] = '#e64444'
  260. }
  261. })
  262. // $('input').each(function () {
  263. // $(this).focus(function () {
  264. // })
  265. // });
  266. // 开始获取当前地址
  267. let type = '<?php echo $_GET['type'];?>';
  268. let form = '<?php echo $_GET['form'];?>';
  269. $(".classA").each(function () {
  270. if (type+'-'+form == $(this).attr("data-type")) {
  271. $(this).addClass('current')
  272. $(this).attr('href','JavaScript:void(0);')
  273. }
  274. })
  275. // 提交
  276. $("#submitBtn").click(function () {
  277. console.log('isSubmit', isSubmit);
  278. if (isSubmit) {
  279. $("#price_form").submit();
  280. }
  281. })
  282. // tab样式
  283. $(".tab-base a").click(function () {
  284. // console.log('this', $(this));
  285. $(this).addClass('current')
  286. $(this).siblings().removeClass('current')
  287. })
  288. // 表格hover时背景
  289. $('.trFlex').each(function () {
  290. $(this).hover(function () {
  291. $(this)[0].style.backgroundColor = '#cbe9f3'
  292. },function() {
  293. $(this)[0].style.backgroundColor = '#fff'
  294. })
  295. })
  296. // 批量设置开关
  297. $('.batch > .icon-edit').click(function () {
  298. $('.batch > .batch-input').hide();
  299. $(this).next().show();
  300. });
  301. $('.batch-input > .close').click(function () {
  302. $(this).parent().hide();
  303. });
  304. $('.price').change(function () {
  305. let val = $(this).val()
  306. if (val != '1' && val != '0') {
  307. layer.msg('开关只能设置0或1');
  308. }
  309. })
  310. // 点击设置
  311. $('.ncsc-btn-mini').click(function () {
  312. let price = $(this).siblings('.price').val()
  313. if (price != '1' && price != '0') {
  314. layer.msg('开关只能设置0或1');
  315. return
  316. }
  317. var lie = $(this).parents('.batch-td').prevAll().length
  318. $('.input-three').each(function () {
  319. let tdCon = $(this).parents('td').prevAll().length / 6
  320. let readOnly = $(this).attr('readOnly')
  321. if (lie == tdCon && !readOnly) {
  322. $(this).val(price)
  323. }
  324. })
  325. })
  326. });
  327. </script>