index.vue
4.13 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
<template>
<div class="layoutIndex">
<tab class="tabber-wrap" :list="list" :index="tabIndex" @change="changeTab" v-if="initShow"></tab>
<template v-if="flag">
<scroll-view class="content" @ReachBottom="onReachBottom" ref="scrollView">
<template v-if="clewList.length > 0">
<template v-for="item in clewList">
<div class="content-item" :key="item.id" @click="gotoDetail(item)">
<div class="content-item-des text-space">
<div class="content-item-name weight-6 text-16 color-3 line-22 text-hide">{{ item.name }}</div>
<div class="content-item-phone text-12 color-9 line-17">{{ item.phone }}</div>
</div>
<div class="content-item-info">
<span class="text-12 color-9 weight-4 line-17">
线索类型
<label>{{ item.type == 1 ? '客户意见' : item.type == 2 ? '卖车询价' : item.type == 3 ? '救援服务' : item.type == 4 ? '新车询价' : item.type == 5 ? '试驾预约' : '维保预约' }}</label>
</span>
<span class="text-12 color-9 weight-4 line-17">
创建时间
<label>{{ item.createdDate }}</label>
</span>
</div>
</div>
</template>
</template>
<template v-else>
<empty description="暂无数据" />
</template>
</scroll-view>
</template>
</div>
</template>
<script type="text/ecmascript-6">
import { Notify } from 'vant'
import { clewApi } from '@/api'
export default {
name: '',
data() {
return {
flag: false,
list: ['跟进中', '已完成'],
tabIndex: 0,
clewList: [],
initShow: false,
page: {
pageNum: 1,
pageSize: 10
}
}
},
props: {},
watch: {},
created() {
this.getClueList()
},
mounted() {},
methods: {
gotoDetail(data) {
this.$router.push({ name: 'clew.detail', query: { taskId: data.id } })
},
getClueList() {
const status = this.tabIndex === 0 ? 1 : 2
const params = {
...this.page,
status
}
const clewList = this.clewList
this.showLoading()
clewApi.getClueList({ ...params }).then(({ code, data, message }) => {
this.hideLoading()
if (code === '0') {
if (status === 1) {
this.list = [`跟进中(${data.total})`, '已完成']
this.initShow = true
}
this.flag = true
if (data.list.length > 0) {
this.clewList = [...clewList, ...data.list]
this.page.pageNum > 1 ? (this.$refs.scrollView.loading = false) : ''
} else {
this.page.pageNum > 1 ? (this.$refs.scrollView.finished = true) : ''
this.page.pageNum > 1 ? (this.$refs.scrollView.loading = false) : ''
}
} else {
Notify(message)
}
})
},
changeTab(index) {
this.flag = false
this.clewList = []
this.page.pageNum = 1
this.tabIndex = index
this.getClueList()
},
onReachBottom() {
console.log('触底')
this.page.pageNum = this.page.pageNum + 1
this.getClueList()
}
}
}
</script>
<style scoped lang="scss">
.layoutIndex {
height: 100vh;
overflow: hidden;
.content {
height: calc(100vh - 82px);
margin: 16px 15px;
box-sizing: border-box;
&-item {
width: 100%;
height: 118px;
background: #ffffff;
box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
border-radius: 4px;
margin-bottom: 11px;
&-des {
height: 47px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
// width:100%;
padding: 16px 16px 9px 16px;
box-sizing: border-box;
.content-item-name{
width: calc(100% - 100px);
}
}
&-info {
padding: 10px 16px 16px 16px;
box-sizing: border-box;
span {
display: block;
label {
margin-left: 20px;
}
}
}
&-info :nth-child(1) {
margin-bottom: 10px;
}
}
}
}
</style>