Browse Source

修改华翰

Qukatie 1 tháng trước cách đây
mục cha
commit
8956d9ac85

+ 417 - 315
src/views/tirePartsMall/financialManagement/collectionSettlement/detailsPage.vue

@@ -2,21 +2,30 @@
   <div>
     <div class="customer-head">
       <div class="customer-back">
-        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
-          @click="backToList(0)">返回列表
+        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left" @click="backToList(0)"
+          >返回列表
         </el-button>
       </div>
       <div class="add-customer-btn">
-        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small"
-          v-if="!editButton" @click="confirmEditing">编辑
+        <el-button
+          class="el-button&#45;&#45;small-yh"
+          style="margin-right: 10px"
+          type="primary"
+          size="small"
+          v-if="!editButton"
+          @click="confirmEditing"
+          >编辑
         </el-button>
-        <el-button class="el-button--small-yh" type="primary" size="small"
-          :disabled="form.financeStatus == '已收款' || isSaveBtn" @click="editCustomer">保存数据
+        <el-button
+          class="el-button--small-yh"
+          type="primary"
+          size="small"
+          :disabled="form.financeStatus == '已收款' || isSaveBtn"
+          @click="editCustomer"
+          >保存数据
         </el-button>
-        <el-button class="el-button--small-yh" type="warning" :disabled="isFinanceBtn" size="small"
-          @click="collection">{{
-            form.financeStatus ==
-              '已收款' ? '撤销收款' : '收款' }}
+        <el-button v-if="form.id" class="el-button--small-yh" type="warning" :disabled="isFinanceBtn" size="small" @click="collection"
+          >{{ form.financeStatus == "已收款" ? "撤销收款" : "收款" }}
         </el-button>
         <!-- <el-button class="el-button--small-yh" type="primary" size="small" v-if="form.id">启用
         </el-button> -->
@@ -26,68 +35,127 @@
       <trade-card title="基础信息">
         <avue-form :option="optionForm" v-model="form" ref="form">
           <tempalte slot="corpName" slot-scope="{ row }">
-            <dic-select v-model="form.corpName" placeholder="客户" key="id" label="cname" res="records"
-              url="/blade-sales-part/corpsDesc/list?current=1&size=10&corpType=KH" :filterable="true" :remote="true"
-              dataName="cname" @selectChange="dicChange('corpName', $event)"
-              :disabled="optionForm.disabled"></dic-select>
+            <dic-select
+              v-model="form.corpName"
+              placeholder="客户"
+              key="id"
+              label="cname"
+              res="records"
+              url="/blade-sales-part/corpsDesc/list?current=1&size=10&corpType=KH"
+              :filterable="true"
+              :remote="true"
+              dataName="cname"
+              @selectChange="dicChange('corpName', $event)"
+              :disabled="optionForm.disabled"
+            ></dic-select>
           </tempalte>
         </avue-form>
       </trade-card>
       <trade-card title="明细信息">
-        <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts" :data="form.settlementItemsList"
-          @row-save="rowSave" @row-update="rowUpdate"
+        <avue-crud
+          :option="optionContacts"
+          v-model="formContacts"
+          ref="formContacts"
+          :data="form.settlementItemsList"
+          @row-save="rowSave"
+          @row-update="rowUpdate"
           @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 267.1)"
-          @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 267.1)">
+          @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 267.1)"
+        >
           <template slot-scope="scope" slot="menuLeft">
-            <el-button type="primary" icon="el-icon-plus" :disabled="form.financeStatus == '已收款' || isMenu" size="small"
-              @click="rowAdd()">选择订单</el-button>
+            <el-button type="primary" icon="el-icon-plus" :disabled="form.financeStatus == '已收款' || isMenu" size="small" @click="rowAdd()"
+              >选择订单</el-button
+            >
           </template>
           <template slot-scope="{ row, index }" slot="contractNumber">
-            <span style="color: #409EFF;cursor: pointer" @click.stop="viewDocuments(row)">{{ row.contractNumber }}
-            </span>
+            <span style="color: #409EFF;cursor: pointer" @click.stop="viewDocuments(row)">{{ row.contractNumber }} </span>
           </template>
           <template slot-scope="{ row, index }" slot="thisAmount">
-            <el-input-number size="small" v-model="row.thisAmount" :precision="2" :controls="false"
-              v-if="row.$cellEdit && row.businesType == 'XS'" @change="thisAmountChange(row)"
-              :max="row.accountsAmount - row.settlmentAmount"></el-input-number>
+            <el-input-number
+              size="small"
+              v-model="row.thisAmount"
+              :precision="2"
+              :controls="false"
+              v-if="row.$cellEdit && row.businesType == 'XS'"
+              @change="thisAmountChange(row)"
+              :max="row.accountsAmount - row.settlmentAmount"
+            ></el-input-number>
             <span v-else>{{ row.thisAmount }}</span>
           </template>
           <template slot-scope="{ row, index }" slot="thisRefundAmount">
-            <el-input-number size="small" width="100" v-model="row.thisRefundAmount" :precision="2" :controls="false"
-              v-if="row.$cellEdit && row.businesType == 'TKXS'" @change="thisReAmountChange(row)"
-              :max="row.accountsAmount - row.settlmentAmount"></el-input-number>
+            <el-input-number
+              size="small"
+              width="100"
+              v-model="row.thisRefundAmount"
+              :precision="2"
+              :controls="false"
+              v-if="row.$cellEdit && row.businesType == 'TKXS'"
+              @change="thisReAmountChange(row)"
+              :max="row.accountsAmount - row.settlmentAmount"
+            ></el-input-number>
             <span v-else>{{ row.thisRefundAmount }}</span>
           </template>
-          <template slot-scope="{type,size,row,index,disabled}" slot="menu">
-            <el-button :size="size" :disabled="form.financeStatus == '已收款' || isMenu" :type="type"
-              :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="$refs.formContacts.rowCell(row, index)">{{
-                row.$cellEdit ? '确认' : '修改' }}
+          <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
+            <el-button
+              :size="size"
+              :disabled="form.financeStatus == '已收款' || isMenu"
+              :type="type"
+              :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
+              @click="$refs.formContacts.rowCell(row, index)"
+              >{{ row.$cellEdit ? "确认" : "修改" }}
             </el-button>
-            <el-button icon="el-icon-delete" :size="size" :disabled="form.financeStatus == '已收款' || isMenu" :type="type"
-              @click="rowDelBox(row, index)">删除
+            <el-button
+              icon="el-icon-delete"
+              :size="size"
+              :disabled="form.financeStatus == '已收款' || isMenu"
+              :type="type"
+              @click="rowDelBox(row, index)"
+              >删除
             </el-button>
           </template>
         </avue-crud>
       </trade-card>
 
       <containerTitle title="上传附件"></containerTitle>
-      <c-upload v-loading="loadingBtn" typeUpload="LT" :disabled="isMenu"
-        deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="filesList" display
-        :enumerationValue="35.1"></c-upload>
+      <c-upload
+        v-loading="loadingBtn"
+        typeUpload="LT"
+        :disabled="isMenu"
+        deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
+        :data="filesList"
+        display
+        :enumerationValue="35.1"
+      ></c-upload>
     </div>
-    <el-dialog title="导入订单" v-if="billDetailDialog" append-to-body class="el-dialogDeep"
-      :visible.sync="billDetailDialog" width="80%" :close-on-click-modal="false" :destroy-on-close="true"
-      :close-on-press-escape="false" top="10vh" v-dialog-drag>
-      <bill-detail :params="params" :billType="billType" :flag="1" @closeFun="closeBillDetail"
-        @importProMent="importProMent">
-      </bill-detail>
+    <el-dialog
+      title="导入订单"
+      v-if="billDetailDialog"
+      append-to-body
+      class="el-dialogDeep"
+      :visible.sync="billDetailDialog"
+      width="80%"
+      :close-on-click-modal="false"
+      :destroy-on-close="true"
+      :close-on-press-escape="false"
+      top="10vh"
+      v-dialog-drag
+    >
+      <bill-detail :params="params" :billType="billType" :flag="1" @closeFun="closeBillDetail" @importProMent="importProMent"> </bill-detail>
     </el-dialog>
   </div>
 </template>
 
 <script>
 import billDetail from "@/components/bill/selectOrderDetailList";
