Przeglądaj źródła

销售/采购/合同流程新增折后单价和折后合计

Z 2 lat temu
rodzic
commit
aab827ea83
19 zmienionych plików z 711 dodań i 413 usunięć
  1. 74 4
      src/views/bpm/handleTask/components/contractBook/inventoryTable.vue
  2. 13 1
      src/views/bpm/handleTask/components/contractBook/inventoryTabledetail.vue
  3. 15 1
      src/views/bpm/handleTask/components/purchaseOrder/accountstatement/inventoryTable.vue
  4. 15 0
      src/views/bpm/handleTask/components/purchaseOrder/detailDialog.vue
  5. 12 0
      src/views/bpm/handleTask/components/purchaseOrder/inventoryTable.vue
  6. 12 0
      src/views/bpm/handleTask/components/purchaseOrder/invoice/detailDialog.vue
  7. 17 0
      src/views/bpm/handleTask/components/purchaseOrder/invoice/inventoryTable.vue
  8. 2 5
      src/views/bpm/handleTask/components/purchaseOrder/returnGoods/addReturnGoodsDialog.vue
  9. 12 0
      src/views/bpm/handleTask/components/purchaseOrder/returnGoods/detailDialog.vue
  10. 407 379
      src/views/bpm/handleTask/components/purchaseOrder/returnGoods/inventoryTable.vue
  11. 2 7
      src/views/bpm/handleTask/components/purchaseOrder/returnGoods/submit.vue
  12. 17 1
      src/views/bpm/handleTask/components/saleOrder/accountstatement/inventoryTable.vue
  13. 18 8
      src/views/bpm/handleTask/components/saleOrder/addDialog.vue
  14. 16 1
      src/views/bpm/handleTask/components/saleOrder/inventoryTable.vue
  15. 16 2
      src/views/bpm/handleTask/components/saleOrder/invoice/addInvoiceDialog.vue
  16. 13 1
      src/views/bpm/handleTask/components/saleOrder/invoice/detailDialog.vue
  17. 12 0
      src/views/bpm/handleTask/components/saleOrder/invoice/inventoryTable.vue
  18. 12 0
      src/views/bpm/handleTask/components/saleOrder/returnGoods/detailDialog.vue
  19. 26 3
      src/views/bpm/handleTask/components/saleOrder/returnGoods/inventoryTable.vue

+ 74 - 4
src/views/bpm/handleTask/components/contractBook/inventoryTable.vue

@@ -239,7 +239,7 @@
           <el-input
             v-model="scope.row.singlePrice"
             placeholder="请输入"
-            @input="getTotalPrice"
+            @input="getTotalPrice(scope.row)"
             :disabled="(!!taskDefinitionKey&&taskDefinitionKey!=='salesManagerApprove')||isContractId"
           >
             <template slot="append">元</template>
@@ -600,6 +600,12 @@
             headerSlot: 'headerSinglePrice',
             show: this.isSinglePrice
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            show: this.isSinglePrice
+          },
           {
             width: 120,
             prop: 'totalCount',
@@ -619,6 +625,11 @@
             label: '合计',
             slot: 'totalPrice'
           },
+          {
+            width: 160,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+          },
           {
             width: 120,
             prop: 'singleWeight',
@@ -855,7 +866,6 @@
           let guaranteePeriodUnitName = this.guaranteePeriodUnit(
             row.guaranteePeriodUnitCode
           );
-          console.log(guaranteePeriodUnitName,'===================');
           this.$set(
             this.form.datasource[index],
             'guaranteePeriodDeadline',
@@ -899,7 +909,6 @@
 
           v.otherFiles = v.otherFiles || [];
         });
-        console.log(comitDatasource,'comitDatasourcecomitDatasourcecomitDatasource');
         return comitDatasource;
       },
       getPrice() {
@@ -913,8 +922,10 @@
           let datasource = this.form.datasource,
             sum = 0;
           datasource.forEach((r) => {
+            r.discountSinglePrice = r.singlePrice
             if (r.singlePrice && r.totalCount) {
               sum += r.singlePrice * r.totalCount;
+              r.discountTotalPrice = r.discountSinglePrice * r.totalCount
             }
           });
           let allsum = sum.toFixed(2);
@@ -922,10 +933,12 @@
           this.discountTotalPrice = allsum;
           this.$store.commit('concact/setDiscountAmount', allsum);
           this.$store.commit('order/setAllcountAmount', allsum);
+          this.$emit('orderDiscountAmount', this.allPrice)
           return allsum;
         } else {
           this.allPrice = 0.0;
           this.discountTotalPrice = 0.0;
+          this.$emit('orderDiscountAmount', this.allPrice)
           return 0.0;
         }
       },
@@ -933,6 +946,31 @@
       discountInput(val) {
         this.$store.commit('concact/setDiscountAmount', val);
       },
+      //设置优惠总金额修改产品单价
+      discountInputByOrder(val) {
+        //获取优惠金额和总计的差价
+        let diffPrice = this.allPrice - val
+        this.form.datasource.forEach((item) => {
+          if(val===0){
+            item.discountTotalPrice = 0
+            item.discountSinglePrice = 0
+            return
+          }
+          if(!val){
+            item.discountTotalPrice = item.totalPrice
+            item.discountSinglePrice = item.singlePrice
+            return
+          }
+          //获取详情每条的小计
+          let totalPrice = item.totalCount * item.singlePrice
+          // 使用小计除以总价得出该条数据小计占比 在乘以差价或的该条数据应承担的差价 在小计-应承担差价获得折让后的小计
+          item.discountTotalPrice = (totalPrice - totalPrice / this.allPrice * diffPrice).toFixed(2)
+          //使用折让后的小计除以数量得到单价
+          item.discountSinglePrice = (item.discountTotalPrice / item.totalCount).toFixed(2)
+        })
+        this.$refs.table.reload()
+        this.$store.commit('concact/setDiscountAmount', val);
+      },
       //修改回显
       putTableValue(data) {
         let productList =
@@ -967,10 +1005,42 @@
           this.discountInput(data?.contractVO?.discountTotalPrice);
         }
       },
