Browse Source

退货流程

yusheng 2 years ago
parent
commit
c13a171668

BIN
dist.zip


+ 11 - 3
src/api/bpm/components/saleManage/saleorder.js

@@ -128,7 +128,7 @@ export async function getSendTableList(params) {
  */
 export async function UpdateReturnInformation(data) {
   const res = await request.put(`/eom/saleorderreturnrecord/update`, data);
-  return res.data
+  return res.data;
 }
 /**
  * 获取信息详情
@@ -146,7 +146,7 @@ export async function gettAccountstatementDetail(id) {
  */
 export async function UpdatetAccountstatement(data) {
   const res = await request.put(`/eom/accountstatement/update`, data);
-  return res.data
+  return res.data;
 }
 
 /**
@@ -161,4 +161,12 @@ export async function getsearchDetailListByType(params) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+/**
+ * 退货审批
+ */
+export async function approve(params) {
+  const res = await request.post(`/bpm/salesOrderReturnApprove/approve`, params);
+  return res.data;
+}

+ 175 - 0
src/components/timeDialog/index.vue

@@ -0,0 +1,175 @@
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="35%"
+  >
+    <el-form
+      :model="form"
+      ref="tableForm"
+      class="tableForm"
+      :rules="tableFormRules"
+    >
+      <el-button
+        type="primary"
+        size="small"
+        style="margin-bottom: 10px"
+        @click="handleAdd()"
+        v-if="!view"
+        >新增</el-button
+      >
+      <el-table
+        ref="multipleTable"
+        :data="form.arrivalBatch"
+        tooltip-effect="dark"
+        style="width: 100%"
+        stripe
+        :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
+      >
+        <el-table-column label="数量" prop="arriveCount">
+          <template slot-scope="{ row, $index }">
+            <el-form-item
+              :prop="'arrivalBatch.' + $index + '.arriveCount'"
+              :rules="tableFormRules.arriveCount"
+            >
+              <el-input
+                placeholder="请输入"
+                clearable
+                v-model="row.arriveCount"
+                :disabled="view"
+              ></el-input>
+            </el-form-item>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="到货时间">
+          <template slot-scope="{ row, $index }">
+            <el-form-item
+              :prop="'arrivalBatch.' + $index + '.arriveDate'"
+              :rules="tableFormRules.arriveDate"
+            >
+              <el-date-picker
+                clearable
+                v-model="row.arriveDate"
+                type="date"
+                value-format="yyyy-MM-dd"
+                placeholder="请选择日期"
+                :disabled="view"
+              >
+              </el-date-picker>
+            </el-form-item> </template
+        ></el-table-column>
+
+        
+        <el-table-column label="操作" prop="action" width="80" v-if="!view">
+          <template slot-scope="{ $index }">
+            <el-link
+              type="primary"
+              :underline="false"
+              @click="handleDel($index)"
+              >删除</el-link
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-form>
+
+    <div class="btns">
+      <el-button type="primary" size="small" @click="handleOk">确认</el-button>
+      <el-button size="small" @click="handleClose">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import { copyObj } from '@/utils/util';
+
+  export default {
+    components: {},
+    props:{
+        view:{
+            default:false
+        }
+    },
+    data() {
+      return {
+        visible: false,
+        title: '设置分批时间',
+
+        current: null,
+        form: {
+          arrivalBatch: [
+            {
+              arriveDate: null,
+              arriveCount: null
+            }
+          ]
+        },
+
+        tableFormRules: {
+          arriveCount: {
+            required: true,
+            message: '请输入数量',
+            trigger: 'blur'
+          },
+
+          arriveDate: {
+            required: true,
+            message: '请选择日期',
+            trigger: 'change'
+          }
+        }
+      };
+    },
+
+    watch: {},
+    methods: {
+      open(row) {
+        console.log(row, 'row');
+        this.form.arrivalBatch = row.arrivalBatch&&copyObj(row.arrivalBatch)||[];
+        this.current = row;
+        this.visible = true;
+      },
+
+      handleAdd() {
+        this.form.arrivalBatch.push({
+          arriveDate: null,
+          arriveCount: null
+        });
+      },
+
+      handleDel(index) {
+        this.form.arrivalBatch.splice(index, 1);
+      },
+
+      handleOk() {
+        this.$refs.tableForm.validate((valid) => {
+          if (valid) {
+            this.$emit('chooseTime', this.current,copyObj(this.form.arrivalBatch) );
+            this.handleClose();
+          }
+        });
+      },
+
+      handleClose() {
+        this.$refs.tableForm && this.$refs.tableForm.resetFields();
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .btns {
+    margin-top: 20px;
+    text-align: center;
+  }
+
+  .el-form-item {
+    margin-bottom: 20px !important;
+  }
+</style>

+ 1 - 0
src/enum/dict.js

@@ -53,6 +53,7 @@ export default {
   退货类型: 'sale_return_type',
   需求来源类型:'requirement_source_type',
   采购类型:'purchase_type',
+  退货类型:'sale_return_order_type',
 
 };
 

+ 37 - 27
src/views/bpm/handleTask/components/contractBook/inventoryTable.vue

@@ -18,13 +18,15 @@
             icon="el-icon-plus"
             class="ele-btn-icon"
             @click="handlAdd"
-            v-if="!taskDefinitionKey"
+            v-if="!taskDefinitionKey||taskDefinitionKey!='produceLeader'"
           >
-            新增
+            新增{{ taskDefinitionKey }}
           </el-button>
           <div class="pricebox">
-            <span class="amount">总计:{{ allPrice }}元</span>
-            <span v-if="isDiscountTotalPrice">优惠总金额:</span>
+            <span class="amount" v-if="isSinglePrice"
+              >总计:{{ allPrice }}元</span
+            >
+            <span v-if="isDiscountTotalPrice">优惠总计:</span>
             <el-input
               v-if="isDiscountTotalPrice"
               v-model="discountTotalPrice"
@@ -50,6 +52,7 @@
           <el-input
             v-model="row.productName"
             placeholder="请输入"
+            :disabled="taskDefinitionKey=='produceLeader'"
             @click.native="handParent(row, $index)"
           ></el-input>
         </el-form-item>
@@ -239,7 +242,7 @@
       </template>
       <template
         v-slot:headerSinglePrice="{ column }"
-        v-if="pageName != 'businessOpportunity'"
+        v-if="pageName != 'businessOpportunity' || isSinglePrice"
       >
         <span class="is-required">{{ column.label }}</span>
       </template>
@@ -329,6 +332,11 @@
       <template v-slot:produceDeliveryDeadline="scope">
         <el-form-item
           :prop="'datasource.' + scope.$index + '.produceDeliveryDeadline'"
+          :rules="{
+            required:taskDefinitionKey=='produceLeader'?true:false,
+            message: '请输入',
+            trigger: 'change'
+          }"
         >
           <el-date-picker
             style="width: 140px"
@@ -383,8 +391,7 @@
             required: taskDefinitionKey === 'technicianApprove' ? true : false,
             message: '请输入',
             trigger: 'change',
-            pattern: numberReg,
-
+            pattern: numberReg
           }"
         >
           <el-input
@@ -398,6 +405,10 @@
       <template v-slot:headerCustomerExpectDeliveryDeadline="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
+      <template v-slot:headeProduceDeliveryDeadline="{ column }" v-if="taskDefinitionKey=='produceLeader'">
+        <span class="is-required">{{ column.label }}</span>
+      </template>
+      
       <template
         v-slot:headerSingleWeight="{ column }"
         v-if="taskDefinitionKey === 'technicianApprove'"
@@ -411,6 +422,7 @@
           class="ele-action"
           title="确定要删除吗?"
           @confirm="remove(row)"
+          v-if="taskDefinitionKey!='produceLeader'"
         >
           <template v-slot:reference>
             <el-link type="danger" :underline="false" icon="el-icon-delete">
@@ -461,10 +473,13 @@
         default: false,
         type: Boolean
       },
+      isSinglePrice: {
+        default: true,
+        type: Boolean
+      },
       taskDefinitionKey: {},
       pageName: { type: String }
     },
