feat: 客户人员编辑表单组件

This commit is contained in:
wangzhuo
2025-08-18 17:08:38 +08:00
parent e6efc466d8
commit f9474ac01d
4 changed files with 337 additions and 6 deletions

View File

@@ -29,7 +29,7 @@
<!-- </picker>-->
<view class="customer-name" @click="handleCustomerClick">
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
<text> {{ customerUser.cusName || '查询客户人员' }}</text> <!---->
<text> {{ customerUser.cusName || '查询客户名称' }}</text> <!---->
</view>
</uni-forms-item>
<!-- 系统推荐等级 -->
@@ -485,7 +485,8 @@ let handleUserTypeChange = (e) => {
// 选择日期
function handleTenureTimeChange(e) {
// console.log(e)
let {value} = e.detail;
formData.value.tenureTime = value;
}
// 需求层次索引
@@ -508,7 +509,8 @@ let handleDevelopChange = e => {
// 选择生日
function handleBirthdayChange(e) {
// console.log(e)
let{value} = e.detail
formData.value.birthday = value;
}
// 爱好标签索引

View File

@@ -0,0 +1,317 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'客户人员查看'" :leftFlag="true" :rightFlag="false">
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height" :style="{ paddingTop: navBarPaddingTop + 'px' }"></view>
<!-- 正文内容 -->
<view class="all-body">
<!-- 搜索 @blur="blur" @focus="focus" @input="input" @cancel="cancel" @clear="clear"-->
<view class="search">
<uni-search-bar class="custom-search" radius="28" placeholder="请输入客户名称" clearButton="auto"
cancelButton="none" bgColor="#6FA2F8" textColor="#ffffff"
v-model="searchValue"
/>
<button type="default" @click="clearSearchValue" size="mini" class="btn-search">清空</button>
</view>
<!-- 分页部分 -->
<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
:up="upOption" :down="downOption" :fixed="false" textColor="#ffffff" bgColor="#ffffff"
class="scroll-h" :class="{'loading-scroll':cssFlag}"
>
<view class="white-bg margin-bottom20" v-for="(item, index) in list" :key="index" @click.stop="handleDetail(item)">
<view class="report-list">
<view class="w-b-title title" @touchstart.prevent="handleTouchStart(item)" @touchend.prevent="handleTouchEnd">
{{ item.cusName }}
<view v-if="item.nodeCode" class="r-right btn-edit" :class="statusColorMap[item.nodeCode]">{{ item.nodeCode }}</view><!---->
</view>
<view class="r-list">
<view class="r-left">客户人员名称</view>
<view class="r-right">{{ item.userName }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">客户等级</view>
<view class="r-right">{{ item.cusEstate }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">职能</view>
<view class="r-right">{{ item.function }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">创建时间</view>
<view class="r-right">{{ item.createTime }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">业务员认定等级</view>
<view class="r-right">{{ item.salesmanThinkLevel }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">系统认定等级</view>
<view class="r-right">{{ item.systemThinkLevel }}</view>
</view>
<view v-if="item.opinion" class="border-bottom"></view>
<view v-if="item.opinion" class="r-list">
<view class="r-left">驳回原因</view>
<view class="r-right">{{ item.opinion }}</view>
</view>
</view>
</view>
</mescroll-uni>
</view>
</view>
</view>
</template>
<script setup>
import {ref, onMounted, watch} from 'vue'
import customHeader from '@/components/customHeader.vue'
import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
import {getNavBarPaddingTop} from '@/utils/system.js'
import {searchForAllPerson} from "@/api/crm/customer/getCustomer"
import {statusColorMap} from "./dataMap";
// 获取导航栏高度用于内容区域padding
const navBarPaddingTop = ref(0);
onMounted(() => {
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
})
// 搜索内容
let searchValue = ref(null);
// 分页
const mescrollRef = ref(null);
// 防抖计时
let timerId = null;
// 查询搜索跳转
let handleSearch = () => {
console.log(searchValue.value)
if (timerId) clearTimeout(timerId);
cssFlag.value = true;
timerId = setTimeout(async () => {
// let res = await getList(1, upOption.value.page.size)
await downCallback(mescrollRef.value.mescroll);
clearTimeout(timerId);
timerId = null;
}, 500)
}
watch(searchValue, (newValue, oldValue) => {
handleSearch()
})
let clearSearchValue = ()=>{
searchValue.value = '';
}
// 查询列表
let list = ref([]);
const upOption = ref({
page: {num: 0, size: 10},
noMoreSize: 5,
empty: {tip: '~ 空空如也 ~'},
textLoading: '加载中...',
textNoMore: '已经到底了'
});
const downOption = ref({
auto: true,
textInOffset: '下拉刷新',
textOutOffset: '释放更新',
textLoading: '刷新中...'
});
let cssFlag = ref(false);//控制样式
const mescrollInit = (mescroll) => {
cssFlag.value = true;
mescrollRef.value = mescroll;
};
// 下拉刷新
const downCallback = async (mescroll) => {
try {
setTimeout(async () => {
const res = await getList(1, upOption.value.page.size);
cssFlag.value = false;
list.value = res.list;
mescroll.endSuccess(res.list.length, res.total >= upOption.value.page.size);
}, 500);
} catch (error) {
console.log(error)
mescroll.endErr();
}
}
// 上拉加载更多
const upCallback = async (mescroll) => {
try {
setTimeout(async () => {
const res = await getList(mescroll.num, mescroll.size);
if (mescroll.num === 1) {
list.value = res.list;
} else {
list.value.push(...res.list);
}
mescroll.endSuccess(res.list.length, res.total >= mescroll.size);
}, 500);
} catch (error) {
console.log(error)
mescroll.endErr();
}
}
// 获取数据列表
const getList = (pageIndex, pageSize) => {
return new Promise(async (resolve) => {
let param = {
pageNum: pageIndex,
pageSize,
searchContent: searchValue.value
}
let res = await searchForAllPerson(param);
resolve({
list: res.rows,
total: res.total
});
});
}
// 跳转到详情
let handleDetail = (item) => {
uni.navigateTo({
url: "/pages/business/CRM/customer/components/customerUserEdit",
events: {
},
success(res){
res.eventChannel.emit('editCusData', {param: item, isAdd: false})
}
})
}
// 长按定时器ID
let touchTimerId = null;
// 开始触摸
let handleTouchStart = (item)=>{
touchTimerId = setTimeout(()=>{
// console.log(item, "长按客户人员项")
uni.showModal({
title: "提示",
content: "是否确认删除本条消息?",
success(res){
if(res.confirm){
handleDelete(item);
}else if(res.cancel){
}
},
})
clearTimeout(touchTimerId);
}, 1500)
}
// 结束触摸
let handleTouchEnd = ()=>{
if(touchTimerId !== null){
clearTimeout(touchTimerId);
}
}
// 删除消息
let handleDelete = async (item)=>{
// console.log(item)
const visitId = item.visitId;
// await removeVisit({visitId})
// uni.hideLoading();
uni.showToast({
title: visitId?visitId:"没有visitId字段无法删除",
icon: 'none'
});
}
</script>
<style scoped>
.all-body {
/* #ifdef APP-PLUS */
top: 150rpx;
height: calc(100vh - 75px);
/* #endif */
/* #ifndef APP-PLUS */
top: 120rpx;
height: calc(100vh);
/* #endif */
}
.search {
display: flex;
}
.search .btn-search {
border: none;
background: none;
line-height: normal;
color: #fff;
line-height: 56rpx !important;
padding: 10rpx 0 0;
text-align: left;
cursor: pointer;
}
.search .btn-search::after {
display: none;
}
.search .custom-search {
width: 80%;
}
.search .custom-search.uni-searchbar {
padding-right: 0 !important;
}
.scroll-h {
/* #ifdef APP-PLUS */
height: calc(100vh - 120px);
/* #endif */
/* #ifndef APP-PLUS */
height: calc(100vh - 110px);
/* #endif */
}
.white-bg {
padding-bottom: 10rpx;
}
.btn-edit{
&.wancheng-deal {
background: #00aa7f;
}
&.daishenhe-un-deal {
background: #ffaa7f;
}
&.chaoqi-deal {
background: #ff0000;
}
&.tijiao-deal {
background: #00aaff;
}
}
</style>

View File

@@ -113,4 +113,14 @@ export const workingStatusList = [
{id: 1, name: '正常上班'},
{id: 2, name: '离职'},
{id: 3, name: '退休'}
]
]
/**
* 人员所属审核状态字典
*/
export const statusColorMap = {
'提交': 'tijiao-deal',
'驳回': 'chaoqi-deal',
'超期': 'chaoqi-deal',
'完成': 'wancheng-deal',
'待审核': 'daishenhe-un-deal'
}

View File

@@ -2,7 +2,7 @@
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'客户列表'" :leftFlag="true" :rightFlag="false">
<customHeader ref="customHeaderRef" :title="'客户名称列表'" :leftFlag="true" :rightFlag="false">
<template #right>
<view class="head-right" @click="handleAdd">
<uni-icons type="plus" size="24" color="#B7D2FF"></uni-icons>
@@ -117,7 +117,7 @@ let timerId = null;
// 搜索
watch(searchValue, (newValue, oldValue) => {
// console.log(`新值: ${newValue}, 旧值: ${oldValue}`);
if(!timerId) clearTimeout(timerId);
if(timerId) clearTimeout(timerId);
cssFlag.value = true;
timerId = setTimeout(async ()=>{
handleSearch();
@@ -135,6 +135,7 @@ const downCallback = async (mescroll) => {
// 正确结束下拉刷新状态
mescroll.endSuccess(res.list.length, res.total >= upOption.value.page.size);
} catch (error) {
console.log(error)
// 发生错误时结束下拉刷新
mescroll.endErr();
}
@@ -152,6 +153,7 @@ const upCallback = async (mescroll) => {
// 正确结束上拉加载状态
mescroll.endSuccess(res.list.length, res.list.length >= mescroll.size);
} catch (error) {
console.log(error)
// 发生错误时结束上拉加载
mescroll.endErr();
}