monitorDetails.vue
4.49 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
<template>
<div class="details">
<div class="top mb10">
<Card class="info">
<h4 class="mb10">客户信息</h4>
<div class="item">姓名:{{ custInfoCopy.custName }}</div>
<div class="item">性别:{{ sexCom }}</div>
<div class="item">证件类型:{{ custIdTypeCom }}</div>
<div class="item">证件号:{{ custInfoCopy.custIdNo }}</div>
<div class="item">微信昵称:{{ custInfoCopy.custWxName }}</div>
<div class="item">
状态:{{ transCustStatus(custInfoCopy.custStatus) }}
</div>
<!-- <div class="item">年收入:{{ custInfoCopy.custIncome }}</div>
<div class="item">地址:{{ custInfoCopy.custAddr }}</div> -->
<div class="item">备注:{{ custInfoCopy.custRemarks }}</div>
</Card>
<div class="video-wrapper">
<VideoPlayer :url="videoUrl"></VideoPlayer>
</div>
</div>
<Card class="mb10">
<el-form label-width="60px" ref="form" :model="form" :rules="rules">
<el-form-item label="备注" prop="remarks">
<el-input
type="textarea"
placeholder="请输入"
maxlength="200"
show-word-limit
:autosize="{ minRows: 4, maxRows: 6 }"
v-model.trim="form.remarks"
></el-input>
</el-form-item>
</el-form>
</Card>
<div class="bottom">
<el-button type="primary" @click="handleSubmit">提交</el-button>
</div>
</div>
</template>
<script>
import VideoPlayer from '@/components/videoPlayer'
import { getResourceDetail, saveResourceMonitorRemarks } from '@/api/monitor'
const custIdTypeMap = {
1: '身份证',
2: '护照',
3: '军官证',
4: '出生证',
5: '户口本',
6: '士兵证',
7: '港澳居民往来内地通行证',
8: '台湾居民来往大陆通行证',
11: '外国人永久居留身份证'
}
export default {
components: {
VideoPlayer
},
props: ['custInfo'],
data() {
return {
form: {
remarks: ''
},
rules: {
remarks: [
{ required: true, message: '请输入备注', trigger: 'blur' },
{
min: 1,
max: 200,
message: '长度在 1 到 200 个字符',
trigger: 'blur'
}
]
},
videoUrl: '',
custInfoCopy: this.custInfo
}
},
beforeMount() {
this.handleGetResourceDetail()
},
computed: {
sexCom() {
if (!this.custInfoCopy.custGender) {
return '无'
} else {
return this.custInfoCopy.custGender === 'F' ? '女' : '男'
}
},
custIdTypeCom() {
return custIdTypeMap[this.custInfoCopy.custIdType]
? custIdTypeMap[this.custInfoCopy.custIdType]
: '无'
}
},
methods: {
transCustStatus(status) {
if (status === '') {
return '无'
}
const numStatus = +status
const map = {
0: '终止跟进',
1: '继续跟进',
2: '重点跟进'
}
return map[numStatus]
},
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
this.handleSaveResourceMonitorRemarks()
}
return false
})
},
async handleGetResourceDetail() {
try {
const {
result: { monitorRemarks, url }
} = await getResourceDetail({
ossId: this.custInfoCopy.ossId,
recordId: this.custInfoCopy.recordId
})
this.form.remarks = monitorRemarks
this.videoUrl = url.replace('http', 'https')
} catch (error) {
console.log(error)
}
},
async handleSaveResourceMonitorRemarks() {
try {
const res = await saveResourceMonitorRemarks({
recordId: this.custInfoCopy.recordId,
remarks: this.form.remarks
})
if (res.code === 0) {
this.$message({
message: '更新成功',
type: 'success'
})
}
} catch (error) {
console.log(error)
}
}
}
}
</script>
<style lang="scss" scoped>
.details {
display: flex;
flex-flow: column nowrap;
.top {
display: flex;
flex-flow: row nowrap;
.info {
width: 330px;
height: 400px;
overflow: auto;
margin-right: 10px;
.item {
margin-bottom: 5px;
font-size: 14px;
}
}
.video-wrapper {
flex: 1 0 300px;
// width: 300px;
height: 400px;
}
}
.bottom {
display: flex;
justify-content: center;
}
}
</style>