Przeglądaj źródła

允许修改费用的险种

祁鹏飞 1 miesiąc temu
rodzic
commit
da3d360aaa

+ 146 - 129
src/views/quoteConfig/agreement/components/ruleFeeDialogEdit.vue

@@ -1,23 +1,27 @@
 <!-- 模板区域 -->
 <template>
   <div>
-    <el-drawer v-model="props.ruleFeeVisible" :direction="direction" :close-on-click-modal="true" size="62%" @close="close">
+    <el-drawer v-model="props.ruleFeeVisible" :direction="direction" :close-on-click-modal="true" size="62%"
+      @close="close">
       <template #header>
-        <h4>{{ props.headerTitle }}{{ props.titleType || '费用编辑' }}</h4>
+        <h4>{{ '费用编辑' }}</h4>
       </template>
       <template #default>
         <div class="rejectionReason flex a-start" v-if="costitemEditInfo.reviewDescription">
-          <el-icon color="red" class="m-right-20"><CircleClose /></el-icon>
+          <el-icon color="red" class="m-right-20">
+            <CircleClose />
+          </el-icon>
           <div class="flex f-c">
             <span class="strong" style="color: #333;">审核不通过</span>
-            <span >审核原因:{{costitemEditInfo. reviewDescription }}</span>
+            <span>审核原因:{{ costitemEditInfo.reviewDescription }}</span>
             <div class="flex a-c ">
               <span class="m-right-20">审核人:{{ costitemEditInfo.auditPerson }}</span>
-              <span >审核时间:{{costitemEditInfo.auditTime }}</span>
+              <span>审核时间:{{ costitemEditInfo.auditTime }}</span>
             </div>
-            <span class="primary" v-if="costitemEditInfo.approved == 2" @click="disabledShow = false"  style="color: #409eff;" >
-                修改并重提交
-              </span>
+            <span class="primary" v-if="costitemEditInfo.approved == 2" @click="disabledShow = false"
+              style="color: #409eff;">
+              修改并重提交
+            </span>
           </div>
         </div>
         <div class="agreement ">
@@ -33,6 +37,15 @@
           <ElRow :gutter="20" class="m-top-20">
             <el-form :model="costitemEditInfo" ref="editFormRefs" label-width="80px" style="width: 100%;"
               :disabled="disabledShow" class="flex a-c f-wrap" :size="fromSize" :rules="editRules">
+              <ElCol :md="24" :lg="24" v-if="!costitemEditInfo.reviewDescription">
+                <el-form-item label="险种" prop="productId">
+                  <el-radio-group v-model="costitemEditInfo.productId"
+                    @change="costitemEditInfo.productName = ruleFeeinfo.find(v => v.value === costitemEditInfo.productId).label">
+                    <el-radio-button v-for="item in ruleFeeinfo" :key="item.id" :label="item.label"
+                      :value="item.value" />
+                  </el-radio-group>
+                </el-form-item>
+              </ElCol>
               <ElCol :md="24" :lg="12">
                 <el-form-item label="生效时间" prop="effectiveTime">
                   <el-date-picker v-model="costitemEditInfo.effectiveTime" style="width: 100%;" type="datetime"
@@ -55,11 +68,11 @@
                   </el-select>
                 </el-form-item>
               </ElCol>
-                <ElCol :md="24" :lg="12">
-                    <el-form-item label="优先级" prop="priorityLevel">
-                        <el-input-number style="width: 100%" v-model="costitemEditInfo.priorityLevel" placeholder="请填写优先级" />
-                    </el-form-item>
-                </ElCol>
+              <ElCol :md="24" :lg="12">
+                <el-form-item label="优先级" prop="priorityLevel">
+                  <el-input-number style="width: 100%" v-model="costitemEditInfo.priorityLevel" placeholder="请填写优先级" />
+                </el-form-item>
+              </ElCol>
               <ElCol :md="24" :lg="24">
                 <el-form-item label="费用描述" prop="costDescribe">
                   <el-input v-model="costitemEditInfo.costDescribe" maxlength="500" placeholder="请输入费用描述"
