|  | @@ -825,6 +825,7 @@
 | 
											
												
													
														|  |            item.exchangeRateGys = item.exchangeRateUsd;
 |  |            item.exchangeRateGys = item.exchangeRateUsd;
 | 
											
												
													
														|  |            item.taxPriceGys = item.taxPrice;
 |  |            item.taxPriceGys = item.taxPrice;
 | 
											
												
													
														|  |            item.notes=item.childNotes
 |  |            item.notes=item.childNotes
 | 
											
												
													
														|  | 
 |  | +          item.purchaseAmount=(Number(item.quantity) * Number(item.purchasePrice)).toFixed(2)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          var xTable = saleQuotationFormProductTableRef.value!.getXTable();
 |  |          var xTable = saleQuotationFormProductTableRef.value!.getXTable();
 | 
											
												
													
														|  |          var arrProduct = xTable.data.concat(data);
 |  |          var arrProduct = xTable.data.concat(data);
 | 
											
										
											
												
													
														|  | @@ -889,49 +890,32 @@
 | 
											
												
													
														|  |          return obj;
 |  |          return obj;
 | 
											
												
													
														|  |        }
 |  |        }
 | 
											
												
													
														|  |        function changeValues(prop) {
 |  |        function changeValues(prop) {
 | 
											
												
													
														|  | 
 |  | +        //设置 默认值
 | 
											
												
													
														|  |          formData.exchangeRate = formData.exchangeRate == '' || formData.exchangeRate === null ? 1 : formData.exchangeRate;
 |  |          formData.exchangeRate = formData.exchangeRate == '' || formData.exchangeRate === null ? 1 : formData.exchangeRate;
 | 
											
												
													
														|  | -        prop.row.customerCommision =
 |  | 
 | 
											
												
													
														|  | -          prop.row.customerCommision == '' || prop.row.customerCommision === null || !prop.row.customerCommision ? 0 : prop.row.customerCommision;
 |  | 
 | 
											
												
													
														|  | 
 |  | +        prop.row.customerCommision = prop.row.customerCommision == '' || prop.row.customerCommision === null || !prop.row.customerCommision ? 0 : prop.row.customerCommision;
 | 
											
												
													
														|  |          prop.row.discount = prop.row.discount == '' || prop.row.discount === null || !prop.row.discount ? 0 : prop.row.discount;
 |  |          prop.row.discount = prop.row.discount == '' || prop.row.discount === null || !prop.row.discount ? 0 : prop.row.discount;
 | 
											
												
													
														|  |          prop.row.tariff = prop.row.tariff == '' || prop.row.tariff === null || !prop.row.tariff ? 0 : prop.row.tariff;
 |  |          prop.row.tariff = prop.row.tariff == '' || prop.row.tariff === null || !prop.row.tariff ? 0 : prop.row.tariff;
 | 
											
												
													
														|  | -        prop.row.intermediatorCommission =
 |  | 
 | 
											
												
													
														|  | -          prop.row.intermediatorCommission == '' || prop.row.intermediatorCommission === null || !prop.row.intermediatorCommission
 |  | 
 | 
											
												
													
														|  | -            ? 0
 |  | 
 | 
											
												
													
														|  | -            : prop.row.intermediatorCommission;
 |  | 
 | 
											
												
													
														|  | -        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'
 |  | 
 | 
											
												
													
														|  | -        ) {
 |  | 
 | 
											
												
													
														|  | -          //汇率默认为1
 |  | 
 | 
											
												
													
														|  | -          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);
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +        prop.row.intermediatorCommission =prop.row.intermediatorCommission == '' || prop.row.intermediatorCommission === null || !prop.row.intermediatorCommission? 0: prop.row.intermediatorCommission;
 | 
											
												
													
														|  | 
 |  | +        //计算销售单价
 | 
											
												
													
														|  | 
 |  | +        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') {
 | 
											
												
													
														|  | 
 |  | +          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);
 | 
											
												
													
														|  |            prop.row.salePrice = !isNaN(num) ? num.toFixed(2) : '';
 |  |            prop.row.salePrice = !isNaN(num) ? num.toFixed(2) : '';
 | 
											
												
													
														|  |            if (prop.row.quantity) {
 |  |            if (prop.row.quantity) {
 | 
											
												
													
														|  | -            prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2); //计算金额
 | 
											
												
													
														|  | 
 |  | +            prop.row.purchaseAmount = (prop.row.purchasePrice * prop.row.quantity).toFixed(2);  //计算采购金额
 | 
											
												
													
														|  |            }
 |  |            }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        if (prop.col.key == 'quantity' && 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).toFixed(2);
 |  |            prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | 
 |  | +        //计算采购金额
 | 
											
												
													
														|  | 
 |  | +        if (prop.col.key == 'quantity' && prop.row.quantity&& prop.row.purchasePrice) {
 | 
											
												
													
														|  | 
 |  | +          prop.row.purchaseAmount = (prop.row.purchasePrice * prop.row.quantity).toFixed(2);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        //计算毛利率/金额
 | 
											
												
													
														|  |          if (prop.col.key == 'salePrice') {
 |  |          if (prop.col.key == 'salePrice') {
 | 
											
												
													
														|  | -          var num =
 |  | 
 | 
											
												
													
														|  | -            1 -
 |  | 
 | 
											
												
													
														|  | -            (((prop.row.purchasePrice / Number(formData.exchangeRate)) *
 |  | 
 | 
											
												
													
														|  | -              (1 + prop.row.taxRate / 100) *
 |  | 
 | 
											
												
													
														|  | -              (1 + prop.row.tariff / 100) *
 |  | 
 | 
											
												
													
														|  | -              (1 - prop.row.discount / 100)) /
 |  | 
 | 
											
												
													
														|  | -              prop.row.salePrice +
 |  | 
 | 
											
												
													
														|  | -              (prop.row.customerCommision / 100 - prop.row.intermediatorCommission / 100));
 |  | 
 | 
											
												
													
														|  | 
 |  | +          var num =1 -(((prop.row.purchasePrice / Number(formData.exchangeRate)) *(1 + prop.row.taxRate / 100) *(1 + prop.row.tariff / 100) *(1 - prop.row.discount / 100)) /prop.row.salePrice +(prop.row.customerCommision / 100 - prop.row.intermediatorCommission / 100));
 | 
											
												
													
														|  |            num = (Number(num) * 100).toFixed(2);
 |  |            num = (Number(num) * 100).toFixed(2);
 | 
											
												
													
														|  |            prop.row.grossMargin = !isNaN(num) ? num : '';
 |  |            prop.row.grossMargin = !isNaN(num) ? num : '';
 | 
											
												
													
														|  |            if (prop.row.quantity) {
 |  |            if (prop.row.quantity) {
 |