Просмотр исходного кода

采购 销售 添加单位换算 (还未测试 不要合并到test !不要合并到test!)

yusheng 1 год назад
Родитель
Сommit
68401ebdc7
44 измененных файлов с 2160 добавлено и 966 удалено
  1. 1 0
      package.json
  2. 174 74
      src/BIZComponents/inventoryTable.vue
  3. 78 27
      src/BIZComponents/inventoryTableDetails.vue
  4. 5 1
      src/BIZComponents/processSubmitDialog/processSubmitDialog.vue
  5. 15 4
      src/BIZComponents/product-list.vue
  6. 106 53
      src/BIZComponents/setProduct.js
  7. 11 0
      src/api/wms/index.js
  8. 5 1
      src/main.js
  9. 29 17
      src/views/commodityManagement/commodityPriceList/components/commodityPriceListDialog.vue
  10. 44 8
      src/views/contractManage/contractBook/components/addDialog.vue
  11. 5 0
      src/views/contractManage/contractBook/components/detailDialog.vue
  12. 1 1
      src/views/financialManage/invoiceManage/components/saleAccountTable.vue
  13. 2 0
      src/views/financialManage/receivableManage/components/detailDialog.vue
  14. 4 0
      src/views/financialManage/receivableManage/components/detailDialog1.vue
  15. 30 16
      src/views/purchasingManage/inquiryManage/components/detailDialog.vue
  16. 101 19
      src/views/purchasingManage/inquiryManage/components/inquiryTable.vue
  17. 29 9
      src/views/purchasingManage/purchaseNeedManage/components/detailDialog.vue
  18. 137 22
      src/views/purchasingManage/purchaseNeedManage/components/inventoryTable.vue
  19. 2 2
      src/views/purchasingManage/purchaseOrder/accountstatement/components/inventoryTable.vue
  20. 6 1
      src/views/purchasingManage/purchaseOrder/components/addDialog.vue
  21. 43 30
      src/views/purchasingManage/purchaseOrder/components/detailDialog.vue
  22. 260 130
      src/views/purchasingManage/purchaseOrder/components/inventoryTable.vue
  23. 38 15
      src/views/purchasingManage/purchaseOrder/invoice/components/detailDialog.vue
  24. 205 83
      src/views/purchasingManage/purchaseOrder/invoice/components/inventoryTable.vue
  25. 38 22
      src/views/purchasingManage/purchaseOrder/outSourceSend/components/detailDialog.vue
  26. 200 91
      src/views/purchasingManage/purchaseOrder/outSourceSend/components/inventoryTable.vue
  27. 14 14
      src/views/purchasingManage/purchaseOrder/returnGoods/components/detailDialog.vue
  28. 14 14
      src/views/purchasingManage/purchaseOrder/returnGoods/components/inventoryTable.vue
  29. 28 15
      src/views/purchasingManage/purchasePlanManage/components/detailDialog.vue
  30. 134 30
      src/views/purchasingManage/purchasePlanManage/components/inventoryTable.vue
  31. 1 0
      src/views/saleManage/quotation/index.vue
  32. 11 11
      src/views/saleManage/saleOrder/accountstatement/components/inventoryTable.vue
  33. 7 0
      src/views/saleManage/saleOrder/components/addDialog.vue
  34. 2 2
      src/views/saleManage/saleOrder/customerReturnOrder/add-sale-order-dialog.vue
  35. 14 14
      src/views/saleManage/saleOrder/entrustedReceive/components/detailDialog.vue
  36. 14 14
      src/views/saleManage/saleOrder/entrustedReceive/components/inventoryTable.vue
  37. 14 14
      src/views/saleManage/saleOrder/exceptionManagement/components/addOrEditDialog.vue
  38. 1 8
      src/views/saleManage/saleOrder/invoice/components/detailDialog.vue
  39. 237 126
      src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue
  40. 44 22
      src/views/saleManage/saleOrder/invoice/components/inventoryTableDetails.vue
  41. 14 14
      src/views/saleManage/saleOrder/invoiceConfirm/components/addInvoiceDialog.vue
  42. 14 14
      src/views/saleManage/saleOrder/invoiceConfirm/components/detailDialog.vue
  43. 14 14
      src/views/saleManage/saleOrder/returnGoods/components/detailDialog.vue
  44. 14 14
      src/views/saleManage/saleOrder/returnGoods/components/inventoryTable.vue

+ 1 - 0
package.json

@@ -39,6 +39,7 @@
     "jsbarcode": "^3.11.5",
     "json-bigint": "^1.0.0",
     "lodash": "^4.17.21",
+    "mathjs": "^12.4.1",
     "nprogress": "^0.2.0",
     "print-js": "^1.6.0",
     "tinymce": "^5.10.5",

+ 174 - 74
src/BIZComponents/inventoryTable.vue

@@ -133,7 +133,7 @@
           :prop="'datasource.' + $index + '.customerMark'"
           :rules="{
             required: isCustomerMark ? true : false,
-            message: '请输入',
+            message: '请输入客户代号',
             trigger: 'change'
           }"
         >
@@ -178,7 +178,7 @@
           <el-input v-model="scope.row.productCategoryName" disabled></el-input>
         </el-form-item>
       </template>
-      <template v-slot:totalCount="scope">
+      <!-- <template v-slot:totalCount="scope">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.totalCount'"
@@ -195,7 +195,7 @@
             @input="changeCount(scope.row, scope.$index)"
           ></el-input>
         </el-form-item>
-      </template>
+      </template> -->
       <template v-slot:headerTotalCount="{ column }">
         <span :class="{ 'is-required': isTotalCount }">{{ column.label }}</span>
       </template>
@@ -656,7 +656,51 @@
           </DictSelection>
         </el-form-item>
       </template>
-
+      <template v-slot:saleCount="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.' + countObj.countKey"
+          :rules="{
+            required: isTotalCount ? true : false,
+            message: '请输入数量',
+            trigger: 'change'
+          }"
+        >
+          <el-input
+            v-model="scope.row[countObj.countKey]"
+            placeholder="请输入"
+            type="number"
+            :min="0"
+            @input="changeCount(scope.row, scope.$index)"
+          >
+          </el-input>
+        </el-form-item>
+      </template>
+      <template v-slot:saleUnit="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.' + countObj.unitIdKey"
+          :rules="{
+            required: isTotalCount ? true : false,
+            message: '请选择单位',
+            trigger: 'change'
+          }"
+        >
+          <el-select
+            v-model="scope.row[countObj.unitIdKey]"
+            style="width: 100%"
+            @change="changeCount(scope.row, scope.$index)"
+          >
+            <el-option
+              :label="item.conversionUnit"
+              :value="item.id"
+              @click.native="packingChange(item, scope.$index)"
+              v-for="(item, index) in scope.row.packageDispositionList"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </template>
       <!-- 操作列 -->
       <template v-slot:action="scope">
         <el-popconfirm
@@ -717,7 +761,7 @@
   import { getInventoryTotalAPI } from '@/api/wms';
   // import fileMain from '@/components/addDoc/index.vue';
   import { pricingWayList, lbjtList } from '@/enum/dict.js';
-  import { changeCount } from '@/BIZComponents/setProduct.js';
+  import { changeCount, getAllPrice } from '@/BIZComponents/setProduct.js';
   import { contactQueryByCategoryIdsAPI } from '@/api/saleManage/contact';
   import taskinstanceDialog from '@/BIZComponents/procedure/taskinstanceDialog.vue';
   import timeDialog from '@/components/timeDialog/index.vue';
@@ -728,7 +772,6 @@
   const dayjs = require('dayjs');
   import { levelList } from '@/enum/dict.js';
   import { getGoodsPriceByCondition } from '@/api/goodsManage/index';
-
   export default {
     mixins: [dictMixins, tabMixins],
     components: {
@@ -852,6 +895,16 @@
       isGoods: {
         type: Boolean,
         default: false
+      },
+      countObj: {
+        type: Object,
+        default: () => {
+          return {
+            countKey: 'saleCount',
+            unitKey: 'saleUnit',
+            unitIdKey: 'saleUnitId'
+          };
+        }
       }
     },
     data() {
@@ -975,20 +1028,51 @@
           },
           {
             width: 150,
-            prop: 'totalCount',
+            prop: 'saleCount',
             label: '数量',
-            slot: 'totalCount',
+            slot: 'saleCount',
             headerSlot: 'headerTotalCount',
             align: 'center'
           },
           {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            headerSlot: 'headerPricingWay',
-            slot: 'pricingWay',
+            width: 150,
+            prop: 'saleUnit',
+            label: '单位',
+            slot: 'saleUnit',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
+
+          {
+            width: 150,
+            prop: 'totalCount',
+            label: '计量数量',
+            // slot: 'totalCount',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'measuringUnit',
+            label: '计量单位',
+            slot: 'measuringUnit',
             align: 'center'
           },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   headerSlot: 'headerPricingWay',
+          //   slot: 'pricingWay',
+          //   align: 'center'
+          // },
           {
             minWidth: 120,
             prop: 'goodsLevel',
@@ -1058,7 +1142,6 @@
             }
           },
 
-   
           {
             width: 110,
             prop: 'batchNo',
@@ -1082,13 +1165,7 @@
             minWidth: 200
             // show:this.contractBookType==2
           },
-          {
-            width: 120,
-            prop: 'measuringUnit',
-            label: '计量单位',
-            slot: 'measuringUnit',
-            align: 'center'
-          },
+
           {
             width: 120,
             prop: 'singleWeight',
@@ -1143,13 +1220,6 @@
             }
           },
 
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
           {
             width: 160,
             prop: 'arrivalWay',
@@ -1291,6 +1361,13 @@
       this.requestDict('商品价格类型');
     },
     methods: {
+      packingChange(item, index) {
+        this.$set(
+          this.form.datasource[index],
+          this.countObj.unitKey,
+          item.conversionUnit
+        );
+      },
       openVersion(index) {
         this.$refs.versionRefs.open(index);
       },
@@ -1423,24 +1500,42 @@
       },
       //改变数量
       changeCount(row, index) {
-        const { allPrice, arr } = changeCount(row, index, this.form.datasource);
-        console.log(arr, 'arr');
-        this.$set(this.form, 'datasource', arr);
-        this.allPrice = allPrice || 0;
+        if (!row) {
+          this.form.datasource.forEach((item, index) => {
+            this.$set(
+              this.form,
+              'datasource[' + index + ']',
+              changeCount(item, this.countObj)
+            );
+          });
+        } else {
+          this.$set(
+            this.form,
+            'datasource[' + index + ']',
+            changeCount(row, this.countObj)
+          );
+        }
 
+        this.getNotaxSinglePrice();
+        this.changeAll();
+        this.$forceUpdate();
+      },
+      changeAll() {
+        this.allPrice = getAllPrice(this.form.datasource) || 0;
         if (this.isDiscountTotalPrice) {
-          this.form.discountTotalPrice = allPrice;
-          this.$emit('setDiscountTotalPrice', allPrice);
+          this.form.discountTotalPrice = this.allPrice;
+          this.$emit('setDiscountTotalPrice', this.allPrice);
         }
         this.$emit('setCountAmount', this.allPrice);
-        this.getNotaxSinglePrice();
       },
+
       setCustomerMark(customerMark) {
         this.form.datasource.forEach((item) => {
           item['customerMark'] = customerMark;
           this.$forceUpdate();
         });
       },
+
       //计算不含税单价
       getNotaxSinglePrice() {
         this.form.datasource.forEach((item, index) => {
@@ -1492,15 +1587,7 @@
       //获取折让合计
       getDiscountTotalPrice(row) {
         let num = 0;
-        if (row.pricingWay == 1) {
-          num = Number(row.discountSinglePrice) * Number(row.totalCount);
-        }
-        if (row.pricingWay == 2) {
-          num =
-            Number(row.discountSinglePrice) *
-            Number(row.totalCount) *
-            Number(row.singleWeight);
-        }
+        num = Number(row.discountSinglePrice) * Number(row.totalCount);
         return isNaN(num) ? '' : num.toFixed(2);
       },
       orderNoChange(row, item) {
@@ -1547,16 +1634,6 @@
             item['arrivalWay'] = item.arrivalWay || 1;
           });
           this.form.datasource = productList;
-          if (this.isChangeCount) {
-            this.changeCount();
-          } else {
-            this.allPrice = data.totalAmount || data?.contractVO?.totalPrice;
-          }
-
-          if (this.isDiscountTotalPrice) {
-            this.form.discountTotalPrice =
-              data.payAmount || data?.contractVO?.discountTotalPrice;
-          }
 
           let codeList = this.form.datasource
             .filter((item) => item.productCode)
@@ -1577,6 +1654,16 @@
                 find.availableCountBase
               );
             });
+          if (this.isChangeCount) {
+            this.changeCount();
+          } else {
+            this.allPrice = data.totalAmount || data?.contractVO?.totalPrice;
+          }
+
+          if (this.isDiscountTotalPrice) {
+            this.form.discountTotalPrice =
+              data.payAmount || data?.contractVO?.discountTotalPrice;
+          }
           this.$refs.table.reload();
         }
       },
@@ -1635,6 +1722,23 @@
           this.$set(parasm, 'singleWeight', item.netWeight);
           this.$set(parasm, 'pricingWay', 1);
           this.$set(parasm, 'goodsLevel', item.level);
+          this.$set(
+            parasm,
+            'packageDispositionList',
+            item.packageDispositionList
+          );
+          if (item.packageDispositionList?.length) {
+            this.$set(
+              parasm,
+              this.countObj.unitIdKey,
+              item.packageDispositionList[0].id
+            );
+            this.$set(
+              parasm,
+              this.countObj.unitKey,
+              item.packageDispositionList[0].conversionUnit
+            );
+          }
 
           this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
 
@@ -1754,13 +1858,9 @@
       remove(index) {
         this.form.datasource.splice(index, 1);
         this.setSort();
-        this.changeCount();
-      },
-      // 清空表格
-      restTable() {
-        this.form.datasource = [];
-        this.changeCount();
+        this.changeAll();
       },
+
       // 重新排序
       setSort() {
         this.form.datasource.forEach((n, index) => {
@@ -1776,19 +1876,19 @@
       },
 
       validateForm(callback) {
-        let singleWeightData = {};
-        this.form.datasource.forEach((item) => {
-          if (item.pricingWay == 2 && !item.singleWeight) {
-            singleWeightData['name'] = item.productName;
-            console.log(singleWeightData, 'singleWeightData');
-          }
-        });
-        if (singleWeightData.name) {
-          this.$message.warning(
-            singleWeightData.name + '计价方式为按重量计费,单重不能为空'
-          );
-          callback(false);
-        }
+        // let singleWeightData = {};
+        // this.form.datasource.forEach((item) => {
+        //   if (item.pricingWay == 2 && !item.singleWeight) {
+        //     singleWeightData['name'] = item.productName;
+        //     console.log(singleWeightData, 'singleWeightData');
+        //   }
+        // });
+        // if (singleWeightData.name) {
+        //   this.$message.warning(
+        //     singleWeightData.name + '计价方式为按重量计费,单重不能为空'
+        //   );
+        //   callback(false);
+        // }
         //开始表单校验
         this.$refs.form.validate((valid, obj) => {
           if (obj) {
@@ -1830,7 +1930,7 @@
                 res.unitPrice
               );
             }
-            this.changeCount();
+            this.changeCount(row, index);
           });
         }
       },

