provider.amount.control.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  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. <li><a href="index.php?act=merchant&op=provider_amount_control&type=1&form=fast" class="classA" data-type="1-fast"><span>快充油卡单量控制</span></a></li>
  92. </ul>
  93. </div>
  94. </div>
  95. <div class="fixed-empty"></div>
  96. <form id="price_form" enctype="multipart/form-data" method="post">
  97. <input type="hidden" name="form_submit" value="ok"/>
  98. <table class="table tb-type2 tableFixed">
  99. <tbody class="tbody" >
  100. <tr>
  101. <td colspan="2" class="required" ><label>单量设置:</label></td>
  102. </tr>
  103. <tr>
  104. <td class="tip_info">
  105. 单量:请输入大于等于-1的数字,-1表示不限;&nbsp;&nbsp;&nbsp;&nbsp;
  106. 优先级:请输入1-100的数字;&nbsp;&nbsp;&nbsp;&nbsp;是否启动:1-开启,0-关闭
  107. </td>
  108. </tr>
  109. <tr class="noborder">
  110. <table class="table tb-type2" style="margin-top: 77px;">
  111. <thead id="tableHread">
  112. <tr class="w550" style="display:block;">
  113. <th class="align-center w120 mw120"></th>
  114. <?php foreach ($output['providers'] as $provider) { ?>
  115. <th class="align-center w165 mw165"><?php echo $provider['store_name']?>(<?php if($provider['opened'] == 1){?>
  116. <span style="color: #0bb20c">开启</span>
  117. <?php }?><?php if($provider['opened'] == 2){?>
  118. <span style="color: #f30707">关闭</span>
  119. <?php }?>)
  120. <?php }?>
  121. </tr>
  122. <tr class="w500" style="display:block;">
  123. <td class="align-center w120 mw120" style="height:16px"></td>
  124. <?php foreach ($output['providers'] as $provider) { ?>
  125. <td class="batch-td">
  126. <div class="listNum">
  127. 单量
  128. <div class="batch" style="display: inline-block"><i class="icon-edit" title="批量操作"></i>
  129. <div class="batch-input" style="display:none">
  130. <h6>批量设置单量(大于等于-1):</h6>
  131. <a href="javascript:void(0)" class="close">X</a>
  132. <input name="" type="number" class="text pricee"/>
  133. <a href="javascript:void(0)" class="ncsc-btn-minii" data-type="pricee">设置</a><span
  134. class="arrow"></span>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="priority">
  139. 优先级
  140. </div>
  141. <div class="priority">
  142. 开关
  143. <div class="batch" style="display: inline-block"><i class="icon-edit" title="批量操作"></i>
  144. <div class="batch-input" style="display:none">
  145. <h6>批量设置开关(0/1):</h6>
  146. <a href="javascript:void(0)" class="close">X</a>
  147. <input name="" type="number" class="text price"/>
  148. <a href="javascript:void(0)" class="ncsc-btn-mini" data-type="price">设置</a><span
  149. class="arrow"></span>
  150. </div>
  151. </div>
  152. </div>
  153. </td>
  154. <?php }?>
  155. </tr>
  156. </thead>
  157. <tbody class="tbody tableContent">
  158. <?php foreach ($output['form']['amountData'] as $key => $amount) { ?>
  159. <tr class="w500 trFlex" data-color="<?php echo $amount['type'];?>">
  160. <td style="text-align: center;width: 120px;min-width:120px;" class="tbFlex">
  161. <?php echo $amount['text']?>
  162. </td>
  163. <?php foreach ($output['providers'] as $provider) { ?>
  164. <input type="hidden" name="str[]" value="<?php echo "{$provider['provider_id']}-{$amount['type']}-{$amount['amount']}-{$output['datas'][$provider['provider_id']][$key]['has']}";?>">
  165. <td class="batch-td">
  166. <div class="listNum">
  167. <input type="text" class="input-one styleOne w46" name="speed[]" autocomplete="off"
  168. value="<?php echo $output['datas'][$provider['provider_id']][$key]['speed']?>"
  169. <?php if($output['datas'][$provider['provider_id']][$key]['has'] == 0){?>
  170. readOnly
  171. style="background-color:#eaeaea;"
  172. <?php }?>
  173. >
  174. </div>
  175. <div class="priority">
  176. <input type="text" class="input-tow styleTow w32" name="sort[]" autocomplete="off"
  177. value="<?php echo $output['datas'][$provider['provider_id']][$key]['sort']?>"
  178. <?php if($output['datas'][$provider['provider_id']][$key]['has'] == 0){?>
  179. readOnly
  180. style="background-color:#eaeaea;"
  181. <?php }?>
  182. >
  183. </div>
  184. <div class="priority">
  185. <input type="text" class="input-three styleTow w32" name="opened[]" autocomplete="off"
  186. value="<?php echo $output['datas'][$provider['provider_id']][$key]['opened']?>"
  187. <?php if($output['datas'][$provider['provider_id']][$key]['has'] == 0){?>
  188. readOnly
  189. style="background-color:#eaeaea;"
  190. <?php }?>
  191. >
  192. </div>
  193. </td>
  194. <?php }?>
  195. </tr>
  196. <?php }?>
  197. </tbody>
  198. </table>
  199. </tr>
  200. </tbody>
  201. <tfoot>
  202. <tr class="tfoot">
  203. <td colspan="15"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit']; ?></span></a></td>
  204. </tr>
  205. </tfoot>
  206. </table>
  207. </form>
  208. </div>
  209. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/dialog/dialog.js" id="dialog_js"
  210. charset="utf-8"></script>
  211. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
  212. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/ajaxfileupload/ajaxfileupload.js"></script>
  213. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.js"></script>
  214. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/refill/layer.js"></script>
  215. <link href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css"
  216. id="cssfile2"/>
  217. <script type="text/javascript">
  218. $(function () {
  219. $(window).scroll(function() {
  220. let toLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
  221. // let toTop = document.documentElement.scrollTop || document.body.scrollTop;
  222. // console.log('toTop',toTop);
  223. if (toLeft>0) {
  224. let headLeft = toLeft - 20
  225. $('#tableHread')[0].style.left = '-'+headLeft+'px'
  226. } else if (toLeft == 0) {
  227. $('#tableHread')[0].style.left = 20+'px'
  228. }
  229. // if (toTop>0) {
  230. // console.log('11', $('.tbFlex')[0].offsetTop);
  231. // $('.tbFlex').each(function () {
  232. // let trTop = $(this)[0].offsetTop
  233. // $(this)[0].style.top = trTop - toTop + 'px'
  234. // })
  235. // } else if (toTop == 0) {
  236. // $('.tbFlex').each(function () {
  237. // $(this)[0].style.top = 'auto'
  238. // })
  239. // }
  240. });
  241. let isSubmit = true
  242. $('.input-one').blur(function () {
  243. // console.log('$(this).value', ($(this)));
  244. let value = $(this)[0].value
  245. if (value >= -1 ) {
  246. isSubmit = true;
  247. $(this)[0].style['borderColor'] = ''
  248. } else {
  249. isSubmit = false
  250. $(this)[0].style['borderColor'] = '#e64444'
  251. }
  252. })
  253. $('.input-tow').blur(function () {
  254. let value = $(this)[0].value
  255. // console.log(value);
  256. if (value >= 1 && value <= 100) {
  257. isSubmit = true;
  258. $(this)[0].style['borderColor'] = ''
  259. } else {
  260. isSubmit = false
  261. $(this)[0].style['borderColor'] = '#e64444'
  262. }
  263. })
  264. $('.input-three').blur(function () {
  265. let value = $(this)[0].value
  266. if (value == 0 || value == 1) {
  267. isSubmit = true
  268. $(this)[0].style['borderColor'] = ''
  269. } else {
  270. isSubmit = false
  271. $(this)[0].style['borderColor'] = '#e64444'
  272. }
  273. })
  274. // $('input').each(function () {
  275. // $(this).focus(function () {
  276. // })
  277. // });
  278. // 开始获取当前地址
  279. let type = '<?php echo $_GET['type'];?>';
  280. let form = '<?php echo $_GET['form'];?>';
  281. $(".classA").each(function () {
  282. if (type+'-'+form == $(this).attr("data-type")) {
  283. $(this).addClass('current')
  284. $(this).attr('href','JavaScript:void(0);')
  285. }
  286. })
  287. // 提交
  288. $("#submitBtn").click(function () {
  289. console.log('isSubmit', isSubmit);
  290. if (isSubmit) {
  291. $("#price_form").submit();
  292. }
  293. })
  294. // tab样式
  295. $(".tab-base a").click(function () {
  296. // console.log('this', $(this));
  297. $(this).addClass('current')
  298. $(this).siblings().removeClass('current')
  299. })
  300. // 表格hover时背景
  301. $('.trFlex').each(function () {
  302. let color = $(this).attr('data-color')
  303. if (color == 4 || color == 1) {
  304. $(this).css('background', '#f1dde6')
  305. } else if (color == 5 || color == 2) {
  306. $(this).css('background', '#c8c6f3')
  307. } else if (color == 6) {
  308. $(this).css('background', '#f2f3c6')
  309. } else {
  310. $(this).css('background', '#fff')
  311. }
  312. $(this).hover(function () {
  313. $(this)[0].style.backgroundColor = '#cbe9f3'
  314. },function() {
  315. if (color == 4 || color == 1) {
  316. $(this).css('background', '#f1dde6')
  317. } else if (color == 5 || color == 2) {
  318. $(this).css('background', '#c8c6f3')
  319. } else if (color == 6) {
  320. $(this).css('background', '#f2f3c6')
  321. } else {
  322. $(this).css('background', '#fff')
  323. }
  324. })
  325. })
  326. // 批量设置开关
  327. $('.batch > .icon-edit').click(function () {
  328. $('.batch > .batch-input').hide();
  329. $(this).next().show();
  330. });
  331. $('.batch-input > .close').click(function () {
  332. $(this).parent().hide();
  333. });
  334. $('.price').change(function () {
  335. let val = $(this).val()
  336. if (val != '1' && val != '0') {
  337. layer.msg('开关只能设置0或1');
  338. }
  339. })
  340. // 点击设置
  341. $('.ncsc-btn-mini').click(function () {
  342. let price = $(this).siblings('.price').val()
  343. if (price != '1' && price != '0') {
  344. layer.msg('开关只能设置0或1');
  345. return
  346. }
  347. var lie = $(this).parents('.batch-td').prevAll().length
  348. $('.input-three').each(function () {
  349. let tdCon = $(this).parents('td').prevAll().length / 6
  350. let readOnly = $(this).attr('readOnly')
  351. if (lie == tdCon && !readOnly) {
  352. $(this).val(price)
  353. }
  354. })
  355. })
  356. // 单量设置开关
  357. $('.batch > .icon-edit').click(function () {
  358. $('.batch > .batch-input').hide();
  359. $(this).next().show();
  360. });
  361. $('.batch-input > .close').click(function () {
  362. $(this).parent().hide();
  363. });
  364. $('.pricee').change(function () {
  365. let val = $(this).val()
  366. if (val <= -2) {
  367. layer.msg('单量只能设置大于-1');
  368. }
  369. })
  370. // 点击设置
  371. $('.ncsc-btn-minii').click(function () {
  372. let price = $(this).siblings('.pricee').val()
  373. if (price <= -2) {
  374. layer.msg('单量只能设置大于-1');
  375. return
  376. }
  377. var lie = $(this).parents('.batch-td').prevAll().length
  378. $('.input-one').each(function () {
  379. let tdCon = $(this).parents('td').prevAll().length / 6
  380. let readOnly = $(this).attr('readOnly')
  381. if (lie == tdCon && !readOnly) {
  382. $(this).val(price)
  383. }
  384. })
  385. })
  386. });
  387. </script>