Commit b8dff89e by 杨明

fixed

1 parent 03661189
...@@ -4,50 +4,36 @@ ...@@ -4,50 +4,36 @@
<div class="carousel-box"> <div class="carousel-box">
<template v-if="dataViewLoading"> <template v-if="dataViewLoading">
<template v-if="viewList.length"> <template v-if="viewList.length">
<el-carousel <el-carousel ref="carousel" :autoplay="false" :loop="false" indicator-position="none" height="100%" arrow="never" class="carousel" @change="viewIndex = $event">
ref="carousel"
:autoplay="false"
:loop="false"
indicator-position="none"
height="100%"
arrow="never"
class="carousel"
@change="viewIndex = $event"
>
<template v-for="(i, index) in viewList"> <template v-for="(i, index) in viewList">
<template> <template>
<el-carousel-item <el-carousel-item :key="index" class="carousel-item">
:key="index"
class="carousel-item"
>
<template v-for="(c, cindex) in i"> <template v-for="(c, cindex) in i">
<template> <template>
<div <div :key="cindex" class="group">
:key="cindex"
class="group"
>
<div class="title"> <div class="title">
<div class="text flex"> <div class="text flex">
<div class="icon"> <div class="icon">
<img :src="`https://img01.glsx.com.cn/weapp/resource/saas/scrm/data-view-sop-${cindex}.png`"> <img :src="`https://img01.glsx.com.cn/weapp/resource/saas/scrm/data-view-sop-${cindex}.png`" />
</div> </div>
{{ c.title }} {{ c.title }}
</div> </div>
<div class="line-box"> <div class="line-box">
<div <div class="line" :style="[{ width: c.width }]"></div>
class="line"
:style="[{ width: c.width }]"
></div>
</div> </div>
</div> </div>
<el-scrollbar class="content"> <div
class="content"
v-infinite-scroll="
() => {
infiniteLoad(cindex, index)
}
"
>
<template v-if="c.list.length"> <template v-if="c.list.length">
<template v-for="(item, ind) in c.list"> <template v-for="(item, ind) in c.list">
<template> <template>
<div <div :key="ind" class="item">
:key="ind"
class="item"
>
<div class="top flex"> <div class="top flex">
<div class="icon"> <div class="icon">
<template v-if="item.wechatAvatarUrl"> <template v-if="item.wechatAvatarUrl">
...@@ -59,10 +45,8 @@ ...@@ -59,10 +45,8 @@
</div> </div>
<div class="text"> <div class="text">
<div class="name"> <div class="name">
{{item.customerName || ''}} {{ item.customerName || '' }}
<template v-if="item.wechatNickname"> <template v-if="item.wechatNickname">@{{ item.wechatNickname }}</template>
@{{item.wechatNickname}}
</template>
</div> </div>
{{ item.customerPhone }} {{ item.customerPhone }}
</div> </div>
...@@ -80,7 +64,7 @@ ...@@ -80,7 +64,7 @@
<img src="@/assets/icon/nodata.png" /> <img src="@/assets/icon/nodata.png" />
</div> </div>
</template> </template>
</el-scrollbar> </div>
</div> </div>
</template> </template>
</template> </template>
...@@ -88,22 +72,16 @@ ...@@ -88,22 +72,16 @@
</template> </template>
</template> </template>
</el-carousel> </el-carousel>
<div <div class="arrow left" @click="$refs.carousel.prev()">
class="arrow left"
@click="$refs.carousel.prev()"
>
<img :src="viewIndex == 0 ? leftIcon : leftActiveIcon" /> <img :src="viewIndex == 0 ? leftIcon : leftActiveIcon" />
</div> </div>
<div <div class="arrow right" @click="$refs.carousel.next()">
class="arrow right"
@click="$refs.carousel.next()"
>
<img :src="viewIndex < viewList.length - 1 ? rightActiveIcon : rightIcon" /> <img :src="viewIndex < viewList.length - 1 ? rightActiveIcon : rightIcon" />
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="nothing"> <div class="nothing">
<img :src="nothing"> <img :src="nothing" />
暂无数据 暂无数据
</div> </div>
</template> </template>
...@@ -136,19 +114,50 @@ export default { ...@@ -136,19 +114,50 @@ export default {
leftActiveIcon: require('@/assets/icon/left-active.png'), leftActiveIcon: require('@/assets/icon/left-active.png'),
rightIcon: require('@/assets/icon/right.png'), rightIcon: require('@/assets/icon/right.png'),
rightActiveIcon: require('@/assets/icon/right-active.png'), rightActiveIcon: require('@/assets/icon/right-active.png'),
pageNumber: 1, pageNumber: [11],
pageCount: [],
nothing, nothing,
} }
}, },
watch: {
// stageList: {
// handler() {
// this.pageNumber = new Array(this.stageList.length).fill(1);
// this.pageCount = new Array(this.stageList.length).fill(0)
// },
// deep:true,
// immediate:true
// }
},
mounted () { mounted () {
this.refreshTable() this.refreshTable()
}, },
methods: { methods: {
// 下拉加载
async infiniteLoad(cindex, index) {
console.log(this.pageCount,this.pageNumber)
if(this.viewList[index][cindex].list.length == 0)return
if (this.viewList[index][cindex].list.length == this.pageCount[cindex]) return
this.pageNumber[cindex]++
const params = {
...JSON.parse(JSON.stringify(this.params)),
pageSize: 10,
pageNumber: this.pageNumber[cindex],
sopJourneyStage: this.stageList[cindex].value
}
let {list}= await this.$apis.journey.getCustomersList(params)
list.length &&
list.forEach((e) => {
e.day = dayjs().diff(dayjs(e.sopJourneyStageEnterTime).format('YYYY/MM/DD'), 'day')
})
this.viewList[index][cindex].list = this.viewList[index][cindex].list.concat(list)
},
async refreshTable () { async refreshTable () {
function splitArrayIntoChunks (arr, chunkSize) { function splitArrayIntoChunks (arr, chunkSize) {
const weight = 1 / arr.length const weight = 1 / arr.length
return arr.reduce((result, item, index) => { return arr.reduce((result, item, index) => {
const chunkIndex = Math.floor(index / chunkSize) const chunkIndex = Math.floor(index / chunkSize)
console.log(index,chunkIndex)
item.width = `${(weight * index + weight) * 100}%` item.width = `${(weight * index + weight) * 100}%`
result[chunkIndex] = result[chunkIndex] || [] result[chunkIndex] = result[chunkIndex] || []
result[chunkIndex].push(item) result[chunkIndex].push(item)
...@@ -157,28 +166,29 @@ export default { ...@@ -157,28 +166,29 @@ export default {
} }
const params = { const params = {
...JSON.parse(JSON.stringify(this.params)), ...JSON.parse(JSON.stringify(this.params)),
pageSize: 9999, pageSize: 10,
pageNumber: this.pageNumber pageNumber: 1
} }
const stageList = this.stageList, const stageList = this.stageList,
arr = [], arr = [],
{ sopJourneyStage } = params { sopJourneyStage } = params
for (let k of stageList) { for (let k in stageList) {
if (k.value) { if (stageList[k].value) {
params.sopJourneyStage = k.value params.sopJourneyStage = stageList[k].value
let list = [] let list = []
if (!sopJourneyStage || sopJourneyStage == stageList[k].value) {
if (!sopJourneyStage || sopJourneyStage == k.value) { k!=0&&this.$set(this.pageNumber,k-1, 1)
this.dataViewLoading = false this.dataViewLoading = false
const { list: apiList } = await this.$apis.journey.getCustomersList(params) const { list: apiList,total } = await this.$apis.journey.getCustomersList(params)
list = apiList list = apiList
k!=0&&this.$set(this.pageCount,k-1, total)
} }
list.length && list.length &&
list.forEach((e) => { list.forEach((e) => {
e.day = dayjs().diff(dayjs(e.sopJourneyStageEnterTime).format('YYYY/MM/DD'), 'day') e.day = dayjs().diff(dayjs(e.sopJourneyStageEnterTime).format('YYYY/MM/DD'), 'day')
}) })
arr.push({ arr.push({
title: k.label, title: stageList[k].label,
list list
}) })
} }
...@@ -247,7 +257,7 @@ export default { ...@@ -247,7 +257,7 @@ export default {
} }
.content { .content {
height: calc(100% - 60px); height: calc(100% - 60px);
overflow-y: scroll; overflow-y: auto;
box-sizing: border-box; box-sizing: border-box;
padding: 16px 16px 8px; padding: 16px 16px 8px;
position: relative; position: relative;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!