+ 78 - 27
src/BIZComponents/inventoryTableDetails.vue

@@ -58,6 +58,24 @@
           </el-link>
         </div>
       </template>
+
+      <template v-slot:saleCount="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.' + countObj.countKey"
+        >
+          {{ scope.row[countObj.countKey] }}
+        </el-form-item>
+      </template>
+      <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 v-slot:toolbar>
         <div class="headbox">
@@ -133,9 +151,19 @@
         default: false
       },
       //显示库存
-      isWms:{
+      isWms: {
         type: Boolean,
         default: false
+      },
+      countObj: {
+        type: Object,
+        default: () => {
+          return {
+            countKey: 'saleCount',
+            unitKey: 'saleUnit',
+            unitIdKey: 'saleUnitId'
+          };
+        }
       }
     },
     data() {
@@ -154,7 +182,7 @@
           width: 1,
           show: false
         };
-        let wmsColumn= {
+        let wmsColumn = {
           width: 1,
           show: false
         };
@@ -167,8 +195,8 @@
             align: 'center'
           };
         }
-        if(this.isWms){
-          wmsColumn= {
+        if (this.isWms) {
+          wmsColumn = {
             minWidth: 160,
             prop: 'availableCountBase',
             label: '库存数量',
@@ -253,13 +281,35 @@
           },
           {
             width: 150,
-            prop: 'totalCount',
+            prop: 'saleCount',
             label: '数量',
+            slot: 'saleCount',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'saleUnit',
+            label: '单位',
+            slot: 'saleUnit',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
+          {
+            width: 150,
+            prop: 'totalCount',
+            label: '计量数量',
             slot: 'totalCount',
             headerSlot: 'headerTotalCount',
             align: 'center'
           },
-          wmsColumn,
           {
             width: 120,
             prop: 'measuringUnit',
@@ -267,6 +317,7 @@
             slot: 'measuringUnit',
             align: 'center'
           },
+          wmsColumn,
           {
             minWidth: 110,
             prop: 'sendTotalCount',
@@ -307,20 +358,20 @@
             align: 'center'
           },
 
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 160,
             prop: 'goodsPriceType',
@@ -464,13 +515,13 @@
           //   label: '批准文号',
           //   showOverflowTooltip: true
           // },
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
+          // {
+          //   width: 120,
+          //   prop: 'packingSpecification',
+          //   align: 'center',
+          //   label: '包装规格',
+          //   showOverflowTooltip: true
+          // },
           {
             width: 160,
             prop: 'arrivalWay',

+ 5 - 1
src/BIZComponents/processSubmitDialog/processSubmitDialog.vue

@@ -151,7 +151,7 @@
       <!--        @click="() => (active = 0)"-->
       <!--        >上一步-->
       <!--      </el-button>-->
-      <el-button type="primary" size="small" @click="submit" v-click-once
+      <el-button type="primary" size="small" @click="submit" :loading="loading"
         >提交</el-button
       >
       <el-button
@@ -239,6 +239,7 @@
         fininvoiceapplyStatusAPI,
         logistictrakplanStatusAPI,
         active: 0,
+        loading:false,
         bpmnXML: null,
         LCFLList: [],
         processList: [],
@@ -451,7 +452,10 @@
         if (code != 0) {
           return;
         }
+        this.loading=true
+
         await processInstanceCreateAPI(this.form);
+        this.loading=false
         this.$message('提交审核成功');
         this.$emit('reload');
         this.cancel();

+ 15 - 4
src/BIZComponents/product-list.vue

@@ -185,7 +185,7 @@
   } from '@/api/saleManage/quotation';
   import searchProduct from './searchProduct.vue';
   import productTree from '@/components/productTree';
-  import { getInventoryTotalAPI } from '@/api/wms';
+  import { getInventoryTotalAPI,getCategoryPackageDisposition } from '@/api/wms';
   import cBomList from './cBom-list.vue';
   import { getByCode } from '@/api/system/dictionary-data';
   import { contactQueryByCategoryIdsAPI } from '@/api/saleManage/contact';
@@ -552,12 +552,12 @@
             return this.$message.error('选择的物品已经存在列表了');
           }
         }
-
-        let codeList = [];
         let list = this.currentIndex == -1 ? this.selection : [this.current];
+        let codeList = list.map((item) => item.code);
+        let idList = list.map((item) => item.id);
+
         //获取仓库库存
         if (this.isGetInventoryTotal) {
-          codeList = list.map((item) => item.code);
           let inventoryTotalList = await getInventoryTotalAPI(codeList);
           list.forEach((item) => {
             let find =
@@ -575,6 +575,17 @@
             }
           });
         }
+        // 获取包装规格
+        let packingSpecification =
+          await getCategoryPackageDisposition({
+            categoryIds: idList
+          });
+        list.forEach((item) => {
+          item['packageDispositionList'] = packingSpecification
+            .filter((ite) => item.id == ite.categoryId&&ite.conversionUnit)
+            .sort((a, b) => a.sort - b.sort);
+        });
+
         this.$emit('changeParent', list, this.currentIndex);
         this.handleClose();
       },

+ 106 - 53
src/BIZComponents/setProduct.js

@@ -1,63 +1,116 @@
 import Vue from 'vue';
 
 //改变数量