@@ -95,11 +108,12 @@
               </div>
             </template>
             <el-table-column prop="costType" label="类型"></el-table-column>
-            <el-table-column prop="costType" label="入口手续费比例" width="150" align="center" v-if="costitemEditInfo.jqEntranceFeeRatio  || costitemEditInfo.syEntranceFeeRatio || costitemEditInfo.jyEntranceFeeRatio">
+            <el-table-column prop="costType" label="入口手续费比例" width="150" align="center"
+              v-if="costitemEditInfo.jqEntranceFeeRatio || costitemEditInfo.syEntranceFeeRatio || costitemEditInfo.jyEntranceFeeRatio">
               <template #default="scope">
-                  <span v-if="scope.row.costType == '交强险'">{{costitemEditInfo.jqEntranceFeeRatio}}%</span>
-                  <span v-if="scope.row.costType == '商业险'">{{costitemEditInfo.syEntranceFeeRatio}}%</span>
-                  <span v-if="scope.row.costType == '驾意险'">{{costitemEditInfo.jyEntranceFeeRatio}}%</span>
+                <span v-if="scope.row.costType == '交强险'">{{ costitemEditInfo.jqEntranceFeeRatio }}%</span>
+                <span v-if="scope.row.costType == '商业险'">{{ costitemEditInfo.syEntranceFeeRatio }}%</span>
+                <span v-if="scope.row.costType == '驾意险'">{{ costitemEditInfo.jyEntranceFeeRatio }}%</span>
               </template>
             </el-table-column>
             <el-table-column prop="inlet" label="入口比例" width="160" align="center">
@@ -118,7 +132,7 @@
                 </el-input-number>
               </template>
             </el-table-column>
-<!--            <el-table-column prop="commission" label="手续费比例" width="180" align="center">
+            <!--            <el-table-column prop="commission" label="手续费比例" width="180" align="center">
               <template #default="scope">
                 <el-input-number v-model="scope.row.commission" :disabled="disabledShow" :precision="2"
                   controls-position="right" style="width: 100%;" :min="0" :max="100">
@@ -127,29 +141,29 @@
               </template>
             </el-table-column>-->
             <el-table-column prop="addThrow" label="加投比例" width="180" align="center">
-                <template #default="scope">
-                    <el-input-number v-model="scope.row.addThrow" :disabled="disabledShow" :precision="2"
-                                     controls-position="right" style="width: 100%;" :min="0" :max="100" @change="handelJT(scope)">
-                        <template #suffix>%</template>
-                    </el-input-number>
-                </template>
+              <template #default="scope">
+                <el-input-number v-model="scope.row.addThrow" :disabled="disabledShow" :precision="2"
+                  controls-position="right" style="width: 100%;" :min="0" :max="100" @change="handelJT(scope)">
+                  <template #suffix>%</template>
+                </el-input-number>
+              </template>
             </el-table-column>
             <el-table-column prop="keepPointRatio" label="留点比例" width="180" align="center">
-                <template #default="scope">
-                    <el-input-number v-model="scope.row.keepPointRatio" :disabled="disabledShow" :precision="2"
-                                     controls-position="right" style="width: 100%;" :min="0" :max="100" @change="handelLD(scope)">
-                        <template #suffix>%</template>
-                    </el-input-number>
-                </template>
+              <template #default="scope">
+                <el-input-number v-model="scope.row.keepPointRatio" :disabled="disabledShow" :precision="2"
+                  controls-position="right" style="width: 100%;" :min="0" :max="100" @change="handelLD(scope)">
+                  <template #suffix>%</template>
+                </el-input-number>
+              </template>
+            </el-table-column>
+            <el-table-column prop="exportKeepPointRatio" label="出口留点比例" width="180" align="center">
+              <template #default="scope">
+                <el-input-number v-model="scope.row.exportKeepPointRatio" :disabled="disabledShow" :precision="2"
+                  controls-position="right" style="width: 100%;" :min="0" :max="100">
+                  <template #suffix>%</template>
+                </el-input-number>
+              </template>
             </el-table-column>