-import { saveSubmit, collectionAndPayment, revokeCollectionAndPayment, detail, removeItems, getFinanceList, remove } from '@/api/accountingManagement/index.js';
+import {
+  saveSubmit,
+  collectionAndPayment,
+  revokeCollectionAndPayment,
+  detail,
+  removeItems,
+  getFinanceList,
+  remove
+} from "@/api/accountingManagement/index.js";
 import { getList } from "@/api/collectionSettlement/index.js";
 import { skgetKh } from "@/api/tirePartsMall/salesManagement/saleOrder";
 import dicSelect from "@/components/dicSelect/main";
@@ -122,102 +190,120 @@ export default {
         disabled: false,
         menuBtn: false,
         span: 8,
-        column: [{
-          label: '客户',
-          prop: "corpName",
-          // type: 'select',
-          // remote: true,
-          // props: {
-          //   label: 'cname',
-          //   value: 'id',
-          //   res: 'data.records'
-          // },
-          // click: () => {
-          //   this.$refs.form.dicInit()
-          // },
-          // dicUrl: '/api/blade-sales-part/corpsDesc/list?current=1&size=20&cname={{key}}&corpType=KH',
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }],
-        }, {
-          label: '收款账户',
-          prop: "accountId",
-          type: 'select',
-          props: {
-            label: 'cname',
-            value: 'id',
-            res: 'data.records'
+        column: [
+          {
+            label: "客户",
+            prop: "corpName",
+            // type: 'select',
+            // remote: true,
+            // props: {
+            //   label: 'cname',
+            //   value: 'id',
+            //   res: 'data.records'
+            // },
+            // click: () => {
+            //   this.$refs.form.dicInit()
+            // },
+            // dicUrl: '/api/blade-sales-part/corpsDesc/list?current=1&size=20&cname={{key}}&corpType=KH',
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
+          },
+          {
+            label: "收款账户",
+            prop: "accountId",
+            type: "select",
+            props: {
+              label: "cname",
+              value: "id",
+              res: "data.records"
+            },
+            click: () => {
+              this.$refs.form.dicInit();
+            },
+            dicUrl: "/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK",
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
+          },
+          {
+            label: "金额",
+            prop: "amount",
+            disabled: true,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
           },
-          click: () => {
-            this.$refs.form.dicInit()
+          {
+            label: "经办人",
+            prop: "handledByName",
+            type: "select",
+            props: {
+              label: "name",
+              value: "name"
+            },
+            click: () => {
+              this.$refs.form.dicInit();
+            },
+            dicUrl: "/api/blade-user/financeList",
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
           },
-          dicUrl: '/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK',
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }]
-        }, {
-          label: '金额',
-          prop: "amount",
-          disabled: true,
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }]
-        }, {
-          label: "经办人",
-          prop: "handledByName",
-          type: "select",
-          props: {
-            label: "name",
-            value: "name"
+          {
+            label: "收款日期",
+            prop: "settlementDate",
+            type: "date",
+            overHidden: true,
+            width: 100,
+            searchRange: true,
+            searchDefaultTime: ["00:00:00", "23:59:59"],
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+            value: "",
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
           },
-          click: () => {
-            this.$refs.form.dicInit()
+          {
+            label: "单据编号",
+            prop: "sysNo",
+            disabled: true
           },
-          dicUrl: "/api/blade-user/financeList",
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }],
-        }, {
-          label: '收款日期',
-          prop: "settlementDate",
-          type: "date",
-          overHidden: true,
-          width: 100,
-          searchRange: true,
-          searchDefaultTime: ["00:00:00", "23:59:59"],
-          format: "yyyy-MM-dd",
-          valueFormat: "yyyy-MM-dd HH:mm:ss",
-          value: '',
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }]
-        }, {
-          label: '单据编号',
-          prop: "sysNo",
-          disabled: true
-        }, {
-          label: '备注',
-          prop: "remarks",
-          type: 'textarea',
-          span: 24,
-          minRows: 2
-        }]
+          {
+            label: "备注",
+            prop: "remarks",
+            type: "textarea",
+            span: 24,
+            minRows: 2
+          }
+        ]
       },
       formContacts: {},
       optionContacts: {},
       optionContactsBack: {
         disabled: false,
-        align: 'center',
+        align: "center",
         index: true,
         // addBtnText: "录入明细",
         refreshBtn: false,
@@ -238,51 +324,60 @@ export default {
           //   cell: true
           // },
           {
-            label: '合同号',
-            prop: 'contractNumber',
+            label: "合同号",
+            prop: "contractNumber",
             cell: false
-          }, {
-            label: '应收金额',
-            prop: 'accountsAmount',
+          },
+          {
+            label: "应收金额",
+            prop: "accountsAmount",
             cell: false
-          }, {
-            label: '结算金额',
-            prop: 'settlmentAmount',
+          },
+          {
+            label: "结算金额",
+            prop: "settlmentAmount",
             cell: false,
             decimals: 2
-          }, {
-            label: '本次金额',
-            prop: 'thisAmount',
-            width: 140,
-          }, {
-            label: '本次退货金额',
-            prop: 'thisRefundAmount',
-            width: 140,
-          }, {
-            label: '来源主表id',
+          },
+          {
+            label: "本次金额",
+            prop: "thisAmount",
+            width: 140
+          },
+          {
+            label: "本次退货金额",
+            prop: "thisRefundAmount",
+            width: 140
+          },
+          {
+            label: "来源主表id",
             hide: true,
             showColumn: false,
-            prop: 'srcParentId',
-          }, {
-            label: '来源单据编号',
-            prop: 'srcBillNo',
+            prop: "srcParentId"
+          },
+          {
+            label: "来源单据编号",
+            prop: "srcBillNo",
             hide: true,
             showColumn: false,
             cell: false
-          }, {
-            label: '所属公司id',
-            prop: 'salesCompanyId',
+          },
+          {
+            label: "所属公司id",
+            prop: "salesCompanyId",
             hide: true,
             showColumn: false,
             cell: false
-          }, {
-            label: '所属公司名称',
-            prop: 'salesCompanyName',
+          },
+          {
+            label: "所属公司名称",
+            prop: "salesCompanyName",
             hide: true,
             showColumn: false,
             cell: false
-          }, {
-            label: '业务日期',
+          },
+          {
+            label: "业务日期",
             prop: "businesDate",
             disabled: false,
             type: "datetime",
@@ -295,58 +390,59 @@ export default {
                 trigger: "blur"
               }
             ]
-          }, {
-            label: '备注',
-            prop: 'remarks',
+          },
+          {
+            label: "备注",
+            prop: "remarks",
             cell: true
-          }]
+          }
+        ]
       }
-    }
+    };
   },
   props: {
     onLoad: Object,
     detailData: Object
   },
   async created() {
-
     //  获取今天的日期
     var today = new Date();
     var year = today.getFullYear();
-    var month = String(today.getMonth() + 1).padStart(2, '0');
-    var day = String(today.getDate()).padStart(2, '0');
-    var hours = String(today.getHours()).padStart(2, '0');
-    var minutes = String(today.getMinutes()).padStart(2, '0');
-    var seconds = String(today.getSeconds()).padStart(2, '0');
+    var month = String(today.getMonth() + 1).padStart(2, "0");
+    var day = String(today.getDate()).padStart(2, "0");
+    var hours = String(today.getHours()).padStart(2, "0");
+    var minutes = String(today.getMinutes()).padStart(2, "0");
+    var seconds = String(today.getSeconds()).padStart(2, "0");
 
     // 查询经办人
     getFinanceList().then(res => {
-      this.financeList = res.data.data
-      const logInUser = JSON.parse(localStorage.getItem('saber-userInfo'));
-      if (logInUser.content.role_name.includes('财务')) {
+      this.financeList = res.data.data;
+      const logInUser = JSON.parse(localStorage.getItem("saber-userInfo"));
+      if (logInUser.content.role_name.includes("财务")) {
         for (let finance of res.data.data) {
           if (finance.name === logInUser.content.nick_name) {
-            console.log(finance.name)
+            console.log(finance.name);
             this.form.handledByName = finance.name;
             break;
           }
         }
       }
-    })
+    });
 
     // 构建今天的日期时间字符串
