gang.huang 1 年之前
父節點
當前提交
399fa5758f
共有 1 個文件被更改,包括 7 次插入16 次删除
  1. 7 16
      admin/templates/default/provider.amount.control.php

+ 7 - 16
admin/templates/default/provider.amount.control.php

@@ -202,7 +202,8 @@
                                 <th class="align-center w120 mw120">通道单量</th>
                                 <?php foreach ($output['providers'] as $provider) { ?>
                                     <th class="align-center w165 mw165">
-                                        <input data-pid="<?php echo $provider['provider_id']?>" type="text" value="<?php echo $provider['channel_speed'] ?? '-1' ?>" name="channel-speed[]" class="w32 channel_speed_input" />
+                                        <input type="text" value="<?php echo $provider['channel_speed'] ?? '-1' ?>" name="channel-speeds[]" class="w32 channel_speed_inputs" />
+                                        <input data-pid="<?php echo $provider['provider_id']?>" type="hidden" value="<?php echo $provider['channel_speed'] ?? '-1' ?>" name="channel-speed[]" class="w32 channel_speed_input" />
                                     </th>    
                                 <?php } ?>
                             </tr>
@@ -309,16 +310,6 @@
             $('#price_table').css({'height': 'calc(100vh - 220px)', 'margin-top': '80px'});
         }
 
-        var $channel_speed_input = $('.channel_speed_input');
-        for(let i=0;i<$channel_speed_input.length;i++) {
-            let pid = $channel_speed_input.eq(i).attr('data-pid');
-            let val = $channel_speed_input.eq(i).val();
-            if(val) {
-                $channel_speed_input.eq(i).val(val.replace(pid+'-',''))
-            }
-            
-        }
-
 
         let isSubmit = true
         $('.input-one').blur(function() {
@@ -365,11 +356,11 @@
         // 提交
         $("#submitBtn").click(function() {
             console.log('isSubmit', isSubmit);
-            var $channel_speed_input = $('.channel_speed_input');
-            for(let i=0;i<$channel_speed_input.length;i++) {
-                const val = $channel_speed_input.eq(i).val();
-                const pid = $channel_speed_input.eq(i).attr('data-pid');
-                $channel_speed_input.eq(i).val(pid+'-'+val);
+            var $channel_speed_inputs = $('.channel_speed_inputs');
+            for(let i=0;i<$channel_speed_inputs.length;i++) {
+                const val = $channel_speed_inputs.eq(i).val();
+                const pid = $channel_speed_inputs.eq(i).siblings('.channel_speed_input')[0].attr('data-pid');
+                $channel_speed_inputs.eq(i).siblings('.channel_speed_input')[0].val(pid+'-'+val);
             }
             if (isSubmit) {
                 $("#price_form").submit();