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 |   90 ++++++++++++++++++++++++++++----------------
 1 files changed, 57 insertions(+), 33 deletions(-)

diff --git a/src/views/safetyReview/expertManage/postEvaluation/components/evaluate.vue b/src/views/safetyReview/expertManage/postEvaluation/components/evaluate.vue
index 87f3e95..d724c9e 100644
--- a/src/views/safetyReview/expertManage/postEvaluation/components/evaluate.vue
+++ b/src/views/safetyReview/expertManage/postEvaluation/components/evaluate.vue
@@ -150,14 +150,7 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="计费标准" prop="freightBasis">
-              <el-input v-model.trim="state.form.freightBasis" :readonly="state.disable"><template #append>天/课时</template></el-input>
-<!--              <el-select v-model="state.form.freightBasis" placeholder="计费标准" clearable>-->
-<!--                <el-option :key="0" label="前三天600/天" :value="600"/>-->
-<!--                <el-option :key="1" label="前三天800/天" :value="800"/>-->
-<!--                <el-option :key="1" label="前三天1000/天" :value="1000"/>-->
-<!--                <el-option :key="2" label="前三天1200/天" :value="1200"/>-->
-<!--                <el-option :key="2" label="前三天1500/天" :value="1500"/>-->
-<!--              </el-select>-->
+              <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">
@@ -169,32 +162,34 @@
         <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"><template #append>天/课时</template></el-input>
+              <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"><template #append>元</template></el-input>
+              <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-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="8">
-            <el-form-item label="应缴个税">
-              <el-input v-model.trim="taxPay" type="number" readonly><template #append>元</template></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
+          <el-col :span="12">
             <el-form-item label="税后金额">
-              <el-input v-model="afterTaxIncome" type="number" readonly><template #append>元</template></el-input>
+              <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">
@@ -334,6 +329,8 @@
   return 100 + Number(addTotal.value) + Number(deductTotal.value)
 })
 
+
+// 这里一堆无作用的代码存在的原因是需求一直来回改,简洁的代码也改成屎了
 const expertIncome = computed(()=>{
   if(state.form.freightBasis == null || state.form.billingDuration == null){
     return null
@@ -344,6 +341,23 @@
     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
@@ -358,26 +372,36 @@
 })
 
 const taxPay = computed(()=>{
-  const taxIncomeValue = taxIncome.value
-  if (taxIncomeValue == null || taxIncomeValue === 0) {
+  // 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 (taxIncomeValue <= 20000) {
-    return taxIncomeValue * 0.2;
-  } else if (taxIncomeValue <= 50000) {
-    return taxIncomeValue * 0.3 - 2000;
-  } else {
-    return taxIncomeValue * 0.4 - 7000;
+  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)|| (taxPayValue == null || taxPayValue == 0)) {
+  if (expertIncomeValue == null || expertIncomeValue == 0) {
     return 0
   }
-  return expertIncomeValue - taxPayValue;
+  return (expertIncomeValue - taxPayValue).toFixed(2)
 })
 
 const openDialog = async (type, value, projectName, projectCheckTime) => {
@@ -513,9 +537,9 @@
     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
+    // 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)

--
Gitblit v1.9.2