-    var todayDateTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
+    var todayDateTime = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
     if (this.onLoad.id) {
-      this.refresh(this.onLoad.id)
-      this.$set(this.optionForm, 'disabled', true)
-      this.$set(this.optionContactsBack, 'disabled', true)
-      this.isSaveBtn = true
-      this.isFinanceBtn = true
+      this.refresh(this.onLoad.id);
+      this.$set(this.optionForm, "disabled", true);
+      this.$set(this.optionContactsBack, "disabled", true);
+      this.isSaveBtn = true;
+      this.isFinanceBtn = true;
 
-      this.isMenu = true
+      this.isMenu = true;
     } else {
-      this.isFinanceBtn = true
-      this.findObject(this.optionForm.column, 'settlementDate').value = todayDateTime
-      this.editButton = true
+      this.isFinanceBtn = true;
+      this.findObject(this.optionForm.column, "settlementDate").value = todayDateTime;
+      this.editButton = true;
       // console.log(this.form.settlementDate = '2023-07-03');
     }
 
@@ -366,39 +462,39 @@ export default {
 
     // 获取客户的数据
     skgetKh().then(res => {
-      console.log(res, 330)
-      this.corpIdData = res.data.data
-    })
+      console.log(res, 330);
+      this.corpIdData = res.data.data;
+    });
     // this.corpIdData
   },
   methods: {
     dicChange(name, row) {
-      if (name == 'corpName') {
+      if (name == "corpName") {
         if (row) {
-          this.form.corpId = row.id
+          this.form.corpId = row.id;
         } else {
-          this.form.corpId = null
-          this.form.corpName = null
+          this.form.corpId = null;
+          this.form.corpName = null;
         }
       }
     },
     thisAmountChange(row) {
-      let sum1 = 0
-      let sum2 = 0
+      let sum1 = 0;
+      let sum2 = 0;
       this.form.settlementItemsList.forEach(e => {
         sum1 += e.thisAmount ? Number(e.thisAmount) : 0;
         sum2 += e.thisRefundAmount ? Number(e.thisRefundAmount) : 0;
-        this.$set(this.form, 'amount', sum1 - sum2)
-      })
+        this.$set(this.form, "amount", sum1 - sum2);
+      });
     },
     thisReAmountChange(row) {
-      let sum1 = 0
-      let sum2 = 0
+      let sum1 = 0;
+      let sum2 = 0;
       this.form.settlementItemsList.forEach(e => {
         sum1 += e.thisAmount ? Number(e.thisAmount) : 0;
         sum2 += e.thisRefundAmount ? Number(e.thisRefundAmount) : 0;
-        this.$set(this.form, 'amount', sum1 - sum2)
-      })
+        this.$set(this.form, "amount", sum1 - sum2);
+      });
     },
     rowDelBox(row, index) {
       this.$confirm("确定将选择数据删除?", {
@@ -416,51 +512,51 @@ export default {
           this.form.settlementItemsList.splice(index, 1);
           this.$message.success("操作成功!");
         }
-      }
-      )
-        ;
+      });
     },
     rowSave(form, done, loading) {
-      done(form)
+      done(form);
     },
     rowUpdate(form, index, done, loading) {
-      done(form)
+      done(form);
     },
     refresh(id, type) {
       const loading = this.$loading({
         lock: true,
-        text: '加载中',
-        spinner: 'el-icon-loading',
-        background: 'rgba(255,255,255,0.7)'
-      })
-      detail({ id: id }).then(res => {
-        this.form = res.data.data
-        this.filesList = res.data.data.filesList
-        // if (res.data.data.financeStatus == '已收款') {
-        //   console.log('已收款');
-        //   this.$set(this.optionForm, 'disabled', true)
-        //   this.$set(this.optionContactsBack, 'disabled', true)
-        // } else {
-        //   this.$set(this.optionForm, 'disabled', false)
-        // }
+        text: "加载中",
+        spinner: "el-icon-loading",
+        background: "rgba(255,255,255,0.7)"
+      });
+      detail({ id: id })
+        .then(res => {
+          this.form = res.data.data;
+          this.filesList = res.data.data.filesList;
+          // if (res.data.data.financeStatus == '已收款') {
+          //   console.log('已收款');
+          //   this.$set(this.optionForm, 'disabled', true)
+          //   this.$set(this.optionContactsBack, 'disabled', true)
+          // } else {
+          //   this.$set(this.optionForm, 'disabled', false)
+          // }
 
-        loading.close();
-      }).catch(() => {
-        loading.close();
-      })
+          loading.close();
+        })
+        .catch(() => {
+          loading.close();
+        });
     },
     //新增
     rowAdd() {
       if (!this.form.corpId) {
-        this.$message.warning("请先选择客户!")
-        return
+        this.$message.warning("请先选择客户!");
+        return;
       }
       this.params = {
         customerId: this.form.corpId,
-        generateTask: '已生成',
-        bsType: 'XS,TKXS,GX',
-        actualPaymentStatus: '2'
-      }
+        generateTask: "已生成",
+        bsType: "XS,TKXS,GX",
+        actualPaymentStatus: "2"
+      };
       this.billDetailDialog = true;
 
       // this.$refs.formContacts.rowAdd()
