Переглянути джерело

Merge branch 'dev1.2.0' of http://222.90.211.174:3000/suf/factoring-trade-front-end-v2 into dev1.2.0

sufan 2 днів тому
батько
коміт
ca72113609

+ 8 - 0
src/api/capitalFinancialManage/index.js

@@ -234,6 +234,14 @@ export function getCapitalAccountRecord(params) {
   })
 }
 
+// 资方授信-资方队长记录-手动批量划扣
+export function execBatchDiscount(params) {
+  return request({
+    url: `/financing/reconciliation/info/repaymentFileProcess?dateStr=${params}`,
+    method: 'get'
+  })
+}
+
 // 资方授信列表--核心企业查询
 export function getCoreEnterpriseList(params) {
   return request({

+ 3 - 1
src/components/Upload/index.vue

@@ -220,7 +220,9 @@ export default {
       handler(newV) {
         this.$nextTick(() => {
           setTimeout(() => {
-            this.$refs.upload.$el.querySelector('.el-upload').style.display = newV ? 'block' : 'none'
+            if (this.$refs.upload?.$el.querySelector('.el-upload')) {
+              this.$refs.upload.$el.querySelector('.el-upload').style.display = newV ? 'block' : 'none'
+            }
           }, 300)
         })
       },

+ 2 - 2
src/router/moudules/tradeManagement.js

@@ -108,7 +108,7 @@ export default {
       meta: { title: '采购合同管理' },
       children: [
         {
-          path: '/purchaseContractManagement/purchaseContractReview/:id',
+          path: '/purchaseContractManagement/purchaseContractReview/:id/:infoId',
           name: 'PurchaseContractReview',
           component: () => import('@/views/purchaseContractManagement/purchaseContractReview'),
           hidden: true,
@@ -122,7 +122,7 @@ export default {
           meta: { title: '签署审核', activeMenu: '/tradeManagement/purchaseContractManagement' }
         },
         {
-          path: '/purchaseContractManagement/changeContractReview/:id',
+          path: '/purchaseContractManagement/changeContractReview/:id/:infoId',
           name: 'PurchaseContractChangeReview',
           component: () => import('@/views/purchaseContractManagement/changeContractReview'),
           hidden: true,

+ 21 - 8
src/utils/request.js

@@ -114,14 +114,27 @@ service.interceptors.response.use(
   },
   error => {
     loadingInstance && loadingInstance.close()
-    const { msg } = error.response.data
-    console.log('err' + error) // for debug
-    // '后端异常:' +
-    Message({
-      message: msg,
-      type: 'error',
-      duration: 5 * 1000
-    })
+    if (error.response.data instanceof ArrayBuffer) {
+      const textDecoder = new TextDecoder('utf-8')
+      const errorText = textDecoder.decode(error.response.data)
+
+      const errorJson = JSON.parse(errorText)
+
+      Message({
+        message: errorJson.msg || '文件下载失败',
+        type: 'error',
+        duration: 5 * 1000
+      })
+    } else {
+      const { msg } = error.response.data
+      console.log('err' + error) // for debug
+      // '后端异常:' +
+      Message({
+        message: msg,
+        type: 'error',
+        duration: 5 * 1000
+      })
+    }
     resetLogin(error.response)
     return Promise.reject(error)
   }

+ 48 - 3
src/views/capitalFinancingManage/billRecords/index.vue

@@ -3,7 +3,9 @@
     <router-view />
     <template v-if="!$route.query.type">
       <div class="search">
-        <div />
+        <div>
+          <el-button v-power="'manuallyBatchDeduction'" type="primary" @click="handleBatchDiscount">手动批量划扣</el-button>
+        </div>
         <div class="right">
           <div>
             <el-input v-model="search.keyword" style="width: 210px;" placeholder="请输入借据编号/贷款编号" clearable></el-input>
@@ -41,13 +43,28 @@
         :table-options="tableOptions"
       />
     </template>
+    <cy-dialog ref="discountDialogRef" title="手动批量划扣" width="360px">
+      <el-form v-model="dialogForm">
+        <el-form-item label="请选择划扣时间">
+          <el-date-picker
+            type="date"
+            value-format="yyyy-MM-dd"
+            v-model="dialogForm.date"
+          />
+        </el-form-item>
+      </el-form>
+      <template slot="footer">
+        <el-button type="primary" :loading="confirmLoading" @click="confirmBatch">确定</el-button>
+        <el-button type="normal" @click="$refs.discountDialogRef.show = false">关闭</el-button>
+      </template>
+    </cy-dialog>
   </div>
 </template>
 
 <script>
 import { mapGetters } from 'vuex'
 import { formatMoney } from '@/utils/index'
-import { getCapitalAccountRecord } from '@/api/capitalFinancialManage/index'
+import { getCapitalAccountRecord, execBatchDiscount } from '@/api/capitalFinancialManage/index'
 
 export default {
   name: 'CapitalAuth',
@@ -173,7 +190,11 @@ export default {
             return <div>{ row.repaymentCompoundInterest ? this.formatMoney(row.repaymentCompoundInterest) : '' }</div>
           }
         }
-      ]
+      ],
+      confirmLoading: false,
+      dialogForm: {
+        date: ''
+      }
     }
   },
   computed: {
@@ -190,6 +211,30 @@ export default {
     this.fetchData()
   },
   methods: {
+    // 手动批量划扣点击
+    handleBatchDiscount() {
+      this.$refs.discountDialogRef.show = true
+    },
+    async confirmBatch() {
+      if (this.dialogForm.date === '') {
+        this.$message.warning('请选择划扣时间')
+        return
+      }
+
+      try {
+        this.confirmLoading = true
+        const res = await execBatchDiscount(this.dialogForm.date)
+
+        if (res.success) {
+          this.confirmLoading = false
+          this.$message.success('操作成功')
+          this.$router.go(0)
+        }
+      } catch (e) {
+        console.log(e)
+        this.confirmLoading = false
+      }
+    },
     async fetchData(type) {
       if (type === 'search') {
         this.page = 1

+ 83 - 22
src/views/purchaseContractManagement/components/ChangeContractReviewContent.vue

@@ -47,29 +47,50 @@
       <template v-if="ruleForm.approvalConclusion == 'pass'">
         <el-form-item label="合同签署方式" prop="signMode" style="width: 60%;"
           :rules="[
-            { required: ruleForm.approvalConclusion === 'pass', message: '请选择合同签署方式', trigger: 'change' }
+            { required: ruleForm.approvalConclusion === 'pass' && (ruleForm.signMode !== null) || ruleForm.signMode !== '', message: '请选择合同签署方式', trigger: 'change' }
           ]">
-          <el-checkbox v-model="ruleForm.signMode" @change="createFile" :true-label="1" :false-label="0" :disabled="isView">线上电子签</el-checkbox>
-        </el-form-item>
-        <el-form-item label="采购合同文件" prop="fileStorage" style="width: calc(66% - 15px);">
-          <cy-upload
-            ref="fileStorage"
-            :upload-params="{ mouldName: 'reconsiderAdjustFile' }"
-            :file-data="fileStorage"
-            :upload-from-orange-status="true"
-            placeholder="请上传附件"
-            disabled
-          />
-        </el-form-item>
-        <el-form-item label="上传合同文件" prop="upload"
-          :rules="[
-            { required: ruleForm.approvalConclusion === 'pass', message: '请选择上传合同文件', trigger: 'change' }
-          ]">
-          <el-radio-group v-model="ruleForm.upload" @change="changeUpload" :disabled="isView">
-            <el-radio :label="1">是</el-radio>
-            <el-radio :label="0">否</el-radio>
+          <!-- <el-checkbox v-model="ruleForm.signMode" @change="createFile" :true-label="1" :false-label="0" :disabled="isView">线上电子签</el-checkbox> -->
+          <el-radio-group :disabled="isView" v-model="ruleForm.signMode" @change="esignRadioChange">
+            <el-radio :label="1">线上电子签</el-radio>
+            <el-radio :label="0">线下电子签</el-radio>
           </el-radio-group>
         </el-form-item>
+        <template v-if="ruleForm.signMode === 0">
+          <el-form-item label="采购合同文件" style="width: 100%;" class="form-required">
+            <cy-upload
+              ref="purchContractOfflineRef"
+              :upload-params="{ mouldName: 'purchaseContractSupplementOfflineSignFile' }"
+              :file-data="fileStorages"
+              :file-type="'pdf'"
+              :upload-from-orange-status="true"
+              :is-call-back="true"
+              @call-back="offlineSignFileCallBack"
+              :disabled="isView"
+              placeholder="请上传附件"
+            />
+          </el-form-item>
+        </template>
+        <template v-if="ruleForm.signMode === 1">
+          <el-form-item label="采购合同文件" prop="fileStorage" style="width: calc(66% - 15px);">
+            <cy-upload
+              ref="fileStorage"
+              :upload-params="{ mouldName: 'reconsiderAdjustFile' }"
+              :file-data="fileStorage"
+              :upload-from-orange-status="true"
+              placeholder="请上传附件"
+              disabled
+            />
+          </el-form-item>
+          <el-form-item label="上传合同文件" prop="upload"
+            :rules="[
+              { required: ruleForm.approvalConclusion === 'pass', message: '请选择上传合同文件', trigger: 'change' }
+            ]">
+            <el-radio-group v-model="ruleForm.upload" @change="changeUpload" :disabled="isView">
+              <el-radio :label="1">是</el-radio>
+              <el-radio :label="0">否</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </template>
       </template>
       <el-form-item
         label="审批意见:"
@@ -82,7 +103,7 @@
       >
         <el-input v-model="ruleForm.approvalComment" type="textarea" style="width: 100%;" rows="3" clearable :disabled="isView"></el-input>
       </el-form-item>
-      <div style="width: 100%;" v-if="ruleForm.upload == 1 && ruleForm.approvalConclusion == 'pass'">
+      <div style="width: 100%;" v-if="ruleForm.upload == 1 && ruleForm.approvalConclusion == 'pass' && ruleForm.signMode === 1">
         <el-table
           :data="ruleForm.uploadPurchSupplementContracts"
           style="width: 100%">
@@ -144,6 +165,7 @@ export default {
   data() {
     return {
       key: 0,
+      tempPurchContractApproval: {}, // 临时变量存储电子签信息
       ruleForm: {
         approvalConclusion: 'pass',
         approvalComment: '',
@@ -170,7 +192,8 @@ export default {
           { required: true, message: '请输入合同生效日', trigger: 'blur' }
         ]
       },
-      fileStorage: []
+      fileStorage: [],
+      fileStorages: []
     }
   },
   props: ["isView", "info"],
@@ -198,6 +221,21 @@ export default {
             }
           })
         } else if(this.ruleForm.approvalConclusion == 'pass' || !this.ruleForm.approvalConclusion) {
+
+          // add by lx at 2024-11-20 合同签署增加线下电子签模式
+          if (this.ruleForm.signMode !== '' && this.ruleForm.signMode === 0) {
+            const purchContractOfflineFiles = this.$refs.purchContractOfflineRef.getFileLists
+
+            if (purchContractOfflineFiles && purchContractOfflineFiles.length === 0) {
+              this.$message.warning('请上传采购合同文件')
+              return
+            }
+
+            if (purchContractOfflineFiles && purchContractOfflineFiles.length) {
+              this.ruleForm.fileIds = purchContractOfflineFiles.map(item => item.id)
+            }
+          }
+
           this.$refs.ruleForm.validate(flag => {
             if(flag) {
               res(this.getParams())
@@ -259,6 +297,25 @@ export default {
         })
       }
     },
+    // 合同签署方式-radio-change
+    esignRadioChange(val) {
+      if (val === 0) {
+        this.ruleForm.fileStorage = []
+        // this.ruleForm.purchContractApproval.platform = {}
+      }
+      if (val === 1) {
+        // this.ruleForm.purchContractApproval = this.tempPurchContractApproval
+        this.createFile(val)
+      }
+    },
+    // 线下签署-采购合同文件上传成功回调
+    offlineSignFileCallBack() {
+      const purchContractOfflineFiles = this.$refs.purchContractOfflineRef.getFileLists
+
+      if (purchContractOfflineFiles && purchContractOfflineFiles.length) {
+        this.ruleForm.fileIds = purchContractOfflineFiles.map(item => item.id)
+      }
+    },
     changeUpload(val) {
       if(val == 1 && (!this.ruleForm.uploadPurchSupplementContracts || this.ruleForm.uploadPurchSupplementContracts.length === 0)) {
         this.ruleForm.uploadPurchSupplementContracts = []
@@ -324,6 +381,10 @@ export default {
             this.fileStorage = []
             this.fileStorage.push(this.info.fileStorage)
           }
+
+          if (this.info.fileStorages) {
+            this.fileStorages = this.info.fileStorages
+          }
         }
       },
       immediate: true

+ 102 - 34
src/views/purchaseContractManagement/components/PurchaseContractReviewContent.vue

@@ -90,7 +90,7 @@
         <el-input v-model="ruleForm.approvalSettleCycle.settleCycle" style="width: 100px;"  class="two-form-item" :disabled="isView" />
         {{ ruleForm.approvalSettleCycle.settleCycleMethod == 'salesContractSettleCycleMethod_fixed' ? '天' : '个自然月' }}
       </el-form-item>
-      
+
       <cy-info-title style="margin-top: 10px;">需方收货人
         <span v-if="!isView" style="position: absolute; right: 10px; top: 0; font-weight: 400; color: #5ac4fc; cursor: pointer;" @click="ruleForm.userList.push({ name: '', idCard: '', mobile: '', id: '' })">新增</span>
       </cy-info-title>
@@ -134,7 +134,7 @@
           </el-table-column>
         </el-table>
       </div>
-      
+
       <cy-info-title style="margin-top: 10px;">增值税要求</cy-info-title>
       <el-form-item label="发票类型" prop="approvalVatInfo.receiptType">
         <el-select v-model="ruleForm.approvalVatInfo.receiptType" placeholder="请选择发票类型" clearable style="width: 100%" :disabled="isView">
@@ -182,7 +182,7 @@
           </el-table-column>
         </el-table>
       </div>
-      
+
       <cy-info-title style="margin-top: 10px;">电子签信息</cy-info-title>
       <el-form-item label="审批结论" prop="purchContractApproval.approvalConclusion">
         <el-radio-group v-model="ruleForm.purchContractApproval.approvalConclusion" @change="setOtherInfo">
@@ -193,39 +193,63 @@
       <template v-if="ruleForm.purchContractApproval.approvalConclusion == 'pass'">
         <el-form-item label="合同签署方式" prop="purchContractApproval.signMode" style="width: 60%;"
           :rules="[
-            { required: ruleForm.purchContractApproval.approvalConclusion == 'pass', message: '请选择合同签署方式', trigger: 'change' }
+            { required: ruleForm.approvalConclusion === 'pass' && (ruleForm.purchContractApproval.signMode !== null || ruleForm.purchContractApproval.signMode !== ''), message: '请选择合同签署方式', trigger: 'change' }
           ]">
           <!-- <el-checkbox v-model="ruleForm.purchContractApproval.signMode" @change="createFile" :true-label="1" :false-label="0" :disabled="isView">线上电子签</el-checkbox> -->
-          <el-checkbox v-model="ruleForm.purchContractApproval.signMode" @change="createFile" :true-label="1" :false-label="''" :disabled="isView">线上电子签</el-checkbox>
-        </el-form-item>
-        <el-form-item label="贸易平台">
-          <el-input v-model="ruleForm.purchContractApproval.platform.platformName" style="width: 100%;" disabled></el-input>
-        </el-form-item>
-        <el-form-item label="认证状态" prop="purchContractApproval.platform.authStatus">
-          <el-input :value="ruleForm.purchContractApproval.platform.authStatus == 1 ? '已认证' : '未认证'" style="width: 100%;" disabled></el-input>
-        </el-form-item>
-        <el-form-item label="自动签署状态" prop="purchContractApproval.platform.autoSignStatus">
-          <el-input :value="ruleForm.purchContractApproval.platform.autoSignStatus == 1 ? '已签署' : '未签署'" style="width: 100%;" disabled></el-input>
-        </el-form-item>
-        <el-form-item label="采购合同文件" prop="purchContractApproval.fileStorage" style="width: calc(66% - 15px);">
-          <cy-upload
-            ref="fileStorage"
-            :upload-params="{ mouldName: 'reconsiderAdjustFile' }"
-            :file-data="ruleForm.purchContractApproval.fileStorage"
-            :upload-from-orange-status="true"
-            placeholder="请上传附件"
-            disabled
-          />
-        </el-form-item>
-        <el-form-item label="上传合同文件" prop="purchContractApproval.upload"
-          :rules="[
-            { required: ruleForm.purchContractApproval.approvalConclusion === 'pass', message: '请选择上传合同文件', trigger: 'change' }
-          ]">
-          <el-radio-group v-model="ruleForm.purchContractApproval.upload" @change="changeUpload" :disabled="isView">
-            <el-radio :label="1">是</el-radio>
-            <el-radio :label="0">否</el-radio>
+          <el-radio-group :disabled="isView" v-model="ruleForm.purchContractApproval.signMode" @change="esignRadioChange">
+            <el-radio :label="1">线上电子签</el-radio>
+            <el-radio :label="0">线下电子签</el-radio>
           </el-radio-group>
+          <!-- <el-checkbox-group :min="1" :max="1" :disabled="isView" v-model="ruleForm.purchContractApproval.signMode" @change="esignCheckBoxChange">
+            <el-checkbox @change="createFile" :label="1">线上电子签</el-checkbox>
+            <el-checkbox @change="downEsignChange" :label="0">线下电子签</el-checkbox>
+          </el-checkbox-group> -->
         </el-form-item>
+        <template v-if="ruleForm.purchContractApproval.signMode === 0">
+          <el-form-item label="采购合同文件" prop="purchContractApproval.fileStorages" style="width: 100%;" class="form-required">
+            <cy-upload
+              ref="purchContractOfflineRef"
+              :upload-params="{ mouldName: 'purchaseContractOfflineSignFile' }"
+              :file-data="ruleForm.purchContractApproval.fileStorages"
+              :file-type="'pdf'"
+              :upload-from-orange-status="true"
+              :is-call-back="true"
+              @call-back="offlineSignFileCallBack"
+              :disabled="isView"
+              placeholder="请上传附件"
+            />
+          </el-form-item>
+        </template>
+        <template v-if="ruleForm.purchContractApproval.signMode === 1">
+          <el-form-item label="贸易平台">
+            <el-input v-model="ruleForm.purchContractApproval.platform.platformName" style="width: 100%;" disabled></el-input>
+          </el-form-item>
+          <el-form-item label="认证状态" prop="purchContractApproval.platform.authStatus">
+            <el-input :value="ruleForm.purchContractApproval.platform.authStatus == 1 ? '已认证' : '未认证'" style="width: 100%;" disabled></el-input>
+          </el-form-item>
+          <el-form-item label="自动签署状态" prop="purchContractApproval.platform.autoSignStatus">
+            <el-input :value="ruleForm.purchContractApproval.platform.autoSignStatus == 1 ? '已签署' : '未签署'" style="width: 100%;" disabled></el-input>
+          </el-form-item>
+          <el-form-item label="采购合同文件" prop="purchContractApproval.fileStorage" style="width: calc(66% - 15px);">
+            <cy-upload
+              ref="fileStorage"
+              :upload-params="{ mouldName: 'reconsiderAdjustFile' }"
+              :file-data="ruleForm.purchContractApproval.fileStorage"
+              :upload-from-orange-status="true"
+              placeholder="请上传附件"
+              disabled
+            />
+          </el-form-item>
+          <el-form-item label="上传合同文件" prop="purchContractApproval.upload"
+            :rules="[
+              { required: ruleForm.purchContractApproval.approvalConclusion === 'pass', message: '请选择上传合同文件', trigger: 'change' }
+            ]">
+            <el-radio-group v-model="ruleForm.purchContractApproval.upload" @change="changeUpload" :disabled="isView">
+              <el-radio :label="1">是</el-radio>
+              <el-radio :label="0">否</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </template>
       </template>
 
       <el-form-item
@@ -297,6 +321,8 @@
 
 <script>
 import request from '@/utils/request'
+import { deepClone } from '@/utils'
+
 export default {
   components: {
     SignConfirmationContent: () => import('./SignConfirmationContent.vue')
@@ -321,6 +347,7 @@ export default {
     }
     return {
       key: 0,
+      tempPurchContractApproval: {}, // 临时变量存储电子签信息
       ruleForm: {
         purchContractBasicInfo: {},
         purchContractReplenishInfo: {},
@@ -332,7 +359,8 @@ export default {
         approvalVatInfo: {},
         purchContractOtherClause: [],
         purchContractApproval: {
-          platform: {}
+          platform: {},
+          fileStorages: []
         },
         visible: '',
         supplier: {}
@@ -459,6 +487,9 @@ export default {
         Object.keys(this.ruleForm).forEach(key => {
           if(data[key]) {
             this.ruleForm[key] = data[key]
+            if (key === 'purchContractApproval') {
+              this.tempPurchContractApproval = deepClone(data.purchContractApproval)
+            }
           }
         })
         this.$emit('changeResult', this.ruleForm.purchContractApproval?.approvalConclusion)
@@ -505,6 +536,21 @@ export default {
             }
           })
         } else if(this.ruleForm.purchContractApproval.approvalConclusion == 'pass' || !this.ruleForm.purchContractApproval.approvalConclusion) {
+
+          // add by lx at 2024-11-20 合同签署增加线下电子签模式
+          if (this.ruleForm.purchContractApproval.signMode !== '' && this.ruleForm.purchContractApproval.signMode === 0) {
+            const purchContractOfflineFiles = this.$refs.purchContractOfflineRef.getFileLists
+
+            if (purchContractOfflineFiles && purchContractOfflineFiles.length === 0) {
+              this.$message.warning('请上传采购合同文件')
+              return
+            }
+
+            if (purchContractOfflineFiles && purchContractOfflineFiles.length) {
+              this.ruleForm.purchContractApproval.fileIds = purchContractOfflineFiles.map(item => item.id)
+            }
+          }
+
           this.$refs.ruleForm.validate(flag => {
             if(flag) {
               resolve()
@@ -525,7 +571,7 @@ export default {
     createFile(val) {
       if(this.ruleForm.purchContractApproval.approvalConclusion == 'pass' && val == 1) {
         let data = { taskId: this.$route.params.taskId, businessKey: this.$route.params.infoId, ...this.ruleForm }
-        data.visible = 0 
+        data.visible = 0
         data.purchContractApproval = {
           ...this.ruleForm.purchContractApproval
         }
@@ -553,6 +599,28 @@ export default {
         this.ruleForm.purchContractApproval.fileStorage = []
       }
     },
+    // 合同签署方式-radio-change
+    esignRadioChange(val) {
+      if (val === 0) {
+        this.ruleForm.purchContractApproval.fileStorage = []
+      }
+      if (val === 1) {
+        if (Object.keys(this.tempPurchContractApproval).length) {
+          this.ruleForm.purchContractApproval = this.tempPurchContractApproval
+          this.ruleForm.purchContractApproval.signMode = val
+          this.ruleForm.purchContractApproval.approvalConclusion = 'pass'
+        }
+        this.createFile(val)
+      }
+    },
+    // 线下签署-采购合同文件上传成功回调
+    offlineSignFileCallBack() {
+      const purchContractOfflineFiles = this.$refs.purchContractOfflineRef.getFileLists
+
+      if (purchContractOfflineFiles && purchContractOfflineFiles.length) {
+        this.ruleForm.purchContractApproval.fileIds = purchContractOfflineFiles.map(item => item.id)
+      }
+    },
     setOtherInfo(val) {
       this.$emit('changeResult', this.ruleForm.purchContractApproval.approvalConclusion)
       if(val == 'back') {