repairInfo.vue
11.6 KB
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
<template>
<div>
<Card title="维修信息">
<glsx-combi-form ref="repairRef" :isInline="false" labelWidth="154px" defaultWidth="350px" :formObj="repairObj" :formData="repairForm">
<div slot="approveAmountSlot" class="amount-wrap">
<div v-for="(item, index) in serviceCodesList" :key="index">
<template v-if="item.checked">
<span class="title">{{ item.serviceItemName }}</span>
<div class="unit-price">
<div>
<el-radio-group disabled v-if="item.serviceItemCode == 'SC0003'" v-model="item.lossType">
<el-radio label="1">全损</el-radio>
<el-radio label="2">局部</el-radio>
</el-radio-group>
<el-checkbox-group disabled v-if="item.serviceItemCode == 'SC0006'" v-model="item.lossType">
<el-checkbox label="3">钥匙</el-checkbox>
<el-checkbox label="4">车牌重置</el-checkbox>
</el-checkbox-group>
</div>
<div class="show-price">
<label for="">
预估损失金额/元:
<span>{{ item.applyAmount }}</span>
</label>
<label v-if="item.lossAssessmentFlag" for="">
保险公司定损金额/元:
<span>{{ item.lossAssessmentAmount }}</span>
</label>
<label for="">
定损批准金额/元:
<span>{{ item.approveAmount }}</span>
</label>
</div>
</div>
</template>
</div>
<div class="lump-sum">
<span>合计</span>
<span>
<span>
预估损失金额
<span class="sign">¥ </span>
<span class="price">{{ applyAmountPrice.toFixed(2) }}</span>
元
</span>
<span>
定损批准金额
<span class="sign">¥ </span>
<span class="price">{{ approveAmountPrice.toFixed(2) }}</span>
元
</span>
</span>
</div>
</div>
<div slot="recipientSlot">
<el-radio-group :disabled="disabled" @change="changeObjectType" v-model="accountForm.objectType">
<el-radio :label="0">店面</el-radio>
<el-radio :label="1">其他</el-radio>
</el-radio-group>
<div class="account-info">
<glsx-combi-form ref="accountRef" :isInline="false" :formRules="accountRule" labelWidth="154px" defaultWidth="432px" :formObj="accountForm" :formData="accountData"></glsx-combi-form>
</div>
</div>
</glsx-combi-form>
</Card>
</div>
</template>
<script type="text/ecmascript-6">
import glsxCombiForm from '@/components/glsx-combi-form'
import Card from './card.vue'
const phoneReg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
const accountRule = {
accountType: [{ required: true, message: '请选择账户类型', trigger: 'change' }],
branchBankCode: [{ required: true, message: '请选择开户行名称', trigger: 'change' }],
accountName: [{ required: true, message: '请输入账户名称', trigger: 'change' }],
accountNo: [
{
required: true,
validator: (rule, value, callback) => {
let numRef = /^[0-9]{1,25}$/
if (!value) {
callback(new Error('请输入收款账号'))
} else if (numRef.test(value)) {
callback()
} else {
callback(new Error('请输入正确的收款账号'))
}
},
trigger: 'change'
}
],
accountCityCode: [{ required: true, message: '请选择收款账号所在省市', trigger: 'change' }],
cardTypeCode: [{ required: true, message: '请选择收款人证件类型', trigger: 'change' }],
cardNo: [{ required: true, message: '请输入收款人证件号码', trigger: 'change' }],
phone: [
{
required: true,
validator: (rule, value, callback) => {
if (!value) {
callback(new Error('请输入手机号'))
} else if (phoneReg.test(value)) {
callback()
} else {
callback(new Error('请输入正确的手机号'))
}
},
trigger: 'change'
}
],
}
export default {
name: 'repairInfo',
components: {
Card,
glsxCombiForm
},
props:{
serviceCodesList:{
type:Array
},
accountForm: Object,
disabled:{
type: Boolean,
default: false
}
},
watch: {
'accountForm.objectType': {
handler(newVal, oldVal) {
const item = this.accountData.find(item => {
return item.name == 'accountType'
})
item.isHide = newVal == 0
},
immediate: true
}
},
data() {
return {
pageType: 1,
accountRule,
accountData:[
{
label: '账户类型',
name: 'accountType',
type: 'radio',
optionList: [
{
confId:0,
confName:'对公'
},
{
confId:1,
confName:'对私'
}
],
optionId: 'confId',
optionLabel: 'confName',
isHide:true,
isClear: true,
isDisabled: this.disabled,
handleRadioChange:()=>{}
},
{
label: '开户行名称',
name: 'openBankCode',
type: 'select',
optionList: [],
optionId: 'code',
optionLabel: 'name',
isClear: true,
isDisabled: this.disabled,
},
{
label: '账户名称',
name: 'accountName',
type: 'input',
maxlength:60,
isClear: true,
isDisabled: this.disabled,
},
{
label: '收款账号',
name: 'accountNo',
type: 'input',
maxlength:25,
isClear: true,
isDisabled: this.disabled,
},
{
label: '收款账号所在省市',
name: 'accountCityCode',
type: 'select',
placeholder:'可输入所在市关键词查询',
optionList: [],
optionId: 'code',
optionLabel: 'name',
isClear: true,
isDisabled: this.disabled,
},
{
label: '收款人证件类型',
name: 'cardTypeCode',
type: 'select',
optionList: [],
optionId: 'code',
optionLabel: 'name',
isClear: true,
isDisabled: this.disabled,
changeAttr: (e, item)=>{
const target = item.optionList.find(item => item.code == e)
this.accountForm.cardTypeName = target.name
}
},
{
label: '收款人证件号码',
name: 'cardNo',
type: 'input',
maxlength: 25,
isClear: true,
isDisabled: this.disabled,
},
{
label: '收款人联系电话',
name: 'phone',
type: 'input',
maxlength: 11,
isClear: true,
isDisabled: this.disabled,
},
],
repairObj:{
amount:'',
recipient:''
},
repairForm:[
{
label: '批准金额',
name: 'amount',
addHtml:'approveAmountSlot'
},
{
label: '收款对象',
name: 'recipient',
addHtml:'recipientSlot'
}
]
}
},
computed: {
approveAmountPrice() {
let total = this.serviceCodesList.reduce(function(prev, cur) {
let curPrice = cur.approveAmount
return prev + +(curPrice * 100).toFixed(0)
}, 0)
return total / 100
},
applyAmountPrice() {
let total = this.serviceCodesList.reduce(function(prev, cur) {
let curPrice = cur.applyAmount
return prev + +(curPrice * 100).toFixed(0)
}, 0)
return total / 100
}
},
mounted() {
this.getBankList()
},
methods:{
changeObjectType(newVal){
this.$emit('getInfo',newVal)
},
validPrice(e, id, key){
let checkPlan = '' + this.serviceCodesList[id][key]
checkPlan = checkPlan.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace(/^\./g, '').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.');
if (checkPlan.indexOf('.') < 0 && checkPlan !== '') {
checkPlan = parseFloat(checkPlan) + ''
} else if (checkPlan.indexOf('.') >= 0) {
checkPlan = checkPlan.replace(/^()*(\d+)\.(\d\d).*$/, '$1$2.$3') // 只能输入两个小数
}
this.$set(this.serviceCodesList[id], key , checkPlan)
},
getBankList() {
this.$apis.beforeSale.getBankList({}).then(res => {
const branchBankList = this.accountData.find(item => item.name === 'openBankCode')
branchBankList.optionList = res.branchBank
const accountCityList = this.accountData.find(item => item.name === 'accountCityCode')
accountCityList.optionList = res.accountCity
const IDCardTypeList = this.accountData.find(item => item.name === 'cardTypeCode')
IDCardTypeList.optionList = res.cardType
})
},
changePrice(e,id,key){
if(!e.target.value) return;
const len = e.target.value.length
let lastStr = e.target.value.charAt(len-1)
if(lastStr==='.'){
this.$set(this.serviceCodesList[id], key , e.target.value.substr(0 ,len-1))
}
const minPrice = 1
if(Number(e.target.value)<minPrice){
this.$set(this.serviceCodesList[id], key , 1)
}
const maxPrice = 200000
if(Number(e.target.value)>maxPrice){
this.$set(this.serviceCodesList[id], key , maxPrice)
}
},
}
}
</script>
<style lang="scss" scoped>
.amount-wrap {
font-family: PingFangSC-Regular, PingFang SC;
display: inline-block;
color: #333333;
.title {
font-size: 14px;
line-height: 32px;
}
/deep/ .unit-price {
background: #f9f9f9;
padding: 20px;
width: 686px;
list-style: none;
margin-bottom: 10px;
.el-radio-group,
.el-checkbox-group {
margin-left: 90px;
.el-radio__input.is-disabled + span.el-radio__label,
.el-checkbox__input.is-disabled + span.el-checkbox__label {
color: #666;
}
}
.show-price {
display: flex;
box-sizing: border-box;
font-size: 14px;
label {
color: #666666;
flex: 1;
text-align: center;
}
span {
color: #333;
}
}
.el-input {
width: 432px;
margin-right: 60px;
}
}
.lump-sum {
background: #f9f9f9;
font-size: 14px;
font-weight: 400;
padding: 0 16px;
height: 36px;
display: flex;
justify-content: space-between;
align-items: center;
.sign {
font-size: 16px;
color: #ff6d00;
}
.price {
color: #ff6d00;
font-size: 18px;
}
}
}
.account-info {
background-color: #f9f9f9;
padding: 20px 80px 20px 20px;
width: fit-content;
/deep/ .el-form-item:last-child {
margin-bottom: 0;
}
/deep/ .el-form-item__label {
padding: 0;
}
/deep/ .el-select {
.el-input__inner {
vertical-align: bottom !important;
}
}
}
</style>