@@ -476,79 +572,83 @@ export default {
       //     }
       //   }
       // }
-      let sum1 = 0
-      let sum2 = 0
+      let sum1 = 0;
+      let sum2 = 0;
       list.forEach((item, index) => {
         item.contractNumber = item.ordNo;
-        item.accountsAmount = item.bsType == "XS" || item.bsType == "GX" ? item.totalMoney : item.returnsAmount
-        item.settlmentAmount = item.paymentAmountTl
-        item.businesType = item.bsType
-        this.$set(item, 'thisAmount', item.bsType == "XS" || item.bsType == "GX" ? (Number(item.totalMoney) - Number(item.paymentAmountTl)) : 0)
-        this.$set(item, 'thisRefundAmount', item.bsType == "TKXS" ? (Number(item.returnsAmount) - Number(item.paymentAmountTl)) : 0)
+        item.accountsAmount = item.bsType == "XS" || item.bsType == "GX" ? item.totalMoney : item.returnsAmount;
+        item.settlmentAmount = item.paymentAmountTl;
+        item.businesType = item.bsType;
+        this.$set(item, "thisAmount", item.bsType == "XS" || item.bsType == "GX" ? Number(item.totalMoney) - Number(item.paymentAmountTl) : 0);
+        this.$set(item, "thisRefundAmount", item.bsType == "TKXS" ? Number(item.returnsAmount) - Number(item.paymentAmountTl) : 0);
         // item.thisAmount =item.bsType=="XS"?(Number(item.totalMoney) - Number(item.paymentAmountTl)):0
         // item.thisRefundAmount =item.bsType=="TKXS"? (Number(item.totalMoney) - Number(item.paymentAmountTl)):0
-        item.srcParentId = item.id
-        item.srcBillNo = item.ordNo
-        item.salesCompanyId = item.salesCompanyId
-        item.salesCompanyName = item.salesCompanyName
-        item.id = null
+        item.srcParentId = item.id;
+        item.srcBillNo = item.ordNo;
+        item.salesCompanyId = item.salesCompanyId;
+        item.salesCompanyName = item.salesCompanyName;
+        item.id = null;
         delete item.ordNo;
         this.$refs.formContacts.rowCellAdd(item);
         //计算主表金额
-        sum1 += item.bsType == "XS" || item.bsType == "GX" ? (Number(item.totalMoney) - Number(item.paymentAmountTl)) : 0
-        sum2 += item.bsType == "TKXS" ? (Number(item.totalMoney) - Number(item.paymentAmountTl)) : 0
-        this.form.amount = sum1 - sum2
-      })
+        sum1 += item.bsType == "XS" || item.bsType == "GX" ? Number(item.totalMoney) - Number(item.paymentAmountTl) : 0;
+        sum2 += item.bsType == "TKXS" ? Number(item.totalMoney) - Number(item.paymentAmountTl) : 0;
+        this.form.amount = sum1 - sum2;
+      });
       //明细列表所有合同号 去重 加, 为主表合同号
       // this.$set(this.form,'srcOrderno',Array.from(new Set(this.dataList.map(item =>{ return item.srcOrderno}))).join(','))
       this.billDetailDialog = false;
     },
     //保存数据
     editCustomer() {
-      console.log(this.form, 441)
+      console.log(this.form, 441);
       this.$refs["form"].validate((valid, done) => {
-        done()
+        done();
         if (valid) {
           let data = {
             ...this.form,
-            dc: 'd',
-            billType: 'SK',
+            dc: "d",
+            billType: "SK",
             // corpName: this.form.$corpId,
             accountName: this.form.$accountId,
             filesList: this.filesList
-          }
+          };
           const loading = this.$loading({
             lock: true,
-            text: '加载中',
-            spinner: 'el-icon-loading',
-            background: 'rgba(255,255,255,0.7)'
+            text: "加载中",
+            spinner: "el-icon-loading",
+            background: "rgba(255,255,255,0.7)"
           });
           for (let finance of this.financeList) {
             if (finance.name == data.handledByName) {
-              data.handledById = finance.id
+              data.handledById = finance.id;
               break;
             }
           }
-          saveSubmit(data).then(res => {
-            console.log(res);
-            this.isFinanceBtn = false
-            this.refresh(res.data.data.id)
-            this.$message.success('保存成功')
-            loading.close();
-          }).catch(() => {
-            loading.close()
-          })
+          saveSubmit(data)
+            .then(res => {
+              console.log(res);
+              this.isFinanceBtn = false;
+              this.refresh(res.data.data.id);
+              this.$message.success("保存成功");
+              loading.close();
+            })
+            .catch(() => {
+              loading.close();
+            });
         }
-      })
-
+      });
     },
     //收款
     collection() {
+      if (!this.form.id) {
+        return this.$message.error("请保存数据");
+      }
       this.$refs["form"].validate((valid, done) => {
-        done()
+        done();
         if (valid) {
-          if (this.form.financeStatus !== '已收款') {
-            console.log('this.form.financeStatus', this.form.financeStatus);
+          if (this.form.financeStatus !== "已收款") {
+            console.log("this.form.financeStatus", this.form.financeStatus);
             this.$confirm("确认收款?", {
               confirmButtonText: "确定",
               cancelButtonText: "取消",
@@ -556,28 +656,31 @@ export default {
             }).then(() => {
               const loading = this.$loading({
                 lock: true,
-                text: '加载中',
-                spinner: 'el-icon-loading',
-                background: 'rgba(255,255,255,0.7)'
+                text: "加载中",
+                spinner: "el-icon-loading",
+                background: "rgba(255,255,255,0.7)"
               });
               let data = {
                 ...this.form,
-                dc: 'd',
-                billType: 'SK',
+                dc: "d",
+                billType: "SK"
                 // corpName: this.form.$corpId
-              }
-              saveSubmit(data).then(res => {
-                loading.close()
-                collectionAndPayment(data).then((res => {
-                  this.refresh(res.data.data.id)
-                  this.$set(this.optionForm, 'disabled', true)
-                  this.$set(this.optionContactsBack, 'disabled', true)
-                  this.$message.success('收款成功')
-                }))
-              }).catch(() => {
-                loading.close()
-              })
-            })
+              };
+              saveSubmit(data)
+                .then(res => {
+                  loading.close();
+                  collectionAndPayment(data).then(res => {
+                    this.refresh(res.data.data.id);
+                    this.$set(this.optionForm, "disabled", true);
+                    this.$set(this.optionContactsBack, "disabled", true);
+                    this.$message.success("收款成功");
+                  });
+                })
+                .catch(() => {
+                  this.refresh(this.form.id);
+                  loading.close();
+                });
+            });
           } else {
             this.$confirm("确认撤销退款?", {
               confirmButtonText: "确定",
@@ -586,48 +689,47 @@ export default {
             }).then(() => {
               const loading = this.$loading({
                 lock: true,
-                text: '加载中',
-                spinner: 'el-icon-loading',
-                background: 'rgba(255,255,255,0.7)'
+                text: "加载中",
+                spinner: "el-icon-loading",
+                background: "rgba(255,255,255,0.7)"
               });
               let data = {
                 ...this.form,
-                dc: 'd',
-                billType: 'SK'
-              }
-              revokeCollectionAndPayment(data).then((res => {
-                this.refresh(res.data.data.id)
-                this.editButton = false
-                this.$message.success('撤销收款成功')
-                loading.close()
-              }))
-            })
+                dc: "d",
+                billType: "SK"
+              };
+              revokeCollectionAndPayment(data).then(res => {
+                this.refresh(res.data.data.id);
+                this.editButton = false;
+                this.$message.success("撤销收款成功");
+                loading.close();
+              });
+            });
           }
         }
-      })
-
+      });
     },
     confirmEditing() {
-      this.editButton = true
-      if (this.form.financeStatus == '已收款') {
-        this.$set(this.optionForm, 'disabled', true)
-        this.$set(this.optionContactsBack, 'disabled', true)
-        this.isFinanceBtn = false
+      this.editButton = true;
+      if (this.form.financeStatus == "已收款") {
+        this.$set(this.optionForm, "disabled", true);
+        this.$set(this.optionContactsBack, "disabled", true);
+        this.isFinanceBtn = false;
       } else {
-        this.$set(this.optionForm, 'disabled', false)
-        this.$set(this.optionContactsBack, 'disabled', false)
-        this.isFinanceBtn = false
-        this.isSaveBtn = false
-        this.isMenu = false
+        this.$set(this.optionForm, "disabled", false);
+        this.$set(this.optionContactsBack, "disabled", false);
+        this.isFinanceBtn = false;
+        this.isSaveBtn = false;
+        this.isMenu = false;
       }
     },
     //查看单据
     viewDocuments(row) {
       console.log(row);
-      this.$router.$avueRouter.closeTag('/tirePartsMall/salesManagement/saleOrder/index');
+      this.$router.$avueRouter.closeTag("/tirePartsMall/salesManagement/saleOrder/index");
       this.$router.push({
         path: "/tirePartsMall/salesManagement/saleOrder/index",
-        query: { detail: row, type: 'S' },
+        query: { detail: row, type: "S" }
       });
     },
     //关闭
@@ -661,7 +763,7 @@ export default {
       this.$emit("backToList", type);
     }
   }
-}
+};
 </script>
 
 <style lang="scss" scoped>

+ 398 - 308
src/views/tirePartsMall/financialManagement/paymentSettlement/detailsPage.vue

@@ -2,21 +2,23 @@
   <div>
     <div class="customer-head">
       <div class="customer-back">
-        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
-          @click="backToList(0)">返回列表
+        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left" @click="backToList(0)"
+          >返回列表
         </el-button>
       </div>
       <div class="add-customer-btn">
-        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small"
-          v-if="!editButton" @click="confirmEditing">编辑
+        <el-button
+          class="el-button&#45;&#45;small-yh"
+          style="margin-right: 10px"
+          type="primary"
+          size="small"
+          v-if="!editButton"
+          @click="confirmEditing"
+          >编辑
         </el-button>
-        <el-button class="el-button--small-yh" type="primary" :disabled="isSaveBtn" size="small"
-          @click="editCustomer">保存数据
-        </el-button>
-        <el-button class="el-button--small-yh" type="warning" size="small" :disabled="isFinanceBtn"
-          @click="collection">{{
-            form.financeStatus ==
-              '已付款' ? '撤销付款' : '付款' }}
+        <el-button class="el-button--small-yh" type="primary" :disabled="isSaveBtn" size="small" @click="editCustomer">保存数据 </el-button>
+        <el-button v-if="form.id" class="el-button--small-yh" type="warning" size="small" :disabled="isFinanceBtn" @click="collection"
+          >{{ form.financeStatus == "已付款" ? "撤销付款" : "付款" }}
         </el-button>
         <!-- <el-button class="el-button--small-yh" type="primary" size="small" v-if="form.id">启用
         </el-button> -->