-              <el-table-column prop="exportKeepPointRatio" label="出口留点比例" width="180" align="center">
-                  <template #default="scope">
-                      <el-input-number v-model="scope.row.exportKeepPointRatio" :disabled="disabledShow" :precision="2" controls-position="right"
-                                       style="width: 100%;" :min="0" :max="100">
-                          <template #suffix>%</template>
-                      </el-input-number>
-                  </template>
-              </el-table-column>
           </el-table>
         </div>
 
@@ -159,8 +173,8 @@
           <el-button @click="cancel">取消</el-button>
           <el-button type="primary" @click="save(editFormRefs)">提交审核</el-button>
         </div>
-         <div class="flex f-c " v-if="!costitemEditInfo?.reviewDescription && props.operationType == 'audit'">
-        <!-- <div class="flex f-c " v-if="!costitemEditInfo?.approved"> -->
+        <div class="flex f-c " v-if="!costitemEditInfo?.reviewDescription && props.operationType == 'audit'">
+          <!-- <div class="flex f-c " v-if="!costitemEditInfo?.approved"> -->
           <el-checkbox v-model="automatic" label="审核后,自动跳支审核下一条费用" size="large" />
           <div class="flex a-c">
             <el-button @click="rejectOperation">审核驳回</el-button>
@@ -170,8 +184,8 @@
       </template>
     </el-drawer>
     <!-- 规则条件弹窗 -->
-    <RuleCondition ref="RuleConditionRefs" :ruleConditionVisible="ruleConditionVisible" @cancel="ruleConditionVisible = false"
-      @save="ruleConditionSave" :attrIdList="ruleConditions" />
+    <RuleCondition ref="RuleConditionRefs" :ruleConditionVisible="ruleConditionVisible"
+      @cancel="ruleConditionVisible = false" @save="ruleConditionSave" :attrIdList="ruleConditions" />
 
   </div>
 </template>
@@ -180,7 +194,7 @@
 <script lang='ts' setup>
 import { ref, } from 'vue'
 import { DrawerProps, ComponentSize, ElMessageBox, ElMessage } from 'element-plus';
-import { loadDicts } from '@/utils/composables/dictService';//字典组件
+import { loadDicts, getDict } from '@/utils/composables/dictService';//字典组件
 const direction = ref<DrawerProps['direction']>('rtl')
 const fromSize = ref<ComponentSize>('default')
 
@@ -203,8 +217,11 @@ const ruleConditionVisible = ref(false);//规则条件弹窗
 const costitemEditInfo = ref();//编辑费用数据
 const disabledShow = ref(false);//是否可编辑
 const automatic = ref(false);//是否连续审核