-export function changeCount(row, index, arr, noDiscountSingle) {
-  if (row) {
-    singleWeightChange(row, index);
+export function changeCount(row, countObj,noDiscountSingle) {
+  let total = row[countObj.countKey] || 0;
+  let data = row;
+  let endIndex = row.packageDispositionList.findIndex(
+    (ite) => row[countObj.unitIdKey] == ite.id
+  );
+  for (; 0 < endIndex; endIndex--) {
+    total = Vue.prototype.$math.format(
+      row.packageDispositionList[endIndex].packageCell * total,
+      14
+    );
   }
-  return getNumTotalPrice(arr, noDiscountSingle);
-}
-
-//计算总金额
-function getNumTotalPrice(arr, noDiscountSingle) {
-  let sum = 0;
-  arr.forEach((r, index) => {
-    // if (r.singlePrice) {
-    //   r.notaxSinglePrice=r.taxRate?r.singlePrice/(1-(r.taxRate/100)):r.singlePrice
-    // }
-    if (r.singlePrice && r.totalCount) {
-      Vue.set(
-        arr[index],
-        'discountSinglePrice',
-        !noDiscountSingle ? r.singlePrice : r.discountSinglePrice
-      );
-      Vue.set(arr[index], 'totalPrice', getAllPrice(r));
-      Vue.set(
-        arr[index],
-        'discountTotalPrice',
-        !noDiscountSingle ? r.totalPrice : r.discountTotalPrice
-      );
-      sum += Number(r.totalPrice);
-    } else {
-      Vue.set(arr[index], 'totalPrice', 0);
-      Vue.set(arr[index], 'discountTotalPrice',0);
+  data['totalCount'] = total;
+  data['discountSinglePrice'] = !noDiscountSingle
+    ? data.singlePrice
+    : data.discountSinglePrice;
 
-    }
-  });
-  return { allPrice: isNaN(sum) ? 0 : sum.toFixed(2), arr };
-}
-
-//获取合计
-function getAllPrice(row) {
-  let num = 0;
-  if (row.pricingWay == 1) {
-    //按数量计价计算总金额
-    num = Number(row.singlePrice) * Number(row.totalCount);
-  }
-  if (row.pricingWay == 2) {
-    //按重量计价计算总金额
-    num =
-      Number(row.singlePrice) *
-      Number(row.totalCount) *
-      Number(row.singleWeight);
+  setWeight(data);
+  if (row.totalCount && row.singlePrice) {
+    data['totalPrice'] = row.totalCount * row.singlePrice;
+    data['discountTotalPrice'] = !noDiscountSingle
+      ? data.totalPrice
+      : data.discountTotalPrice;
   }
-  return isNaN(num) ? '' : num.toFixed(2);
+  // getNotaxSinglePrice(data);
+  return data;
+  // if (row) {
+  //   singleWeightChange(row, index);
+  // }
+  // return getNumTotalPrice(arr, noDiscountSingle);
 }
-function singleWeightChange(row) {
-  console.log(row, 'row');
-  if (row && row.singleWeight && row.totalCount) {
-    row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2) || 0;
+function setWeight(row) {
+  if (row.weightUnit == row.measuringUnit) {
+    row['totalWeight'] = row.totalCount;
+  } else if (row.totalCount && row.singleWeight) {
+    row['totalWeight'] = row.totalCount * row.singleWeight;
   } else {
-    row.totalWeight = '';
+    row['totalWeight'] = 0;
   }
 }
+export function getAllPrice(arr){
+  let sum = 0;
+  arr.forEach(item=>{
+    if(item.totalPrice){
+      sum+=Number(item.totalPrice)
+    }
+  })
+  return sum
+}
+// //计算不含税单价
+// function getNotaxSinglePrice(row) {
+//   if (row.singlePrice && row.taxRate) {
+//     row['notaxSinglePrice'] = parseFloat(
+//       (row.singlePrice / (1 + row.taxRate / 100)).toFixed(2)
+//     );
+//   } else {
+//     row['notaxSinglePrice'] = '';
+//   }
+// }
+
+// //计算总金额
+// function getNumTotalPrice(arr, noDiscountSingle) {
+//   let sum = 0;
+//   arr.forEach((r, index) => {
+//     // if (r.singlePrice) {
+//     //   r.notaxSinglePrice=r.taxRate?r.singlePrice/(1-(r.taxRate/100)):r.singlePrice
+//     // }
+//     if (r.singlePrice && r.totalCount) {
+//       Vue.set(
+//         arr[index],
+//         'discountSinglePrice',
+//         !noDiscountSingle ? r.singlePrice : r.discountSinglePrice
+//       );
+//       Vue.set(arr[index], 'totalPrice', getAllPrice(r));
+//       Vue.set(
+//         arr[index],
+//         'discountTotalPrice',
+//         !noDiscountSingle ? r.totalPrice : r.discountTotalPrice
+//       );
+//       sum += Number(r.totalPrice);
+//     } else {
+//       Vue.set(arr[index], 'totalPrice', 0);
+//       Vue.set(arr[index], 'discountTotalPrice',0);
+
+//     }
+//   });
+//   return { allPrice: isNaN(sum) ? 0 : sum.toFixed(2), arr };
+// }
+
+// //获取合计
+// function getAllPrice(row) {
+//   let num = 0;
+//   if (row.pricingWay == 1) {
+//     //按数量计价计算总金额
+//     num = Number(row.singlePrice) * Number(row.totalCount);
+//   }
+//   if (row.pricingWay == 2) {
+//     //按重量计价计算总金额
+//     num =
+//       Number(row.singlePrice) *
+//       Number(row.totalCount) *
+//       Number(row.singleWeight);
+//   }
+//   return isNaN(num) ? '' : num.toFixed(2);
+// }
+// function singleWeightChange(row) {
+//   console.log(row, 'row');
+//   if (row && row.singleWeight && row.totalCount) {
+//     row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2) || 0;
+//   } else {
+//     row.totalWeight = '';
+//   }
+// }

+ 11 - 0
src/api/wms/index.js

@@ -226,3 +226,14 @@ export async function getPackingList(params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+export async function getCategoryPackageDisposition (data){
+  const res = await request.post(
+    '/main/categoryPackageDisposition/list',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 5 - 1
src/main.js

@@ -17,6 +17,7 @@ import Vue2OrgTree from 'vue2-org-tree';
 import seekPage from '@/BIZComponents/seekPage';
 import clickOnce from './utils/clickOnce.js';
 import noChinese from './utils/noChinese.js';
+import { all, create } from 'mathjs'; // 引入mathjs工具并初始化
 // 注册全局自定义指令
 Vue.directive('click-once', clickOnce);
 Vue.directive('no-chinese', noChinese);
@@ -28,7 +29,10 @@ Vue.component('DictSelection', DictSelection);
 Vue.component('seekPage', seekPage);
 
 Vue.config.productionTip = false;
-
+Vue.prototype.$math = create(all, {
+  number: 'BigNumber',
+  precision: 64
+});
 Vue.use(Vue2OrgTree);
 Vue.use(EleAdmin, {
   response: {

+ 29 - 17
src/views/commodityManagement/commodityPriceList/components/commodityPriceListDialog.vue

@@ -164,7 +164,10 @@
   import dictMixins from '@/mixins/dictMixins';
   import { reviewStatus } from '@/enum/dict';
   import { mapGetters } from 'vuex';
-  import { getInventoryTotalAPI } from '@/api/wms';
+  import {
+    getInventoryTotalAPI,
+    getCategoryPackageDisposition
+  } from '@/api/wms';
   import { contactQueryByCategoryIdsAPI } from '@/api/saleManage/contact';
 
   export default {
@@ -415,26 +418,32 @@
           this.$refs.editPriceDialogRef.$refs.form.clearValidate();
       },
       async selected() {
-        if (!this.selection.length&&!this.current) {
+        if (!this.selection.length && !this.current) {
           return this.$message.warning('请至少选择一条数据');
         }
-        let codeList = [];
         let list = this.currentIndex == -1 ? this.selection : [this.current];
-        list=list.map(item=>{
-         return {
-              ...item.categoryInfo,
-              goodsId:item.id,
-              to:item.id,
-              goodsPriceId:item.goodsPriceList[0]?.id,
-              level:item.level,
-              goodsPriceType:item.goodsPriceList[0]?.priceType,
-              singlePrice:item.goodsPriceList[0]?.unitPrice,
-              notaxSinglePrice:item.goodsPriceList[0]?.excludeTaxPrice,
-              taxRate:item.goodsPriceList[0]?.taxRate,
-          }
-        })
+
+        list = list.map((item) => {
+          return {
+            ...item.categoryInfo,
+            goodsId: item.id,
+            to: item.id,
+            goodsPriceId: item.goodsPriceList[0]?.id,
+            level: item.level,
+            goodsPriceType: item.goodsPriceList[0]?.priceType,
+            singlePrice: item.goodsPriceList[0]?.unitPrice,
+            notaxSinglePrice: item.goodsPriceList[0]?.excludeTaxPrice,
+            taxRate: item.goodsPriceList[0]?.taxRate
+          };
+        });
+        let codeList = list.map((item) => item.code);
+        let idList = list.map((item) => item.id);
+        // 获取包装规格
+        let packingSpecification = await getCategoryPackageDisposition({
+          categoryIds: idList
+        });
         //获取仓库库存
-        codeList = list.map((item) => item.code);
+
         let inventoryTotalList = await getInventoryTotalAPI(codeList);
         list.forEach((item) => {
           let find =
@@ -447,6 +456,9 @@
           if (supplierList[item.id]?.length === 1) {
             item['entrustedEnterpriseId'] = supplierList[item.id][0].id;
           }
+          item['packageDispositionList'] = packingSpecification
+            .filter((ite) => item.id == ite.categoryId && ite.conversionUnit)
+            .sort((a, b) => a.sort - b.sort);
         });
         this.$emit('changeParent', list, this.currentIndex);
         this.visible = false;

+ 44 - 8
src/views/contractManage/contractBook/components/addDialog.vue

@@ -477,6 +477,11 @@
             :isSalesRecord="form.type"
             :cacheKeyUrl="cacheKeyUrl"
             :isGoods="true"
+            :countObj="{
+              countKey: 'contractCount',
+              unitKey: 'contractUnit',
+              unitIdKey: 'contractUnitId'
+            }"
           ></inventoryTable1>
         </el-tab-pane>
         <el-tab-pane
@@ -851,7 +856,11 @@
             { required: true, message: '请选择甲方名称', trigger: 'change' }
           ],
           partaLinkName: [
-            { required: isRequired, message: '请选择甲方联系人', trigger: 'change' }
+            {
+              required: isRequired,
+              message: '请选择甲方联系人',
+              trigger: 'change'
+            }
           ],
           acceptUnpack: [
             { required: true, message: '请选择是否接受', trigger: 'change' }
@@ -872,7 +881,11 @@
             { required: true, message: '请输入乙方名称', trigger: 'change' }
           ],
           partbLinkName: [
-            { required: isRequired, message: '请输入乙方联系人', trigger: 'change' }
+            {
+              required: isRequired,
+              message: '请输入乙方联系人',
+              trigger: 'change'
+            }
           ],
           partbTel: [
             {
@@ -1002,7 +1015,7 @@
         // let categoryData = this.categoryList.find(
         //   (item) => item.id == this.form.categoryId
         // );
-        let list = await listCode({id:this.form.categoryId});
+        let list = await listCode({ id: this.form.categoryId });
         if (list?.length > 0) {
           this.$set(this.form, 'contractNumber', await getCode(list[0]?.id));
         } else {
@@ -1361,7 +1374,6 @@
             this.$nextTick(async () => {
               this.setValue(row);
               if (source == 'inquiryManage') {
-                console.log(row, 'row');
                 //核价单是否生成过合同
                 this.$nextTick(() => {
                   this.$refs.rawDetailListRef &&
@@ -1409,6 +1421,23 @@
             contractVO.contractEndDate || this.form.contractEndDate,
           pricingWay: 1
         };
+
+        row.productList = row.productList.map((item) => {
+          item['contractCount'] =
+            contractVO.type == 1
+              ? item.saleCount
+              : item.contractCount || item.purchaseCount;
+          item['contractUnit'] =
+            contractVO.type == 1
+              ? item.saleUnit
+              : item.contractUnit || item.purchaseUnit;
+          item['contractUnitId'] =
+            contractVO.type == 1
+              ? item.saleUnitId
+              : item.contractUnitId || item.purchaseUnitId;
+          return item;
+        });
+
         this.form = contractVO;
         this.form.HJQD = this.form.partbName;
         this.$refs.inventoryTable &&
@@ -1423,6 +1452,12 @@
         await this.getLinkInfo(
           contractVO.type == '2' ? contractVO.partbId : contractVO.partaId
         );
+        if (contractVO.discountTotalPrice) {
+          this.$refs.inventoryTable.allPrice=contractVO.totalPrice
+            this.$refs.inventoryTable.discountInputByOrder(
+              contractVO.discountTotalPrice
+            );
+        }
         this.$nextTick(() => {
           this.getrequireUser(contractVO.requireDeptId);
           let firstLink =
@@ -1748,10 +1783,11 @@
             requireSourceType: info.sourceType,
             requireSourceTypeName: info.sourceTypeName
           },
-          productList: info.detailList.map(item=>{
-            item['customerExpectDeliveryDeadline']=item.expectReceiveDate
-            return item
-          }) || []
+          productList:
+            info.detailList.map((item) => {
+              item['customerExpectDeliveryDeadline'] = item.expectReceiveDate;
+              return item;
+            }) || []
         };
         this.setValue(form);
         // await this.getLinkInfo(cusInfo.base.id)

+ 5 - 0
src/views/contractManage/contractBook/components/detailDialog.vue

@@ -205,6 +205,11 @@
             :pricingWay="form.pricingWay"
             :isChangeCount="false"
             :cacheKeyUrl="cacheKeyUrl"
+            :countObj="{
+              countKey: 'contractCount',
+              unitKey: 'contractUnit',
+              unitIdKey: 'contractUnitId'
+            }"
           ></inventoryTabledetail>
         </el-tab-pane>
         <el-tab-pane

+ 1 - 1
src/views/financialManage/invoiceManage/components/saleAccountTable.vue

@@ -8,7 +8,7 @@
             <span>销售订单:</span>
             <span>{{ item.orderNo }}</span>
             <el-divider direction="vertical"></el-divider>
-            <span>计价方式:</span>
+            <!-- <span>计价方式:</span> -->
             <!-- <span> {{ item.pricingWay == 1 ? '按数量计费' : '按重量计费' }}</span>
             <el-divider direction="vertical"></el-divider> -->
             <span>总金额:</span>

+ 2 - 0
src/views/financialManage/receivableManage/components/detailDialog.vue

@@ -87,6 +87,8 @@
                     ? '销售订单'
                     : form.sourceType == 4
                     ? '售后管理'
+                    : form.sourceType == 5
+                    ? '发货单'
                     : '对账单'
                 "
                 disabled

+ 4 - 0
src/views/financialManage/receivableManage/components/detailDialog1.vue

@@ -85,6 +85,10 @@
                     ? '合同'
                     : form.sourceType == 3
                     ? '销售订单'
+                    : form.sourceType == 4
+                    ? '售后管理'
+                    : form.sourceType == 5
+                    ? '发货单'
                     : '对账单'
                 "
                 disabled

+ 30 - 16
src/views/purchasingManage/inquiryManage/components/detailDialog.vue

@@ -246,14 +246,41 @@
             },
             align: 'center'
           },
+          {
+            width: 150,
+            prop: 'purchaseCount',
+            label: '数量',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            align: 'center'
+          },
+          {
+            minWidth: 180,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
           {
             minWidth: 80,
             prop: 'totalCount',
-            label: '数量',
+            label: '计量数量',
             slot: 'totalCount',
             showOverflowTooltip: true,
             align: 'center'
           },
+          {
+            minWidth: 80,
+            prop: 'measuringUnit',
+            label: '计量单位',
+            slot: 'measuringUnit',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
           {
             width: 150,
             prop: 'inquiryNum',
@@ -296,14 +323,7 @@
                 : '';
             }
           },
-          {
-            minWidth: 80,
-            prop: 'measuringUnit',
-            label: '单位',
-            slot: 'measuringUnit',
-            showOverflowTooltip: true,
-            align: 'center'
-          },
+ 
           {
             minWidth: 120,
             prop: 'modelType',
@@ -351,13 +371,7 @@
               }
             }
           },
-          {
-            minWidth: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
+
           {
             minWidth: 140,
             prop: 'files',

+ 101 - 19
src/views/purchasingManage/inquiryManage/components/inquiryTable.vue

@@ -214,7 +214,7 @@
           }"
         >
           <el-input
-            @blur="changeGetPrice(scope.row)"
+            @blur="changeCount(scope.row, scope.$index)"
             v-model="scope.row.singlePrice"
             :disabled="status == 'Detail'"
             type="number"
@@ -246,7 +246,7 @@
           }"
         >
           <el-input
-            @blur="changeGetPrice(scope.row)"
+            @blur="changeCount(scope.row, scope.$index)"
             v-model="scope.row.totalCount"
             :disabled="status == 'Detail'"
             placeholder="请输入"
@@ -300,7 +300,53 @@
           ></el-input>
         </el-form-item>
       </template>
-
+      <template v-slot:purchaseCount="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'resultList.' + scope.$index + '.purchaseCount'"
+          :rules="{
+            required: true,
+            message: '请输入数量',
+            trigger: 'change'
+          }"
+        >
+          <el-input
+            v-model="scope.row.purchaseCount"
+            placeholder="请输入"
+            type="number"
+            :disabled="status == 'Detail'"
+            :min="0"
+            @input="changeCount(scope.row, scope.$index)"
+          >
+          </el-input>
+        </el-form-item>
+      </template>
+      <template v-slot:purchaseUnit="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'resultList.' + scope.$index + '.purchaseUnitId'"
+          :rules="{
+            required: true,
+            message: '请选择单位',
+            trigger: 'change'
+          }"
+        >
+          <el-select
+            v-model="scope.row.purchaseUnitId"
+            style="width: 100%"
+            :disabled="status == 'Detail'"
+            @change="changeCount(scope.row, scope.$index)"
+          >
+            <el-option
+              :label="item.conversionUnit"
+              :value="item.id"
+              @click.native="packingChange(item, scope.$index)"
+              v-for="(item, index) in scope.row.packageDispositionList"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </template>
       <template v-slot:isRequired="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
@@ -319,6 +365,7 @@
   import tabMixins from '@/mixins/tableColumnsMixin';
   import { parameterGetByCode } from '@/api/main/index.js';
   import { levelList } from '@/enum/dict.js';
+  import { changeCount } from '@/BIZComponents/setProduct.js';
 
   export default {
     mixins: [dictMixins, tabMixins],
@@ -508,12 +555,28 @@
             showOverflowTooltip: true,
             align: 'center'
           },
+          {
+            width: 150,
+            prop: 'purchaseCount',
+            label: '数量',
+            slot: 'purchaseCount',
+            headerSlot: 'isRequired',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            slot: 'purchaseUnit',
+            headerSlot: 'isRequired',
+            align: 'center'
+          },
           {
             minWidth: 130,
             prop: 'totalCount',
             label: '购买数量',
-            slot: 'totalCount',
-            headerSlot: 'isRequired',
+            // slot: 'totalCount',
+            // headerSlot: 'isRequired',
             showOverflowTooltip: true,
             align: 'center'
           },
@@ -528,7 +591,7 @@
           {
             minWidth: 80,
             prop: 'measuringUnit',
-            label: '单位',
+            label: '计量单位',
             slot: 'measuringUnit',
             showOverflowTooltip: true,
             align: 'center'
@@ -810,6 +873,27 @@
         return;
         this.$emit('setIsInquiry');
       },
+      packingChange(item, index) {
+        this.$set(
+          this.form.resultList[index],
+          'purchaseUnit',
+          item.conversionUnit
+        );
+      },
+      //改变数量
+      changeCount(row, index) {
+        this.$set(
+          this.form,
+          'resultList[' + index + ']',
+          changeCount(row, {
+            countKey: 'purchaseCount',
+            unitKey: 'purchaseUnit',
+            unitIdKey: 'purchaseUnitId'
+          })
+        );
+        this.getNotaxSinglePrice();
+        this.$forceUpdate();
+      },
       //计算不含税单价
       getNotaxSinglePrice() {
         this.form.resultList.forEach((item, index) => {
@@ -894,17 +978,17 @@
         getFile({ objectName: file.storePath }, file.name);
       },
       //
-      changeGetPrice(row) {
-        if (row.singlePrice && row.totalCount) {
-          let num = 0;
-          this.form.resultList.forEach((item) => {
-            num += item.totalPrice || 0;
-          });
-          this.form.preferentialPrice = parseFloat(num.toFixed(2));
-        }
-        this.setIsInquiry();
-        this.getNotaxSinglePrice();
-      },
+      // changeGetPrice(row) {
+      //   if (row.singlePrice && row.totalCount) {
+      //     let num = 0;
+      //     this.form.resultList.forEach((item) => {
+      //       num += item.totalPrice || 0;
+      //     });
+      //     this.form.preferentialPrice = parseFloat(num.toFixed(2));
+      //   }
+      //   this.setIsInquiry();
+      //   this.getNotaxSinglePrice();
+      // },
       //计算销售金额
       totalPrice(a, b, row) {
         if (!a || !b) {
@@ -921,8 +1005,6 @@
           num += item.totalPrice || 0;
         });
         this.form.totalPrice = parseFloat(num.toFixed(2));
-        // this.form.preferentialPrice = parseFloat(num.toFixed(2));
-        // console.log(this.form.resultList,'dasdasd')
       },
       // 返回列表数据
       getTableValue() {

+ 29 - 9
src/views/purchasingManage/purchaseNeedManage/components/detailDialog.vue

@@ -236,10 +236,30 @@
             slot: 'productBrand',
             align: 'center'
           },
+          {
+            width: 150,
+            prop: 'purchaseCount',
+            label: '数量',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            align: 'center'
+          },
+ 
+          {
+            minWidth: 180,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
           {
             width: 80,
             prop: 'totalCount',
-            label: '数量',
+            label: '计量数量',
             slot: 'totalCount',
             align: 'center'
           },
@@ -297,7 +317,7 @@
           {
             width: 100,
             prop: 'measuringUnit',
-            label: '单位',
+            label: '计量单位',
             slot: 'measuringUnit',
             align: 'center'
           },
@@ -361,13 +381,13 @@
           //   label: '批准文号',
           //   showOverflowTooltip: true
           // },
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
+          // {
+          //   width: 120,
+          //   prop: 'packingSpecification',
+          //   align: 'center',
+          //   label: '包装规格',
+          //   showOverflowTooltip: true
+          // },
           {
             width: 160,
             prop: 'technicalDrawings',

+ 137 - 22
src/views/purchasingManage/purchaseNeedManage/components/inventoryTable.vue

@@ -331,7 +331,51 @@
       <template v-slot:headerArrivalWay="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
-
+      <template v-slot:purchaseCount="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.purchaseCount'"
+          :rules="{
+            required: true,
+            message: '请输入数量',
+            trigger: 'change'
+          }"
+        >
+          <el-input
+            v-model="scope.row.purchaseCount"
+            placeholder="请输入"
+            type="number"
+            :min="0"
+            @input="changeCount(scope.row, scope.$index)"
+          >
+          </el-input>
+        </el-form-item>
+      </template>
+      <template v-slot:purchaseUnit="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.purchaseUnitId'"
+          :rules="{
+            required: true,
+            message: '请选择单位',
+            trigger: 'change'
+          }"
+        >
+          <el-select
+            v-model="scope.row.purchaseUnitId"
+            style="width: 100%"
+            @change="changeCount(scope.row, scope.$index)"
+          >
+            <el-option
+              :label="item.conversionUnit"
+              :value="item.id"
+              @click.native="packingChange(item, scope.$index)"
+              v-for="(item, index) in scope.row.packageDispositionList"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </template>
       <!-- 操作列 -->
       <template v-slot:action="scope">
         <el-popconfirm
@@ -382,6 +426,7 @@
   import { lbjtList } from '@/enum/dict.js';
   import tabMixins from '@/mixins/tableColumnsMixin';
   import { levelList } from '@/enum/dict.js';
+  import { changeCount } from '@/BIZComponents/setProduct.js';
 
   export default {
     mixins: [dictMixins, tabMixins],
@@ -456,13 +501,43 @@
             align: 'center'
           },
           {
-            width: 80,
-            prop: 'totalCount',
+            width: 150,
+            prop: 'purchaseCount',
             label: '数量',
-            slot: 'totalCount',
+            slot: 'purchaseCount',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            slot: 'purchaseUnit',
             headerSlot: 'headerTotalCount',
             align: 'center'
           },
+          {
+            width: 120,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
+          {
+            width: 80,
+            prop: 'totalCount',
+            label: '计量数量',
+            // slot: 'totalCount',
+            // headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 100,
+            prop: 'measuringUnit',
+            label: '计量单位',
+            slot: 'measuringUnit',
+            align: 'center'
+          },
           {
             minWidth: 120,
             prop: 'goodsLevel',
@@ -561,21 +636,6 @@
               }
             }
           },
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
-
-          {
-            width: 100,
-            prop: 'measuringUnit',
-            label: '单位',
-            slot: 'measuringUnit',
-            align: 'center'
-          },
 
           {
             width: 130,
@@ -679,7 +739,11 @@
         console.log(data, 'data');
         let keyS = this.selection.map((item) => item.key - 1);
         keyS.forEach((key) => {
-        this.$set(this.form.datasource[key], 'arrivalWay', data.deliveryMethod);
+          this.$set(
+            this.form.datasource[key],
+            'arrivalWay',
+            data.deliveryMethod
+          );
 
           if (data.deliveryMethod == 1) {
             this.$set(
@@ -693,7 +757,13 @@
               'arrivalBatch',
               copyObj(data.arrivalBatch)
             );
-            this.$set(this.form.datasource[key],'totalCount',data.arrivalBatch.map(item=>item.arriveCount).reduce((a,b)=>a+b,0))
+            this.$set(
+              this.form.datasource[key],
+              'totalCount',
+              data.arrivalBatch
+                .map((item) => item.arriveCount)
+                .reduce((a, b) => a + b, 0)
+            );
           }
         });
       },
@@ -730,7 +800,19 @@
           this.$set(parasm, 'produceType', item.componentAttribute);
           this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
           this.$set(parasm, 'goodsLevel', item.level);
-
+          this.$set(
+            parasm,
+            'packageDispositionList',
+            item.packageDispositionList
+          );
+          if (item.packageDispositionList?.length) {
+            this.$set(parasm, 'purchaseUnitId', item.packageDispositionList[0].id);
+            this.$set(
+              parasm,
+              'purchaseUnit',
+              item.packageDispositionList[0].conversionUnit
+            );
+          }
           this.$set(
             parasm,
             'packingSpecification',
@@ -743,6 +825,26 @@
           }
         });
       },
+      packingChange(item, index) {
+        this.$set(
+          this.form.datasource[index],
+          'purchaseUnit',
+          item.conversionUnit
+        );
+      },
+      //改变数量
+      changeCount(row, index) {
+        this.$set(
+          this.form,
+          'datasource[' + index + ']',
+          changeCount(row, {
+            countKey: 'purchaseCount',
+            unitKey: 'purchaseUnit',
+            unitIdKey: 'purchaseUnitId'
+          })
+        );
+        this.$forceUpdate();
+      },
       //选择产品
       handParent(row, index) {
         // let item = {
@@ -800,6 +902,19 @@
             'packingSpecification',
             item.extField?.packingSpecification
           );
+          this.$set(
+            parasm,
+            'packageDispositionList',
+            item.packageDispositionList
+          );
+          if (item.packageDispositionList?.length) {
+            this.$set(parasm, 'purchaseUnitId', item.packageDispositionList[0].id);
+            this.$set(
+              parasm,
+              'purchaseUnit',
+              item.packageDispositionList[0].conversionUnit
+            );
+          }
           if (item.purchaseOrigins?.length > 0) {
             item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
           }

+ 2 - 2
src/views/purchasingManage/purchaseOrder/accountstatement/components/inventoryTable.vue

@@ -8,11 +8,11 @@
             <span>采购订单:</span>
             <span>{{ item.orderNo }}</span>
             <el-divider direction="vertical"></el-divider>
-            <span>计价方式:</span>
+            <!-- <span>计价方式:</span>
             <span>
               {{ item.pricingWay == 1 ? '按数量计费' : '按重量计费' }}</span
             >
-            <el-divider direction="vertical"></el-divider>
+            <el-divider direction="vertical"></el-divider> -->
             <span>总金额:</span>
             <span>{{ item.amountTotalPrice }}</span>
             <el-divider direction="vertical"></el-divider>

+ 6 - 1
src/views/purchasingManage/purchaseOrder/components/addDialog.vue

@@ -1099,7 +1099,12 @@
               sourceTypeName: requireSourceTypeName
             });
             this.getLinkInfo(partaId);
-
+            info.productList = info.productList.map((item) => {
+              item['purchaseCount'] = item.contractCount;
+              item['purchaseUnit'] = item.contractUnit;
+              item['purchaseUnitId'] = item.contractUnitId;
+              return item;
+            });
             if (info.productList.length > 1) {
               this.$refs.planTableListRef.contractOpen(
                 info.productList,

+ 43 - 30
src/views/purchasingManage/purchaseOrder/components/detailDialog.vue

@@ -587,13 +587,39 @@
             label: '未收货数量',
             align: 'center'
           },
+          {
+            width: 150,
+            prop: 'purchaseCount',
+            label: '数量',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            align: 'center'
+          },
+          {
+            minWidth: 180,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
           {
             width: 120,
             prop: 'totalCount',
-            label: '数量',
+            label: '计量数量',
             slot: 'totalCount',
             align: 'center'
           },
+          {
+            width: 120,
+            prop: 'measuringUnit',
+            label: '计量单位',
+            slot: 'measuringUnit',
+            align: 'center'
+          },
           {
             width: 120,
             prop: 'produceType',
@@ -611,21 +637,8 @@
             }
           },
 
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
-
-          {
-            width: 120,
-            prop: 'measuringUnit',
-            label: '计量单位',
-            slot: 'measuringUnit',
-            align: 'center'
-          },
+      
+       
           {
             width: 120,
             prop: 'singleWeight',
@@ -647,20 +660,20 @@
             slot: 'weightUnit',
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             minWidth: 120,
             prop: 'goodsLevel',

+ 260 - 130
src/views/purchasingManage/purchaseOrder/components/inventoryTable.vue

@@ -121,7 +121,7 @@
           </el-input>
         </el-form-item>
       </template>
-      <template v-slot:totalCount="scope">
+      <!-- <template v-slot:totalCount="scope">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.totalCount'"
@@ -138,7 +138,7 @@
             type="number"
           ></el-input>
         </el-form-item>
-      </template>
+      </template> -->
       <template v-slot:totalPrice="scope">
         <el-form-item
           style="margin-bottom: 20px"
@@ -170,7 +170,7 @@
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.specification'"
         >
-          <el-input v-model="scope.row.specification" ></el-input>
+          <el-input v-model="scope.row.specification"></el-input>
         </el-form-item>
       </template>
       <template v-slot:deliveryDays="scope">
@@ -263,7 +263,7 @@
           <el-input
             v-model="scope.row.singlePrice"
             placeholder="请输入"
-            @input="getTotalPrice"
+            @input="changeCount(scope.row, scope.$index)"
           >
             <template slot="append">元</template>
           </el-input>
@@ -304,7 +304,7 @@
         >
           <el-input
             v-model="scope.row.singleWeight"
-            @input="singleWeightChange(scope.row, scope.$index)"
+            @input="changeCount(scope.row, scope.$index)"
             placeholder="请输入"
           ></el-input>
         </el-form-item>
@@ -434,7 +434,7 @@
           </template>
         </el-popconfirm>
       </template>
-      <template v-slot:pricingWay="scope">
+      <!-- <template v-slot:pricingWay="scope">
         <el-form-item
           :prop="'datasource.' + scope.$index + '.pricingWay'"
           :rules="{
@@ -454,10 +454,55 @@
             </el-option>
           </el-select>
         </el-form-item>
-      </template>
+      </template> -->
       <template v-slot:headerPricingWay="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
+      <template v-slot:purchaseCount="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.purchaseCount'"
+          :rules="{
+            required: true,
+            message: '请输入数量',
+            trigger: 'change'
+          }"
+        >
+          <el-input
+            v-model="scope.row.purchaseCount"
+            placeholder="请输入"
+            type="number"
+            :min="0"
+            @input="changeCount(scope.row, scope.$index)"
+          >
+          </el-input>
+        </el-form-item>
+      </template>
+      <template v-slot:purchaseUnit="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.purchaseUnitId'"
+          :rules="{
+            required: true,
+            message: '请选择单位',
+            trigger: 'change'
+          }"
+        >
+          <el-select
+            v-model="scope.row.purchaseUnitId"
+            style="width: 100%"
+            @change="changeCount(scope.row, scope.$index)"
+          >
+            <el-option
+              :label="item.conversionUnit"
+              :value="item.id"
+              @click.native="packingChange(item, scope.$index)"
+              v-for="(item, index) in scope.row.packageDispositionList"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </template>
     </ele-pro-table>
 
     <product-list
@@ -481,15 +526,13 @@
   </el-form>
 </template>
 <script>
-  import { emailReg, phoneReg, numberReg, positiveIntegerReg } from 'ele-admin';
+  import { numberReg, positiveIntegerReg } from 'ele-admin';
   import productList from '@/BIZComponents/product-list.vue';
   import dictMixins from '@/mixins/dictMixins';
-  import store from '@/store';
   import fileUpload from '@/components/upload/fileUpload';
   import headList from '@/BIZComponents/user-select/user-select.vue';
   import { getFile } from '@/api/system/file';
-  import { getByCode } from '@/api/system/dictionary-data';
-  // import fileMain from '@/components/addDoc/index.vue';
+
   import billDetailDialog from './billDetailDialog.vue';
   import taskinstanceDialog from '@/BIZComponents/procedure/taskinstanceDialog.vue';
   import { getCode } from '@/components/addDoc/api/index.js';
@@ -498,6 +541,7 @@
   import tabMixins from '@/mixins/tableColumnsMixin';
   import { levelList } from '@/enum/dict.js';
   import { getGoodsPriceByCondition } from '@/api/goodsManage/index';
+  import { changeCount, getAllPrice } from '@/BIZComponents/setProduct.js';
 
   const dayjs = require('dayjs');
 
@@ -632,27 +676,58 @@
           },
           {
             width: 150,
-            prop: 'totalCount',
+            prop: 'purchaseCount',
             label: '数量',
-            slot: 'totalCount',
+            slot: 'purchaseCount',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            slot: 'purchaseUnit',
             headerSlot: 'headerTotalCount',
             align: 'center'
           },
           {
             width: 120,
-            prop: 'availableCountBase',
-            label: '库存数量',
-            slot: 'availableCountBase',
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
+          {
+            width: 150,
+            prop: 'totalCount',
+            label: '计量数量',
+            // slot: 'totalCount',
+            // headerSlot: 'headerTotalCount',
             align: 'center'
           },
+
           {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            headerSlot: 'headerPricingWay',
-            slot: 'pricingWay',
+            width: 80,
+            prop: 'measuringUnit',
+            label: '计量单位',
+            slot: 'measuringUnit',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'availableCountBase',
+            label: '库存数量',
+            slot: 'availableCountBase',
             align: 'center'
           },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   headerSlot: 'headerPricingWay',
+          //   slot: 'pricingWay',
+          //   align: 'center'
+          // },
           {
             minWidth: 120,
             prop: 'goodsLevel',
@@ -761,21 +836,6 @@
             }
           },
 
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
-
-          {
-            width: 80,
-            prop: 'measuringUnit',
-            label: '计量单位',
-            slot: 'measuringUnit',
-            align: 'center'
-          },
           {
             width: 120,
             prop: 'singleWeight',
@@ -911,7 +971,6 @@
     created() {
       this.requestDict('生产类型');
       this.requestDict('商品价格类型');
-
     },
     methods: {
       handleGetBillDetail(row, type) {
@@ -946,15 +1005,60 @@
       getPrice() {
         return [this.allPrice];
       },
+      packingChange(item, index) {
+        this.$set(
+          this.form.datasource[index],
+          'purchaseUnit',
+          item.conversionUnit
+        );
+      },
+
       //改变数量
       changeCount(row, index) {
         if (this.detailType) {
           return;
         }
+        let countObj = {
+          countKey: 'purchaseCount',
+          unitKey: 'purchaseUnit',
+          unitIdKey: 'purchaseUnitId'
+        };
+        if (!row) {
+          this.form.datasource.forEach((item, index) => {
+            this.$set(
+              this.form,
+              'datasource[' + index + ']',
+              changeCount(item, countObj)
+            );
+          });
+        } else {
+          this.$set(
+            this.form,
+            'datasource[' + index + ']',
+            changeCount(row, countObj)
+          );
+        }
 
-        this.singleWeightChange(row, index);
-        this.getTotalPrice();
+        this.getNotaxSinglePrice();
+        this.changeAll();
+        this.$forceUpdate();
       },
+      changeAll() {
+        this.allPrice = getAllPrice(this.form.datasource) || 0;
+        this.$store.commit('concact/setDiscountAmount', this.allPrice);
+        this.$store.commit('order/setAllcountAmount', this.allPrice);
+        this.$emit('orderDiscountAmount', this.allPrice);
+      },
+
+      // //改变数量
+      // changeCount(row, index) {
+      //   if (this.detailType) {
+      //     return;
+      //   }
+
+      //   this.singleWeightChange(row, index);
+      //   this.getTotalPrice();
+      // },
       goodsPriceTypeChange(row, index) {
         if (row.goodsId) {
           getGoodsPriceByCondition({
@@ -989,28 +1093,28 @@
           });
         }
       },
-      //计算总金额
-      getTotalPrice(row, index) {
-        this.getNotaxSinglePrice();
+      // //计算总金额
+      // getTotalPrice(row, index) {
+      //   this.getNotaxSinglePrice();
 
-        if (this.form.datasource.length) {
-          let sum = 0;
-          sum = this.getNumTotalPrice();
-          let allsum = sum.toFixed(2);
-          this.allPrice = allsum;
-          this.form.discountTotalPrice = allsum;
-          this.$store.commit('concact/setDiscountAmount', allsum);
-          this.$store.commit('order/setAllcountAmount', allsum);
-          this.$emit('orderDiscountAmount', this.allPrice);
-          this.$refs.table.reload();
-          return allsum;
-        } else {
-          this.allPrice = 0.0;
-          this.form.discountTotalPrice = 0.0;
-          this.$emit('orderDiscountAmount', 0);
-          return 0.0;
-        }
-      },
+      //   if (this.form.datasource.length) {
+      //     let sum = 0;
+      //     sum = this.getNumTotalPrice();
+      //     let allsum = sum.toFixed(2);
+      //     this.allPrice = allsum;
+      //     this.form.discountTotalPrice = allsum;
+      //     this.$store.commit('concact/setDiscountAmount', allsum);
+      //     this.$store.commit('order/setAllcountAmount', allsum);
+      //     this.$emit('orderDiscountAmount', this.allPrice);
+      //     this.$refs.table.reload();
+      //     return allsum;
+      //   } else {
+      //     this.allPrice = 0.0;
+      //     this.form.discountTotalPrice = 0.0;
+      //     this.$emit('orderDiscountAmount', 0);
+      //     return 0.0;
+      //   }
+      // },
       //计算不含税单价
       getNotaxSinglePrice() {
         this.form.datasource.forEach((item, index) => {
@@ -1027,64 +1131,82 @@
           }
         });
       },
-      //计算总金额
-      getNumTotalPrice() {
-        console.log(111);
-        let sum = 0;
-        this.form.datasource.forEach((r) => {
-          this.$set(
-            r,
-            'discountSinglePrice',
-            r.singlePrice ? Number(r.singlePrice) : ''
-          );
-          if (r.singlePrice && r.totalCount) {
-            r.totalPrice = this.getAllPrice(r);
-            r.discountTotalPrice = this.getDiscountTotalPrice(r);
-            this.$set(r, 'totalPrice', Number(r.totalPrice));
-            this.$set(r, 'discountTotalPrice', Number(r.discountTotalPrice));
-            sum += Number(r.totalPrice);
-          } else {
-            this.$set(r, 'totalPrice', '');
-            this.$set(r, 'discountTotalPrice', '');
-          }
-        });
-        return sum;
-      },
+      // //计算总金额
+      // getNumTotalPrice() {
+      //   console.log(111);
+      //   let sum = 0;
+      //   this.form.datasource.forEach((r) => {
+      //     this.$set(
+      //       r,
+      //       'discountSinglePrice',
+      //       r.singlePrice ? Number(r.singlePrice) : ''
+      //     );
+      //     if (r.singlePrice && r.totalCount) {
+      //       r.totalPrice = this.getAllPrice(r);
+      //       r.discountTotalPrice = this.getDiscountTotalPrice(r);
+      //       this.$set(r, 'totalPrice', Number(r.totalPrice));
+      //       this.$set(r, 'discountTotalPrice', Number(r.discountTotalPrice));
+      //       sum += Number(r.totalPrice);
+      //     } else {
+      //       this.$set(r, 'totalPrice', '');
+      //       this.$set(r, 'discountTotalPrice', '');
+      //     }
+      //   });
+      //   return sum;
+      // },
 
-      //计算单重
-      singleWeightChange(row, index) {
-        if (row && row.singleWeight && row.totalCount) {
-          row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2) || 0;
-          this.$set(
-            this.form.datasource[index],
-            'totalWeight',
-            row.totalWeight
-          );
-        }
-        if (row.pricingWay == 2) {
-          this.getTotalPrice(row);
-        }
-      },
+      // //计算单重
+      // singleWeightChange(row, index) {
+      //   if (row && row.singleWeight && row.totalCount) {
+      //     row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2) || 0;
+      //     this.$set(
+      //       this.form.datasource[index],
+      //       'totalWeight',
+      //       row.totalWeight
+      //     );
+      //   }
+      //   if (row.pricingWay == 2) {
+      //     this.getTotalPrice(row);
+      //   }
+      // },
       //设置优惠后总金额修改产品单价
       discountInputByOrder(val) {
         this.form.discountTotalPrice = val;
         //获取优惠金额和总计的差价
-        this.form.datasource.forEach((item) => {
+        this.form.datasource.forEach((item, index) => {
           if (val === 0) {
-            item.discountTotalPrice = 0;
-            item.discountSinglePrice = 0;
+            this.$set(this.form.datasource[index], 'discountTotalPrice', 0);
+            this.$set(this.form.datasource[index], 'discountSinglePrice', 0);
             return;
           }
           if (!val) {
-            item.discountTotalPrice = item.totalPrice;
-            item.discountSinglePrice = item.singlePrice;
+            this.$set(
+              this.form.datasource[index],
+              'discountTotalPrice',
+              item.totalPrice
+            );
+            this.$set(
+              this.form.datasource[index],
+              'discountSinglePrice',
+              item.singlePrice
+            );
             return;
           }
+
+          this.$set(
+            this.form.datasource[index],
+            'discountSinglePrice',
+            this.getDiscountSinglePrice(item)
+          );
           //获取折让单价
-          item.discountSinglePrice = this.getDiscountSinglePrice(item);
-          item.discountTotalPrice = this.getDiscountTotalPrice(item);
+          this.$set(
+            this.form.datasource[index],
+            'discountTotalPrice',
+            this.getDiscountTotalPrice(item)
+          );
         });
-        this.$refs.table.reload();
+        this.$forceUpdate();
+        this.$refs.table.reRenderTable();
         this.$store.commit('concact/setDiscountAmount', val);
       },
       //获取折让单价
@@ -1109,35 +1231,26 @@
           row.produceRoutingId
         );
       },
-      //获取合计
-      getAllPrice(row) {
-        let num = 0;
-        if (row.pricingWay == 1) {
-          num = Number(row.singlePrice) * Number(row.totalCount);
-        }
-        if (row.pricingWay == 2) {
-          num =
-            Number(row.singlePrice) *
-            Number(row.totalCount) *
-            Number(row.singleWeight);
-        }
-        console.log(row, 'row');
+      // //获取合计
+      // getAllPrice(row) {
+      //   let num = 0;
+      //   if (row.pricingWay == 1) {
+      //     num = Number(row.singlePrice) * Number(row.totalCount);
+      //   }
+      //   if (row.pricingWay == 2) {
+      //     num =
+      //       Number(row.singlePrice) *
+      //       Number(row.totalCount) *
+      //       Number(row.singleWeight);
+      //   }
+      //   console.log(row, 'row');
 
-        return isNaN(num) ? '' : num.toFixed(2);
-      },
+      //   return isNaN(num) ? '' : num.toFixed(2);
+      // },
       //获取折让合计
       getDiscountTotalPrice(row) {
         let num = 0;
-        if (row.pricingWay == 1) {
-          num = Number(row.discountSinglePrice) * Number(row.totalCount);
-        }
-        if (row.pricingWay == 2) {
-          num =
-            Number(row.discountSinglePrice) *
-            Number(row.totalCount) *
-            Number(row.singleWeight);
-        }
-
+        num = Number(row.discountSinglePrice) * Number(row.totalCount);
         return isNaN(num) ? '' : num.toFixed(2);
       },
       //修改回显
@@ -1240,6 +1353,23 @@
             'packingSpecification',
             item.extField?.packingSpecification
           );
+          this.$set(
+            parasm,
+            'packageDispositionList',
+            item.packageDispositionList
+          );
+          if (item.packageDispositionList?.length) {
+            this.$set(
+              parasm,
+              'purchaseUnitId',
+              item.packageDispositionList[0].id
+            );
+            this.$set(
+              parasm,
+              'purchaseUnit',
+              item.packageDispositionList[0].conversionUnit
+            );
+          }
           this.$set(parasm, 'supplierMark', this.supplierMark);
           this.$set(parasm, 'batchNo', await getCode('1900101420390125570'));
           if (item.purchaseOrigins?.length > 0) {

+ 38 - 15
src/views/purchasingManage/purchaseOrder/invoice/components/detailDialog.vue

@@ -302,6 +302,29 @@
               slot: 'warehouseName',
               align: 'center'
             },
+            {
+              width: 150,
+              prop: 'purchaseCount',
+              label: '数量',
+              slot: 'purchaseCount',
+              headerSlot: 'headerTotalCount',
+              align: 'center'
+            },
+            {
+              width: 150,
+              prop: 'purchaseUnit',
+              label: '单位',
+              slot: 'purchaseUnit',
+              headerSlot: 'headerTotalCount',
+              align: 'center'
+            },
+            {
+              width: 120,
+              prop: 'packingSpecification',
+              align: 'center',
+              label: '包装规格',
+              showOverflowTooltip: true
+            },
             {
               width: 80,
               prop: 'totalCount',
@@ -372,21 +395,21 @@
               align: 'center',
               show: v != 2
             },
-            {
-              width: 160,
-              prop: 'pricingWay',
-              label: '计价方式',
-              slot: 'pricingWay',
-              align: 'center',
-              show: v != 2,
-              formatter: (row, column) => {
-                return row.pricingWay == 1
-                  ? '按数量计费'
-                  : row.pricingWay == 2
-                  ? '按重量计费'
-                  : '';
-              }
-            },
+            // {
+            //   width: 160,
+            //   prop: 'pricingWay',
+            //   label: '计价方式',
+            //   slot: 'pricingWay',
+            //   align: 'center',
+            //   show: v != 2,
+            //   formatter: (row, column) => {
+            //     return row.pricingWay == 1
+            //       ? '按数量计费'
+            //       : row.pricingWay == 2
+            //       ? '按重量计费'
+            //       : '';
+            //   }
+            // },
             {
               minWidth: 120,
               prop: 'goodsLevel',

+ 205 - 83
src/views/purchasingManage/purchaseOrder/invoice/components/inventoryTable.vue

@@ -50,7 +50,7 @@
           />
         </el-form-item>
       </template>
-      <template v-slot:totalCount="scope">
+      <!-- <template v-slot:totalCount="scope">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.totalCount'"
@@ -61,7 +61,7 @@
             @input="(val) => changeNum(val, scope.$index, scope.row)"
           ></el-input>
         </el-form-item>
-      </template>
+      </template> -->
       <template v-slot:batchNo="scope">
         <el-form-item
           style="margin-bottom: 20px"
@@ -152,17 +152,17 @@
           </el-select>
         </el-form-item>
       </template>
-      <template v-slot:notaxSinglePrice="scope">
+      <template v-slot:singlePrice="scope">
         <el-form-item
           style="margin-bottom: 20px"
-          :prop="'datasource.' + scope.$index + '.notaxSinglePrice'"
+          :prop="'datasource.' + scope.$index + '.singlePrice'"
         >
           <el-input
-            v-model="scope.row.notaxSinglePrice"
+            v-model="scope.row.singlePrice"
             placeholder="请输入"
             type="number"
+            @input="changeCount(scope.row, scope.$index)"
           >
-            <template slot="append">元</template>
           </el-input>
         </el-form-item>
       </template>
@@ -171,7 +171,7 @@
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.specification'"
         >
-          <el-input v-model="scope.row.specification" ></el-input>
+          <el-input v-model="scope.row.specification"></el-input>
         </el-form-item>
       </template>
       <template v-slot:warehouseNum="scope">
@@ -238,6 +238,53 @@
           </el-date-picker>
         </el-form-item>
       </template>
+
+      <template v-slot:purchaseCount="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.purchaseCount'"
+          :rules="{
+            required: true,
+            message: '请输入数量',
+            trigger: 'change'
+          }"
+        >
+          <el-input
+            v-model="scope.row.purchaseCount"
+            placeholder="请输入"
+            type="number"
+            :min="0"
+            @input="changeCount(scope.row, scope.$index)"
+          >
+          </el-input>
+        </el-form-item>
+      </template>
+      <template v-slot:purchaseUnit="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.purchaseUnitId'"
+          :rules="{
+            required: true,
+            message: '请选择单位',
+            trigger: 'change'
+          }"
+        >
+          <el-select
+            v-model="scope.row.purchaseUnitId"
+            style="width: 100%"
+            @change="changeCount(scope.row, scope.$index)"
+          >
+            <el-option
+              :label="item.conversionUnit"
+              :value="item.id"
+              @click.native="packingChange(item, scope.$index)"
+              v-for="(item, index) in scope.row.packageDispositionList"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </template>
+
       <!-- 操作列 -->
       <template v-slot:action="scope">
         <el-popconfirm
@@ -315,6 +362,8 @@
   import productListMain from '@/BIZComponents/product-list.vue';
   import warehouseAll from '@/BIZComponents/warehouseAll.vue';
   import { levelList } from '@/enum/dict.js';
+  import { changeCount, getAllPrice } from '@/BIZComponents/setProduct.js';
+
   const dayjs = require('dayjs');
 
   export default {
@@ -461,13 +510,7 @@
           //   label: '批准文号',
           //   showOverflowTooltip: true
           // },
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
+
           {
             width: 120,
             prop: 'supplierMark',
@@ -490,12 +533,36 @@
             headerSlot: 'headerWarehouseId',
             align: 'center'
           },
+          {
+            width: 150,
+            prop: 'purchaseCount',
+            label: '数量',
+            slot: 'purchaseCount',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            slot: 'purchaseUnit',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
+
           {
             width: 120,
             prop: 'totalCount',
             label: '收货数量',
-            slot: 'totalCount',
-            headerSlot: 'headerTotalCount',
+            // slot: 'totalCount',
+            // headerSlot: 'headerTotalCount',
             align: 'center'
           },
           {
@@ -555,20 +622,20 @@
             slot: 'weightUnit',
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 160,
             prop: 'singlePrice',
@@ -599,7 +666,7 @@
             width: 180,
             prop: 'notaxSinglePrice',
             label: '不含税单价',
-            slot: 'notaxSinglePrice',
+            // slot: 'notaxSinglePrice',
             align: 'center'
           },
           {
@@ -806,61 +873,97 @@
 
         this.setIcreaseTotalWeight(this.curIndex);
       },
-      //修改数量更新合计/总重
-      changeNum(val, index, row) {
-        this.setWeight(index);
-        this.getTotalPrice(index);
-      },
-      setWeight(index) {
-        let data = this.form.datasource[index];
-        let totalCount = data.totalCount;
-        let singleWeight = data.singleWeight;
-        let sendTotalWeight = data.sendTotalWeight;
+
+      //改变数量
+      changeCount(row, index) {
         this.$set(
-          this.form.datasource[index],
-          'receiveTotalWeight',
-          totalCount * singleWeight || 0
+          this.form,
+          'datasource[' + index + ']',
+          changeCount(row, {
+            countKey: 'purchaseCount',
+            unitKey: 'purchaseUnit',
+            unitIdKey: 'purchaseUnitId'
+          })
         );
         this.$set(
           this.form.datasource[index],
-          'increaseTotalWeight',
-          Number(this.form.datasource[index].receiveTotalWeight) -
-            Number(sendTotalWeight)
+          'receiveTotalWeight',
+          this.form.datasource[index].totalWeight
         );
+        this.setIcreaseTotalWeight(index);
+        this.getNotaxSinglePrice();
+        this.$forceUpdate();
       },
-      getTotalPrice(index) {
-        let data = this.form.datasource[index];
-        let singlePrice = data.singlePrice;
-        let discountSinglePrice = data.discountSinglePrice;
-        let totalCount = data.totalCount;
-        if (data['pricingWay'] == 2) {
-          let increaseTotalWeight = data.increaseTotalWeight;
-          this.$set(
-            this.form.datasource[index],
-            'totalPrice',
-            (Number(increaseTotalWeight) * Number(singlePrice)).toFixed(2)
-          );
-          this.$set(
-            this.form.datasource[index],
-            'discountTotalPrice',
-            (Number(discountSinglePrice) * Number(increaseTotalWeight)).toFixed(
-              2
-            )
-          );
-        }
-        if (this.form.datasource[index]['pricingWay'] == 1) {
-          this.$set(
-            this.form.datasource[index],
-            'totalPrice',
-            (Number(totalCount) * Number(singlePrice)).toFixed(2)
-          );
-          this.$set(
-            this.form.datasource[index],
-            'discountTotalPrice',
-            (Number(totalCount) * Number(discountSinglePrice)).toFixed(2)
-          );
-        }
+      getNotaxSinglePrice() {
+        this.form.datasource.forEach((item, index) => {
+          if (item.singlePrice && item.taxRate) {
+            this.$set(
+              this.form.datasource[index],
+              'notaxSinglePrice',
+              parseFloat(
+                (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
+              )
+            );
+          } else {
+            this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
+          }
+        });
       },
+      // //修改数量更新合计/总重
+      // changeNum(val, index, row) {
+      //   this.setWeight(index);
+      //   this.getTotalPrice(index);
+      // },
+      // setWeight(index) {
+      //   let data = this.form.datasource[index];
+      //   let totalCount = data.totalCount;
+      //   let singleWeight = data.singleWeight;
+      //   let sendTotalWeight = data.sendTotalWeight;
+      //   this.$set(
+      //     this.form.datasource[index],
+      //     'receiveTotalWeight',
+      //     totalCount * singleWeight || 0
+      //   );
+      //   this.$set(
+      //     this.form.datasource[index],
+      //     'increaseTotalWeight',
+      //     Number(this.form.datasource[index].receiveTotalWeight) -
+      //       Number(sendTotalWeight)
+      //   );
+      // },
+      // getTotalPrice(index) {
+      //   let data = this.form.datasource[index];
+      //   let singlePrice = data.singlePrice;
+      //   let discountSinglePrice = data.discountSinglePrice;
+      //   let totalCount = data.totalCount;
+      //   if (data['pricingWay'] == 2) {
+      //     let increaseTotalWeight = data.increaseTotalWeight;
+      //     this.$set(
+      //       this.form.datasource[index],
+      //       'totalPrice',
+      //       (Number(increaseTotalWeight) * Number(singlePrice)).toFixed(2)
+      //     );
+      //     this.$set(
+      //       this.form.datasource[index],
+      //       'discountTotalPrice',
+      //       (Number(discountSinglePrice) * Number(increaseTotalWeight)).toFixed(
+      //         2
+      //       )
+      //     );
+      //   }
+      //   if (this.form.datasource[index]['pricingWay'] == 1) {
+      //     this.$set(
+      //       this.form.datasource[index],
+      //       'totalPrice',
+      //       (Number(totalCount) * Number(singlePrice)).toFixed(2)
+      //     );
+      //     this.$set(
+      //       this.form.datasource[index],
+      //       'discountTotalPrice',
+      //       (Number(totalCount) * Number(discountSinglePrice)).toFixed(2)
+      //     );
+      //   }
+      // },
       //设置增重总重
       setIcreaseTotalWeight(index) {
         let receiveTotalWeight = Number(
@@ -874,7 +977,6 @@
           'increaseTotalWeight',
           (receiveTotalWeight - sendTotalWeight).toFixed(2)
         );
-        this.getTotalPrice(index);
         this.$refs.table.reload();
       },
       //选择产品回调
@@ -925,7 +1027,28 @@
             'supplierMark',
             this.form.datasource[0]?.supplierMark
           );
-          // this.$set(parasm, 'batchNo', await getCode('1900101420390125570'));
+          this.$set(
+            parasm,
+            'packingSpecification',
+            item.extField?.packingSpecification
+          );
+          this.$set(
+            parasm,
+            'packageDispositionList',
+            item.packageDispositionList
+          );
+          if (item.packageDispositionList?.length) {
+            this.$set(
+              parasm,
+              'purchaseUnitId',
+              item.packageDispositionList[0].id
+            );
+            this.$set(
+              parasm,
+              'purchaseUnit',
+              item.packageDispositionList[0].conversionUnit
+            );
+          }
           if (item.purchaseOrigins?.length > 0) {
             item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
           }
@@ -1013,7 +1136,7 @@
               : '';
             item.key = index + 1;
             this.init(item, index);
-            this.getTotalPrice(index);
+            // this.getTotalPrice(index);
           });
           this.$refs.table.reload();
           this.$forceUpdate();
@@ -1048,7 +1171,6 @@
             item.increaseTotalWeight || item.receiveTotalWeight || 0
           );
         }
-        this.$set(this.form.datasource[index], 'pricingWay', item.pricingWay);
       },
 
       remove(i) {

+ 38 - 22
src/views/purchasingManage/purchaseOrder/outSourceSend/components/detailDialog.vue

@@ -252,13 +252,7 @@
               }
             }
           },
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
+ 
           {
             width: 200,
             prop: 'supplierMark',
@@ -273,7 +267,29 @@
             slot: 'warehouseName',
             align: 'center'
           },
-
+          {
+            width: 150,
+            prop: 'purchaseCount',
+            label: '数量',
+            slot: 'purchaseCount',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            slot: 'purchaseUnit',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
           {
             width: 120,
             prop: 'totalCount',
@@ -323,20 +339,20 @@
             slot: 'weightUnit',
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             minWidth: 120,
             prop: 'goodsLevel',

+ 200 - 91
src/views/purchasingManage/purchaseOrder/outSourceSend/components/inventoryTable.vue

@@ -52,17 +52,7 @@
           style="margin-bottom: 20px"
           :prop="'datasource.' + $index + '.customerReqFiles'"
         >
-          <div v-if="row.customerReqFiles && row.customerReqFiles?.length">
-            <el-link
-              v-for="link in row.customerReqFiles"
-              :key="link.id"
-              type="primary"
-              :underline="false"
-              @click="downloadFile(link)"
-            >
-              {{ link.name }}
-            </el-link>
-          </div>
+          <fileMain v-model="row.customerReqFiles" type="view"></fileMain>
         </el-form-item>
       </template>
 
@@ -79,7 +69,7 @@
           />
         </el-form-item>
       </template>
-      <template v-slot:totalCount="scope">
+      <!-- <template v-slot:totalCount="scope">
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.totalCount'"
@@ -92,7 +82,7 @@
             @input="(val) => changeNum(val, scope.row, scope.$index)"
           ></el-input>
         </el-form-item>
-      </template>
+      </template> -->
       <template v-slot:singlePrice="scope">
         <el-form-item
           style="margin-bottom: 20px"
@@ -101,7 +91,7 @@
           <el-input
             v-model="scope.row.singlePrice"
             placeholder="请输入"
-            @input="changeNum(val, scope.row, scope.$index)"
+            @input="changeCount(scope.row, scope.$index)"
             type="number"
           >
             <template slot="append">元</template>
@@ -171,6 +161,53 @@
           </el-button>
         </el-form-item>
       </template>
+
+      <template v-slot:purchaseCount="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.purchaseCount'"
+          :rules="{
+            required: true,
+            message: '请输入数量',
+            trigger: 'change'
+          }"
+        >
+          <el-input
+            v-model="scope.row.purchaseCount"
+            placeholder="请输入"
+            type="number"
+            :min="0"
+            @input="changeCount(scope.row, scope.$index)"
+          >
+          </el-input>
+        </el-form-item>
+      </template>
+      <template v-slot:purchaseUnit="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.purchaseUnitId'"
+          :rules="{
+            required: true,
+            message: '请选择单位',
+            trigger: 'change'
+          }"
+        >
+          <el-select
+            v-model="scope.row.purchaseUnitId"
+            style="width: 100%"
+            @change="changeCount(scope.row, scope.$index)"
+          >
+            <el-option
+              :label="item.conversionUnit"
+              :value="item.id"
+              @click.native="packingChange(item, scope.$index)"
+              v-for="(item, index) in scope.row.packageDispositionList"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </template>
+
       <!-- 操作列 -->
       <template v-slot:action="scope">
         <el-popconfirm
@@ -217,9 +254,10 @@
   import { getCode } from '@/components/addDoc/api/index.js';
   import { lbjtList } from '@/enum/dict.js';
   import { levelList } from '@/enum/dict.js';
+  import { changeCount } from '@/BIZComponents/setProduct.js';
 
   export default {
-    mixins: [dictMixins,tabMixins],
+    mixins: [dictMixins, tabMixins],
     props: {
       orderId: String,
       isShowAdd: {
@@ -231,7 +269,8 @@
     },
     components: {
       // fileMain,
-      productList,taskinstanceDialog
+      productList,
+      taskinstanceDialog
     },
     data() {
       const defaultForm = {
@@ -247,12 +286,12 @@
         // warehouseName:'',
       };
       return {
-        cacheKeyUrl:'eos-purchaseOrder-outSourceSend-inventoryTable',
+        cacheKeyUrl: 'eos-purchaseOrder-outSourceSend-inventoryTable',
         discountTotalPrice: 0.0,
         allPrice: 0.0,
         numberReg,
         defaultForm,
-        taskinstanceDialogFlag:false,
+        taskinstanceDialogFlag: false,
         warehouseList: [],
         form: {
           datasource: []
@@ -331,20 +370,8 @@
               }
             }
           },
-          // {
-          //   width: 120,
-          //   prop: 'approvalNumber',
-          //   align: 'center',
-          //   label: '批准文号',
-          //   showOverflowTooltip: true
-          // },
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
+
+   
           {
             minWidth: 150,
             prop: 'supplierMark',
@@ -367,6 +394,29 @@
             slot: 'warehouseNum',
             align: 'center'
           },
+          {
+            width: 150,
+            prop: 'purchaseCount',
+            label: '数量',
+            slot: 'purchaseCount',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            slot: 'purchaseUnit',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
           {
             width: 100,
             prop: 'totalCount',
@@ -423,26 +473,27 @@
             slot: 'weightUnit',
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '数量'
-                : row.pricingWay == 2
-                ? '重量'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '数量'
+          //       : row.pricingWay == 2
+          //       ? '重量'
+          //       : '';
+          //   }
+          // },
           {
             minWidth: 120,
             prop: 'goodsLevel',
             label: '物品级别',
             formatter: (_row, _column, cellValue) => {
-              return levelList.find(item=>item.value==_row.goodsLevel)?.label
+              return levelList.find((item) => item.value == _row.goodsLevel)
+                ?.label;
             },
             align: 'center'
           },
@@ -466,7 +517,7 @@
             width: 180,
             prop: 'notaxSinglePrice',
             label: '不含税单价',
-            slot: 'notaxSinglePrice',
+            // slot: 'notaxSinglePrice',
             align: 'center'
           },
           {
@@ -631,9 +682,6 @@
       }
     },
     methods: {
-      downloadFile(file) {
-        getFile({ objectName: file.storePath }, file.name);
-      },
       async warehouseChange(index, row, item) {
         console.log(item, 'row');
 
@@ -663,52 +711,96 @@
           this.$refs.taskinstanceDialogRef.open(row, index);
         });
       },
-      //改数量更新合计
-      changeNum(val, row, index) {
+      //改数量
+      changeCount(row, index) {
         this.$set(
-          this.form.datasource[index],
-          'sendTotalWeight',
-          val ? val * row.singleWeight : ''
+          this.form,
+          'datasource[' + index + ']',
+          changeCount(row, {
+            countKey: 'purchaseCount',
+            unitKey: 'purchaseUnit',
+            unitIdKey: 'purchaseUnitId'
+          })
         );
         this.$set(
           this.form.datasource[index],
-          'totalPrice',
-          this.getTotalPrice(row).toFixed(2)
+          'sendTotalWeight',
+          this.form.datasource[index].totalWeight
         );
+
+        this.getNotaxSinglePrice();
+        this.$forceUpdate();
+      },
+      packingChange(item, index) {
         this.$set(
           this.form.datasource[index],
-          'discountTotalPrice',
-          this.getDiscountTotalPrice(row).toFixed(2)
+          'purchaseUnit',
+          item.conversionUnit
         );
       },
-      getTotalPrice(row) {
-        let num = 0;
-        if (row.pricingWay == 1) {
-          num = Number(row.singlePrice) * Number(row.totalCount);
-        }
-        if (row.pricingWay == 2) {
-          num =
-            Number(row.singlePrice) *
-            Number(row.totalCount) *
-            Number(row.singleWeight);
-        }
 
-        return num;
+      //计算不含税单价
+      getNotaxSinglePrice() {
+        this.form.datasource.forEach((item, index) => {
+          if (item.singlePrice && item.taxRate) {
+            this.$set(
+              this.form.datasource[index],
+              'notaxSinglePrice',
+              parseFloat(
+                (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
+              )
+            );
+          } else {
+            this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
+          }
+        });
       },
-      getDiscountTotalPrice(row) {
-        let num = 0;
-        if (row.pricingWay == 1) {
-          num = Number(row.discountSinglePrice) * Number(row.totalCount);
-        }
-        if (row.pricingWay == 2) {
-          num =
-            Number(row.discountSinglePrice) *
-            Number(row.totalCount) *
-            Number(row.singleWeight);
-        }
+      // //修改数量更新合计
+      // changeNum(val, row, index) {
+      //   this.$set(
+      //     this.form.datasource[index],
+      //     'sendTotalWeight',
+      //     val ? val * row.singleWeight : ''
+      //   );
+      //   this.$set(
+      //     this.form.datasource[index],
+      //     'totalPrice',
+      //     this.getTotalPrice(row).toFixed(2)
+      //   );
+      //   this.$set(
+      //     this.form.datasource[index],
+      //     'discountTotalPrice',
+      //     this.getDiscountTotalPrice(row).toFixed(2)
+      //   );
+      // },
+      // getTotalPrice(row) {
+      //   let num = 0;
+      //   if (row.pricingWay == 1) {
+      //     num = Number(row.singlePrice) * Number(row.totalCount);
+      //   }
+      //   if (row.pricingWay == 2) {
+      //     num =
+      //       Number(row.singlePrice) *
+      //       Number(row.totalCount) *
+      //       Number(row.singleWeight);
+      //   }
 
-        return num;
-      },
+      //   return num;
+      // },
+      // getDiscountTotalPrice(row) {
+      //   let num = 0;
+      //   if (row.pricingWay == 1) {
+      //     num = Number(row.discountSinglePrice) * Number(row.totalCount);
+      //   }
+      //   if (row.pricingWay == 2) {
+      //     num =
+      //       Number(row.discountSinglePrice) *
+      //       Number(row.totalCount) *
+      //       Number(row.singleWeight);
+      //   }
+
+      //   return num;
+      // },
       // //选择产品回调
       // changeParent(obj, idx) {
       //   obj.orderTotalCount = obj.totalCount;
@@ -764,6 +856,23 @@
             'supplierMark',
             this.form.datasource[0]?.supplierMark
           );
+          this.$set(
+            parasm,
+            'packageDispositionList',
+            item.packageDispositionList
+          );
+          if (item.packageDispositionList?.length) {
+            this.$set(
+              parasm,
+              'purchaseUnitId',
+              item.packageDispositionList[0].id
+            );
+            this.$set(
+              parasm,
+              'purchaseUnit',
+              item.packageDispositionList[0].conversionUnit
+            );
+          }
           this.$set(parasm, 'batchNo', await getCode('1900101420390125570'));
           if (item.purchaseOrigins?.length > 0) {
             item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
@@ -840,12 +949,12 @@
                 categoryId: item.productId
               })
             );
-            if (!item.sendTotalWeight)
-              this.$set(
-                item,
-                'sendTotalWeight',
-                Number(item.totalCount) * Number(item.singleWeight)
-              );
+            // if (!item.sendTotalWeight)
+            this.$set(
+              item,
+              'sendTotalWeight',
+              item.sendTotalWeight || item.totalWeight
+            );
           });
         }
       },

