Browse Source

云端结算页:逻辑bug汇总

zweizhao 7 years ago
parent
commit
89ccfc35a3
1 changed files with 37 additions and 14 deletions
  1. 37 14
      src/module/main/components/wage_settlement.vue

+ 37 - 14
src/module/main/components/wage_settlement.vue

@@ -6,10 +6,14 @@
       <a :href="'/rooter/cloudjobdetail/'+detail.job_id">{{detail.job.title_count}}</a>
       】{{detail.time.month}}工资账单
     </h4>
-    <section class="container"><span class="title">每月薪资:</span>¥{{salary.job_salary}}/月</section>
-    <section
-      class="container"
-    ><span class="title">工作周期:</span>{{detail.time.start_time | dateFormat}} 至 {{detail.time.end_time | dateFormat}} ({{detail.days}}天)</section>
+    <section class="container">
+      <span class="title">每月薪资:</span>
+      ¥{{salary.job_salary}}/月
+    </section>
+    <section class="container">
+      <span class="title">工作周期:</span>
+      {{detail.time.start_time | dateFormat}} 至 {{detail.time.end_time | dateFormat}} ({{detail.days}}天)
+    </section>
     <section class="container">
       <span class="title">托管金额:</span>
       ¥{{detail.company.company_pay}}
@@ -35,7 +39,9 @@
       <span class="title">本月工资:</span>
       <section>
         <div class="salary-result">¥{{baseSalary}}</div>
-        <div class="salary-calc">=({{salary.normal_salary}}+{{salary.probation_salary}})*{{detail.work_hour.work_rate}}%-{{salary.deduction_fee}}</div>
+        <div
+          class="salary-calc"
+        >=({{salary.normal_salary}}+{{salary.probation_salary}})*{{detail.work_hour.work_rate}}%-{{salary.deduction_fee}}</div>
       </section>
     </section>
     <section class="container">
@@ -46,7 +52,7 @@
     <section class="container">
       <span class="title">应缴税费:</span>
       <el-checkbox type="checkbox" v-model="payable"></el-checkbox>
-      ¥{{shouldRate}} (开发者税率{{rate.person_tax_rate+rate.person_tax_service_fee_rate}}%)
+      ¥{{shouldRate}} (开发者税率{{devRate}}%)
     </section>
     <section class="container salary-container">
       <span class="title">实际工资:</span>
@@ -77,7 +83,11 @@
     </section>
     <el-button v-show="detail.status == 2 || detail.status == 3" @click="jobPeriodSettle('save')">保存</el-button>
     <section v-if="detail.can_send_salary" class="container" style="margin-top: 20px;">
-      <el-button type="primary" v-show="detail.status == 3" @click="jobPeriodSettle('confirm')">确定支付工资</el-button>
+      <el-button
+        type="primary"
+        v-show="detail.status == 3"
+        @click="jobPeriodSettle('confirm')"
+      >确定支付工资</el-button>
     </section>
   </div>
 </template>
@@ -95,6 +105,13 @@ export default {
   },
   computed: {
     /**
+     * 开发者税率
+     */
+    devRate() {
+      let rate = this.rate
+      return Number(rate.person_tax_rate) + Number(rate.person_tax_service_fee_rate)
+    },
+    /**
      * 薪资
      */
     salary() {
@@ -106,7 +123,7 @@ export default {
     vipMinus() {
       let salary = this.salary
       let rate = this.rate
-      return this.keepDecimal(((salary.normal_salary * 1+salary.probation_salary * 1)*(this.detail.work_hour.work_rate/100)-salary.deduction_fee * 1)*((rate.origin_person_service_fee_rate - rate.person_service_fee_rate_reduce)/100))
+      return this.keepDecimal(((salary.normal_salary * 1 + salary.probation_salary * 1) * (this.detail.work_hour.work_rate / 100) - salary.deduction_fee * 1) * ((rate.origin_person_service_fee_rate - rate.person_service_fee_rate_reduce) / 100))
     },
     /**
      * 税率
@@ -119,25 +136,25 @@ export default {
      */
     shouldRate() {
       let rate = this.rate
-      return this.keepDecimal(this.baseSalary*(1-Number(rate.person_service_fee_rate)/100)*((Number(rate.person_tax_rate)+Number(rate.person_tax_service_fee_rate))/100))
+      return this.keepDecimal(Number(this.baseSalary) * (1 - Number(rate.person_service_fee_rate) / 100 + Number(rate.person_service_fee_rate_reduce) / 100) * this.devRate / 100)
     },
     /**
      * 本月工资
      */
     baseSalary() {
       let salary = this.salary
-      return this.keepDecimal(Number(salary.normal_salary) + Number(salary.probation_salary) * (this.detail.work_hour.work_rate / 100) - Number(salary.deduction_fee))
+      return this.keepDecimal((Number(salary.normal_salary) + Number(salary.probation_salary)) * .5 - Number(salary.deduction_fee))
     },
     /**
-     * 退金额
+     * 退金额
      */
     returnMoney() {
       if(this.is_use_deposit) return 0
 
       let salary = this.salary
       let isPay = Number(this.detail.company.company_pay) > 0 ? 1 : 0
-      let hasTax = this.payable ? (1 + this.detail.rate.company_tax_rate / 100) : 1
-      return this.keepDecimal(Number((salary.normal_salary) + Number(salary.probation_salary) - this.baseSalary) * (1 + this.detail.rate.company_service_fee_rate / 100) * hasTax) * isPay
+      let hasTax = this.payable ? (1 + Number(this.detail.rate.company_tax_rate) / 100) : 1
+      return this.keepDecimal((Number(salary.normal_salary) + Number(salary.probation_salary) - Number(this.baseSalary)) * (1 + Number(this.detail.rate.company_service_fee_rate) / 100) * hasTax) * isPay
     },
     /**
      * 实际工资
@@ -210,7 +227,13 @@ export default {
       })
       // console.log(res)
       if(!res) return
-      alert('操作成功')
+      this.$message({
+        message: '成功',
+        type: 'success'
+      })
+      setTimeout(() => {
+        location.reload()
+      }, 1000)
     },
     /**
      * 获取数据