Browse Source

采购/合同流程新增委外操作

Z 2 years ago
parent
commit
29c2e72483
18 changed files with 1846 additions and 497 deletions
  1. 36 24
      src/views/contractManage/contractBook/components/addDialog.vue
  2. 8 1
      src/views/contractManage/contractBook/components/detailDialog.vue
  3. 143 102
      src/views/contractManage/contractBook/components/inventoryTable.vue
  4. 82 53
      src/views/contractManage/contractBook/components/inventoryTabledetail.vue
  5. 2 1
      src/views/purchasingManage/purchaseNeedManage/components/inventoryTable.vue
  6. 28 5
      src/views/purchasingManage/purchaseOrder/components/addDialog.vue
  7. 71 25
      src/views/purchasingManage/purchaseOrder/components/detailDialog.vue
  8. 106 76
      src/views/purchasingManage/purchaseOrder/components/inventoryTable.vue
  9. 3 1
      src/views/purchasingManage/purchaseOrder/invoice/components/addInvoiceDialog.vue
  10. 84 39
      src/views/purchasingManage/purchaseOrder/invoice/components/detailDialog.vue
  11. 92 45
      src/views/purchasingManage/purchaseOrder/invoice/components/inventoryTable.vue
  12. 21 7
      src/views/purchasingManage/purchaseOrder/outSourceSend/components/detailDialog.vue
  13. 51 44
      src/views/purchasingManage/purchaseOrder/outSourceSend/components/inventoryTable.vue
  14. 51 26
      src/views/purchasingManage/purchaseOrder/returnGoods/components/addReturnGoodsDialog.vue
  15. 60 16
      src/views/purchasingManage/purchaseOrder/returnGoods/components/detailDialog.vue
  16. 752 0
      src/views/purchasingManage/purchaseOrder/returnGoods/components/innerboundDetailsDialog.vue
  17. 254 32
      src/views/purchasingManage/purchaseOrder/returnGoods/components/inventoryTable.vue
  18. 2 0
      src/views/purchasingManage/purchasePlanManage/components/inventoryTable.vue

+ 36 - 24
src/views/contractManage/contractBook/components/addDialog.vue

@@ -51,6 +51,7 @@
               v-model="form.sourceType"
               placeholder="请选择"
               style="width: 100%"
+              clearable
               @change="sourceTypeChange(form.type)"
             >
               <el-option
@@ -233,7 +234,7 @@
             prop="pricingWay"
             style="margin-bottom: 22px"
           >
-            <el-radio-group v-model="form.pricingWay">
+            <el-radio-group v-model="form.pricingWay" @change="changePricingWay">
               <el-radio v-for="item in pricingWayList" :label="item.id">{{ item.name }}</el-radio>
             </el-radio-group>
           </el-form-item>
@@ -539,9 +540,7 @@ import {acceptUnpackoptions} from '@/enum/dict';
 import inventoryTable from './inventoryTable.vue';
 import inquiryList from './inquiryList.vue';
 import quotationList from './quotationList.vue';
-import {categoryData} from 'element-china-category-data';
 import fileUpload from '@/components/upload/fileUpload';