@@ -26,60 +28,110 @@
       <trade-card title="基础信息">
         <avue-form :option="optionForm" v-model="form" ref="form">
           <tempalte slot="corpName" slot-scope="{ row }">
-            <dic-select v-model="form.corpName" placeholder="供应商" key="id" label="cname" res="records"
-              url="/blade-sales-part/corpsDesc/list?current=1&size=10&corpType=GYS" :filterable="true" :remote="true"
-              dataName="cname" @selectChange="dicChange('corpName', $event)"
-              :disabled="optionForm.disabled"></dic-select>
+            <dic-select
+              v-model="form.corpName"
+              placeholder="供应商"
+              key="id"
+              label="cname"
+              res="records"
+              url="/blade-sales-part/corpsDesc/list?current=1&size=10&corpType=GYS"
+              :filterable="true"
+              :remote="true"
+              dataName="cname"
+              @selectChange="dicChange('corpName', $event)"
+              :disabled="optionForm.disabled"
+            ></dic-select>
           </tempalte>
         </avue-form>
       </trade-card>
       <trade-card title="明细信息">
-        <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts" :data="form.settlementItemsList"
-          @row-save="rowSave" @row-update="rowUpdate"
+        <avue-crud
+          :option="optionContacts"
+          v-model="formContacts"
+          ref="formContacts"
+          :data="form.settlementItemsList"
+          @row-save="rowSave"
+          @row-update="rowUpdate"
           @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 266.1)"
-          @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 266.1)">
+          @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 266.1)"
+        >
           <template slot-scope="scope" slot="menuLeft">
-            <el-button type="primary" icon="el-icon-plus" :disabled="form.financeStatus == '已付款' || isMenu" size="small"
-              @click="rowAdd()">选择订单</el-button>
+            <el-button type="primary" icon="el-icon-plus" :disabled="form.financeStatus == '已付款' || isMenu" size="small" @click="rowAdd()"
+              >选择订单</el-button
+            >
           </template>
           <template slot-scope="{ row, index }" slot="contractNumber">
-            <span style="color: #409EFF;cursor: pointer" @click.stop="payBtn(row)">{{ row.contractNumber }}
-            </span>
+            <span style="color: #409EFF;cursor: pointer" @click.stop="payBtn(row)">{{ row.contractNumber }} </span>
           </template>
           <template slot-scope="{ row, index }" slot="thisAmount">
-            <el-input-number size="small" v-model="row.thisAmount" :precision="2" :controls="false"
-              v-if="row.$cellEdit && row.businesType == 'CG'" @change="thisAmountChange(row)"
-              :max="row.accountsAmount - row.settlmentAmount"></el-input-number>
+            <el-input-number
+              size="small"
+              v-model="row.thisAmount"
+              :precision="2"
+              :controls="false"
+              v-if="row.$cellEdit && row.businesType == 'CG'"
+              @change="thisAmountChange(row)"
+              :max="row.accountsAmount - row.settlmentAmount"
+            ></el-input-number>
             <span v-else>{{ row.thisAmount }}</span>
           </template>
           <template slot-scope="{ row, index }" slot="thisRefundAmount">
-            <el-input-number size="small" width="100" v-model="row.thisRefundAmount" :precision="2" :controls="false"
-              v-if="row.$cellEdit && row.businesType == 'TKCG'" @change="thisReAmountChange(row)"
-              :max="row.accountsAmount - row.settlmentAmount"></el-input-number>
+            <el-input-number
+              size="small"
+              width="100"
+              v-model="row.thisRefundAmount"
+              :precision="2"
+              :controls="false"
+              v-if="row.$cellEdit && row.businesType == 'TKCG'"
+              @change="thisReAmountChange(row)"
+              :max="row.accountsAmount - row.settlmentAmount"
+            ></el-input-number>
             <span v-else>{{ row.thisRefundAmount }}</span>
           </template>
-          <template slot-scope="{type,size,row,index,disabled}" slot="menu">
-            <el-button :size="size" :type="type" :disabled="form.financeStatus == '已付款' || isMenu"
-              :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="$refs.formContacts.rowCell(row, index)">{{
-                row.$cellEdit ? '确认' : '修改' }}
+          <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
+            <el-button
+              :size="size"
+              :type="type"
+              :disabled="form.financeStatus == '已付款' || isMenu"
+              :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
+              @click="$refs.formContacts.rowCell(row, index)"
+              >{{ row.$cellEdit ? "确认" : "修改" }}
             </el-button>
-            <el-button icon="el-icon-delete" :size="size" :disabled="form.financeStatus == '已付款' || isMenu" :type="type"
-              @click="rowDelBox(row, index)">删除
+            <el-button
+              icon="el-icon-delete"
+              :size="size"
+              :disabled="form.financeStatus == '已付款' || isMenu"
+              :type="type"
+              @click="rowDelBox(row, index)"
+              >删除
             </el-button>
           </template>
         </avue-crud>
       </trade-card>
 
       <containerTitle title="上传附件"></containerTitle>
-      <c-upload v-loading="loadingBtn" typeUpload="LT"
-        deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="filesList" display
-        :enumerationValue="35.1"></c-upload>
-
+      <c-upload
+        v-loading="loadingBtn"
+        typeUpload="LT"
+        deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
+        :data="filesList"
+        display
+        :enumerationValue="35.1"
+      ></c-upload>
     </div>
-    <el-dialog title="导入订单" append-to-body class="el-dialogDeep" :visible.sync="billDetailDialog" width="80%"
-      :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" top="10vh" v-dialog-drag>
-      <bill-detail ref="billDetailRef" :params="params" :billType="billType" :flag="1" @closeFun="closeBillDetail"
-        @importProMent="importProMent">
+    <el-dialog
+      title="导入订单"
+      append-to-body
+      class="el-dialogDeep"
+      :visible.sync="billDetailDialog"
+      width="80%"
+      :close-on-click-modal="false"
+      :destroy-on-close="true"
+      :close-on-press-escape="false"
+      top="10vh"
+      v-dialog-drag
+    >
+      <bill-detail ref="billDetailRef" :params="params" :billType="billType" :flag="1" @closeFun="closeBillDetail" @importProMent="importProMent">
       </bill-detail>
     </el-dialog>
   </div>
@@ -87,7 +139,15 @@
 
 <script>
 import billDetail from "@/components/bill/selectOrderDetailListCG";