+
+      //修改订单未选择合同时回显
+      putTableValueByOrder(row) {
+        let data = {...row}
+        let productList =
+          (data && data.productList) || [];
+        if (productList) {
+          productList.forEach((item) => {
+            item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode ? item.guaranteePeriodUnitCode + '' : '';
+            // if (item.deliveryDays) {
+            //   item['deliveryDeadline'] =
+            //     item['deliveryDeadline'] || this.setDay(item.deliveryDays);
+            // }
+            let guaranteePeriodUnitName = this.guaranteePeriodUnit(
+              item.guaranteePeriodUnitCode
+            );
+            if (item.guaranteePeriod && item.guaranteePeriodUnitCode) {
+              item['guaranteePeriodDeadline'] =
+                item['guaranteePeriodDeadline'] ||
+                guaranteePeriodUnitName != 'second'
+                  ? this.setDay(item.guaranteePeriod, guaranteePeriodUnitName)
+                  : '';
+            }
+          });
+          this.form.datasource = productList;
+          this.allPrice = data.totalAmount;
+          this.form.discountTotalPrice = data.payAmount;
+        }
+      },
+
+
       //计算单重
       singleWeightChange(row={}) {
         if (row && row.singleWeight && row.totalCount) {
-         return row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2);
+          console.log(111);
+          return row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2);
         }
         return row.totalWeight = 0
 

+ 13 - 1
src/views/bpm/handleTask/components/contractBook/inventoryTabledetail.vue

@@ -168,7 +168,13 @@
             slot: 'singlePrice',
             show:this.isSinglePrice
           },
-
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            slot: 'discountSinglePrice',
+            show:this.isSinglePrice
+          },
           {
             width: 120,
             prop: 'totalCount',
@@ -190,6 +196,12 @@
               return _row.totalPrice + '元';
             }
           },
