zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<template>
  <div class="refund">
    <el-button
      type="primary"
      style="margin-bottom:24px"
      icon="el-icon-circle-plus-outline"
      @click="addRefundFee"
      size="medium"
      v-if="isrefund == 1"
    >新增退息费信息</el-button>
    <el-table
      stripe
      :data="refunds"
      :header-cell-style="{background:'#f5f5f5',color:'#222222'}"
      highlight-current-row
    >
      <el-table-column min-width="220">
        <template slot="header">
          <span>
            <span class="red-star">*</span>
            <span style="padding-left:8px">退息费日期</span>
          </span>
        </template>
        <template slot-scope="{row}">
          <span style="padding-left:15px" v-show="!row.isEdit">{{row.refunddate}}</span>
          <div style="padding-left:15px">
            <el-date-picker
              v-model="row.refunddate"
              type="date"
              v-show="row.isEdit"
              format="yyyy/MM/dd"
              value-format="yyyy/MM/dd"
              size="small"
              placeholder="选择日期">
            </el-date-picker>
          </div>
        </template>
      </el-table-column>
      <el-table-column min-width="220">
        <template slot="header">
          <span>
            <span class="red-star">*</span>
            <span style="padding-left:8px">退利息金额</span>
          </span>
        </template>
        <template slot-scope="{row}">
          <span style="padding-left:15px" v-show="!row.isEdit">{{formatMoney(row.refundpayinterestamt)}}</span>
          <el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.refundpayinterestamt" placeholder="请输入" @blur="row.refundpayinterestamt=formatMoney(row.refundpayinterestamt)"></el-input>
        </template>
      </el-table-column>
      <el-table-column min-width="220">
        <template slot="header">
          <span>
            <span class="red-star">*</span>
            <span style="padding-left:8px">退手续费金额</span>
          </span>
        </template>
        <template slot-scope="{row}">
          <span style="padding-left:15px" v-show="!row.isEdit">{{formatMoney(row.refundcharge)}}</span>
          <el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.refundcharge" placeholder="请输入" @blur="row.refundcharge=formatMoney(row.refundcharge)"></el-input>
        </template>
      </el-table-column>
      <el-table-column min-width="220">
        <template slot="header">
          <span>
            <span class="red-star">*</span>
            <span style="padding-left:8px">退担保费</span>
          </span>
        </template>
        <template slot-scope="{row}">
          <span style="padding-left:15px" v-show="!row.isEdit">{{formatMoney(row.refundguarantee)}}</span>
          <el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.refundguarantee" placeholder="请输入" @blur="row.refundguarantee=formatMoney(row.refundguarantee)"></el-input>
        </template>
      </el-table-column>
      <el-table-column min-width="220">
        <template slot="header">
          <span>
            <span class="red-star">*</span>
            <span style="padding-left:8px">退平台服务费</span>
          </span>
        </template>
        <template slot-scope="{row}">
          <span style="padding-left:15px" v-show="!row.isEdit">{{formatMoney(row.refundservicefee)}}</span>
          <el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.refundservicefee" placeholder="请输入" @blur="row.refundservicefee=formatMoney(row.refundservicefee)"></el-input>
        </template>
      </el-table-column>
      <el-table-column min-width="220">
        <template slot="header">
          <span>
            <span class="red-star">*</span>
            <span style="padding-left:8px">退息费银行流水</span>
          </span>
        </template>
        <template slot-scope="{row}">
          <span style="padding-left:15px" v-show="!row.isEdit">{{row.refundtxno}}</span>
          <el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.refundtxno" placeholder="请输入"></el-input>
        </template>
      </el-table-column>
      <el-table-column min-width="220" label="备注" show-overflow-tooltip>
        <template slot-scope="{row}">
          <span style="padding-left:15px" v-show="!row.isEdit">{{row.remark}}</span>
          <el-input style="padding-left:15px" size="small" v-show="row.isEdit" v-model="row.remark" placeholder="请输入"></el-input>
        </template>
      </el-table-column>
      <el-table-column label="操作管理" width="110">
        <template slot-scope="scope">
          <el-button type="text" @click.native="handleSave(scope.row)" v-show="scope.row.isEdit">保存</el-button>
          <el-button type="text" @click.native="handlecancel(scope.$index)" v-show="scope.row.isEdit">取消</el-button>
          <el-button type="text" @click="handleDelete(scope.row,scope.$index)" v-show="!scope.row.isEdit && isrefund == 1">删除</el-button>
          <el-button type="text" v-show="isrefund != 1">--</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import {
  saveRefundFeeMulti,
  delRefundInfo
} from '@api/product'
import common from '@/utils/common'
export default {
  props: ['refunds','isrefund'],
  data () {
    return {
      applyInfo:this.$store.state.product.applyInfo,
    }
  },
  methods: {
    // 金额格式化
    formatMoney(value) {
      if (value) {
        value =
          parseFloat((value + "").replace(/[^\d\.-]/g, "")).toFixed(2) + "";
        if (value == "NaN") return;
        let l = value
          .split(".")[0]
          .split("")
          .reverse();
        let r = value.split(".")[1];
        let t = "";
        for (let i = 0; i < l.length; i++) {
          t += l[i] + ((i + 1) % 3 === 0 && i + 1 !== l.length ? "," : "");
        }
        return (
          t
            .split("")
            .reverse()
            .join("") +
          "." +
          r
        );
      }
    },
    // 新增退息费信息
    addRefundFee(){
      for (let i = 0; i < this.refunds.length; i++) {
        if(this.refunds[i].isEdit){
            this.$message.warning('请先保存当前退息费信息再新增')
            return;
        }
      };
      this.refunds.unshift({
        refunddate:'',
        refundpayinterestamt:'',
        refundcharge:'',
        refundguarantee:'',
        refundservicefee:'',
        refundtxno:'',
        remark:'',
        isEdit:true
      })
    },
    // 保存退息费信息
    handleSave(row){
      if(!row.refunddate){
        this.$message.warning('退息费日期不能为空')
        return;
      }
      if(!row.refundpayinterestamt){
        this.$message.warning('退利息金额不能为空')
        return;
      }
      if(!row.refundcharge){
        this.$message.warning('退手续费金额不能为空')
        return;
      }
      if(!row.refundguarantee){
        this.$message.warning('退担保费不能为空')
        return;
      }
      if(!row.refundservicefee){
        this.$message.warning('退平台服务费不能为空')
        return;
      }
      if(!row.refundtxno){
        this.$message.warning('退息费银行流水不能为空')
        return;
      }
      row.objectno = this.applyInfo.serialNo;
      saveRefundFeeMulti({refundRegistrationInfos:this.refunds}).then(res=>{
        if(res.code == '00'){
          this.$message.success('保存成功')
          this.$emit('sendReFund',true)
          this.$set(row,'isEdit',false)
        }
      })
    },
    // 删除
    handleDelete(row,index){
      // 这里删除成功后数据需要splice
      if(!row.isEdit){
        common.comfirm('提示',`请确认是否需要删除:${row.propertyowner}?`,async ()=>{
          if(row.serialno){
            const res = await delRefundInfo({serialno:row.serialno})
            if(res.code != '00')return;
          }
          this.$message.success('删除成功')
          this.refunds.splice(index,1)
        })
      }else{
        this.refunds.splice(index,1)
      }
    },
    // 取消
    handlecancel(index){
      this.refunds.splice(index,1)
    }
  }
}
</script>
<style lang="stylus">
.refund  
  width 100%
  margin-bottom 24px
  .el-date-editor
    width 100%
  .red-star
    width 7px
    display inline-block
    vertical-align: middle;
    color: #FF4300;
</style>