From 2891efe0745a7510536d1aa01b914564fc58721a Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期二, 24 十二月 2024 10:10:20 +0800
Subject: [PATCH] 修改bug

---
 src/views/safetyReview/expertManage/postEvaluation/components/evaluate.vue |  164 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 143 insertions(+), 21 deletions(-)

diff --git a/src/views/safetyReview/expertManage/postEvaluation/components/evaluate.vue b/src/views/safetyReview/expertManage/postEvaluation/components/evaluate.vue
index 5bb36a7..d724c9e 100644
--- a/src/views/safetyReview/expertManage/postEvaluation/components/evaluate.vue
+++ b/src/views/safetyReview/expertManage/postEvaluation/components/evaluate.vue
@@ -115,7 +115,7 @@
           <el-table-column prop="content" label="扣分项"/>
           <el-table-column prop="score" label="分值">
             <template #default="scope">
-              <el-input v-model.trim="scope.row.score" type="number" :readonly="state.disable"></el-input>
+              <el-input v-model.trim="scope.row.score" type="number" :readonly="state.disable" placeholder="此处须填写负数"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
@@ -128,7 +128,7 @@
 
         <div style="margin: 25px 0;font-size: 14px">
           <el-form-item label="本项目考评总计" prop="score">
-            <el-input v-model.trim="state.form.score" type="number" :readonly="state.disable"><template #append>分</template></el-input>
+            <el-input v-model.trim="totalScore" type="number" readonly=true><template #append>分</template></el-input>
           </el-form-item>
         </div>
         <el-row>
@@ -147,21 +147,49 @@
           <el-input v-model="state.form.content" type="textarea" :autosize="{ minRows: 2}" :readonly="state.disable"></el-input>
         </el-form-item>
         <el-divider></el-divider>
-        <el-form-item label="计费标准" prop="freightBasis">
-          <el-input v-model.trim="state.form.freightBasis" :readonly="state.disable"></el-input>
-        </el-form-item>
         <el-row>
           <el-col :span="12">
-            <el-form-item label="计费时长" prop="billingDuration">
-              <el-input v-model.trim="state.form.billingDuration" type="number" :readonly="state.disable"><template #append>小时</template></el-input>
+            <el-form-item label="计费标准" prop="freightBasis">
+              <el-input v-model.number.trim="state.form.freightBasis" :readonly="state.disable" @input="getExpertFee"><template #append>天/课时</template></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="税后金额" prop="afterTaxAmount">
-              <el-input v-model.trim="state.form.afterTaxAmount" type="number" :readonly="state.disable"><template #append>元</template></el-input>
+            <el-form-item label="标准说明" prop="billingInstructions">
+              <el-input v-model.trim="state.form.billingInstructions" type="textarea" :autosize="{ minRows: 2}" :readonly="state.disable" placeholder="如填写:第1-3天800元/天"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="计费时长" prop="billingDuration">
+              <el-input v-model.number.trim="state.form.billingDuration" type="number" :readonly="state.disable" @input="getExpertFee"><template #append>天/课时</template></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="税前金额(专家费)" prop="taxExpertFee">
+              <el-input v-model="state.form.taxExpertFee" type="number" :readonly="state.disable" @input="getExpertTax"><template #append>元</template></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+<!--          <el-col :span="8">-->
+<!--            <el-form-item label="应纳税所得额">-->
+<!--              <el-input v-model.trim="taxIncome" type="number" readonly><template #append>元</template></el-input>-->
+<!--            </el-form-item>-->
+<!--          </el-col>-->
+          <el-col :span="12">
+            <el-form-item label="应缴税费">
+              <el-input v-model.trim="state.form.incomeTaxPayable" type="number" :readonly="state.disable"><template #append>元</template></el-input>
+              <div style="font-size: 12px;color: red">系统自动计算金额仅供参考,请注意核对。</div>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="税后金额">
+              <el-input v-model="state.form.afterTaxAmount" type="number" :readonly="state.disable"><template #append>元</template></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
         <el-row>
           <el-col :span="12">
             <el-form-item label="开户行" prop="openBank">
@@ -246,7 +274,11 @@
     content: '',
     freightBasis: '',
     billingDuration: null,
+    taxExpertFee: null,
+    billingInstructions: '',
     afterTaxAmount: null,
+    taxableIncome: null,
+    incomeTaxPayable: null,
     openBank: '',
     bankCard: '',
   },
@@ -262,7 +294,7 @@
     generalHazards: [{required: true, message: '请输入一般隐患数', trigger: 'blur'}],
     freightBasis: [{required: true, message: '请输入计费标准', trigger: 'blur'}],
     billingDuration: [{required: true, message: '请输入计费时长', trigger: 'blur'}],
-    afterTaxAmount: [{required: true, message: '请输入税后金额', trigger: 'blur'}],
+    taxExpertFee: [{required: true, message: '请输入税前金额(专家费)', trigger: 'blur'}],
     openBank: [{required: true, message: '请输入开户行', trigger: 'blur'}],
     bankCard: [{required: true, message: '请输入卡号', trigger: 'blur'}]
   },