+          {
+            width: 160,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            slot: 'discountTotalPrice',
+          },
           {
             width: 120,
             prop: 'singleWeight',

+ 15 - 1
src/views/bpm/handleTask/components/purchaseOrder/accountstatement/inventoryTable.vue

@@ -162,6 +162,13 @@ export default {
           align: 'center',
           slot: 'singlePrice'
         },
+        {
+          minWidth: 100,
+          prop: 'discountSinglePrice',
+          label: '折后单价',
+          align: 'center',
+          slot: 'discountSinglePrice'
+        },
         {
           minWidth: 130,
           prop: 'contractTotalPrice',
@@ -191,6 +198,13 @@ export default {
           align: 'center',
           slot: 'totalPrice'
         },
+        {
+          minWidth: 130,
+          prop: 'discountTotalPrice',
+          label: '折后已收货金额',
+          align: 'center',
+          slot: 'discountTotalPrice'
+        },
       ]
       let permissionType = {
         'financeLeader': [
@@ -435,7 +449,7 @@ export default {
     getSummaries(param) {
       const {columns, data} = param;
       const sums = [];
-      let fields = ['totalPrice', 'paidPrice', 'notPaidPrice', 'invoicedPrice', 'notInvoicedPrice']
+      let fields = ['totalPrice', 'paidPrice', 'notPaidPrice', 'invoicedPrice', 'notInvoicedPrice','discountTotalPrice']
       columns.forEach((column, index) => {
         if (index === 0) {
           sums[index] = '合计';

+ 15 - 0
src/views/bpm/handleTask/components/purchaseOrder/detailDialog.vue

@@ -398,6 +398,12 @@
             label: '单价',
             slot: 'singlePrice'
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折后单价',
+            slot: 'discountSinglePrice'
+          },
           {
             width: 120,
             prop: 'totalPrice',
@@ -407,6 +413,15 @@
               return _row.totalPrice + '元';
             }
           },
+          {
+            width: 120,
+            prop: 'discountTotalPrice',
+            label: '折后采购总金额',
+            slot: 'discountTotalPrice',
+            formatter: (_row, _column, cellValue) => {
+              return _row.discountTotalPrice + '元';
+            }
+          },
           //
           // {
           //   width: 120,

+ 12 - 0
src/views/bpm/handleTask/components/purchaseOrder/inventoryTable.vue

@@ -446,12 +446,24 @@ export default {
           label: '单价',
           slot: 'singlePrice'
         },
+        {
+          width: 160,
+          prop: 'discountSinglePrice',
+          label: '折后单价',
+          slot: 'discountSinglePrice'
+        },
         {
           width: 120,
           prop: 'totalPrice',
           label: '合计',
           slot: 'totalPrice'
         },
+        {
+          width: 120,
+          prop: 'discountTotalPrice',
+          label: '折后合计',
+          slot: 'discountTotalPrice'
+        },
         // {
         //   width: 80,
         //   prop: 'deliveryDays',

+ 12 - 0
src/views/bpm/handleTask/components/purchaseOrder/invoice/detailDialog.vue

@@ -295,12 +295,24 @@
             label: '单价',
             slot: 'singlePrice'
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折后单价',
+            slot: 'discountSinglePrice'
+          },
           {
             width: 120,
             prop: 'totalPrice',
             label: '合计',
             slot: 'totalPrice'
           },
+          {
+            width: 120,
+            prop: 'discountTotalPrice',
+            label: '折后合计',
+            slot: 'discountTotalPrice'
+          },
           {
             width: 80,
             prop: 'deliveryDays',

+ 17 - 0
src/views/bpm/handleTask/components/purchaseOrder/invoice/inventoryTable.vue

@@ -247,12 +247,24 @@
             label: '单价',
             slot: 'singlePrice'
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折后单价',
+            slot: 'discountSinglePrice'
+          },
           {
             width: 120,
             prop: 'totalPrice',
             label: '合计',
             slot: 'totalPrice'
           },
+          {
+            width: 120,
+            prop: 'discountTotalPrice',
+            label: '折后合计',
+            slot: 'discountTotalPrice'
+          },
           {
             width: 80,
             prop: 'deliveryDays',
@@ -346,6 +358,11 @@
           'totalPrice',
           (Number(this.form.datasource[index].singlePrice) * val).toFixed(2)
         );
+        this.$set(
+          this.form.datasource[index],
+          'discountTotalPrice',
+          (Number(this.form.datasource[index].discountSinglePrice) * val).toFixed(2)
+        );
       },
       //选择产品回调
       changeParent(obj, idx) {

+ 2 - 5
src/views/bpm/handleTask/components/purchaseOrder/returnGoods/addReturnGoodsDialog.vue

@@ -66,6 +66,7 @@
       </el-row>
       <headerTitle title="产品清单" style="margin-top: 30px"></headerTitle>
       <inventoryTable
+        :payAmount.sync="form.payAmount"
         ref="inventoryTableref"
         :receiveId="form.receiveId"
       ></inventoryTable>
@@ -94,7 +95,7 @@
       ref="sendListDialogRef"
       @changeParent="changeOrder"
     ></sendListDialog>
-   
+
   </div>
 </template>
 
@@ -174,10 +175,6 @@
     computed: {
       totalAmount() {
         let allcountAmount = this.$store.state.returnGoods.allcountAmount;
-        if (!this.$store.state.isDefaultPayableAmount) {
-          this.form.payAmount = allcountAmount;
-        }
-
         return allcountAmount;
       }
     },

+ 12 - 0
src/views/bpm/handleTask/components/purchaseOrder/returnGoods/detailDialog.vue

@@ -300,12 +300,24 @@
             label: '单价',
             slot: 'singlePrice'
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            slot: 'discountSinglePrice'
+          },
           {
             width: 120,
             prop: 'totalPrice',
             label: '合计',
             slot: 'totalPrice'
           },
+          {
+            width: 160,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            slot: 'discountTotalPrice'
+          },
           {
             width: 200,
             prop: 'returnReason',

+ 407 - 379
src/views/bpm/handleTask/components/purchaseOrder/returnGoods/inventoryTable.vue

@@ -143,411 +143,439 @@
   </el-form>
 </template>
 <script>
-  import { numberReg } from 'ele-admin';
-  import dictMixins from '@/mixins/dictMixins';
-  import productList from '@/views/bpm/handleTask/components/saleOrder/invoice/product-list.vue';
+import {numberReg} from 'ele-admin';
+import dictMixins from '@/mixins/dictMixins';
+import productList from '@/views/bpm/handleTask/components/saleOrder/invoice/product-list.vue';
 
-  import { getWarehouseOutStock } from '@/api/bpm/components/saleManage/saleorder';
-  export default {
-    mixins: [dictMixins],
-    props: {
-      receiveId: String
-    },
-    components: {
-      productList
-    },
-    data() {
-      const defaultForm = {
-        key: null,
-        endTime: '',
-        isFirst: 0,
-        name: '',
-        startTime: '',
-        workHour: '',
-        technicalDrawings: []
-      };
-      return {
-        discountTotalPrice: 0.0,
-        allPrice: 0.0,
-        numberReg,
-        defaultForm,
-        // warehouseList: [],
-        form: {
-          datasource: []
-        },
-        rules: {},
+import {getWarehouseOutStock} from '@/api/bpm/components/saleManage/saleorder';
+
+export default {
+  mixins: [dictMixins],
+  props: {
+    receiveId: String,
+    payAmount: [Number,String]
+  },
+  components: {
+    productList
+  },
+  data() {
+    const defaultForm = {
+      key: null,
+      endTime: '',
+      isFirst: 0,
+      name: '',
+      startTime: '',
+      workHour: '',
+      technicalDrawings: []
+    };
+    return {
+      discountTotalPrice: 0.0,
+      allPrice: 0.0,
+      numberReg,
+      defaultForm,
+      // warehouseList: [],
+      form: {
+        datasource: []
+      },
+      rules: {},
 
-        columns: [
-          {
-            width: 45,
-            type: 'index',
-            columnKey: 'index',
-            align: 'center',
-            fixed: 'left'
-          },
-          {
-            width: 200,
-            prop: 'productName',
-            label: '名称',
-            slot: 'productName'
-          },
-          {
-            width: 120,
-            prop: 'productCode',
-            label: '编码',
-            slot: 'productCode'
-          },
-          {
-            width: 200,
-            prop: 'productCategoryName',
-            label: '类型',
-            slot: 'productCategoryName'
-          },
-          {
-            width: 160,
-            prop: 'productBrand',
-            label: '牌号',
-            slot: 'productBrand'
-          },
-          {
-            width: 120,
-            prop: 'modelType',
-            label: '型号',
-            slot: 'modelType'
-          },
-          {
-            width: 120,
-            prop: 'specification',
-            label: '规格',
-            slot: 'specification'
-          },
-          {
-            width: 200,
-            prop: 'warehouseName',
-            label: '仓库名称',
-            slot: 'warehouseName'
-          },
-          {
-            width: 100,
-            prop: 'warehouseNum',
-            label: '库存',
-            slot: 'warehouseNum'
-          },
-          {
-            width: 120,
-            prop: 'receiveTotalCount',
-            label: '收货数量',
-            slot: 'receiveTotalCount'
-          },
-          {
-            width: 120,
-            prop: 'totalCount',
-            label: '退货数量',
-            slot: 'totalCount',
-            headerSlot: 'headerTotalCount'
-          },
-          {
-            width: 80,
-            prop: 'measuringUnit',
-            label: '计量单位',
-            slot: 'measuringUnit'
-          },
-          {
-            width: 160,
-            prop: 'singlePrice',
-            label: '单价',
-            slot: 'singlePrice'
-          },
-          {
-            width: 120,
-            prop: 'totalPrice',
-            label: '合计',
-            slot: 'totalPrice'
-          },
-          {
-            width: 200,
-            prop: 'returnReason',
-            label: '退货原因',
-            slot: 'returnReason'
-          },
-          // {
-          //   width: 140,
-          //   prop: 'returnType',
-          //   label: '退货类型',
-          //   slot: 'returnType'
-          // },
+      columns: [
+        {
+          width: 45,
+          type: 'index',
+          columnKey: 'index',
+          align: 'center',
+          fixed: 'left'
+        },
+        {
+          width: 200,
+          prop: 'productName',
+          label: '名称',
+          slot: 'productName'
+        },
+        {
+          width: 120,
+          prop: 'productCode',
+          label: '编码',
+          slot: 'productCode'
+        },
+        {
+          width: 200,
+          prop: 'productCategoryName',
+          label: '类型',
+          slot: 'productCategoryName'
+        },
+        {
+          width: 160,
+          prop: 'productBrand',
+          label: '牌号',
+          slot: 'productBrand'
+        },
+        {
+          width: 120,
+          prop: 'modelType',
+          label: '型号',
+          slot: 'modelType'
+        },
+        {
+          width: 120,
+          prop: 'specification',
+          label: '规格',
+          slot: 'specification'
+        },
+        {
+          width: 200,
+          prop: 'warehouseName',
+          label: '仓库名称',
+          slot: 'warehouseName'
+        },
+        {
+          width: 100,
+          prop: 'warehouseNum',
+          label: '库存',
+          slot: 'warehouseNum'
+        },
+        {
+          width: 120,
+          prop: 'receiveTotalCount',
+          label: '收货数量',
+          slot: 'receiveTotalCount'
+        },
+        {
+          width: 120,
+          prop: 'totalCount',
+          label: '退货数量',
+          slot: 'totalCount',
+          headerSlot: 'headerTotalCount'
+        },
+        {
+          width: 80,
+          prop: 'measuringUnit',
+          label: '计量单位',
+          slot: 'measuringUnit'
+        },
+        {
+          width: 160,
+          prop: 'singlePrice',
+          label: '单价',
+          slot: 'singlePrice'
+        },
+        {
+          width: 160,
+          prop: 'discountSinglePrice',
+          label: '折让单价',
+          slot: 'discountSinglePrice'
+        },
+        {
+          width: 120,
+          prop: 'totalPrice',
+          label: '合计',
+          slot: 'totalPrice'
+        },
+        {
+          width: 160,
+          prop: 'discountTotalPrice',
+          label: '折让合计',
+          slot: 'discountTotalPrice'
+        },
+        {
+          width: 200,
+          prop: 'returnReason',
+          label: '退货原因',
+          slot: 'returnReason'
+        },
+        // {
+        //   width: 140,
+        //   prop: 'returnType',
+        //   label: '退货类型',
+        //   slot: 'returnType'
+        // },
 
-          // {
-          //   width: 80,
-          //   prop: 'deliveryDays',
-          //   label: '交期(天)',
-          //   slot: 'deliveryDays'
-          // },
-          // {
-          //   width: 200,
-          //   prop: 'guaranteePeriod',
-          //   label: '质保期',
-          //   slot: 'guaranteePeriod'
-          // },
+        // {
+        //   width: 80,
+        //   prop: 'deliveryDays',
+        //   label: '交期(天)',
+        //   slot: 'deliveryDays'
+        // },
+        // {
+        //   width: 200,
+        //   prop: 'guaranteePeriod',
+        //   label: '质保期',
+        //   slot: 'guaranteePeriod'
+        // },
 
-          // {
-          //   width: 130,
-          //   prop: 'technicalAnswerName',
-          //   label: '技术答疑人',
-          //   slot: 'technicalAnswerName'
-          // },
-          // {
-          //   width: 220,
-          //   prop: 'technicalParams',
-          //   label: '技术参数',
-          //   slot: 'technicalParams'
-          // },
-          // {
-          //   width: 240,
-          //   prop: 'technicalDrawings',
-          //   label: '技术图纸',
-          //   slot: 'technicalDrawings'
-          // },
-          {
-            width: 220,
-            prop: 'remark',
-            label: '备注',
-            slot: 'remark'
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 120,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            fixed: 'right',
-            showOverflowTooltip: true
-          }
-        ]
-      };
+        // {
+        //   width: 130,
+        //   prop: 'technicalAnswerName',
+        //   label: '技术答疑人',
+        //   slot: 'technicalAnswerName'
+        // },
+        // {
+        //   width: 220,
+        //   prop: 'technicalParams',
+        //   label: '技术参数',
+        //   slot: 'technicalParams'
+        // },
+        // {
+        //   width: 240,
+        //   prop: 'technicalDrawings',
+        //   label: '技术图纸',
+        //   slot: 'technicalDrawings'
+        // },
+        {
+          width: 220,
+          prop: 'remark',
+          label: '备注',
+          slot: 'remark'
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 120,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          fixed: 'right',
+          showOverflowTooltip: true
+        }
+      ]
+    };
+  },
+  computed: {
+    contractId() {
+      return this.$store.state.order.contractId;
+    }
+  },
+  created() {
+    // getWarehouseList().then((res) => {
+    //   this.warehouseList = res;
+    // });
+  },
+  methods: {
+    //修改数量更新合计
+    changeNum(val, index) {
+      this.$set(
+        this.form.datasource[index],
+        'totalPrice',
+        (Number(this.form.datasource[index].singlePrice) * val).toFixed(2)
+      );
+      this.$set(
+        this.form.datasource[index],
+        'discountTotalPrice',
+        (Number(this.form.datasource[index].discountSinglePrice) * val).toFixed(2)
+      );
+      this.$store.commit('returnGoods/setIsDefaultPayableAmount', false);
+      this.gettotalAmount();
     },
-    computed: {
-      contractId() {
-        return this.$store.state.order.contractId;
+    //获取订单总金额
+    gettotalAmount() {
+      let productData = this.form.datasource;
+      if (productData.length) {
+        let sum = productData
+          .reduce((sum, item) => {
+            return sum + Number(item.totalPrice);
+          }, 0)
+          .toFixed(2);
+        this.$emit('update:payAmount', productData
+          .reduce((sum, item) => {
+            return sum + Number(item.discountTotalPrice);
+          }, 0).toFixed(2))
+        this.$store.commit('returnGoods/setAllcountAmount', sum);
+      } else {
+        this.$store.commit('returnGoods/setAllcountAmount', 0);
       }
     },
-    created() {
-      // getWarehouseList().then((res) => {
-      //   this.warehouseList = res;
-      // });
-    },
-    methods: {
-      //修改数量更新合计
-      changeNum(val, index) {
-        this.$set(
-          this.form.datasource[index],
-          'totalPrice',
-          (Number(this.form.datasource[index].singlePrice) * val).toFixed(2)
-        );
-        this.$store.commit('returnGoods/setIsDefaultPayableAmount', false);
-        this.gettotalAmount();
-      },
-      //获取订单总金额
-      gettotalAmount() {
-        let productData = this.form.datasource;
-        if (productData.length) {
-          let sum = productData
-            .reduce((sum, item) => {
-              return sum + Number(item.totalPrice);
-            }, 0)
-            .toFixed(2);
-          this.$store.commit('returnGoods/setAllcountAmount', sum);
-        } else {
-          this.$store.commit('returnGoods/setAllcountAmount', 0);
-        }
-      },
-      //选择产品回调
-      async changeParent(obj, idx) {
-        obj.receiveTotalCount = obj.totalCount;
-        obj.receiveProductId = obj.id;
-        obj.id = '';
-
-        if (obj.warehouseId) {
-          obj['warehouseNum'] = await getWarehouseOutStock({
-            warehouseId: obj.warehouseId,
-            code: obj.productCode
-          });
-        }
-        this.$set(this.form.datasource, this.form.datasource.length, obj);
-      },
+    //选择产品回调
+    async changeParent(obj, idx) {
+      obj.receiveTotalCount = obj.totalCount;
+      obj.receiveProductId = obj.id;
+      obj.id = '';
 
-      // async warehouseChange(index, row) {
-      //   let warehouseIds =
-      //     this.form.datasource
-      //       .filter(
-      //         (item, i) => row.productCode == item.productCode && index != i
-      //       )
-      //       .map((item) => item.warehouseId) || [];
-      //   const data = this.warehouseList.find(
-      //     (item) => item.id == row.warehouseId
-      //   );
-      //   if (warehouseIds.length > 0 && warehouseIds.includes(row.warehouseId)) {
-      //     row.warehouseId = '';
-      //     return this.$message.error('同一个产品不能选择相同的仓库');
-      //   }
+      if (obj.warehouseId) {
+        obj['warehouseNum'] = await getWarehouseOutStock({
+          warehouseId: obj.warehouseId,
+          code: obj.productCode
+        });
+      }
+      this.$set(this.form.datasource, this.form.datasource.length, obj);
+    },
 
-      //   this.$set(this.form.datasource[index], 'warehouseName', data.name);
-      //   this.$set(this.form.datasource[index], 'warehouseCode', data.code);
-      //   const warehouseOutStock = await getWarehouseOutStock({
-      //     warehouseId: data.id,
-      //     code: row.productCode
-      //   });
-      //   this.$set(
-      //     this.form.datasource[index],
-      //     'warehouseNum',
-      //     warehouseOutStock
-      //   );
-      // },
+    // async warehouseChange(index, row) {
+    //   let warehouseIds =
+    //     this.form.datasource
+    //       .filter(
+    //         (item, i) => row.productCode == item.productCode && index != i
+    //       )
+    //       .map((item) => item.warehouseId) || [];
+    //   const data = this.warehouseList.find(
+    //     (item) => item.id == row.warehouseId
+    //   );
+    //   if (warehouseIds.length > 0 && warehouseIds.includes(row.warehouseId)) {
+    //     row.warehouseId = '';
+    //     return this.$message.error('同一个产品不能选择相同的仓库');
+    //   }
 
-      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.receiveTotalCount) {
-            this.$message.error('退货数量不能大于收货数量');
-            callback(new Error('退货数量不能大于收货数量'));
-          } else {
-            callback();
-          }
-        };
-      },
-      // else if (this.getTotalCount(row)> row.warehouseNum) {
-      //       this.$message.error('退货数量不能大于库存');
-      //       callback(new Error('退货数量不能大于库存'));
-      //     }
-      getTotalCount(row) {
-        let num = 0;
-        this.form.datasource
-          .filter((item) => item.warehouseId == row.warehouseId)
-          .forEach((item) => {
-            num += Number(item.totalCount);
-          });
+    //   this.$set(this.form.datasource[index], 'warehouseName', data.name);
+    //   this.$set(this.form.datasource[index], 'warehouseCode', data.code);
+    //   const warehouseOutStock = await getWarehouseOutStock({
+    //     warehouseId: data.id,
+    //     code: row.productCode
+    //   });
+    //   this.$set(
+    //     this.form.datasource[index],
+    //     'warehouseNum',
+    //     warehouseOutStock
+    //   );
+    // },
 
-        return num;
-      },
-      // 返回列表数据
-      getTableValue() {
-        let comitDatasource = this.form.datasource;
-        if (comitDatasource.length === 0) return [];
-        comitDatasource.forEach((v) => {
-          v.totalCount = Number(v.totalCount);
-          v.technicalDrawings = Array.isArray(v.technicalDrawings)
-            ? v.technicalDrawings
-            : [];
+    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.receiveTotalCount) {
+          this.$message.error('退货数量不能大于收货数量');
+          callback(new Error('退货数量不能大于收货数量'));
+        } else {
+          callback();
+        }
+      };
+    },
+    // else if (this.getTotalCount(row)> row.warehouseNum) {
+    //       this.$message.error('退货数量不能大于库存');
+    //       callback(new Error('退货数量不能大于库存'));
+    //     }
+    getTotalCount(row) {
+      let num = 0;
+      this.form.datasource
+        .filter((item) => item.warehouseId == row.warehouseId)
+        .forEach((item) => {
+          num += Number(item.totalCount);
         });
-        return comitDatasource;
-      },
-      getPrice() {
-        return [this.allPrice];
-      },
-
-      //修改回显
-      putTableValue(data) {
-        if (data && data?.length) {
-          data.forEach((v, index) => {
-            v.receiveTotalCount = v.receiveTotalCount || v.totalCount;
-            v.receiveProductId = v.receiveProductId || v.id;
-          });
 
-          this.form.datasource = data;
-          this.form.datasource.forEach(async (v, index) => {
-            if (v.warehouseId) {
-              this.$set(
-                this.form.datasource[index],
-                'warehouseNum',
-                await getWarehouseOutStock({
-                  warehouseId: v.warehouseId,
-                  code: v.productCode
-                })
-              );
-            }
-          });
-          this.gettotalAmount();
-        }
-      },
+      return num;
+    },
+    // 返回列表数据
+    getTableValue() {
+      let comitDatasource = this.form.datasource;
+      if (comitDatasource.length === 0) return [];
+      comitDatasource.forEach((v) => {
+        v.totalCount = Number(v.totalCount);
+        v.technicalDrawings = Array.isArray(v.technicalDrawings)
+          ? v.technicalDrawings
+          : [];
+      });
+      return comitDatasource;
+    },
+    getPrice() {
+      return [this.allPrice];
+    },
 
-      remove(row) {
-        let index = this.form.datasource.findIndex((n) => n.key == row.key);
-        if (index !== -1) {
-          this.form.datasource.splice(index, 1);
-          this.setSort();
-          this.gettotalAmount();
-        }
-      },
-      // 清空表格
-      restTable() {
-        this.form.datasource = [];
-      },
-      // 重新排序
-      setSort() {
-        this.form.datasource.forEach((n, index) => {
-          n.key = index + 1;
+    //修改回显
+    putTableValue(data) {
+      if (data && data?.length) {
+        data.forEach((v, index) => {
+          v.receiveTotalCount = v.receiveTotalCount || v.totalCount;
+          v.receiveProductId = v.receiveProductId || v.id;
         });
-      },
-      // 添加
-      handlAdd() {
-        if (!this.receiveId) return this.$message.error('请先选择收货单');
-        this.$refs.productListRef.open(this.form.datasource);
-      },
 
-      validateForm(callback) {
-        //开始表单校验
-        this.$refs.form.validate((valid) => {
-          callback(valid);
+        this.form.datasource = data;
+        this.form.datasource.forEach(async (v, index) => {
+          if (v.warehouseId) {
+            this.$set(
+              this.form.datasource[index],
+              'warehouseNum',
+              await getWarehouseOutStock({
+                warehouseId: v.warehouseId,
+                code: v.productCode
+              })
+            );
+          }
         });
+        this.gettotalAmount();
+      }
+    },
+
+    remove(row) {
+      let index = this.form.datasource.findIndex((n) => n.key == row.key);
+      if (index !== -1) {
+        this.form.datasource.splice(index, 1);
+        this.setSort();
+        this.gettotalAmount();
       }
+    },
+    // 清空表格
+    restTable() {
+      this.form.datasource = [];
+    },
+    // 重新排序
+    setSort() {
+      this.form.datasource.forEach((n, index) => {
+        n.key = index + 1;
+      });
+    },
+    // 添加
+    handlAdd() {
+      if (!this.receiveId) return this.$message.error('请先选择收货单');
+      this.$refs.productListRef.open(this.form.datasource);
+    },
+
+    validateForm(callback) {
+      //开始表单校验
+      this.$refs.form.validate((valid) => {
+        callback(valid);
+      });
     }
-  };
+  }
+};
 </script>
 <style lang="scss" scoped>
-  .headbox {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    .amount {
-      font-size: 14px;
-      font-weight: bold;
-      padding-right: 30px;
-    }
-  }
-  .time-form .el-form-item {
-    margin-bottom: 0 !important;
+.headbox {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+
+  .amount {
+    font-size: 14px;
+    font-weight: bold;
+    padding-right: 30px;
   }
+}
 
-  ::v-deep .period {
-    display: flex;
-    .borderleftnone {
-      .el-input--medium .el-input__inner {
-        border-top-right-radius: 0;
-        border-bottom-right-radius: 0;
-      }
-    }
-    .borderrightnone {
-      .el-input--medium .el-input__inner {
-        border-top-left-radius: 0;
-        border-bottom-left-radius: 0;
-      }
+.time-form .el-form-item {
+  margin-bottom: 0 !important;
+}
+
+::v-deep .period {
+  display: flex;
+
+  .borderleftnone {
+    .el-input--medium .el-input__inner {
+      border-top-right-radius: 0;
+      border-bottom-right-radius: 0;
     }
   }
 
-  ::v-deep .time-form tbody > tr:hover > td {
-    background-color: transparent !important;
-  }
-  ::v-deep .time-form .el-table tr {
-    background-color: #ffffff;
+  .borderrightnone {
+    .el-input--medium .el-input__inner {
+      border-top-left-radius: 0;
+      border-bottom-left-radius: 0;
+    }
   }
+}
 
-  .pricebox {
-    display: flex;
-    justify-content: flex-start;
-    align-items: center;
-    font-weight: bold;
-  }
+::v-deep .time-form tbody > tr:hover > td {
+  background-color: transparent !important;
+}
+
+::v-deep .time-form .el-table tr {
+  background-color: #ffffff;
+}
+
+.pricebox {
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+  font-weight: bold;
+}
 </style>

+ 2 - 7
src/views/bpm/handleTask/components/purchaseOrder/returnGoods/submit.vue

@@ -139,7 +139,6 @@
         let data = await getReturnSaleOrderrecordDetail(this.businessId);
         try {
           this.outInData = await getOutInBySourceBizNo(data.returnNo);
-          console.log('outInData----------------', outInData);
         } catch (error) {
           this.outInData.verifyStatus = 0;
         }
@@ -149,7 +148,6 @@
       async storemanApprove() {
         let res = await this.getTableValue();
         let storageData = res.returnStorageData;
-        console.log(storageData);
         // 出库来源storageSource 0-正常  1-外部(外部跳过内部审核流程)
         storageData.storageSource = 1;
         try {
@@ -188,16 +186,13 @@
       },
       async handleAudit(status) {
         //发起人补充
-        if (this.taskDefinitionKey === 'purchase_return_approve') {
+        if (this.taskDefinitionKey === 'starter') {
           let arr = await this.getTableValue();
           if (!arr) {
             return;
           }
 
-          let data = await UpdateReturnInformation(arr);
-          if (data.code != '0') {
-            return;
-          }
+         await UpdateReturnInformation(arr);
         }
         if (this.taskDefinitionKey === 'purchaserUploadReceipt') {
           let data = await this.getTableValue();

+ 17 - 1
src/views/bpm/handleTask/components/saleOrder/accountstatement/inventoryTable.vue

@@ -184,6 +184,14 @@ export default {
           slot: 'singlePrice',
           showOverflowTooltip: true
         },
+        {
+          minWidth: 100,
+          prop: 'discountSinglePrice',
+          label: '折让单价',
+          align: 'center',
+          slot: 'discountSinglePrice',
+          showOverflowTooltip: true
+        },
         {
           minWidth: 120,
           prop: 'totalPrice',
@@ -192,6 +200,14 @@ export default {
           align: 'center',
           showOverflowTooltip: true
         },
+        {
+          minWidth: 100,
+          prop: 'discountTotalPrice',
+          label: '折让合计金额',
+          align: 'center',
+          slot: 'discountTotalPrice',
+          showOverflowTooltip: true
+        },
       ]
       let permissionType = {
         'financeLeader': [
@@ -435,7 +451,7 @@ export default {
     getSummaries(param) {
       const {columns, data} = param;
       const sums = [];
-      let fields = ['totalPrice', 'notInvoicedPrice', 'invoicedPrice', 'receivablePrice', 'receivedPrice']
+      let fields = ['totalPrice', 'notInvoicedPrice', 'invoicedPrice', 'receivablePrice', 'receivedPrice','discountTotalPrice']
       columns.forEach((column, index) => {
         if (index === 0) {
           sums[index] = '合计';

+ 18 - 8
src/views/bpm/handleTask/components/saleOrder/addDialog.vue

@@ -289,7 +289,8 @@
 
       <headerTitle title="产品清单" style="margin-top: 30px"></headerTitle>
 
-      <inventoryTable ref="inventoryTable" :isContractId='!!form.contractId'></inventoryTable>
+      <inventoryTable ref="inventoryTable" :isContractId='!!form.contractId'
+                      @orderDiscountAmount="orderDiscountAmount"></inventoryTable>
       <el-row style="margin-top: 20px">
         <el-col :span="12">
           <el-form-item
@@ -298,11 +299,14 @@
             style="margin-bottom: 22px"
           >
             <el-input
+              type="number"
+              :min="0"
+              :max="allcountAmount"
               clearable
-              :disabled="!!form.contractId"
-              v-model="form.payAmount"
-              placeholder="请输入"
-            >
+              :disabled="!!form.contractId||!allcountAmount"
+              v-model.number="form.payAmount"
+              @blur="discountInput"
+              placeholder="请输入">
               <template slot="append">元</template>
             </el-input>
           </el-form-item>
@@ -494,7 +498,6 @@ export default {
   },
   computed: {
     allcountAmount() {
-      this.form.payAmount = this.$store.state.order.allcountAmount;
       return this.$store.state.order.allcountAmount;
     }
   },
@@ -614,14 +617,21 @@ export default {
           data.saleType = +data.saleType
           this.form = data;
           this.$refs.inventoryTable &&
-          this.$refs.inventoryTable.putTableValue(data);
+          this.$refs.inventoryTable.putTableValueByOrder(data)
           this.getLinkInfo(data.partaId);
           this.$store.commit('order/setAllcountAmount', data.totalAmount);
           this.$store.commit('order/setContractId', data.contractId);
         });
       }
     },
-
+    //修改优惠金额
+    discountInput() {
+      this.$refs.inventoryTable.discountInputByOrder(this.form.payAmount)
+    },
+//产品清单修改单价或者数量重置优惠金额
+    orderDiscountAmount(val = 0) {
+      this.form.payAmount = val
+    },
     //更新联系人数据
     async getLinkInfo(contactId) {
       const data = await getcontactlink({contactId});

+ 16 - 1
src/views/bpm/handleTask/components/saleOrder/inventoryTable.vue

@@ -426,6 +426,12 @@
             label: '单价',
             slot: 'singlePrice'
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            slot: 'discountSinglePrice'
+          },
           {
             width: 120,
             prop: 'totalCount',
@@ -435,12 +441,21 @@
           {
             width: 120,
             prop: 'totalPrice',
-            label: '销售总金额',
+            label: '合计',
             slot: 'totalPrice',
             formatter: (_row, _column, cellValue) => {
               return _row.totalPrice + '元';
             }
           },
+          {
+            width: 120,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            slot: 'discountTotalPrice',
+            formatter: (_row, _column, cellValue) => {
+              return _row.discountTotalPrice + '元';
+            }
+          },
           {
             width: 120,
             prop: 'measuringUnit',

+ 16 - 2
src/views/bpm/handleTask/components/saleOrder/invoice/addInvoiceDialog.vue

@@ -311,16 +311,30 @@
             label: '单价',
             slot: 'singlePrice'
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            slot: 'discountSinglePrice'
+          },
           {
             width: 120,
             prop: 'totalPrice',
-            label: '销售总金额',
+            label: '合计',
             slot: 'totalPrice',
             formatter: (_row, _column, cellValue) => {
               return _row.totalPrice + '元';
             }
           },
-
+          {
+            width: 120,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            slot: 'totalPrice',
+            formatter: (_row, _column, cellValue) => {
+              return _row.discountTotalPrice + '元';
+            }
+          },
           {
             width: 120,
             prop: 'deliveryDays',

+ 13 - 1
src/views/bpm/handleTask/components/saleOrder/invoice/detailDialog.vue

@@ -301,15 +301,27 @@
             label: '单价',
             slot: 'singlePrice'
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            slot: 'discountSinglePrice'
+          },
           {
             width: 120,
             prop: 'totalPrice',
-            label: '销售总金额',
+            label: '合计',
             slot: 'totalPrice',
             formatter: (_row, _column, cellValue) => {
               return _row.totalPrice + '元';
             }
           },
+          {
+            width: 160,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            slot: 'discountTotalPrice'
+          },
 
           {
             width: 120,

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

@@ -284,12 +284,24 @@
             label: '单价',
             slot: 'singlePrice'
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            slot: 'discountSinglePrice'
+          },
           {
             width: 120,
             prop: 'totalPrice',
             label: '合计',
             slot: 'totalPrice'
           },
+          {
+            width: 160,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            slot: 'discountTotalPrice'
+          },
           {
             width: 120,
             prop: 'singleWeight',

+ 12 - 0
src/views/bpm/handleTask/components/saleOrder/returnGoods/detailDialog.vue

@@ -286,12 +286,24 @@
             label: '单价',
             slot: 'singlePrice'
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            slot: 'discountSinglePrice'
+          },
           {
             width: 120,
             prop: 'totalPrice',
             label: '合计',
             slot: 'totalPrice'
           },
+          {
+            width: 120,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            slot: 'discountTotalPrice'
+          },
 
           {
             width: 200,

+ 26 - 3
src/views/bpm/handleTask/components/saleOrder/returnGoods/inventoryTable.vue

@@ -230,12 +230,24 @@
             label: '单价',
             slot: 'singlePrice'
           },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折让单价',
+            slot: 'discountSinglePrice'
+          },
           {
             width: 120,
             prop: 'totalPrice',
             label: '合计',
             slot: 'totalPrice'
           },
+          {
+            width: 120,
+            prop: 'discountTotalPrice',
+            label: '折让合计',
+            slot: 'discountTotalPrice'
+          },
           {
             width: 200,
             prop: 'returnReason',
@@ -302,14 +314,12 @@
     computed: {
       totalAmount() {
         let allcountAmount = this.$store.state.returnGoods.allcountAmount;
-        if (!this.$store.state.isDefaultPayableAmount) {
-          this.payAmount = allcountAmount;
-        }
         return allcountAmount;
       }
     },
     watch:{
       payAmount(n){
+        console.log('1111111111')
         this.$emit('payAmountChange',n)
       }
     },
@@ -321,6 +331,12 @@
           'totalPrice',
           (Number(this.form.datasource[index].singlePrice) * val).toFixed(2)
         );
+        this.$set(
+          this.form.datasource[index],
+          'discountTotalPrice',
+          (Number(this.form.datasource[index].discountSinglePrice) * val).toFixed(2)
+        );
+
         this.$store.commit('returnGoods/setIsDefaultPayableAmount', false);
         this.gettotalAmount();
       },
@@ -333,6 +349,13 @@
               return sum + Number(item.totalPrice);
             }, 0)
             .toFixed(2);
+          this.payAmount = productData
+            .reduce((sum, item) => {
+              return sum + Number(item.discountTotalPrice);
+            }, 0)
+            .toFixed(2);
+
+
           this.$store.commit('returnGoods/setAllcountAmount', sum);
         } else {
           this.$store.commit('returnGoods/setAllcountAmount', 0);