| | |
| | | this.$refs["form"].validate((valid) => { |
| | | if (valid) { |
| | | this.formData = this.form; |
| | | let totalPreTaxAmount = 0.0; |
| | | let totalAfterTaxAmount = 0.0; |
| | | let totalAmount = 0.0; |
| | | |
| | | console.log('1'); |
| | | // let totalPreTaxAmount = 0.0; |
| | | // let totalAfterTaxAmount = 0.0; |
| | | // let totalAmount = 0.0; |
| | | |
| | | //保存前校验数据 |
| | | for (let k = 0; k < this.fundDetails.length; k++) { |
| | |
| | | // tempDetail.unitname = tempDetail.unitno; |
| | | // } |
| | | |
| | | |
| | | } |
| | | |
| | | //附件处理 |
| | | let list = this.fileList; |
| | | if (list.length > 0) { |
| | | this.form.annexfiles = list.map(item => item.url).join(","); |
| | | } |
| | | |
| | | //处理明细 |
| | | for (let i = 0; i < this.fundDetails.length; i++) { |
| | | let tempDetail = this.fundDetails[i]; |
| | | //获取服务项目明细 |
| | | let tempItemArr = tempDetail.itemArr; |
| | | let itemIndex = tempItemArr.findIndex( |
| | |
| | | (item) => tempDetail.applytype == item.value |
| | | ); |
| | | if (applytypeIndex > -1) { |
| | | console.log("tempDetail", tempDetail); |
| | | tempDetail.applytypename = this.rowfeeItemTypes[applytypeIndex].label; |
| | | tempDetail.subjecttype = this.rowfeeItemTypes[applytypeIndex].subjecttype; |
| | | tempDetail.subjecttypename = this.rowfeeItemTypes[applytypeIndex].subjecttypename; |
| | | } |
| | | this.fundDetails[k] = tempDetail; |
| | | |
| | | /* |
| | | //计算个税 |
| | | //if (isNaN(parseFloat(tempDetail.taxedamount))) |
| | | //获取参数 |
| | |
| | | |
| | | this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount); |
| | | this.totalAmount += parseFloat(tempDetail.amount); |
| | | console.log('第二步'); |
| | | this.brforaFn() |
| | | } |
| | | }); |
| | | } |
| | |
| | | this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount); |
| | | this.totalAmount += parseFloat(tempDetail.amount); |
| | | console.log("1", this.amount); |
| | | console.log('第二步'); |
| | | this.brforaFn() |
| | | } |
| | | }); |
| | | } |
| | | */ |
| | | } |
| | | } |
| | | console.log('2'); |
| | | }); |
| | | }, |
| | | //费用合计 |
| | | // this.form.pretaxcost = parseFloat(this.totalPreTaxAmount).toFixed(2); |
| | | // this.form.taxedcost = parseFloat(this.totalAfterTaxAmount).toFixed(2); |
| | | // this.form.amountrequested = this.totalAmount.toFixed(2); |
| | | |
| | | // 第二步 |
| | | brforaFn() { |
| | | console.log('3'); |
| | | this.loading = true; |
| | | //保存数据 |
| | | this.loading = true; |
| | | this.form.serviceFunddetails = 0; |
| | | this.fundDetails.map((item) => { |
| | | this.form.serviceFunddetails += item.amount; |
| | | }); |
| | | this.form.serviceFunddetails = this.fundDetails; |
| | | |
| | | //捐献者 |
| | | this.form.donorname = this.curCase.name; |
| | | if (this.form.id != null) { |
| | | //捐献者 |
| | | this.form.donorname = this.curCase.name; |
| | | } |
| | | else { |
| | | this.form.recordstatus = -1; |
| | | } |
| | | |
| | | //附件处理 |
| | | let list = this.fileList; |
| | | if (list.length > 0) { |
| | | this.form.annexfiles = list.map(item => item.url).join(","); |
| | | } |
| | | //费用合计 |
| | | this.form.pretaxcost = parseFloat(this.totalPreTaxAmount).toFixed(2); |
| | | this.form.taxedcost = parseFloat(this.totalAfterTaxAmount).toFixed(2); |
| | | this.form.amountrequested = this.totalAmount.toFixed(2); |
| | | |
| | | //保存 |
| | | if (this.form.id != null) { |
| | | this.form.recordstatus = -1; |
| | | updateFund(this.form).then((res) => { |
| | | this.getfundList(); |
| | | this.dialogOpen = false; |
| | | this.getList(); |
| | | this.selectDonotor(this.curCase); |
| | | |
| | | for (let m = 0; m < this.fundDetails.length; m++) { |
| | | let tempData = this.fundDetails[m]; |
| | | if (tempData.id > 0) { |
| | | updateFunddetail(tempData).then((res) => { }); |
| | | batchUploadFund(this.form).then((response) => { |
| | | if (response.code === 200) { |
| | | this.$modal.msgSuccess("专家劳务费保存成功!"); |
| | | this.selectDonotor(this.curCase); |
| | | } else { |
| | | tempData.fundid = this.formData.id; |
| | | addFunddetail(tempData).then((res) => { }); |
| | | this.$modal.msgError("专家劳务费保存失败:" + response.msg); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | this.$modal.msgSuccess("修改成功"); |
| | | //关闭窗口 |
| | | this.loading = false; |
| | | }); |
| | | } else { |
| | | this.form.serviceFunddetails = 0; |
| | | this.fundDetails.map((item) => { |
| | | this.form.serviceFunddetails += item.amount; |
| | | }); |
| | | this.form.serviceFunddetails = this.fundDetails; |
| | | this.form.recordstatus = -1; |
| | | |
| | | batchUploadFund(this.form).then((response) => { |
| | | if (response.code === 200) { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.loading = false; |
| | | this.selectDonotor(this.curCase); |
| | | } else { |
| | | this.$modal.msgError("新增失败:" + response.msg); |
| | | this.loading = false; |
| | | } |
| | | }); |
| | | |
| | | //关闭窗口 |
| | | this.dialogOpen = false; |
| | | } |
| | | this.dialogOpen = false; |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | //获取专家列表 |