Browse Source

配置毛利率

jingbb 2 months ago
parent
commit
09bcb7ee5c
1 changed files with 24 additions and 6 deletions
  1. 24 6
      src/views/saleCode/quotation/components/quotationFormForm.vue

+ 24 - 6
src/views/saleCode/quotation/components/quotationFormForm.vue

@@ -117,7 +117,7 @@
                 :labelCol="formItemLayout.labelCol1"
                 :wrapperCol="formItemLayout.wrapperCol1"
               >
-                <JDictSelectTag v-model:value="formData.currency" placeholder="请选择" dictCode="currency" @change="changeExchangeRate" />
+                <JDictSelectTag v-model:value="formData.currency" placeholder="请选择" dictCode="currency" @select="changeExchangeRate" />
               </a-form-item>
             </a-col>
             <a-col :span="12">
@@ -280,6 +280,7 @@
       <a-tab-pane tab="销售报价单 - 产品明细(product details)" key="saleQuotationFormProduct" :forceRender="true">
         <a-button type="primary" @click="selectProducts" style="margin-right: 1%; margin-bottom: 1%"> 选择产品(select product)</a-button>
         <a-button type="primary" @click="chooseSupplier"> 选择供应商报价选定(select supplier quotation selection)</a-button>
+        <a-button type="primary" @click="setSonList" style="margin-left: 1%; margin-bottom: 1%"> 配置毛利率(Configure gross margin)</a-button>
         <j-vxe-table
           :keep-source="true"
           resizable
@@ -334,6 +335,7 @@
     <SelectProjectModal ref="SelectProjectModalRef" @select-project="addProject" />
     <ViewHistoryQuotationModal ref="ViewHistoryQuotationModalRef" />
     <SelectSupplierQuotation ref="SelectSupplierQuotationRef" @select-supplier-quatation-confirm="addProductFromSupplier" />
+    <SetSonList ref="SetSonListRef" @success="setSonListFiled"></SetSonList>
   </a-spin>
 </template>
 
@@ -355,6 +357,7 @@
   import { JVxeTable } from '/@/components/jeecg/JVxeTable';
   import { saleQuotationFormShipColumns, saleQuotationFormProductColumns } from '../quotationForm.data';
   import SelectShipSModal from '../../../publicComponents/SelectShipSModal.vue';
+  import SetSonList from './SetSonList.vue';
   import BaseShipArchiveAccessoriesModal from '../../../publicComponents/BaseShipArchiveAccessoriesModal.vue';
   import SelectPrpductModal from '../../../publicComponents/SelectPrpductModal.vue';
   import SelectProjectModal from '../../../publicComponents/SelectProjectModal.vue';
@@ -386,6 +389,7 @@
       JDictSelectTag,
       JSelectInput,
       JSelectMultiple,
+      SetSonList
     },
     props: {
       formDisabled: {
@@ -400,6 +404,7 @@
       const baseUrl = domainUrl + '/sys/common/static/';
       const loading = ref(false);
       const formRef = ref();
+      var SetSonListRef = ref();
       var SelectPrpductModalRef = ref();
       var SelectProjectModalRef = ref();
       var ViewHistoryQuotationModalRef = ref();
@@ -932,11 +937,9 @@
           var newArr = [...xTable.data];
           formData.exchangeRate = formData.exchangeRate == '' || formData.exchangeRate === null || !formData.exchangeRate ? 1 : formData.exchangeRate;
           newArr.map((item) => {
-            item.discount =
-              formData.custumerDiscount == '' || formData.custumerDiscount === null || !formData.custumerDiscount ? 0 : formData.custumerDiscount;
+            item.discount = formData.custumerDiscount == '' || formData.custumerDiscount === null || !formData.custumerDiscount ? 0 : formData.custumerDiscount;
             item.tariff = item.tariff == '' || item.tariff === null || !item.tariff ? 0 : item.tariff;
-            item.customerCommision =
-              item.customerCommision == '' || item.customerCommision === null || !item.customerCommision ? 0 : item.customerCommision;
+            item.customerCommision = item.customerCommision == '' || item.customerCommision === null || !item.customerCommision ? 0 : item.customerCommision;
             item.intermediatorCommission =
               item.intermediatorCommission == '' || item.intermediatorCommission === null || !item.intermediatorCommission
                 ? 0
@@ -949,7 +952,6 @@
                 (1 - item.discount / 100)) /
               (1 - item.grossMargin / 100 - item.customerCommision / 100 - item.intermediatorCommission / 100);
             item.salePrice = !isNaN(num) ? num.toFixed(2) : '';
-
             if (item.quantity) {
               item.taxAmount = (item.salePrice * item.quantity).toFixed(2);
             }
@@ -958,6 +960,19 @@
           saleQuotationFormProductTable.dataSource = newArr;
         }
       }
+      function setSonList(){
+        SetSonListRef.value.getTable()
+      }
+      function setSonListFiled(value){
+        var xTable = (saleQuotationFormProductTableRef.value!.getXTable()).data
+        if(xTable.length>0){
+          xTable.map(item=>{
+            item.grossMargin = value.numericalValue
+          })
+        }
+        saleQuotationFormProductTable.dataSource =[...xTable]
+        changeDiscountOrExchangeRate()
+      }
       return {
         saleQuotationFormShipTableRef,
         saleQuotationFormShipTable,
@@ -1010,6 +1025,9 @@
         getRowRate,
         changeDiscountOrExchangeRate,
         changeExchangeRate,
+        setSonList,
+        SetSonListRef,
+        setSonListFiled
       };
     },
   });