+ 14 - 14
src/views/purchasingManage/purchaseOrder/returnGoods/components/detailDialog.vue

@@ -339,20 +339,20 @@
             slot: 'increaseTotalWeight',
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             minWidth: 120,
             prop: 'goodsLevel',

+ 14 - 14
src/views/purchasingManage/purchaseOrder/returnGoods/components/inventoryTable.vue

@@ -456,20 +456,20 @@
             slot: 'increaseTotalWeight',
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             minWidth: 120,
             prop: 'goodsLevel',

+ 28 - 15
src/views/purchasingManage/purchasePlanManage/components/detailDialog.vue

@@ -398,13 +398,39 @@
             slot: 'productBrand',
             align: 'center'
           },
+          {
+            width: 150,
+            prop: 'purchaseCount',
+            label: '数量',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            align: 'center'
+          },
+          {
+            minWidth: 180,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
           {
             width: 80,
             prop: 'totalCount',
-            label: '数量',
+            label: '计量数量',
             slot: 'totalCount',
             align: 'center'
           },
+          {
+            width: 100,
+            prop: 'measuringUnit',
+            label: '计量单位',
+            slot: 'measuringUnit',
+            align: 'center'
+          },
           {
             minWidth: 120,
             prop: 'goodsLevel',
@@ -471,13 +497,7 @@
             label: '已核价重量',
             align: 'center'
           },
-          {
-            width: 100,
-            prop: 'measuringUnit',
-            label: '单位',
-            slot: 'measuringUnit',
-            align: 'center'
-          },
+     
           {
             width: 130,
             prop: 'modelType',
@@ -525,13 +545,6 @@
             headerSlot: 'headerSupplierName',
             align: 'center'
           },
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
           {
             width: 160,
             prop: 'technicalDrawings',

+ 134 - 30
src/views/purchasingManage/purchasePlanManage/components/inventoryTable.vue

@@ -94,7 +94,7 @@
         >
           <el-input
             v-model="scope.row.totalCount"
-            @input="singleWeightChange(scope.row, scope.$index)"
+            @input="changeCount(scope.row, scope.$index)"
             placeholder="请输入"
           ></el-input>
         </el-form-item>
@@ -308,7 +308,7 @@
           <el-input
             :disabled="isContractId"
             v-model="scope.row.singleWeight"
-            @input="singleWeightChange(scope.row, scope.$index)"
+            @input="changeCount(scope.row, scope.$index)"
             placeholder="请输入"
           ></el-input>
         </el-form-item>
@@ -318,11 +318,10 @@
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.supplierName'"
           :rules="{
-            required: isSupplier?true:false,
+            required: isSupplier ? true : false,
             trigger: 'change',
-            message: '请选择供应商',
+            message: '请选择供应商'
           }"
-          
         >
           <el-input
             clearable
@@ -356,9 +355,7 @@
         <span class="is-required">{{ column.label }}</span>
       </template>
       <template v-slot:headerSupplierName="{ column }">
-        <span :class="{ 'is-required': isSupplier }">{{
-          column.label
-        }}</span>
+        <span :class="{ 'is-required': isSupplier }">{{ column.label }}</span>
       </template>
       <template v-slot:headerWarehouseId="{ column }">
         <span
@@ -393,6 +390,51 @@
           </el-select>
         </el-form-item>
       </template>
+      <template v-slot:purchaseCount="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.purchaseCount'"
+          :rules="{
+            required: true,
+            message: '请输入数量',
+            trigger: 'change'
+          }"
+        >
+          <el-input
+            v-model="scope.row.purchaseCount"
+            placeholder="请输入"
+            type="number"
+            :min="0"
+            @input="changeCount(scope.row, scope.$index)"
+          >
+          </el-input>
+        </el-form-item>
+      </template>
+      <template v-slot:purchaseUnit="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.purchaseUnitId'"
+          :rules="{
+            required: true,
+            message: '请选择单位',
+            trigger: 'change'
+          }"
+        >
+          <el-select
+            v-model="scope.row.purchaseUnitId"
+            style="width: 100%"
+            @change="changeCount(scope.row, scope.$index)"
+          >
+            <el-option
+              :label="item.conversionUnit"
+              :value="item.id"
+              @click.native="packingChange(item, scope.$index)"
+              v-for="(item, index) in scope.row.packageDispositionList"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </template>
       <!-- 操作列 -->
       <template v-slot:action="scope">
         <el-popconfirm
