wage_settlement.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <div v-if="detail" id="wage-settlement">
  3. <h3>工资结算</h3>
  4. <h4>
  5. <a :href="orderHref">{{detail.job.title_count}}</a>
  6. 】{{detail.time.month}}工资账单
  7. <span class="ui horizontal label">{{item.statusName}}</span>
  8. <span class="ui horizontal label" v-if="item.is_use_deposit=='1'">{{使用押金结算}}</span>
  9. </h4>
  10. <section class="container">
  11. <span class="title">每月薪资:</span>
  12. ¥{{salary.job_salary}}/月
  13. </section>
  14. <section class="container">
  15. <span class="title">工作周期:</span>
  16. {{detail.time.start_time | dateFormat}} 至 {{detail.time.end_time | dateFormat}} ({{detail.days}}天)
  17. </section>
  18. <section class="container">
  19. <span class="title">托管金额:</span>
  20. ¥{{detail.company.company_pay}}
  21. </section>
  22. <section v-if="detail.normal_days > 0" class="container">
  23. <span class="title">正式工资:</span>
  24. ¥{{salary.normal_salary}}({{detail.normal_days}}天)
  25. </section>
  26. <section v-if="detail.probation_days > 0" class="container">
  27. <span class="title">试用工资:</span>
  28. ¥{{salary.probation_salary}}({{detail.probation_days}}天,按月工资{{rate.probation_rate}}%结算)
  29. </section>
  30. <section class="container">
  31. <span class="title">结算比例:</span>
  32. <el-input type="number" v-model="detail.work_hour.work_rate"></el-input>
  33. % (工作工时:{{detail.work_hour.worked_hours}}/{{detail.work_hour.should_work_hours}})
  34. </section>
  35. <section class="container">
  36. <span class="title">扣减工资:</span>
  37. <el-input type="number" v-model="salary.deduction_fee"></el-input>元
  38. </section>
  39. <section class="container salary-container">
  40. <span class="title">本月工资:</span>
  41. <section>
  42. <div class="salary-result">¥{{baseSalary}}</div>
  43. <div
  44. class="salary-calc"
  45. >=({{salary.normal_salary}}+{{salary.probation_salary}})*{{detail.work_hour.work_rate}}%-{{salary.deduction_fee}}</div>
  46. </section>
  47. </section>
  48. <section class="container">
  49. <span class="title">平台服务费:</span>
  50. <el-input type="number" v-model="rate.origin_person_service_fee_rate"></el-input>
  51. VIP会员减免{{rate.person_service_fee_rate_reduce}}% ¥{{vipMinus}} (开发者服务费率{{devServiceRate}}%)
  52. </section>
  53. <section class="container">
  54. <span class="title">应缴税费:</span>
  55. <el-checkbox type="checkbox" v-model="payable"></el-checkbox>
  56. ¥{{shouldRate}} (开发者税率{{devRate}}%)
  57. </section>
  58. <section class="container salary-container">
  59. <span class="title">实际工资:</span>
  60. <section>
  61. <div class="salary-result">¥{{personPrice}}</div>
  62. <div class="salary-calc">
  63. <span>=(({{salary.normal_salary}}+{{salary.probation_salary}})*{{detail.work_hour.work_rate}}%-{{salary.deduction_fee * 1}})*(1-{{rate.person_service_fee_rate}}%)</span>
  64. <span v-if="payable">*(1-{{rate.person_tax_rate}}%-{{rate.person_tax_service_fee_rate}}%)</span>
  65. </div>
  66. </section>
  67. </section>
  68. <!-- 本月结束合作,下月未托管费用 -->
  69. <section v-if="detail.can_use_deposit" class="container">
  70. <el-checkbox v-model="is_use_deposit" style="margin: 0 4px 0 0;" disabled checked></el-checkbox>
  71. 使用押金结算(¥{{detail.company.company_left_deposit}})(企业方费用:¥{{companyPrice}})
  72. </section>
  73. <section class="container">
  74. <span class="title">退还金额:</span>
  75. <el-input type="text" :value="returnMoney" disabled></el-input>
  76. =(({{salary.normal_salary}}+{{salary.probation_salary}})-{{baseSalary}})*(1+{{rate.company_service_fee_rate}}%)
  77. <span
  78. v-if="payable"
  79. >*(1+{{detail.is_invoice ? rate.company_tax_rate : 0}}%)</span>元
  80. </section>
  81. <section class="container">
  82. <span class="title">备注说明:</span>
  83. <el-input v-model="detail.remark"></el-input>
  84. </section>
  85. <el-button v-show="detail.status == 2 || detail.status == 3" @click="jobPeriodSettle('save')">保存</el-button>
  86. <section v-if="detail.can_send_salary" class="container" style="margin-top: 20px;">
  87. <el-button
  88. type="primary"
  89. v-show="detail.status == 3"
  90. @click="jobPeriodSettle('confirm')"
  91. >确定支付工资</el-button>
  92. </section>
  93. </div>
  94. </template>
  95. <script>
  96. // 现在环境是线上还是测试, 默认线上
  97. let env = ''
  98. export default {
  99. data() {
  100. return {
  101. job_id: '',
  102. period_id: '',
  103. payable: false,
  104. is_use_deposit: false,
  105. detail: null,
  106. }
  107. },
  108. computed: {
  109. /**
  110. * 详情链接地址
  111. */
  112. orderHref() {
  113. let detail = this.detail
  114. , hrefFix = `/rooter/cloudjobitem/${detail.job_id}`
  115. if(env === 'test') hrefFix = `https://dev.test.proginn.com${hrefFix}`
  116. else hrefFix = `https://www.proginn.com${hrefFix}`
  117. return hrefFix
  118. },
  119. /**
  120. * 开发者服务费率
  121. */
  122. devServiceRate() {
  123. let rate = this.rate
  124. let result = Number(rate.origin_person_service_fee_rate) - Number(rate.person_service_fee_rate_reduce)
  125. return result < 0 ? 0 : result
  126. },
  127. /**
  128. * 开发者税率
  129. */
  130. devRate() {
  131. let rate = this.rate
  132. return Number(rate.person_tax_rate) + Number(rate.person_tax_service_fee_rate)
  133. },
  134. /**
  135. * 薪资
  136. */
  137. salary() {
  138. return this.detail.salary
  139. },
  140. /**
  141. * 会员减免
  142. */
  143. vipMinus() {
  144. let salary = this.salary
  145. let rate = this.rate
  146. 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))
  147. },
  148. /**
  149. * 税率
  150. */
  151. rate() {
  152. return this.detail.rate
  153. },
  154. /**
  155. * 应缴税费
  156. */
  157. shouldRate() {
  158. let rate = this.rate
  159. return this.keepDecimal(Number(this.baseSalary) * (1 - Number(rate.origin_person_service_fee_rate) / 100 + Number(rate.person_service_fee_rate_reduce) / 100) * this.devRate / 100)
  160. },
  161. /**
  162. * 本月工资
  163. */
  164. baseSalary() {
  165. let salary = this.salary
  166. return this.keepDecimal((Number(salary.normal_salary) + Number(salary.probation_salary)) * Number(this.detail.work_hour.work_rate) / 100 - Number(salary.deduction_fee))
  167. },
  168. /**
  169. * 退还金额
  170. */
  171. returnMoney() {
  172. if(this.is_use_deposit) return 0
  173. let salary = this.salary
  174. let isPay = Number(this.detail.company.company_pay) > 0 ? 1 : 0
  175. let hasTax = this.payable ? (1 + Number(this.detail.rate.company_tax_rate) / 100) : 1
  176. 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
  177. },
  178. /**
  179. * 实际工资
  180. */
  181. personPrice() {
  182. let salary = this.salary
  183. let rate = this.detail.rate
  184. let work_hour = this.detail.work_hour
  185. let isPayable = this.payable ? (1 - rate.person_tax_rate / 100 - rate.person_tax_service_fee_rate / 100) : 1
  186. let personPrice = (((salary.normal_salary - 0) + (salary.probation_salary - 0)) * work_hour.work_rate / 100 - Number(salary.deduction_fee)) * (1 - rate.person_service_fee_rate / 100) * isPayable
  187. return this.keepDecimal(personPrice)
  188. },
  189. /**
  190. * 企业方费用
  191. */
  192. companyPrice() {
  193. let salary = this.salary
  194. let rate = this.detail.rate
  195. let work_hour = this.detail.work_hour
  196. let isPayable = this.payable ? (1 + rate.company_tax_rate / 100) : 1
  197. let companyPrice = (((salary.normal_salary - 0) + (salary.probation_salary - 0)) * work_hour.work_rate / 100 - Number(salary.deduction_fee)) * (1 + rate.company_service_fee_rate / 100) * isPayable
  198. return this.keepDecimal(companyPrice)
  199. },
  200. },
  201. filters: {
  202. /**
  203. * 格式化日期
  204. */
  205. dateFormat(val) {
  206. return new Date(Number(val) * 1000).toLocaleDateString()
  207. }
  208. },
  209. mounted() {
  210. this.job_id = this.$route.query.job_id
  211. this.period_id = this.$route.query.period_id
  212. this.getData()
  213. },
  214. methods: {
  215. /**
  216. * 有效数字控制
  217. */
  218. keepDecimal(num) {
  219. return num.toFixed(2)
  220. },
  221. /**
  222. * 点击保存或支付
  223. */
  224. async jobPeriodSettle(action) {
  225. let res = await this.$post('/api/admin/job/job_period_settle', {
  226. // 云端工作周期id(int)
  227. period_id: this.period_id,
  228. // 云端工作id(int)
  229. job_id: this.job_id,
  230. // 操作名称 save-保存结算信息 confirm-确认支付工资
  231. action,
  232. // 结算比例(百分比)
  233. work_rate: this.detail.work_hour.work_rate,
  234. // 扣减工资(数值,两位小数)
  235. deduction_fee: this.salary.deduction_fee,
  236. // 是否要发票(0-不需要 1-需要)
  237. is_invoice: this.payable ? 1 : 0,
  238. // 退还金额(数值,两位小数)
  239. return_money: this.returnMoney,
  240. // 结算工资时的备注(可选)
  241. remark: this.detail.remark,
  242. // 结算时是否使用押金
  243. is_use_deposit: this.is_use_deposit ? 1 : 0,
  244. person_service_fee_rate: this.detail.rate.origin_person_service_fee_rate,
  245. })
  246. // console.log(res)
  247. if(!res) return
  248. this.$message({
  249. message: '成功',
  250. type: 'success'
  251. })
  252. setTimeout(() => {
  253. location.reload()
  254. }, 1000)
  255. },
  256. /**
  257. * 获取数据
  258. */
  259. async getData(i) {
  260. let res = await this.$post('/api/admin/job/get_job_period_detail', {
  261. job_id: this.job_id,
  262. period_id: this.period_id,
  263. is_cal_workrate: 1
  264. })
  265. if(!res.data) return
  266. let data = res.data
  267. env = data.current_env
  268. this.detail = data
  269. this.payable = data.is_invoice === '1'
  270. this.is_use_deposit = data.can_use_deposit === '1'
  271. },
  272. }
  273. }
  274. </script>
  275. <style scoped>
  276. #wage-settlement {
  277. padding: 20px;
  278. }
  279. .container {
  280. display: flex;
  281. align-items: center;
  282. height: 44px;
  283. }
  284. .salary-container {
  285. height: 80px;
  286. background: #f0f0f0;
  287. }
  288. .salary-result {
  289. font-size: 28px;
  290. font-weight: 800;
  291. }
  292. .salary-calc {
  293. color: #666;
  294. margin-left: 40px;
  295. }
  296. .title {
  297. width: 92px;
  298. }
  299. .el-input {
  300. width: 180px;
  301. }
  302. </style>