瀏覽代碼

提交报价管理

hezhanp 9 月之前
父節點
當前提交
97e2510a3c
共有 2 個文件被更改,包括 239 次插入204 次删除
  1. 121 75
      src/BIZComponents/inventoryTable.vue
  2. 118 129
      src/BIZComponents/inventoryTableDetails.vue

+ 121 - 75
src/BIZComponents/inventoryTable.vue

@@ -681,7 +681,11 @@
       <!-- 生产加工类型特有列的模板 -->
       <template v-slot:thickNess="{ row, $index }">
         <el-form-item :prop="'datasource.' + $index + '.thickNess'">
-          <el-input v-model="row.thickNess" placeholder="请输入">
+          <el-input
+            v-model="row.thickNess"
+            placeholder="请输入"
+            @input="calculateIncludingTaxPrice(row, $index)"
+          >
             <template slot="append">mm</template></el-input
           >
         </el-form-item>
@@ -689,7 +693,11 @@
 
       <template v-slot:squareNumber="{ row, $index }">
         <el-form-item :prop="'datasource.' + $index + '.squareNumber'">
-          <el-input v-model="row.squareNumber" placeholder="请输入">
+          <el-input
+            v-model="row.squareNumber"
+            placeholder="请输入"
+            @input="calculateIncludingTaxPrice(row, $index)"
+          >
             <template slot="append">m²</template></el-input
           >
         </el-form-item>
@@ -738,17 +746,19 @@
         </el-form-item>
       </template>
 
-      <!-- 新增未税小记列模板 -->
+      <!-- 未税小计列模板 -->
       <template v-slot:untaxedSubtotal="{ row, $index }">
-        <el-form-item :prop="'datasource.' + $index + '.untaxedSubtotal'">
-          {{ (Number(row.untaxedSubtotal) || 0).toFixed(2) }}元
+        <el-form-item
+          :prop="'datasource.' + $index + '.quotationSubtotalBeforeTax'"
+        >
+          {{ (Number(row.quotationSubtotalBeforeTax) || 0).toFixed(2) }}元
         </el-form-item>
       </template>
 
-      <template v-slot:additionalTaxRate="{ row, $index }">
-        <el-form-item :prop="'datasource.' + $index + '.additionalTaxRate'">
+      <template v-slot:extraTax="{ row, $index }">
+        <el-form-item :prop="'datasource.' + $index + '.extraTax'">
           <el-input
-            v-model="row.additionalTaxRate"
+            v-model="row.extraTax"
             type="number"
             placeholder="请输入"
             @input="calculateIncludingTaxPrice(row, $index)"
@@ -758,13 +768,14 @@
         </el-form-item>
       </template>
 
-      <!-- 含税单价改为含税小计 -->
-      <template v-slot:includingTaxPrice="{ row, $index }">
-        <el-form-item :prop="'datasource.' + $index + '.includingTaxPrice'">
+      <!-- 含税小计模板 -->
+      <template v-slot:quotationSubtotalTax="{ row, $index }">
+        <el-form-item :prop="'datasource.' + $index + '.quotationSubtotalTax'">
           <el-input
-            v-model="row.includingTaxPrice"
+            v-model="row.quotationSubtotalTax"
             type="number"
             placeholder="请输入"
+            @input="onQuotationSubtotalTaxChange(row, $index)"
           >
             <template slot="append">元</template>
           </el-input>