@@ -294,7 +326,82 @@
 })
 
 const totalScore = computed(()=>{
-  return Number(addTotal.value) + Number(deductTotal.value)
+  return 100 + Number(addTotal.value) + Number(deductTotal.value)
+})
+
+
+// 这里一堆无作用的代码存在的原因是需求一直来回改,简洁的代码也改成屎了
+const expertIncome = computed(()=>{
+  if(state.form.freightBasis == null || state.form.billingDuration == null){
+    return null
+  }
+  if(state.form.billingDuration <= 3){
+    return (state.form.freightBasis * state.form.billingDuration)
+  }else{
+    return (state.form.freightBasis * 3) + (state.form.freightBasis * 0.5 * (state.form.billingDuration - 3))
+  }
+})
+
+const getExpertFee = ()=>{
+  if((state.form.freightBasis && state.form.freightBasis > 0) && (state.form.billingDuration && state.form.billingDuration > 0)){
+    state.form.taxExpertFee = state.form.freightBasis * state.form.billingDuration
+  }
+}
+
+const getExpertTax = ()=>{
+  const expertIncomeValue = state.form.taxExpertFee
+  if(expertIncomeValue == null || expertIncomeValue / 1.01 - 800<=0){
+    state.form.incomeTaxPayable = 0
+    state.form.afterTaxAmount = expertIncomeValue
+  }else{
+    state.form.incomeTaxPayable = ((expertIncomeValue / 1.01 - 800) * 0.2).toFixed(2)
+    state.form.afterTaxAmount = (expertIncomeValue - state.form.incomeTaxPayable).toFixed(2)
+  }
+}
+
+const taxIncome = computed(()=>{
+  const expertIncomeValue = state.form.taxExpertFee
+  if (expertIncomeValue == null || expertIncomeValue === 0 || expertIncomeValue <= 800) {
+    return 0
+  }
+  if (expertIncomeValue > 800 && expertIncomeValue <= 4000) {
+    return expertIncomeValue - 800
+  } else {
+    return expertIncomeValue * 0.8
+  }
+})
+
+const taxPay = computed(()=>{
+  // const taxIncomeValue = taxIncome.value
+  // if (taxIncomeValue == null || taxIncomeValue === 0) {
+  //   return 0
+  // }
+  // if (taxIncomeValue <= 20000) {
+  //   return taxIncomeValue * 0.2
+  // } else if (taxIncomeValue <= 50000) {
+  //   return taxIncomeValue * 0.3 - 2000
+  // } else {
+  //   return taxIncomeValue * 0.4 - 7000
+  // }
+
+  const expertIncomeValue = state.form.taxExpertFee
+  if(expertIncomeValue == null || expertIncomeValue === 0 || expertIncomeValue <= 800){
+    return 0
+  }
+  if(expertIncomeValue / 1.01 - 800>0){
+    return ((expertIncomeValue / 1.01 - 800) * 0.2).toFixed(2)
+  }else{
+    return 0
+  }
+})
+
+const afterTaxIncome = computed(()=>{
+  const expertIncomeValue = state.form.taxExpertFee
+  const taxPayValue = taxPay.value
+  if (expertIncomeValue == null || expertIncomeValue == 0) {
+    return 0
+  }
+  return (expertIncomeValue - taxPayValue).toFixed(2)
 })
 
 const openDialog = async (type, value, projectName, projectCheckTime) => {
@@ -362,7 +469,6 @@
 }
 
 const handleClose = () => {
-  busRef.value.clearValidate();
   state.info = {
     name: '',
     idCard: '',
@@ -386,10 +492,19 @@
     content: '',
     freightBasis: '',
     billingDuration: null,
+    taxExpertFee: null,
+    billingInstructions: '',
     afterTaxAmount: null,
+    taxableIncome: null,
+    incomeTaxPayable: null,
     openBank: '',
     bankCard: '',
   }
+  totalScore.value = null
+  taxIncome.value= null
+  taxPay.value= null
+  afterTaxIncome.value= null
+  busRef.value.clearValidate()
   state.addData = []
   state.deductData = []
   dialogVisible.value = false;
@@ -417,15 +532,22 @@
 }
 
 const confirmScore = async ()=>{
-  state.form.saveData = [...state.addData,...state.deductData]
-  state.form.delData = state.form.delData.filter((id) => !state.form.saveData.some((item) => item.id === id))
-  const res = await projectExpertDetailSave(state.form)
-  if(res.code == 200){
-    ElMessage.success(res.msg)
-    await handleClose()
-    emit('getList')
-  }else{
-    ElMessage.warning(res.msg)
+  const valid = await evaluateRef.value.validate();
+  if(valid){
+    state.form.saveData = [...state.addData,...state.deductData]
+    state.form.delData = state.form.delData.filter((id) => !state.form.saveData.some((item) => item.id === id))
+    state.form.score = totalScore.value || 0
+    // state.form.taxableIncome = taxIncome.value || 0
+    // state.form.incomeTaxPayable = taxPay.value || 0
+    // state.form.afterTaxAmount = afterTaxIncome.value || 0
+    const res = await projectExpertDetailSave(state.form)
+    if(res.code == 200){
+      ElMessage.success(res.msg)
+      await handleClose()
+      emit('getList')
+    }else{
+      ElMessage.warning(res.msg)
+    }
   }
 }
 

--
Gitblit v1.9.2