@@ -460,6 +502,7 @@
   import { getWarehouseList } from '@/api/saleManage/saleorder';
   import warehouseAll from '@/BIZComponents/warehouseAll.vue';
   import { levelList } from '@/enum/dict.js';
+  import { changeCount } from '@/BIZComponents/setProduct.js';
 
   export default {
     mixins: [dictMixins, tabMixins],
@@ -487,7 +530,6 @@
       warehouseAll
     },
     computed: {
-   
       columns() {
         return [
           {
@@ -555,13 +597,36 @@
             align: 'center'
           },
           {
-            width: 90,
-            prop: 'totalCount',
+            width: 150,
+            prop: 'purchaseCount',
             label: '数量',
-            slot: 'totalCount',
+            slot: 'purchaseCount',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'purchaseUnit',
+            label: '单位',
+            slot: 'purchaseUnit',
             headerSlot: 'headerTotalCount',
             align: 'center'
           },
+          {
+            width: 120,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
+          {
+            width: 90,
+            prop: 'totalCount',
+            label: '计量数量',
+            // slot: 'totalCount',
+            // headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
           {
             minWidth: 120,
             prop: 'goodsLevel',
@@ -690,14 +755,6 @@
             }
           },
 
-          {
-            width: 120,
-            prop: 'packingSpecification',
-            align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
-          },
-
           {
             width: 100,
             prop: 'measuringUnit',
@@ -775,16 +832,37 @@
         });
         return comitDatasource;
       },
-      //计算单重
-      singleWeightChange(row, index) {
-        if (row && row.singleWeight && row.totalCount) {
-          row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2) || 0;
-          this.$set(
-            this.form.datasource[index],
-            'totalWeight',
-            row.totalWeight
-          );
-        }
+      // //计算单重
+      // singleWeightChange(row, index) {
+      //   if (row && row.singleWeight && row.totalCount) {
+      //     row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2) || 0;
+      //     this.$set(
+      //       this.form.datasource[index],
+      //       'totalWeight',
+      //       row.totalWeight
+      //     );
+      //   }
+      // },
+
+      packingChange(item, index) {
+        this.$set(
+          this.form.datasource[index],
+          'purchaseUnit',
+          item.conversionUnit
+        );
+      },
+      //改变数量
+      changeCount(row, index) {
+        this.$set(
+          this.form,
+          'datasource[' + index + ']',
+          changeCount(row, {
+            countKey: 'purchaseCount',
+            unitKey: 'purchaseUnit',
+            unitIdKey: 'purchaseUnitId'
+          })
+        );
+        this.$forceUpdate();
       },
       //修改回显
       async putTableValue(data) {
@@ -948,6 +1026,19 @@
             'packingSpecification',
             item.extField.packingSpecification
           );
+          this.$set(
+            parasm,
+            'packageDispositionList',
+            item.packageDispositionList
+          );
+          if (item.packageDispositionList?.length) {
+            this.$set(parasm, 'purchaseUnitId', item.packageDispositionList[0].id);
+            this.$set(
+              parasm,
+              'purchaseUnit',
+              item.packageDispositionList[0].conversionUnit
+            );
+          }
           this.$set(parasm, 'provenance', item.purchaseOrigins || []);
           if (idx == -1) {
             this.form.datasource.push(row);
@@ -994,6 +1085,19 @@
             'packingSpecification',
             item.extField.packingSpecification
           );
+          this.$set(
+            parasm,
+            'packageDispositionList',
+            item.packageDispositionList
+          );
+          if (item.packageDispositionList?.length) {
+            this.$set(parasm, 'purchaseUnitId', item.packageDispositionList[0].id);
+            this.$set(
+              parasm,
+              'purchaseUnit',
+              item.packageDispositionList[0].conversionUnit
+            );
+          }
           if (item.purchaseOrigins?.length > 0) {
             item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
           }

+ 1 - 0
src/views/saleManage/quotation/index.vue

@@ -492,6 +492,7 @@
             sourceName: data.code,
             status: '',
             totalPrice: data.totalPrice,
+            discountTotalPrice: data.totalPrice,
             type: '1',
             typeName: '销售合同',
             updateUsername: '',

+ 11 - 11
src/views/saleManage/saleOrder/accountstatement/components/inventoryTable.vue

@@ -175,17 +175,17 @@ export default {
                 : '';
             }
           },
-          {
-            minWidth: 100,
-            prop: 'pricingWay',
-            label: '计价方式',
-            align: 'center',
-            slot: 'pricingWay',
-            showOverflowTooltip: true,
-            formatter: (_row, _column, cellValue) => {
-              return _row.pricingWay == 1 ? '按数量计价' :_row.pricingWay == 2? '按重量计价':''
-            }
-          },
+          // {
+          //   minWidth: 100,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   align: 'center',
+          //   slot: 'pricingWay',
+          //   showOverflowTooltip: true,
+          //   formatter: (_row, _column, cellValue) => {
+          //     return _row.pricingWay == 1 ? '按数量计价' :_row.pricingWay == 2? '按重量计价':''
+          //   }
+          // },
           {
             minWidth: 100,
             prop: 'totalCount',

+ 7 - 0
src/views/saleManage/saleOrder/components/addDialog.vue

@@ -791,6 +791,13 @@
               contractNo,
               contractNumber
             });
