浏览代码

报价单-销售单价/含税金额计算

jingbb 4 月之前
父节点
当前提交
0067a69639

+ 17 - 1
src/views/saleCode/quotation/components/quotationFormForm.vue

@@ -155,6 +155,7 @@
           :rowNumber="true"
           :rowSelection="true"
           asyncRemove
+          @valueChange="changeValues"
           >
             <template #lastPrice="props">
                   <a @click="viewHistory">{{ props.row.lastPrice }}</a>
@@ -593,6 +594,20 @@
         formData.quotationCustomer =obj[0].customerId
         formData.quotationCustomerName =obj[0].customerId_dictText
       }
+      function changeValues(prop){
+        if(prop.col.key=='purchasePrice'||prop.col.key=='taxRate'||prop.col.key=='tariff'||prop.col.key=='discount'||prop.col.key=='grossMargin'||prop.col.key=='customerCommision'||prop.col.key=='intermediatorCommission'){
+          if(prop.row.purchasePrice&&prop.row.taxRate&&prop.row.tariff&&prop.row.discount&&prop.row.grossMargin&&prop.row.customerCommision&&prop.row.intermediatorCommission){
+            var num= prop.row.purchasePrice/1*(1+prop.row.taxRate/100)*(1+prop.row.tariff/100)*(1-prop.row.discount/100)/(1-prop.row.grossMargin/100-prop.row.customerCommision/100-prop.row.intermediatorCommission/100)
+            prop.row.salePrice = num.toFixed(2)
+            if(prop.row.quantity){
+              prop.row.taxAmount =  prop.row.salePrice*prop.row.quantity
+            }
+          }
+        }
+        if(prop.col.key=='quantity'&&prop.row.salePrice&&prop.row.quantity){
+          prop.row.taxAmount =  prop.row.salePrice*prop.row.quantity
+        }
+      }
       return {
         saleQuotationFormShipTableRef,
         saleQuotationFormShipTable,
@@ -640,7 +655,8 @@
         VersionDetail,
         queryVersonHistoryData,
         addProductFromSupplier,
-        notAllowEdit
+        notAllowEdit,
+        changeValues
       }
     }
   });

+ 2 - 1
src/views/saleCode/quotation/quotationForm.data.ts

@@ -318,6 +318,7 @@ export const saleQuotationFormProductColumns: JVxeColumn[] = [
       placeholder: '请输入${title}',
       width:"200px",
       defaultValue:'',
+      
     },
     {
       title: '上一次报价(last price)',
@@ -329,7 +330,7 @@ export const saleQuotationFormProductColumns: JVxeColumn[] = [
       slotName: 'lastPrice',
     },
     {
-      title: '含税报价(tax amount)',
+      title: '含税金额(tax amount)',
       key: 'taxAmount',
       type: JVxeTypes.normal,
       placeholder: '请输入${title}',