Browse Source

销售合同/销售订单/销售报价单-修改价格计算

jingbb 2 months ago
parent
commit
111ddb27b8

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

@@ -712,7 +712,7 @@
           formData.quotationProjectName = data[0].code;
           formData.quotationCustomer = data[0].customerId;
           formData.quotationCustomerName = data[0].customerId_dictText;
-          formData.custumerDiscount == data[0].discount;
+          // formData.custumerDiscount == data[0].discount;
           formData.currency = '美元';
           formData.exchangeRate = '1';
           customerOption.value.map((item) => {
@@ -946,6 +946,7 @@
           // var num =((prop.row.purchasePrice / Number(formData.exchangeRate)) *(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);
           var num=(prop.row.purchasePrice * Number(formData.exchangeRate)*(1 + prop.row.tariff / 100))/(1 - prop.row.grossMargin / 100 - prop.row.customerCommision / 100-prop.row.intermediatorCommission / 100)*(1 + prop.row.taxRate / 100)
           prop.row.salePrice = !isNaN(num) ? num.toFixed(2) : '';
+          prop.row.preDiscountPrice =(prop.row.salePrice/(1-prop.row.discount / 100))toFixed(2);
           if (prop.row.quantity) {
             prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2); //计算金额
             prop.row.purchaseAmount = (prop.row.purchasePrice * prop.row.quantity).toFixed(2);  //计算采购金额
@@ -968,6 +969,7 @@
           if (prop.row.quantity) {
             prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2);
           }
+          prop.row.preDiscountPrice =(prop.row.salePrice/(1-prop.row.discount / 100))toFixed(2);
         }
         countGrossMargin()
       }
@@ -984,6 +986,7 @@
             //汇率默认为1
             var num =(item.purchasePrice * Number(formData.exchangeRate)*(1 + item.tariff / 100))/(1 - item.grossMargin / 100 - item.customerCommision / 100-item.intermediatorCommission / 100)*(1 + item.taxRate / 100)
             item.salePrice = !isNaN(num) ? num.toFixed(2) : '';
+            item.preDiscountPrice =(item.salePrice/(1-item.discount / 100)).toFixed(2);
             if (item.quantity) {
               item.taxAmount = (item.salePrice * item.quantity).toFixed(2);
             }

+ 9 - 0
src/views/saleCode/quotation/quotationForm.data.ts

@@ -313,6 +313,15 @@ export const saleQuotationFormProductColumns: JVxeColumn[] = [
       width:"200px",
       defaultValue:'',
     },
+    {
+      title: '折前单价(pre discount price)',
+      key: 'preDiscountPrice',
+      type: JVxeTypes.normal,
+      placeholder: '请输入${title}',
+      width:"200px",
+      defaultValue:'',
+      
+    },
     {
       title: '销售单价(sale price)',
       key: 'salePrice',

+ 8 - 0
src/views/saleCode/saleContract/SaleContract.data.ts

@@ -641,6 +641,14 @@ export const saleContractProductColumns: JVxeColumn[] = [
     placeholder: '请输入${title}',
     defaultValue: '',
   },
+  {
+    title: '折前单价(pre discount price)',
+    key: 'preDiscountPrice',
+    type: JVxeTypes.normal,
+    width: '200px',
+    placeholder: '请输入${title}',
+    defaultValue: '',
+  },
   {
     title: '单价(price)',
     key: 'taxPrice',

+ 2 - 1
src/views/saleCode/saleContract/components/SaleContractModal.vue

@@ -302,7 +302,8 @@
       item.id =undefined;
       item.taxPrice = item.salePrice;
       item.deliveryTime = moment(time.billDate).add(Number(item.deliveryDayChild), 'days').format('YYYY-MM-DD');
-      item.notes=''
+      item.notes='',
+      item.preDiscountPrice = (Number(item.salePrice)/(1-Number(item.discount)/100)).toFixed(2);
     });
     var xTable = saleContractProduct.value!.getXTable();
     var arrProduct = xTable.data.concat(data);

+ 18 - 10
src/views/saleCode/salesOrder/SaleOrderForm.data.ts

@@ -328,16 +328,24 @@ export const saleOrderProductColumns: JVxeColumn[] = [
       defaultValue:'',  
       width:"200px",
     },
-    // {
-    //   title: '折扣(discount)',
-    //   key: 'discount',
-    //   width:"200px",
-    //   placeholder: '请输入${title}',
-    //   defaultValue:'',
-    //   type: JVxeTypes.normal,
-    // },
     {
-      title: '单价(price)',
+      title: '折扣(discount)',
+      key: 'discount',
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+      type: JVxeTypes.normal,
+    },
+    {
+      title: '折前单价(pre discount price)',
+      key: 'preDiscountPrice',
+      type: JVxeTypes.normal,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '折后单价(price)',
       key: 'taxPrice',
       type: JVxeTypes.normal,
       width:"200px",
@@ -354,7 +362,7 @@ export const saleOrderProductColumns: JVxeColumn[] = [
       statistics:['sum'],
     },
     {
-      title: '折后单价(discounted unit price)',
+      title: '折上折后单价(discounted unit price)',
       key: 'discountedPrice',
       type: JVxeTypes.normal,
       width:"200px",

+ 5 - 6
src/views/saleCode/salesOrder/components/SlaeOrderFormForm.vue

@@ -733,9 +733,9 @@
           item.id=undefined;
           item.sourceType = 'Quo' + item.childId;
           item.taxPrice = item.salePrice;
-          item.discount = formData.doubleDiscount !== ''?formData.doubleDiscount:0;
+          item.preDiscountPrice = (item.taxPrice/(1-Number(item.discount)/100)).toFixed(2);
           if (formData.doubleDiscount && formData.doubleDiscount !== '') {
-            item.discountedPrice = Number(item.taxPrice) * (1 - Number(item.discount) / 100);
+            item.discountedPrice = Number(item.taxPrice) * (1 - Number(formData.doubleDiscount) / 100);
           } else {
             item.discountedPrice = Number(item.taxPrice);
           }
@@ -780,8 +780,7 @@
         var detail = xTable.data,
         num = 0;
         detail.map((item) => {
-          item.discount = formData.doubleDiscount
-          item.discountedPrice = (Number(item.taxPrice) * (1 - Number(item.discount) / 100)).toFixed(2);
+          item.discountedPrice = (Number(item.taxPrice) * (1 - Number(formData.doubleDiscount) / 100)).toFixed(2);
           item.discountedAmount = (Number(item.discountedPrice) * Number(item.quantity)).toFixed(2);
           num = num + Number(item.discountedAmount);
         });
@@ -796,9 +795,9 @@
           item.deliveryTime = formData.deliveryTime&&formData.deliveryTime!==''?formData.deliveryTime:item.deliveryTime;
           item.sourceId = item.childId;
           item.sourceType = 'Con' + item.childId;
-          item.discount = formData.doubleDiscount !== ''?formData.doubleDiscount:0;
+          item.preDiscountPrice = (item.taxPrice/(1-Number(item.discount)/100)).toFixed(2);
           if (formData.doubleDiscount && formData.doubleDiscount !== '') {
-            item.discountedPrice = Number(item.taxPrice) * (1 - Number(item.discount) / 100);
+            item.discountedPrice = Number(item.taxPrice) * (1 - Number(formData.doubleDiscount) / 100);
           } else {
             item.discountedPrice = Number(item.taxPrice);
           }