+            data.productList = data.productList.map((item) => {
+              item['saleCount'] = item.contractCount;
+              item['saleUnit'] = item.contractUnit;
+              item['saleUnitId'] = item.contractUnitId;
+              return item;
+            });
+
             this.getLinkInfo(partaId);
             this.$refs.inventoryTable &&
               this.$refs.inventoryTable.putTableValue(data);

+ 2 - 2
src/views/saleManage/saleOrder/customerReturnOrder/add-sale-order-dialog.vue

@@ -34,14 +34,14 @@
           >
             <span>{{ form.contactName }}</span>
           </el-form-item>
-          <el-form-item
+          <!-- <el-form-item
             label="计价方式"
             style="margin-bottom: 22px">
             <el-select v-model="form.pricingWay" disabled style="width: 100%">
               <el-option label="按数量计费" :value="1"></el-option>
               <el-option label="按重量计费" :value="2"></el-option>
             </el-select>
-          </el-form-item>
+          </el-form-item> -->
           <el-form-item
             label="客户联系人"
             prop="linkName"

+ 14 - 14
src/views/saleManage/saleOrder/entrustedReceive/components/detailDialog.vue

@@ -270,20 +270,20 @@
             slot: 'weightUnit',
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 160,
             prop: 'singlePrice',

+ 14 - 14
src/views/saleManage/saleOrder/entrustedReceive/components/inventoryTable.vue