@@ -1011,10 +1022,10 @@ export default {
       processingFeeBeforeTax: '',
       packagingFeeNotTaxed: '',
       transportationFeeWithoutTax: '',
-      additionalTaxRate: '',
-      includingTaxPrice: '',
-      // 新增未税小记字段
-      untaxedSubtotal: ''
+      extraTax: '', // 税率(%)
+      quotationSubtotalTax: '', // 含税小计
+      // 未税小记字段
+      quotationSubtotalBeforeTax: '' // 未税小计
     };
     return {
       levelList,
@@ -1070,7 +1081,6 @@ export default {
           fixed: 'left'
         },
         {
-          label: '选择',
           width: 45,
           type: 'selection',
           columnKey: 'selection',
@@ -1154,21 +1164,6 @@ export default {
             slot: 'squareNumber',
             align: 'center'
           },
-          {
-            width: 120,
-            prop: 'singleWeight',
-            label: '单重',
-            slot: 'singleWeight',
-            headerSlot: 'headerSingleWeight',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'weightUnit',
-            label: '重量单位',
-            slot: 'weightUnit',
-            align: 'center'
-          },
           {
             width: 150,
             prop: 'processingFeeBeforeTax',
@@ -1192,23 +1187,23 @@ export default {
           },
           {
             width: 150,
-            prop: 'untaxedSubtotal',
+            prop: 'quotationSubtotalBeforeTax',
             label: '未税小计',
-            slot: 'additionalTaxRate_untaxed',
+            slot: 'untaxedSubtotal',
             align: 'center'
           },
           {
             width: 150,
-            prop: 'additionalTaxRate',
+            prop: 'extraTax',
             label: '税率(%)',
-            slot: 'additionalTaxRate',
+            slot: 'extraTax',
             align: 'center'
           },
           {
             width: 150,
-            prop: 'includingTaxPrice',
+            prop: 'quotationSubtotalTax',
             label: '含税小计',
-            slot: 'includingTaxPrice',
+            slot: 'quotationSubtotalTax',
             align: 'center'
           }
         );
@@ -1225,6 +1220,22 @@ export default {
             this.isDate == 1 ? 'headerCustomerExpectDeliveryDeadline' : '',
           align: 'center'
         },
+        
+          {
+            width: 120,
+            prop: 'singleWeight',
+            label: '单重',
+            slot: 'singleWeight',
+            headerSlot: 'headerSingleWeight',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'weightUnit',
+            label: '重量单位',
+            slot: 'weightUnit',
+            align: 'center'
+          },
         {
           minWidth: 120,
           prop: 'goodsLevel',
@@ -1568,20 +1579,20 @@ export default {
       'form.datasource',
       (newVal) => {
         newVal.forEach((row, index) => {
-          // 为每个行项目添加监听器
           this.$watch(
             () => [
               row.processingFeeBeforeTax,
               row.packagingFeeNotTaxed,
               row.transportationFeeWithoutTax,
-              row.additionalTaxRate,
-              row[this.countObj.countKey]
+              row.extraTax,
+              row[this.countObj.countKey], // 显式监听数量字段
+              row.quotationSubtotalTax // 监听手动修改的含税小计
             ],
             () => {
               this.calculateIncludingTaxPrice(row, index);
-              this.changeAll(); // 更新总价
+              this.changeAll();
             },
-            { deep: true }
+            { deep: true, immediate: true } // 立即执行一次
           );
         });
       },
@@ -1716,6 +1727,16 @@ export default {
         v.customerReqFiles = v.customerReqFiles || [];
         v.industryArtFiles = v.industryArtFiles || [];
         v.otherFiles = v.otherFiles || [];
+
+        // 确保接口所需字段存在
+        v.quotationSubtotalBeforeTax = v.quotationSubtotalBeforeTax || '0.00';
+        v.quotationSubtotalTax = v.quotationSubtotalTax || '0.00';
+        v.extraTax = v.extraTax || 0;
+
+        // 删除旧字段
+        delete v.untaxedSubtotal;
+        delete v.includingTaxPrice;
+        delete v.additionalTaxRate;
       });
       return comitDatasource;
     },
@@ -1750,31 +1771,47 @@ export default {
       this.$forceUpdate();
     },
 
-    // 计算含税小计(原含税单价逻辑)
+    // 含税小计手动修改时触发
+    onQuotationSubtotalTaxChange(row, index) {
+      // 计算总价
+      if (row[this.countObj.countKey]) {
+        const totalPrice =
+          Number(row.quotationSubtotalTax) *
+          Number(row[this.countObj.countKey]);
+        this.$set(row, 'totalPrice', totalPrice.toFixed(2));
+      }
+      this.changeAll(); // 更新总价
+    },
+
+    // 计算含税小计
     calculateIncludingTaxPrice(row, index) {
       if (!row) return;
 
       // 计算各项费用总和(加工费 + 包装费 + 运输费)作为未税小记
-      const untaxedSubtotal =
+      const quotationSubtotalBeforeTax =
         (Number(row.processingFeeBeforeTax) || 0) +
         (Number(row.packagingFeeNotTaxed) || 0) +
         (Number(row.transportationFeeWithoutTax) || 0);
 
       // 设置未税小记的值
-      this.$set(row, 'untaxedSubtotal', untaxedSubtotal.toFixed(2));
+      this.$set(
+        row,
+        'quotationSubtotalBeforeTax',
+        quotationSubtotalBeforeTax.toFixed(2)
+      );
 
       // 计算额外税率(将百分比转换为小数)
-      const taxRate = (Number(row.additionalTaxRate) || 0) / 100;
+      const taxRate = (Number(row.extraTax) || 0) / 100;
 
       // 计算含税小计 = 未税小记 * (1 + 额外税率)
-      const includingTaxPrice = untaxedSubtotal * (1 + taxRate);
+      const quotationSubtotalTax = quotationSubtotalBeforeTax * (1 + taxRate);
 
-      this.$set(row, 'includingTaxPrice', includingTaxPrice.toFixed(2));
+      this.$set(row, 'quotationSubtotalTax', quotationSubtotalTax.toFixed(2));
 
       // 更新总价
       if (row[this.countObj.countKey]) {
         const totalPrice =
-          includingTaxPrice * Number(row[this.countObj.countKey]);
+          quotationSubtotalTax * Number(row[this.countObj.countKey]);
         this.$set(row, 'totalPrice', totalPrice.toFixed(2));
       }
     },
@@ -1907,7 +1944,7 @@ export default {
             item[this.countObj.countKey] = 1;
           }
 
-          // 初始化生产加工特有字段及未税小记
+          // 初始化生产加工特有字段及未税小记、含税小计和税率
           if (this.quoteType === 2) {
             item.thickNess = item.thickNess || '';
             item.squareNumber = item.squareNumber || '';
@@ -1915,14 +1952,23 @@ export default {
             item.packagingFeeNotTaxed = item.packagingFeeNotTaxed || '';
             item.transportationFeeWithoutTax =
               item.transportationFeeWithoutTax || '';
-            item.additionalTaxRate = item.additionalTaxRate || '';
+            // 映射旧税率字段到新字段
+            item.extraTax = item.additionalTaxRate || 13;
+            this.calculateIncludingTaxPrice(item, index);
             // 计算未税小记
-            const untaxedSubtotal =
+            const quotationSubtotalBeforeTax =
               (Number(item.processingFeeBeforeTax) || 0) +
               (Number(item.packagingFeeNotTaxed) || 0) +
               (Number(item.transportationFeeWithoutTax) || 0);
-            item.untaxedSubtotal = untaxedSubtotal.toFixed(2);
-            item.includingTaxPrice = item.includingTaxPrice || '';
+            item.quotationSubtotalBeforeTax =
+              quotationSubtotalBeforeTax.toFixed(2);
+            // 映射旧含税单价字段到新含税小计字段
+            item.quotationSubtotalTax = item.includingTaxPrice || '';
+
+            // 删除旧字段
+            delete item.untaxedSubtotal;
+            delete item.includingTaxPrice;
+            delete item.additionalTaxRate;
           }
         });
         this.form.datasource = productList;
@@ -2081,6 +2127,18 @@ export default {
           this.$set(parasm, this.countObj.countKey, 1);
         }
 
+        // 初始化生产加工特有字段及未税小记、含税小计和税率
+        if (this.quoteType === 2) {
+          parasm.thickNess = '';
+          parasm.squareNumber = '';
+          parasm.processingFeeBeforeTax = '';
+          parasm.packagingFeeNotTaxed = '';
+          parasm.transportationFeeWithoutTax = '';
+          parasm.extraTax = 13;
+          parasm.quotationSubtotalBeforeTax = '0.00';
+          parasm.quotationSubtotalTax = '';
+        }
+
         if (this.isSupplier) {
           this.$set(
             parasm,
@@ -2105,18 +2163,6 @@ export default {
         }
         this.$set(parasm, 'provenance', item.purchaseOrigins || []);
 
-        // 初始化生产加工特有字段及未税小记
-        if (this.quoteType === 2) {
-          parasm.thickNess = '';
-          parasm.squareNumber = '';
-          parasm.processingFeeBeforeTax = '';
-          parasm.packagingFeeNotTaxed = '';
-          parasm.transportationFeeWithoutTax = '';
-          parasm.additionalTaxRate = 13;
-          parasm.untaxedSubtotal = '0.00';
-          parasm.includingTaxPrice = '';
-        }
-
         if (idx == -1) {
           this.form.datasource.push(row);
         }
@@ -2218,16 +2264,16 @@ export default {
           this.$set(parasm, this.countObj.countKey, 1);
         }
 
-        // 初始化生产加工特有字段及未税小记
+        // 初始化生产加工特有字段及未税小记、含税小计和税率
         if (this.quoteType === 2) {
           parasm.thickNess = '';
           parasm.squareNumber = '';
           parasm.processingFeeBeforeTax = '';
           parasm.packagingFeeNotTaxed = '';
           parasm.transportationFeeWithoutTax = '';
-          parasm.additionalTaxRate = '';
-          parasm.untaxedSubtotal = '0.00';
-          parasm.includingTaxPrice = '';
+          parasm.extraTax = '';
+          parasm.quotationSubtotalBeforeTax = '0.00';
+          parasm.quotationSubtotalTax = '';
         }
 
         if (idx == -1) {
@@ -2258,16 +2304,16 @@ export default {
         item[this.countObj.countKey] = 1;
       }
 
-      // 初始化生产加工特有字段及未税小记
+      // 初始化生产加工特有字段及未税小记、含税小计和税率
       if (this.quoteType === 2) {
         item.thickNess = '';
         item.squareNumber = '';
         item.processingFeeBeforeTax = '';
         item.packagingFeeNotTaxed = '';
         item.transportationFeeWithoutTax = '';
-        item.additionalTaxRate = '';
-        item.untaxedSubtotal = '0.00';
-        item.includingTaxPrice = '';
+        item.extraTax = '';
+        item.quotationSubtotalBeforeTax = '0.00';
+        item.quotationSubtotalTax = '';
       }
 
       this.form.datasource.push(item);

+ 118 - 129
src/BIZComponents/inventoryTableDetails.vue

@@ -67,19 +67,19 @@
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.' + countObj.countKey"
         >
-          {{ scope.row[countObj.countKey] }}
+          {{ scope.row[countObj.countKey] }}{{ scope.row[countObj.unitKey] }}
         </el-form-item>
       </template>
-      <template v-slot:saleUnit="scope">
+      <!-- <template v-slot:saleUnit="scope">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.' + countObj.unitKey"
         >
           {{ scope.row[countObj.unitKey] }}
         </el-form-item>
-      </template>
+      </template> -->
 
-      <!-- 新增字段插槽 - 只在类型为2时显示 -->
+      <!-- 新增字段插槽 -->
       <template v-slot:thickNess="scope">
         <el-form-item
           style="margin-bottom: 20px"
@@ -269,11 +269,6 @@
       isProductionRequirements: {
         type: Boolean,
         default: false
-      },
-      // 报价类型(1:产品销售,2:生产加工)
-      quoteType: {
-        type: Number,
-        default: 1
       }
     },
     data() {
@@ -316,9 +311,7 @@
             align: 'center'
           };
         }
-
-        // 基础列(所有类型都显示)
-        const baseColumns = [
+        return [
           {
             width: 45,
             type: 'index',
@@ -354,65 +347,54 @@
             label: '规格',
             slot: 'specification',
             align: 'center'
-          }
-        ];
-
-        // 类型为2时显示的列(生产加工)
-        const type2Columns = [];
-        if (this.quoteType === 2) {
-          type2Columns.push(
-            // 新增字段:厚度
-            {
-              width: 150,
-              prop: 'thickNess',
-              label: '厚度',
-              slot: 'thickNess',
-              align: 'center'
-            },
-            // 新增字段:平方数
-            {
-              width: 150,
-              prop: 'squareNumber',
-              label: '平方数',
-              slot: 'squareNumber',
-              align: 'center'
-            },
-            // 新增字段:加工费(未税)
-            {
-              width: 150,
-              prop: 'processingFeeBeforeTax',
-              label: '加工费(未税)',
-              slot: 'processingFeeBeforeTax',
-              align: 'center'
-            },
-            // 新增字段:包装费(未税)
-            {
-              width: 150,
-              prop: 'packagingFeeNotTaxed',
-              label: '包装费(未税)',
-              slot: 'packagingFeeNotTaxed',
-              align: 'center'
-            },
-            // 新增字段:运输费(未税)
-            {
-              width: 150,
-              prop: 'transportationFeeWithoutTax',
-              label: '运输费(未税)',
-              slot: 'transportationFeeWithoutTax',
-              align: 'center'
-            },
-            {
-              width: 150,
-              prop: 'quotationSubtotalBeforeTax',
-              label: '报价小计(未税)',
-              slot: 'quotationSubtotalBeforeTax',
-              align: 'center'
-            }
-          );
-        }
-
-        // 其他公共列
-        const otherColumns = [
+          },
+          // 新增字段:厚度
+          {
+            width: 150,
+            prop: 'thickNess',
+            label: '厚度',
+            slot: 'thickNess',
+            align: 'center'
+          },
+          // 新增字段:平方数
+          {
+            width: 150,
+            prop: 'squareNumber',
+            label: '平方数',
+            slot: 'squareNumber',
+            align: 'center'
+          },
+          // 新增字段:加工费(未税)
+          {
+            width: 150,
+            prop: 'processingFeeBeforeTax',
+            label: '加工费(未税)',
+            slot: 'processingFeeBeforeTax',
+            align: 'center'
+          },
+          // 新增字段:包装费(未税)
+          {
+            width: 150,
+            prop: 'packagingFeeNotTaxed',
+            label: '包装费(未税)',
+            slot: 'packagingFeeNotTaxed',
+            align: 'center'
+          },
+          // 新增字段:运输费(未税)
+          {
+            width: 150,
+            prop: 'transportationFeeWithoutTax',
+            label: '运输费(未税)',
+            slot: 'transportationFeeWithoutTax',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'quotationSubtotalBeforeTax',
+            label: '报价小计(未税)',
+            slot: 'quotationSubtotalBeforeTax',
+            align: 'center'
+          },
           {
             width: 200,
             prop: 'customerMark',
@@ -465,21 +447,21 @@
                 width: 1
               },
           {
-            width: 150,
+            width: 180,
             prop: 'saleCount',
             label: '数量',
             slot: 'saleCount',
             headerSlot: 'headerTotalCount',
             align: 'center'
           },
-          {
-            width: 150,
-            prop: 'saleUnit',
-            label: '单位',
-            slot: 'saleUnit',
-            headerSlot: 'headerTotalCount',
-            align: 'center'
-          },
+          // {
+          //   width: 150,
+          //   prop: 'saleUnit',
+          //   label: '单位',
+          //   slot: 'saleUnit',
+          //   headerSlot: 'headerTotalCount',
+          //   align: 'center'
+          // },
           {
             width: 120,
             prop: 'packingSpecification',
@@ -500,59 +482,79 @@
             },
             align: 'center'
           },
-          {
-            width: 120,
-            prop: 'measuringUnit',
-            label: '计量单位',
-            slot: 'measuringUnit',
-            align: 'center'
-          },
+          // {
+          //   width: 120,
+          //   prop: 'measuringUnit',
+          //   label: '计量单位',
+          //   slot: 'measuringUnit',
+          //   align: 'center'
+          // },
           wmsColumn,
           this.pageName == 'send'
             ? {
-                minWidth: 110,
+                minWidth: 140,
                 prop: 'sendTotalCount',
                 label: '已发货数量',
                 slot: 'sendTotalCount',
-                align: 'center'
+                align: 'center',
+                formatter: (row, column) => {
+                  if (row.sendTotalCount) {
+                    return row.sendTotalCount + ' ' + row.measuringUnit;
+                  }
+                }
               }
             : {
                 width: 1
               },
           this.pageName == 'send'
             ? {
-                minWidth: 110,
+                minWidth: 140,
                 prop: 'notSendTotalCount',
                 label: '未发货数量',
                 slot: 'notSendTotalCount',
-                align: 'center'
+                align: 'center',
+                formatter: (row, column) => {
+                  if (row.notSendTotalCount) {
+                    return row.notSendTotalCount + ' ' + row.measuringUnit;
+                  }
+                }
               }
             : {
                 width: 1
               },
 
           {
-            width: 120,
+            width: 140,
             prop: 'singleWeight',
             label: '单重',
             slot: 'singleWeight',
             headerSlot: 'headerSingleWeight',
+            formatter: (row, column) => {
+              if (row.singleWeight) {
+                return row.singleWeight + ' ' + row.weightUnit;
+              }
+            },
             align: 'center'
           },
           {
-            width: 120,
+            width: 140,
             prop: 'totalWeight',
             label: '总重',
             slot: 'totalWeight',
+            formatter: (row, column) => {
+              if (row.totalWeight) {
+                return row.totalWeight + ' ' + row.weightUnit;
+              }
+            },
             align: 'center'
           },
-          {
-            width: 120,
-            prop: 'weightUnit',
-            label: '重量单位',
-            slot: 'weightUnit',
-            align: 'center'
-          },
+          // {
+          //   width: 120,
+          //   prop: 'weightUnit',
+          //   label: '重量单位',
+          //   slot: 'weightUnit',
+          //   align: 'center'
+          // },
 
           {
             width: 160,
@@ -658,32 +660,22 @@
             slot: 'modelType',
             align: 'center'
           },
-          // 机型列 - 只在类型为2时显示
-          this.quoteType === 2
-            ? {
-                minWidth: 120,
-                prop: 'modelKey',
-                label: '机型',
-                slot: 'modelKey',
-                showOverflowTooltip: true,
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
-          // 颜色列 - 只在类型为2时显示
-          this.quoteType === 2
-            ? {
-                minWidth: 120,
-                prop: 'colorKey',
-                slot: 'colorKey',
-                showOverflowTooltip: true,
-                label: '颜色',
-                align: 'center'
-              }
-            : {
-                width: 1
-              },
+          {
+            minWidth: 120,
+            prop: 'modelKey',
+            label: '机型',
+            slot: 'modelKey',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            minWidth: 120,
+            prop: 'colorKey',
+            slot: 'colorKey',
+            showOverflowTooltip: true,
+            label: '颜色',
+            align: 'center'
+          },
           {
             width: 120,
             prop: 'imgCode',
@@ -861,9 +853,6 @@
             align: 'center'
           }
         ];
-
-        // 合并所有列
-        return [...baseColumns, ...type2Columns, ...otherColumns];
       }
     },