-import { saveSubmit, collectionAndPayment, revokeCollectionAndPayment, detail, removeItems, getFinanceList, remove } from '@/api/accountingManagement/index.js';
+import {
+  saveSubmit,
+  collectionAndPayment,
+  revokeCollectionAndPayment,
+  detail,
+  removeItems,
+  getFinanceList,
+  remove
+} from "@/api/accountingManagement/index.js";
 import { number } from "echarts";
 import dicSelect from "@/components/dicSelect/main";
 export default {
@@ -117,107 +177,125 @@ export default {
       optionForm: {
         menuBtn: false,
         span: 8,
-        column: [{
-          label: '供应商',
-          prop: "corpName",
-          // type: "select",
-          // remote: true,
-          // props: {
-          //   label: 'cname',
-          //   value: 'id',
-          //   res: 'data.records'
-          // },
-          // click: () => {
-          //   this.$refs.form.dicInit()
-          // },
-          // dicUrl: '/api/blade-sales-part/corpsDesc/list?current=1&size=20&cname={{key}}&corpType=GYS',
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }]
-        }, {
-          label: '付款账户',
-          prop: "accountName",
-          props: {
-            label: 'cname',
-            value: 'cname'
+        column: [
+          {
+            label: "供应商",
+            prop: "corpName",
+            // type: "select",
+            // remote: true,
+            // props: {
+            //   label: 'cname',
+            //   value: 'id',
+            //   res: 'data.records'
+            // },
+            // click: () => {
+            //   this.$refs.form.dicInit()
+            // },
+            // dicUrl: '/api/blade-sales-part/corpsDesc/list?current=1&size=20&cname={{key}}&corpType=GYS',
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
+          },
+          {
+            label: "付款账户",
+            prop: "accountName",
+            props: {
+              label: "cname",
+              value: "cname"
+            },
+            type: "select",
+            dicUrl: "/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK",
+            dicFormatter: res => {
+              return res.data.records;
+            },
+            click: () => {
+              this.$refs.form.dicInit();
+            },
+            change: data => {
+              const targetObject = this.$refs.form.DIC.accountName.find(obj => obj.cname == data.value);
+              this.form.accountId = targetObject.id;
+            },
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
           },
-          type: "select",
-          dicUrl: '/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK',
-          dicFormatter: (res => {
-            return res.data.records
-          }),
-          click: () => {
-            this.$refs.form.dicInit()
+          {
+            label: "金额",
+            prop: "amount",
+            disabled: true,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
           },
-          change: (data => {
-            const targetObject = this.$refs.form.DIC.accountName.find(obj => obj.cname == data.value);
-            this.form.accountId = targetObject.id
-          }),
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }]
-        }, {
-          label: '金额',
-          prop: "amount",
-          disabled: true,
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }]
-        }, {
-          label: "经办人",
-          prop: "handledByName",
-          type: "select",
-          props: {
-            label: "name",
-            value: "name"
+          {
+            label: "经办人",
+            prop: "handledByName",
+            type: "select",
+            props: {
+              label: "name",
+              value: "name"
+            },
+            click: () => {
+              this.$refs.form.dicInit();
+            },
+            dicUrl: "/api/blade-user/financeList",
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
           },
-          click: () => {
-            this.$refs.form.dicInit()
+          {
+            label: "付款日期",
+            prop: "settlementDate",
+            type: "date",
+            overHidden: true,
+            width: 100,
+            searchRange: true,
+            searchDefaultTime: ["00:00:00", "23:59:59"],
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+            value: "",
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
           },
-          dicUrl: "/api/blade-user/financeList",
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }],
-        }, {
-          label: '付款日期',
-          prop: "settlementDate",
-          type: "date",
-          overHidden: true,
-          width: 100,
-          searchRange: true,
-          searchDefaultTime: ["00:00:00", "23:59:59"],
-          format: "yyyy-MM-dd",
-          valueFormat: "yyyy-MM-dd HH:mm:ss",
-          value: '',
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }]
-        }, {
-          label: '单据编号',
-          prop: "sysNo",
-          disabled: true
-        }, {
-          label: '备注',
-          prop: "remarks",
-          type: 'textarea',
-          span: 24,
-          minRows: 2
-        }]
+          {
+            label: "单据编号",
+            prop: "sysNo",
+            disabled: true
+          },
+          {
+            label: "备注",
+            prop: "remarks",
+            type: "textarea",
+            span: 24,
+            minRows: 2
+          }
+        ]
       },
       formContacts: {},
       optionContacts: {},
       optionContactsBack: {
-        align: 'center',
+        align: "center",
         index: true,
         addBtnText: "录入明细",
         refreshBtn: false,
@@ -238,27 +316,32 @@ export default {
           //   cell: true
           // },
           {
-            label: '合同号',
-            prop: 'contractNumber',
+            label: "合同号",
+            prop: "contractNumber",
             cell: false
-          }, {
-            label: '应付金额',
-            prop: 'accountsAmount',
+          },
+          {
+            label: "应付金额",
+            prop: "accountsAmount",
             cell: false
-          }, {
-            label: '结算金额',
-            prop: 'settlmentAmount',
+          },
+          {
+            label: "结算金额",
+            prop: "settlmentAmount",
             cell: false
-          }, {
-            label: '本次金额',
-            prop: 'thisAmount',
-            width: 140,
-          }, {
-            label: '本次退货金额',
-            prop: 'thisRefundAmount',
-            width: 140,
-          }, {
-            label: '业务日期',
+          },
+          {
+            label: "本次金额",
+            prop: "thisAmount",
+            width: 140
+          },
+          {
+            label: "本次退货金额",
+            prop: "thisRefundAmount",
+            width: 140
+          },
+          {
+            label: "业务日期",
             prop: "businesDate",
             disabled: false,
             type: "datetime",
@@ -271,13 +354,15 @@ export default {
                 trigger: "blur"
               }
             ]
-          }, {
-            label: '备注',
-            prop: 'remarks',
+          },
+          {
+            label: "备注",
+            prop: "remarks",
             cell: true
-          }]
+          }
+        ]
       }
-    }
+    };
   },
   props: {
     onLoad: Object,
@@ -287,81 +372,80 @@ export default {
     //  获取今天的日期
     var today = new Date();
     var year = today.getFullYear();
-    var month = String(today.getMonth() + 1).padStart(2, '0');
-    var day = String(today.getDate()).padStart(2, '0');
-    var hours = String(today.getHours()).padStart(2, '0');
-    var minutes = String(today.getMinutes()).padStart(2, '0');
-    var seconds = String(today.getSeconds()).padStart(2, '0');
+    var month = String(today.getMonth() + 1).padStart(2, "0");
+    var day = String(today.getDate()).padStart(2, "0");
+    var hours = String(today.getHours()).padStart(2, "0");
+    var minutes = String(today.getMinutes()).padStart(2, "0");
+    var seconds = String(today.getSeconds()).padStart(2, "0");
 
     // 查询经办人
     getFinanceList().then(res => {
-      this.financeList = res.data.data
-      const logInUser = JSON.parse(localStorage.getItem('saber-userInfo'));
-      if (logInUser.content.role_name.includes('财务')) {
+      this.financeList = res.data.data;
+      const logInUser = JSON.parse(localStorage.getItem("saber-userInfo"));
+      if (logInUser.content.role_name.includes("财务")) {
         for (let finance of res.data.data) {
           if (finance.name === logInUser.content.nick_name) {
-            console.log(finance.name)
+            console.log(finance.name);
             this.form.handledByName = finance.name;
             break;
           }
         }
       }
-    })
+    });
 
     // 构建今天的日期时间字符串
-    var todayDateTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
+    var todayDateTime = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
     if (this.onLoad.id) {
-      this.refresh(this.onLoad.id)
-      this.$set(this.optionForm, 'disabled', true)
-      this.$set(this.optionContactsBack, 'disabled', true)
-      this.isSaveBtn = true
-      this.isFinanceBtn = true
-      this.isMenu = true
+      this.refresh(this.onLoad.id);
+      this.$set(this.optionForm, "disabled", true);
+      this.$set(this.optionContactsBack, "disabled", true);
+      this.isSaveBtn = true;
+      this.isFinanceBtn = true;
+      this.isMenu = true;
     } else {
-      this.findObject(this.optionForm.column, 'settlementDate').value = todayDateTime
-      this.editButton = true
+      this.findObject(this.optionForm.column, "settlementDate").value = todayDateTime;
+      this.editButton = true;
     }
 
     this.optionContacts = await this.getColumnData(this.getColumnName(266.1), this.optionContactsBack);
     // let thisAmountSum = 0
     this.findObject(this.optionContacts.column, "thisAmount").change = ({ value, column }) => {
-      let thisAmountSum = 0
+      let thisAmountSum = 0;
       for (let item of this.form.settlementItemsList) {
         thisAmountSum += item.thisAmount;
       }
-      this.form.amount = Number(thisAmountSum)
-    }
+      this.form.amount = Number(thisAmountSum);
+    };
     console.log(this.onLoad.id);
