| <template> | 
|     <GlobalWindow | 
|         :title="title" | 
|         width="100%" | 
|         :text="`${title === '修改金额' ? '提交' : type === 1 ? '完成理算' : '完成核赔'}`" | 
|         :visible.sync="visible" | 
|         :confirm-working="isWorking" | 
|         @confirm="confirm" | 
|     > | 
|         <div class="box"> | 
|             <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: 100%;" v-for="(item, index) in list1" :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.describe" placeholder="请输入费用说明"></el-input> | 
|                                 </div> | 
|                             </el-form-item> | 
|                         </div> | 
|                     </div> | 
|                     <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.describe" placeholder="请输入费用说明"></el-input> | 
|                                 </div> | 
|                             </el-form-item> | 
|                         </div> | 
|                     </div> | 
|                     <div class="price"> | 
|                         <span>赔付金额合计</span> | 
|                         <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> | 
| </template> | 
|   | 
| <script> | 
|     import BaseOpera from '@/components/base/BaseOpera' | 
|     import GlobalWindow from '@/components/common/GlobalWindow' | 
|     import { compensation, getCompensation, nuclearCompensation, updFee } from '@/api/business/settleRisk' | 
|     export default { | 
|         name: 'acceptance', | 
|         extends: BaseOpera, | 
|         components: { GlobalWindow }, | 
|         data () { | 
|             return { | 
|                 form: { | 
|                     id: null, | 
|                     describe: '' | 
|                 }, | 
|                 rules: { | 
|                     describe: [ | 
|                         { required: true, message: '修改说明不能为空', trigger: 'blur' } | 
|                     ] | 
|                 }, | 
|                 type: '', | 
|                 list1: [], | 
|                 list2: [], | 
|                 totalPrice: 0 | 
|             } | 
|         }, | 
|         methods: { | 
|             open (title, id, type) { | 
|                 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 => { | 
|                             if (!item.fee) { | 
|                                 item.fee = 0 | 
|                             } | 
|                         }) | 
|                         this.list1 = res.filter(item => item.type === 0) | 
|                         this.list2 = res.filter(item => item.type === 1) | 
|                         this.changeFee() | 
|                         this.visible = true | 
|                     }) | 
|             }, | 
|             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 = Math.round(price * 100) / 100; | 
|             }, | 
|             confirm() { | 
|                 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 | 
|                                 }) | 
|                         } | 
|                     } | 
|                 }); | 
|             } | 
|         } | 
|     } | 
| </script> | 
|   | 
| <style scoped lang="scss"> | 
|     .box { | 
|         width: 100%; | 
|         .box_item { | 
|             width: 100%; | 
|             margin-bottom: 30px; | 
|             .box_item_title { | 
|                 width: 100%; | 
|                 margin-bottom: 15px; | 
|                 span { | 
|                     color: rgba(16,16,16,1); | 
|                     font-size: 16px; | 
|                     margin-right: 10px; | 
|                 } | 
|             } | 
|             .box_item_desc { | 
|                 width: 100%; | 
|                 padding-left: 50px; | 
|                 box-sizing: border-box; | 
|                 color: rgba(16,16,16,1); | 
|                 font-size: 14px; | 
|                 margin-bottom: 15px; | 
|             } | 
|             .price { | 
|                 width: 100%; | 
|                 height: 62px; | 
|                 display: flex; | 
|                 align-items: center; | 
|                 justify-content: space-between; | 
|                 border-radius: 4px; | 
|                 background-color: rgba(239,239,239,1); | 
|                 margin-top: 50px; | 
|                 padding: 0 20px; | 
|                 box-sizing: border-box; | 
|                 span { | 
|                     &:nth-child(1) { | 
|                         color: rgba(16,16,16,1); | 
|                         font-size: 18px; | 
|                     } | 
|                     &:nth-child(2) { | 
|                         color: rgba(255,149,2,1); | 
|                         font-size: 22px; | 
|                     } | 
|                 } | 
|             } | 
|             .button { | 
|                 width: 100%; | 
|                 display: flex; | 
|                 align-items: center; | 
|                 justify-content: end; | 
|                 margin-top: 15px; | 
|                 .button_submit { | 
|                     width: 108px; | 
|                     height: 38px; | 
|                     line-height: 38px; | 
|                     text-align: center; | 
|                     border-radius: 4px; | 
|                     color: rgba(255,255,255,1); | 
|                     font-size: 14px; | 
|                     background-color: rgba(31,99,255,1); | 
|                 } | 
|             } | 
|             .box_item_list { | 
|                 width: 100%; | 
|                 display: flex; | 
|                 align-items: center; | 
|                 flex-wrap: wrap; | 
|                 justify-content: space-between; | 
|                 .box_item_list_rowx { | 
|                     width: 33.3%; | 
|                     height: 0; | 
|                 } | 
|                 .box_item_list_row { | 
|                     width: 33.3%; | 
|                     .box_item_list_row_l { | 
|                         width: 100%; | 
|                         display: flex; | 
|                         align-items: center; | 
|                         flex-wrap: wrap; | 
|                         .desc_data_list_item { | 
|                             width: 100px; | 
|                             height: 100px; | 
|                             padding: 10px; | 
|                             box-sizing: border-box; | 
|                             border: 1px solid #e2e2e2; | 
|                             display: flex; | 
|                             flex-direction: column; | 
|                             align-items: center; | 
|                             justify-content: center; | 
|                             position: relative; | 
|                             margin-bottom: 10px; | 
|                             margin-left: 10px; | 
|                             &:first-child { | 
|                                 margin-left: 0 !important; | 
|                             } | 
|                             .desc_data_list_item_dele { | 
|                                 position: absolute; | 
|                                 top: 5px; | 
|                                 right: 5px; | 
|                                 font-size: 14px; | 
|                                 cursor: pointer; | 
|                                 color: rgba(249, 86, 1, 0.996078431372549); | 
|                             } | 
|                             .desc_data_list_item_upload { | 
|                                 flex: 1; | 
|                                 height: 80px; | 
|                                 display: flex; | 
|                                 align-items: center; | 
|                                 justify-content: center; | 
|                             } | 
|                             .desc_data_list_item_img { | 
|                                 flex-shrink: 0; | 
|                                 width: 70px; | 
|                                 height: 70px; | 
|                                 display: flex; | 
|                                 align-items: center; | 
|                                 justify-content: center; | 
|                                 overflow: hidden; | 
|                                 margin-right: 10px; | 
|                                 .el-icon-folder-opened { | 
|                                     font-size: 34px; | 
|                                     color: #666666; | 
|                                 } | 
|                                 .el-icon-plus { | 
|                                     font-size: 26px; | 
|                                     color: #ffffff; | 
|                                 } | 
|                                 img { | 
|                                     width: 100%; | 
|                                 } | 
|                                 video { | 
|                                     width: 100%; | 
|                                 } | 
|                             } | 
|                             .desc_data_list_item_info { | 
|                                 width: 100%; | 
|                                 display: flex; | 
|                                 flex-direction: column; | 
|                                 justify-content: space-between; | 
|                                 word-break: break-all; | 
|                                 span { | 
|                                     width: 100%; | 
|                                     white-space: nowrap; | 
|                                     overflow: hidden; | 
|                                     text-overflow: ellipsis; | 
|                                     font-size: 14px; | 
|                                     color: black; | 
|                                 } | 
|                             } | 
|                         } | 
|                     } | 
|                     .box_item_list_row_title { | 
|                         width: 100%; | 
|                         display: flex; | 
|                         align-items: center; | 
|                         margin-bottom: 20px; | 
|                         .x { | 
|                             width: 1px; | 
|                             height: 14px; | 
|                             background-color: rgba(255,255,255,1); | 
|                             border: 4px solid rgba(22,93,255,1); | 
|                             margin-right: 10px; | 
|                         } | 
|                         span { | 
|                             color: rgba(16,16,16,1); | 
|                             font-size: 14px; | 
|                         } | 
|                     } | 
|                 } | 
|             } | 
|         } | 
|     } | 
| </style> |