Quellcode durchsuchen

汇付分账迁移提交

yjwang vor 3 Tagen
Ursprung
Commit
7cbecb709f
2 geänderte Dateien mit 225 neuen und 3 gelöschten Zeilen
  1. 23 0
      src/api/his/company.js
  2. 202 3
      src/views/his/company/index.vue

+ 23 - 0
src/api/his/company.js

@@ -71,3 +71,26 @@ export function exportCompany(query) {
     params: query
   })
 }
+
+export function getDivConfig(companyId) {
+  return request({
+    url: '/his/company/getDivConfig/' + companyId,
+    method: 'get'
+  })
+}
+
+// 设置分账配置
+export function setDiv(data) {
+  return request({
+    url: '/his/company/setDiv',
+    method: 'post',
+    data: data
+  })
+}
+export function exitMiniProgram(data) {
+  return request({
+    url: '/his/company/exitMiniProgram',
+    method: 'post',
+    data: data
+  })
+}

+ 202 - 3
src/views/his/company/index.vue

@@ -134,7 +134,7 @@
       <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
       <el-table-column label="更新时间" align="center" prop="updateTime" width="180"/>
       <!--      <el-table-column label="主机重启时间" align="center" prop="restartTime" width="180" />-->
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200px">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="300px">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -176,7 +176,13 @@
             v-hasPermi="['his:company:deduct']"
           >扣款
           </el-button>
-
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleRevenue(scope.row)"
+            v-hasPermi="['his:companyDivConfig:set']"
+          >分账配置</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -473,6 +479,99 @@
         <el-button @click="deduct.open=false">取 消</el-button>
       </div>
     </el-dialog>
+
+    <el-dialog :title="revenue.title" :visible.sync="revenue.open" width="800px" append-to-body>
+      <el-form ref="revenueForm"  :model="revenueForm" label-width="150px">
+        <el-form-item label="公司">
+          <el-input v-model="revenueForm.companyName" disabled/>
+        </el-form-item>
+
+        <el-form-item label="开启分账">
+          <el-switch
+            v-model="revenueForm.divFlag"
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+            active-value="1"
+            inactive-value="0"
+          >
+          </el-switch>
+        </el-form-item>
+
+        <el-form-item label="分账模式" v-if="revenueForm.divFlag == 1">
+          <el-radio v-model="revenueForm.delayAcctFlag" label="N">实时分账</el-radio>
+          <el-radio v-model="revenueForm.delayAcctFlag" label="Y">延时分账</el-radio>
+        </el-form-item>
+        <el-form-item label="是否使用百分比分账" v-if="revenueForm.divFlag == 1">
+          <el-switch
+            v-model="revenueForm.percentageFlag"
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+            active-value="Y"
+            inactive-value="N"
+          >
+          </el-switch>
+        </el-form-item>
+        <el-form-item label="是否净值分账" v-if="revenueForm.percentageFlag == 'Y'">
+          <el-switch
+            v-model="revenueForm.iscCleanSplit"
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+            active-value="Y"
+            inactive-value="N"
+          >
+          </el-switch>
+        </el-form-item>
+        <div v-if="revenueForm.divFlag == 1">
+          <el-form-item label="分账接收方配置">
+            <el-tooltip content="批量设置分账接收账户" placement="top">
+              <el-button type="primary" icon="el-icon-plus" @click="addAcctInfo" style="margin-bottom: 5px;">
+                添加新接收方
+              </el-button>
+            </el-tooltip>
+
+          </el-form-item>
+
+          <div v-for="(account, index) in revenueForm.acctInfos" :key="index"
+               style="border: 1px solid #dcdfe6; padding: 20px; margin-bottom: 20px; border-radius: 4px;"
+          >
+            <div style="display: flex; justify-content: between; align-items: center; margin-bottom: 15px;">
+              <div style="margin: 0; color: #409eff;">账户 {{ index + 1 }}</div>
+              <el-button
+                type="danger"
+                icon="el-icon-delete"
+                size="mini"
+                @click="removeAcctInfo(index)"
+                v-if="revenueForm.acctInfos.length > 0"
+              >
+                删除账户
+              </el-button>
+            </div>
+
+            <el-form-item label="分账接收方ID" :prop="`acctInfos.${index}.huifuId`">
+              <el-input v-model="account.huifuId"   placeholder="斗拱开户时生成;示例值:6666000123120001"></el-input>
+            </el-form-item>
+            <el-form-item label="账户号" :prop="`acctInfos.${index}.acctId`" >
+              <el-input v-model="account.acctId"  placeholder="可指定账户号,仅支持基本户、现金户,不填默认为基本户;示例值:F00598600"></el-input>
+            </el-form-item>
+
+            <el-form-item label="分账百分比%" v-if="revenueForm.percentageFlag == 'Y'" :prop="`acctInfos.${index}.percentageDiv`"  >
+              <el-input-number v-model="account.percentageDiv" :precision="2" :step="0.1" :min="0" :max="100" placeholder="示例值:23.50,表示23.50%。acct_infos中全部分账百分比之和必须为100.00%。"></el-input-number>
+            </el-form-item>
+            <el-form-item label="分账金额" v-if="revenueForm.percentageFlag == 'N'" :prop="`acctInfos.${index}.divAmt`"  >
+              <el-input-number v-model="account.divAmt" :precision="2" :step="1" :min="0.01" placeholder="单位元,需保留小数点后两位,示例值:1.00 ,最低传入0.01"></el-input-number>
+            </el-form-item>
+
+          </div>
+        </div>
+
+
+
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitRevenueForm">确 定</el-button>
+        <el-button @click="revenue.open=false">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -486,7 +585,10 @@ import {
   recharge,
   deduct,
   exportCompany,
-  resetPwd
+  resetPwd,
+  getDivConfig,
+  setDiv,
+  exitMiniProgram
 } from '@/api/his/company'
 import { getFollowDoctorList } from '@/api/his/doctor'
 import { docList } from '@/api/his/doctor'