-
   },
   methods: {
     dicChange(name, row) {
-      if (name == 'corpName') {
+      if (name == "corpName") {
         if (row) {
-          this.form.corpId = row.id
+          this.form.corpId = row.id;
         } else {
-          this.form.corpId = null
-          this.form.corpName = null
+          this.form.corpId = null;
+          this.form.corpName = null;
         }
       }
     },
     thisAmountChange(row) {
-      let sum1 = 0
-      let sum2 = 0
+      let sum1 = 0;
+      let sum2 = 0;
       this.form.settlementItemsList.forEach(e => {
         sum1 += e.thisAmount ? Number(e.thisAmount) : 0;
         sum2 += e.thisRefundAmount ? Number(e.thisRefundAmount) : 0;
-        this.$set(this.form, 'amount', sum1 - sum2)
-      })
+        this.$set(this.form, "amount", sum1 - sum2);
+      });
     },
     thisReAmountChange(row) {
-      let sum1 = 0
-      let sum2 = 0
+      let sum1 = 0;
+      let sum2 = 0;
       this.form.settlementItemsList.forEach(e => {
         sum1 += e.thisAmount ? Number(e.thisAmount) : 0;
         sum2 += e.thisRefundAmount ? Number(e.thisRefundAmount) : 0;
-        this.$set(this.form, 'amount', sum1 - sum2)
-      })
+        this.$set(this.form, "amount", sum1 - sum2);
+      });
     },
     rowDelBox(row, index) {
       this.$confirm("确定将选择数据删除?", {
@@ -379,37 +463,37 @@ export default {
           this.form.settlementItemsList.splice(index, 1);
           this.$message.success("操作成功!");
         }
-      }
-      )
-        ;
+      });
     },
     refresh(id, type) {
       const loading = this.$loading({
         lock: true,
-        text: '加载中',
-        spinner: 'el-icon-loading',
-        background: 'rgba(255,255,255,0.7)'
-      })
-      detail({ id: id }).then(res => {
-        this.form = res.data.data
-        this.filesList = res.data.data.filesList
-        loading.close();
-      }).catch(() => {
-        loading.close();
-      })
+        text: "加载中",
+        spinner: "el-icon-loading",
+        background: "rgba(255,255,255,0.7)"
+      });
+      detail({ id: id })
+        .then(res => {
+          this.form = res.data.data;
+          this.filesList = res.data.data.filesList;
+          loading.close();
+        })
+        .catch(() => {
+          loading.close();
+        });
     },
     rowAdd() {
       if (!this.form.corpId) {
-        this.$message.warning("请先选择客户!")
-        return
+        this.$message.warning("请先选择客户!");
+        return;
       }
-      console.log(this.form, 329)
+      console.log(this.form, 329);
       this.params = {
         customerId: this.form.corpId,
-        status: '待确认',
-        bsType: 'CG,TKCG',
-        actualPaymentStatus: '2'
-      }
+        status: "待确认",
+        bsType: "CG,TKCG",
+        actualPaymentStatus: "2"
+      };
       this.billDetailDialog = true;
 
       // 调用一次弹窗的方法,防止不刷新数据
@@ -418,23 +502,21 @@ export default {
         pagerCount: 1,
         total: 0,
         pageSizes: [20, 200, 300, 500, 700, 1000]
-      }
-      this.$refs.billDetailRef.onLoad(page, this.params)
-
-
+      };
+      this.$refs.billDetailRef.onLoad(page, this.params);
     },
     confirmEditing() {
-      this.editButton = true
-      if (this.form.financeStatus == '已付款') {
-        this.$set(this.optionForm, 'disabled', true)
-        this.$set(this.optionContactsBack, 'disabled', true)
-        this.isFinanceBtn = false
+      this.editButton = true;
+      if (this.form.financeStatus == "已付款") {
+        this.$set(this.optionForm, "disabled", true);
+        this.$set(this.optionContactsBack, "disabled", true);
+        this.isFinanceBtn = false;
       } else {
-        this.$set(this.optionForm, 'disabled', false)
-        this.$set(this.optionContactsBack, 'disabled', false)
-        this.isFinanceBtn = false
-        this.isSaveBtn = false
-        this.isMenu = false
+        this.$set(this.optionForm, "disabled", false);
+        this.$set(this.optionContactsBack, "disabled", false);
+        this.isFinanceBtn = false;
+        this.isSaveBtn = false;
+        this.isMenu = false;
       }
     },
     //关闭
@@ -444,37 +526,39 @@ export default {
     //保存数据
     editCustomer() {
       this.$refs["form"].validate((valid, done) => {
-        done()
+        done();
         if (valid) {
           let data = {
             ...this.form,
-            dc: 'c',
-            billType: 'FK',
+            dc: "c",
+            billType: "FK",
             // corpName: this.form.$corpId,
             filesList: this.filesList
-          }
+          };
           const loading = this.$loading({
             lock: true,
-            text: '加载中',
-            spinner: 'el-icon-loading',
-            background: 'rgba(255,255,255,0.7)'
+            text: "加载中",
+            spinner: "el-icon-loading",
+            background: "rgba(255,255,255,0.7)"
           });
           for (let finance of this.financeList) {
             if (finance.name == data.handledByName) {
-              data.handledById = finance.id
+              data.handledById = finance.id;
               break;
             }
           }
-          saveSubmit(data).then(res => {
-            console.log(res);
-            this.refresh(res.data.data.id)
-            this.$message.success('保存成功')
-            loading.close();
-          }).catch(() => {
-            loading.close()
-          })
+          saveSubmit(data)
+            .then(res => {
+              console.log(res);
+              this.refresh(res.data.data.id);
+              this.$message.success("保存成功");
+              loading.close();
+            })
+            .catch(() => {
+              loading.close();
+            });
         }
-      })
+      });
     },
     //导入
     importProMent(list) {
@@ -487,27 +571,27 @@ export default {
       //     }
       //   }
       // }
-      let sum1 = 0
-      let sum2 = 0
+      let sum1 = 0;
+      let sum2 = 0;
       list.forEach((item, index) => {
         item.contractNumber = item.ordNo;
-        item.accountsAmount = item.bsType == "CG" ? item.totalMoney : item.returnsAmount
-        item.settlmentAmount = item.paymentAmountTl
-        item.businesType = item.bsType
-        this.$set(item, 'thisAmount', item.bsType == "CG" ? (Number(item.totalMoney) - Number(item.paymentAmountTl)) : 0)
-        this.$set(item, 'thisRefundAmount', item.bsType == "TKCG" ? (Number(item.returnsAmount) - Number(item.paymentAmountTl)) : 0)
-        item.srcParentId = item.id
-        item.srcBillNo = item.ordNo
-        item.salesCompanyId = item.salesCompanyId
-        item.salesCompanyName = item.salesCompanyName
-        item.id = null
+        item.accountsAmount = item.bsType == "CG" ? item.totalMoney : item.returnsAmount;
+        item.settlmentAmount = item.paymentAmountTl;
+        item.businesType = item.bsType;
+        this.$set(item, "thisAmount", item.bsType == "CG" ? Number(item.totalMoney) - Number(item.paymentAmountTl) : 0);
+        this.$set(item, "thisRefundAmount", item.bsType == "TKCG" ? Number(item.returnsAmount) - Number(item.paymentAmountTl) : 0);
+        item.srcParentId = item.id;
+        item.srcBillNo = item.ordNo;
+        item.salesCompanyId = item.salesCompanyId;
+        item.salesCompanyName = item.salesCompanyName;
+        item.id = null;
         delete item.ordNo;
         this.$refs.formContacts.rowCellAdd(item);
         //计算主表金额
-        sum1 += item.bsType == "CG" ? (Number(item.totalMoney) - Number(item.paymentAmountTl)) : 0
-        sum2 += item.bsType == "TKCG" ? (Number(item.totalMoney) - Number(item.paymentAmountTl)) : 0
-        this.form.amount = sum1 - sum2
-      })
+        sum1 += item.bsType == "CG" ? Number(item.totalMoney) - Number(item.paymentAmountTl) : 0;
+        sum2 += item.bsType == "TKCG" ? Number(item.totalMoney) - Number(item.paymentAmountTl) : 0;
+        this.form.amount = sum1 - sum2;
+      });
       //明细列表所有合同号 去重 加, 为主表合同号
       // this.$set(this.form,'srcOrderno',Array.from(new Set(this.dataList.map(item =>{ return item.srcOrderno}))).join(','))
 
