Bläddra i källkod

change: indent导出PDF样式调整.

peter 1 månad sedan
förälder
incheckning
0efcca296a
1 ändrade filer med 19 tillägg och 9 borttagningar
  1. 19 9
      src/pages/indent-manage/indent/components/exportQuota2.vue

+ 19 - 9
src/pages/indent-manage/indent/components/exportQuota2.vue

@@ -132,7 +132,9 @@
 
             <p v-if="productInfo.product_other">
               <strong>More Details:</strong>
-              <span v-html="productInfo.product_other.replace(/\n/g, '<br>')"></span>
+              <span
+                v-html="productInfo.product_other.replace(/\n/g, '<br>')"
+              ></span>
             </p>
           </td>
         </tr>
@@ -249,22 +251,23 @@
                     }}
                   </td>
                   <td style="border-bottom: solid 1px #ccc; height: 45px">
-                    {{ row.number }} units
+                    {{ formatNumber(row.number) }}units
                   </td>
                   <td style="border-bottom: solid 1px #ccc; height: 45px">
-                    ${{ row.setup_cost }}
-                    {{ exportForm.gst_name ? '+GST' : '' }}
+                    ${{ formatNumber(row.setup_cost)
+                    }}{{ exportForm.gst_name ? '+GST' : '' }}
                   </td>
                   <td style="border-bottom: solid 1px #ccc; height: 45px">
-                    ${{ row.sold_unit }} {{ exportForm.gst_name ? '+GST' : '' }}
+                    ${{ formatNumber(row.sold_unit)
+                    }}{{ exportForm.gst_name ? '+GST' : '' }}
                   </td>
                   <td style="border-bottom: solid 1px #ccc; height: 45px">
-                    ${{ row.add_freight_cost }}
-                    {{ exportForm.gst_name ? '+GST' : '' }}
+                    ${{ formatNumber(row.add_freight_cost)
+                    }}{{ exportForm.gst_name ? '+GST' : '' }}
                   </td>
                   <td style="border-bottom: solid 1px #ccc; height: 45px">
-                    ${{ row.sold_price }}
-                    {{ exportForm.gst_name ? '+GST' : '' }}
+                    ${{ formatNumber(row.sold_price)
+                    }}{{ exportForm.gst_name ? '+GST' : '' }}
                   </td>
                 </tr>
 
@@ -468,6 +471,13 @@ const computedCreator = computed(() => {
   }
   return result
 })
+
+// 处理数字, 保留两位小数, 即使是整数也显示两位00, 每3位用英文逗号分割
+const formatNumber = (number: number) => {
+  const num = Number(number)
+  if (Number.isNaN(num)) return '0.00'
+  return num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')
+}
 </script>
 <style lang="scss" scoped>
 $subColor: #777;