@@ -501,6 +603,23 @@ export default {
   name: 'Company',
   data() {
     return {
+      signProjectName:"",
+      redSubmit: false,
+      //分账参数
+      revenue:{
+        open: false,
+        title: '分账配置'
+      },
+      revenueForm:{
+        companyId: null,
+        companyName: '',
+        divFlag: '0',
+        delayAcctFlag: 'N',
+        percentageFlag: 'N',
+        iscCleanSplit: 'N',
+        acctInfos: [],
+        isAdd: 1
+      },
       // 表单参数
       deductForm: {
         money: 0
@@ -669,6 +788,70 @@ export default {
     })
   },
   methods: {
+    // 添加分账账户
+    addAcctInfo() {
+      this.revenueForm.acctInfos.push({
+        huifuId: '',
+        acctId: '',
+        percentageDiv: null,
+        divAmt: null
+      })
+    },
+    // 删除接收方账户
+    removeAcctInfo(index) {
+      this.$confirm('确认删除该接收方账户?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.revenueForm.acctInfos.splice(index, 1)
+        this.$message.success('删除成功')
+      }).catch(() => {
+      })
+    },
+    handleRevenue(row){
+      const companyId = row.companyId
+      // 重置表单数据,避免保留上次的数据
+      this.revenueForm = {
+        companyId: companyId,
+        companyName: row.companyName,
+        divFlag: '0',
+        delayAcctFlag: 'N',
+        percentageFlag: 'N',
+        iscCleanSplit: 'N',
+        acctInfos: [],
+        isAdd: 1
+      }
+
+      //查询配置
+      getDivConfig(companyId).then(response => {
+        if(response.data){
+          this.revenueForm = {
+            ...response.data,
+            companyId: companyId,
+            companyName: row.companyName,
+            isAdd: 0  // 已有配置,设置为更新操作
+          }
+          if(response.data.acctInfos == null){
+            this.revenueForm.acctInfos = []
+          }
+          if(response.data.divFlag != null){
+            this.revenueForm.divFlag = String(response.data.divFlag)
+          }
+          if(!response.data.delayAcctFlag){
+            this.revenueForm.delayAcctFlag = 'N'
+          }
+          if(!response.data.percentageFlag){
+            this.revenueForm.percentageFlag = 'N'
+          }
+          if(!response.data.iscCleanSplit){
+            this.revenueForm.iscCleanSplit = 'N'
+          }
+        }
+      })
+
+      this.revenue.open = true
+    },
     handleRecharge(row) {
       const companyId = row.companyId
       this.rechargeForm.companyId = row.companyId
@@ -685,6 +868,22 @@ export default {
       this.deductForm.money = null
       this.deduct.open = true
     },
+    submitRevenueForm(){
+      // 使用深拷贝,避免影响其他数据
+      var param = JSON.parse(JSON.stringify(this.revenueForm));
+      console.log("--------------提交的分账配置参数",param)
+      if(param.companyId && param.divFlag != null){
+        setDiv(param).then(response => {
+          if (response.code === 200) {
+            this.msgSuccess(response.msg)
+            this.revenue.open = false
+            this.getList()
+          }
+        })
+      } else {
+        this.$message.error('请填写完整的分账配置信息')
+      }
+    },
     /** 提交按钮 */
     submitRechargeForm() {
       this.$refs['rechargeForm'].validate(valid => {