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

feat(冲差单): 新增冲差单功能并优化相关组件

liujt 10 месяцев назад
Родитель
Сommit
62ed6f4ceb

+ 16 - 1
src/BIZComponents/inventoryTableDetails.vue

@@ -12,6 +12,7 @@
       @columns-change="handleColumnChange"
       @selection-change="handleSelectionChange"
       :cache-key="cacheKeyUrl"
+      @done="handleDone"
     >
       <!-- 原有插槽 -->
       <template v-slot:technicalDrawings="scope">
@@ -272,10 +273,18 @@
         type: Boolean,
         default: false
       },
+      // 是否勾选
       isSelected: {
         type: Boolean,
         default: false
-      }
+      },
+      // 选中的列表返显
+      selectedList: {
+        type: Array,
+        default: () => {
+          return [];
+        }
+      },
     },
     data() {
       return {
@@ -857,6 +866,12 @@
       this.requestDict('商品价格类型');
     },
     methods: {
+      handleDone() {
+        if(this.isSelected) {
+          let ids = this.selectedList.map((item) => item.sourceDetailId);
+          this.$refs.table.setSelectedRowKeys(ids);
+        }
+      },
       handleSelectionChange(val) {
         console.log(val, 'val');
         this.$emit('selection-change', val);

+ 57 - 0
src/api/saleManage/adjustmentNote‌.js

@@ -0,0 +1,57 @@
+import request from '@/utils/request';
+
+/**
+ * 获取冲差单列表
+ */
+export async function getTableList(params) {
+  const res = await request.get(`/eom/punchSlipOrder/v1/page`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+/**
+ * 新增信息
+ */
+export async function addCreate(data) {
+  const res = await request.post(`/eom/punchSlipOrder/v1/create`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+} 
+
+/**
+ * 获取详情
+ */
+export async function getInfo(id) {
+  const res = await request.get(`/eom/punchSlipOrder/v1/get/${id}`, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 更新详情
+ */
+export async function updateInfo(data) {
+  const res = await request.patch(`/eom/punchSlipOrder/v1/update/${data.id}`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 删除事项
+ */
+export async function deleteInfo(id) {
+  const res = await request.delete(`/eom/punchSlipOrder/v1/delete/${id}`, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 181 - 509
src/views/saleManage/saleOrder/adjustmentNote‌/components/addAdjustDialog.vue

@@ -12,12 +12,12 @@
     @close="handleClose"
   >
     <div style="margin-bottom: 20px;">
-      <el-alert
+      <!-- <el-alert
         title="目前冲差功能仅适用于销售订单已审核,未执行发货的情况"
         type="warning"
         center
         show-icon>
-      </el-alert>
+      </el-alert> -->
     </div>
     <el-form
       ref="form"
@@ -27,9 +27,9 @@
       label-width="160px"
     >
       <headerTitle title="基本信息"></headerTitle>
-      <el-row>
-        <el-col :span="12">
-          <el-form-item label="冲差单编码" prop="returnSourceType">
+      <el-row :gutter="20">
+        <el-col :span="8">
+          <el-form-item labelWidth="100px" label="冲差单编码" prop="orderNo">
             <el-input
               clearable
               v-model="form.orderNo"
@@ -38,8 +38,9 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="12">
+        <el-col :span="8">
           <el-form-item
+             labelWidth="100px"
             label="冲差类型"
             prop="type"
           >
@@ -53,8 +54,9 @@
           </el-form-item>
         </el-col>
 
-        <el-col :span="12">
+        <el-col :span="8">
           <el-form-item
+            labelWidth="100px"
             label="冲差原因"
             prop="reason"
           >
@@ -62,27 +64,26 @@
               dictName="冲差原因"
               clearable
               v-model="form.reason"
-              @change="handleSetReturnSourceType"
             >
             </DictSelection>
           </el-form-item>
         </el-col>
 
-        <el-col :span="12">
-          <el-form-item label="冲差方式" prop="method">
+        <el-col :span="8">
+          <el-form-item labelWidth="100px" label="冲差方式" prop="method">
             <DictSelection
               dictName="冲差方式"
               disabled
               clearable
               v-model="form.method"
-              @change="handleSetReturnSourceType"
             >
             </DictSelection>
           </el-form-item>
         </el-col>
 
-        <el-col :span="12">
+        <el-col :span="8">
           <el-form-item
+            labelWidth="100px"
             label="调整类型"
             prop="adjustType"
           >
@@ -94,31 +95,32 @@
             </DictSelection>
           </el-form-item>
         </el-col>
-        <el-col :span="12">
-          <el-form-item label="冲差范围" prop="range">
+        <el-col :span="8">
+          <el-form-item labelWidth="100px" label="冲差范围" prop="rangeType">
             <DictSelection
               dictName="冲差范围"
               clearable
-              v-model="form.range"
+              v-model="form.rangeType"
             >
             </DictSelection>
           </el-form-item>
         </el-col>
       </el-row>
       <el-row>
-        <el-col :span="24">
-          <el-form-item label="调整说明" prop="remark">
+        <el-col :span="16">
+          <el-form-item labelWidth="100px" label="调整说明" prop="remark">
             <el-input
               clearable
               v-model="form.remark"
               type="textarea"
+              rows="1"
               placeholder="请输入"
             />
           </el-form-item>
         </el-col>
 
-        <el-col :span="12">
-          <el-form-item prop="files" label="附件">
+        <el-col :span="8">
+          <el-form-item labelWidth="100px" prop="files" label="附件">
             <fileMain v-model="form.files"></fileMain>
           </el-form-item>
         </el-col>
@@ -128,6 +130,7 @@
         ref="inventoryTableDetailsRef"
         :isDiscountTotalPrice="true"
         :isSelected="true"
+        :selectedList="adjustData"
         @selection-change="handleSelectionChange"
       ></inventoryTableDetails>
       <headerTitle
@@ -135,42 +138,40 @@
         style="margin-top: 30px"
       ></headerTitle>
       <inventoryTable
-        :returnType="form.returnType"
-        :returnSourceType="form.returnSourceType"
-        :entrustedCode="form.entrustedCode"
         ref="inventoryTableRef"
-        :sendId="form.sendId"
-        :sendNo="form.sendNo"
-        :type="form.type"
-        @handleSelectGoods="handleSelectGoods"
-        :orderOption="orderOption"
+        @changePrice="handleChangePrice"
+        @setCountAmount="setCountAmount"
       ></inventoryTable>
       <div style="margin-top: 20px;">
         <el-row :gutter="20">
           <el-col :span="8">
-            <el-form-item label-width="100px" label="总差异金额:" prop="redressAmount">
+            <el-form-item label-width="100px" label="总差异金额:" prop="differenceAmount">
               <el-input
                 clearable
-                v-model="form.redressAmount"
+                v-model="form.differenceAmount"
+                disabled
                 placeholder="请输入"
               />
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label-width="100px" label="总金额:" prop="redressAmount">
+            <el-form-item label-width="100px" label="总金额:" prop="adjustAmount">
               <el-input
                 clearable
-                v-model="form.redressAmount"
+                disabled
+                v-model="form.adjustAmount"
                 placeholder="请输入"
               />
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label-width="100px" label="优惠后总金额:" prop="redressAmount">
+            <el-form-item label-width="100px" label="优惠后总金额:" prop="adjustDiscountAmount">
               <el-input
                 clearable
-                v-model="form.redressAmount"
+                type="number"
+                v-model="form.adjustDiscountAmount"
                 placeholder="请输入"
+                @input="discountInput"
               />
             </el-form-item>
           </el-col>
@@ -207,28 +208,18 @@
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
   import personSelect from '@/components/CommomSelect/person-select.vue';
   import parentList from '@/views/saleManage/contact/components/parentList.vue';
-  import {
-    addReturnInformation,
-    getReturnSaleOrderrecordDetail,
-    UpdateReturnInformation
-  } from '@/api/saleManage/returnGoods';
-  import {
-    getSendSaleOrderrecordDetailSplit
-  } from '@/api/saleManage/saleordersendrecord';
   import inventoryTable from './inventoryTable.vue';
   import { copyObj } from '@/utils/util';
-  import { getPSaleEntrustedReceiveDetailAPI } from '@/api/saleManage/entrustedReceive';
   import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
   import fileMain from '@/components/addDoc/index.vue';
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
   import orderListDialog from '@/views/saleManage/saleOrder/invoice/components/orderListDialog.vue';
   import inventoryTable1 from '@/BIZComponents/inventoryTable.vue';
   import inventoryTableDetails from '@/BIZComponents/inventoryTableDetails.vue';
-  import { getSendSaleOrderConfirmDetail } from '@/api/saleManage/invoiceConfirm';
-  import { contactDetail } from '@/api/saleManage/contact';
   import {
-    getSaleOrderDetail
+    getSaleOrderDetail,
   } from '@/api/saleManage/saleorder';
+  import { addCreate, getInfo, updateInfo } from '@/api/saleManage/adjustmentNote‌';
 
   export default {
     mixins: [dictMixins],
@@ -259,44 +250,32 @@
     },
     data() {
       let formDef = {
+        orderNo: '',
         type: '1',
         method: '1',
         reason: '1',
-        range: '',
+        rangeType: '',
         adjustType: '1',
+        sourceType: '1',
+        sourceNo: '',
+        sourceId: '',
         files: [],
-        repliedFiles: [],
-        remark: '',
-        payAmount: 0,
-        sendId: '',
-        sendNo: '',
-        orderId: '',
-        orderIds: '',
-        orderNo: '',
-        totalAmount: '',
-        returnType: '',
-        pricingWay: '',
-        returnSourceType: 3,
-        isOrderAll: 0,
-        entrustedCode: '',
-        entrustedId: '',
-        entrustedReceiveId: '',
-        entrustedReceiveCode: ''
+        differenceAmount: '',
+        amount: '',
+        discountAmount: '',
+        sourceNo: '',
+        sourceId: '',
+        adjustAmount: '',
+        adjustDiscountAmount: ''
       };
 
       return {
         orderOption: [],
-        fullscreen: false, //全屏
-        customerMark: '',
         oldProductList: [],
         detailData: {},
-        payWayOptions: [],
-        delDetailIds: [],
-        linkNameOptions: [],
         acceptUnpackoptions,
         visible: false,
         processSubmitDialogFlag: false,
-        outboundDetailsDialogFlag1: false,
         title: '',
         row: {},
         activeName: 'base',
@@ -305,8 +284,6 @@
         orderForm: {},
         tableBankData: [],
         tableLinkData: [],
-        // 组织机构树形结构数据
-        groupTreeData: [],
         groupData: [],
         rules: {
           type: [
@@ -314,24 +291,23 @@
           ],
           method: [{ required: true, message: '请选择', trigger: 'change' }],
           reason: [{ required: true, message: '请选择', trigger: 'change' }],
-          range: [{ required: true, message: '请选择', trigger: 'change' }],
+          rangeType: [{ required: true, message: '请选择', trigger: 'change' }],
           adjustType: [{ required: true, message: '请选择', trigger: 'change' }],
           // files: [{ required: true, message: '请上传附件', trigger: 'change' }],
+          adjustDiscountAmount: [{ required: true, message: '请输入', trigger: 'change' }],
         },
         // 提交状态
         loading: false,
         // 是否是修改
         isUpdate: false,
-        entrustedReceiveDialogFlag: false,
         businessId: '',
         orderId: '',
-        outboundDetailsDialogFlag: false,
         productList: [],
         adjustData: [],
       };
     },
-    created() {
-      this.requestDict('产地');
+    async created() {
+    
     },
     computed: {
       totalAmount() {
@@ -373,11 +349,23 @@
     },
 
     methods: {
+      // 选择需要冲差的产品
       handleSelectionChange(list) {
         // this.form.productList = val;
         console.log('select------list', list);
         // 创建深拷贝避免引用关系
-        this.adjustData = JSON.parse(JSON.stringify(list));
+        this.adjustData = JSON.parse(JSON.stringify(list))?.map(item => ({
+          ...item,
+          price: item.singlePrice,
+          adjustPrice: item.singlePrice,
+          quantity: item.saleCount,
+          adjustDiscountPrice: item.discountSinglePrice,
+          adjustDiscountAmount: item.discountTotalPrice,
+          adjustAmount: item.totalPrice,
+          sourceDetailId: item.id,
+          discountPrice: item.discountSinglePrice,
+          unTaxPrice: item.notaxSinglePrice,
+        }));
         
         if (this.$refs.inventoryTableRef) {
           // 获取当前inventoryTable中已有的数据
@@ -396,9 +384,13 @@
             if (existingItemsMap[item.productCode]) {
               // 保留已编辑的字段
               const existingItem = existingItemsMap[item.productCode];
-              item.singlePriceDiff = existingItem.singlePriceDiff !== undefined ? existingItem.singlePriceDiff : item.singlePriceDiff;
-              item.totalCount = existingItem.totalCount !== undefined ? existingItem.totalCount : item.totalCount;
-              item.totalPrice = existingItem.totalPrice !== undefined ? existingItem.totalPrice : item.totalPrice;
+              item.priceDifference = existingItem.priceDifference !== undefined ? existingItem.priceDifference : item.priceDifference;
+              item.adjustPrice = existingItem.adjustPrice !== undefined ? existingItem.adjustPrice : item.adjustPrice;
+              item.quantity = existingItem.quantity !== undefined ? existingItem.quantity : item.quantity;
+              item.adjustDiscountPrice = existingItem.adjustDiscountPrice !== undefined ? existingItem.adjustDiscountPrice : item.adjustDiscountPrice;
+              item.adjustDiscountAmount = existingItem.adjustDiscountAmount !== undefined ? existingItem.adjustDiscountAmount : item.adjustDiscountAmount;
+              item.adjustAmount = existingItem.adjustAmount !== undefined ? existingItem.adjustAmount : item.adjustAmount;
+              item.unTaxPrice = existingItem.unTaxPrice !== undefined ? existingItem.unTaxPrice : item.unTaxPrice;
               
               // 移除已处理的项
               delete existingItemsMap[item.productCode];
@@ -409,6 +401,16 @@
           this.$refs.inventoryTableRef.putTableValue(this.adjustData);
         }
       },
+      // 计算总金额和优惠总金额
+      setCountAmount(allPrice, diffPriceTotal) {
+        this.form.adjustAmount = this.orderForm.totalAmount + Number(diffPriceTotal);
+        this.form.adjustDiscountAmount = this.orderForm.payAmount + Number(diffPriceTotal);
+        this.form.differenceAmount = diffPriceTotal;
+      },
+      // 优惠后总金额修改产品折让单价
+      discountInput() {
+        this.$refs.inventoryTableRef.discountInputByOrder(this.form.adjustDiscountAmount, this.form.amount);
+      },
       //删除产品
       remove(row) {
         if (this.form.productList.length === 1)
@@ -419,365 +421,60 @@
         }
       },
     
-      async contactDetail(id) {
-        const { base } = await contactDetail(id);
-        this.customerMark = base.serialNo;
-        this.$refs.inventoryTableref1.setCustomerMark(base.serialNo);
-      },
-      //设置退货类型
-      handleSetReturnSourceType(val) {
-        this.form = Object.assign({}, this.form, {
-          orderId: '',
-          orderIds: '',
-          sendNo: '',
-          orderNo: '',
-          sendId: '',
-          contactName: '',
-          contactId: '',
-          pricingWay: '',
-          entrustedCode: '',
-          entrustedId: '',
-          entrustedReceiveId: '',
-          entrustedReceiveCode: ''
-        });
-        this.$nextTick(() => {
-          this.$refs.inventoryTableRef &&
-            this.$refs.inventoryTableRef.putTableValue([]);
-          this.$refs.inventoryTableDetailsRef &&
-            this.$refs.inventoryTableDetailsRef.putTableValue([]);
-        });
-      },
-      //选择受托收货单弹框
-      handleEntrustedReceive(e) {
-        if (e.target.nodeName == 'I') {
-          this.form = Object.assign({}, this.form, {
-            carNo: '',
-            carId: '',
-            linkName: '',
-            linkPhone: '',
-            orderNo: '',
-            orderId: '',
-            contactId: '',
-            contactName: '',
-            entrustedCode: '',
-            entrustedId: '',
-            sendNoteNo: '',
-            pricingWay: '',
-            entrustedReceiveId: '',
-            entrustedReceiveCode: ''
-          });
-          this.$refs.inventoryTableRef &&
-            this.$refs.inventoryTableRef.putTableValue([]);
-          return;
-        }
-        this.entrustedReceiveDialogFlag = true;
-        this.$nextTick(() => {
-          this.$refs.entrustedReceiveDialogRef.init();
-        });
-      },
-      //获取受托收货单数据回调
-      async getInfo(row, type) {
-        if (!row.id) {
-          return;
-        }
-        const data = await getPSaleEntrustedReceiveDetailAPI(row.id);
-        if (data) {
-          this.productList = data.productList;
-          if (type) {
-            this.$refs.inventoryTableDetailsRef &&
-              this.$refs.inventoryTableDetailsRef.putTableValue(
-                data.productList.map((item) => {
-                  item['extField'] = item.extField || [];
-                  return item;
-                })
-              );
-            return;
-          }
-
-          this.getOrderOption(data);
-          this.$nextTick(() => {
-            let { code, id, productList, contactId, contactName } = data;
-            if (productList && productList.length > 0) {
-              productList.forEach((v) => {
-                v.orderTotalCount = v.orderTotalCount || v.totalCount;
-              });
-            }
-            this.form = Object.assign({}, this.form, {
-              orderId: data.orderId,
-              orderIds: data.orderIds,
-              sendNo: '',
-              sendId: '',
-              contactName,
-              contactId,
-              entrustedCode: code,
-              entrustedId: id,
-              entrustedReceiveId: id,
-              entrustedReceiveCode: code
-            });
-            this.handleSelectGoods();
-
-            this.$refs.inventoryTableDetailsRef &&
-              this.$refs.inventoryTableDetailsRef.putTableValue(
-                data.productList.map((item) => {
-                  item['extField'] = item.extField || [];
-                  return item;
-                })
-              );
-          });
-        }
-      },
-      //选择发货单回调
-      changeOrder(obj = {}) {
-        this.getSendSaleOrderMultipleDetail(obj);
-      },
-      //多发货单详情
-      async getSendSaleOrderMultipleDetail(params) {
-        this.loading = true;
-        this.productList = [];
-        let data = {},
-          res = {};
-        this.$refs.inventoryTableRef &&
-          this.$refs.inventoryTableRef.putTableValue([]);
-        this.$refs.inventoryTableref1 &&
-          this.$refs.inventoryTableref1.putTableValue({
-            productList: []
-          });
-        if (params.activeName == 1) {
-          data = await getSendSaleOrderrecordDetailSplit(params.id);
-        } else {
-          res = await getSendSaleOrderConfirmDetail(params.id);
-          data = await getSendSaleOrderrecordDetailSplit(res.sendId);
-        }
-        this.loading = false;
-        if (data) {
-          this.getOrderOption(data);
-
-          this.$nextTick(() => {
-            this.setForm(data);
-            if (params.activeName == 2) {
-              this.productList = data.productList;
-              res.productList.forEach((item) => {
-                item['orderId'] = this.orderOption[0]?.orderId;
-                item['orderNo'] = this.orderOption[0]?.orderNo;
-              });
-
-              this.$refs.inventoryTableRef &&
-                this.$refs.inventoryTableRef.putTableValue(res.productList);
-              this.$refs.inventoryTableDetailsRef &&
-                this.$refs.inventoryTableDetailsRef.putTableValue(
-                  data.productList
-                );
-              return;
-            }
-            this.productList = data.productList;
-            if (
-              !['40', '50'].includes(this.form.type) ||
-              this.form.returnSourceType != 1
-            ) {
-              this.handleSelectGoods();
-            }
-
-            this.$refs.inventoryTableDetailsRef &&
-              this.$refs.inventoryTableDetailsRef.putTableValue(
-                data.productList
-              );
-          });
-        }
-      },
-      setForm(data) {
-        data.productList.forEach((item) => {
-          item.sendProductId = item.id;
-          item.id = '';
-        });
-        if (data.contactId) {
-          this.contactDetail(data.contactId);
-        }
-        this.form = Object.assign({}, this.form, {
-          orderIds: data.orderIds || data.orderId,
-          sendNo: data.docNo,
-          orderNo: data.orderNo,
-          sendId: data.id,
-          contactName: data.contactName,
-          contactId: data.contactId,
-          entrustedCode: data.entrustedCode,
-          entrustedId: data.entrustedCode,
-          entrustedReceiveId: '',
-          entrustedReceiveCode: ''
-        });
-      },
-      getOrderOption(data) {
-        if (data.orderIds) {
-          this.orderOption = data.orderIds.split(',').map((item, index) => {
-            return {
-              orderId: item,
-              orderNo: data.orderNo.split(',')[index]
-            };
-          });
-        } else {
-          this.orderOption = [
-            {
-              orderId: data.orderId,
-              orderNo: data.orderNo
-            }
-          ];
-        }
-      },
-      //选择退货明细
-      handleSelectGoods(list) {
-        if (this.form.returnSourceType != 2) {
-          this.outboundDetailsDialogFlag = true;
-        } else {
-          this.outboundDetailsDialogFlag1 = true;
-        }
-        this.$nextTick(() => {
-          if (this.form.returnSourceType != 2) {
-            this.$refs.outboundDetailsDialogRef.init(this.form, list);
-          } else {
-            this.$refs.outboundDetailsDialogRef1.init(this.form, list);
-          }
-        });
-      },
-      saveDate(data) {
-        data.forEach((item, index) => {
-          // item['totalCount'] = item.measureQuantity;
-          this.$set(data[index], 'totalCount', item.measureQuantity);
-          item['orderId'] = this.orderOption[0]?.orderId;
-          item['orderNo'] = this.orderOption[0]?.orderNo;
-
-          this.productList.forEach((val) => {
-            if (item.productCode == val.productCode) {
-              item['singlePrice'] = val.singlePrice;
-              item['clientCode'] = item.clientCode || val.customerMark;
-              item['notaxSinglePrice'] = val.notaxSinglePrice;
-              item['taxRate'] = val.taxRate;
-              item['goodsLevel'] = val.goodsLevel;
-              item['goodsId'] = val.goodsId;
-              item['goodsPriceId'] = val.goodsPriceId;
-              item['goodsPriceType'] = val.goodsPriceType;
-            }
-          });
-        });
-        this.$refs.inventoryTableRef &&
-          this.$refs.inventoryTableRef.putTableValue(data);
-      },
-      //发货单详情
-      async getSendSaleOrderDetail(id, type) {
-        this.loading = true;
-        const data = await getSendSaleOrderrecordDetailSplit(id);
-
-        this.getOrderOption(data);
-
-        this.productList = data.productList;
-        this.$nextTick(() => {
-          this.$refs.inventoryTableDetailsRef &&
-            this.$refs.inventoryTableDetailsRef.putTableValue(data.productList);
-        });
-
-        if (type) return;
-        // if (data.entrustedCode) {
-        //   this.form.returnSourceType = 2;
-        //   await this.getInfo({ id: data.entrustedId });
-
-        //   this.loading = false;
-        //   return;
-        // }
-        this.loading = false;
-        if (data) {
-          this.$nextTick(() => {
-            this.setForm(data);
-            this.handleSelectGoods();
-          });
-        }
-      },
-
-      //获取退货单详情
-      async getReturnSaleOrderrecordDetail(id) {
-        this.businessId = id;
-
-        this.loading = true;
-        const data = await getReturnSaleOrderrecordDetail(id);
-        this.loading = false;
-        if (data) {
-          this.form = data;
-          this.orderOption = data.returnOrderList;
-          this.form.entrustedCode = data?.entrustedReceiveCode;
-          this.form.entrustedId = data?.entrustedReceiveId;
-          this.$nextTick(() => {
-            this.$refs.inventoryTableRef &&
-              this.$refs.inventoryTableRef.putTableValue(data.productList);
-            this.$refs.inventoryTableref1 &&
-              this.$refs.inventoryTableref1.putTableValue({
-                productList: data.redressProductList
-              });
-            if (this.form.returnSourceType != 2) {
-              this.getSendSaleOrderDetail(data.sendId, 1);
-            } else {
-              this.getInfo({ id: data.entrustedReceiveId }, 1);
-            }
-          });
-        }
-      },
-
-      //选择订单弹框
-      handleOrderBtn() {
-        let item = {
-          id: this.form.sendId
-        };
-        this.$refs.sendListDialogRef.open(item);
-      },
-      handleSaleOrderBtn() {
-        let item = {
-          id: this.form.orderId
-        };
-        this.$refs.orderListDialogRef.open(item);
+      // 处理单价差异变化,更新单价
+      handleChangePrice(obj) {
+        this.form.differenceAmount = obj.total;
       },
+ 
 
       //打开新增编辑弹框
       async open(type, row) {
         this.title = type === 'add' ? '新增' : '修改';
+        this.isUpdate = type != 'add';
         this.row = row;
         this.visible = true;
-
-        if (row && row?.id) {
+        console.log('row~~~~~~~~~~', row);
+        if (row && row?.id && !this.isUpdate) {
           await this.getSaleOrderDetail(row?.id);
+        } else {
+          const data = await getInfo(row?.id);
+          if (data) {
+            const tempdata = {
+              // ...data,
+              totalPrice: data.amount,
+              discountTotalPrice: data.discountAmount,
+              productList: data.originalList
+            }
+            this.businessId = data.id;
+            this.adjustData = data.detailList;
+            this.form = data;
+            this.$refs.inventoryTableDetailsRef &&
+              this.$refs.inventoryTableDetailsRef.putTableValue(tempdata);
+            this.$refs.inventoryTableRef && this.$refs.inventoryTableRef.putTableValue(data.detailList);
+          }
         }
-
-        this.isUpdate = type != 'add';
+        
       },
 
-      //获取订单详情
+      //获取销售订单详情
       async getSaleOrderDetail(id) {
-        this.businessId = id;
+        // this.businessId = id;
         this.loading = true;
         const data = await getSaleOrderDetail(id);
         this.loading = false;
         this.orderForm = data;
-        // if (data.partaId) {
-        //   await this.changeParent({ id: data.partaId }, true);
-        // }
+        
         console.log('data~~~订单详情', data);
         if (data) {
+          this.form.sourceNo = data.orderNo;
+          this.form.sourceId = data.id;
           this.$nextTick(() => {
             this.$refs.inventoryTableDetailsRef &&
               this.$refs.inventoryTableDetailsRef.putTableValue(data);
           });
         }
       },
-
-      salesmanChange(val, info) {
-        this.otherForm.salesmanName = info.name;
-      },
-      settlementModeChange(info) {
-        this.form.settlementModeName = info.dictValue;
-      },
-      ifChiefChange(value, idx) {
-        if (value === 1) {
-          this.tableLinkData.forEach((e) => (e.ifChief = 0));
-          this.tableLinkData[idx].ifChief = 1;
-        }
-      },
-
-      getValidate() {
+      getValidate() { 
         let proAll = [
           new Promise((resolve, reject) => {
             this.$refs.form.validate((valid) => {
@@ -789,22 +486,19 @@
             });
           })
         ];
-        if (
-          !['40', '50'].includes(this.form.type) ||
-          this.form.returnSourceType != 1
-        ) {
-          proAll.push(
-            new Promise((resolve, reject) => {
-              this.$refs.inventoryTableRef.validateForm((valid) => {
-                if (!valid) {
-                  reject(false);
-                } else {
-                  resolve(true);
-                }
-              });
-            })
-          );
-        }
+ 
+        proAll.push(
+          new Promise((resolve, reject) => {
+            this.$refs.inventoryTableRef.validateForm((valid) => {
+              if (!valid) {
+                reject(false);
+              } else {
+                resolve(true);
+              }
+            });
+          })
+        );
+        
         return Promise.all(proAll);
       },
       async save(type) {
@@ -817,68 +511,59 @@
             delete this.form.id;
           }
           let data = this.$refs.inventoryTableRef.getTableValue();
-          let redressProductList =
-            (this.$refs.inventoryTableref1 &&
-              this.$refs.inventoryTableref1.getTableValue()) ||
-            [];
-
+          // let redressProductList =
+          //   (this.$refs.inventoryTableref1 &&
+          //     this.$refs.inventoryTableref1.getTableValue()) ||
+          //   [];
+          console.log('data!!!!!!', data);
           if (
-            data.productList.length === 0 &&
-            (!['40', '50'].includes(this.form.type) ||
-              this.form.returnSourceType != 1)
+            data.productList.length === 0
           ) {
-            return this.$message.error('至少选择一个退货产品');
+            return this.$message.error('至少选择一个冲差产品');
           }
-          let orderIds = [...data.productList, ...redressProductList].map(
-            (item) => item.orderId
-          );
-          let orderNos = [...data.productList, ...redressProductList].map(
-            (item) => item.orderNo
-          );
-
-          this.form.repliedFiles = this.form.repliedFiles || [];
-          this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
-          this.form.typeName = this.getDictValue('退货类型', this.form.type);
+          // let orderIds = [...data.productList, ...redressProductList].map(
+          //   (item) => item.orderId
+          // );
+          // let orderNos = [...data.productList, ...redressProductList].map(
+          //   (item) => item.orderNo
+          // );
+
+          // this.form.repliedFiles = this.form.repliedFiles || [];
+          // this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
+          // this.form.typeName = this.getDictValue('退货类型', this.form.type);
           let commitData = Object.assign({}, this.form, {
-            totalAmount: this.totalAmount,
-            productList: data.productList,
-            payAmount: this.totalAmount,
-            redressProductList,
-            returnOrderList: this.orderOption
-          });
-          let productListData = [];
-          data.productList.forEach((item) => {
-            if (!item.totalCount) {
-              productListData.push(item.productName);
-            }
+       
+            detailList: data.productList,
+            originalList: this.orderForm.productList,
+          
           });
-          console.log(productListData);
-          if (productListData.length) {
-            return this.$message.error(
-              productListData.toString() + ' 退货数量不能为空!'
-            );
-          }
-          if (orderIds?.length) {
-            commitData.orderIds = Array.from(new Set(orderIds)).toString();
-          }
-          if (orderNos?.length) {
-            commitData.orderNo = Array.from(new Set(orderNos)).toString();
-          }
-          // return;
+          // let productListData = [];
+          // data.productList.forEach((item) => {
+          //   if (!item.totalCount) {
+          //     productListData.push(item.productName);
+          //   }
+          // });
+          // console.log(productListData);
+          // if (productListData.length) {
+          //   return this.$message.error(
+          //     productListData.toString() + ' 退货数量不能为空!'
+          //   );
+          // }
+   
           if (this.isUpdate) {
-            UpdateReturnInformation(commitData)
+            updateInfo(commitData)
               .then(async (res) => {
                 this.loading = false;
 
                 this.$message.success('修改成功');
                 if (type === 'sub') {
                   let storemanIds = '';
-                  let ids = commitData.productList.map(
+                  let ids = commitData.detailList.map(
                     (item) => item.warehouseId
                   );
                   let warehouseList = await getWarehouseListByIds(ids || []);
                   storemanIds = warehouseList.map((item) => item.ownerId);
-                  await this.returnSubmit(res, storemanIds.toString());
+                  await this.adjustSubmit(res, storemanIds.toString());
                   return;
                 }
                 this.cancel();
@@ -888,18 +573,18 @@
                 //this.loading = false;
               });
           } else {
-            addReturnInformation(commitData)
+            addCreate(commitData)
               .then(async (res) => {
                 this.loading = false;
                 this.$message.success('新增成功');
                 if (type === 'sub') {
-                  let storemanIds = '';
-                  let ids = commitData.productList.map(
-                    (item) => item.warehouseId
-                  );
-                  let warehouseList = await getWarehouseListByIds(ids || []);
-                  storemanIds = warehouseList.map((item) => item.ownerId);
-                  this.returnSubmit(res, storemanIds.toString());
+                  // let storemanIds = '';
+                  // let ids = commitData.detailList.map(
+                  //   (item) => item.warehouseId
+                  // );
+                  // let warehouseList = await getWarehouseListByIds(ids || []);
+                  // storemanIds = warehouseList.map((item) => item.ownerId);
+                  this.adjustSubmit(res);
                   this.$emit('done');
                   return;
                 }
@@ -915,8 +600,8 @@
           // 表单验证未通过,不执行保存操作
         }
       },
-      async returnSubmit(res, storemanIds) {
-        const data = await getReturnSaleOrderrecordDetail(
+      async adjustSubmit(res) {
+        const data = await getInfo(
           this.businessId || res
         );
         this.processSubmitDialogFlag = true;
@@ -924,26 +609,14 @@
         this.$nextTick(() => {
           let params = {
             businessId: this.businessId || res,
-            businessKey:
-              this.form.returnSourceType == 1
-                ? 'sale_return_approve1'
-                : this.form.returnSourceType == 2
-                ? 'sale_entrusted_receive_return_approve'
-                : 'sales_return_approve',
+            businessKey: 'punch_slip_order_approve',
             formCreateUserId: data.createUserId,
             variables: {
-              returnSourceType: data.returnSourceType,
-              storemanIds: storemanIds.toString(),
-              businessCode: data.returnNo,
-              businessName: data.contactName,
-              businessType:
-                data.returnSourceType == 1
-                  ? '售后退货'
-                  : data.returnSourceType == 3
-                  ? '销售发货退货'
-                  : data.returnSourceType == 2
-                  ? '受托收货退货'
-                  : '销售订单退货'
+              // returnSourceType: data.returnSourceType,
+              // storemanIds: storemanIds.toString(),
+              businessCode: data.orderNo,
+              businessName: data.createUserName,
+              businessType: '冲差单'
             }
           };
 
@@ -960,11 +633,10 @@
       },
       cancel() {
         this.$nextTick(() => {
-          this.activeName = 'base';
           // 关闭后,销毁所有的表单数据
-          this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
-          this.$refs['formRef'] && this.$refs['formRef'].resetFields();
-          this.$store.commit('order/clearUserData');
+          // this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
+          this.$refs['form'] && this.$refs['form'].resetFields();
+          // this.$store.commit('order/clearUserData');
           this.form = copyObj(this.formDef);
           // 通过$emit更新父组件中的addAdjustDialogFlag值,避免直接修改prop
           this.$emit('update:addAdjustDialogFlag', false);

+ 239 - 774
src/views/saleManage/saleOrder/adjustmentNote‌/components/detailAdjustDialog.vue

@@ -11,188 +11,209 @@
     :resizable="true"
     @close="cancel"
   >
-    <div style="margin-bottom: 20px;">
+    <!-- <div style="margin-bottom: 20px;">
       <el-alert
         title="目前冲差功能仅适用于销售订单已审核,未执行发货的情况"
         type="warning"
         center
         show-icon>
       </el-alert>
-    </div>
-    <el-form
-      ref="form"
-      :model="form"
-      :rules="rules"
-      class="el-form-box"
-      label-width="160px"
-    >
-      <headerTitle title="基本信息"></headerTitle>
-      <el-row>
-        <el-col :span="12">
-          <el-form-item label="冲差单编码" prop="returnSourceType">
-            <el-input
-              clearable
-              v-model="form.orderNo"
-              @click.native="handleSaleOrderBtn"
-              disabled
-              placeholder="自动生成"
-            />
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item
-            label="冲差类型"
-            prop="type"
-            style="margin-bottom: 22px"
+    </div> -->
+    <div class="switch">
+      <div class="switch_left">
+        <ul>
+          <li
+            v-for="item in tabOptions"
+            :key="item.key"
+            :class="{ active: activeComp == item.key }"
+            @click="handleTag(item.key)"
           >
-            <DictSelection
-              dictName="冲差类型"
-              clearable
-              v-model="form.type"
-              @change="handleSetReturnSourceType"
-            >
-            </DictSelection>
-          </el-form-item>
-        </el-col>
+            {{ item.name }}
+          </li>
+        </ul>
+      </div>
+    </div>
 
-        <el-col :span="12">
-          <el-form-item
-            label="冲差原因"
-            prop="entrustedReceiveCode"
-          >
-            <DictSelection
-              dictName="冲差原因"
-              clearable
-              v-model="form.type"
-              @change="handleSetReturnSourceType"
+    <div v-if="activeComp === 'main'">
+      <el-form
+        ref="form"
+        :model="form"
+        :rules="rules"
+        class="el-form-box"
+        label-width="160px"
+      >
+        <headerTitle title="基本信息"></headerTitle>
+        <el-row :gutter="20">
+          <el-col :span="8">
+            <el-form-item labelWidth="100px" label="冲差单编码" prop="orderNo">
+              <el-input
+                clearable
+                v-model="form.orderNo"
+                disabled
+                placeholder="自动生成"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item
+              labelWidth="100px"
+              label="冲差类型"
+              prop="type"
             >
-            </DictSelection>
-          </el-form-item>
-        </el-col>
-
-        <el-col :span="12">
-          <el-form-item label="冲差方式" prop="totalAmount">
-            <DictSelection
-              dictName="冲差方式"
-              clearable
-              v-model="form.type"
-              @change="handleSetReturnSourceType"
+              <DictSelection
+                dictName="冲差类型"
+                disabled
+                clearable
+                v-model="form.type"
+              >
+              </DictSelection>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8">
+            <el-form-item
+              labelWidth="100px"
+              label="冲差原因"
+              prop="reason"
             >
-            </DictSelection>
-          </el-form-item>
-        </el-col>
-
-        <el-col :span="12">
-          <el-form-item
-            label="调整类型"
-            prop="redressAmount"
-          >
-            <DictSelection
-              dictName="调整类型"
-              clearable
-              v-model="form.type"
-              @change="handleSetReturnSourceType"
+              <DictSelection
+                dictName="冲差原因"
+                clearable
+                disabled
+                v-model="form.reason"
+              >
+              </DictSelection>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8">
+            <el-form-item labelWidth="100px" label="冲差方式" prop="method">
+              <DictSelection
+                dictName="冲差方式"
+                disabled
+                clearable
+                v-model="form.method"
+              >
+              </DictSelection>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8">
+            <el-form-item
+              labelWidth="100px"
+              label="调整类型"
+              prop="adjustType"
             >
-            </DictSelection>
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="冲差范围" prop="contactName">
-            <DictSelection
-              dictName="冲差范围"
-              clearable
-              v-model="form.type"
-              @change="handleSetReturnSourceType"
-            >
-            </DictSelection>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row>
-        <el-col :span="24">
-          <el-form-item label="调整说明" prop="remark">
-            <el-input
-              clearable
-              v-model="form.remark"
-              type="textarea"
-              placeholder="请输入"
-            />
-          </el-form-item>
-        </el-col>
+              <DictSelection
+                dictName="调整类型"
+                clearable
+                disabled
+                v-model="form.adjustType"
+              >
+              </DictSelection>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item labelWidth="100px" label="冲差范围" prop="rangeType">
+              <DictSelection
+                dictName="冲差范围"
+                clearable
+                disabled
+                v-model="form.rangeType"
+              >
+              </DictSelection>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="16">
+            <el-form-item labelWidth="100px" label="调整说明" prop="remark">
+              <el-input
+                clearable
+                v-model="form.remark"
+                type="textarea"
+                rows="1"
+                disabled
+                placeholder="请输入"
+              />
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8">
+            <el-form-item labelWidth="100px" prop="files" label="附件">
+              <fileMain disabled v-model="form.files"></fileMain>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <headerTitle title="物品清单" style="margin-top: 30px"></headerTitle>
+        <inventoryTableDetails
+          ref="inventoryTableDetailsRef"
+          :isDiscountTotalPrice="true"
+        ></inventoryTableDetails>
+        <headerTitle
+          title="冲差信息"
+          style="margin-top: 30px"
+        ></headerTitle>
+        <inventoryTable
+          ref="inventoryTableRef"
+          :isView="true"
+        ></inventoryTable>
+        <div style="margin-top: 20px;">
+          <el-row :gutter="20">
+            <el-col :span="8">
+              <el-form-item label-width="100px" label="总差异金额:" prop="differenceAmount">
+                <el-input
+                  clearable
+                  v-model="form.differenceAmount"
+                  disabled
+                  placeholder="请输入"
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label-width="100px" label="总金额:" prop="adjustAmount">
+                <el-input
+                  clearable
+                  disabled
+                  v-model="form.adjustAmount"
+                  placeholder="请输入"
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label-width="100px" label="优惠后总金额:" prop="adjustDiscountAmount">
+                <el-input
+                  clearable
+                  disabled
+                  v-model="form.adjustDiscountAmount"
+                  placeholder="请输入"
+                />
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </div>
+      </el-form>
+    </div>
 
-        <el-col :span="12">
-          <el-form-item prop="returnFiles" label="附件">
-            <fileMain v-model="form.returnFiles"></fileMain>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <headerTitle title="物品清单" style="margin-top: 30px"></headerTitle>
-      <inventoryTableDetails
-        ref="inventoryTableDetailsRef"
-      ></inventoryTableDetails>
-      <headerTitle
-        title="冲差信息"
-        style="margin-top: 30px"
-      ></headerTitle>
-      <inventoryTable
-        :returnType="form.returnType"
-        :returnSourceType="form.returnSourceType"
-        :entrustedCode="form.entrustedCode"
-        ref="inventoryTableref"
-        :sendId="form.sendId"
-        :sendNo="form.sendNo"
-        :type="form.type"
-        @handleSelectGoods="handleSelectGoods"
-        :orderOption="orderOption"
-      ></inventoryTable>
-      <headerTitle
-        title="实物赔偿清单"
-        v-show="['20', '40'].includes(form.type) && form.returnSourceType == 1"
-        style="margin-top: 30px"
-      ></headerTitle>
-      <inventoryTable1
-        v-show="['20', '40'].includes(form.type) && form.returnSourceType == 1"
-        ref="inventoryTableref1"
-        :customerMark="customerMark"
-        cacheKeyUrl="eos-saleManage-returnGoods-redressProductList"
-        :isOrderNo="true"
-        :orderOption="orderOption"
-      ></inventoryTable1>
-    </el-form>
+    <bpmDetail
+      v-if="activeComp === 'bpm' && form.processInstanceId"
+      :id="form.processInstanceId"
+    ></bpmDetail>
 
     <div slot="footer" class="footer">
-      <el-button type="primary" @click="save" v-click-once>保存</el-button>
+      <!-- <el-button type="primary" @click="save" v-click-once>保存</el-button>
       <el-button
         type="primary"
         v-if="isNeed_process_is_close"
         @click="save('sub')"
         v-click-once
         >提交</el-button
-      >
+      > -->
       <el-button @click="cancel">返回</el-button>
     </div>
-    <!--  销售发货单  -->
-    <sendListDialog
-      ref="sendListDialogRef"
-      @changeParent="changeOrder"
-      :contactData="contactData"
-      :saleOrderData="saleOrderData"
-    ></sendListDialog>
-    <!--  受托发货单  -->
-    <entrusted-receive-dialog
-      :entrusted-receive-dialog-flag.sync="entrustedReceiveDialogFlag"
-      :contactData="contactData"
-      :saleOrderData="saleOrderData"
-      v-if="entrustedReceiveDialogFlag"
-      @changeParent="getInfo"
-      ref="entrustedReceiveDialogRef"
-    ></entrusted-receive-dialog>
-    <!--    销售订单-->
-    <!-- <orderListDialog
-      ref="orderListDialogRef"
-      @changeParent="changeSaleOrder"
-      :contactData="contactData"
-    ></orderListDialog> -->
+   
+
+
     <process-submit-dialog
       :isNotNeedProcess="false"
       :processSubmitDialogFlag.sync="processSubmitDialogFlag"
@@ -200,73 +221,32 @@
       ref="processSubmitDialogRef"
       @reload="reload"
     ></process-submit-dialog>
-    <!--出库详情-->
-    <!-- <outbound-details-dialog
-      v-if="outboundDetailsDialogFlag && form.returnType != 2"
-      ref="outboundDetailsDialogRef"
-      :outboundDetailsDialogFlag.sync="outboundDetailsDialogFlag"
-      @saveDate="saveDate"
-    ></outbound-details-dialog> -->
-    <!--入库详情-->
-    <!-- <outbound-details-dialog1
-      v-if="outboundDetailsDialogFlag1"
-      ref="outboundDetailsDialogRef1"
-      :outboundDetailsDialogFlag.sync="outboundDetailsDialogFlag1"
-      @saveDate="saveDate"
-    ></outbound-details-dialog1> -->
+
   </ele-modal>
 </template>
 
 <script>
   import { numberReg } from 'ele-admin';
   import { acceptUnpackoptions } from '@/enum/dict';
-  import fileUpload from '@/components/upload/fileUpload';
   import dictMixins from '@/mixins/dictMixins';
-  import deptSelect from '@/components/CommomSelect/dept-select.vue';
-  import personSelect from '@/components/CommomSelect/person-select.vue';
-  import parentList from '@/views/saleManage/contact/components/parentList.vue';
-  import {
-    addReturnInformation,
-    getReturnSaleOrderrecordDetail,
-    UpdateReturnInformation
-  } from '@/api/saleManage/returnGoods';
-  import {
-    getSendSaleOrderCordList,
-    getSendSaleOrderrecordDetailSplit
-  } from '@/api/saleManage/saleordersendrecord';
-  import inventoryTable from './inventoryTable.vue';
-  // import sendListDialog from './sendListMultipleDialog.vue';
+
   import { copyObj } from '@/utils/util';
-  import entrustedReceiveDialog from '@/views/saleManage/saleOrder/invoice/components/entrustedReceiveDialog.vue';
-  import { getPSaleEntrustedReceiveDetailAPI } from '@/api/saleManage/entrustedReceive';
-  import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
   import fileMain from '@/components/addDoc/index.vue';
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
-  import orderListDialog from '@/views/saleManage/saleOrder/invoice/components/orderListDialog.vue';
-  // import outboundDetailsDialog from './outboundDetailsDialog.vue';
-  import outboundDetailsDialog1 from '@/views/saleManage/saleOrder/entrustedReceive/components/outboundDetailsDialog.vue';
-  import inventoryTable1 from '@/BIZComponents/inventoryTable.vue';
-  import inventoryTableDetails from '@/views/saleManage/saleOrder/invoice/components/inventoryTableDetails.vue';
-  import { getSendSaleOrderConfirmDetail } from '@/api/saleManage/invoiceConfirm';
-  import { contactDetail } from '@/api/saleManage/contact';
+  import inventoryTable from './inventoryTable.vue';
+  import inventoryTableDetails from '@/BIZComponents/inventoryTableDetails.vue';
+
+  import { getInfo } from '@/api/saleManage/adjustmentNote‌';
+  import bpmDetail from '@/views/bpm/processInstance/detail.vue';
 
   export default {
     mixins: [dictMixins],
     components: {
-      orderListDialog,
       processSubmitDialog,
       fileMain,
-      entrustedReceiveDialog,
-      fileUpload,
-      deptSelect,
-      // sendListDialog,
       inventoryTable,
-      inventoryTable1,
-      parentList,
-      personSelect,
-      // outboundDetailsDialog,
-      outboundDetailsDialog1,
-      inventoryTableDetails
+      inventoryTableDetails,
+      bpmDetail
     },
     //客户管理数据
     props: {
@@ -274,12 +254,6 @@
         type: Boolean,
         default: false
       },
-      contactData: {
-        type: Object,
-        default: () => {
-          return {};
-        }
-      },
       saleOrderData: {
         type: Object,
         default: () => {
@@ -289,25 +263,21 @@
     },
     data() {
       let formDef = {
-        id: '',
-        payAmount: 0,
-        returnFiles: [],
-        repliedFiles: [],
-        remark: '',
-        sendId: '',
-        sendNo: '',
-        orderId: '',
-        orderIds: '',
         orderNo: '',
-        totalAmount: '',
-        returnType: '',
-        pricingWay: '',
-        returnSourceType: 3,
-        isOrderAll: 0,
-        entrustedCode: '',
-        entrustedId: '',
-        entrustedReceiveId: '',
-        entrustedReceiveCode: ''
+        type: '1',
+        method: '1',
+        reason: '1',
+        rangeType: '',
+        adjustType: '1',
+        sourceType: '1',
+        sourceNo: '',
+        sourceId: '',
+        files: [],
+        differenceAmount: '',
+        amount: '',
+        discountAmount: '',
+        sourceNo: '',
+        sourceId: '',
       };
 
       return {
@@ -316,50 +286,31 @@
         customerMark: '',
         oldProductList: [],
         detailData: {},
-        payWayOptions: [],
-        delDetailIds: [],
-        linkNameOptions: [],
         acceptUnpackoptions,
         visible: false,
         processSubmitDialogFlag: false,
-        outboundDetailsDialogFlag1: false,
         title: '',
         row: {},
-        activeName: 'base',
+        activeComp: 'main',
+        tabOptions: [
+          { key: 'main', name: '冲差单详情' },
+          { key: 'bpm', name: '流程详情' },
+        ],
         formDef,
         form: copyObj(formDef),
-        tableBankData: [],
-        tableLinkData: [],
-        // 组织机构树形结构数据
-        groupTreeData: [],
-        groupData: [],
-        rules: {
-          returnSourceType: [
-            { required: true, message: '请选择', trigger: 'change' }
-          ],
-          sendNo: [{ required: true, message: '请选择', trigger: 'change' }],
-          payAmount: [
-            {
-              required: true,
-              pattern: numberReg,
-              message: '请输入数字',
-              trigger: 'blur'
-            }
-          ]
-        },
+        rules: {},
         // 提交状态
         loading: false,
         // 是否是修改
         isUpdate: false,
-        entrustedReceiveDialogFlag: false,
         businessId: '',
         orderId: '',
-        outboundDetailsDialogFlag: false,
-        productList: []
+        productList: [],
+        adjustData: []
       };
     },
     created() {
-      this.requestDict('产地');
+      // this.requestDict('产地');
     },
     computed: {
       totalAmount() {
@@ -401,6 +352,9 @@
     },
 
     methods: {
+      handleTag(val) {
+        this.activeComp = val;
+      },
       //删除产品
       remove(row) {
         if (this.form.productList.length === 1)
@@ -410,543 +364,54 @@
           this.form.productList.splice(index, 1);
         }
       },
-      onchangeLink() {
-        this.form.type = '';
-        this.handleSetReturnSourceType();
-      },
-      async contactDetail(id) {
-        const { base } = await contactDetail(id);
-        this.customerMark = base.serialNo;
-        this.$refs.inventoryTableref1.setCustomerMark(base.serialNo);
-      },
-      //设置退货类型
-      handleSetReturnSourceType(val) {
-        this.form = Object.assign({}, this.form, {
-          orderId: '',
-          orderIds: '',
-          sendNo: '',
-          orderNo: '',
-          sendId: '',
-          contactName: '',
-          contactId: '',
-          pricingWay: '',
-          entrustedCode: '',
-          entrustedId: '',
-          entrustedReceiveId: '',
-          entrustedReceiveCode: ''
-        });
-        this.$nextTick(() => {
-          this.$refs.inventoryTableref &&
-            this.$refs.inventoryTableref.putTableValue([]);
-          this.$refs.inventoryTableDetailsRef &&
-            this.$refs.inventoryTableDetailsRef.putTableValue([]);
-        });
-      },
-      //选择受托收货单弹框
-      handleEntrustedReceive(e) {
-        if (e.target.nodeName == 'I') {
-          this.form = Object.assign({}, this.form, {
-            carNo: '',
-            carId: '',
-            linkName: '',
-            linkPhone: '',
-            orderNo: '',
-            orderId: '',
-            contactId: '',
-            contactName: '',
-            entrustedCode: '',
-            entrustedId: '',
-            sendNoteNo: '',
-            pricingWay: '',
-            entrustedReceiveId: '',
-            entrustedReceiveCode: ''
-          });
-          this.$refs.inventoryTableref &&
-            this.$refs.inventoryTableref.putTableValue([]);
-          return;
-        }
-        this.entrustedReceiveDialogFlag = true;
-        this.$nextTick(() => {
-          this.$refs.entrustedReceiveDialogRef.init();
-        });
-      },
-      //获取受托收货单数据回调
-      async getInfo(row, type) {
-        if (!row.id) {
-          return;
-        }
-        const data = await getPSaleEntrustedReceiveDetailAPI(row.id);
-        if (data) {
-          this.productList = data.productList;
-          if (type) {
-            this.$refs.inventoryTableDetailsRef &&
-              this.$refs.inventoryTableDetailsRef.putTableValue(
-                data.productList.map((item) => {
-                  item['extField'] = item.extField || [];
-                  return item;
-                })
-              );
-            return;
-          }
-
-          this.getOrderOption(data);
-          this.$nextTick(() => {
-            let { code, id, productList, contactId, contactName } = data;
-            if (productList && productList.length > 0) {
-              productList.forEach((v) => {
-                v.orderTotalCount = v.orderTotalCount || v.totalCount;
-              });
-            }
-            this.form = Object.assign({}, this.form, {
-              orderId: data.orderId,
-              orderIds: data.orderIds,
-              sendNo: '',
-              sendId: '',
-              contactName,
-              contactId,
-              entrustedCode: code,
-              entrustedId: id,
-              entrustedReceiveId: id,
-              entrustedReceiveCode: code
-            });
-            this.handleSelectGoods();
 
-            this.$refs.inventoryTableDetailsRef &&
-              this.$refs.inventoryTableDetailsRef.putTableValue(
-                data.productList.map((item) => {
-                  item['extField'] = item.extField || [];
-                  return item;
-                })
-              );
-          });
-        }
-      },
-      //选择发货单回调
-      changeOrder(obj = {}) {
-        this.getSendSaleOrderMultipleDetail(obj);
-      },
-      //多发货单详情
-      async getSendSaleOrderMultipleDetail(params) {
-        this.loading = true;
-        this.productList = [];
-        let data = {},
-          res = {};
-        this.$refs.inventoryTableref &&
-          this.$refs.inventoryTableref.putTableValue([]);
-        this.$refs.inventoryTableref1 &&
-          this.$refs.inventoryTableref1.putTableValue({
-            productList: []
-          });
-        if (params.activeName == 1) {
-          data = await getSendSaleOrderrecordDetailSplit(params.id);
-        } else {
-          res = await getSendSaleOrderConfirmDetail(params.id);
-          data = await getSendSaleOrderrecordDetailSplit(res.sendId);
-        }
-        this.loading = false;
-        if (data) {
-          this.getOrderOption(data);
-
-          this.$nextTick(() => {
-            this.setForm(data);
-            if (params.activeName == 2) {
-              this.productList = data.productList;
-              res.productList.forEach((item) => {
-                item['orderId'] = this.orderOption[0]?.orderId;
-                item['orderNo'] = this.orderOption[0]?.orderNo;
-              });
-
-              this.$refs.inventoryTableref &&
-                this.$refs.inventoryTableref.putTableValue(res.productList);
-              this.$refs.inventoryTableDetailsRef &&
-                this.$refs.inventoryTableDetailsRef.putTableValue(
-                  data.productList
-                );
-              return;
-            }
-            this.productList = data.productList;
-            if (
-              !['40', '50'].includes(this.form.type) ||
-              this.form.returnSourceType != 1
-            ) {
-              this.handleSelectGoods();
-            }
-
-            this.$refs.inventoryTableDetailsRef &&
-              this.$refs.inventoryTableDetailsRef.putTableValue(
-                data.productList
-              );
-          });
-        }
-      },
-      setForm(data) {
-        data.productList.forEach((item) => {
-          item.sendProductId = item.id;
-          item.id = '';
-        });
-        if (data.contactId) {
-          this.contactDetail(data.contactId);
-        }
-        this.form = Object.assign({}, this.form, {
-          orderIds: data.orderIds || data.orderId,
-          sendNo: data.docNo,
-          orderNo: data.orderNo,
-          sendId: data.id,
-          contactName: data.contactName,
-          contactId: data.contactId,
-          entrustedCode: data.entrustedCode,
-          entrustedId: data.entrustedCode,
-          entrustedReceiveId: '',
-          entrustedReceiveCode: ''
-        });
-      },
-      getOrderOption(data) {
-        if (data.orderIds) {
-          this.orderOption = data.orderIds.split(',').map((item, index) => {
-            return {
-              orderId: item,
-              orderNo: data.orderNo.split(',')[index]
-            };
-          });
-        } else {
-          this.orderOption = [
-            {
-              orderId: data.orderId,
-              orderNo: data.orderNo
-            }
-          ];
-        }
-      },
-      //选择退货明细
-      handleSelectGoods(list) {
-        if (this.form.returnSourceType != 2) {
-          this.outboundDetailsDialogFlag = true;
-        } else {
-          this.outboundDetailsDialogFlag1 = true;
-        }
-        this.$nextTick(() => {
-          if (this.form.returnSourceType != 2) {
-            this.$refs.outboundDetailsDialogRef.init(this.form, list);
-          } else {
-            this.$refs.outboundDetailsDialogRef1.init(this.form, list);
-          }
-        });
-      },
-      saveDate(data) {
-        data.forEach((item, index) => {
-          // item['totalCount'] = item.measureQuantity;
-          this.$set(data[index], 'totalCount', item.measureQuantity);
-          item['orderId'] = this.orderOption[0]?.orderId;
-          item['orderNo'] = this.orderOption[0]?.orderNo;
-
-          this.productList.forEach((val) => {
-            if (item.productCode == val.productCode) {
-              item['singlePrice'] = val.singlePrice;
-              item['clientCode'] = item.clientCode || val.customerMark;
-              item['notaxSinglePrice'] = val.notaxSinglePrice;
-              item['taxRate'] = val.taxRate;
-              item['goodsLevel'] = val.goodsLevel;
-              item['goodsId'] = val.goodsId;
-              item['goodsPriceId'] = val.goodsPriceId;
-              item['goodsPriceType'] = val.goodsPriceType;
-            }
-          });
-        });
-        this.$refs.inventoryTableref &&
-          this.$refs.inventoryTableref.putTableValue(data);
-      },
-      //发货单详情
-      async getSendSaleOrderDetail(id, type) {
-        this.loading = true;
-        const data = await getSendSaleOrderrecordDetailSplit(id);
-
-        this.getOrderOption(data);
-
-        this.productList = data.productList;
-        this.$nextTick(() => {
-          this.$refs.inventoryTableDetailsRef &&
-            this.$refs.inventoryTableDetailsRef.putTableValue(data.productList);
-        });
-
-        if (type) return;
-        // if (data.entrustedCode) {
-        //   this.form.returnSourceType = 2;
-        //   await this.getInfo({ id: data.entrustedId });
-
-        //   this.loading = false;
-        //   return;
-        // }
-        this.loading = false;
-        if (data) {
-          this.$nextTick(() => {
-            this.setForm(data);
-            this.handleSelectGoods();
-          });
-        }
-      },
-
-      //获取退货单详情
-      async getReturnSaleOrderrecordDetail(id) {
+      //获取详情
+      async getDetail(id) {
         this.businessId = id;
 
         this.loading = true;
-        const data = await getReturnSaleOrderrecordDetail(id);
+        const data = await getInfo(id);
         this.loading = false;
         if (data) {
+          const tempdata = {
+            // ...data,
+            totalPrice: data.amount,
+            discountTotalPrice: data.discountAmount,
+            productList: data.originalList
+          }
+          this.businessId = data.id;
+          this.adjustData = data.detailList;
           this.form = data;
-          this.orderOption = data.returnOrderList;
-          this.form.entrustedCode = data?.entrustedReceiveCode;
-          this.form.entrustedId = data?.entrustedReceiveId;
-          this.$nextTick(() => {
-            this.$refs.inventoryTableref &&
-              this.$refs.inventoryTableref.putTableValue(data.productList);
-            this.$refs.inventoryTableref1 &&
-              this.$refs.inventoryTableref1.putTableValue({
-                productList: data.redressProductList
-              });
-            if (this.form.returnSourceType != 2) {
-              this.getSendSaleOrderDetail(data.sendId, 1);
-            } else {
-              this.getInfo({ id: data.entrustedReceiveId }, 1);
-            }
-          });
+          console.log('tempdata~~~~', tempdata);
+          this.$refs.inventoryTableDetailsRef &&
+            this.$refs.inventoryTableDetailsRef.putTableValue(tempdata);
+          this.$refs.inventoryTableRef && this.$refs.inventoryTableRef.putTableValue(data.detailList);
         }
       },
 
-      //选择订单弹框
-      handleOrderBtn() {
-        let item = {
-          id: this.form.sendId
-        };
-        this.$refs.sendListDialogRef.open(item);
-      },
-      handleSaleOrderBtn() {
-        let item = {
-          id: this.form.orderId
-        };
-        this.$refs.orderListDialogRef.open(item);
-      },
-
       //打开新增编辑弹框
-      async open(type, row, sendId, isEntrustedReceive) {
-        this.title = type === 'add' ? '新增' : '修改';
-        this.row = row;
-        this.visible = true;
-        this.$store.commit('returnGoods/clearUserData');
-        if (type === 'add') {
-          this.$store.commit('returnGoods/setIsDefaultPayableAmount', false); // 设置标志变量为 false,应付金额将跟随订单金额同步
-        }
-        if (row && row?.id) {
-          await this.getReturnSaleOrderrecordDetail(row?.id);
-        }
-        if (sendId && !isEntrustedReceive) {
-          await this.getSendSaleOrderDetail(sendId);
-        }
-        if (sendId && isEntrustedReceive) {
-          this.form.returnSourceType = 2;
-          await this.getInfo({ id: sendId });
-        }
-        this.isUpdate = type != 'add';
-      },
+      async open(type, row) {
 
-      salesmanChange(val, info) {
-        this.otherForm.salesmanName = info.name;
-      },
-      settlementModeChange(info) {
-        this.form.settlementModeName = info.dictValue;
-      },
-      ifChiefChange(value, idx) {
-        if (value === 1) {
-          this.tableLinkData.forEach((e) => (e.ifChief = 0));
-          this.tableLinkData[idx].ifChief = 1;
+        if (row && row?.id) {
+          await this.getDetail(row?.id);
         }
-      },
 
-      getValidate() {
-        let proAll = [
-          new Promise((resolve, reject) => {
-            this.$refs.form.validate((valid) => {
-              if (!valid) {
-                reject(false);
-              } else {
-                resolve(true);
-              }
-            });
-          })
-        ];
-        if (
-          !['40', '50'].includes(this.form.type) ||
-          this.form.returnSourceType != 1
-        ) {
-          proAll.push(
-            new Promise((resolve, reject) => {
-              this.$refs.inventoryTableref.validateForm((valid) => {
-                if (!valid) {
-                  reject(false);
-                } else {
-                  resolve(true);
-                }
-              });
-            })
-          );
-        }
-        return Promise.all(proAll);
       },
-      async save(type) {
-        try {
-          await this.getValidate();
-          // 表单验证通过,执行保存操作
-          this.loading = true;
 
-          if (!this.isUpdate) {
-            delete this.form.id;
-          }
-          let data = this.$refs.inventoryTableref.getTableValue();
-          let redressProductList =
-            (this.$refs.inventoryTableref1 &&
-              this.$refs.inventoryTableref1.getTableValue()) ||
-            [];
-
-          if (
-            data.productList.length === 0 &&
-            (!['40', '50'].includes(this.form.type) ||
-              this.form.returnSourceType != 1)
-          ) {
-            return this.$message.error('至少选择一个退货产品');
-          }
-          let orderIds = [...data.productList, ...redressProductList].map(
-            (item) => item.orderId
-          );
-          let orderNos = [...data.productList, ...redressProductList].map(
-            (item) => item.orderNo
-          );
-
-          this.form.repliedFiles = this.form.repliedFiles || [];
-          this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
-          this.form.typeName = this.getDictValue('退货类型', this.form.type);
-          let commitData = Object.assign({}, this.form, {
-            totalAmount: this.totalAmount,
-            productList: data.productList,
-            payAmount: this.totalAmount,
-            redressProductList,
-            returnOrderList: this.orderOption
-          });
-          let productListData = [];
-          data.productList.forEach((item) => {
-            if (!item.totalCount) {
-              productListData.push(item.productName);
-            }
-          });
-          console.log(productListData);
-          if (productListData.length) {
-            return this.$message.error(
-              productListData.toString() + ' 退货数量不能为空!'
-            );
-          }
-          if (orderIds?.length) {
-            commitData.orderIds = Array.from(new Set(orderIds)).toString();
-          }
-          if (orderNos?.length) {
-            commitData.orderNo = Array.from(new Set(orderNos)).toString();
-          }
-          // return;
-          if (this.isUpdate) {
-            UpdateReturnInformation(commitData)
-              .then(async (res) => {
-                this.loading = false;
 
-                this.$message.success('修改成功');
-                if (type === 'sub') {
-                  let storemanIds = '';
-                  let ids = commitData.productList.map(
-                    (item) => item.warehouseId
-                  );
-                  let warehouseList = await getWarehouseListByIds(ids || []);
-                  storemanIds = warehouseList.map((item) => item.ownerId);
-                  await this.returnSubmit(res, storemanIds.toString());
-                  return;
-                }
-                this.cancel();
-                this.$emit('done');
-              })
-              .catch((e) => {
-                //this.loading = false;
-              });
-          } else {
-            addReturnInformation(commitData)
-              .then(async (res) => {
-                this.loading = false;
-                this.$message.success('新增成功');
-                if (type === 'sub') {
-                  let storemanIds = '';
-                  let ids = commitData.productList.map(
-                    (item) => item.warehouseId
-                  );
-                  let warehouseList = await getWarehouseListByIds(ids || []);
-                  storemanIds = warehouseList.map((item) => item.ownerId);
-                  this.returnSubmit(res, storemanIds.toString());
-                  this.$emit('done');
-                  return;
-                }
-                this.cancel();
-                this.$emit('done');
-              })
-              .catch((e) => {
-                //this.loading = false;
-              });
-          }
-        } catch (error) {
-          console.log(error);
-          // 表单验证未通过,不执行保存操作
-        }
-      },
-      async returnSubmit(res, storemanIds) {
-        const data = await getReturnSaleOrderrecordDetail(
-          this.businessId || res
-        );
-        this.processSubmitDialogFlag = true;
 
-        this.$nextTick(() => {
-          let params = {
-            businessId: this.businessId || res,
-            businessKey:
-              this.form.returnSourceType == 1
-                ? 'sale_return_approve1'
-                : this.form.returnSourceType == 2
-                ? 'sale_entrusted_receive_return_approve'
-                : 'sales_return_approve',
-            formCreateUserId: data.createUserId,
-            variables: {
-              returnSourceType: data.returnSourceType,
-              storemanIds: storemanIds.toString(),
-              businessCode: data.returnNo,
-              businessName: data.contactName,
-              businessType:
-                data.returnSourceType == 1
-                  ? '售后退货'
-                  : data.returnSourceType == 3
-                  ? '销售发货退货'
-                  : data.returnSourceType == 2
-                  ? '受托收货退货'
-                  : '销售订单退货'
-            }
-          };
-
-          this.$refs.processSubmitDialogRef.init(params);
-        });
-      },
       reload() {
         this.cancel();
         this.$emit('done');
       },
       cancel() {
         this.$nextTick(() => {
-          this.activeName = 'base';
+          this.activeName = 'main';
           // 关闭后,销毁所有的表单数据
-          this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
-          this.$refs['formRef'] && this.$refs['formRef'].resetFields();
-          this.$store.commit('order/clearUserData');
-          this.form = copyObj(this.formDef);
+          // this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
+          // this.$refs['formRef'] && this.$refs['formRef'].resetFields();
+          // this.$store.commit('order/clearUserData');
+          // this.form = copyObj(this.formDef);
           // 通过$emit更新父组件中的detailAdjustDialogFlag值,避免直接修改prop
           this.$emit('update:detailAdjustDialogFlag', false);
         });

+ 217 - 98
src/views/saleManage/saleOrder/adjustmentNote‌/components/inventoryTable.vue

@@ -10,23 +10,25 @@
       class="time-form"
       :maxHeight="250"
     >
-      <template v-slot:singlePriceDiff="scope">
+      <template v-slot:priceDifference="scope">
         <el-form-item
           style="margin-bottom: 20px"
-          :prop="'datasource.' + scope.$index + '.singlePriceDiff'"
+          :prop="'datasource.' + scope.$index + '.priceDifference'"
         >
+          <!-- @input="handleSinglePriceDiffChange(scope.row, scope.$index)"
+            @blur="handleSinglePriceDiffChange(scope.row, scope.$index)" -->
           <el-input
-            v-model="scope.row.singlePriceDiff"
+            v-model="scope.row.priceDifference"
             placeholder="请输入"
+            :disabled="isView"
             type="number"
-            @input="handleSinglePriceDiffChange(scope.row, scope.$index)"
-            @blur="handleSinglePriceDiffChange(scope.row, scope.$index)"
+            @input="changeDiffPrice(scope.row, scope.$index)"
           >
             <!-- <template slot="append">元</template> -->
           </el-input>
         </el-form-item>
       </template>
-      <template v-slot:headerSinglePriceDiff="{ column }">
+      <template v-slot:headerPriceDifference="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
       <!-- 操作列 -->
@@ -46,12 +48,12 @@
       </template>
     </ele-pro-table>
 
-    <product-list
+    <!-- <product-list
       ref="productListRef"
       :orderId="sendId"
       type="send"
       @changeParent="changeParent"
-    ></product-list>
+    ></product-list> -->
   </el-form>
 </template>
 <script>
@@ -76,7 +78,20 @@
       type: {
         default: ''
       },
-
+      countObj: {
+        type: Object,
+        default: () => {
+          return {
+            countKey: 'quantity',
+            unitKey: 'saleUnit',
+            unitIdKey: 'saleUnitId'
+          };
+        }
+      },
+      isView: {
+        default: false,
+        type: Boolean
+      },
     },
 
     components: {
@@ -87,10 +102,12 @@
         cacheKeyUrl: 'eos-saleManage-saleOrder-adjustmentNote-inventoryTable',
         payAmount: '',
         form: {
-          datasource: []
+          datasource: [],
+          adjustDiscountAmount: 0
         },
+        allPrice: 0,
         rules: {
-          'singlePriceDiff': [
+          'priceDifference': [
             { required: true, message: '请输入', trigger: 'blur' }
           ]
         },
@@ -133,25 +150,25 @@
           },
           {
             minWidth: 150,
-            prop: 'saleCount',
+            prop: 'quantity',
             label: '数量',
             showOverflowTooltip: true,
             align: 'center'
           },
           {
             width: 100,
-            prop: 'singlePrice',
+            prop: 'adjustPrice',
             label: '单价',
-            slot: 'singlePrice',
+            slot: 'adjustPrice',
             align: 'center'
           },
           {
             width: 180,
-            prop: 'singlePriceDiff',
+            prop: 'priceDifference',
             label: '单价差异',
-            slot: 'singlePriceDiff',
+            slot: 'priceDifference',
             align: 'center',
-            headerSlot: 'headerSinglePriceDiff'
+            headerSlot: 'headerPriceDifference'
           },
           {
             width: 130,
@@ -164,29 +181,29 @@
           },
           {
             width: 130,
-            prop: 'notaxSinglePrice',
+            prop: 'unTaxPrice',
             label: '不含税单价',
-            slot: 'notaxSinglePrice',
+            slot: 'unTaxPrice',
             align: 'center'
           },
           {
             width: 130,
-            prop: 'discountSinglePrice',
+            prop: 'adjustDiscountPrice',
             label: '折让单价',
-            slot: 'discountSinglePrice',
+            slot: 'adjustDiscountPrice',
             align: 'center'
           },
           {
             width: 120,
-            prop: 'totalPrice',
-            slot: 'totalPrice',
+            prop: 'adjustAmount',
+            slot: 'adjustAmount',
             label: '合计',
             align: 'center'
           },
           {
             width: 120,
-            prop: 'discountTotalPrice',
-            slot: 'discountTotalPrice',
+            prop: 'adjustDiscountAmount',
+            slot: 'adjustDiscountAmount',
             label: '折让合计',
             align: 'center'
           },
@@ -212,10 +229,10 @@
         this.form.datasource.forEach((item, index) => {
           this.$set(
             this.form.datasource[index],
-            'totalPrice',
-            item.singlePrice * item.totalCount || 0
+            'adjustAmount',
+            item.adjustPrice * item.quantity || 0
           );
-          num += this.form.datasource[index].totalPrice;
+          num += this.form.datasource[index].adjustAmount;
         });
         return parseFloat(num).toFixed(2);
       },
@@ -226,81 +243,182 @@
     },
     methods: {
       // changeSinglePriceDiff(row, index) {
-      //   if (row.singlePriceDiff && row.singlePrice) {
+      //   if (row.priceDifference && row.singlePrice) {
       //     this.$set(
       //       this.form.datasource[index],
-      //       'totalPrice',
-      //       row.singlePriceDiff * row.totalCount || 0
+      //       'adjustAmount',
+      //       row.priceDifference * row.quantity || 0
       //     );
       //   }
       // },
+      //改变数量
+      changeDiffPrice(row, index) {
+        if (!row) {
+          this.form.datasource.forEach((item, index) => {
+            this.$set(
+              this.form,
+              'datasource[' + index + ']',
+              this.changeCount(item)
+            );
+          });
+        } else {
+          console.log('row~~~', row);
+          // 改变单价
+          this.$set(
+            this.form.datasource[index],
+            'adjustPrice',
+            row.priceDifference ? row.price + Number(row.priceDifference) : row.price
+          );
+          // 改变相关数据
+          this.$set(
+            this.form,
+            'datasource[' + index + ']',
+            this.changeCount(row)
+          );
+        }
+
+        this.getNotaxSinglePrice();
+        this.changeAll();
+        this.$forceUpdate();
+      },
+
+      //改变数量
+      changeCount(row, countObj) {
+        
+        // let total = row['quantity'] || 0;
+        let data = row;
+        // if (row.packageDispositionList) {
+        //   let endIndex = row.packageDispositionList.findIndex(
+        //     (ite) => row[countObj.unitIdKey] == ite.id
+        //   );
+        //   for (; 0 < endIndex; endIndex--) {
+        //     total = Vue.prototype.$math.format(
+        //       row.packageDispositionList[endIndex].packageCell * total,
+        //       14
+        //     );
+        //   }
+        // }
+
+        // data['totalCount'] = total;
+        data['adjustDiscountPrice'] = data.adjustPrice;
+
+
+        if (row['quantity'] && row.adjustPrice) {
+          data['adjustAmount'] = row['quantity'] * row.adjustPrice;
+          data['adjustDiscountAmount'] = data.adjustAmount;
+        } else {
+          data['adjustAmount'] = 0;
+          data['adjustDiscountAmount'] = 0;
+        }
+    
+        return data;
+
+      },
+      // 计算合计
+      getAllPrice(arr) {
+        let sum = 0;
+        arr.forEach((item) => {
+          if (item.adjustAmount) {
+            sum += Number(item.adjustAmount);
+          }
+        });
+        return isNaN(sum) ? 0 : sum.toFixed(2);
+      },
+      // 计算总差异金额
+      getDiffPriceTotal(arr) {
+        let sum = 0;
+        arr.forEach((item) => {
+          if (item.priceDifference) {
+            sum += (Number(item.priceDifference)*Number(item.quantity));
+          }
+        });
+        return isNaN(sum) ? 0 : sum.toFixed(2);
+      },
+
+      changeAll() {
+        this.allPrice = this.getAllPrice(this.form.datasource) || 0;
+        this.diffPriceTotal = this.getDiffPriceTotal(this.form.datasource) || 0;
+        // if (this.isDiscountTotalPrice) {
+          this.form.adjustDiscountAmount = this.allPrice;
+          // this.$emit('setDiscountTotalPrice', this.allPrice);
+        // }
+        this.$emit('setCountAmount', this.allPrice, this.diffPriceTotal);
+      },
+      //设置优惠后总金额修改产品单价
+      discountInputByOrder(val, amount) {
+        this.form.adjustDiscountAmount = val;
+        this.form.amount = amount;
+        this.allPrice = amount;
+
+        this.form.datasource.forEach((item, index) => {
+          this.$set(
+            this.form.datasource[index],
+            'adjustDiscountPrice',
+            this.getDiscountSinglePrice(item)
+          );
+          this.$set(
+            this.form.datasource[index],
+            'adjustDiscountAmount',
+            this.getDiscountTotalPrice(item)
+          );
+        });
+        this.$emit('setDiscountTotalPrice', val);
+
+        this.$forceUpdate();
+        this.$refs.table.reRenderTable();
+      },
       // 处理单价差异变化,更新单价
       handleSinglePriceDiffChange(row, index) {
         // 确保原单价和单价差异都有值
-        const originalPrice = Number(row.singlePrice) || 0;
-        const priceDiff = Number(row.singlePriceDiff) || 0;
+        const originalPrice = Number(row.price) || 0;
+        const priceDiff = Number(row.priceDifference) || 0;
         
         // 计算新单价 = 原单价 + 单价差异
         const newPrice = originalPrice + priceDiff;
         
         // 使用$set更新单价字段
-        this.$set(this.form.datasource[index], 'singlePrice', newPrice);
+        this.$set(this.form.datasource[index], 'adjustPrice', newPrice);
         
         // 同时更新总价
-        if (row.totalCount) {
-          this.$set(this.form.datasource[index], 'totalPrice', row.totalCount * newPrice);
+        if (row.quantity) {
+          this.$set(this.form.datasource[index], 'adjustAmount', row.quantity * newPrice);
         }
+
+        this.$emit('changePrice', {
+          total: this.totalAmount,
+        });
       },
       //计算不含税单价
       getNotaxSinglePrice() {
         this.form.datasource.forEach((item, index) => {
-          if (item.singlePrice && item.taxRate) {
+          if (item.adjustPrice && item.taxRate) {
             this.$set(
               this.form.datasource[index],
-              'notaxSinglePrice',
+              'unTaxPrice',
               parseFloat(
-                (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
+                (item.adjustPrice / (1 + item.taxRate / 100)).toFixed(2)
               )
             );
           } else {
-            this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
+            this.$set(this.form.datasource[index], 'unTaxPrice', '');
           }
         });
       },
-      //获取订单总金额
-      gettotalAmount() {
-        let productData = this.form.datasource;
-        if (productData.length) {
-          let sum = productData
-            .reduce((sum, item) => {
-              return sum + Number(item.totalPrice);
-            }, 0)
-            .toFixed(2);
-          this.payAmount = productData
-            .reduce((sum, item) => {
-              return sum + Number(item.discountTotalPrice);
-            }, 0)
-            .toFixed(2);
-          // this.$emit('update:payAmount', this.payAmount);
-          // this.$store.commit('returnGoods/setAllcountAmount', sum);
-        } else {
-          // this.$store.commit('returnGoods/setAllcountAmount', 0);
-        }
+      //获取折让单价
+      getDiscountSinglePrice(row) {
+        console.log('row~~~', this.allPrice);
+        let num =
+          (Number(this.form.adjustDiscountAmount) / Number(this.allPrice)) *
+          Number(row.adjustPrice);
+        return isNaN(num) ? '' : num;
+      },
+
+      //获取折让合计
+      getDiscountTotalPrice(row) {
+        let num = 0;
+        num = Number(row.adjustDiscountAmount) * Number(row.quantity);
+        return isNaN(num) ? '' : num.toFixed(2);
       },
-  
-      // validateTotalCount(row) {
-      //   return (rule, value, callback) => {
-      //     if (isNaN(value) || Number(value) <= 0) {
-      //       this.$message.error('请输入大于0的数');
-      //       callback(new Error('请输入大于0的数字'));
-      //     } else if (Number(value) > row.sendTotalCount) {
-      //       this.$message.error('输入的数字不能大于最大发货值');
-      //       callback(new Error('输入的数字不能大于最大发货值'));
-      //     } else {
-      //       callback();
-      //     }
-      //   };
-      // },
       getTotalCount(row) {
         let num = 0;
         this.form.datasource
@@ -313,23 +431,23 @@
       },
       // 返回列表数据
       getTableValue() {
-        let is = false;
-        this.form.datasource.forEach((item) => {
-          if (item.pricingWay == 2 && !item.totalPrice) {
-            is = true;
-          }
-        });
-        if (is) {
-          this.$message.error('合计金额不能为空');
-          return;
-        }
+        // let is = false;
+        // this.form.datasource.forEach((item) => {
+        //   if (item.pricingWay == 2 && !item.adjustAmount) {
+        //     is = true;
+        //   }
+        // });
+        // if (is) {
+        //   this.$message.error('合计金额不能为空');
+        //   return;
+        // }
         let comitDatasource = this.form.datasource;
         if (comitDatasource.length === 0) return { productList: [] };
         comitDatasource.forEach((v) => {
-          v.totalCount = Number(v.totalCount);
-          v.technicalDrawings = Array.isArray(v.technicalDrawings)
-            ? v.technicalDrawings
-            : [];
+          // v.totalCount = Number(v.totalCount);
+          // v.technicalDrawings = Array.isArray(v.technicalDrawings)
+          //   ? v.technicalDrawings
+          //   : [];
         });
         return { productList: comitDatasource, payAmount: this.totalAmount };
       },
@@ -347,28 +465,29 @@
             v.sendTotalCount = v.packingQuantity || 0;
             v.sendProductId = v.sendProductId || v.categoryId || v.productId;
             // 初始化单价差异字段,如果未定义则设为0
-            if (v.singlePrice !== undefined && v.singlePriceDiff === undefined) {
-              v.singlePriceDiff = 0;
+            if (v.adjustPrice !== undefined && v.priceDifference === undefined) {
+              v.priceDifference = '';
             }
           });
           
-          this.oldSendTotalWeightList = copyData.map((item) => {
-            return {
-              productCode: item.productCode,
-              oldSendTotalWeight: item.sendTotalWeight,
-              oldReceiveTotalWeight: item.receiveTotalWeight
-            };
-          });
+          // this.oldSendTotalWeightList = copyData.map((item) => {
+          //   return {
+          //     productCode: item.productCode,
+          //     oldSendTotalWeight: item.sendTotalWeight,
+          //     oldReceiveTotalWeight: item.receiveTotalWeight
+          //   };
+          // });
           
           this.form.datasource = copyData;
-          this.gettotalAmount();
+        
+          // this.allPrice = form.amount;
         }
       },
 
       remove(index) {
         this.form.datasource.splice(index, 1);
         this.setSort();
-        this.gettotalAmount();
+ 
       },
       // 清空表格
       restTable() {

+ 9 - 7
src/views/saleManage/saleOrder/adjustmentNote‌/components/searchTable.vue

@@ -14,21 +14,23 @@ export default {
       return [
         {
           label: '关键字:',
-          value: 'searchName',
+          value: 'keyWord',
           type: 'input',
           placeholder: '冲差编码'
         },
         {
           label: '冲差原因:',
-          value: 'statementNo',
-          type: 'input',
-          placeholder: '请输入'
+          value: 'reason',
+          type: 'DictSelection',
+          placeholder: '请选择',
+          dictName: '冲差原因:'
         },
         {
           label: '调整类型:',
-          value: 'contactName',
-          type: 'input',
-          placeholder: '请输入'
+          value: 'adjustType',
+          type: 'DictSelection',
+          placeholder: '请选择',
+          dictName: '调整类型:'
         },
       ];
     }

+ 109 - 154
src/views/saleManage/saleOrder/adjustmentNote‌/index.vue

@@ -21,16 +21,18 @@
           <!-- 表头工具栏 -->
           <template v-slot:toolbar>
             <el-button
+              v-if="showAddBtn"
               size="small"
               type="primary"
               icon="el-icon-plus"
               class="ele-btn-icon"
-              @click="handleAddOrEditAccount('add', '')"
+              @click="handleAddOrEdit('add', '')"
             >
               新建
             </el-button>
 
             <el-button
+              v-if="showAddBtn"
               size="small"
               type="danger"
               el-icon-delete
@@ -43,16 +45,6 @@
           </template>
 
           <!-- 查看详情列 -->
-
-          <template v-slot:statementNo="{ row }">
-            <el-link
-              type="primary"
-              :underline="false"
-              @click="openorderDetail(row, 'statementNo')"
-            >
-              {{ row.statementNo }}
-            </el-link>
-          </template>
           <template v-slot:orderNo="{ row }">
             <el-link
               type="primary"
@@ -62,18 +54,34 @@
               {{ row.orderNo }}
             </el-link>
           </template>
+          <!-- 冲差类型列 -->
+          <template v-slot:type="{ row }">
+            {{ row.type ? getDict('冲差类型', row.type) : '' }}
+          </template>
+          <!-- 冲差方式列 -->
+          <template v-slot:method="{ row }">
+            {{ row.method ? getDict('冲差方式', row.method) : '' }}
+          </template>
+          <!-- 冲差范围列 -->
+          <template v-slot:rangeType="{ row }">
+            {{ row.rangeType ? getDict('冲差范围', row.rangeType) : '' }}
+          </template>
+          <!-- 冲差原因列 -->
+          <template v-slot:reason="{ row }">
+            {{ getDict('冲差原因', row.reason) }}
+          </template>
+          <!-- 调整类型列 -->
+          <template v-slot:adjustType="{ row }">
+            {{ row.adjustType ? getDict('调整类型', row.adjustType) : '' }}
+          </template>
           <!-- 操作列 -->
           <template v-slot:action="{ row }">
             <el-link
+              v-if="[0, 3].includes(row.status)"
               type="primary"
               :underline="false"
               icon="el-icon-edit"
-              @click="handleAddOrEditAccount('update', row)"
-              v-if="
-                (isNeed_process_is_close &&
-                  [0, 3].includes(row.reviewStatus)) ||
-                !isNeed_process_is_close
-              "
+              @click="handleAddOrEdit('update', row)"
             >
               修改
             </el-link>
@@ -81,10 +89,8 @@
               type="primary"
               :underline="false"
               icon="el-icon-plus"
-              @click="accountstatementSubmit(row)"
-              v-if="
-                isNeed_process_is_close && [0, 3].includes(row.reviewStatus)
-              "
+              @click="adjustSubmit(row)"
+              v-if="[0, 3].includes(row.status)"
             >
               提交
             </el-link>
@@ -93,11 +99,7 @@
               class="ele-action"
               title="确定要删除此信息吗?"
               @confirm="remove([row.id])"
-              v-if="
-                (isNeed_process_is_close &&
-                  [0, 3].includes(row.reviewStatus)) ||
-                !isNeed_process_is_close
-              "
+              v-if="[0, 3].includes(row.status)"
             >
               <template v-slot:reference>
                 <el-link type="danger" :underline="false" icon="el-icon-delete">
@@ -126,36 +128,12 @@
       :saleOrderData="saleOrderData"
       @done="reload"
     ></detail-adjust-dialog>
-    <add-return-goods-dialog
-      ref="addReturnGoodsRef"
-      @done="reload"
-    ></add-return-goods-dialog>
     <!-- 多选删除弹窗 -->
     <pop-modal
       :visible.sync="delVisible"
       content="是否确定删除?"
       @done="commitBtn"
     />
-    <!--对账单详情    -->
-    <!-- <detail-dialog
-      :detailDialogFlag.sync="detailDialogFlag"
-      v-if="detailDialogFlag"
-      ref="detailDialogRef"
-    ></detail-dialog> -->
-    <!-- 创建发票选择采购对账单信息 对账明细   -->
-    <accountInfoDialog
-      ref="accountInfoDialogRef"
-      v-if="accountInfoDialogFlag"
-      :account-info-dialog-flag.sync="accountInfoDialogFlag"
-      @getAccountInfo="getAccountInfo"
-    ></accountInfoDialog>
-    <!--    新增发票-->
-    <add-invoice-dialog
-      :add-or-edit-dialog-flag.sync="addInvoiceDialogFlag"
-      ref="addInvoiceDialogRef"
-      v-if="addInvoiceDialogFlag"
-      @reload="reload"
-    ></add-invoice-dialog>
     <process-submit-dialog
       :processSubmitDialogFlag.sync="processSubmitDialogFlag"
       v-if="processSubmitDialogFlag"
@@ -171,29 +149,24 @@
   import detailAdjustDialog from './components/detailAdjustDialog.vue';
 
   import popModal from '@/components/pop-modal';
-  import { reviewStatus } from '@/enum/dict';
   import orderDetailDialog from '@/views/saleManage/saleOrder/components/detailDialog.vue';
-  import addReturnGoodsDialog from '@/views/saleManage/saleOrder/returnGoods/components/addReturnGoodsDialog';
   import {
-    getAccountstatementList,
     deletetAccountstatement,
     accountStatementExportAPI
   } from '@/api/saleManage/accountstatement';
   import dictMixins from '@/mixins/dictMixins';
-  import AccountInfoDialog from '@/views/financialManage/invoiceManage/components/accountInfoDialog.vue';
-  import addInvoiceDialog from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue';
+  import {mapGetters} from "vuex";
+
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
   import tabMixins from '@/mixins/tableColumnsMixin';
-
+  import { getTableList, deleteInfo } from '@/api/saleManage/adjustmentNote‌';
+  import { reviewStatus } from '@/enum/dict';
   export default {
     mixins: [dictMixins,tabMixins],
     components: {
       processSubmitDialog,
-      addInvoiceDialog,
-      AccountInfoDialog,
       searchTable,
       popModal,
-      addReturnGoodsDialog,
       orderDetailDialog,
       addAdjustDialog,
       detailAdjustDialog,
@@ -205,17 +178,15 @@
     },
     //客户管理数据
     props: {
-      contactData: {
-        type: Object,
-        default: () => {
-          return {};
-        }
-      },
       saleOrderData: {
         type: Object,
         default: () => {
           return {};
         }
+      },
+      showAddBtn: {
+        type: Boolean,
+        default: false
       }
     },
     data() {
@@ -253,105 +224,99 @@
             fixed: 'left'
           },
           {
-            prop: 'statementNo',
+            prop: 'orderNo',
             label: '冲差单编码',
             align: 'center',
-            slot: 'statementNo',
+            slot: 'orderNo',
             sortable: true,
             showOverflowTooltip: true,
             minWidth: 200
           },
           {
-            prop: 'contactName',
+            prop: 'type',
             label: '冲差类型',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 180
+            minWidth: 180,
+            slot: 'type'
           },
           {
-          prop: '关联订单编码',
-          label: '对账方式',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 150,
-          formatter: (_row, _column, cellValue) => {
-            return cellValue==1?'按年度':cellValue==2?'按季度':cellValue==3?'按月度':'按时间段'
-          }
-        },
+            prop: 'sourceNo',
+            label: '关联订单编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+          },
           {
-            prop: '冲差方式',
-            label: '对账开始日期',
+            prop: 'method',
+            label: '冲差方式',
             align: 'center',
             slot: 'startDate',
             showOverflowTooltip: true,
-            minWidth: 200
+            minWidth: 200,
+            slot: 'method'
           },
           {
-            prop: 'endDate',
+            prop: 'rangeType',
             label: '冲差范围',
             align: 'center',
-            slot: 'endDate',
             showOverflowTooltip: true,
-            minWidth: 200
+            minWidth: 200,
+            slot: 'rangeType'
           },
           {
-            prop: '冲差原因',
-            label: '总金额',
+            prop: 'reason',
+            label: '冲差原因',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 130
+            minWidth: 130,
+            slot: 'reason'
           },
           {
-            prop: 'amountReceivablePrice',
+            prop: 'adjustType',
             label: '调整类型',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 130
+            minWidth: 130,
+            slot: 'adjustType'
           },
           {
-            prop: 'amountPayablePrice',
+            prop: 'amount',
             label: '原总金额',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 130
           },
           {
-            prop: 'reviewStatus',
+            prop: 'discountAmount',
             label: '原优惠后总金额',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 200,
-            formatter: (_row, _column, cellValue) => {
-              return reviewStatus[_row.reviewStatus];
-            }
           },
           {
-            prop: 'replied',
+            prop: 'differenceAmount',
             label: '总差异金额',
             align: 'center',
-            slot: 'replied',
             showOverflowTooltip: true,
             minWidth: 200,
-            formatter: (_row, _column, cellValue) => {
-              return _row.replied ? '是' : '否';
-            }
           },
           {
-            prop: 'createUserName',
+            prop: 'adjustAmount',
             label: '新总金额',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 80
           },
           {
-            prop: 'createTime',
+            prop: 'adjustDiscountAmount',
             label: '新优惠后总金额',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 170
           },
           {
-            prop: 'createTime',
+            prop: 'createUserName',
             label: '创建人',
             align: 'center',
             showOverflowTooltip: true,
@@ -365,11 +330,14 @@
             minWidth: 170
           },
           {
-            prop: 'createTime',
+            prop: 'status',
             label: '状态',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 170
+            minWidth: 170,
+            formatter: (_row, _column, cellValue) => {
+              return reviewStatus[_row.status];
+            }
           },
           {
             columnKey: 'action',
@@ -385,22 +353,34 @@
         cacheKeyUrl:'eos-saleManage-saleOrder-adjustmentNote-index',
       };
     },
-    computed: {},
+    created() {
+      this.requestDict('冲差原因');
+      this.requestDict('调整类型');
+      this.requestDict('冲差范围');
+      this.requestDict('冲差方式');
+      this.requestDict('冲差类型');
+    },
+    computed: {
+      ...mapGetters(['dict','getDictValue']),
+      getDict() {
+        return (dictName, val) => {
+          // console.log(dictName, val)
+          // console.log(this.getDictValue(dictName, val))
+          return this.getDictValue(dictName, val)
+        }
+      },
+    },
 
     methods: {
       /* 表格数据源 */
       datasource({ page, limit, where, order }) {
-        if (this.contactData.id) {
-          where['contactId'] = this.contactData.id;
-        }
         if (this.saleOrderData.id) {
-          where['orderCode'] = this.saleOrderData.orderNo;
+          where['sourceId'] = this.saleOrderData.id;
         }
 
-        return getAccountstatementList({
+        return getTableList({
           pageNum: page,
-          size: limit,
-          type: 1,
+          pageSize: limit,
           ...where
         });
       },
@@ -413,10 +393,10 @@
       },
 
       //新增编辑
-      handleAddOrEditAccount(type, row) {
+      handleAddOrEdit(type, row) {
         this.addAdjustDialogFlag = true;
         this.$nextTick(() => {
-          this.$refs.addAdjustDialogRef.open(type, row, '1');
+          this.$refs.addAdjustDialogRef.open(type, row);
         });
       },
       //导出
@@ -424,32 +404,7 @@
         let data = await accountStatementExportAPI(row.id);
         saveAs(data.data, '应收对账单');
       },
-      /*新增发票*/
-      handleAddInvoice(row) {
-        this.currentRow = row;
-        this.accountInfoDialogFlag = true;
-        this.$nextTick(() => {
-          this.$refs.accountInfoDialogRef.createInvoice(
-            row,
-            'add',
-            'saleOrder'
-          );
-        });
-      },
-      /*新增发票选择对账单信息回调*/
-      getAccountInfo(row) {
-        this.currentRow.children = row;
-        setTimeout(() => {
-          this.addInvoiceDialogFlag = true;
-          this.$nextTick(() => {
-            this.$refs.addInvoiceDialogRef.createInvoice(
-              {},
-              1,
-              this.currentRow
-            );
-          });
-        }, 400);
-      },
+
       //批量删除
       allDelBtn() {
         if (this.selection.length === 0) return;
@@ -465,7 +420,7 @@
 
       //删除接口
       remove(delData) {
-        deletetAccountstatement(delData).then((res) => {
+        deleteInfo(delData).then((res) => {
           this.$message.success('删除成功!');
           this.reload();
         });
@@ -476,18 +431,18 @@
         const dataId = this.selection.map((v) => v.id);
         this.remove(dataId);
       },
-      accountstatementSubmit(res) {
+      adjustSubmit(res) {
         this.processSubmitDialogFlag = true;
         this.$nextTick(() => {
           let params = {
             businessId: res.id,
-            businessKey: 'sales_account_statement_approve',
+            businessKey: 'punch_slip_order_approve',
             formCreateUserId: res.createUserId,
             variables: {
-              type: '1',
-              businessCode: res.statementNo,
-              businessName: res.contactName,
-              businessType: '对账单'
+              // type: '1',
+              businessCode: res.orderNo,
+              businessName: res.createUserName,
+              businessType: '冲差单'
             }
             // callBackMethodType : '1',
             // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
@@ -509,15 +464,15 @@
       },
       //查看详情
       openorderDetail(row, type) {
-        if (type === 'statementNo') {
-          this.detailDialogFlag = true;
+        // if (type === 'statementNo') {
+          this.detailAdjustDialogFlag = true;
           this.$nextTick(() => {
-            this.$refs.detailAdjustDialogRef.open('view', row, '1');
+            this.$refs.detailAdjustDialogRef.open('view', row);
           });
-        }
-        if (type === 'orderNo') {
-          this.$refs.orderDetailDialogRef.open({ id: row.orderId });
-        }
+        // }
+        // if (type === 'orderNo') {
+        //   this.$refs.orderDetailDialogRef.open({ id: row.orderId });
+        // }
       }
     }
   };

+ 1 - 0
src/views/saleManage/saleOrder/components/drawer.vue

@@ -136,6 +136,7 @@
         <el-tab-pane label="冲差单" name="冲差单">
           <adjustmentNote
           :saleOrderData="row"
+          :showAdd="true"
           ref="adjustmentNoteRef"
           ></adjustmentNote>
         </el-tab-pane>