| | |
| | | <GlobalWindow |
| | | :title="title" |
| | | width="100%" |
| | | :text="`${type === 1 ? '完成理算' : '完成核赔'}`" |
| | | :text="`${title === '修改金额' ? '提交' : type === 1 ? '完成理算' : '完成核赔'}`" |
| | | :visible.sync="visible" |
| | | :confirm-working="isWorking" |
| | | @confirm="confirm" |
| | | > |
| | | <div class="box"> |
| | | <el-form :model="form" ref="ruleForm" label-width="150px" class="demo-ruleForm"> |
| | | <el-form :model="form" ref="form" :rules="rules" label-width="150px" class="demo-ruleForm"> |
| | | <div class="box_item"> |
| | | <div class="box_item_desc">主要赔付项</div> |
| | | <div class="box_item_list"> |
| | |
| | | <div class="box_item_list_row" style="width: 50%;" v-for="(item, index) in list2" :key="index"> |
| | | <el-form-item :label="item.name"> |
| | | <div style="display: flex; flex-direction: column;"> |
| | | <el-input v-model="item.fee" @input="changeFee" type="number" placeholder="请输入金额"></el-input> |
| | | <el-input v-model="item.fee" @input="changeFee()" type="number" placeholder="请输入金额"></el-input> |
| | | <el-input v-model="item.describe" placeholder="请输入费用说明"></el-input> |
| | | </div> |
| | | </el-form-item> |
| | |
| | | <span>¥{{totalPrice}}</span> |
| | | </div> |
| | | </div> |
| | | <el-form-item label="修改说明" prop="describe" v-if="title === '修改金额'"> |
| | | <el-input v-model="form.describe" placeholder="请输入" type="textarea" row="5"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | </GlobalWindow> |
| | |
| | | <script> |
| | | import BaseOpera from '@/components/base/BaseOpera' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | import { compensation, getCompensation, nuclearCompensation } from '@/api/business/settleRisk' |
| | | import { compensation, getCompensation, nuclearCompensation, updFee } from '@/api/business/settleRisk' |
| | | export default { |
| | | name: 'acceptance', |
| | | extends: BaseOpera, |
| | |
| | | data () { |
| | | return { |
| | | form: { |
| | | id: null |
| | | id: null, |
| | | describe: '' |
| | | }, |
| | | rules: { |
| | | describe: [ |
| | | { required: true, message: '修改说明不能为空', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | type: '', |
| | | list1: [], |
| | |
| | | this.type = type |
| | | this.title = title |
| | | this.form.id = id |
| | | this.$nextTick(() => { |
| | | this.$refs.form.resetFields(); |
| | | }) |
| | | getCompensation({ type, id: this.form.id }) |
| | | .then(res => { |
| | | res.forEach(item => { |
| | |
| | | }, |
| | | changeFee() { |
| | | let arr = [...this.list1, ...this.list2] |
| | | |
| | | for (let i = 0; i < arr.length; i++) { |
| | | if (!/^\d+(\.\d{1,2})?$/.test(arr[i].fee)) { |
| | | arr[i].fee = 0 |
| | | this.$message.warning('只能输入正数,最多只能输入两位小数') |
| | | } |
| | | } |
| | | |
| | | let price = 0 |
| | | arr.forEach(item => { |
| | | if (item.fee) { |
| | | price += Number(item.fee) |
| | | } |
| | | }) |
| | | this.totalPrice = price |
| | | this.totalPrice = Math.round(price * 100) / 100; |
| | | }, |
| | | confirm() { |
| | | let arr = [...this.list1, ...this.list2] |
| | | for (let i = 0; i < arr.length; i++) { |
| | | if (!arr[i].fee && arr[i].fee !== 0) { |
| | | return this.$message.warning(`请先完善${arr[i].name}金额`) |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | let arr = [...this.list1, ...this.list2] |
| | | for (let i = 0; i < arr.length; i++) { |
| | | if (!arr[i].fee && arr[i].fee !== 0) { |
| | | return this.$message.warning(`请先完善${arr[i].name}金额`) |
| | | } |
| | | } |
| | | this.isWorking = true |
| | | let compensationJson = JSON.stringify(arr) |
| | | if (this.title === '修改金额') { |
| | | updFee({ id: this.form.id, compensationJson, describe: this.form.describe }) |
| | | .then(() => { |
| | | this.visible = false |
| | | this.$tip.apiSuccess('操作成功') |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | | }) |
| | | return |
| | | } |
| | | if (this.type === 1) { |
| | | compensation({ id: this.form.id, compensationJson }) |
| | | .then(() => { |
| | | this.visible = false |
| | | this.$tip.apiSuccess('操作成功') |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | | }) |
| | | } else if (this.type === 2) { |
| | | nuclearCompensation({ id: this.form.id, compensationJson }) |
| | | .then(() => { |
| | | this.visible = false |
| | | this.$tip.apiSuccess('操作成功') |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | this.isWorking = true |
| | | let compensationJson = JSON.stringify(arr) |
| | | if (this.type === 1) { |
| | | compensation({ id: this.form.id, compensationJson }) |
| | | .then(() => { |
| | | this.visible = false |
| | | this.$tip.apiSuccess('操作成功') |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | | }) |
| | | } else if (this.type === 2) { |
| | | nuclearCompensation({ id: this.form.id, compensationJson }) |
| | | .then(() => { |
| | | this.visible = false |
| | | this.$tip.apiSuccess('操作成功') |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | | }) |
| | | } |
| | | |
| | | }); |
| | | } |
| | | } |
| | | } |