splitFee.vue
2.9 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
<template>
<el-dialog :title="$t('splitFee.title')" :visible.sync="visible" width="50%">
<el-form :model="splitFeeInfo" label-width="120px" class="text-left">
<el-form-item :label="$t('splitFee.timePeriod')">
<div>{{ splitFeeInfo.endTime }} ~ {{ splitFeeInfo.deadlineTime }}</div>
</el-form-item>
<el-form-item :label="$t('splitFee.splitTime')" required>
<el-date-picker
v-model="splitFeeInfo.splitTime"
type="date"
:placeholder="$t('splitFee.splitTimePlaceholder')"
value-format="yyyy-MM-dd"
style="width:100%">
</el-date-picker>
<span style="color: red;">{{ $t('splitFee.note') }}</span>
</el-form-item>
<el-form-item :label="$t('splitFee.remark')" required>
<el-input
type="textarea"
v-model="splitFeeInfo.remark"
:placeholder="$t('splitFee.remarkPlaceholder')"
:rows="3"
style="width:100%">
</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="close">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" @click="_doSplitFee">{{ $t('common.submit') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { splitFee } from '@/api/fee/listCarFeeApi'
import {dateFormat} from '@/utils/dateUtil'
import {getCommunityId} from '@/api/community/communityApi'
export default {
name: 'SplitFee',
data() {
return {
visible: false,
splitFeeInfo: {
feeId: '',
splitTime: '',
remark: '',
endTime: '',
deadlineTime: ''
}
}
},
methods: {
open(fee) {
this.splitFeeInfo = {
feeId: fee.feeId,
endTime: dateFormat(fee.endTime),
deadlineTime: this._computeSplitDeadLineTime(fee),
splitTime: '',
remark: ''
}
this.visible = true
},
close() {
this.visible = false
},
_doSplitFee() {
if (!this.splitFeeInfo.splitTime) {
this.$message.error(this.$t('splitFee.splitTimeRequired'))
return
}
const data = {
preFeeId: this.splitFeeInfo.feeId,
splitTime: this.splitFeeInfo.splitTime,
communityId:getCommunityId(),
remark: this.splitFeeInfo.remark
}
splitFee(data).then(response => {
if (response.code === 0) {
this.$message.success(this.$t('common.operationSuccess'))
this.$emit('success')
this.close()
} else {
this.$message.error(response.msg)
}
}).catch(error => {
this.$message.error(error.message)
})
},
_computeSplitDeadLineTime(fee) {
if (fee.amountOwed == 0 && fee.endTime == fee.deadlineTime) {
return "-"
}
if (fee.state == '2009001') {
return "-"
}
return this.$formatDate(fee.deadlineTime)
}
}
}
</script>