-import {cityData} from 'ele-admin/packages/utils/regions';
 import dictMixins from '@/mixins/dictMixins';
 import parentList from '@/views/saleManage/contact/components/parentList.vue';
 import {
@@ -612,8 +611,8 @@ export default {
       partbLinkName: '',
       partbName: '',
       partbTel: '',
-      settlementModeName: '',
-      settlementMode: '',
+      settlementModeName: '结算方式',
+      settlementMode: '4',
       pricingWay: 1,
       totalPrice: null,
       type: '', //1=销售合同  2=采购合同
@@ -621,7 +620,6 @@ export default {
     };
 
     return {
-      sourceName: '',
       payWayOptions: [],
       delDetailIds: [],
       paymentTypeOptions: [
@@ -630,7 +628,7 @@ export default {
       ],
       pricingWayList: [
         {id: 1, name: '按数量计价'},
-        {id: 2, name: '按增重计价'}
+        {id: 2, name: '按重量计价'}
       ],
       contractBookTypeList: [],
       sourceTypeList: [
@@ -738,19 +736,11 @@ export default {
         tel: '',
         name: ''
       },
-      options: {
-        cityData,
-        categoryData
-      },
       // 提交状态
       loading: false,
       // 是否是修改
       isUpdate: false,
 
-      // 组织机构树形结构数据
-      groupTreeData: [],
-      // 组织机构平铺数据
-      groupData: [],
       enterprisePage: [],
       create: false,
       businessId: ''
@@ -1080,7 +1070,7 @@ export default {
         categoryName: contractVO.categoryName || this.form.categoryName,
         contractStartDate: contractVO.contractStartDate || this.form.contractStartDate,
         contractEndDate: contractVO.contractEndDate || this.form.contractEndDate,
-        pricingWay:1,
+        pricingWay: 1,
 
       }
       this.form = contractVO;
@@ -1094,7 +1084,10 @@ export default {
         contractVO.type == '2' ? contractVO.partbId : contractVO.partaId
       );
     },
-
+    //切换计费方式重新算费用
+    changePricingWay() {
+      this.$refs.inventoryTable.getTotalPrice()
+    },
     salesmanChange(val, info) {
       this.otherForm.salesmanName = info.name;
     },
@@ -1157,8 +1150,7 @@ export default {
         if (!this.isUpdate) {
           delete this.form.id;
         }
-        let [totalPrice, discountTotalPrice] =
-          this.$refs.inventoryTable.getPrice();
+        let [totalPrice, discountTotalPrice] = this.$refs.inventoryTable.getPrice();
         this.form.totalPrice = totalPrice;
         this.form.discountTotalPrice = discountTotalPrice;
         if (this.form.categoryId) {
@@ -1226,10 +1218,20 @@ export default {
         this.$emit('done');
       });
     },
-    handInquiry() {
+    handInquiry(e) {
+      if (e.target.nodeName == "I") {
+        this.$set(this.form, 'sourceName', '');
+        this.$set(this.form, 'sourceId', '');
+        return
+      }
       this.$refs.inquiryListRef.open();
     },
-    handQuotation() {
+    handQuotation(e) {
+      if (e.target.nodeName == "I") {
+        this.$set(this.form, 'sourceName', '');
+        this.$set(this.form, 'sourceId', '');
+        return
+      }
       this.$refs.quotationListRef.open();
     },
 
@@ -1243,7 +1245,12 @@ export default {
       this.$set(this.form, 'contractName', base.simpleName);
     },
     //选择采购计划
-    handPlan() {
+    handPlan(e) {
+      if (e.target.nodeName == "I") {
+        this.$set(this.form, 'sourceName', '');
+        this.$set(this.form, 'sourceId', '');
+        return
+      }
       this.$refs.inquiryManageRef.open();
     },
     //选择采购计划回调
@@ -1268,7 +1275,7 @@ export default {
         productList: info.detailList || []
       }
       this.setValue(form);
-      await this.getLinkInfo(cusInfo.base.id)
+      // await this.getLinkInfo(cusInfo.base.id)
 
     },
     //获取计划详情
@@ -1281,7 +1288,12 @@ export default {
       return Promise.resolve(await contactDetail(id))
     },
     //选择商机
-    handOpportunity() {
+    handOpportunity(e) {
+      if (e.target.nodeName == "I") {
+        this.$set(this.form, 'sourceName', '');
+        this.$set(this.form, 'sourceId', '');
+        return
+      }
       this.opportunityDialogFlag = true
       this.$nextTick(() => {
         let item = {

+ 8 - 1
src/views/contractManage/contractBook/components/detailDialog.vue

@@ -41,7 +41,7 @@
               style="margin-bottom: 22px"
               v-if="form.sourceType == 2"
             >
-             {[form.sourceName}}
+             {{form.sourceName}}
             </el-form-item>
             <el-form-item
               label="报价单:"
@@ -104,6 +104,13 @@
             >
               {{ form.contractEndDate }}
             </el-form-item>
+            <el-form-item
+              label="计费方式:"
+              prop="payWay"
+              style="margin-bottom: 16px"
+            >
+              {{ form.pricingWay==1?'按数量计费':'按重量计费' }}
+            </el-form-item>
             <el-form-item
               label="结算方式:"
               prop="payWay"

+ 143 - 102
src/views/contractManage/contractBook/components/inventoryTable.vue

@@ -40,7 +40,7 @@
                 type="number"
                 :min="0"
                 :max="allPrice"
-                :disabled="!allPrice||pricingWay==2"
+                :disabled="!allPrice"
                 v-model="form.discountTotalPrice"
                 style="width: 180px"
                 placeholder="请输入"
@@ -121,7 +121,7 @@
             :disabled="isContractId"
             v-model="scope.row.totalCount"
             placeholder="请输入"
-            @input="getTotalPrice(scope.row)"
+            @input="changeCount(scope.row,scope.$index)"
           ></el-input>
         </el-form-item>
       </template>
@@ -131,6 +131,11 @@
       >
         <span class="is-required">{{ column.label }}</span>
       </template>
+      <template
+        v-slot:headerSingleWeight="{ column }"
+        v-if="pageName != 'businessOpportunity'">
+        <span :class="{'is-required':pricingWay==2}">{{ column.label }}</span>
+      </template>
       <template v-slot:totalPrice="scope">
         <el-form-item
           style="margin-bottom: 20px"
@@ -315,7 +320,7 @@
             :showLib="false"
             :limit="5"
           />
-          <div v-else v-if="scope.row.technicalDrawings && scope.row.technicalDrawings?.length">
+          <div v-else-if="scope.row.technicalDrawings && scope.row.technicalDrawings?.length">
             <el-link
               v-for="link in scope.row.technicalDrawings"
               :key="link.id"
@@ -341,7 +346,7 @@
             :showLib="false"
             :limit="5"
           />
-          <div v-else v-if="scope.row.customerReqFiles && scope.row.customerReqFiles?.length">
+          <div v-else-if="scope.row.customerReqFiles && scope.row.customerReqFiles?.length">
             <el-link
               v-for="link in scope.row.customerReqFiles"
               :key="link.id"
@@ -372,7 +377,7 @@
             :showLib="false"
             :limit="5"
           />
-          <div v-else v-if="scope.row.industryArtFiles && scope.row.industryArtFiles?.length">
+          <div v-else-if="scope.row.industryArtFiles && scope.row.industryArtFiles?.length">
             <el-link
               v-for="link in scope.row.industryArtFiles"
               :key="link.id"
@@ -398,7 +403,7 @@
             :showLib="false"
             :limit="5"
           />
-          <div v-else v-if="scope.row.otherFiles && scope.row.otherFiles?.length">
+          <div v-else-if="scope.row.otherFiles && scope.row.otherFiles?.length">
             <el-link
               v-for="link in scope.row.otherFiles"
               :key="link.id"
@@ -466,16 +471,16 @@
         <el-form-item
           style="margin-bottom: 20px"
           :rules="{
-            required: false,
+            required: pricingWay==2,
             pattern: numberReg,
-            trigger: 'change'
+            trigger: ['change','blur']
           }"
           :prop="'datasource.' + scope.$index + '.singleWeight'"
         >
           <el-input
             :disabled="isContractId"
             v-model="scope.row.singleWeight"
-            @input="singleWeightChange(scope.row)"
+            @input="singleWeightChange(scope.row,scope.$index)"
             placeholder="请输入"
           ></el-input>
         </el-form-item>
@@ -610,37 +615,43 @@ export default {
           prop: 'productName',
           label: '名称',
           slot: 'productName',
-          headerSlot: 'headerProductName'
+          headerSlot: 'headerProductName',
+          align: "center"
         },
         {
           width: 120,
           prop: 'productCode',
           label: '编码',
-          slot: 'productCode'
+          slot: 'productCode',
+          align: "center"
         },
         {
           width: 200,
           prop: 'productCategoryName',
           label: '类型',
-          slot: 'productCategoryName'
+          slot: 'productCategoryName',
+          align: "center"
         },
         {
           width: 160,
           prop: 'productBrand',
           label: '牌号',
-          slot: 'productBrand'
+          slot: 'productBrand',
+          align: "center"
         },
         {
           width: 120,
           prop: 'modelType',
           label: '型号',
-          slot: 'modelType'
+          slot: 'modelType',
+          align: "center"
         },
         {
           width: 120,
           prop: 'specification',
           label: '规格',
-          slot: 'specification'
+          slot: 'specification',
+          align: "center"
         },
         {
           width: 200,
@@ -648,62 +659,74 @@ export default {
           label: '客户代号',
           slot: 'customerMark',
           headerSlot: 'headerCustomerMark',
-          show: this.isCustomerMark
-        },
-        {
-          width: 160,
-          prop: 'singlePrice',
-          label: '单价',
-          slot: 'singlePrice',
-          headerSlot: 'headerSinglePrice'
-        },
-        {
-          width: 160,
-          prop: 'discountSinglePrice',
-          label: '折让单价',
+          show: this.isCustomerMark,
+          align: "center"
         },
         {
           width: 120,
           prop: 'totalCount',
           label: '数量',
           slot: 'totalCount',
-          headerSlot: 'headerTotalCount'
+          headerSlot: 'headerTotalCount',
+          align: "center"
         },
         {
           width: 120,
           prop: 'measuringUnit',
           label: '计量单位',
-          slot: 'measuringUnit'
-        },
-        {
-          width: 120,
-          prop: 'totalPrice',
-          label: '合计',
-          slot: 'totalPrice'
-        },
-        {
-          width: 160,
-          prop: 'discountTotalPrice',
-          label: '折让合计',
+          slot: 'measuringUnit',
+          align: "center"
         },
         {
           width: 120,
           prop: 'singleWeight',
           label: '单重',
-          slot: 'singleWeight'
+          slot: 'singleWeight',
+          headerSlot: 'headerSingleWeight',
+          align: "center"
         },
         {
           width: 120,
           prop: 'totalWeight',
           label: '总重',
-          slot: 'totalWeight'
+          slot: 'totalWeight',
+          align: "center"
         },
         {
           width: 120,
           prop: 'weightUnit',
           label: '重量单位',
-          slot: 'weightUnit'
+          slot: 'weightUnit',
+          align: "center"
         },
+        {
+          width: 160,
+          prop: 'singlePrice',
+          label: '单价',
+          slot: 'singlePrice',
+          headerSlot: 'headerSinglePrice',
+          align: "center"
+        },
+        {
+          width: 160,
+          prop: 'discountSinglePrice',
+          label: '折让单价',
+          align: "center",
+        },
+        {
+          width: 120,
+          prop: 'totalPrice',
+          label: '合计',
+          slot: 'totalPrice',
+          align: "center"
+        },
+        {
+          width: 160,
+          prop: 'discountTotalPrice',
+          label: '折让合计',
+          align: "center",
+        },
+
         // {
         //   width: 80,
         //   prop: 'deliveryDays',
@@ -722,28 +745,32 @@ export default {
           prop: 'customerExpectDeliveryDeadline',
           label: this.contractBookType == 1 ? '客户期望交期' : '交付日期',
           slot: 'customerExpectDeliveryDeadline',
-          headerSlot: 'headerCustomerExpectDeliveryDeadline'
+          headerSlot: 'headerCustomerExpectDeliveryDeadline',
+          align: "center"
         },
         {
           width: 160,
           prop: 'produceDeliveryDeadline',
           label: '生产交付交期',
           slot: 'produceDeliveryDeadline',
-          show: this.contractBookType == 1 ? true : false
+          show: this.contractBookType == 1 ? true : false,
+          align: "center"
         },
 
         {
           width: 200,
           prop: 'guaranteePeriod',
           label: '质保期',
-          slot: 'guaranteePeriod'
+          slot: 'guaranteePeriod',
+          align: "center"
         },
         {
           width: 200,
           prop: 'guaranteePeriodDeadline',
           label: '质保期截止日期',
           slot: 'guaranteePeriodDeadline',
-          show: this.isGuaranteePeriod
+          show: this.isGuaranteePeriod,
+          align: "center"
         },
         // {
         //   width: 120,
@@ -755,51 +782,59 @@ export default {
           width: 220,
           prop: 'customerReqFiles',
           label: '客户需求',
-          slot: 'customerReqFiles'
+          slot: 'customerReqFiles',
+          align: "center"
         },
         {
           width: 130,
           prop: 'technicalAnswerName',
           label: '技术答疑人',
-          slot: 'technicalAnswerName'
+          slot: 'technicalAnswerName',
+          align: "center"
         },
         {
           width: 220,
           prop: 'technicalParams',
           label: '技术参数',
-          slot: 'technicalParams'
+          slot: 'technicalParams',
+          align: "center"
         },
         {
           width: 240,
           prop: 'technicalDrawings',
           label: '技术图纸',
-          slot: 'technicalDrawings'
+          slot: 'technicalDrawings',
+          align: "center"
         },
         {
           width: 240,
           prop: 'technologyRouteName',
           label: '工艺路线',
           slot: 'technologyRouteName',
-          show: this.contractBookType == 1 ? true : false
+          show: this.contractBookType == 1 ? true : false,
+          align: "center"
 
         },
         {
           width: 240,
           prop: 'industryArtFiles',
           label: '工艺附件',
-          slot: 'industryArtFiles'
+          slot: 'industryArtFiles',
+          align: "center"
         },
         {
           width: 240,
           prop: 'otherFiles',
           label: '其他附件',
-          slot: 'otherFiles'
+          slot: 'otherFiles',
+          align: "center"
         },
         {
           width: 220,
           prop: 'remark',
           label: '备注',
-          slot: 'remark'
+          slot: 'remark',
+          align: "center"
         },
         {
           columnKey: 'action',
@@ -831,12 +866,7 @@ export default {
         }
       });
       this.$refs.table.reRenderTable();
-    },
-    pricingWay: {
-      handler() {
-        this.getTotalPrice()
-      }
-    },
+    }
   },
 
   methods: {
@@ -920,16 +950,8 @@ export default {
       let comitDatasource = this.form.datasource;
       if (comitDatasource.length === 0) return [];
       comitDatasource.forEach((v) => {
-        v.totalPrice =
-          (v.totalCount &&
-            v.singlePrice &&
-            (v.totalCount * v.singlePrice)?.toFixed(2)) ||
-          '';
         if (v.guaranteePeriodUnitCode) {
-          v.guaranteePeriodUnitName = this.getDictValue(
-            '保质期单位',
-            v.guaranteePeriodUnitCode
-          );
+          v.guaranteePeriodUnitName = this.getDictValue('保质期单位', v.guaranteePeriodUnitCode);
         }
         v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
         v.customerReqFiles = v.customerReqFiles || [];
@@ -941,22 +963,23 @@ export default {
     getPrice() {
       return [this.allPrice, this.form.discountTotalPrice];
     },
+    //改变数量
+    changeCount(row, index) {
+      this.singleWeightChange(row, index);
+      this.getTotalPrice()
+    },
     //计算总金额
     getTotalPrice(row) {
-      this.singleWeightChange(row);
       if (this.form.datasource.length) {
         let sum = 0;
-        if (this.pricingWay == 1) {
-          sum = this.getNumTotalPrice()
-        } else {
-          sum = this.getWeightTotalPrice()
-        }
+        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;
@@ -964,36 +987,36 @@ export default {
         this.$emit('orderDiscountAmount', 0)
         return 0.0;
       }
-
-
     },
-    //按数量计价计算总金额
+    //计算总金额
     getNumTotalPrice(sum = 0) {
-      this.form.datasource.forEach((r) => {
-        r.discountSinglePrice = Number(r.singlePrice)
-        this.$set(r, 'discountTotalPrice', Number(r.singlePrice))
+      this.form.datasource.forEach((r, index) => {
+        this.$set(r, 'discountSinglePrice', r.singlePrice ? Number(r.singlePrice) : '')
         if (r.singlePrice && r.totalCount) {
-          r.totalPrice = Number(r.singlePrice) * Number(r.totalCount);
-          this.$set(r, 'totalPrice', Number(r.totalPrice))
+          r.totalPrice = this.getAllPrice(r);
+          r.discountTotalPrice = this.getAllPrice(r);
+          this.$set(this.form.datasource[index], 'totalPrice', Number(r.totalPrice))
+          this.$set(this.form.datasource[index], 'discountTotalPrice', Number(r.discountTotalPrice))
           sum += Number(r.totalPrice);
-          r.discountTotalPrice = r.discountSinglePrice * r.totalCount
-          this.$set(r, 'discountTotalPrice', Number(r.discountTotalPrice))
+        } else {
+          this.$set(r, 'totalPrice', '')
+          this.$set(r, 'discountTotalPrice', '')
         }
       });
       return sum
     },
-    //按重量计价计算总金额
-    getWeightTotalPrice(sum = 0) {
-      this.form.datasource.forEach((r) => {
-        if (r.singlePrice) {
-          this.$set(r, 'discountTotalPrice', Number(r.singlePrice))
-          this.$set(r, 'discountSinglePrice', Number(r.singlePrice))
-          this.$set(r, 'totalPrice', Number(r.singlePrice))
-          sum += Number(r.totalPrice);
-        }
-      });
-      console.log(111111111);
-      return sum
+    getAllPrice(row) {
+      console.log(this.pricingWay, this.pricingWay == 1, this.pricingWay == 2);
+      let num = 0
+      switch (this.pricingWay) {
+        case 1: //按数量计价计算总金额
+          num = Number(row.singlePrice) * Number(row.totalCount)
+          break;
+        case 2 ://按重量计价计算总金额
+          num = Number(row.singlePrice) * Number(row.totalCount) * Number(row.singleWeight)
+          break;
+      }
+      return num
     },
     //更新优惠总金额
     discountInput(val) {
@@ -1016,15 +1039,27 @@ export default {
           return
         }
         //获取详情每条的小计
-        let totalPrice = item.totalCount * item.singlePrice
+        let totalPrice = this.getAllPrice(item)
         // 使用小计除以总价得出该条数据小计占比 在乘以差价或的该条数据应承担的差价 在小计-应承担差价获得折让后的小计
         item.discountTotalPrice = (totalPrice - totalPrice / this.allPrice * diffPrice).toFixed(2)
         //使用折让后的小计除以数量得到单价
-        item.discountSinglePrice = (item.discountTotalPrice / item.totalCount).toFixed(2)
+        item.discountSinglePrice = this.getDiscountSinglePrice(item)
       })
       this.$refs.table.reload()
       this.$store.commit('concact/setDiscountAmount', val);
     },
+    getDiscountSinglePrice(row) {
+      let num = 0
+      switch (this.pricingWay) {
+        case 1: //按数量优惠金额和总计
+          num = (Number(row.discountTotalPrice) / Number(row.totalCount)).toFixed(2)
+          break;
+        case 2 ://按重量优惠金额和总计
+          num = (Number(row.discountTotalPrice) / Number(row.totalCount) / Number(row.singleWeight)).toFixed(2)
+          break
+      }
+      return num
+    },
     //修改回显
     putTableValue(data) {
       let productList =
@@ -1086,9 +1121,15 @@ export default {
       }
     },
     //计算单重
-    singleWeightChange(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)
+      } else {
+        this.$set(this.form.datasource[index], 'totalWeight', '')
+      }
+      if (this.pricingWay == 2) {
+        this.getTotalPrice(row)
       }
     },
     //选择产品

+ 82 - 53
src/views/contractManage/contractBook/components/inventoryTabledetail.vue

@@ -119,70 +119,104 @@
             width: 200,
             prop: 'productName',
             label: '名称',
-            slot: 'productName'
+            slot: 'productName',
+            align: 'center'
           },
           {
             width: 120,
             prop: 'productCode',
             label: '编码',
-            slot: 'productCode'
+            slot: 'productCode',
+            align: 'center'
           },
           {
             width: 200,
             prop: 'productCategoryName',
             label: '类型',
-            slot: 'productCategoryName'
+            slot: 'productCategoryName',
+            align: 'center'
           },
           {
             width: 160,
             prop: 'productBrand',
             label: '牌号',
-            slot: 'productBrand'
+            slot: 'productBrand',
+            align: 'center'
           },
           {
             width: 120,
             prop: 'modelType',
             label: '型号',
-            slot: 'modelType'
+            slot: 'modelType',
+            align: 'center'
           },
           {
             width: 120,
             prop: 'specification',
             label: '规格',
-            slot: 'specification'
+            slot: 'specification',
+            align: 'center'
           },
           {
             width: 160,
             prop: 'customerMark',
             label: '客户代号',
             slot: 'customerMark',
-            show: this.isCustomerMark
+            show: this.isCustomerMark,
+            align: 'center'
           },
+          {
+            width: 120,
+            prop: 'totalCount',
+            label: '数量',
+            slot: 'totalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'measuringUnit',
+            label: '计量单位',
+            slot: 'measuringUnit',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'singleWeight',
+            label: '单重',
+            slot: 'singleWeight',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'totalWeight',
+            label: '总重',
+            slot: 'totalWeight',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'weightUnit',
+            label: '重量单位',
+            slot: 'weightUnit',
+            align: 'center'
+          },
+
           {
             width: 160,
             prop: 'singlePrice',
             label: '单价',
             slot: 'singlePrice',
-            show:this.isSinglePrice
+            show:this.isSinglePrice,
+            align: 'center'
           },
           {
             width: 160,
             prop: 'discountSinglePrice',
             label: '折让单价',
-            show:this.isSinglePrice
-          },
-          {
-            width: 120,
-            prop: 'totalCount',
-            label: '数量',
-            slot: 'totalCount'
-          },
-          {
-            width: 120,
-            prop: 'measuringUnit',
-            label: '计量单位',
-            slot: 'measuringUnit'
+            show:this.isSinglePrice,
+            align: 'center'
           },
+
           {
             width: 120,
             prop: 'totalPrice',
@@ -190,7 +224,8 @@
             slot: 'totalPrice',
             formatter: (_row, _column, cellValue) => {
               return _row.totalPrice?_row.totalPrice + '元':'';
-            }
+            },
+            align: 'center'
           },
           {
             width: 120,
@@ -199,27 +234,11 @@
             slot: 'discountTotalPrice',
             formatter: (_row, _column, cellValue) => {
               return _row.discountTotalPrice?_row.discountTotalPrice + '元':'';
-            }
+            },
+            align: 'center'
           },
 
-          {
-            width: 120,
-            prop: 'singleWeight',
-            label: '单重',
-            slot: 'singleWeight'
-          },
-          {
-            width: 120,
-            prop: 'totalWeight',
-            label: '总重',
-            slot: 'totalWeight'
-          },
-          {
-            width: 120,
-            prop: 'weightUnit',
-            label: '重量单位',
-            slot: 'weightUnit'
-          },
+
 
           // {
           //   width: 120,
@@ -238,14 +257,16 @@
             width: 160,
             prop: 'customerExpectDeliveryDeadline',
             label: this.contractBookType == 1 ? '客户期望交期' : '交付日期',
-            slot: 'customerExpectDeliveryDeadline'
+            slot: 'customerExpectDeliveryDeadline',
+            align: 'center'
           },
           {
             width: 160,
             prop: 'produceDeliveryDeadline',
             label: '生产交付交期',
             slot: 'produceDeliveryDeadline',
-            show: this.contractBookType == 1 ? true : false
+            show: this.contractBookType == 1 ? true : false,
+            align: 'center'
 
           },
           {
@@ -255,14 +276,16 @@
             slot: 'guaranteePeriod',
             formatter: (_row, _column, cellValue) => {
               return (_row.guaranteePeriod||'') + _row.guaranteePeriodUnitName;
-            }
+            },
+            align: 'center'
           },
           {
             width: 200,
             prop: 'guaranteePeriodDeadline',
             label: '质保期截止日期',
             slot: 'guaranteePeriodDeadline',
-            show: this.isGuaranteePeriod
+            show: this.isGuaranteePeriod,
+            align: 'center'
           },
           // {
           //   width: 120,
@@ -274,25 +297,29 @@
             width: 220,
             prop: 'customerReqFiles',
             label: '客户需求',
-            slot: 'customerReqFiles'
+            slot: 'customerReqFiles',
+            align: 'center'
           },
           {
             width: 120,
             prop: 'technicalAnswerName',
             label: '技术答疑人',
-            slot: 'technicalAnswerName'
+            slot: 'technicalAnswerName',
+            align: 'center'
           },
           {
             width: 220,
             prop: 'technicalParams',
             label: '技术参数',
-            slot: 'technicalParams'
+            slot: 'technicalParams',
+            align: 'center'
           },
           {
             width: 240,
             prop: 'technicalDrawings',
             label: '技术图纸',
-            slot: 'technicalDrawings'
+            slot: 'technicalDrawings',
+            align: 'center'
           },
           {
             width: 240,
@@ -306,19 +333,22 @@
             width: 240,
             prop: 'industryArtFiles',
             label: '工艺附件',
-            slot: 'industryArtFiles'
+            slot: 'industryArtFiles',
+            align: 'center'
           },
           {
             width: 240,
             prop: 'otherFiles',
             label: '其他附件',
-            slot: 'otherFiles'
+            slot: 'otherFiles',
+            align: 'center'
           },
           {
             width: 220,
             prop: 'remark',
             label: '备注',
-            slot: 'remark'
+            slot: 'remark',
+            align: 'center'
           }
         ],
         form: {},
@@ -330,7 +360,6 @@
     methods: {
       //修改回显
       putTableValue(data) {
-        console.log(data, 'data');
         let productList =
           (data && (data.redressProductList||data.quoteProductList || data.productList)) || [];
         if (data) {

+ 2 - 1
src/views/purchasingManage/purchaseNeedManage/components/inventoryTable.vue

@@ -399,7 +399,7 @@
             label: '单位',
             slot: 'measuringUnit'
           },
-       
+
           {
             width: 130,
             prop: 'brand',
@@ -523,6 +523,7 @@
         this.$set(this.form.datasource[idx], 'productCode', obj.code);
         this.$set(this.form.datasource[idx], 'productName', obj.name);
         this.$set(this.form.datasource[idx], 'modelType', obj.modelType);
+        this.$set(this.form.datasource[idx], 'weightUnit', obj.weightUnit);
         this.$set(
           this.form.datasource[idx],
           'measuringUnit',

+ 28 - 5
src/views/purchasingManage/purchaseOrder/components/addDialog.vue

@@ -70,7 +70,7 @@
             label="计价方式"
             prop="pricingWay"
             style="margin-bottom: 22px">
-            <el-radio-group v-model="form.pricingWay" :disabled="!!form.contractId">
+            <el-radio-group v-model="form.pricingWay" @change="changePricingWay" :disabled="!!form.contractId">
               <el-radio v-for="item in pricingWayList" :label="item.id">{{ item.name }}</el-radio>
             </el-radio-group>
           </el-form-item>
@@ -312,7 +312,7 @@
             prop="payAmount"
             style="margin-bottom: 22px"
           >
-            <el-input clearable v-model="form.payAmount" :disabled="!!form.contractId||form.pricingWay==2||!allcountAmount"
+            <el-input clearable v-model="form.payAmount" :disabled="!!form.contractId||!allcountAmount"
                       type="number"
                       @blur="discountInput"
                       placeholder="请输入">
@@ -400,6 +400,7 @@ import contractListDialog from '@/views/saleManage/saleOrder/components/contract
 import {listOrganizations} from '@/api/system/organization';
 import {copyObj} from '@/utils/util';
 import inquiryManageList from "@/views/purchasingManage/inquiryManage/components/inquiryManage-list.vue";
+import {getplanDetail} from "@/api/purchasingManage/purchasePlanManage";
 
 export default {
   mixins: [dictMixins],
@@ -470,7 +471,7 @@ export default {
       activeName: 'base',
       pricingWayList: [
         {id: 1, name: '按数量计价'},
-        {id: 2, name: '按增重计价'}
+        {id: 2, name: '按重量计价'}
       ],
       formDef,
       form: copyObj(formDef),
@@ -569,16 +570,37 @@ export default {
 
       this.getrequireUser(id);
     },
+    //切换计费方式重新算费用
+    changePricingWay(){
+      this.$refs.inventoryTable.getTotalPrice()
+    },
     //选择采购计划
     handPurchasePlan() {
       this.$refs.inquiryManageRef.open(this.form.planCode);
     },
 //选择采购计划回调
-    changeInquiryManageList(data) {
+   async changeInquiryManageList(data) {
       this.form.purchasePlanId = data.id;
       this.form.purchasePlanNo = data.planCode;
       this.form.purchasePlanName = data.planName;
 
+
+      let info = await getplanDetail(data.id)
+      let cusInfo = {}
+      this.$set(this.form, 'purchasePlanName', data.planName);
+      this.$set(this.form, 'purchasePlanId', data.id);
+      this.$set(this.form, 'purchasePlanNo', data.planCode);
+      let form = {
+        contractVO: {
+          ...this.form
+        },
+        productList: info.detailList || []
+      }
+
+     this.$refs.inventoryTable &&
+     this.$refs.inventoryTable.putTableValue(form.productList);
+      await this.getLinkInfo(cusInfo.base.id)
+
     },
     // //选择需求来源类型
     // chaengSource(data) {
@@ -685,7 +707,8 @@ export default {
             pricingWay,
             totalAmount: totalPrice,
             payAmount: discountTotalPrice,
-            receiveAddress: partaAddress
+            receiveAddress: partaAddress,
+
           });
           this.getLinkInfo(partaId);
 

+ 71 - 25
src/views/purchasingManage/purchaseOrder/components/detailDialog.vue

@@ -368,7 +368,8 @@
             width: 200,
             prop: 'moneyName',
             label: '款项名称',
-            slot: 'moneyName'
+            slot: 'moneyName',
+            align: "center"
           },
           {
             width: 100,
@@ -377,7 +378,8 @@
             slot: 'price',
             formatter: (_row, _column, cellValue) => {
               return _row.price + '元';
-            }
+            },
+            align: "center"
           },
           {
             width: 100,
@@ -386,18 +388,21 @@
             slot: 'ratio',
             formatter: (_row, _column, cellValue) => {
               return _row.ratio + '%';
-            }
+            },
+            align: "center"
           },
           {
             width: 160,
             prop: 'deadLine',
             label: '截止日期',
-            slot: 'deadLine'
+            slot: 'deadLine',
+            align: "center"
           },
           {
             prop: 'remark',
             label: '	说明',
-            slot: 'remark'
+            slot: 'remark',
+            align: "center"
           }
         ],
         competAnalysisListcolumns: [
@@ -412,68 +417,100 @@
             width: 200,
             prop: 'productName',
             label: '名称',
-            slot: 'productName'
+            slot: 'productName',
+            align: "center"
           },
           {
             width: 120,
             prop: 'productCode',
             label: '编码',
-            slot: 'productCode'
+            slot: 'productCode',
+            align: "center"
           },
           {
             width: 200,
             prop: 'productCategoryName',
             label: '类型',
-            slot: 'productCategoryName'
+            slot: 'productCategoryName',
+            align: "center"
           },
           {
             width: 160,
             prop: 'productBrand',
             label: '牌号',
-            slot: 'productBrand'
+            slot: 'productBrand',
+            align: "center"
           },
           {
             width: 120,
             prop: 'modelType',
             label: '型号',
-            slot: 'modelType'
+            slot: 'modelType',
+            align: "center"
           },
           {
             width: 120,
             prop: 'supplierMark',
             label: '供应商代号',
-            slot: 'supplierMark'
+            slot: 'supplierMark',
+            align: "center"
           },
           {
             width: 120,
             prop: 'specification',
             label: '规格',
-            slot: 'specification'
+            slot: 'specification',
+            align: "center"
           },
 
           {
             width: 120,
             prop: 'totalCount',
             label: '数量',
-            slot: 'totalCount'
+            slot: 'totalCount',
+            align: "center"
           },
           {
             width: 120,
             prop: 'measuringUnit',
             label: '计量单位',
-            slot: 'measuringUnit'
+            slot: 'measuringUnit',
+            align: "center"
+          },
+          {
+            width: 120,
+            prop: 'singleWeight',
+            label: '单重',
+            slot: 'singleWeight',
+            align: "center"
+          },
+          {
+            width: 120,
+            prop: 'totalWeight',
+            label: '总重',
+            slot: 'totalWeight',
+            align: "center"
+          },
+          {
+            width: 120,
+            prop: 'weightUnit',
+            label: '重量单位',
+            slot: 'weightUnit',
+            align: "center"
           },
           {
             width: 160,
             prop: 'singlePrice',
             label: '单价',
-            slot: 'singlePrice'
+            slot: 'singlePrice',
+            align: "center"
           },
           {
             width: 160,
             prop: 'discountSinglePrice',
             label: '折后单价',
-            slot: 'discountSinglePrice'
+            slot: 'discountSinglePrice',
+            align: "center"
           },
           {
             width: 120,
@@ -482,7 +519,8 @@
             slot: 'totalPrice',
             formatter: (_row, _column, cellValue) => {
               return _row.totalPrice + '元';
-            }
+            },
+            align: "center"
           },
           {
             width: 120,
@@ -491,7 +529,8 @@
             slot: 'discountTotalPrice',
             formatter: (_row, _column, cellValue) => {
               return _row.discountTotalPrice + '元';
-            }
+            },
+            align: "center"
           },
 
           {
@@ -504,7 +543,8 @@
             width: 160,
             prop: 'deliveryDeadline',
             label: '交期截止日期',
-            slot: 'deliveryDeadline'
+            slot: 'deliveryDeadline',
+            align: "center"
           },
           {
             width: 200,
@@ -513,25 +553,29 @@
             slot: 'guaranteePeriod',
             formatter: (_row, _column, cellValue) => {
               return (_row.guaranteePeriod||'') + _row.guaranteePeriodUnitName;
-            }
+            },
+            align: "center"
           },
           {
             width: 160,
             prop: 'guaranteePeriodDeadline',
             label: '质保截止日期',
-            slot: 'guaranteePeriodDeadline'
+            slot: 'guaranteePeriodDeadline',
+            align: "center"
           },
           {
             width: 120,
             prop: 'technicalAnswerName',
             label: '技术答疑人',
-            slot: 'technicalAnswerName'
+            slot: 'technicalAnswerName',
+            align: "center"
           },
           {
             width: 220,
             prop: 'technicalParams',
             label: '技术参数',
-            slot: 'technicalParams'
+            slot: 'technicalParams',
+            align: "center"
           },
           {
             width: 240,
@@ -540,13 +584,15 @@
             slot: 'technicalDrawings',
             formatter: (_row, _column, cellValue) => {
               return (_row.guaranteePeriod||'') + _row.guaranteePeriodUnitName;
-            }
+            },
+            align: "center"
           },
           {
             width: 220,
             prop: 'remark',
             label: '备注',
-            slot: 'remark'
+            slot: 'remark',
+            align: "center"
           }
         ]
       };

+ 106 - 76
src/views/purchasingManage/purchaseOrder/components/inventoryTable.vue

@@ -77,7 +77,7 @@
               :disabled="isContractId"
               v-model="scope.row.totalCount"
               placeholder="请输入"
-              @input="getTotalPrice"
+              @input="changeCount(scope.row,scope.$index)"
             ></el-input>
           </el-form-item>
         </template>
@@ -231,7 +231,7 @@
             <el-input
               :disabled="isContractId"
               v-model="scope.row.singleWeight"
-              @input="singleWeightChange(scope.row)"
+              @input="singleWeightChange(scope.row,scope.$index)"
               placeholder="请输入"
             ></el-input>
           </el-form-item>
@@ -402,13 +402,7 @@ export default {
       return this.$store.state.order.contractId;
     }
   },