@@ -515,11 +599,14 @@ export default {
     },
     //收款
     collection() {
+      if (!this.form.id) {
+        return this.$message.error("请保存数据");
+      }
       this.$refs["form"].validate((valid, done) => {
-        done()
+        done();
         if (valid) {
-          if (this.form.financeStatus !== '已付款') {
-            console.log('this.form.financeStatus', this.form.financeStatus);
+          if (this.form.financeStatus !== "已付款") {
+            console.log("this.form.financeStatus", this.form.financeStatus);
             this.$confirm("确认付款?", {
               confirmButtonText: "确定",
               cancelButtonText: "取消",
@@ -527,33 +614,36 @@ export default {
             }).then(() => {
               const loading = this.$loading({
                 lock: true,
-                text: '加载中',
-                spinner: 'el-icon-loading',
-                background: 'rgba(255,255,255,0.7)'
+                text: "加载中",
+                spinner: "el-icon-loading",
+                background: "rgba(255,255,255,0.7)"
               });
               let data = {
                 ...this.form,
-                dc: 'c',
-                billType: 'FK'
-              }
-              saveSubmit(data).then(res => {
-                collectionAndPayment(data)
-                  .then((res) => {
-                    console.log(res);
-                    this.refresh(res.data.data.id);
-                    this.$set(this.optionForm, 'disabled', true)
-                    this.$set(this.optionContactsBack, 'disabled', true)
-                    this.$message.success('付款成功');
-                    loading.close();
-                  })
-                  .catch((error) => {
-                    console.error(error);
-                    loading.close();
-                  });
-              }).catch(() => {
-                loading.close()
-              })
-            })
+                dc: "c",
+                billType: "FK"
+              };
+              saveSubmit(data)
+                .then(res => {
+                  collectionAndPayment(data)
+                    .then(res => {
+                      console.log(res);
+                      this.refresh(res.data.data.id);
+                      this.$set(this.optionForm, "disabled", true);
+                      this.$set(this.optionContactsBack, "disabled", true);
+                      this.$message.success("付款成功");
+                      loading.close();
+                    })
+                    .catch(error => {
+                      console.error(error);
+                      loading.close();
+                    });
+                })
+                .catch(() => {
+                  loading.close();
+                  this.refresh(this.form.id);
+                });
+            });
           } else {
             this.$confirm("确认撤销付款?", {
               confirmButtonText: "确定",
@@ -562,40 +652,40 @@ export default {
             }).then(() => {
               const loading = this.$loading({
                 lock: true,
-                text: '加载中',
-                spinner: 'el-icon-loading',
-                background: 'rgba(255,255,255,0.7)'
+                text: "加载中",
+                spinner: "el-icon-loading",
+                background: "rgba(255,255,255,0.7)"
               });
               let data = {
                 ...this.form,
-                dc: 'c',
-                billType: 'FK',
+                dc: "c",
+                billType: "FK"
                 // corpName: this.form.$corpId
-              }
-              revokeCollectionAndPayment(data).then((res => {
-                this.refresh(res.data.data.id)
-                this.editButton = false
-                this.$message.success('撤销付款成功')
-                loading.close()
-              }))
-            })
+              };
+              revokeCollectionAndPayment(data).then(res => {
+                this.refresh(res.data.data.id);
+                this.editButton = false;
+                this.$message.success("撤销付款成功");
+                loading.close();
+              });
+            });
           }
         }
-      })
+      });
     },
     payBtn(row) {
       console.log(row);
-      this.$router.$avueRouter.closeTag('/tirePartsMall/salesManagement/purchaseOrder/index');
+      this.$router.$avueRouter.closeTag("/tirePartsMall/salesManagement/purchaseOrder/index");
       this.$router.push({
         path: "/tirePartsMall/salesManagement/purchaseOrder/index",
-        query: { detail: row, type: 'F' },
+        query: { detail: row, type: "F" }
       });
     },
     rowSave(form, done, loading) {
-      done(form)
+      done(form);
     },
     rowUpdate(form, index, done, loading) {
-      done(form)
+      done(form);
     },
     //自定义列保存
     async saveColumnTwo(ref, option, optionBack, code) {
@@ -624,7 +714,7 @@ export default {
       this.$emit("backToList", type);
     }
   }
-}
+};
 </script>
 
 <style lang="scss" scoped>

+ 8 - 2
src/views/tirePartsMall/purchasingManagement/financingProcurement/detailsPage.vue

@@ -250,7 +250,7 @@
                 <el-button
                   v-else
                   :size="size"
-                  :disabled="disabled || isAdd"
+                  :disabled="disabled || isAdd||(row.id&&form.status!='录入')"
                   :type="type"
                   :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
                   @click="hangbaocun(row, index)"
@@ -1952,7 +1952,7 @@ export default {
         return;
       }
       if (this.form.status == "审核中") {
-        this.$set(this.optionForm, "disabled", false);
+        this.$set(this.optionForm, "disabled", true);
         this.findObject(this.optionForm.column, "customerId").disabled = true;
         this.findObject(this.optionForm.column, "storageId").disabled = true;
         this.findObject(this.optionForm.column, "businesDate").disabled = true;
@@ -2335,6 +2335,12 @@ export default {
           // }
 
           if (this.form.status == "审核中") {
+            this.$set(this.optionForm, "disabled", true);
+            this.findObject(this.optionForm.column, "customerId").disabled = true;
+            this.findObject(this.optionForm.column, "storageId").disabled = true;
+            this.findObject(this.optionForm.column, "businesDate").disabled = true;
+            this.findObject(this.optionForm.column, "phone").disabled = true;
+            this.findObject(this.optionForm.column, "receivableType").disabled = true;
             this.isApplySettlement = false;
             this.isRevocationRequest = false; // 撤销请核能点击
           }

+ 6 - 5
src/views/tirePartsMall/salesManagement/purchaseOrder/detailsPage.vue

@@ -86,7 +86,7 @@
               allow-create
               default-first-option
               @change="contactsChange($event)"
-              :disabled="isContacts"
+              :disabled="isContacts||optionForm.disabled"
             >
               <el-option v-for="item in contactsOption" :key="item.cname" :label="item.cname" :value="item.contacts" />
             </el-select>
@@ -102,7 +102,7 @@
               filterable
               allow-create
               default-first-option
-              :disabled="isContacts"
+              :disabled="isContacts||optionForm.disabled"
             >
               <el-option
                 v-for="item in recAddressOption"
@@ -132,7 +132,7 @@
               @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
             >
               <template slot-scope="{ scope, row }" slot="menuLeft">
-                <el-button type="primary" icon="el-icon-plus" size="small" :disabled="isAddBtn" @click="rowAdd(row)">添加商品</el-button>
+                <el-button type="primary" icon="el-icon-plus" size="small" :disabled="isAddBtn||(form.id&&form.status!='录入')" @click="rowAdd(row)">添加商品</el-button>
                 <el-button type="success" size="small" :disabled="isAddBtn" icon="el-icon-bottom" @click="excelDialogfun('名称')"
                   >按名称导入
                 </el-button>
@@ -216,7 +216,7 @@
                 <el-button
                   v-if="mingxibaocun"
                   :size="size"
-                  :disabled="disabled || isAdd"
+                  :disabled="disabled || isAdd||(row.id&&form.status!='录入')"
                   :type="type"
                   :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
                   @click="hangeditBtn(row, index)"
@@ -234,7 +234,7 @@
                 <el-button
                   icon="el-icon-delete"
                   :size="size"
-                  :disabled="disabled || isDisabled"
+                  :disabled="disabled || isDisabled||(row.id&&form.status!='录入')"
                   :type="type"
                   @click="rowDelBox(row, index, 'orderItemsList')"
                   >删除
@@ -2361,6 +2361,7 @@ export default {
         revokeCheckOrderCG({ ...this.form })
           .then(res => {
             this.isRevocationRequest = !this.isRevocationRequest;
+            this.editButton=true
             this.refresh(res.data.data.id);
             this.$message.success("撤回成功");
             loading.close();