Commit b8dff89e by 杨明

fixed

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