-  watch: {
-    pricingWay: {
-      handler() {
-        this.getTotalPrice()
-      }
-    },
-  },
+
   data() {
     const defaultForm = {
       key: null,
@@ -443,44 +437,51 @@ export default {
           prop: 'productName',
           label: '名称',
           slot: 'productName',
-          headerSlot: 'headerProductName'
+          headerSlot: 'headerProductName',
+          align: "center"
         },
         {
           width: 120,
           prop: 'productCode',
           label: '编码',
-          slot: 'productCode'
+          slot: 'productCode',
+          align: "center"
         },
         {
           width: 200,
           prop: 'productCategoryName',
           label: '类型',
-          slot: 'productCategoryName'
+          slot: 'productCategoryName',
+          align: "center"
         },
         {
           width: 160,
           prop: 'productBrand',
           label: '牌号',
-          slot: 'productBrand'
+          slot: 'productBrand',
+          align: "center"
         },
         {
           width: 120,
           prop: 'modelType',
           label: '型号',
-          slot: 'modelType'
+          slot: 'modelType',
+          align: "center"
         },
         {
           width: 120,
           prop: 'supplierMark',
           label: '供应商代号',
           // headerSlot: 'headerSupplierMark',
-          slot: 'supplierMark'
+          slot: 'supplierMark',
+          align: "center"
         },
         {
           width: 120,
           prop: 'specification',
           label: '规格',
-          slot: 'specification'
+          slot: 'specification',
+          align: "center"
         },
 
         {
@@ -488,59 +489,68 @@ export default {
           prop: 'totalCount',
           label: '数量',
           slot: 'totalCount',
-          headerSlot: 'headerTotalCount'
+          headerSlot: 'headerTotalCount',
+          align: "center"
 
         },
         {
           width: 80,
           prop: 'measuringUnit',
           label: '计量单位',
-          slot: 'measuringUnit'
-        },
-        {
-          width: 160,
-          prop: 'singlePrice',
-          label: '单价',
-          slot: 'singlePrice',
-          headerSlot: 'headerSinglePrice'
-
-        },
-        {
-          width: 160,
-          prop: 'discountSinglePrice',
-          label: '折后单价',
-          slot: 'discountSinglePrice',
-
+          slot: 'measuringUnit',
+          align: "center"
         },
         {
           width: 120,
           prop: 'singleWeight',
           label: '单重',
-          slot: 'singleWeight'
+          slot: 'singleWeight',
+          align: "center"
         },
         {
           width: 120,
           prop: 'totalWeight',
           label: '总重',
-          slot: 'totalWeight'
+          slot: 'totalWeight',
+          align: "center"
         },
         {
           width: 120,
           prop: 'weightUnit',
           label: '重量单位',
-          slot: 'weightUnit'
+          slot: 'weightUnit',
+          align: "center"
         },
+        {
+          width: 160,
+          prop: 'singlePrice',
+          label: '单价',
+          slot: 'singlePrice',
+          headerSlot: 'headerSinglePrice',
+          align: "center"
+        },
+        {
+          width: 160,
+          prop: 'discountSinglePrice',
+          label: '折后单价',
+          slot: 'discountSinglePrice',
+          align: "center",
+
+        },
+
         {
           width: 120,
           prop: 'totalPrice',
           label: '合计',
-          slot: 'totalPrice'
+          slot: 'totalPrice',
+          align: "center"
         },
         {
           width: 120,
           prop: 'discountTotalPrice',
           label: '折后合计',
-          slot: 'discountTotalPrice'
+          slot: 'discountTotalPrice',
+          align: "center"
         },
         // {
         //   width: 80,
@@ -553,19 +563,22 @@ export default {
           prop: 'deliveryDeadline',
           label: '交期截止日期',
           slot: 'deliveryDeadline',
-          headerSlot: 'headerDeadline'
+          align: "center",
+          // headerSlot: 'headerDeadline'
         },
         {
           width: 200,
           prop: 'guaranteePeriod',
           label: '质保期',
-          slot: 'guaranteePeriod'
+          slot: 'guaranteePeriod',
+          align: "center"
         },
         {
           width: 160,
           prop: 'guaranteePeriodDeadline',
           label: '	质保截止日期',
-          slot: 'guaranteePeriodDeadline'
+          slot: 'guaranteePeriodDeadline',
+          align: "center"
         },
         // {
         //   width: 120,
@@ -577,25 +590,29 @@ export default {
           width: 130,
           prop: 'technicalAnswerName',
           label: '技术答疑人',
-          slot: 'technicalAnswerName'
+          slot: 'technicalAnswerName',
+          align: "center"
         },
         {
           width: 220,
           prop: 'technicalParams',
           label: '技术参数',
-          slot: 'technicalParams'
+          slot: 'technicalParams',
+          align: "center"
         },
         {
           width: 240,
           prop: 'technicalDrawings',
           label: '技术图纸',
-          slot: 'technicalDrawings'
+          slot: 'technicalDrawings',
+          align: "center"
         },
         {
           width: 220,
           prop: 'remark',
           label: '备注',
-          slot: 'remark'
+          slot: 'remark',
+          align: "center"
         },
         {
           columnKey: 'action',
@@ -634,22 +651,23 @@ export default {
     getPrice() {
       return [this.allPrice];
     },
+    //改变数量
+    changeCount(row, index) {
+      this.singleWeightChange(row, index);
+      this.getTotalPrice()
+    },
     //计算总金额
-    getTotalPrice(row) {
-      this.singleWeightChange(row);
+    getTotalPrice() {
       if (this.form.datasource.length) {
         let sum = 0;
-        if (this.pricingWay == 1) {
-          sum = this.getNumTotalPrice()
-        } else {
-          sum = this.getWeightTotalPrice()
-        }
+        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;
@@ -657,45 +675,47 @@ export default {
         this.$emit('orderDiscountAmount', 0)
         return 0.0;
       }
-
-
     },
-    //按数量计价计算总金额
+    //计算总金额
     getNumTotalPrice(sum = 0) {
       this.form.datasource.forEach((r) => {
-        r.discountSinglePrice = Number(r.singlePrice) || undefined
-        this.$set(r, 'discountTotalPrice', Number(r.singlePrice))
+        this.$set(r, 'discountSinglePrice', r.singlePrice ? Number(r.singlePrice) : '')
         if (r.singlePrice && r.totalCount) {
-          r.totalPrice = Number(r.singlePrice) * Number(r.totalCount);
+          r.discountTotalPrice = r.totalPrice = this.getAllPrice(r);
           this.$set(r, 'totalPrice', Number(r.totalPrice))
-          sum += Number(r.totalPrice);
-          r.discountTotalPrice = r.discountSinglePrice * r.totalCount
           this.$set(r, 'discountTotalPrice', Number(r.discountTotalPrice))
-        }
-      });
-      return sum
-    },
-    //按重量计价计算总金额
-    getWeightTotalPrice(sum = 0) {
-      this.form.datasource.forEach((r) => {
-        if (r.singlePrice) {
-          this.$set(r, 'discountTotalPrice', Number(r.singlePrice))
-          this.$set(r, 'discountSinglePrice', Number(r.singlePrice))
-          this.$set(r, 'totalPrice', Number(r.singlePrice))
           sum += Number(r.totalPrice);
+        } else {
+          this.$set(r, 'totalPrice', '')
+          this.$set(r, 'discountTotalPrice', '')
         }
       });
       return sum
     },
+    getAllPrice(row) {
+      let num = 0
+      switch (this.pricingWay) {
+        case 1: //按数量计价计算总金额
+          num = Number(row.singlePrice) * Number(row.totalCount)
+          break;
+        case 2 ://按重量计价计算总金额
+          num = Number(row.singlePrice) * Number(row.totalCount) * Number(row.singleWeight)
+      }
+      return num
+    },
+
     //计算单重
-    singleWeightChange(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 (this.pricingWay == 2) {
+        this.getTotalPrice(row)
       }
     },
     //设置优惠总金额修改产品单价
     discountInputByOrder(val) {
-      console.log(this.allPrice,val,this.form.datasource);
       //获取优惠金额和总计的差价
       let diffPrice = this.allPrice - val
       this.form.datasource.forEach((item) => {
@@ -710,19 +730,29 @@ export default {
           return
         }
         //获取详情每条的小计
-        let totalPrice = item.totalCount * item.singlePrice
+        let totalPrice = this.getAllPrice(item)
         // 使用小计除以总价得出该条数据小计占比 在乘以差价或的该条数据应承担的差价 在小计-应承担差价获得折让后的小计
         item.discountTotalPrice = (totalPrice - totalPrice / this.allPrice * diffPrice).toFixed(2)
         //使用折让后的小计除以数量得到单价
-        item.discountSinglePrice = (item.discountTotalPrice / item.totalCount).toFixed(2)
+        item.discountSinglePrice = this.getDiscountSinglePrice(item)
       })
       this.$refs.table.reload()
       this.$store.commit('concact/setDiscountAmount', val);
     },
+    getDiscountSinglePrice(row) {
+      let num = 0
+      switch (this.pricingWay) {
+        case 1: //按数量优惠金额和总计
+          num = (row.discountTotalPrice / row.totalCount).toFixed(2)
+          break;
+        case 2 ://按重量优惠金额和总计
+          num = (row.discountTotalPrice / row.totalCount / row.singleWeight).toFixed(2)
+      }
+      return num
+    },
 
     //修改回显
     putTableValue(data, contractStartDate) {
-      console.log(data);
       if (contractStartDate) {
         this.contractStartDate = contractStartDate;
       }

+ 3 - 1
src/views/purchasingManage/purchaseOrder/invoice/components/addInvoiceDialog.vue

@@ -273,7 +273,8 @@ export default {
             partbLinkName,
             productList,
             sourceTypeName,
-            sourceType
+            sourceType,
+            pricingWay,
           } = data;
           if (productList && productList.length > 0) {
             productList.forEach((v) => {
@@ -290,6 +291,7 @@ export default {
             sourceTypeName,
             sourceType,
             productList,
+            pricingWay,
           });
           this.$refs.inventoryTableref &&
           this.$refs.inventoryTableref.putTableValue(productList);

+ 84 - 39
src/views/purchasingManage/purchaseOrder/invoice/components/detailDialog.vue

@@ -109,6 +109,10 @@
             <el-form-item prop="outsourceSendCode" label="委外发货单编码:">
               {{ form.outsourceSendCode }}
             </el-form-item>
+            <el-form-item prop="pricingWay" label="计费方式:">
+              {{ form.pricingWay==1?'按数量计费':'按重量计费' }}
+            </el-form-item>
+
             <el-form-item
               label="制单人:"
               prop="makerName"
@@ -214,85 +218,78 @@
             width: 200,
             prop: 'productName',
             label: '名称',
-            slot: 'productName'
+            slot: 'productName',
+            align: "center"
           },
           {
             width: 120,
             prop: 'productCode',
             label: '编码',
-            slot: 'productCode'
+            slot: 'productCode',
+            align: "center"
           },
           {
             width: 200,
             prop: 'productCategoryName',
             label: '类型',
-            slot: 'productCategoryName'
+            slot: 'productCategoryName',
+            align: "center"
           },
           {
             width: 160,
             prop: 'productBrand',
             label: '牌号',
-            slot: 'productBrand'
+            slot: 'productBrand',
+            align: "center"
           },
           {
             width: 120,
             prop: 'modelType',
             label: '型号',
-            slot: 'modelType'
+            slot: 'modelType',
+            align: "center"
           },
           {
             width: 120,
             prop: 'specification',
             label: '规格',
-            slot: 'specification'
+            slot: 'specification',
+            align: "center"
           },
           {
             width: 200,
             prop: 'warehouseName',
             label: '仓库名称',
-            slot: 'warehouseName'
+            slot: 'warehouseName',
+            align: "center"
           },
           {
             width: 80,
             prop: 'totalCount',
             label: '进货数量',
-            slot: 'totalCount'
+            slot: 'totalCount',
+            align: "center"
           },
           {
             width: 120,
             prop: 'orderTotalCount',
             label: '总数量',
-            slot: 'orderTotalCount'
+            slot: 'orderTotalCount',
+            align: "center"
           },
           {
             width: 80,
             prop: 'measuringUnit',
             label: '计量单位',
-            slot: 'measuringUnit'
-          },
-          {
-            width: 160,
-            prop: 'singlePrice',
-            label: '单价',
-            slot: 'singlePrice'
-          },
-          {
-            width: 160,
-            prop: 'discountSinglePrice',
-            label: '折后单价',
-            slot: 'discountSinglePrice'
+            slot: 'measuringUnit',
+            align: "center"
           },
           {
             width: 120,
-            prop: 'totalPrice',
-            label: '合计',
-            slot: 'totalPrice'
-          },
-          {
-            width: 160,
-            prop: 'discountTotalPrice',
-            label: '折后合计',
-            slot: 'discountTotalPrice'
+            prop: 'singleWeight',
+            label: '单重',
+            slot: 'singleWeight',
+            align: "center"
           },
           {
             width: 200,
@@ -316,55 +313,99 @@
             slot: 'increaseTotalWeight',
             align: "center"
           },
+          {
+            width: 100,
+            prop: 'weightUnit',
+            label: '重量单位',
+            slot: 'weightUnit',
+            align: "center"
+          },
+          {
+            width: 160,
+            prop: 'singlePrice',
+            label: '单价',
+            slot: 'singlePrice',
+            align: "center"
+          },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折后单价',
+            slot: 'discountSinglePrice',
+            align: "center"
+          },
+          {
+            width: 120,
+            prop: 'totalPrice',
+            label: '合计',
+            slot: 'totalPrice',
+            align: "center"
+          },
+          {
+            width: 160,
+            prop: 'discountTotalPrice',
+            label: '折后合计',
+            slot: 'discountTotalPrice',
+            align: "center"
+          },
+
 
 
           {
             width: 80,
             prop: 'deliveryDays',
             label: '交期(天)',
-            slot: 'deliveryDays'
+            slot: 'deliveryDays',
+            align: "center"
           },
           {
             width: 160,
             prop: 'deliveryDeadline',
             label: '交期截止日期',
-            slot: 'deliveryDeadline'
+            slot: 'deliveryDeadline',
+            align: "center"
           },
           {
             width: 200,
             prop: 'guaranteePeriod',
             label: '质保期',
-            slot: 'guaranteePeriod'
+            slot: 'guaranteePeriod',
+            align: "center"
           },
           {
             width: 160,
             prop: 'guaranteePeriodDeadline',
             label: '质保截止日期',
-            slot: 'guaranteePeriodDeadline'
+            slot: 'guaranteePeriodDeadline',
+            align: "center"
           },
           {
             width: 130,
             prop: 'technicalAnswerName',
             label: '技术答疑人',
-            slot: 'technicalAnswerName'
+            slot: 'technicalAnswerName',
+            align: "center"
           },
           {
             width: 220,
             prop: 'technicalParams',
             label: '技术参数',
-            slot: 'technicalParams'
+            slot: 'technicalParams',
+            align: "center"
           },
           {
             width: 240,
             prop: 'technicalDrawings',
             label: '技术图纸',
-            slot: 'technicalDrawings'
+            slot: 'technicalDrawings',
+            align: "center"
           },
           {
             width: 220,
             prop: 'remark',
             label: '备注',
-            slot: 'remark'
+            slot: 'remark',
+            align: "center"
           }
         ]
       };
@@ -397,6 +438,10 @@
         if (data) {
           this.form = data;
           this.detailData = data;
+          this.detailData.productList.forEach(item => {
+            item.receiveTotalWeight = item.receiveTotalWeight || (Number(item.orderTotalCount) * Number(item.singleWeight)) || 0
+            item.increaseTotalWeight = item.increaseTotalWeight || item.receiveTotalWeight || 0
+          })
         }
       }
     }

+ 92 - 45
src/views/purchasingManage/purchaseOrder/invoice/components/inventoryTable.vue

@@ -78,13 +78,14 @@
             { required: [2,3].includes(Number(sourceType))&&pricingWay==2, message: '请输入数字', trigger: 'blur' }
           ]"
         >
-          <el-input v-model="scope.row.sendTotalWeight" style="width: 60%; margin-right: 10px">
+          <el-input v-model="scope.row.sendTotalWeight" :disabled="!outsourceSendCode" @blur="changeSendTotalWeight(scope.$index)"
+                    style="width: 60%; margin-right: 10px">
 
           </el-input>
           <el-button
             size="small"
             type="primary"
-            v-if="[2,3].includes(Number(sourceType))&&pricingWay==2"
+            v-if="[2,3].includes(Number(sourceType))&&outsourceSendCode"
             @click.native="(e)=>handleOutBound(e,scope.row,scope.$index)"
           >选择
           </el-button
@@ -289,6 +290,42 @@ export default {
           slot: 'measuringUnit',
           align: 'center'
         },
+        {
+          width: 120,
+          prop: 'singleWeight',
+          label: '单重',
+          slot: 'singleWeight',
+          align: "center"
+        },
+        {
+          width: 200,
+          prop: 'sendTotalWeight',
+          label: '发货总重',
+          slot: 'sendTotalWeight',
+          align: "center",
+          headerSlot: 'headerTotalCount'
+        },
+        {
+          width: 100,
+          prop: 'receiveTotalWeight',
+          label: '收货总重',
+          slot: 'receiveTotalWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'increaseTotalWeight',
+          label: '增重重量',
+          slot: 'increaseTotalWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'weightUnit',
+          label: '重量单位',
+          slot: 'weightUnit',
+          align: "center"
+        },
         {
           width: 160,
           prop: 'singlePrice',
@@ -317,28 +354,6 @@ export default {
           slot: 'discountTotalPrice',
           align: 'center'
         },
-        {
-          width: 200,
-          prop: 'sendTotalWeight',
-          label: '发货总重',
-          slot: 'sendTotalWeight',
-          align: "center",
-          headerSlot: 'headerTotalCount'
-        },
-        {
-          width: 100,
-          prop: 'receiveTotalWeight',
-          label: '收货总重',
-          slot: 'receiveTotalWeight',
-          align: "center"
-        },
-        {
-          width: 100,
-          prop: 'increaseTotalWeight',
-          label: '增重重量',
-          slot: 'increaseTotalWeight',
-          align: "center"
-        },
         {
           width: 80,
           prop: 'deliveryDays',
@@ -439,8 +454,13 @@ export default {
       this.$set(this.form.datasource[index], 'warehouseName', data.name);
       this.$set(this.form.datasource[index], 'warehouseCode', data.code);
     },
+    //修改发货总重
+    changeSendTotalWeight(index) {
+      this.curIndex = index
+      this.setIcreaseTotalWeight()
+    },
     //出库单详情
-    handleOutBound(e, rows,index) {
+    handleOutBound(e, rows, index) {
       this.curIndex = index
       this.outboundDetailsDialogFlag = true
       this.$nextTick(() => {
@@ -457,31 +477,47 @@ export default {
         num += Number(row.weight)
         return num
       }, 0)
-      console.log(totalWeight,this.curIndex);
       this.$set(this.form.datasource[this.curIndex], 'sendTotalWeight', totalWeight);
+      this.$set(this.form.datasource[this.curIndex], 'increaseTotalWeight', Number(this.form.datasource[this.curIndex].receiveTotalWeight)-Number(this.form.datasource[this.curIndex].sendTotalWeight));
     },
     //修改数量更新合计/总重
     changeNum(val, index) {
+      this.curIndex = index
       if (this.pricingWay == 2) {
         if (val != this.form.datasource[index].orderTotalCount) {
           this.$set(this.form.datasource[index], 'sendTotalWeight', '')
+          this.$set(this.form.datasource[index], 'receiveTotalWeight', Number(val) * Number(this.form.datasource[index].singleWeight));
         } else {
-          let find = this.oldSendTotalWeightList.find(key => key.id == this.form.datasource[index].id) || {}
-          this.$set(this.form.datasource[index], 'sendTotalWeight', find.oldSendTotalWeight)
+          let find = this.oldSendTotalWeightList.find(key => key.productCode == this.form.datasource[index].productCode) || {}
+          this.$set(this.form.datasource[index], 'sendTotalWeight', find.oldSendTotalWeight||'')
+          this.$set(this.form.datasource[index], 'receiveTotalWeight', Number(val) * Number(this.form.datasource[index].singleWeight));
         }
+        this.setIcreaseTotalWeight()
+        this.getWeightPrice()
       } else {
-        this.$set(
-          this.form.datasource[index],
-          'totalPrice',
-          (Number(this.form.datasource[index].singlePrice) * val).toFixed(2)
-        );
-        this.$set(
-          this.form.datasource[index],
-          'discountTotalPrice',
-          (Number(this.form.datasource[index].discountSinglePrice) * val).toFixed(2)
-        );
+        this.$set(this.form.datasource[index], 'totalPrice', (Number(this.form.datasource[index].singlePrice) * val).toFixed(2));
+        this.$set(this.form.datasource[index], 'discountTotalPrice', (Number(this.form.datasource[index].discountSinglePrice) * val).toFixed(2));
+        this.$set(this.form.datasource[index], 'receiveTotalWeight', Number(this.form.datasource[index].totalCount) * Number(this.form.datasource[index].singleWeight));
+        this.$set(this.form.datasource[index], 'increaseTotalWeight', Number(this.form.datasource[index].totalCount) * Number(this.form.datasource[index].singleWeight));
       }
     },
+    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() {
+      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', (receiveTotalWeight - sendTotalWeight).toFixed(2));
+      if (this.pricingWay == 2) {
+        this.getWeightPrice()
+      }
+      this.$refs.table.reload()
+    },
     //选择产品回调
     changeParent(obj, idx) {
       obj.orderTotalCount = obj.orderTotalCount || obj.totalCount;
@@ -512,7 +548,6 @@ export default {
         .forEach((item) => {
           num += Number(item.totalCount);
         });
-      console.log(num);
       return num;
     },
     // 返回列表数据
@@ -533,13 +568,25 @@ export default {
 
     //修改回显
     async putTableValue(data = [], code) {
-      this.form.datasource = data;
-      this.oldSendTotalWeightList = this.form.datasource.map(item => {
-        return {
-          id: item.id,
-          oldSendTotalWeight: item.sendTotalWeight
-        }
+      this.$nextTick(()=>{
+        this.form.datasource = data;
+        this.oldSendTotalWeightList = this.form.datasource.map(item => {
+          return {
+            productCode: item.productCode,
+            oldSendTotalWeight: item.sendTotalWeight
+          }
+        })
+        this.form.datasource.forEach(item => {
+          item.receiveTotalWeight = item.receiveTotalWeight || (Number(item.totalCount) * Number(item.singleWeight)) || 0
+          if(this.outsourceSendCode){
+            item.increaseTotalWeight =  Number(item.receiveTotalWeight)-Number(item.sendTotalWeight)
+          }else {
+            item.increaseTotalWeight = item.increaseTotalWeight || item.receiveTotalWeight || 0
+          }
+
+        })
       })
+
     },
 
     remove(i) {

+ 21 - 7
src/views/purchasingManage/purchaseOrder/outSourceSend/components/detailDialog.vue

@@ -278,6 +278,27 @@ export default {
           slot: 'measuringUnit',
           align: "center"
         },
+        {
+          width: 120,
+          prop: 'singleWeight',
+          label: '单重',
+          slot: 'singleWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'sendTotalWeight',
+          label: '发货总重',
+          slot: 'sendTotalWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'weightUnit',
+          label: '重量单位',
+          slot: 'weightUnit',
+          align: "center"
+        },
         {
           width: 160,
           prop: 'singlePrice',
@@ -310,13 +331,6 @@ export default {
           slot: 'discountTotalPrice',
           align: "center"
         },
-        {
-          width: 100,
-          prop: 'sendTotalWeight',
-          label: '发货总重',
-          slot: 'sendTotalWeight',
-          align: "center"
-        },
         {
           width: 120,
           prop: 'deliveryDays',

+ 51 - 44
src/views/purchasingManage/purchaseOrder/outSourceSend/components/inventoryTable.vue

@@ -125,7 +125,7 @@
           <!--           { validator: validateTotalCount(scope.row), trigger: 'blur' }-->
           <el-input
             v-model="scope.row.totalCount"
-            @input="(val) => changeNum(val, scope.$index)"
+            @input="(val) => changeNum(val,scope.row, scope.$index)"
           ></el-input>
         </el-form-item>
       </template>
@@ -324,6 +324,27 @@ export default {
           slot: 'measuringUnit',
           align: "center"
         },
+        {
+          width: 120,
+          prop: 'singleWeight',
+          label: '单重',
+          slot: 'singleWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'sendTotalWeight',
+          label: '发货总重',
+          slot: 'sendTotalWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'weightUnit',
+          label: '重量单位',
+          slot: 'weightUnit',
+          align: "center"
+        },
         {
           width: 80,
           prop: 'singlePrice',
@@ -352,32 +373,7 @@ export default {
           slot: 'discountTotalPrice',
           align: "center"
         },
-        // {
-        //   width: 120,
-        //   prop: 'singleWeight',
-        //   label: '单重',
-        //   slot: 'singleWeight'
-        // },
-        // {
-        //   width: 120,
-        //   prop: 'totalWeight',
-        //   label: '总重',
-        //   slot: 'totalWeight'
-        // },
-        {
-          width: 100,
-          prop: 'sendTotalWeight',
-          label: '发货总重',
-          slot: 'sendTotalWeight',
-          align: "center"
-        },
-        {
-          width: 100,
-          prop: 'weightUnit',
-          label: '重量单位',
-          slot: 'weightUnit',
-          align: "center"
-        },
+
         // {
         //   width: 80,
         //   prop: 'deliveryDays',
@@ -522,18 +518,32 @@ export default {
     },
 
     //修改数量更新合计
-    changeNum(val, index) {
-      if (this.pricingWay == 2) return
-      this.$set(
-        this.form.datasource[index],
-        'totalPrice',
-        (Number(this.form.datasource[index].singlePrice) * val).toFixed(2)
-      );
-      this.$set(
-        this.form.datasource[index],
-        'discountTotalPrice',
-        (Number(this.form.datasource[index].discountSinglePrice) * val).toFixed(2)
-      );
+    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
+      switch (this.pricingWay) {
+        case 1: //按数量计价计算总金额
+          num = Number(row.singlePrice) * Number(row.totalCount)
+          break;
+        case 2 ://按重量计价计算总金额
+          num = Number(row.singlePrice) * Number(row.totalCount) * Number(row.singleWeight)
+      }
+      return num
+    },
+    getDiscountTotalPrice(row) {
+      let num = 0
+      switch (this.pricingWay) {
+        case 1: //按数量计价计算总金额
+          num = Number(row.discountSinglePrice) * Number(row.totalCount)
+          break;
+        case 2 ://按重量计价计算总金额
+          num = Number(row.discountSinglePrice) * Number(row.totalCount) * Number(row.singleWeight)
+      }
+      return num
     },
     //选择产品回调
     changeParent(obj, idx) {
@@ -574,8 +584,6 @@ export default {
         v.otherFiles = v.otherFiles || [];
         // v.ownerId = this.warehouseList.find(item => v.warehouseId == item.id)?.ownerId 获取仓库人员id
       });
-
-
       return comitDatasource;
     },
     getPrice() {
@@ -588,15 +596,14 @@ export default {
         this.form.datasource = data;
         data.forEach(async (item, index) => {
           if (item.warehouseId) {
-            this.$set(
-              this.form.datasource[index],
-              'warehouseNum',
+            this.$set(this.form.datasource[index], 'warehouseNum',
               await getWarehouseOutStock({
                 warehouseId: item.warehouseId,
                 code: item.productCode
               })
             );
           }
+          if (!item.sendTotalWeight) this.$set(item, 'sendTotalWeight', Number(item.totalCount) * Number(item.singleWeight));
         });
       }
     },

+ 51 - 26
src/views/purchasingManage/purchaseOrder/returnGoods/components/addReturnGoodsDialog.vue

@@ -11,6 +11,10 @@
   >
     <el-form ref="form" :model="form" :rules="rules" label-width="120px">
       <headerTitle title="退货信息"></headerTitle>
+
+      <el-row :gutter="20">
+        <el-col :span="12"></el-col>
+      </el-row>
       <el-row>
         <el-col :span="12">
           <el-form-item
@@ -37,6 +41,12 @@
               placeholder="请输入"
             />
           </el-form-item>
+          <el-form-item
+            label="需求类型"
+            style="margin-bottom: 22px"
+          >
+            <el-input v-model="form.sourceTypeName" disabled></el-input>
+          </el-form-item>
           <el-form-item label="备注" prop="remark" style="margin-bottom: 22px">
             <el-input
               clearable
@@ -45,6 +55,14 @@
               placeholder="请输入"
             />
           </el-form-item>
+          <el-form-item prop="returnFiles" label="附件">
+            <fileUpload
+              v-model="form.returnFiles"
+              module="main"
+              :showLib="false"
+              :limit="10"
+            />
+          </el-form-item>
         </el-col>
 
         <el-col :span="12">
@@ -63,18 +81,22 @@
             <el-input clearable v-model="form.linkPhone" placeholder="请输入" />
             <!-- {{ form.linkPhone }} -->
           </el-form-item>
-          <el-form-item prop="returnFiles" label="附件">
-            <fileUpload
-              v-model="form.returnFiles"
-              module="main"
-              :showLib="false"
-              :limit="10"
-            />
+          <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-col>
       </el-row>
       <headerTitle title="产品清单" style="margin-top: 30px"></headerTitle>
       <inventoryTable
+        :pricingWay="form.pricingWay"
+        :sourceType="form.sourceType"
+        :outsourceSendCode="form.outsourceSendCode"
+        :receiveNo="form.receiveNo"
         :payAmount.sync="form.payAmount"
         ref="inventoryTableref"
         :receiveId="form.receiveId"
@@ -116,22 +138,22 @@
 
 <script>
 import {contactDetail} from '@/api/saleManage/contact';
-  import { numberReg } from 'ele-admin';
-  import fileUpload from '@/components/upload/fileUpload';
-  import dictMixins from '@/mixins/dictMixins';
-  import {
-    getReturnSaleOrderrecordDetail,
-    UpdateReturnInformation,
-    addReturnInformation,
-    submit,
-    getWarehouseListByIds
-  } from '@/api/purchasingManage/returnGoods';
-  import { getReceiveSaleOrderrecordDetail } from '@/api/purchasingManage/purchaseorderreceive';
-  import inventoryTable from './inventoryTable.vue';
-  import sendListDialog from './sendListDialog.vue';
-  import { copyObj } from '@/utils/util';
+import {numberReg} from 'ele-admin';
+import fileUpload from '@/components/upload/fileUpload';
+import dictMixins from '@/mixins/dictMixins';
+import {
+  addReturnInformation,
+  getReturnSaleOrderrecordDetail,
+  getWarehouseListByIds,
+  submit,
+  UpdateReturnInformation
+} from '@/api/purchasingManage/returnGoods';
+import {getReceiveSaleOrderrecordDetail} from '@/api/purchasingManage/purchaseorderreceive';
+import inventoryTable from './inventoryTable.vue';
+import sendListDialog from './sendListDialog.vue';
+import {copyObj} from '@/utils/util';
 
-  export default {
+export default {
     mixins: [dictMixins],
     components: {
       fileUpload,
@@ -149,6 +171,9 @@ import {contactDetail} from '@/api/saleManage/contact';
         linkName: '',
         linkPhone: '',
         payAmount: '',
+        pricingWay: '',
+        sourceType: '',
+        sourceTypeName: '',
         receiveAddress: ''
       };
 
@@ -196,8 +221,7 @@ import {contactDetail} from '@/api/saleManage/contact';
     },
     computed: {
       totalAmount() {
-        let allcountAmount = this.$store.state.returnGoods.allcountAmount;
-        return allcountAmount;
+        return this.$store.state.returnGoods.allcountAmount;
       }
     },
 
@@ -225,11 +249,12 @@ import {contactDetail} from '@/api/saleManage/contact';
         this.loading = false;
         if (data) {
           this.$nextTick(async () => {
-
             const contactInfo = await contactDetail(data.supplierId);
             this.form = Object.assign({}, data, {
+              id:this.businessId,
               receiveId: data.id,
-              receiveAddress:contactInfo.other?.addressName +  contactInfo.other?.address
+              receiveAddress:contactInfo.other?.addressName +  contactInfo.other?.address,
+              reviewStatus:null
             });
             this.$refs.inventoryTableref &&
               this.$refs.inventoryTableref.putTableValue(data.productList);

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

@@ -247,92 +247,135 @@
             width: 200,
             prop: 'productName',
             label: '名称',
-            slot: 'productName'
+            slot: 'productName',
+            align: "center"
           },
           {
             width: 120,
             prop: 'productCode',
             label: '编码',
-            slot: 'productCode'
+            slot: 'productCode',
+            align: "center"
           },
           {
             width: 200,
             prop: 'productCategoryName',
             label: '类型',
-            slot: 'productCategoryName'
+            slot: 'productCategoryName',
+            align: "center"
           },
           {
             width: 160,
             prop: 'productBrand',
             label: '牌号',
-            slot: 'productBrand'
+            slot: 'productBrand',
+            align: "center"
           },
           {
             width: 120,
             prop: 'modelType',
             label: '型号',
-            slot: 'modelType'
+            slot: 'modelType',
+            align: "center"
           },
           {
             width: 120,
             prop: 'specification',
             label: '规格',
-            slot: 'specification'
+            slot: 'specification',
+            align: "center"
           },
           {
             width: 200,
             prop: 'warehouseName',
             label: '仓库名称',
-            slot: 'warehouseName'
+            slot: 'warehouseName',
+            align: "center"
           },
 
           {
             width: 120,
             prop: 'receiveTotalCount',
             label: '收货数量',
-            slot: 'receiveTotalCount'
+            slot: 'receiveTotalCount',
+            align: "center"
           },
           {
             width: 120,
             prop: 'totalCount',
             label: '退货数量',
-            slot: 'totalCount'
+            slot: 'totalCount',
+            align: "center"
           },
           {
             width: 80,
             prop: 'measuringUnit',
             label: '计量单位',
-            slot: 'measuringUnit'
+            slot: 'measuringUnit',
+            align: "center"
+          },
+          {
+            width: 120,
+            prop: 'singleWeight',
+            label: '单重',
+            slot: 'singleWeight',
+            align: "center"
+          },
+          {
+            width: 200,
+            prop: 'sendTotalWeight',
+            label: '发货总重',
+            slot: 'sendTotalWeight',
+            align: "center",
+          },
+          {
+            width: 200,
+            prop: 'receiveTotalWeight',
+            label: '收货总重',
+            slot: 'receiveTotalWeight',
+            align: "center"
+          },
+          {
+            width: 100,
+            prop: 'increaseTotalWeight',
+            label: '增重重量',
+            slot: 'increaseTotalWeight',
+            align: "center"
           },
           {
             width: 160,
             prop: 'singlePrice',
             label: '单价',
-            slot: 'singlePrice'
+            slot: 'singlePrice',
+            align: "center"
           },
           {
             width: 160,
             prop: 'discountSinglePrice',
             label: '折后单价',
-            slot: 'discountSinglePrice'
+            slot: 'discountSinglePrice',
+            align: "center"
           },
           {
             width: 120,
             prop: 'totalPrice',
             label: '合计',
-            slot: 'totalPrice'
+            slot: 'totalPrice',
+            align: "center"
           },
           {
             width: 120,
             prop: 'discountTotalPrice',
             label: '折后合计',
-            slot: 'discountTotalPrice'
+            slot: 'discountTotalPrice',
+            align: "center"
           },
           {
             width: 200,
             prop: 'returnReason',
             label: '退货原因',
-            slot: 'returnReason'
+            slot: 'returnReason',
+            align: "center"
           },
           // {
           //   width: 140,
@@ -376,7 +419,8 @@
             width: 220,
             prop: 'remark',
             label: '备注',
-            slot: 'remark'
+            slot: 'remark',
+            align: "center"
           }
         ]
       };

+ 752 - 0
src/views/purchasingManage/purchaseOrder/returnGoods/components/innerboundDetailsDialog.vue

@@ -0,0 +1,752 @@
+<template>
+  <ele-modal
+    custom-class="ele-dialog-form long-dialog-form"
+    :centered="true"
+    :visible.sync="innerboundDetailsDialogFlag"
+    :title="title"
+    append-to-body
+    :close-on-click-modal="false"
+    width="80%"
+    :before-close="cancel">
+    <div>
+      <div class="content-detail">
+        <header-title title="基本信息" size="16px"></header-title>
+
+        <div class="mt20">
+          <el-form label-width="110px">
+            <el-col :span="8">
+              <el-form-item label="入库单号">
+                <span>{{ infoData.bizNo }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="入库物品类型">
+                  <span>{{
+                      infoData.bizType == 3
+                        ? '物品'
+                        : getDictValue('类型用途', infoData.assetType)
+                    }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="入库场景">
+                <!--                <span>{{ getSceneState(infoData.bizType) }}</span>-->
+              </el-form-item>
+            </el-col>
+            <el-col :span="8" v-if="infoData.bizType == 3">
+              <el-form-item label="客户名称">
+                <span>{{ infoData.clientName }}</span>
+              </el-form-item>
+            </el-col
+            >
+            <el-col :span="8" v-if="infoData.bizType == 3">
+              <el-form-item label="客户联系人">
+                <span>{{ infoData.clientUser }}</span>
+              </el-form-item>
+            </el-col
+            >
+            <el-col :span="8" v-if="infoData.bizType == 3">
+              <el-form-item label="客户电话">
+                <span>{{ infoData.clientPhone }}</span>
+              </el-form-item>
+            </el-col>
+
+            <el-col :span="8">
+              <el-form-item
+                :label="infoData.bizType == 4 ? '领料单' : '来源单据'"
+              >
+                <span>{{ infoData.sourceBizNo }}</span>
+              </el-form-item>
+            </el-col>
+
+            <el-col :span="8">
+              <el-form-item label="领料人联系方式">
+                <span>{{ infoData.fromUserPhone }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="出库登记人">
+                <span>{{ infoData.extInfo?.createUserName }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="权属部门">
+                <span>{{ infoData.extInfo?.deptName }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="创建时间">
+                <span>{{ infoData.createTime }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="入库时间">
+                <span>{{ infoData.createTime }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="状态:">
+                <span>{{ stepsTitle }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="领料人部门">
+                <span>{{ infoData.verifyDeptName }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="领料人">
+                <span>{{ infoData.fromUser }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="16">
+              <el-form-item label="备注">
+                <span>{{ infoData.remark }}</span>
+              </el-form-item>
+            </el-col>
+          </el-form>
+        </div>
+      </div>
+      <div class="content-detail mt20">
+        <header-title title="入库物品明细" size="16px"></header-title>
+        <div class="mt20">
+          <div class="mt10">
+            <el-table
+              ref="multipleTable"
+              :data="warehousingMaterialList"
+              tooltip-effect="dark"
+              style="width: 100%"
+
+              stripe
+              :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
+            >
+              <!--              <el-table-column-->
+              <!--                align="center"-->
+              <!--                type="selection"-->
+              <!--                width="55">-->
+              <!--              </el-table-column>-->
+              <el-table-column label="序号" type="index" width="50">
+              </el-table-column>
+              <el-table-column
+                label="编码"
+                prop="categoryCode"
+              ></el-table-column>
+              <el-table-column label="名称" prop="name"></el-table-column>
+              <el-table-column
+                label="批次号"
+                prop="batchNo"
+              ></el-table-column>
+              <el-table-column label="最小包装单元" width="120">
+                <template slot-scope="{ row }">
+                  {{ row.minPackingCount }}{{ row.measuringUnit }}/{{
+                    row.packingUnit
+                  }}
+                </template>
+              </el-table-column>
+              <el-table-column label="包装数量" prop="availableCountBase">
+                <template slot-scope="{ row }">
+                  {{ row.packingCount }}{{ row.packingUnit }}
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="计量数量"
+                prop="count"
+              ></el-table-column>
+              <el-table-column
+                label="计量单位"
+                prop="measuringUnit"
+              ></el-table-column>
+              <el-table-column label="重量" prop="weight"></el-table-column>
+              <el-table-column
+                label="重量单位"
+                prop="weightUnit"
+              ></el-table-column>
+              <el-table-column label="单价">
+                <template slot-scope="{ row }">
+                  {{ row.price ? row.price : '-' }}元/{{ row.measuringUnit }}
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="金额"
+                prop="totalMoney"
+              ></el-table-column>
+              <el-table-column label="领料部门" prop="llbm"></el-table-column>
+            </el-table>
+          </div>
+        </div>
+      </div>
+      <!-- ${
+            infoData.bizType == 3
+              ? '物品'
+              : getDictValue('类型用途', infoData.assetType)
+          }明细 -->
+      <div class="mt20">
+        <header-title :title="`出库包装明细`" size="16px"></header-title>
+        <el-table
+          ref="multipleTable"
+          :data="materialCodeReqList"
+          tooltip-effect="dark"
+          style="width: 100%"
+          @selection-change="selectionChange2"
+
+          stripe
+          :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
+        >
+          <el-table-column
+            align="center"
+            type="selection"
+            v-if="!metaList.length"
+            :selectable="(row)=>row.categoryCode==rows.productCode"
+            width="55">
+          </el-table-column>
+          <el-table-column label="序号" type="index" width="50">
+          </el-table-column>
+          <!-- ${
+              infoData.bizType == 3
+                ? '物品'
+                : getDictValue('类型用途', infoData.assetType)
+            } -->
+          <el-table-column
+            :label="`编码`"
+            prop="categoryCode"
+          ></el-table-column>
+          <el-table-column :label="`名称`" prop="name"></el-table-column>
+          <el-table-column label="批次号" prop="batchNo"></el-table-column>
+          <el-table-column
+            label="包装编码"
+            prop="code"
+            width="80"
+          ></el-table-column>
+          <el-table-column label="包装数量" prop="packingCount" width="80">
+            <template slot-scope="{ row }">
+              {{ row.packingCount == 0 ? '0' : row.packingCount }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="包装单位"
+            prop="packingUnit"
+          ></el-table-column>
+          <el-table-column
+            label="计量数量"
+            prop="totalCount"
+          ></el-table-column>
+          <el-table-column
+            label="计量单位"
+            prop="measuringUnit"
+          ></el-table-column>
+          <!-- <el-table-column label="领料部门" prop=""></el-table-column> -->
+          <el-table-column
+            v-if="infoData.bizType == 2 || infoData.bizType == 1"
+            label="物料代号"
+            prop="materielCode"
+          >
+            <template slot-scope="{ row }">
+              {{ row.materielCode }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            v-if="infoData.bizType == 2 || infoData.bizType == 1"
+            label="客户代号"
+            prop="clientCode"
+          >
+            <template slot-scope="{ row }">
+              {{ row.clientCode }}
+            </template>
+          </el-table-column>
+          <!-- v-if="infoData.bizType == 1" -->
+          <el-table-column label="刻码" prop="engrave">
+            <template slot-scope="{ row }">
+              {{ row.engrave }}
+            </template>
+          </el-table-column>
+          <el-table-column label="重量" prop="weight">
+            <template slot-scope="{ row }">
+              {{ row.weight }}
+            </template>
+          </el-table-column>
+          <el-table-column label="重量单位" prop="weightUtil">
+            <template slot-scope="{ row }">
+              {{ row.weightUtil }}
+            </template>
+          </el-table-column>
+
+          <el-table-column label="日期" prop="createTime" width="200">
+            <template slot="header" slot-scope="scope">
+              <!-- {{ dateTypes != 1 ? '采购日期' : '生产日期' }} -->
+              采购日期
+            </template>
+            <template slot-scope="{ row }">
+              {{ row.createTime }}
+            </template>
+          </el-table-column>
+          <el-table-column label="领料部门" prop="">
+            <template slot-scope="{ row }">
+              {{ row.llbm }}
+            </template>
+          </el-table-column>
+          <!-- <el-table-column label="转消耗" prop="">
+            <template slot-scope="{ row }">
+              <el-checkbox
+                disabled
+                v-model="row.isTransferAsset"
+              ></el-checkbox>
+            </template>
+          </el-table-column> -->
+        </el-table>
+      </div>
+      <div class="mt20">
+        <header-title :title="`出库物料明细`" size="16px"></header-title>
+        <el-table
+          ref="multipleTable1"
+          :data="metaList"
+          tooltip-effect="dark"
+          style="width: 100%"
+          @selection-change="selectionChange3"
+          stripe
+          :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
+        >
+          <el-table-column
+            :selectable="(row)=>row.assetCode==rows.productCode"
+            align="center"
+            type="selection"
+            width="55">
+          </el-table-column>
+          <el-table-column label="序号" type="index" width="50">
+          </el-table-column>
+          <el-table-column label="编码" prop="assetCode"></el-table-column>
+          <el-table-column label="名称" prop="assetName"></el-table-column>
+          <el-table-column label="批次号" prop="batchNo"></el-table-column>
+          <el-table-column label="物料编码" prop="no"></el-table-column>
+          <el-table-column label="计量数量" prop="">
+            <template slot-scope="{ row }">1</template>
+          </el-table-column>
+          <el-table-column label="计量单位" prop="measuringUnit">
+          </el-table-column>
+          <el-table-column label="物料代号" prop="meterielCode">
+          </el-table-column>
+          <el-table-column label="客户代号" prop="clientCode">
+          </el-table-column>
+          <el-table-column label="刻码" prop="engrave"></el-table-column>
+          <el-table-column label="重量" prop="weight"></el-table-column>
+          <el-table-column label="重量单位" prop="weightUnit">
+          </el-table-column>
+        </el-table>
+      </div>
+    </div>
+
+    <div slot="footer">
+      <el-button type="primary" @click="handleSave">保存</el-button>
+      <el-button type="info" @click="cancel">关闭</el-button>
+    </div>
+
+  </ele-modal>
+
+</template>
+
+<script>
+
+// import { getInfo } from '@/api/stockManagement/outgoingManagement' '@/components/PageHeader'
+// import PageHeader from '@/components/PageHeader';
+// import { tableHeader } from '../common';
+import {mapGetters, mapActions} from 'vuex';
+//import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+
+// import {
+//   materialType,
+//   warehousingType,
+//   useDict,
+//   useDictLabel,
+//   inputStatus,
+//   outputSceneState,
+//   auditStatus
+// } from '@/utils/dict/index';
+import {getUser} from '@/api/system/user';
+import {getOutInBySourceBizNoAPI} from "@/api/saleManage/returnGoods";
+import {deepClone} from "@/utils";
+
+export default {
+  props: {
+    innerboundDetailsDialogFlag: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      title: '信息',
+      selectionChangeList: [],
+      selectionChangeList2: [],
+      selectionChangeList3: [],
+      metaList: [],
+      rows: {},
+      infoData: {},
+      warehousingMaterialList: [],
+      materialCodeReqList: [],
+      tableData2: [],
+      fromUserList: [],
+
+      num: 1,
+      stepsList: [
+        {status: 'Done', nodeName: '创建'},
+        {status: 'Done', nodeName: '暂存', time: '2023-01-06'},
+        {status: 'Done', nodeName: '收货中'},
+        {status: 'Processing', nodeName: '已收货'}
+      ],
+      list: [
+        {
+          name: '紧急',
+          color: 'red'
+        },
+        {
+          name: '重要',
+          color: 'blue'
+        },
+        {
+          name: '已催办',
+          color: 'red'
+        }
+      ],
+      stepsTitle: '已完成',
+      stepsStatus: 'success',
+      active: 0
+    };
+  },
+  watch: {},
+  computed: {
+    ...mapGetters(['getDictValue']),
+    // tableHeader() {
+    //   return tableHeader(this.infoData?.extInfo?.assetType);
+    // }
+  },
+
+  created() {
+    //
+    // this.getUser();
+    // this._getInfo();
+    // this.requestDict('类型用途');
+  },
+  methods: {
+    async init(row = {}) {
+      this.rows = row
+      const data = await getOutInBySourceBizNoAPI(row.sendNo)
+      this.infoData = deepClone(data)
+      //出库物料明细
+      this.warehousingMaterialList = this.infoData?.outInDetailVOList || []
+      //出库包装明细
+      if (this.warehousingMaterialList.length) {
+        this.materialCodeReqList = []
+        this.warehousingMaterialList.forEach(item => {
+          if (item.outInDetailRecordVOList?.length) {
+            item.outInDetailRecordVOList = item.outInDetailRecordVOList.map(i => {
+              return {
+                ...i,
+                outInCode: this.infoData.bizNo,
+                outInId: item.outInId,
+                measurementCount: i.totalCount,
+                outboundDetailId: i.id,
+                outboundType: 1,
+                packageCount: i.packingCount,
+                packingUnit: i.packingUnit,
+                weight: i.weight,
+                specification: item.specification,
+                name: i.name,
+                carveCode: i.engrave,
+                categoryCode: i.categoryCode,
+                id: ''
+              }
+            })
+            this.materialCodeReqList.push(...item.outInDetailRecordVOList)
+          }
+        })
+        //出库物料明细
+        if (this.materialCodeReqList.length) {
+          this.metaList = []
+          this.materialCodeReqList.forEach(item => {
+            if (item.outInDetailRecordMaterialDetailVOList?.length) {
+              item.outInDetailRecordMaterialDetailVOList = item.outInDetailRecordMaterialDetailVOList.map(i => {
+                return {
+                  ...i,
+                  outInId: item.outInId,
+                  outInCode: item.outInCode,
+                  measurementCount: 1,
+                  outboundDetailId: i.id,
+                  outboundType: 2,
+                  packageCount: i.packingCount,
+                  packingUnit: i.packingUnit,
+                  weight: i.weight,
+                  weightUtil: i.weightUnit,
+                  specification: item.specification,
+                  categoryCode: i.assetCode,
+                  carveCode: i.engrave,
+                  name: i.assetName,
+                  id: ''
+                }
+              })
+              this.metaList.push(...item.outInDetailRecordMaterialDetailVOList)
+            }
+          })
+        }
+      }
+
+    },
+    getUserName(id) {
+      let obj = this.fromUserList.find((x) => x.id == id);
+      return obj && obj.name;
+    },
+    async getUser() {
+      let res22 = await warehouseDefinition.getUserPage({
+        groupId: 1,
+        size: 9999,
+        page: 1
+      });
+      this.fromUserList = res22.list;
+    },
+    // selectionChange(val){
+    //   this.selectionChangeList = val
+    // },
+    selectionChange2(val) {
+      this.selectionChangeList2 = val
+      console.log(this.selectionChangeList2);
+    },
+    selectionChange3(val) {
+      this.selectionChangeList3 = val
+      console.log(this.selectionChangeList3);
+    },
+    handleSave() {
+      if (!this.selectionChangeList2.length && !this.selectionChangeList3.length) return this.$message.warning('请选择退货明细')
+      let params = [
+        ...this.selectionChangeList2,
+        ...this.selectionChangeList3
+      ]
+      this.$emit('saveDate', params)
+      this.cancel()
+    },
+    cancel() {
+      this.$emit('update:innerboundDetailsDialogFlag', false)
+    },
+    ...mapActions('dict', ['requestDict']),
+
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.stepsStatus {
+  width: 40%;
+  margin: 0 auto;
+}
+
+.p20 {
+  padding: 20px;
+}
+
+.flex {
+  display: flex;
+}
+
+.title {
+  justify-content: space-between;
+  border-bottom: 1px solid #ccc;
+  padding-bottom: 5px;
+
+  span {
+    font-size: 16px;
+  }
+
+  .col {
+    padding-left: 40px;
+    font-size: 14px;
+    color: #aaaaaa;
+  }
+}
+
+.degree {
+  margin-right: 10px;
+  padding: 0px 15px;
+  color: #fff;
+  font-size: 13px;
+  line-height: 23px;
+  border-radius: 23px;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+
+  span {
+    width: 5px;
+    height: 5px;
+    border-radius: 100%;
+    margin-right: 6px;
+    background-color: #fff;
+  }
+}
+
+.red {
+  background-color: rgb(163, 0, 20);
+}
+
+.blue {
+  background-color: #1989fa;
+}
+
+.createdInfo {
+  justify-content: space-around;
+  margin-top: 10px;
+  font-size: 14px;
+
+  .col {
+    color: #6e6e6e;
+    padding-right: 10px;
+  }
+}
+
+.mt40 {
+  margin-top: 40px;
+}
+
+.custSteps {
+  margin-top: 20px;
+  margin-left: 70px;
+
+  .box {
+    width: 158px;
+    border: 1px solid #ccc;
+    padding: 10px;
+    flex-direction: row;
+    flex-wrap: wrap;
+    // justify-content: space-between;
+    font-size: 12px;
+    color: #9e9e9e;
+
+    .x {
+      width: 20px;
+      height: 15px;
+      margin-right: 5px;
+    }
+
+    .q {
+      background-color: #d0e4d5;
+    }
+
+    .b {
+      background-color: #1989fa;
+    }
+
+    .g {
+      background-color: #157a2c;
+    }
+
+    .r {
+      background-color: #a30014;
+    }
+
+    .a {
+      align-items: center;
+      margin-bottom: 10px;
+    }
+
+    .mr10 {
+      margin-right: 10px;
+    }
+
+    .mb0 {
+      margin-bottom: 0;
+    }
+  }
+
+  .stepsInfo {
+    // flex: 1;
+    width: 483px;
+  }
+}
+
+.mt20 {
+  margin-top: 20px;
+}
+
+.content-detail {
+  overflow: hidden;
+}
+
+.executor {
+  font-size: 14px;
+
+  .col {
+    color: #6e6e6e;
+    padding-right: 10px;
+  }
+}
+
+.result {
+  justify-content: space-around;
+}
+
+.mr20 {
+  margin-right: 20px;
+}
+
+.details {
+  font-size: 14px;
+  margin-bottom: 10px;
+}
+
+.customSteps {
+  margin-top: 40px;
+  font-size: 14px;
+  margin-left: 80px;
+
+  .time {
+    font-size: 12px;
+    color: #6e6e6e;
+    margin-right: 20px;
+    position: relative;
+
+    &::after {
+      content: '';
+      width: 1px;
+      height: 100%;
+      background-color: #157a2c;
+      position: absolute;
+      right: -26px;
+    }
+  }
+
+  .flex:last-child {
+    .time {
+      &::after {
+        display: none;
+      }
+    }
+  }
+
+  .round {
+    margin-right: 20px;
+    width: 10px;
+    height: 10px;
+    border-radius: 100%;
+    background-color: #157a2c;
+    position: relative;
+
+    span {
+      position: absolute;
+      top: 50%;
+      left: 50%;
+      width: 4px;
+      height: 4px;
+      background-color: #fff;
+      border-radius: 100%;
+      transform: translate(-2px, -2px);
+    }
+  }
+
+  .text {
+    .info {
+      margin-top: 10px;
+      width: 955px;
+      background-color: #f0f3f3;
+      overflow: hidden;
+      padding: 10px;
+      margin-bottom: 10px;
+    }
+  }
+}
+</style>

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

@@ -94,6 +94,52 @@
           ></el-input>
         </el-form-item>
       </template>
+      <!--   发货总重   -->
+      <template v-slot:sendTotalWeight="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.sendTotalWeight'"
+          :rules="[
+            { required: [2,3].includes(Number(sourceType))&&outsourceSendCode, message: '请输入数字', trigger: 'blur' }
+          ]"
+        >
+          <el-input v-model="scope.row.sendTotalWeight" @blur="changeSendTotalWeight(scope.$index)"
+                    :disabled="!outsourceSendCode"
+                    style="width: 60%; margin-right: 10px">
+
+          </el-input>
+          <el-button
+            size="small"
+            type="primary"
+            v-if="[2,3].includes(Number(sourceType))&&outsourceSendCode"
+            @click.native="(e)=>handleOutBound(e,scope.row,scope.$index)"
+          >选择
+          </el-button
+          >
+        </el-form-item>
+      </template>
+      <!--   收货总重   -->
+      <template v-slot:receiveTotalWeight="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.receiveTotalWeight'"
+          :rules="[
+            { required: [2,3].includes(Number(sourceType))&&pricingWay==2, message: '请输入数字', trigger: 'blur' }
+          ]"
+        >
+          <el-input v-model="scope.row.receiveTotalWeight" @blur="changeReceiveTotalWeight(scope.$index)"
+                    style="width: 60%; margin-right: 10px">
+
+          </el-input>
+          <el-button
+            size="small"
+            type="primary"
+            @click.native="(e)=>handleInnerBound(e,scope.row,scope.$index)"
+          >选择
+          </el-button
+          >
+        </el-form-item>
+      </template>
       <!-- <template v-slot:warehouseId="scope">
         <el-form-item
           style="margin-bottom: 20px"
@@ -120,6 +166,9 @@
       <template v-slot:headerTotalCount="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
+      <template v-slot:headerSendTotalWeight="{ column }">
+        <span :class="{'is-required':outsourceSendCode}">{{ column.label }}</span>
+      </template>
       <template v-slot:action="{ row }">
         <el-popconfirm
           class="ele-action"
@@ -140,6 +189,14 @@
       type="receive"
       @changeParent="changeParent"
     ></product-list>
+    <!--出库详情-->
+    <outbound-details-dialog v-if="outboundDetailsDialogFlag" ref="outboundDetailsDialogRef"
+                             :outboundDetailsDialogFlag.sync="outboundDetailsDialogFlag"
+                             @saveDate="saveDate"></outbound-details-dialog>
+    <!--入库详情-->
+    <innertboundDetailsDialog v-if="innerboundDetailsDialogFlag" ref="innerboundDetailsDialogRef"
+                              :innerboundDetailsDialogFlag.sync="innerboundDetailsDialogFlag"
+                              @saveDate="saveInnerDate"></innertboundDetailsDialog>
   </el-form>
 </template>
 <script>
@@ -150,14 +207,22 @@ import {
   // getWarehouseList,
   getWarehouseOutStock
 } from '@/api/saleManage/saleorder';
+import outboundDetailsDialog from "@/views/purchasingManage/purchaseOrder/invoice/components/outboundDetailsDialog.vue";
+import innertboundDetailsDialog from './innerboundDetailsDialog.vue'
 
 export default {
   mixins: [dictMixins],
   props: {
     receiveId: String,
-    payAmount: [Number,String]
+    payAmount: [Number, String],
+    pricingWay: [Number, String],
+    sourceType: [Number, String],
+    outsourceSendCode: [Number, String],
+    receiveNo: [Number, String],
   },
   components: {
+    outboundDetailsDialog,
+    innertboundDetailsDialog,
     productList
   },
   data() {
@@ -173,6 +238,8 @@ export default {
     return {
       discountTotalPrice: 0.0,
       allPrice: 0.0,
+      outboundDetailsDialogFlag: false,
+      innerboundDetailsDialogFlag: false,
       numberReg,
       defaultForm,
       // warehouseList: [],
@@ -193,98 +260,144 @@ export default {
           width: 200,
           prop: 'productName',
           label: '名称',
-          slot: 'productName'
+          slot: 'productName',
+          align: "center"
         },
         {
           width: 120,
           prop: 'productCode',
           label: '编码',
-          slot: 'productCode'
+          slot: 'productCode',
+          align: "center"
         },
         {
           width: 200,
           prop: 'productCategoryName',
           label: '类型',
-          slot: 'productCategoryName'
+          slot: 'productCategoryName',
+          align: "center"
         },
         {
           width: 160,
           prop: 'productBrand',
           label: '牌号',
-          slot: 'productBrand'
+          slot: 'productBrand',
+          align: "center"
         },
         {
           width: 120,
           prop: 'modelType',
           label: '型号',
-          slot: 'modelType'
+          slot: 'modelType',
+          align: "center"
         },
         {
           width: 120,
           prop: 'specification',
           label: '规格',
-          slot: 'specification'
+          slot: 'specification',
+          align: "center"
         },
         {
           width: 200,
           prop: 'warehouseName',
           label: '仓库名称',
           slot: 'warehouseName',
+          align: "center",
         },
         {
           width: 100,
           prop: 'warehouseNum',
           label: '库存',
-          slot: 'warehouseNum'
+          slot: 'warehouseNum',
+          align: "center"
         },
         {
           width: 120,
           prop: 'receiveTotalCount',
           label: '收货数量',
-          slot: 'receiveTotalCount'
+          slot: 'receiveTotalCount',
+          align: "center"
         },
         {
           width: 120,
           prop: 'totalCount',
           label: '退货数量',
           slot: 'totalCount',
-          headerSlot: 'headerTotalCount'
+          headerSlot: 'headerTotalCount',
+          align: "center"
         },
         {
           width: 80,
           prop: 'measuringUnit',
           label: '计量单位',
-          slot: 'measuringUnit'
+          slot: 'measuringUnit',
+          align: "center"
+        },
+        {
+          width: 120,
+          prop: 'singleWeight',
+          label: '单重',
+          slot: 'singleWeight',
+          align: "center"
+        },
+        {
+          width: 200,
+          prop: 'sendTotalWeight',
+          label: '发货总重',
+          slot: 'sendTotalWeight',
+          align: "center",
+          headerSlot: 'headerSendTotalWeight'
+        },
+        {
+          width: 200,
+          prop: 'receiveTotalWeight',
+          label: '收货总重',
+          slot: 'receiveTotalWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'increaseTotalWeight',
+          label: '增重重量',
+          slot: 'increaseTotalWeight',
+          align: "center"
         },
         {
           width: 160,
           prop: 'singlePrice',
           label: '单价',
-          slot: 'singlePrice'
+          slot: 'singlePrice',
+          align: "center"
         },
         {
           width: 160,
           prop: 'discountSinglePrice',
           label: '折后单价',
-          slot: 'discountSinglePrice'
+          slot: 'discountSinglePrice',
+          align: "center"
         },
         {
           width: 120,
           prop: 'totalPrice',
           label: '合计',
-          slot: 'totalPrice'
+          slot: 'totalPrice',
+          align: "center"
         },
         {
           width: 120,
           prop: 'discountTotalPrice',
           label: '折后合计',
-          slot: 'discountTotalPrice'
+          slot: 'discountTotalPrice',
+          align: "center"
         },
+
         {
           width: 200,
           prop: 'returnReason',
           label: '退货原因',
-          slot: 'returnReason'
+          slot: 'returnReason',
+          align: "center"
         },
         // {
         //   width: 140,
@@ -328,7 +441,8 @@ export default {
           width: 220,
           prop: 'remark',
           label: '备注',
-          slot: 'remark'
+          slot: 'remark',
+          align: "center"
         },
         {
           columnKey: 'action',
@@ -354,21 +468,124 @@ export default {
     // });
   },
   methods: {
-    //修改数量更新合计
+    //修改数量更新合计/总重
     changeNum(val, index) {
-      this.$set(
-        this.form.datasource[index],
-        'totalPrice',
-        (Number(this.form.datasource[index].singlePrice) * val).toFixed(2)
-      );
-      this.$set(
-        this.form.datasource[index],
-        'discountTotalPrice',
-        (Number(this.form.datasource[index].discountSinglePrice) * val).toFixed(2)
-      );
-      this.$store.commit('returnGoods/setIsDefaultPayableAmount', false);
+      this.curIndex = index
+      if (this.pricingWay == 2) {
+        if (val != this.form.datasource[index].receiveTotalCount) {
+          this.$set(this.form.datasource[index], 'sendTotalWeight', '')
+          this.$set(this.form.datasource[index], 'receiveTotalWeight', '')
+          this.$set(this.form.datasource[index], 'increaseTotalWeight', '')
+          this.getWeightPrice()
+        } else {
+          let find = this.oldSendTotalWeightList.find(key => key.productCode == this.form.datasource[index].productCode) || {}
+          this.$set(this.form.datasource[index], 'sendTotalWeight', find.oldSendTotalWeight)
+          this.$set(this.form.datasource[index], 'receiveTotalWeight', find.oldReceiveTotalWeight)
+          this.setIcreaseTotalWeight()
+        }
+      } else {
+        if (val != this.form.datasource[index].receiveTotalCount) {
+          this.$set(this.form.datasource[index], 'sendTotalWeight', '')
+          this.$set(this.form.datasource[index], 'receiveTotalWeight', '')
+          this.$set(this.form.datasource[index], 'increaseTotalWeight', '')
+        } else {
+          let find = this.oldSendTotalWeightList.find(key => key.productCode == this.form.datasource[index].productCode) || {}
+          this.$set(this.form.datasource[index], 'sendTotalWeight', find.oldSendTotalWeight)
+          this.$set(this.form.datasource[index], 'receiveTotalWeight', find.oldReceiveTotalWeight)
+          this.setIcreaseTotalWeight()
+        }
+
+        this.$set(this.form.datasource[index], 'totalPrice', (Number(this.form.datasource[index].singlePrice) * val).toFixed(2));
+        this.$set(this.form.datasource[index], 'discountTotalPrice', (Number(this.form.datasource[index].discountSinglePrice) * val).toFixed(2));
+
+        this.$store.commit('returnGoods/setIsDefaultPayableAmount', false);
+        this.gettotalAmount();
+      }
+    },
+    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));
       this.gettotalAmount();
     },
+
+    //出库单详情
+    handleOutBound(e, rows, index) {
+      this.curIndex = index
+      this.outboundDetailsDialogFlag = true
+      this.$nextTick(() => {
+        let row = {
+          sendNo: this.outsourceSendCode,
+          productCode: rows.productCode
+        }
+        this.$refs.outboundDetailsDialogRef.init(row)
+      })
+    },
+    //选择退货信息回调
+    saveDate(data = []) {
+      let totalWeight = data.reduce((num, row) => {
+        num += Number(row.weight)
+        return num
+      }, 0)
+      this.$set(this.form.datasource[this.curIndex], 'sendTotalWeight', totalWeight);
+      this.setIcreaseTotalWeight()
+    },
+
+    //入库单详情
+    handleInnerBound(e, rows, index) {
+      this.curIndex = index
+      this.innerboundDetailsDialogFlag = true
+      this.$nextTick(() => {
+        let row = {
+          sendNo: this.receiveNo,
+          productCode: rows.productCode
+        }
+        this.$refs.innerboundDetailsDialogRef.init(row)
+      })
+    },
+    //选择入库单信息
+    saveInnerDate(data = []) {
+      let totalWeight = data.reduce((num, row) => {
+        num += Number(row.weight)
+        return num
+      }, 0)
+      this.$set(this.form.datasource[this.curIndex], 'receiveTotalWeight', totalWeight);
+      this.setIcreaseTotalWeight()
+    },
+    //修改发货总重
+    changeSendTotalWeight(index) {
+      this.curIndex = index
+      this.setIcreaseTotalWeight()
+    },
+    //修改收货总重
+    changeReceiveTotalWeight(index) {
+      this.curIndex = index
+      this.setIcreaseTotalWeight()
+    },
+    //设置增重总重
+    setIcreaseTotalWeight() {
+      let receiveTotalWeight = Number(this.form.datasource[this.curIndex].receiveTotalWeight)
+      let sendTotalWeight = Number(this.form.datasource[this.curIndex].sendTotalWeight)
+      if ([2, 3].includes(Number(this.sourceType))) {
+        if (this.pricingWay == 2) {
+          if ((!receiveTotalWeight || !sendTotalWeight)) {
+            return this.$set(this.form.datasource[this.curIndex], 'increaseTotalWeight', '');
+          } else {
+            this.$set(this.form.datasource[this.curIndex], 'increaseTotalWeight', (receiveTotalWeight - sendTotalWeight).toFixed(2));
+          }
+        } else {
+          this.$set(this.form.datasource[this.curIndex], 'increaseTotalWeight', (receiveTotalWeight - sendTotalWeight).toFixed(2));
+        }
+      } else {
+        this.$set(this.form.datasource[this.curIndex], 'increaseTotalWeight', receiveTotalWeight);
+      }
+      if (this.pricingWay == 2) {
+        this.getWeightPrice()
+      }
+
+    },
     //获取订单总金额
     gettotalAmount() {
       let productData = this.form.datasource;
@@ -478,13 +695,18 @@ export default {
           v.receiveTotalCount = v.receiveTotalCount || v.totalCount;
           v.receiveProductId = v.receiveProductId || v.id;
         });
-
+        this.oldSendTotalWeightList = data.map(item => {
+          return {
+            productCode: item.productCode,
+            oldSendTotalWeight: item.sendTotalWeight,
+            oldReceiveTotalWeight: item.receiveTotalWeight
+          }
+        })
         this.form.datasource = data;
         this.form.datasource.forEach(async (v, index) => {
           if (v.warehouseId) {
             this.$set(
-              this.form.datasource[index],
-              'warehouseNum',
+              this.form.datasource[index], 'warehouseNum',
               await getWarehouseOutStock({
                 warehouseId: v.warehouseId,
                 code: v.productCode

+ 2 - 0
src/views/purchasingManage/purchasePlanManage/components/inventoryTable.vue

@@ -380,6 +380,7 @@ export default {
       isFirst: 0,
       name: '',
       supplierName: '',
+      weightUnit: '',
     };
     return {
       curIndex: null,
@@ -616,6 +617,7 @@ export default {
       this.$set(this.form.datasource[idx], 'productCode', obj.code);
       this.$set(this.form.datasource[idx], 'productName', obj.name);
       this.$set(this.form.datasource[idx], 'modelType', obj.modelType);
+      this.$set(this.form.datasource[idx], 'weightUnit', obj.weightUnit);
       this.$set(
         this.form.datasource[idx],
         'measuringUnit',