| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form |
| | | class="opo-query-form" |
| | | :model="queryParams" |
| | | ref="queryForm" |
| | | :inline="true" |
| | |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['project:ethicalfund:edit']" |
| | | >修改</el-button |
| | | > |
| | | <el-button |
| | |
| | | size="mini" |
| | | type="text" |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['project:ethicalfund:delete']" |
| | | ><span class="button-delete" |
| | | ><i class="el-icon-delete"></i>删除</span |
| | | ></el-button |
| | |
| | | type="text" |
| | | icon="el-icon-download" |
| | | @click="mixExport(scope.row.id)" |
| | | v-hasPermi="['project:ethicalfund:download']" |
| | | >下载</el-button |
| | | > |
| | | </template> |
| | |
| | | clearable |
| | | style="width: 100%" |
| | | v-model="form.applyTime" |
| | | type="date" |
| | | type="date" format="yyyy-MM-dd" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | placeholder="申请日期" |
| | | > |
| | |
| | | import { getUserProfile } from "@/api/system/user"; |
| | | import { listFundflow } from "@/api/project/fundflow"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { moneySum, moneyAdd, moneySub, moneyMul, moneyRound } from "@/utils/money"; |
| | | |
| | | export default { |
| | | //import引入的组件需要注入到对象中才能使用 |
| | |
| | | // } catch { |
| | | // tempDetail.unitname = tempDetail.unitno; |
| | | // } |
| | | if (!isNaN(parseFloat(tempDetail.amount))) { |
| | | totalPreTaxAmount += parseFloat(tempDetail.amount); |
| | | totalAmount += parseFloat(tempDetail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(tempDetail.taxedamount))) { |
| | | totalAfterTaxAmount += parseFloat(tempDetail.taxedamount); |
| | | totalAmount += parseFloat(tempDetail.taxedamount); |
| | | } |
| | | } |
| | | //金额一律走精确运算,禁止 parseFloat 累加 |
| | | totalPreTaxAmount = moneySum(this.fundDetailArr, "amount"); |
| | | totalAfterTaxAmount = moneySum(this.fundDetailArr, "taxedamount"); |
| | | totalAmount = moneyAdd(totalPreTaxAmount, totalAfterTaxAmount); |
| | | try { |
| | | this.form.unitname = this.$refs.orgSelecter.getOptionByValue( |
| | | this.form.unitno |
| | |
| | | }); |
| | | }, |
| | | |
| | | //计算总金额 |
| | | //计算总金额(金额一律走精确运算,禁止 parseFloat 累加) |
| | | sumTotalFee() { |
| | | let allSum = 0; |
| | | const detailsArr = []; |
| | | let preTaxSum = 0; |
| | | let taxedSum = 0; |
| | | if (this.form.applytype != null) { |
| | | for (let i = 0; i < this.fundDetailArr.length; i++) { |
| | | const detail = this.fundDetailArr[i]; |
| | | let totalFee = 0; |
| | | let taxFee = 0; |
| | | if (this.form.applytype == 1 || this.form.applytype == 2) { |
| | | //计算当前报销内容费用合计 |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].amount))) { |
| | | totalFee += parseFloat(this.fundDetailArr[i].amount); |
| | | taxFee += parseFloat(this.fundDetailArr[i].amount); |
| | | preTaxSum += parseFloat(this.fundDetailArr[i].amount); |
| | | //计算当前报销内容费用合计:税前 - 扣税 |
| | | if (!isNaN(parseFloat(detail.amount))) { |
| | | totalFee = moneyAdd(totalFee, detail.amount); |
| | | preTaxSum = moneyAdd(preTaxSum, detail.amount); |
| | | } |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].taxamount))) { |
| | | totalFee -= parseFloat(this.fundDetailArr[i].taxamount); |
| | | taxFee -= parseFloat(this.fundDetailArr[i].taxamount); |
| | | if (!isNaN(parseFloat(detail.taxamount))) { |
| | | totalFee = moneySub(totalFee, detail.taxamount); |
| | | } |
| | | //taxedamount |
| | | if (!isNaN(parseFloat(this.fundDetailArr[i].taxedamount))) { |
| | | taxedSum += parseFloat(this.fundDetailArr[i].taxedamount); |
| | | if (!isNaN(parseFloat(detail.taxedamount))) { |
| | | taxedSum = moneyAdd(taxedSum, detail.taxedamount); |
| | | } |
| | | } else if (this.form.applytype == 3) { |
| | | if ( |
| | | !isNaN(parseFloat(this.fundDetailArr[i].price)) && |
| | | !isNaN(parseFloat(this.fundDetailArr[i].quantity)) |
| | | !isNaN(parseFloat(detail.price)) && |
| | | !isNaN(parseFloat(detail.quantity)) |
| | | ) { |
| | | totalFee += |
| | | parseFloat(this.fundDetailArr[i].price) * |
| | | parseFloat(this.fundDetailArr[i].quantity); |
| | | totalFee = moneyMul(detail.price, detail.quantity); |
| | | } |
| | | } |
| | | // if (!isNaN(parseFloat(taxFee))) { |
| | | // this.fundDetailArr[i].taxedamount = taxFee.toFixed(2); |
| | | // } |
| | | allSum += totalFee; |
| | | detailsArr.push(totalFee); |
| | | } |
| | | } |
| | | this.form.amountrequested = allSum.toFixed(2); |
| | | this.form.pretaxcost = preTaxSum.toFixed(2); |
| | | this.form.taxedcost = taxedSum.toFixed(2); |
| | | this.form.amountrequested = moneyRound(moneySum(detailsArr)).toFixed(2); |
| | | this.form.pretaxcost = moneyRound(preTaxSum).toFixed(2); |
| | | this.form.taxedcost = moneyRound(taxedSum).toFixed(2); |
| | | this.$forceUpdate(); |
| | | }, |
| | | |