|
|
|
@ -6,109 +6,106 @@ import {
|
|
|
|
|
ref
|
|
|
|
|
} from 'vue'
|
|
|
|
|
import type {
|
|
|
|
|
AssetsList
|
|
|
|
|
AssetsList,
|
|
|
|
|
HomeSearchPage
|
|
|
|
|
} from '@/types/consult'
|
|
|
|
|
import {
|
|
|
|
|
getKnowledgePage
|
|
|
|
|
} from '@/api/consult'
|
|
|
|
|
interface SearchObj {
|
|
|
|
|
searchVal: string | number
|
|
|
|
|
} from '@/api/home'
|
|
|
|
|
interface SearchObj {
|
|
|
|
|
nid?: string
|
|
|
|
|
searchDate?: string
|
|
|
|
|
}
|
|
|
|
|
const props = defineProps<SearchObj>()
|
|
|
|
|
// const { nid, searchDate } = toRefs(props)
|
|
|
|
|
|
|
|
|
|
const emits = defineEmits(['clickDetail', 'toPlay'])
|
|
|
|
|
//列表数据
|
|
|
|
|
const list = ref<AssetsList>([
|
|
|
|
|
{ id: 1, name: '张三大大大大大大大大大大大大大大大大大大大大大大大大大大', state: 1, lastTime: 1690956863121, call: '18516647464', tag: ['人美', '温柔乡', '粘人', '毒蛇', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨',] },
|
|
|
|
|
{ id: 2, name: '张三大大大大大大大大大大大大大大大大大大大大大大大大大大', state: 1, lastTime: 1690956863121, call: '18516647464', tag: ['人美', '温柔乡', '粘人', '毒蛇', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨',] },
|
|
|
|
|
{ id: 3, name: '张三大大大大大大大大大大大大大大大大大大大大大大大大大大', state: 1, lastTime: 1690956863121, call: '18516647464', tag: ['人美', '温柔乡', '粘人', '毒蛇', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨',] },
|
|
|
|
|
{ id: 4, name: '张三大大大大大大大大大大大大大大大大大大大大大大大大大大', state: 1, lastTime: 1690956863121, call: '18516647464', tag: ['人美', '温柔乡', '粘人', '毒蛇', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨',] },
|
|
|
|
|
{ id: 5, name: '张三大大大大大大大大大大大大大大大大大大大大大大大大大大', state: 1, lastTime: 1690956863121, call: '18516647464', tag: ['人美', '温柔乡', '粘人', '毒蛇', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨',] },
|
|
|
|
|
{ id: 5, name: '张三大大大大大大大大大大大大大大大大大大大大大大大大大大', state: 1, lastTime: 1690956863121, call: '18516647464', tag: ['人美', '温柔乡', '粘人', '毒蛇', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨',] },
|
|
|
|
|
{ id: 5, name: '张三大大大大大大大大大大大大大大大大大大大大大大大大大大', state: 1, lastTime: 1690956863121, call: '18516647464', tag: ['人美', '温柔乡', '粘人', '毒蛇', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨',] },
|
|
|
|
|
{ id: 5, name: '张三大大大大大大大大大大大大大大大大大大大大大大大大大大', state: 1, lastTime: 1690956863121, call: '18516647464', tag: ['人美', '温柔乡', '粘人', '毒蛇', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨',] },
|
|
|
|
|
{ id: 5, name: '张三大大大大大大大大大大大大大大大大大大大大大大大大大大', state: 1, lastTime: 1690956863121, call: '18516647464', tag: ['人美', '温柔乡', '粘人', '毒蛇', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨', '话痨',] },
|
|
|
|
|
]);
|
|
|
|
|
const list = ref<AssetsList>([])
|
|
|
|
|
//列表加载状态:true加载中 false加载完成(多次触发)
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
//控制列表数据是否加载完成:falsw还有数据 true数据已经加载完毕
|
|
|
|
|
const finished = ref(false);
|
|
|
|
|
|
|
|
|
|
//请求的分页参数
|
|
|
|
|
let params = {
|
|
|
|
|
current: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
searchVal: ''
|
|
|
|
|
let params: HomeSearchPage = {
|
|
|
|
|
page: 1,
|
|
|
|
|
size: 10,
|
|
|
|
|
nid: null,
|
|
|
|
|
startTime: null,
|
|
|
|
|
endTime: null
|
|
|
|
|
}
|
|
|
|
|
// onMounted(() => {
|
|
|
|
|
// console.log('22222222222222222222')
|
|
|
|
|
// })
|
|
|
|
|
//加载数据的函数
|
|
|
|
|
const onLoad = async () => {
|
|
|
|
|
// 异步更新数据
|
|
|
|
|
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
|
|
|
|
|
if (props.searchVal) {
|
|
|
|
|
params.searchVal = props.searchVal.toString()
|
|
|
|
|
}
|
|
|
|
|
const {
|
|
|
|
|
data
|
|
|
|
|
} = await getKnowledgePage(params)
|
|
|
|
|
if (params.searchVal) {
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
initListData()
|
|
|
|
|
})
|
|
|
|
|
const initListData = async(type?: string) => {
|
|
|
|
|
if (type == 'search') {
|
|
|
|
|
initList()
|
|
|
|
|
}
|
|
|
|
|
//把当前页数据追加到list列表中
|
|
|
|
|
list.value.push(...data.rows)
|
|
|
|
|
|
|
|
|
|
// 加载状态结束
|
|
|
|
|
if (props.nid) {
|
|
|
|
|
params.nid = props.nid
|
|
|
|
|
}
|
|
|
|
|
if (props.searchDate) {
|
|
|
|
|
let arr = props.searchDate.split('-')
|
|
|
|
|
params.endTime = arr[0]
|
|
|
|
|
params.startTime = arr[1]
|
|
|
|
|
}
|
|
|
|
|
const { data } = await getKnowledgePage(params)
|
|
|
|
|
list.value.push(...data.records)
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
|
|
|
|
// 数据全部加载完成
|
|
|
|
|
// 判断列表的数据是否加载完成了?
|
|
|
|
|
//1、list长度===total数据总条数
|
|
|
|
|
//2、current===pageTotal总页数
|
|
|
|
|
if (list.value.length === data.total) {
|
|
|
|
|
//数据加载完了
|
|
|
|
|
finished.value = true;
|
|
|
|
|
} else {
|
|
|
|
|
//数据没有加载完?把页码+1
|
|
|
|
|
params.current++
|
|
|
|
|
params.page++
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const clickDetail = (id: string) => {
|
|
|
|
|
uni.stopPullDownRefresh()
|
|
|
|
|
}
|
|
|
|
|
const clickDetail = (id: number) => {
|
|
|
|
|
emits('clickDetail', id)
|
|
|
|
|
}
|
|
|
|
|
const playCall = async (call: string) => {
|
|
|
|
|
emits('toPlay', call)
|
|
|
|
|
}
|
|
|
|
|
const initList = () => {
|
|
|
|
|
params.searchVal = ''
|
|
|
|
|
list.value = []
|
|
|
|
|
finished.value = false
|
|
|
|
|
params.current = 1
|
|
|
|
|
params.page = 1
|
|
|
|
|
params.nid = null
|
|
|
|
|
params.startTime = null
|
|
|
|
|
params.endTime = null
|
|
|
|
|
}
|
|
|
|
|
defineExpose({
|
|
|
|
|
initListData
|
|
|
|
|
})
|
|
|
|
|
// //当前选中的页签
|
|
|
|
|
onPullDownRefresh(() => {
|
|
|
|
|
initListData('search')
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<view class="knowledge-list">
|
|
|
|
|
<van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
|
|
|
|
|
<van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="initListData">
|
|
|
|
|
<!-- 列表数据 -->
|
|
|
|
|
<view class="mt-20rpx">
|
|
|
|
|
<view v-for="(item, index) in list" class="card-item bg-white p-15rpx mb-16rpx border-l-7 border-cyan-500" @click="clickDetail(item.id)">
|
|
|
|
|
<view v-for="item in list" :key="item.clueId" class="card-item bg-white p-15rpx mb-16rpx border-l-7 border-cyan-500 relative" @click="clickDetail(item.clueId)">
|
|
|
|
|
<view class="flex items-center justify-between">
|
|
|
|
|
<view class="font-bold text-c5 text-sm van-ellipsis flex-initial pr-15rpx">{{ item.name }}</view>
|
|
|
|
|
<view class="flex-none"><uni-icons type="smallcircle-filled" :class="item.state == 0 ? '' : 'text-c7'" size="10rpx"></uni-icons>{{ item.state == 0 ? '未跟进' : '已跟进' }}</view>
|
|
|
|
|
<view class="font-bold text-c5 text-sm van-ellipsis flex-initial pr-15rpx">{{ item.nid }}</view>
|
|
|
|
|
<view class="flex-none">{{ item.clueStageName ? item.clueStageName: '--' }}</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="flex py-15rpx justify-between">
|
|
|
|
|
<view class="flex-initial van-ellipsis">
|
|
|
|
|
<text class="block text-xs mb-10rpx">最后跟进:{{ parseTime(item.lastTime) }}</text>
|
|
|
|
|
<text class="block text-xs mb-10rpx">{{ item.originName }}</text>
|
|
|
|
|
<text class="block text-xs mb-10rpx">线索日期:{{ item.clueTime ? item.clueTime : '--' }}</text>
|
|
|
|
|
<!-- <text class="block text-xs">标签:有意向,咨询多次</text> -->
|
|
|
|
|
<view class="van-ellipsis">
|
|
|
|
|
<van-tag v-for="it in item.tag" type="primary" class="mr-5rpx">{{ it }}</van-tag>
|
|
|
|
|
<van-tag v-for="it in item.clueLabelList" type="primary" class="mr-5rpx">{{ it }}</van-tag>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="flex-none" @click.stop="playCall(item.call)">
|
|
|
|
|
<view class="flex-none" @click.stop="playCall(item.nid)">
|
|
|
|
|
<uni-icons custom-prefix="iconfont" class="text-c6! block mt-6rpx active:text-c7!" type="icon-dianhua" size="36"></uni-icons>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<img v-if="item.isNewClue" class="absolute w-44rpx top-0 left-0" src="@/static/images/new.png">
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</van-list>
|
|
|
|
|