+const ruleFeeinfo = ref();//险种列表
 onMounted(async () => {
   await loadDicts(['insurance_type'])
+  const dict = getDict('insurance_type');
+  ruleFeeinfo.value = dict
 })
 watch(props, () => {
   if (props.costitemEditInfo) {
@@ -221,95 +238,95 @@ watch(props, () => {
 })
 
 let editRules = ref({
-    effectiveTime: [
-        { required: true, trigger: 'change', message: '请选择生效时间' },
-    ],
-    failureTime: [
-        { required: true, trigger: 'change', message: '请选择失效时间' },
-    ],
-    auditMethod: [
-        { required: true, trigger: 'change', message: '请选择审核方式' },
-    ],
-    priorityLevel: [
-        { required: true, trigger: 'blur', message: '请填写优先级' },
-    ]
+  effectiveTime: [
+    { required: true, trigger: 'change', message: '请选择生效时间' },
+  ],
+  failureTime: [
+    { required: true, trigger: 'change', message: '请选择失效时间' },
+  ],
+  auditMethod: [
+    { required: true, trigger: 'change', message: '请选择审核方式' },
+  ],
+  priorityLevel: [
+    { required: true, trigger: 'blur', message: '请填写优先级' },
+  ]
 })
 
 const addRules = () => {
-    ruleConditionVisible.value = true
-    RuleConditionRefs.value.ruleAttr(props.agreementInfo.companyId)
+  ruleConditionVisible.value = true
+  RuleConditionRefs.value.ruleAttr(props.agreementInfo.companyId)
 }
 
 const handelRK = (scope) => {
-//  // 获取当前险种对应的入口手续费比例
-//  let entranceFeeRatio = 0;
-//   if (scope.row.costType == '交强险') {
-//     entranceFeeRatio = costitemEditInfo.value?.jqEntranceFeeRatio || 0;
-//   } else if (scope.row.costType == '商业险') {
-//     entranceFeeRatio = costitemEditInfo.value?.syEntranceFeeRatio || 0;
-//   } else if (scope.row.costType == '驾意险') {
-//     entranceFeeRatio = costitemEditInfo.value?.jyEntranceFeeRatio || 0;
-//   }
+  //  // 获取当前险种对应的入口手续费比例
+  //  let entranceFeeRatio = 0;
+  //   if (scope.row.costType == '交强险') {
+  //     entranceFeeRatio = costitemEditInfo.value?.jqEntranceFeeRatio || 0;
+  //   } else if (scope.row.costType == '商业险') {
+  //     entranceFeeRatio = costitemEditInfo.value?.syEntranceFeeRatio || 0;
+  //   } else if (scope.row.costType == '驾意险') {
+  //     entranceFeeRatio = costitemEditInfo.value?.jyEntranceFeeRatio || 0;
+  //   }
 
-//   // 检查入口比例是否小于入口手续费比例
-//   if (scope.row.inlet < entranceFeeRatio) {
-//     ElMessage({
-//       type: 'warning',
-//       message: `入口比例不能小于入口手续费比例(${entranceFeeRatio}%)`,
-//       plain: true,
-//     });
-//     scope.row.inlet = entranceFeeRatio;
-//     return;
-//   }
+  //   // 检查入口比例是否小于入口手续费比例
+  //   if (scope.row.inlet < entranceFeeRatio) {
+  //     ElMessage({
+  //       type: 'warning',
+  //       message: `入口比例不能小于入口手续费比例(${entranceFeeRatio}%)`,
+  //       plain: true,
+  //     });
+  //     scope.row.inlet = entranceFeeRatio;
+  //     return;
+  //   }
 
-    if(scope.row.export&&scope.row.addThrow || scope.row.export&&scope.row.addThrow === 0) {
-        scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
-    }
-    if(scope.row.export&&scope.row.keepPointRatio) {
-        scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
-    }
-    if(scope.row.keepPointRatio&&scope.row.addThrow || scope.row.keepPointRatio&&scope.row.addThrow === 0) {
-        scope.row.export = scope.row.inlet + scope.row.addThrow - scope.row.keepPointRatio
-    }
+  if (scope.row.export && scope.row.addThrow || scope.row.export && scope.row.addThrow === 0) {
+    scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
+  }
+  if (scope.row.export && scope.row.keepPointRatio) {
+    scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
+  }
+  if (scope.row.keepPointRatio && scope.row.addThrow || scope.row.keepPointRatio && scope.row.addThrow === 0) {
+    scope.row.export = scope.row.inlet + scope.row.addThrow - scope.row.keepPointRatio
+  }
 }
 const handelCK = (scope) => {
-    if(scope.row.inlet&&scope.row.addThrow || scope.row.inlet&&scope.row.addThrow === 0) {
-        scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
-    }
-    if(scope.row.inlet&&scope.row.keepPointRatio) {
-        scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
-    }
-    if(scope.row.keepPointRatio&&scope.row.addThrow || scope.row.keepPointRatio&&scope.row.addThrow === 0) {
-        scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
-    }
-    if(scope.row.keepPointRatio) {
-        scope.row.exportKeepPointRatio = scope.row.export - scope.row.keepPointRatio
-    }
+  if (scope.row.inlet && scope.row.addThrow || scope.row.inlet && scope.row.addThrow === 0) {
+    scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
+  }
+  if (scope.row.inlet && scope.row.keepPointRatio) {
+    scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
+  }
+  if (scope.row.keepPointRatio && scope.row.addThrow || scope.row.keepPointRatio && scope.row.addThrow === 0) {
+    scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
+  }
+  if (scope.row.keepPointRatio) {
+    scope.row.exportKeepPointRatio = scope.row.export - scope.row.keepPointRatio
+  }
 }
 const handelJT = (scope) => {
-    if(scope.row.inlet&&scope.row.export) {
-        scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
-    }
-    if(scope.row.inlet&&scope.row.keepPointRatio) {
-        scope.row.export = scope.row.addThrow + scope.row.inlet - scope.row.keepPointRatio
-    }
-    if(scope.row.keepPointRatio&&scope.row.export) {
-        scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
-    }
+  if (scope.row.inlet && scope.row.export) {
+    scope.row.keepPointRatio = scope.row.inlet + scope.row.addThrow - scope.row.export
+  }
+  if (scope.row.inlet && scope.row.keepPointRatio) {
+    scope.row.export = scope.row.addThrow + scope.row.inlet - scope.row.keepPointRatio
+  }
+  if (scope.row.keepPointRatio && scope.row.export) {
+    scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
+  }
 }
 const handelLD = (scope) => {
-    if(scope.row.inlet&&scope.row.export) {
-        scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
-    }
-    if(scope.row.inlet&&scope.row.addThrow || scope.row.inlet&&scope.row.addThrow === 0) {
-        scope.row.export = scope.row.addThrow + scope.row.inlet - scope.row.keepPointRatio
-    }
-    if(scope.row.addThrow&&scope.row.export || scope.row.addThrow === 0&&scope.row.export) {
-        scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
-    }
-    if(scope.row.export) {
-        scope.row.exportKeepPointRatio = scope.row.export - scope.row.keepPointRatio
-    }
+  if (scope.row.inlet && scope.row.export) {
+    scope.row.addThrow = scope.row.export + scope.row.keepPointRatio - scope.row.inlet
+  }
+  if (scope.row.inlet && scope.row.addThrow || scope.row.inlet && scope.row.addThrow === 0) {
+    scope.row.export = scope.row.addThrow + scope.row.inlet - scope.row.keepPointRatio
+  }
+  if (scope.row.addThrow && scope.row.export || scope.row.addThrow === 0 && scope.row.export) {
+    scope.row.inlet = scope.row.export + scope.row.keepPointRatio - scope.row.addThrow
+  }
+  if (scope.row.export) {
+    scope.row.exportKeepPointRatio = scope.row.export - scope.row.keepPointRatio
+  }
 }
 
 
@@ -354,18 +371,18 @@ const ruleConditionSave = (list: string[]) => {//获取规则条件选中集合
 const cancel = () => {
   emits("cancel")
 }
-const close=()=>{
+const close = () => {
   emits("cancel")
 }
 const save = (formRef) => {
-    if (!formRef) return
-    if (formRef) {
-        formRef.validate((valid) => {
-            if(valid) {
-                emits("save", costitemEditInfo.value)
-            }
-        })
-    }
+  if (!formRef) return
+  if (formRef) {
+    formRef.validate((valid) => {
+      if (valid) {
+        emits("save", costitemEditInfo.value)
+      }
+    })
+  }
 }
 
 
@@ -381,12 +398,12 @@ const rejectOperation = () => {
     inputPlaceholder: "请输入不通过原因",
   })
     .then(({ value }) => {
-      emits("rejectOperation",automatic.value,costitemEditInfo.value.id,value)
+      emits("rejectOperation", automatic.value, costitemEditInfo.value.id, value)
     })
 }
 //审核通过操作
 const auditOperation = () => {
-  emits("auditOperation", automatic.value,costitemEditInfo.value.id)
+  emits("auditOperation", automatic.value, costitemEditInfo.value.id)
 }
 </script>
 <!-- 样式区域 -->