马宇豪
2024-12-09 84748363b911c35b9b3a66159cfeeeefd13cc917
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,18 +147,51 @@
          <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.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-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="请具体说明依据的专家费计算标准"></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"><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-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="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-form-item label="税后金额">
              <el-input v-model="afterTaxIncome" type="number" readonly><template #append>元</template></el-input>
            </el-form-item>
          </el-col>
        </el-row>
@@ -246,7 +279,11 @@
    content: '',
    freightBasis: '',
    billingDuration: null,
    taxExpertFee: null,
    billingInstructions: '',
    afterTaxAmount: null,
    taxableIncome: null,
    incomeTaxPayable: null,
    openBank: '',
    bankCard: '',
  },
@@ -262,7 +299,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 +331,53 @@
})
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 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 afterTaxIncome = computed(()=>{
  const expertIncomeValue = state.form.taxExpertFee
  const taxPayValue = taxPay.value
  if ((expertIncomeValue == null || expertIncomeValue == 0)|| (taxPayValue == null || taxPayValue == 0)) {
    return 0
  }
  return expertIncomeValue - taxPayValue;
})
const openDialog = async (type, value, projectName, projectCheckTime) => {
@@ -362,7 +445,6 @@
}
const handleClose = () => {
  busRef.value.clearValidate();
  state.info = {
    name: '',
    idCard: '',
@@ -386,10 +468,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 +508,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)
    }
  }
}