Browse Source

admin merchant.ctl

xiaoyu 3 năm trước cách đây
mục cha
commit
50302a3db4
1 tập tin đã thay đổi với 33 bổ sung12 xóa
  1. 33 12
      admin/templates/default/merchant.ctl.php

+ 33 - 12
admin/templates/default/merchant.ctl.php

@@ -166,20 +166,20 @@
 
             <?php foreach ($output['quality'] as $key => $value) { ?>
                 <tr class="noborder">
-                    <td colspan="2" class="required">
+                    <td colspan="2" class="required judge">
                         <label class="seconds"
                                style="margin-left: 48px;display:inline-block;  margin-right: 16px; min-width: 38px"
                                for="name"><?php echo $value; ?>:</label>
                         <label>
-                            <input class="day_secs" type="text" name="<?php echo "$key-day_secs"; ?>"
+                            <input  class="day_secs" type="text" name="<?php echo "$key-day_secs"; ?>"
                                    value="<?php echo $output['retry_times']['qualities'][$key]['day_secs'] ?? 0; ?>">
                         </label>
                         <label>
-                            <input class="night_secs" style="margin: 0 30px;" type="text" name="<?php echo "$key-night_secs"; ?>"
+                            <input  class="night_secs" style="margin: 0 30px;" type="text" name="<?php echo "$key-night_secs"; ?>"
                                    value="<?php echo $output['retry_times']['qualities'][$key]['night_secs'] ?? 0; ?>">
                         </label>
                         <label>
-                            <input class="times" type="text" name="<?php echo "$key-times"; ?>"
+                            <input  class="times" type="text" name="<?php echo "$key-times"; ?>"
                                    value="<?php echo $output['retry_times']['qualities'][$key]['times'] ?? 0; ?>">
                         </label>
                     </td>
@@ -352,11 +352,16 @@
 <script type="text/javascript">
     $(function () {
         //按钮先执行验证再提交表单
-        $("#submitBtn").click(function () {
-            if ($("#user_form").valid()) {
-                $("#user_form").submit();
-            }
-        });
+            let day
+            let nights
+            let times
+            $("#submitBtn").click(function () {
+                if (day == 0 || nights == 0 || times == 0) {
+                    layer.msg('白天秒数,黑天秒数,重试次数(三者都需设置)');
+                } else {
+                    $("#user_form").submit();
+                }
+            })
         $('.required .day_secs').each(function(index, item) {
             $(item).change(function() {
                 const day_secs = $(this).val()
@@ -374,7 +379,7 @@
                 const zero = night_secs.replace(/^[0]+/,'')
                 $(item).val(zero);
                 if ((!/^\d+$/.test(night_secs)) || isNaN(night_secs)) {
-                layer.msg('天秒数只能设置大于0的整数');
+                layer.msg('天秒数只能设置大于0的整数');
                 $(item).val("0");
                }
             })
@@ -385,7 +390,7 @@
                 const zero = times.replace(/^[0]+/,'')
                 $(item).val(zero);
                 if ((!/^\d+$/.test(times)) || isNaN(times)) {
-                layer.msg('白天秒数只能设置大于0的整数');
+                layer.msg('重试次数只能设置大于0的整数');
                 $(item).val("0");
                }
             })
@@ -409,7 +414,7 @@
                 const profit_ratio = $(this).val()
                 const intercept = profit_ratio.substring(profit_ratio.length, profit_ratio.length-1)
                 if(intercept == '.') {
-                    layer.msg('成功率只能设置浮点数');
+                    layer.msg('利润率只能设置浮点数');
                     $(this).val("0.00");
                     return
                 }
@@ -420,5 +425,21 @@
                     $(this).val("0.00");
 	            }
         })
+        $('.judge').each(function(index, item) {
+            let day_secs = $(item).find('.day_secs').val()
+            let night_secs = $(item).find('.night_secs').val()
+            let times_secs = $(item).find('.times').val()
+            $(item).change(function() {
+            let day_secs = $(item).find('.day_secs').val()
+            let night_secs = $(item).find('.night_secs').val()
+            let times_secs = $(item).find('.times').val()
+            day = day_secs
+            nights = night_secs
+            times = times_secs
+            if (day_secs == 0 || night_secs == 0 || times_secs == 0) {
+                    layer.msg('白天秒数,黑天秒数,重试次数(三者都需设置 只能设置大于0的整数)');
+                }
+            })
+        })
     });
 </script>