Browse Source

Merge branch 'raccount' of 39.97.239.116:gyfl/xyzshop into raccount

haru haru 3 years atrás
parent
commit
6fb72f6c81
1 changed files with 9 additions and 7 deletions
  1. 9 7
      admin/templates/default/provider.price.set.php

+ 9 - 7
admin/templates/default/provider.price.set.php

@@ -127,7 +127,7 @@
                         </select>
                     </td>
                     <td class="vatop rowform">
-                        <input class="txt date" style="display:none;" type="text" id="startTime" name="effect_time" placeholder="" value="<?php echo date("Y-m-d H:i:s", $output['effect_time']);?>" autocomplete="off" style="width:120px" />
+                        <input class="txt date" style="display:none;" type="text" id="startTime" name="effect_time" placeholder="" value="<?php echo date("Y-m-d H:i:s", $output['effect_time']); ?>" autocomplete="off" style="width:120px" />
                     </td>
                     <td class="vatop tips" style="color: red"></td>
                 </tr>
@@ -207,6 +207,10 @@
 <script type="text/javascript">
     $(function() {
 
+        let maxDecimal = (number) => {
+            return String(number).replace(/^(.*\..{4}).*$/, "$1")
+        }
+
         var effect_time = <?php echo json_encode($output['effect_time']) ?> * 1000;
         var curDate = new Date().getTime();
         if (effect_time > curDate) {
@@ -242,16 +246,14 @@
             let price = tdVals.eq(i).find('.price').val();
             let amountPrice = tdVals.eq(i).find('.price').attr('name').split('-')[2];
             if (tdVals.eq(i).find('input').attr('data-opened') == 1) {
-                rateInput.val(price / amountPrice * 100);
+                rateInput.val(maxDecimal((price * 1000) / (amountPrice * 1000) * 100));
             } else {
                 rateInput.val('--');
             }
         }
 
 
-        let maxDecimal = (number) => {
-            return String(number).replace(/^(.*\..{4}).*$/, "$1")
-        }
+
 
         $('.txt.price').on('input', function() {
             var val = $(this).val();
@@ -370,7 +372,7 @@
                 }
                 // console.log('_valArr', _valArr)
             }
-            $(this).parents('.setTable').children('.tbody').find('input[data-type="rate"]').val(_value);
+            $(this).parents('.setTable').children('.tbody').find('input[data-type="rate"]').val(maxDecimal(_value));
 
             $(this).parent().hide();
             $(this).prev().val('');
@@ -387,7 +389,7 @@
             const val = $(this).val();
             const amountPrice = $(this).attr('name').split('-')[2];
             const rateInput = $(this).parent().next().find('input');
-            rateInput.val(val / amountPrice * 100);
+            rateInput.val(maxDecimal((val * 1000) / (amountPrice * 1000) * 100));
         })
 
         $('.ncsc-btn-mini-price').on('click', function() {