@@ -321,20 +321,20 @@
             slot: 'weightUnit',
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 80,
             prop: 'singlePrice',

+ 14 - 14
src/views/saleManage/saleOrder/exceptionManagement/components/addOrEditDialog.vue

@@ -276,20 +276,20 @@
             showOverflowTooltip: true,
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 100,
             prop: 'singlePrice',

+ 1 - 8
src/views/saleManage/saleOrder/invoice/components/detailDialog.vue

@@ -60,14 +60,7 @@
           </el-col>
 
           <el-col :span="12">
-            <!-- <el-form-item label="车辆名称" >
-              <el-input disabled v-model="form.deviceName"/>
-            </el-form-item>
-            <el-form-item
-              label="车牌号:"
-              prop="carNo">
-              <el-input v-model="form.carNo" disabled></el-input>
-            </el-form-item> -->
+   
             <el-form-item label="受托收货单编码:" prop="entrustedCode">
               <el-input v-model="form.entrustedCode" disabled></el-input>
             </el-form-item>

+ 237 - 126
src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue

@@ -233,7 +233,7 @@
           <el-input
             v-model="scope.row.singlePrice"
             placeholder="请输入"
-            @input="changeCount"
+            @input="changeCount(scope.row, scope.$index)"
             type="number"
           >
             <template slot="append">元</template>
@@ -285,7 +285,51 @@
           column.label
         }}</span>
       </template>