-
     data() {
       const defaultForm = {
         key: null,
@@ -541,7 +556,8 @@
             prop: 'singlePrice',
             label: '单价',
             slot: 'singlePrice',
-            headerSlot: 'headerSinglePrice'
+            headerSlot: 'headerSinglePrice',
+            show: this.isSinglePrice
           },
           {
             width: 120,
@@ -605,7 +621,9 @@
             width: 160,
             prop: 'produceDeliveryDeadline',
             label: '生产交付交期',
-            slot: 'produceDeliveryDeadline'
+            slot: 'produceDeliveryDeadline',
+            headerSlot: 'headeProduceDeliveryDeadline'
+
           },
 
           {
@@ -690,7 +708,8 @@
         if (
           [
             'productionSupervisorApprove1',
-            'productionSupervisorApprove2'
+            'productionSupervisorApprove2','produceLeader'
+            
           ].includes(this.taskDefinitionKey) ||
           !this.taskDefinitionKey
         ) {
@@ -711,7 +730,7 @@
       },
       isSingleWeight() {
         if (
-          ['techLeaderApprove', 'technicianApprove'].includes(
+          ['techLeaderApprove', 'technicianApprove', 'QCLeader'].includes(
             this.taskDefinitionKey
           )
         ) {
@@ -720,19 +739,6 @@
         return false;
       }
     },
-    watch: {
-      // contractStartDate() {
-      //   this.form.datasource.forEach((item,index) => {
-      //     if (item.deliveryDays&&!item.deliveryDeadline) {
-      //       this.$set(
-      //         this.form.datasource[index],
-      //         'deliveryDeadline',
-      //         this.setDay(item.deliveryDays)
-      //       );
-      //     }
-      //   });
-      // }
-    },
     methods: {
       setDeliveryDays(row, index, type, isAll) {
         if (isAll) {
@@ -801,7 +807,11 @@
         let comitDatasource = this.form.datasource;
         if (comitDatasource.length === 0) return [];
         comitDatasource.forEach((v) => {
-          v.totalPrice = (v.totalCount * v.singlePrice)?.toFixed(2) || 0;
+          v.totalPrice =
+            (v.totalCount &&
+              v.singlePrice &&
+              (v.totalCount * v.singlePrice)?.toFixed(2)) ||
+            null;
           v.guaranteePeriodUnitName = this.getDictValue(
             '质保期单位',
             v.guaranteePeriodUnitCode
@@ -847,7 +857,7 @@
       //修改回显
       putTableValue(data) {
         let productList =
-          (data && (data.quoteProductList || data.productList)) || [];
+          (data && (data.redressProductList||data.quoteProductList || data.productList)) || [];
         if (productList) {
           productList.forEach((item) => {
             item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode + '';

+ 12 - 3
src/views/bpm/handleTask/components/contractBook/inventoryTabledetail.vue

@@ -9,7 +9,7 @@
   >
     <template v-slot:toolbar>
       <div class="headbox">
-        <span class="amount"
+        <span class="amount" v-if="isSinglePrice"
           >总计:{{ form.totalPrice || form.totalAmount }}元</span
         >
         <span
@@ -94,6 +94,14 @@
         default: false,
         type: Boolean
       },
+      isSinglePrice: {
+        default: true,
+        type: Boolean
+      },
+      isSinglePrice: {
+        default: true,
+        type: Boolean
+      }
     },
     data() {
       return {
@@ -152,7 +160,8 @@
             width: 160,
             prop: 'singlePrice',
             label: '单价',
-            slot: 'singlePrice'
+            slot: 'singlePrice',
+            show:this.isSinglePrice
           },
 
           {
@@ -296,7 +305,7 @@
       putTableValue(data) {
         console.log(data, 'data');
         let productList =
-          (data && (data.quoteProductList || data.productList)) || [];
+          (data && (data.redressProductList||data.quoteProductList || data.productList)) || [];
         if (data) {
           this.form = data;
           this.productList = productList;

+ 8 - 1
src/views/bpm/handleTask/components/purchaseNeedManage/detailDialog.vue

@@ -93,6 +93,7 @@
         </div>
       </template>
     </ele-pro-table>
+    <timeDialog ref="timeDialogRef" :view="true"></timeDialog>
   </div>
 </template>
 
@@ -100,6 +101,7 @@
   import { getDetail } from '@/api/bpm/components/purchasingManage/purchaseNeedManage';
   import { getFile } from '@/api/system/file';
   import dictMixins from '@/mixins/dictMixins';
+  import timeDialog from '@/components/timeDialog/index.vue';
 
   export default {
     props: {
@@ -108,7 +110,9 @@
       }
     },
     mixins: [dictMixins],
- 
+    components: {
+      timeDialog
+    },
     data() {
       return {
         visible: false,
@@ -206,6 +210,9 @@
       downloadFile(file) {
         getFile({ objectName: file.storePath }, file.name);
       },
+      handleMethod(row) {
+        this.$refs.timeDialogRef.open(row);
+      },
       async getDetailData(id) {
         this.loading = true;
         const data = await getDetail(id);

+ 85 - 6
src/views/bpm/handleTask/components/purchaseNeedManage/inventoryTable.vue

@@ -51,7 +51,6 @@
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.productCode'"
-          
         >
           <el-input v-model="scope.row.productCode" disabled></el-input>
         </el-form-item>
@@ -60,7 +59,6 @@
         <el-form-item
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.productCategoryName'"
-         
         >
           <el-input v-model="scope.row.productCategoryName" disabled></el-input>
         </el-form-item>
@@ -198,8 +196,23 @@
           />
         </el-form-item>
       </template>
+      <template v-slot:technicalDrawings="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.technicalDrawings'"
+        >
+          <fileUpload
+            v-model="scope.row.technicalDrawings"
+            module="main"
+            :showLib="false"
+            :limit="5"
+          />
+        </el-form-item>
+      </template>
+
       <template v-slot:expectReceiveDate="scope">
         <el-form-item
+          v-if="scope.row.arrivalWay == 1"
           style="margin-bottom: 20px"
           :prop="'datasource.' + scope.$index + '.expectReceiveDate'"
           :rules="{
@@ -218,8 +231,43 @@
           >
           </el-date-picker>
         </el-form-item>
+        <el-form-item
+          style="margin-bottom: 20px"
+          v-if="scope.row.arrivalWay == 2"
+        >
+          <el-link
+            type="primary"
+            :underline="false"
+            @click.native="handleMethod(scope.row)"
+          >
+            设置分批时间
+          </el-link>
+        </el-form-item>
+      </template>
+      <template v-slot:arrivalWay="scope">
+        <el-form-item
+          :prop="'datasource.' + scope.$index + '.arrivalWay'"
+          :rules="{
+            required: true,
+            message: '请选择',
+            trigger: 'blur'
+          }"
+        >
+          <el-select
+            v-model="scope.row.arrivalWay"
+            clearable
+            style="width: 100%"
+          >
+            <el-option
+              v-for="item in arrivalWayList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
       </template>
-
       <!-- 操作列 -->
       <template v-slot:action="scope">
         <el-popconfirm
@@ -241,6 +289,8 @@
       @changeParent="changeParent"
     ></product-list>
     <head-list ref="headRef" @changeParent="changeAnswer"></head-list>
+    <timeDialog @chooseTime="chooseTime" ref="timeDialogRef"></timeDialog>
+
   </el-form>
 </template>
 <script>
@@ -249,12 +299,14 @@
   import dictMixins from '@/mixins/dictMixins';
   import fileUpload from '@/components/upload/fileUpload';
   import headList from '@/components/headList';
+  import timeDialog from '@/components/timeDialog/index.vue';
+
   export default {
     mixins: [dictMixins],
     components: {
       productList,
       fileUpload,
-      headList
+      headList,timeDialog
     },
     data() {
       const defaultForm = {
@@ -264,6 +316,10 @@
         name: ''
       };
       return {
+        arrivalWayList: [
+          { label: '一次性到货', value: 1 },
+          { label: '分批到货', value: 2 }
+        ],
         numberReg,
         defaultForm,
         form: {
@@ -333,11 +389,25 @@
             label: '品牌',
             slot: 'brand'
           },
+          {
+            width: 160,
+            prop: 'arrivalWay',
+            label: '到货方式',
+            slot: 'arrivalWay',
+            headerSlot: 'headerArrivalWay'
+          },
           {
             width: 170,
             prop: 'expectReceiveDate',
             label: '到货日期',
-            slot: 'expectReceiveDate'
+            slot: 'expectReceiveDate',
+            headerSlot: 'headerExpectReceiveDate'
+          },
+          {
+            width: 160,
+            prop: 'technicalDrawings',
+            label: '图纸附件',
+            slot: 'technicalDrawings'
           },
           {
             width: 140,
@@ -373,7 +443,9 @@
         if (comitDatasource.length === 0) return [];
         comitDatasource.forEach((v) => {
           v.totalPrice = (v.totalCount * v.singlePrice)?.toFixed(2) || 0;
-          v.files = v.files || null;
+          v.files = v.files || [];
+          v.technicalDrawings = v.technicalDrawings || [];
+          v.arrivalBatch = v.arrivalBatch || [];
         });
         return comitDatasource;
       },
@@ -383,6 +455,13 @@
           this.form.datasource = data;
         }
       },
+      handleMethod(row) {
+        this.$refs.timeDialogRef.open(row);
+      },
+      chooseTime(row, arrivalBatch) {
+        row.arrivalBatch = copyObj(arrivalBatch);
+        console.log(row, 'row');
+      },
       //选择产品
       handParent(row, index) {
         // let item = {

+ 875 - 0
src/views/bpm/handleTask/components/saleOrder/inventoryTable.vue

@@ -0,0 +1,875 @@
+<template>
+  <el-form ref="form" :model="form" :rules="rules">
+    <!-- <template v-if="contractId">
+      <ele-pro-table
+        ref="table"
+        :needPage="false"
+        :columns="competAnalysisListcolumns"
+        :toolkit="[]"
+        :datasource="form.datasource"
+        row-key="id"
+      >
+      </ele-pro-table>
+    </template> -->
+    <template>
+      <ele-pro-table
+        ref="table"
+        :needPage="false"
+        :columns="columns"
+        :toolkit="[]"
+        :datasource="form.datasource"
+        cache-key="systemRoleTable17"
+        class="time-form"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:toolbar>
+          <div class="headbox" v-if="!contractId">
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              class="ele-btn-icon"
+              @click="handlAdd"
+            >
+              新增
+            </el-button>
+          </div>
+        </template>
+        <template v-slot:productName="{ row, $index }">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + $index + '.productName'"
+            :rules="{
+              required: true,
+              message: '请输入',
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="row.productName"
+              placeholder="请输入"
+              @click.native="handParent(row, $index)"
+            ></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:productCode="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.productCode'"
+            :rules="{
+              required: true,
+              message: '请输入',
+              trigger: 'change'
+            }"
+          >
+            <el-input v-model="scope.row.productCode" disabled></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:productCategoryName="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.productCategoryName'"
+            :rules="{
+              required: true,
+              message: '请输入',
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="scope.row.productCategoryName"
+              disabled
+            ></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:totalCount="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.totalCount'"
+            :rules="{
+              required: true,
+              pattern: numberReg,
+              message: '请输入数字',
+              trigger: 'blur'
+            }"
+          >
+            <el-input
+              v-model="scope.row.totalCount"
+              placeholder="请输入"
+              @input="getTotalPrice"
+            ></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:totalPrice="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.totalPrice'"
+          >
+            {{
+              (scope.row.totalCount * scope.row.singlePrice || 0).toFixed(2)
+            }}元
+          </el-form-item>
+        </template>
+
+        <template v-slot:productBrand="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.productBrand'"
+          >
+            <el-input v-model="scope.row.productBrand" disabled></el-input>
+          </el-form-item>
+        </template>
+
+        <template v-slot:modelType="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.modelType'"
+          >
+            <el-input v-model="scope.row.modelType" disabled></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:specification="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.specification'"
+          >
+            <el-input v-model="scope.row.specification" disabled></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:deliveryDays="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.deliveryDays'"
+            :rules="{
+              pattern: numberReg,
+              message: '请输入数字',
+              trigger: 'blur'
+            }"
+          >
+            <el-input
+              v-model="scope.row.deliveryDays"
+              @change="setDeliveryDays(scope.row, scope.$index, 'deliveryDays')"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:guaranteePeriod="scope">
+          <div class="period">
+            <div class="borderleftnone">
+              <el-form-item
+                style="margin-bottom: 20px"
+                :prop="'datasource.' + scope.$index + '.guaranteePeriod'"
+                :rules="{
+                  pattern: numberReg,
+                  message: '请输入数字',
+                  trigger: 'blur'
+                }"
+              >
+                <el-input
+                  v-model="scope.row.guaranteePeriod"
+                  @change="
+                    setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
+                  "
+                  placeholder="请输入"
+                ></el-input>
+              </el-form-item>
+            </div>
+            <div class="borderrightnone">
+              <DictSelection
+                dictName="质保期单位"
+                clearable
+                v-model="scope.row.guaranteePeriodUnitCode"
+                @change="
+                  setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
+                "
+              >
+              </DictSelection>
+            </div>
+          </div>
+        </template>
+        <!-- <template v-slot:guaranteePeriodUnitCode="scope"> </template> -->
+        <template v-slot:measuringUnit="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.measuringUnit'"
+          >
+            <el-input
+              v-model="scope.row.measuringUnit"
+              disabled
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:remark="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.remark'"
+          >
+            <el-input
+              v-model="scope.row.remark"
+              type="textarea"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:singlePrice="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.singlePrice'"
+            :rules="{
+              required: true,
+              pattern: numberReg,
+              message: '请输入正确的单价',
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="scope.row.singlePrice"
+              placeholder="请输入"
+              @input="getTotalPrice"
+            >
+              <template slot="append">元</template>
+            </el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:technicalAnswerName="{ row, $index }">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + $index + '.technicalAnswerName'"
+          >
+            <el-input
+              v-model="row.technicalAnswerName"
+              placeholder="请输入"
+              @click.native="handHead(row, $index)"
+            ></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:technicalParams="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.technicalParams'"
+          >
+            <el-input
+              type="textarea"
+              v-model="scope.row.technicalParams"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:technicalDrawings="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.technicalDrawings'"
+          >
+            <fileUpload
+              v-model="scope.row.technicalDrawings"
+              module="main"
+              :showLib="false"
+              :limit="5"
+            />
+          </el-form-item>
+        </template>
+        <template v-slot:customerReqFiles="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'datasource.' + scope.$index + '.customerReqFiles'"
+          >
+            <fileUpload
+              v-model="scope.row.customerReqFiles"
+              module="main"
+              :showLib="false"
+              :limit="5"
+            />
+          </el-form-item>
+        </template>
+        <template v-slot:guaranteePeriodDeadline="scope">
+          <el-form-item
+            :prop="'datasource.' + scope.$index + '.guaranteePeriodDeadline'"
+          >
+            <el-date-picker
+              style="width: 140px"
+              v-model="scope.row.guaranteePeriodDeadline"
+              type="date"
+              placeholder="选择日期"
+            >
+            </el-date-picker>
+          </el-form-item>
+        </template>
+        <template v-slot:deliveryDeadline="scope">
+          <el-form-item
+            :prop="'datasource.' + scope.$index + '.deliveryDeadline'"
+          >
+            <el-date-picker
+              style="width: 140px"
+              v-model="scope.row.deliveryDeadline"
+              type="date"
+              placeholder="选择日期"
+            >
+            </el-date-picker>
+          </el-form-item>
+        </template>
+
+        <template v-slot:headerProductName="{ column }">
+          <span class="is-required">{{ column.label }}</span>
+        </template>
+        <template v-slot:headerTotalCount="{ column }">
+          <span class="is-required">{{ column.label }}</span>
+        </template>
+        <template v-slot:headerSinglePrice="{ column }">
+          <span class="is-required">{{ column.label }}</span>
+        </template>
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-popconfirm
+            class="ele-action"
+            title="确定要删除吗?"
+            @confirm="remove(row)"
+          >
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+        </template>
+      </ele-pro-table>
+    </template>
+    <product-list
+      ref="productListRef"
+      classType="1"
+      @changeParent="changeParent"
+    ></product-list>
+    <head-list ref="headRef" @changeParent="changeAnswer"></head-list>
+  </el-form>
+</template>
+<script>
+  import { numberReg } from 'ele-admin';
+  import productList from '@/views/bpm/handleTask/components/quotation/product-list.vue';
+  import dictMixins from '@/mixins/dictMixins';
+  import fileUpload from '@/components/upload/fileUpload';
+  import headList from '@/components/headList';
+  const dayjs = require('dayjs');
+
+  export default {
+    mixins: [dictMixins],
+    components: {
+      productList,
+      fileUpload,
+      headList
+    },
+    data() {
+      const defaultForm = {
+        key: null,
+        endTime: '',
+        isFirst: 0,
+        name: '',
+        startTime: '',
+        workHour: '',
+        technicalDrawings: []
+      };
+      return {
+        discountTotalPrice: 0.0,
+        allPrice: 0.0,
+        numberReg,
+        defaultForm,
+        form: {
+          datasource: []
+        },
+        rules: {},
+        competAnalysisListcolumns: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            width: 200,
+            prop: 'productName',
+            label: '名称',
+            slot: 'productName'
+          },
+          {
+            width: 120,
+            prop: 'productCode',
+            label: '编码',
+            slot: 'productCode'
+          },
+          {
+            width: 200,
+            prop: 'productCategoryName',
+            label: '类型',
+            slot: 'productCategoryName'
+          },
+          {
+            width: 160,
+            prop: 'productBrand',
+            label: '牌号',
+            slot: 'productBrand'
+          },
+          {
+            width: 120,
+            prop: 'modelType',
+            label: '型号',
+            slot: 'modelType'
+          },
+          {
+            width: 120,
+            prop: 'specification',
+            label: '规格',
+            slot: 'specification'
+          },
+
+          {
+            width: 160,
+            prop: 'singlePrice',
+            label: '单价',
+            slot: 'singlePrice'
+          },
+          {
+            width: 120,
+            prop: 'totalCount',
+            label: '数量',
+            slot: 'totalCount'
+          },
+          {
+            width: 120,
+            prop: 'totalPrice',
+            label: '销售总金额',
+            slot: 'totalPrice',
+            formatter: (_row, _column, cellValue) => {
+              return _row.totalPrice + '元';
+            }
+          },
+          {
+            width: 120,
+            prop: 'measuringUnit',
+            label: '计量单位',
+            slot: 'measuringUnit'
+          },
+          {
+            width: 120,
+            prop: 'deliveryDays',
+            label: '交期(天)',
+            slot: 'deliveryDays'
+          },
+          {
+            width: 160,
+            prop: 'deliveryDeadline',
+            label: '交期截止日期',
+            slot: 'deliveryDeadline'
+          },
+          {
+            width: 200,
+            prop: 'guaranteePeriod',
+            label: '质保期',
+            slot: 'guaranteePeriod',
+            formatter: (_row, _column, cellValue) => {
+              return _row.guaranteePeriod + _row.guaranteePeriodUnitName;
+            }
+          },
+          {
+            width: 160,
+            prop: 'guaranteePeriodDeadline',
+            label: '质保截止日期',
+            slot: 'guaranteePeriodDeadline'
+          },
+          // {
+          //   width: 120,
+          //   prop: 'guaranteePeriodUnitCode',
+          //   label: '',
+          //   slot: 'guaranteePeriodUnitCode'
+          // },
+          {
+            width: 240,
+            prop: 'customerReqFiles',
+            label: '客户需求',
+            slot: 'customerReqFiles'
+          },
+          {
+            width: 120,
+            prop: 'technicalAnswerName',
+            label: '技术答疑人',
+            slot: 'technicalAnswerName'
+          },
+          {
+            width: 220,
+            prop: 'technicalParams',
+            label: '技术参数',
+            slot: 'technicalParams'
+          },
+          {
+            width: 240,
+            prop: 'technicalDrawings',
+            label: '技术图纸',
+            slot: 'technicalDrawings',
+            formatter: (_row, _column, cellValue) => {
+              return _row.guaranteePeriod + _row.guaranteePeriodUnitName;
+            }
+          },
+          {
+            width: 220,
+            prop: 'remark',
+            label: '备注',
+            slot: 'remark'
+          }
+        ],
+        columns: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            width: 200,
+            prop: 'productName',
+            label: '名称',
+            slot: 'productName',
+            headerSlot: 'headerProductName'
+          },
+          {
+            width: 120,
+            prop: 'productCode',
+            label: '编码',
+            slot: 'productCode'
+          },
+          {
+            width: 200,
+            prop: 'productCategoryName',
+            label: '类型',
+            slot: 'productCategoryName'
+          },
+          {
+            width: 160,
+            prop: 'productBrand',
+            label: '牌号',
+            slot: 'productBrand'
+          },
+          {
+            width: 120,
+            prop: 'modelType',
+            label: '型号',
+            slot: 'modelType'
+          },
+          {
+            width: 120,
+            prop: 'specification',
+            label: '规格',
+            slot: 'specification'
+          },
+
+          {
+            width: 80,
+            prop: 'totalCount',
+            label: '数量',
+            slot: 'totalCount',
+            headerSlot: 'headerTotalCount'
+          },
+          {
+            width: 80,
+            prop: 'measuringUnit',
+            label: '计量单位',
+            slot: 'measuringUnit'
+          },
+          {
+            width: 160,
+            prop: 'singlePrice',
+            label: '单价',
+            slot: 'singlePrice',
+            headerSlot: 'headerSinglePrice'
+          },
+          {
+            width: 120,
+            prop: 'totalPrice',
+            label: '合计',
+            slot: 'totalPrice'
+          },
+          {
+            width: 80,
+            prop: 'deliveryDays',
+            label: '交期(天)',
+            slot: 'deliveryDays'
+          },
+          {
+            width: 160,
+            prop: 'deliveryDeadline',
+            label: '交期截止日期',
+            slot: 'deliveryDeadline'
+          },
+          {
+            width: 200,
+            prop: 'guaranteePeriod',
+            label: '质保期',
+            slot: 'guaranteePeriod'
+          },
+          {
+            width: 160,
+            prop: 'guaranteePeriodDeadline',
+            label: '质保截止日期',
+            slot: 'guaranteePeriodDeadline'
+          },
+          // {
+          //   width: 120,
+          //   prop: 'guaranteePeriodUnitCode',
+          //   label: '',
+          //   slot: 'guaranteePeriodUnitCode'
+          // },
+          {
+            width: 240,
+            prop: 'customerReqFiles',
+            label: '客户需求',
+            slot: 'customerReqFiles'
+          },
+          {
+            width: 130,
+            prop: 'technicalAnswerName',
+            label: '技术答疑人',
+            slot: 'technicalAnswerName'
+          },
+          {
+            width: 220,
+            prop: 'technicalParams',
+            label: '技术参数',
+            slot: 'technicalParams'
+          },
+          {
+            width: 240,
+            prop: 'technicalDrawings',
+            label: '技术图纸',
+            slot: 'technicalDrawings'
+          },
+          {
+            width: 220,
+            prop: 'remark',
+            label: '备注',
+            slot: 'remark'
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 120,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            fixed: 'right',
+            showOverflowTooltip: true
+          }
+        ]
+      };
+    },
+    computed: {
+      canHandl() {
+        return this.form.datasource.length;
+      },
+      contractId() {
+        return this.$store.state.order.contractId;
+      }
+    },
+    methods: {
+      // 返回列表数据
+      getTableValue() {
+        let comitDatasource = this.form.datasource;
+        if (comitDatasource.length === 0) return [];
+        comitDatasource.forEach((v) => {
+          v.totalPrice = (v.totalCount * v.singlePrice)?.toFixed(2) || 0;
+          v.guaranteePeriodUnitName = this.getDictValue(
+            '质保期单位',
+            v.guaranteePeriodUnitCode
+          );
+          v.technicalDrawings = Array.isArray(v.technicalDrawings)
+            ? v.technicalDrawings
+            : [];
+          v.customerReqFiles = Array.isArray(v.customerReqFiles)
+            ? v.customerReqFiles
+            : [];
+        });
+        return comitDatasource;
+      },
+      getPrice() {
+        return [this.allPrice];
+      },
+      //计算总金额
+      getTotalPrice() {
+        if (this.form.datasource.length) {
+          let datasource = this.form.datasource,
+            sum = 0;
+          datasource.forEach((r) => {
+            if (r.singlePrice && r.totalCount) {
+              sum += r.singlePrice * r.totalCount;
+            }
+          });
+          let allsum = sum.toFixed(2);
+          this.allPrice = allsum;
+          this.$store.commit('order/setAllcountAmount', allsum);
+        } else {
+          this.allPrice = 0.0;
+        }
+      },
+      setDeliveryDays(row, index, type) {
+        if (type == 'deliveryDays') {
+          this.$set(
+            this.form.datasource[index],
+            'deliveryDeadline',
+            this.setDay(row.deliveryDays)
+          );
+        }
+        if (type == 'guaranteePeriod') {
+          let guaranteePeriodUnitName = this.guaranteePeriodUnit(
+            row.guaranteePeriodUnitCode
+          );
+          this.$set(
+            this.form.datasource[index],
+            'guaranteePeriodDeadline',
+            guaranteePeriodUnitName != 'second'
+              ? this.setDay(row.guaranteePeriod, guaranteePeriodUnitName)
+              : ''
+          );
+        }
+      },
+      guaranteePeriodUnit(code) {
+        return code == 3
+          ? 'day'
+          : code == 4
+          ? 'month'
+          : code == 5
+          ? 'year'
+          : 'second';
+      },
+      setDay(addDay, dateType = 'day') {
+        return dayjs(new Date()).add(addDay, dateType).format('YYYY-MM-DD');
+      },
+
+      //修改回显
+      putTableValue(data) {
+        if (data) {
+          this.form.datasource = data;
+        }
+      },
+      //选择产品
+      handParent(row, index) {
+        let item = {
+          id: row.productCode
+        };
+        this.$refs.productListRef.open(item, index);
+      },
+      //选择技术人回调
+      changeAnswer(obj, idx) {
+        this.$set(this.form.datasource[idx], 'technicalAnswerId', obj.id);
+        this.$set(this.form.datasource[idx], 'technicalAnswerName', obj.name);
+      },
+      handHead(row, index) {
+        let item = {
+          id: row.technicalAnswerId
+        };
+        this.$refs.headRef.open(item, index);
+      },
+      //选择产品回调
+      changeParent(obj, idx) {
+        console.log(obj, '33333');
+
+        this.$set(this.form.datasource[idx], 'categoryName', obj.name);
+        this.$set(
+          this.form.datasource[idx],
+          'productCategoryId',
+          obj.categoryLevelId
+        );
+        this.$set(this.form.datasource[idx], 'productBrand', obj.brandNum);
+        this.$set(
+          this.form.datasource[idx],
+          'productCategoryName',
+          obj.categoryLevelPath
+        );
+        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],
+          'measuringUnit',
+          obj.measuringUnit
+        );
+        this.$set(
+          this.form.datasource[idx],
+          'specification',
+          obj.specification
+        );
+      },
+      remove(row) {
+        let index = this.form.datasource.findIndex((n) => n.key == row.key);
+        if (index !== -1) {
+          this.form.datasource.splice(index, 1);
+          this.setSort();
+        }
+      },
+      // 清空表格
+      restTable() {
+        this.form.datasource = [];
+      },
+      // 重新排序
+      setSort() {
+        this.form.datasource.forEach((n, index) => {
+          n.key = index + 1;
+        });
+      },
+      // 添加
+      handlAdd() {
+        let item = JSON.parse(JSON.stringify(this.defaultForm));
+        item.key = this.form.datasource.length + 1;
+        this.form.datasource.push(item);
+      },
+
+      validateForm(callback) {
+        //开始表单校验
+        this.$refs.form.validate((valid) => {
+          callback(valid);
+        });
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  .headbox {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    .amount {
+      font-size: 14px;
+      font-weight: bold;
+      padding-right: 30px;
+    }
+  }
+  .time-form .el-form-item {
+    margin-bottom: 0 !important;
+  }
+
+  ::v-deep .period {
+    display: flex;
+    .borderleftnone {
+      .el-input--medium .el-input__inner {
+        border-top-right-radius: 0;
+        border-bottom-right-radius: 0;
+      }
+    }
+    .borderrightnone {
+      .el-input--medium .el-input__inner {
+        border-top-left-radius: 0;
+        border-bottom-left-radius: 0;
+      }
+    }
+  }
+
+  ::v-deep .time-form tbody > tr:hover > td {
+    background-color: transparent !important;
+  }
+  ::v-deep .time-form .el-table tr {
+    background-color: #ffffff;
+  }
+
+  .pricebox {
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+    font-weight: bold;
+  }
+</style>

+ 141 - 166
src/views/bpm/handleTask/components/saleOrder/returnGoods/addReturnGoodsDialog.vue

@@ -17,6 +17,38 @@
             />
           </el-form-item>
 
+          <el-form-item
+            label="退货类型"
+            prop="type"
+            style="margin-bottom: 22px"
+          >
+            <DictSelection
+              dictName="退货类型"
+              clearable
+              v-model="form.type"
+              @change="onchangeLink"
+              :disabled="taskDefinitionKey != 'QCLeader'"
+            >
+            </DictSelection>
+          </el-form-item>
+          <el-form-item
+            label="赔偿金额"
+            prop="redressAmount"
+            style="margin-bottom: 22px"
+            v-show="['30', '50'].includes(form.type)"
+          >
+            <el-input
+              clearable
+              v-model="form.redressAmount"
+              placeholder="请输入"
+            />
+          </el-form-item>
+          <el-form-item label="赔偿总金额" style="margin-bottom: 22px">
+            {{ totalAmount }}元
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
           <el-form-item
             label="退货备注"
             prop="remark"
@@ -29,17 +61,7 @@
               placeholder="请输入"
             />
           </el-form-item>
-          <el-form-item prop="repliedFiles" label="回执附件">
-            <fileUpload
-              v-model="form.repliedFiles"
-              module="main"
-              :showLib="false"
-              :limit="10"
-            />
-          </el-form-item>
-        </el-col>
 
-        <el-col :span="12">
           <el-form-item
             label="客户名称"
             prop="contactName"
@@ -56,18 +78,42 @@
               :limit="10"
             />
           </el-form-item>
+          <el-form-item prop="repliedFiles" label="回执附件">
+            <fileUpload
+              v-model="form.repliedFiles"
+              module="main"
+              :showLib="false"
+              :limit="10"
+            />
+          </el-form-item>
         </el-col>
       </el-row>
 
-      <headerTitle title="产品清单" style="margin-top: 30px"></headerTitle>
+      <headerTitle
+        v-if="['10', '20', '30'].includes(form.type)"
+        title="产品清单"
+        style="margin-top: 30px"
+      ></headerTitle>
       <inventoryTable
+        v-show="['10', '20', '30'].includes(form.type)"
         ref="inventoryTableref"
         :sendId="form.sendId"
-       
+        :type="form.type"
+        @payAmountChange="payAmountChange"
       ></inventoryTable>
- 
+      <headerTitle
+        title="实物赔偿清单"
+        v-show="['20', '40'].includes(form.type)"
+        style="margin-top: 30px"
+      ></headerTitle>
+      <inventoryTable1
+        v-show="['20', '40'].includes(form.type)"
+        ref="inventoryTableref1"
+        :sendId="form.sendId"
+        :isSinglePrice="false"
+      ></inventoryTable1>
 
-      <el-row style="margin-top: 20px">
+      <!-- <el-row style="margin-top: 20px">
         <el-col :span="12">
           <el-form-item
             label="总金额"
@@ -86,7 +132,7 @@
             <el-input clearable v-model="form.payAmount" placeholder="请输入" />
           </el-form-item>
         </el-col>
-      </el-row>
+      </el-row> -->
     </el-form>
 
     <sendListDialog
@@ -105,6 +151,7 @@
     getSendSaleOrderrecordDetail
   } from '@/api/bpm/components/saleManage/saleorder';
   import inventoryTable from './inventoryTable.vue';
+  import inventoryTable1 from '@/views/bpm/handleTask/components/contractBook/inventoryTable.vue';
   import sendListDialog from './sendListDialog.vue';
   import { copyObj } from '@/utils/util';
 
@@ -113,12 +160,16 @@
     components: {
       fileUpload,
       sendListDialog,
-      inventoryTable
+      inventoryTable,
+      inventoryTable1
     },
     props: {
       businessId: {
         default: ''
       },
+      taskDefinitionKey: {
+        default: ''
+      }
     },
 
     data() {
@@ -130,7 +181,9 @@
         remark: '',
         sendId: '',
         sendNo: '',
-        totalAmount: ''
+        totalAmount: '',
+        type: '',
+        redressAmount: 0
       };
 
       return {
@@ -139,6 +192,7 @@
         delDetailIds: [],
         linkNameOptions: [],
         visible: false,
+        payAmount1: '',
         title: '',
         row: {},
         activeName: 'base',
@@ -150,144 +204,18 @@
         groupTreeData: [],
         groupData: [],
         rules: {
-          partaName: [
-            { required: true, message: '请选择客户名称', trigger: 'change' }
+          sendNo: [
+            { required: true, message: '请选择发货单', trigger: 'change' }
           ],
-          payAmount: [
+          type: [
             {
-              required: true,
-              pattern: numberReg,
-              message: '请输入数字',
-              trigger: 'blur'
+              required: this.taskDefinitionKey == 'QCLeader' ? true : false,
+              message: '请选择退货类型',
+              trigger: 'change'
             }
           ]
         },
-        competAnalysisListcolumns: [
-          {
-            width: 45,
-            type: 'index',
-            columnKey: 'index',
-            align: 'center',
-            fixed: 'left'
-          },
-          {
-            width: 200,
-            prop: 'productName',
-            label: '名称',
-            slot: 'productName'
-          },
-          {
-            width: 120,
-            prop: 'productCode',
-            label: '编码',
-            slot: 'productCode'
-          },
-          {
-            width: 200,
-            prop: 'productCategoryName',
-            label: '类型',
-            slot: 'productCategoryName'
-          },
-          {
-            width: 160,
-            prop: 'productBrand',
-            label: '牌号',
-            slot: 'productBrand'
-          },
-          {
-            width: 120,
-            prop: 'modelType',
-            label: '型号',
-            slot: 'modelType'
-          },
-          {
-            width: 120,
-            prop: 'specification',
-            label: '规格',
-            slot: 'specification'
-          },
-
-          {
-            width: 120,
-            prop: 'sendTotalCount',
-            label: '发货数量',
-            slot: 'sendTotalCount'
-          },
 
-          {
-            width: 120,
-            prop: 'totalCount',
-            label: '退货数量',
-            slot: 'totalCount'
-          },
-          {
-            width: 80,
-            prop: 'measuringUnit',
-            label: '计量单位',
-            slot: 'measuringUnit'
-          },
-          {
-            width: 160,
-            prop: 'singlePrice',
-            label: '单价',
-            slot: 'singlePrice'
-          },
-          {
-            width: 120,
-            prop: 'totalPrice',
-            label: '合计',
-            slot: 'totalPrice'
-          },
-
-          {
-            width: 200,
-            prop: 'returnReason',
-            label: '退货原因',
-            slot: 'returnReason'
-          },
-          {
-            width: 140,
-            prop: 'returnType',
-            label: '退货类型',
-            slot: 'returnType',
-            formatter: (_row, _column) => {
-              this.getDictValue('退货类型', _row.returnType + '');
-            }
-          },
-          {
-            width: 120,
-            prop: 'deliveryDays',
-            label: '交期(天)',
-            slot: 'deliveryDays'
-          },
-          {
-            width: 120,
-            prop: 'technicalAnswerName',
-            label: '技术答疑人',
-            slot: 'technicalAnswerName'
-          },
-          {
-            width: 220,
-            prop: 'technicalParams',
-            label: '技术参数',
-            slot: 'technicalParams'
-          },
-          {
-            width: 240,
-            prop: 'technicalDrawings',
-            label: '技术图纸',
-            slot: 'technicalDrawings',
-            formatter: (_row, _column, cellValue) => {
-              return _row.guaranteePeriod + _row.guaranteePeriodUnitName;
-            }
-          },
-          {
-            width: 220,
-            prop: 'remark',
-            label: '备注',
-            slot: 'remark'
-          }
-        ],
         // 提交状态
         loading: false,
         // 是否是修改
@@ -296,11 +224,18 @@
     },
     computed: {
       totalAmount() {
-        let allcountAmount = this.$store.state.returnGoods.allcountAmount;
-        if (!this.$store.state.isDefaultPayableAmount) {
-          this.form.payAmount = allcountAmount;
+        let allcountAmount = 0;
+        if (this.form.type === '10' || this.form.type === '20') {
+          allcountAmount = this.form.payAmount;
+        }
+        if (this.form.type === '30') {
+          allcountAmount =
+            Number(this.form.payAmount) + Number(this.form.redressAmount);
         }
 
+        if (this.form.type === '50') {
+          allcountAmount = Number(this.form.redressAmount);
+        }
         return allcountAmount;
       }
     },
@@ -317,6 +252,9 @@
           this.form.productList.splice(index, 1);
         }
       },
+      payAmountChange(val) {
+        this.form.payAmount = val;
+      },
 
       //选择订单回调
       changeOrder(obj) {
@@ -334,6 +272,10 @@
         const data = await getSendSaleOrderrecordDetail(id);
         this.loading = false;
         if (data) {
+          data.productList.forEach((item) => {
+            item.sendProductId = item.id;
+            item.id = '';
+          });
           this.$nextTick(() => {
             this.form = Object.assign({}, this.form, {
               orderId: data.orderId,
@@ -357,6 +299,8 @@
             this.form = data;
             this.$refs.inventoryTableref &&
               this.$refs.inventoryTableref.putTableValue(data.productList);
+            this.$refs.inventoryTableref1 &&
+              this.$refs.inventoryTableref1.putTableValue(data);
           });
         }
       },
@@ -383,6 +327,33 @@
       },
 
       getValidate() {
+        let arr = [];
+        if (['10', '20', '30'].includes(this.form.type)) {
+          arr.push(
+            new Promise((resolve, reject) => {
+              this.$refs.inventoryTableref.validateForm((valid) => {
+                if (!valid) {
+                  reject(false);
+                } else {
+                  resolve(true);
+                }
+              });
+            })
+          );
+        }
+        if (['20', '40'].includes(this.form.type)) {
+          arr.push(
+            new Promise((resolve, reject) => {
+              this.$refs.inventoryTableref1.validateForm((valid) => {
+                if (!valid) {
+                  reject(false);
+                } else {
+                  resolve(true);
+                }
+              });
+            })
+          );
+        }
         return Promise.all([
           new Promise((resolve, reject) => {
             this.$refs.form.validate((valid) => {
@@ -393,33 +364,37 @@
               }
             });
           }),
-          new Promise((resolve, reject) => {
-            this.$refs.inventoryTableref.validateForm((valid) => {
-              if (!valid) {
-                reject(false);
-              } else {
-                resolve(true);
-              }
-            });
-          })
+          ...arr
         ]);
       },
+      onchangeLink() {
+        this.getSendSaleOrderDetail(this.form.sendId);
+        console.log(this.form, 'this.form');
+      },
+
       async getTableValue() {
+
         try {
           await this.getValidate();
           // 表单验证通过,执行保存操作
           this.loading = true;
-
-          let productList = this.$refs.inventoryTableref.getTableValue();
-          if (productList.length === 0) {
+          let data = this.$refs.inventoryTableref.getTableValue();
+          let redressProductList =
+            (this.$refs.inventoryTableref1 &&
+              this.$refs.inventoryTableref1.getTableValue()) ||
+            [];
+          if (data.productList.length === 0) {
             return this.$message.error('至少选择一个退货产品');
           }
+          this.form.typeName = this.getDictValue('退货类型', this.form.type);
           this.form.repliedFiles = this.form.repliedFiles || [];
           this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
           let commitData = Object.assign({}, this.form, {
-            totalAmount: Number(this.totalAmount),
-            productList
+            totalAmount: this.totalAmount,
+            productList: data.productList,
+            redressProductList
           });
+          console.log(commitData);
 
           return commitData;
         } catch (error) {

+ 95 - 10
src/views/bpm/handleTask/components/saleOrder/returnGoods/detailDialog.vue

@@ -11,16 +11,23 @@
           >
             {{ form.contactName }}
           </el-form-item>
-
           <el-form-item
-            label="金额:"
-            prop="payAmount"
+            label="退货类型:"
+            prop="contactName"
             style="margin-bottom: 16px"
           >
-            {{ form.payAmount }}元
+            {{ form.typeName }}
           </el-form-item>
           <el-form-item
-            label="总金额:"
+            label="赔偿金额:"
+            prop="redressAmount"
+            style="margin-bottom: 16px"
+            v-show="['30', '50'].includes(form.type)"
+          >
+            {{ form.redressAmount }}元
+          </el-form-item>
+          <el-form-item
+            label="赔偿总金额:"
             prop="totalAmount"
             style="margin-bottom: 16px"
           >
@@ -98,7 +105,9 @@
             prop="sendFiles"
             style="margin-bottom: 16px"
           >
-            <div v-if="detailData.repliedFiles && detailData.repliedFiles?.length">
+            <div
+              v-if="detailData.repliedFiles && detailData.repliedFiles?.length"
+            >
               <el-link
                 v-for="link in detailData.repliedFiles"
                 :key="link.id"
@@ -114,8 +123,20 @@
       </el-row>
     </el-form>
 
-    <headerTitle title="产品清单"></headerTitle>
+    <headerTitle
+      title="产品清单"
+      v-show="
+        taskDefinitionKey == 'starter' ||
+        taskDefinitionKey == 'deptLeader' ||
+        ['10', '20', '30'].includes(form.type)
+      "
+    ></headerTitle>
     <ele-pro-table
+      v-show="
+        taskDefinitionKey == 'starter' ||
+        taskDefinitionKey == 'deptLeader' ||
+        ['10', '20', '30'].includes(form.type)
+      "
       ref="table"
       :needPage="false"
       :columns="competAnalysisListcolumns"
@@ -143,7 +164,26 @@
         </div>
       </template>
     </ele-pro-table>
-
+    <headerTitle
+      title="实物赔偿清单"
+      v-show="['20', '40'].includes(form.type)"
+      style="margin-top: 30px"
+    ></headerTitle>
+    <inventoryTabledetail
+      v-if="
+        ['20', '40'].includes(form.type) && taskDefinitionKey != 'produceLeader'
+      "
+      ref="inventoryTabledetailRef"
+      :isSinglePrice="false"
+    ></inventoryTabledetail>
+    <inventoryTable
+      v-if="
+        ['20', '40'].includes(form.type) && taskDefinitionKey == 'produceLeader'
+      "
+      ref="inventoryTabledetailRef"
+      :isSinglePrice="false"
+      :taskDefinitionKey="taskDefinitionKey"
+    ></inventoryTable>
   </div>
 </template>
 
@@ -152,9 +192,15 @@
   import { getFile } from '@/api/system/file';
   import dictMixins from '@/mixins/dictMixins';
   import { reviewStatusEnum } from '@/enum/dict';
+  import inventoryTabledetail from '@/views/bpm/handleTask/components/contractBook/inventoryTabledetail.vue';
+  import inventoryTable from '@/views/bpm/handleTask/components/contractBook/inventoryTable.vue';
 
   export default {
     mixins: [dictMixins],
+    components: {
+      inventoryTabledetail,
+      inventoryTable
+    },
     data() {
       return {
         codeData: [],
@@ -301,6 +347,9 @@
     props: {
       businessId: {
         default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
       }
     },
     created() {
@@ -310,8 +359,40 @@
       downloadFile(file) {
         getFile({ objectName: file.storePath }, file.name);
       },
-      getTableValue() {
-        return this.detailData;
+      async getTableValue() {
+        console.log(await this.getValidate());
+        try {
+          await this.getValidate();
+          // 表单验证通过,执行保存操作
+          this.loading = true;
+
+          let redressProductList =
+            (this.$refs.inventoryTabledetailRef &&
+              this.$refs.inventoryTabledetailRef.getTableValue()) ||
+            [];
+
+          let commitData = Object.assign({}, this.form, {
+            redressProductList
+          });
+          return commitData;
+        } catch (error) {
+          console.log(error);
+          // 表单验证未通过,不执行保存操作
+        }
+      },
+
+      getValidate() {
+        return Promise.all([
+          new Promise((resolve, reject) => {
+            this.$refs.inventoryTabledetailRef.validateForm((valid) => {
+              if (!valid) {
+                reject(false);
+              } else {
+                resolve(true);
+              }
+            });
+          })
+        ]);
       },
       async getDetailData(id) {
         this.loading = true;
@@ -320,6 +401,10 @@
         if (data) {
           this.detailData = data;
           this.form = data;
+          this.$nextTick(() => {
+            this.$refs.inventoryTabledetailRef &&
+              this.$refs.inventoryTabledetailRef.putTableValue(data);
+          });
         }
       }
     }

+ 55 - 39
src/views/bpm/handleTask/components/saleOrder/returnGoods/inventoryTable.vue

@@ -18,9 +18,23 @@
             icon="el-icon-plus"
             class="ele-btn-icon"
             @click="handlAdd"
+            v-if="type != '10'"
           >
             新增
           </el-button>
+          <div class="pricebox">
+            <span class="amount">合计{{ totalAmount }}元</span>
+            <span>优惠合计:</span>
+            <el-input
+              v-model="payAmount"
+              style="width: 150px"
+              placeholder="请输入"
+            >
+              <!-- @input="discountInput" -->
+
+              <template slot="append">元</template></el-input
+            >
+          </div>
         </div>
       </template>
       <template v-slot:technicalDrawings="{ row, $index }">
@@ -54,18 +68,7 @@
           />
         </el-form-item>
       </template>
-      <template v-slot:returnType="{ row, $index }">
-        <el-form-item
-          style="margin-bottom: 20px"
-          :prop="'datasource.' + $index + '.returnType'"
-        >
-          <DictSelection
-            dictName="退货类型"
-            clearable
-            v-model="row.returnType"
-          />
-        </el-form-item>
-      </template>
+
       <template v-slot:totalCount="scope">
         <el-form-item
           style="margin-bottom: 20px"
@@ -82,10 +85,10 @@
         </el-form-item>
       </template>
       <template v-slot:headerTotalCount="{ column }">
-          <span class="is-required">{{ column.label }}</span>
-        </template>
+        <span class="is-required">{{ column.label }}</span>
+      </template>
       <!-- 操作列 -->
-      <template v-slot:action="{ row }">
+      <template v-slot:action="{ row }" v-if="type != '10'">
         <el-popconfirm
           class="ele-action"
           title="确定要删除吗?"
@@ -103,7 +106,6 @@
       ref="productListRef"
       :orderId="sendId"
       type="send"
-
       @changeParent="changeParent"
     ></product-list>
   </el-form>
@@ -113,14 +115,14 @@
   import dictMixins from '@/mixins/dictMixins';
   import productList from '@/views/bpm/handleTask/components/saleOrder/invoice/product-list.vue';
 
-  import {
-    getWarehouseOutStock
-  } from '@/api/bpm/components/saleManage/saleorder';
+  import { getWarehouseOutStock } from '@/api/bpm/components/saleManage/saleorder';
   export default {
     mixins: [dictMixins],
     props: {
       sendId: String,
-     
+      type: {
+        default: ''
+      }
     },
     components: {
       productList
@@ -136,6 +138,7 @@
         technicalDrawings: []
       };
       return {
+        payAmount: '',
         discountTotalPrice: 0.0,
         allPrice: 0.0,
         numberReg,
@@ -213,7 +216,7 @@
             prop: 'totalCount',
             label: '退货数量',
             slot: 'totalCount',
-            headerSlot: 'headerTotalCount',
+            headerSlot: 'headerTotalCount'
           },
           {
             width: 80,
@@ -239,12 +242,12 @@
             label: '退货原因',
             slot: 'returnReason'
           },
-          {
-            width: 140,
-            prop: 'returnType',
-            label: '退货类型',
-            slot: 'returnType'
-          },
+          // {
+          //   width: 140,
+          //   prop: 'returnType',
+          //   label: '退货类型',
+          //   slot: 'returnType'
+          // },
 
           // {
           //   width: 80,
@@ -296,7 +299,20 @@
         ]
       };
     },
-  
+    computed: {
+      totalAmount() {
+        let allcountAmount = this.$store.state.returnGoods.allcountAmount;
+        if (!this.$store.state.isDefaultPayableAmount) {
+          this.payAmount = allcountAmount;
+        }
+        return allcountAmount;
+      }
+    },
+    watch:{
+      payAmount(n){
+        this.$emit('payAmountChange',n)
+      }
+    },
     methods: {
       //修改数量更新合计
       changeNum(val, index) {
@@ -327,7 +343,7 @@
         console.log(obj, '9999');
         obj.sendTotalCount = obj.totalCount;
         obj.sendProductId = obj.id;
-        obj.id = ''
+        obj.id = '';
 
         if (obj.warehouseId) {
           obj['warehouseNum'] = await getWarehouseOutStock({
@@ -350,11 +366,13 @@
           }
         };
       },
-      getTotalCount(row){
-        let num=0;
-        this.form.datasource.filter(item=>item.warehouseId==row.warehouseId).forEach(item=>{
-          num+=Number(item.totalCount)
-        })
+      getTotalCount(row) {
+        let num = 0;
+        this.form.datasource
+          .filter((item) => item.warehouseId == row.warehouseId)
+          .forEach((item) => {
+            num += Number(item.totalCount);
+          });
 
         return num;
       },
@@ -368,23 +386,21 @@
             ? v.technicalDrawings
             : [];
         });
-        return comitDatasource;
+        return {productList:comitDatasource,payAmount:this.payAmount};
       },
       getPrice() {
         return [this.allPrice];
       },
+      
 
       //修改回显
       putTableValue(data) {
         if (data && data?.length) {
-         
-
           data.forEach((v) => {
             v.returnReason = v.returnReason || '';
             v.returnType = v.returnType || '';
             v.sendTotalCount = v.sendTotalCount || v.totalCount;
-            v.sendProductId = v.sendProductId ||v.id;
-
+            v.sendProductId = v.sendProductId || v.id;
           });
 
           this.form.datasource = data;

+ 31 - 40
src/views/bpm/handleTask/components/saleOrder/returnGoods/submit.vue

@@ -26,18 +26,14 @@
         @click="handleAudit(1)"
         >通过
       </el-button>
-      <!-- <el-button
+      <el-button
         icon="el-icon-circle-close"
         type="danger"
         size="mini"
         @click="handleAudit(0)"
-        v-if="
-          ['productionSupervisorApprove', 'deptLeaderApprove'].includes(
-            taskDefinitionKey
-          )
-        "
+        v-if="!['starter'].includes(taskDefinitionKey)"
         >驳回
-      </el-button> -->
+      </el-button>
 
       <!-- <el-button
         icon="el-icon-circle-close"
@@ -69,7 +65,8 @@
 <script>
   import {
     UpdateReturnInformation,
-    getWarehouseListByIds
+    getWarehouseListByIds,
+    approve
   } from '@/api/bpm/components/saleManage/saleorder';
   import { approveTaskWithVariables } from '@/api/bpm/task';
   import { listAllUserBind } from '@/api/system/organization';
@@ -123,55 +120,49 @@
       },
 
       async handleAudit(status) {
-        let storemanIds = '';
+        let returnType = '';
         //发起人补充
-        if (
-          this.taskDefinitionKey === 'starter' ||
-          this.taskDefinitionKey === 'salesmanUploadReceipt'
-        ) {
+        if (this.taskDefinitionKey === 'starter') {
           let arr = await this.getTableValue();
           if (!arr) {
             return;
           }
-          if (
-            this.taskDefinitionKey === 'salesmanUploadReceipt' &&
-            arr.replied === 0
-          ) {
-            this.$message.error('回执附件不能为空');
+          let data = await UpdateReturnInformation(arr);
+          if (data.code != '0') {
+            return;
+          }
+        }
+
+        if (this.taskDefinitionKey === 'QCLeader') {
+          let arr = await this.getTableValue();
+          if (!arr) {
             return;
           }
           let data = await UpdateReturnInformation(arr);
           if (data.code != '0') {
             return;
           }
+          returnType = arr.type;
         }
-
-        if (this.taskDefinitionKey === 'productionSupervisorApprove') {
+        if (this.taskDefinitionKey === 'produceLeader') {
           let arr = await this.getTableValue();
-          let ids = arr.productList.map((item) => item.warehouseId);
-          let data = await getWarehouseListByIds(ids || []);
-
-          storemanIds = data.map((item) => item.ownerId);
+          if (!arr) {
+            return;
+          }
+          let data = await UpdateReturnInformation(arr);
+          if (data.code != '0') {
+            return;
+          }
+          
         }
-        this._approveTaskWithVariables(
-          status,
-          storemanIds.length > 0
-            ? Array.from(new Set(storemanIds)).toString()
-            : ''
-        );
+        this.approveTaskWithVariables(status, returnType);
       },
-      async _approveTaskWithVariables(status, storemanIds) {
-        let variables = {
-          pass: !!status
-        };
-        if (storemanIds) {
-          variables['storemanIds'] = storemanIds;
-        }
-
-        approveTaskWithVariables({
+      async approveTaskWithVariables(status, returnType) {
+        approve({
           id: this.taskId,
           reason: this.form.reason,
-          variables
+          operateType: status == 0 ? 2 : 1,
+          returnType
         }).then((res) => {
           if (res.data.code != '-1') {
             this.$emit('handleAudit', {