-
+      <template v-slot:saleCount="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.saleCount'"
+          :rules="{
+            required: true,
+            message: '请输入数量',
+            trigger: 'change'
+          }"
+        >
+          <el-input
+            v-model="scope.row.saleCount"
+            placeholder="请输入"
+            type="number"
+            :min="0"
+            @input="changeCount(scope.row, scope.$index)"
+          >
+          </el-input>
+        </el-form-item>
+      </template>
+      <template v-slot:saleUnit="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.saleUnitId'"
+          :rules="{
+            required: true,
+            message: '请选择单位',
+            trigger: 'change'
+          }"
+        >
+          <el-select
+            v-model="scope.row.saleUnitId"
+            style="width: 100%"
+            @change="changeCount(scope.row, scope.$index)"
+          >
+            <el-option
+              :label="item.conversionUnit"
+              :value="item.id"
+              @click.native="packingChange(item, scope.$index)"
+              v-for="(item, index) in scope.row.packageDispositionList"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </template>
       <!-- 操作列 -->
       <template v-slot:action="scope">
         <el-popconfirm
@@ -356,7 +400,7 @@
   import { getFile } from '@/api/system/file';
   import innertboundDetailsDialog from '@/BIZComponents/innerboundDetailsDialog.vue';
   import stockLedgerDialog from './stockLedger/stockLedgerDialog.vue';
-  import { fieldModelAPI } from '@/api/main';
+
   import getDynamicsColumns from '@/mixins/getDynamicsColumns';
   // import fileMain from '@/components/addDoc/index.vue';
   import selectStockLedgerDialog from '@/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue'; //库存台账
@@ -365,7 +409,7 @@
   import { parameterGetByCode } from '@/api/main/index.js';
   import tabMixins from '@/mixins/tableColumnsMixin';
   import { levelList } from '@/enum/dict.js';
-
+  import { changeCount, getAllPrice } from '@/BIZComponents/setProduct.js';
   export default {
     mixins: [dictMixins, getDynamicsColumns, tabMixins],
     props: {
@@ -551,29 +595,7 @@
             align: 'center',
             slot: 'productionCodes'
           },
-          {
-            width: 120,
-            prop: 'imgCode',
-            align: 'center',
-            label: '图号/件号',
-            showOverflowTooltip: true
-          },
-          {
-            width: 120,
-            prop: 'produceType',
-            align: 'center',
-            label: '属性类型',
-            formatter: (row, column) => {
-              if (row.produceType) {
-                return row.produceType
-                  .map((item) => {
-                    return lbjtList[item];
-                  })
-                  .toString();
-              }
-            },
-            showOverflowTooltip: true
-          },
+
           {
             minWidth: 120,
             prop: 'goodsLevel',
@@ -616,12 +638,37 @@
           //   slot: 'stockLedger',
           //   align: 'center'
           // },
+
+          {
+            width: 150,
+            prop: 'saleCount',
+            label: '数量',
+            slot: 'saleCount',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'saleUnit',
+            label: '单位',
+            slot: 'saleUnit',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
+
           {
             width: 120,
             prop: 'totalCount',
             label: '发货数量',
-            slot: 'totalCount',
-            headerSlot: 'headerTotalCount',
+            // slot: 'totalCount',
+            // headerSlot: 'headerTotalCount',
             align: 'center'
           },
           {
@@ -685,20 +732,20 @@
             slot: 'weightUnit',
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 180,
             prop: 'singlePrice',
@@ -749,12 +796,35 @@
             align: 'center'
           },
           {
-            width: 80,
-            prop: 'deliveryDays',
-            label: '交期(天)',
-            slot: 'deliveryDays',
-            align: 'center'
+            width: 120,
+            prop: 'imgCode',
+            align: 'center',
+            label: '图号/件号',
+            showOverflowTooltip: true
           },
+          {
+            width: 120,
+            prop: 'produceType',
+            align: 'center',
+            label: '属性类型',
+            formatter: (row, column) => {
+              if (row.produceType) {
+                return row.produceType
+                  .map((item) => {
+                    return lbjtList[item];
+                  })
+                  .toString();
+              }
+            },
+            showOverflowTooltip: true
+          },
+          // {
+          //   width: 80,
+          //   prop: 'deliveryDays',
+          //   label: '交期(天)',
+          //   slot: 'deliveryDays',
+          //   align: 'center'
+          // },
 
           {
             width: 200,
@@ -851,39 +921,46 @@
       },
       changeCount1(row, index) {
         this.tableHandleKeyUp(row, index, 'sum');
-        this.changeCount();
+        this.changeCount(row, index);
       },
-      //改变数量
-      changeCount() {
-        this.form.datasource.forEach((item, index) => {
-          if (item.pricingWay == 1) {
-            this.$set(
-              this.form.datasource[index],
-              'discountTotalPrice',
-              item.discountSinglePrice * item.totalCount
-            );
-            this.$set(
-              this.form.datasource[index],
-              'totalPrice',
-              item.singlePrice * item.totalCount
-            );
-          }
-          if (item.pricingWay == 2) {
-            this.$set(
-              this.form.datasource[index],
-              'discountTotalPrice',
-              item.discountSinglePrice *
-                item.totalCount *
-                (item.singleWeight || 0)
-            );
-            this.$set(
-              this.form.datasource[index],
-              'totalPrice',
-              item.singlePrice * item.totalCount * (item.singleWeight || 0)
-            );
-          }
-        });
+      packingChange(item, index) {
+        this.$set(
+          this.form.datasource[index],
+           'saleUnitId',
+          item.conversionUnit
+        );
       },
+      //改变数量
+      // changeCount() {
+      //   this.form.datasource.forEach((item, index) => {
+      //     if (item.pricingWay == 1) {
+      //       this.$set(
+      //         this.form.datasource[index],
+      //         'discountTotalPrice',
+      //         item.discountSinglePrice * item.totalCount
+      //       );
+      //       this.$set(
+      //         this.form.datasource[index],
+      //         'totalPrice',
+      //         item.singlePrice * item.totalCount
+      //       );
+      //     }
+      //     if (item.pricingWay == 2) {
+      //       this.$set(
+      //         this.form.datasource[index],
+      //         'discountTotalPrice',
+      //         item.discountSinglePrice *
+      //           item.totalCount *
+      //           (item.singleWeight || 0)
+      //       );
+      //       this.$set(
+      //         this.form.datasource[index],
+      //         'totalPrice',
+      //         item.singlePrice * item.totalCount * (item.singleWeight || 0)
+      //       );
+      //     }
+      //   });
+      // },
       //获取
       getStockLedger(sendProductDetail) {
         if (!this.form.datasource[this.curIndex].sendProductDetail)
@@ -932,12 +1009,64 @@
           warehouseOutStock || 0
         );
       },
-
+      //改变数量
+      changeCount(row, index) {
+        this.$set(
+          this.form,
+          'datasource[' + index + ']',
+          changeCount(row, {
+            countKey: 'saleCount',
+            unitKey: 'saleUnit',
+            unitIdKey: 'saleUnitId'
+          })
+        );
+        this.$set(
+          this.form.datasource[index],
+          'sendTotalWeight',
+          this.form.datasource[index].totalWeight
+        );
+        this.changeSendTotalWeight(row, index);
+        this.getNotaxSinglePrice();
+        this.$forceUpdate();
+      },
       //修改发货总重
       changeSendTotalWeight(row, index) {
         this.curIndex = index;
         this.setIcreaseTotalWeight(row);
       },
+
+      //设置增重总重
+      setIcreaseTotalWeight(row) {
+        let receiveTotalWeight = Number(
+          this.form.datasource[this.curIndex]?.receiveTotalWeight
+        );
+        let sendTotalWeight = Number(
+          this.form.datasource[this.curIndex]?.sendTotalWeight
+        );
+        this.$set(
+          this.form.datasource[this.curIndex],
+          'increaseTotalWeight',
+          (sendTotalWeight - receiveTotalWeight).toFixed(2)
+        );
+        this.$refs.table.reload();
+        this.$forceUpdate();
+      },
+      //计算不含税单价
+      getNotaxSinglePrice() {
+        this.form.datasource.forEach((item, index) => {
+          if (item.singlePrice && item.taxRate) {
+            this.$set(
+              this.form.datasource[index],
+              'notaxSinglePrice',
+              parseFloat(
+                (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
+              )
+            );
+          } else {
+            this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
+          }
+        });
+      },
       //入库单详情
       handleInnerBound(e, rows, index) {
         this.curIndex = index;
@@ -964,42 +1093,23 @@
         this.setIcreaseTotalWeight(this.form.datasource[this.curIndex]);
       },
 
-      getWeightPrice() {
-        let increaseTotalWeight =
-          this.form.datasource[this.curIndex].increaseTotalWeight;
-        let singlePrice = this.form.datasource[this.curIndex].singlePrice;
-        let discountSinglePrice =
-          this.form.datasource[this.curIndex].discountSinglePrice;
-        this.$set(
-          this.form.datasource[this.curIndex],
-          'totalPrice',
-          (Number(increaseTotalWeight) * Number(singlePrice)).toFixed(2)
-        );
-        this.$set(
-          this.form.datasource[this.curIndex],
-          'discountTotalPrice',
-          (Number(discountSinglePrice) * Number(increaseTotalWeight)).toFixed(2)
-        );
-      },
-      //设置增重总重
-      setIcreaseTotalWeight(row) {
-        let receiveTotalWeight = Number(
-          this.form.datasource[this.curIndex]?.receiveTotalWeight
-        );
-        let sendTotalWeight = Number(
-          this.form.datasource[this.curIndex]?.sendTotalWeight
-        );
-        this.$set(
-          this.form.datasource[this.curIndex],
-          'increaseTotalWeight',
-          (sendTotalWeight - receiveTotalWeight).toFixed(2)
-        );
-        if (row.pricingWay == 2) {
-          this.getWeightPrice();
-        }
-        this.$refs.table.reload();
-        this.$forceUpdate();
-      },
+      // getWeightPrice() {
+      //   let increaseTotalWeight =
+      //     this.form.datasource[this.curIndex].increaseTotalWeight;
+      //   let singlePrice = this.form.datasource[this.curIndex].singlePrice;
+      //   let discountSinglePrice =
+      //     this.form.datasource[this.curIndex].discountSinglePrice;
+      //   this.$set(
+      //     this.form.datasource[this.curIndex],
+      //     'totalPrice',
+      //     (Number(increaseTotalWeight) * Number(singlePrice)).toFixed(2)
+      //   );
+      //   this.$set(
+      //     this.form.datasource[this.curIndex],
+      //     'discountTotalPrice',
+      //     (Number(discountSinglePrice) * Number(increaseTotalWeight)).toFixed(2)
+      //   );
+      // },
 
       // 表格:模数、数量(方)、块数输入框 输入事件
       tableHandleKeyUp(row, index, name) {
@@ -1017,7 +1127,7 @@
             row.totalCount =
               (Number(row.blockCount) * modelLong * modeWide * modeHight) /
               1000000;
-            this.changeCount();
+            this.changeCount(row, index);
           }
         }
       },
@@ -1165,10 +1275,15 @@
                 'receiveTotalWeight',
                 item.receiveTotalWeight || 0
               );
-              item.sendTotalWeight =
-                item.sendTotalWeight ||
-                Number(item.totalCount) * Number(item.singleWeight) ||
-                0;
+              if (item.weightUnit == item.measuringUnit) {
+                item.sendTotalWeight = item.sendTotalWeight || item.totalCount;
+              } else {
+                item.sendTotalWeight =
+                  item.sendTotalWeight ||
+                  Number(item.totalCount) * Number(item.singleWeight) ||
+                  0;
+              }
+
               if (this.outsourceSendCode) {
                 item.increaseTotalWeight =
                   Number(item.receiveTotalWeight) -
@@ -1178,7 +1293,6 @@
                   item.increaseTotalWeight || item.receiveTotalWeight || 0;
               }
             });
-            this.changeCount();
           });
         }
       },
@@ -1187,10 +1301,7 @@
         this.form.datasource.splice(i, 1);
         this.setSort();
       },
-      // 清空表格
-      restTable() {
-        this.form.datasource = [];
-      },
+
       // 重新排序
       setSort() {
         this.form.datasource.forEach((n, index) => {

+ 44 - 22
src/views/saleManage/saleOrder/invoice/components/inventoryTableDetails.vue

@@ -176,7 +176,29 @@
 
             align: 'center'
           },
-
+          {
+            width: 150,
+            prop: 'saleCount',
+            label: '数量',
+            slot: 'saleCount',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 150,
+            prop: 'saleUnit',
+            label: '单位',
+            slot: 'saleUnit',
+            headerSlot: 'headerTotalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
           {
             width: 120,
             prop: 'totalCount',
@@ -246,20 +268,20 @@
             slot: 'weightUnit',
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 160,
             prop: 'singlePrice',
@@ -305,13 +327,13 @@
             align: 'center'
           },
           ...this.dynamicsColumns,
-          {
-            width: 120,
-            prop: 'deliveryDays',
-            label: '交期(天)',
-            slot: 'deliveryDays',
-            align: 'center'
-          },
+          // {
+          //   width: 120,
+          //   prop: 'deliveryDays',
+          //   label: '交期(天)',
+          //   slot: 'deliveryDays',
+          //   align: 'center'
+          // },
           {
             width: 200,
             prop: 'guaranteePeriod',

+ 14 - 14
src/views/saleManage/saleOrder/invoiceConfirm/components/addInvoiceDialog.vue

@@ -415,20 +415,20 @@
             showOverflowTooltip: true,
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 160,
             prop: 'goodsPriceType',

+ 14 - 14
src/views/saleManage/saleOrder/invoiceConfirm/components/detailDialog.vue

@@ -384,20 +384,20 @@
             showOverflowTooltip: true,
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 160,
             prop: 'goodsPriceType',

+ 14 - 14
src/views/saleManage/saleOrder/returnGoods/components/detailDialog.vue

@@ -336,20 +336,20 @@
             showOverflowTooltip: true,
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 160,
             prop: 'goodsPriceType',

+ 14 - 14
src/views/saleManage/saleOrder/returnGoods/components/inventoryTable.vue

@@ -439,20 +439,20 @@
             showOverflowTooltip: true,
             align: 'center'
           },
-          {
-            width: 160,
-            prop: 'pricingWay',
-            label: '计价方式',
-            slot: 'pricingWay',
-            align: 'center',
-            formatter: (row, column) => {
-              return row.pricingWay == 1
-                ? '按数量计费'
-                : row.pricingWay == 2
-                ? '按重量计费'
-                : '';
-            }
-          },
+          // {
+          //   width: 160,
+          //   prop: 'pricingWay',
+          //   label: '计价方式',
+          //   slot: 'pricingWay',
+          //   align: 'center',
+          //   formatter: (row, column) => {
+          //     return row.pricingWay == 1
+          //       ? '按数量计费'
+          //       : row.pricingWay == 2
+          //       ? '按重量计费'
+          //       : '';
+          //   }
+          // },
           {
             width: 160,
             prop: 'goodsPriceType',