Files
crm-uni/pages/customer/detile.vue
T

637 lines
15 KiB
Vue
Raw Normal View History

2025-03-14 16:55:12 +08:00
<template>
<view>
2025-03-20 10:58:04 +08:00
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" :title="$t('navbar.customerinfo')"></uni-nav-bar>
2025-03-14 16:55:12 +08:00
<view class="content">
2025-03-21 17:57:32 +08:00
<view class="contents" >
<view class="top">
<view class="name">{{datas.contacts}}</view>
<view class="right">
<text class="medal" :style="{color:(datas.magnitude == 0 ?'#F5AB00' : datas.magnitude == 1 ?'#8495B8': '#9B7200')}">{{datas.magnitude_txt}}</text>
2025-04-03 13:23:48 +08:00
<text class="tag" :style="{background:(datas.follow == 0 ?'#3471FF' : datas.follow == 1 ?'#27C89C': '#FF4040')}">{{datas.follow==0?$t('followup'):datas.follow==1?$t('deal'):$t('lost')}}</text>
2025-03-21 17:57:32 +08:00
</view>
2025-03-14 16:55:12 +08:00
</view>
2025-03-21 17:57:32 +08:00
<u-line margin="20rpx 0px" color="#fff" :hairline="false"></u-line>
<view class="cont">
<view class="title">
2025-07-23 10:16:29 +08:00
<view class="">
<u-tooltip :text="datas.phone" :copyText="datas.phone" :showCopy="true">
<text class="name" @click.stop>{{datas.phone}}</text>
</u-tooltip>
</view>
2025-03-28 14:46:49 +08:00
<view class="ststus" v-if="datas.channel_name!=''">{{$t('channel')}}:{{datas.channel_name}}</view>
2025-03-21 17:57:32 +08:00
</view>
<view class="info"><text class="sex">{{datas.sex_txt}}</text> | <text class="addr">{{datas.country_name}}</text><text class="type">{{datas.car_type_name}}</text>
</view>
2025-07-23 10:16:29 +08:00
<view v-if="datas.email!=''">
<u-tooltip :text="datas.email" :copyText="datas.email" :showCopy="true">
<text @click.stop>Email: {{datas.email}}</text>
</u-tooltip>
</view>
<view v-if="datas.WhatsApp!=''">
<u-tooltip :text="datas.WhatsApp" :copyText="datas.WhatsApp" :showCopy="true">
<text @click.stop>WhatsAPP: {{datas.WhatsApp}}</text>
</u-tooltip>
</view>
2025-03-28 14:46:49 +08:00
<view v-if="datas.address!=''">{{$t('customer.Company')}}: {{datas.address}}</view>
<view v-if="datas.describe!=''">{{$t('remarks')}}: {{datas.describe}}</view>
2025-03-17 17:43:41 +08:00
</view>
2025-03-21 17:57:32 +08:00
<view class="edt">
2025-03-28 14:46:49 +08:00
<!-- <view class="btn" @click="showtag = true"><image src="/static/image/customer/tagadd.png" mode=""></image><text> {{$t('addtag')}}</text></view> -->
2025-03-21 17:57:32 +08:00
<view class="btn" @click="editFn"><image src="/static/image/customer/edit.png" mode=""></image><text> {{$t('edtbtn')}}</text></view>
2025-03-14 16:55:12 +08:00
</view>
</view>
2025-03-28 14:46:49 +08:00
<view class="cells">
<view class="top">
<view class="item">{{$t('CustomerProfile')}}</view>
<view class="right">
<view class="btn"@click="showtag = true"><image src="/static/image/customer/tagadd.png" mode=""></image><text> {{$t('addtag')}}</text></view>
</view>
</view>
<view v-if="datas.tags.length>0">
<view class="conts" :class="{'expandeds':!expanded}">
2025-04-03 13:23:48 +08:00
<view class="tags" @click="tagselects(item)" v-for="(item, index) in datas.tags" :key="index">{{item.name}}</view>
2025-03-28 14:46:49 +08:00
</view>
<view class="toggle" @click="expanded = !expanded">
<text >
{{ expanded ? $t('retract') : $t('expand') }}
</text>
<u-icon v-if="expanded" class="arrowright" name="arrow-up" size="16" color="#999999"></u-icon>
<u-icon v-else class="arrowright" name="arrow-down" size="16" color="#999999"></u-icon>
</view>
</view>
<view v-else class="nones">
{{$t('CustomerProfilemag')}}
</view>
</view>
2025-03-14 16:55:12 +08:00
<view class="cell">
2025-03-20 17:35:53 +08:00
<view class="item">{{$t('customer.Cstomerfj')}}</view>
2025-03-15 15:46:16 +08:00
<view class="right select" @click="showgrade = true">
2025-03-20 17:35:53 +08:00
<!-- <input :placeholder="$t('customer.Cstomerfjinput')" disabled v-model="grade_name" /> -->
<view class="" :class="['content2', { placeholder: !grade_name }]">{{grade_name || $t('customer.Cstomerfjinput')}}</view>
2025-03-14 16:55:12 +08:00
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
</view>
</view>
</view>
<u-gap height="10" bgColor="#F6F6F6"></u-gap>
<view class="steps">
<view class="title">
2025-03-18 13:32:13 +08:00
<view class="">
2025-04-03 13:23:48 +08:00
{{$t('customer.followrecord')}} <text class="status" :style="{color:(datas.follow == 0 ?'#3471FF' : datas.follow == 1 ?'#27C89C': '#FF4040')}">{{datas.follow==0?$t('followup'):datas.follow==1?$t('deal'):$t('lost')}}</text>
2025-03-18 13:32:13 +08:00
</view>
<view class="btnjl" @click="followupFn">
2025-03-20 10:58:04 +08:00
{{$t('navbar.addfollowup')}}
2025-03-18 13:32:13 +08:00
</view>
2025-03-14 16:55:12 +08:00
</view>
2025-03-18 13:32:13 +08:00
<u-steps v-if="followList.length>0" :current="followList.length" direction="column" dot>
2025-03-28 14:46:49 +08:00
<u-steps-item :title="item.type==1? $t('customer.Online') : $t('customer.Visit') " v-for="(item, index) in followList" :key="index">
2025-03-14 16:55:12 +08:00
<view slot="desc" class="desc">
2025-06-23 17:41:44 +08:00
<view class="flex">
2025-03-14 16:55:12 +08:00
<view class="">
2025-03-28 14:46:49 +08:00
<view class="lingh">
2025-03-19 15:39:21 +08:00
{{$t('times')}} :{{item.created_at}}
2025-03-18 13:32:13 +08:00
</view>
2025-06-23 17:41:44 +08:00
<view class="" v-if="item.type==0">{{$t('address')}}:{{item.address}}</view>
<view class="lingh" v-if="item.type==0">{{$t('customer.Visitcontent')}}:{{item.audio_text}}</view>
<view class="lingh" v-if="item.type==1">{{$t('customer.flRemarks')}}:{{item.audio_text}}</view>
2025-03-14 16:55:12 +08:00
</view>
<view class="">
2025-03-28 14:46:49 +08:00
<!-- <image :src="item.oss_picture" mode=""></image> -->
<u-album
:urls="isurls(item.oss_picture)"
:singleSize="80"
keyName="src"
></u-album>
2025-03-14 16:55:12 +08:00
</view>
</view>
</view>
</u-steps-item>
</u-steps>
2025-03-18 13:32:13 +08:00
<empty :list="followList"></empty>
2025-03-14 16:55:12 +08:00
</view>
<view class="zw"></view>
2025-03-20 10:58:04 +08:00
<u-picker closeOnClickOverlay :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :defaultIndex="defaultIndexfj" :show="showgrade" @cancel="cancel('showgrade')" @close="close('showgrade')" :columns="getGradeList" keyName="name" @confirm="gradeHandler"></u-picker>
2025-03-28 14:46:49 +08:00
<!-- 客户标签 -->
<u-popup closeOnClickOverlay :show="showtag" mode="bottom" :round="10" @close="closetag('showtag')" :closeable="true" >
<view class="popup-content">
<scroll-view scroll-y class="tag-list">
<view
v-for="(item, index) in taglist"
:key="index"
class="tags"
>
<view class="name">{{ item.name }}</view>
<view class="row">
<view class="col4 tagitem" v-for="(item1, index1) in item.tags" :class="{ 'tagactive': isActive(item1.group_id, item1.id) }" @click="tagSelect(item1)" :key="index1">
{{ item1.name }}
</view>
</view>
2025-03-18 13:32:13 +08:00
2025-03-28 14:46:49 +08:00
</view>
</scroll-view>
2025-03-18 13:32:13 +08:00
</view>
2025-03-28 14:46:49 +08:00
</u-popup>
2025-03-14 16:55:12 +08:00
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
export default {
data() {
return {
id:'',
2025-03-28 14:46:49 +08:00
expanded:false,
2025-03-18 13:32:13 +08:00
followList:[],
2025-03-28 14:46:49 +08:00
showtag: false,
2025-03-18 13:32:13 +08:00
showmap: false,
showmagnitude: false,
2025-03-15 15:46:16 +08:00
showgrade: false,
showcartype: false,
2025-03-18 13:32:13 +08:00
showchannel: false,
showarea: false,
2025-03-19 15:39:21 +08:00
getGradeList1:[],
2025-03-21 17:57:32 +08:00
getGradeList:[],
2025-03-15 15:46:16 +08:00
grade_name:'',
2025-03-18 13:32:13 +08:00
defaultIndexfj:[0],
2025-03-15 15:46:16 +08:00
form: {
grade:'',
2025-03-19 15:39:21 +08:00
},
2025-03-28 14:46:49 +08:00
datas:'',
activeMap: {}, // 存储每个父级下选中的子项 { 父ID: 子ID }
taglist:[]
2025-03-14 16:55:12 +08:00
}
},
onLoad(options) {
2025-03-18 13:32:13 +08:00
this.id = options.id;
2025-03-14 16:55:12 +08:00
var that = this
2025-03-18 13:32:13 +08:00
this.getGrade()
this.customerdetailfn()
2025-03-28 14:46:49 +08:00
this.tagGroup()
2025-03-14 16:55:12 +08:00
},
2025-03-18 13:32:13 +08:00
onShow() {
2025-03-19 15:39:21 +08:00
if(uni.getStorageSync('location')){
this.location = JSON.parse(uni.getStorageSync('location'))
this.form.address = this.location.address
this.form.lng = this.location.lng
this.form.lat = this.location.lat
}
2025-03-18 13:32:13 +08:00
this.followlistfn()
},
2025-03-14 16:55:12 +08:00
methods: {
leftClick(){
uni.navigateBack({})
2025-03-15 15:46:16 +08:00
},
2025-03-28 14:46:49 +08:00
isurls(url){
var urls=[]
var obj={}
obj.src = url
urls.push(obj)
return urls
},
2025-03-19 15:39:21 +08:00
gomap(){
uni.navigateTo({
url: '/pages/customer/map'
});
},
select(){
var that=this;
that.getGradeList1.forEach((item,index) => {
if(item.id == that.form.grade){
that.grade_name = item.name
that.defaultIndexfj=[index]
}
})
},
2025-03-18 13:32:13 +08:00
//客户详情
customerdetailfn(){
2025-03-19 15:39:21 +08:00
var that=this;
2025-03-18 13:32:13 +08:00
request({
url:'customer/detail',
method:'get',
data: {
id:this.id,
}
}).then(res => {
2025-03-19 15:39:21 +08:00
that.datas = res.data.data
2025-03-28 14:46:49 +08:00
that.datas.tags.forEach((item,index) => {
that.$set(that.activeMap, item.group_id,item.id);
})
2025-03-19 15:39:21 +08:00
that.form = res.data.data
that.select()
2025-03-18 13:32:13 +08:00
})
},
// 跟进记录
followlistfn(){
request({
url:'follow/list',
method:'get',
data: {
customer_id:this.id,
}
}).then(res => {
this.followList = res.data.data
})
},
//添加跟进
followupFn(){
uni.navigateTo({
url: '/pages/customer/followup?id='+this.id
});
},
mapclose(){
this.showmap = false
},
mapconfirm(){
this.showmap = false
},
//客户等级
2025-03-15 15:46:16 +08:00
getGrade(){
request({
url:'customer/getGrade',
method:'get',
}).then(res => {
var list = res.data.data
this.getGradeList = [list]
2025-03-19 15:39:21 +08:00
this.getGradeList1 = list
2025-03-15 15:46:16 +08:00
})
},
2025-03-18 13:32:13 +08:00
//客户等级切换事件
2025-03-15 15:46:16 +08:00
gradeHandler(val){
2025-03-18 13:32:13 +08:00
this.form.grade = val.value[0].id
2025-03-15 15:46:16 +08:00
this.grade_name = val.value[0].name
this.showgrade = false
2025-03-21 17:57:32 +08:00
request({
url:'customer/grade',
method:'post',
data:{
id:this.id,
grade:this.form.grade
}
}).then(res => {
uni.showToast({
title: res.data.message,
icon: 'none'
});
// if(res.data.code ==0){
// setTimeout(() => {
// uni.reLaunch({
// url: '/pages/index/customer',// 替换为你要跳转的页面路径
// });
// }, 1000);
// }
})
2025-03-15 15:46:16 +08:00
},
cancel(val){
this[val] = false
},
2025-03-20 10:58:04 +08:00
close(val){
this[val] = false
},
2025-03-28 14:46:49 +08:00
closetag(val){
this[val] = false
this.customerdetailfn()
},
2025-03-21 17:57:32 +08:00
editFn(){
uni.navigateTo({
url: '/pages/customer/editdetile?id='+this.id
});
},
2025-03-28 14:46:49 +08:00
//标签
tagGroup(){
request({
url:'tagGroup/list',
method:'get',
}).then(res => {
this.taglist = res.data.data
})
},
//标签点击
tagSelect(item) {
// 如果已选中则取消,否则设置选中
this.$set(this.activeMap, item.group_id, this.activeMap[item.group_id] === item.id ? '' : item.id);
request({
url:'tagGroup/updatePivot',
method:'post',
data:{
customer_id: this.id,
group_id:item.group_id,
tag_id:this.activeMap[item.group_id]
}
}).then(res => {
if(res.data.code!=0){
uni.showToast({
title: res.data.message,
icon: 'none'
});
}
})
},
2025-04-03 13:23:48 +08:00
tagselects(item){ //标签筛选
uni.navigateTo({
url: '/pages/customer/tagcustomer?tag_id='+item.id+'&name='+item.name
});
},
2025-03-28 14:46:49 +08:00
isActive(parentId, childId) {
return this.activeMap[parentId] === childId;
},
2025-03-15 15:46:16 +08:00
nextFn(){
2025-03-20 10:58:04 +08:00
request({
url:'customer/save',
method:'post',
data:this.form
}).then(res => {
uni.showToast({
title: res.data.message,
icon: 'none'
});
if(res.data.code ==0){
setTimeout(() => {
uni.reLaunch({
url: '/pages/index/customer',// 替换为你要跳转的页面路径
});
}, 1000);
}
})
2025-03-14 16:55:12 +08:00
}
}
}
</script>
<style lang="scss">
2025-03-28 14:46:49 +08:00
::v-deep .u-cell__body{
padding: 0px !important;
}
::v-deep .u-collapse-item__content__text{
padding: 10px 0px!important;
}
::v-deep .u-cell__title-text{
font-size: 14px;
}
2025-03-20 10:58:04 +08:00
.u-m-lr-10{
margin: 0px 10px;
}
2025-03-20 17:35:53 +08:00
.placeholder {
color: #999; /* 占位符颜色 */
}
2025-03-18 13:32:13 +08:00
textarea {
min-height: 200rpx;// 设置默认高度 ,解决设置自适应高度之后高度无效问题
margin-top: 15px;
background-color: #F6F6F6;
padding: 15px;
border-radius: 10px;
}
.red{
color: red;
2025-03-14 16:55:12 +08:00
}
.zw{
height: 120px;
}
.uniui-right{
position: absolute;
top: 2px;
}
2025-03-28 14:46:49 +08:00
.expandeds{
height: 33px;
overflow: hidden;
}
.cells{
margin-bottom: 10px;
background: #f6f6f6;
padding:13px 15px;
border-radius: 10px;
.top{
display: flex;
align-items: center;
justify-content: space-between;
color: #666666;
}
.btn{
color: #3471FF;
text-align: right;
display: flex;
align-items: center;
}
image{
width: 14px;
height: 14px;
margin-right: 5px;
}
.conts{
padding: 10px 0px;
}
.tags{
display: inline-block;
margin: 4px 3px;
// width: 31%;
background: #ECF2FF;
border-radius: 15px;
color: #3471FF;
text-align: center;
padding: 5px 15px;
}
.toggle{
display: flex;
align-items: center;
justify-content: center;
color: #999999;
font-size: 12px;
margin-top: 5px;
text{
margin-right: 5px;
}
}
.nones{
text-align: center;
color: #999999;
line-height: 30px;
font-size: 12px;
}
}
2025-03-14 16:55:12 +08:00
.cell{
position: relative;
display: flex;
justify-content:space-between;
2025-03-28 14:46:49 +08:00
padding: 13px 20px;
2025-03-14 16:55:12 +08:00
align-items: center;
font-weight: 500;
2025-03-20 17:35:53 +08:00
.item{
width: 90px;
2025-03-21 17:57:32 +08:00
color: #666666;
2025-03-20 17:35:53 +08:00
}
2025-03-21 17:57:32 +08:00
background: #f6f6f6;
border-radius: 10px;
2025-03-14 16:55:12 +08:00
}
.arrowright{
margin-right: -15px;
}
.right{
text-align: right;
}
.select{
display: flex;
position: relative;
margin-right: 10px;
}
2025-03-28 14:46:49 +08:00
.tagname{
color: #726CFF;
font-size: 12px;
}
2025-03-21 17:57:32 +08:00
.content{
padding: 10px 15px;
background: #FFFFFF;
.contents{
background-color:#F6F6F6;
border-radius: 10px;
margin-bottom: 10px;
.edt{
display: flex;
2025-03-28 14:46:49 +08:00
justify-content: flex-end;
2025-03-21 17:57:32 +08:00
padding-bottom: 10px;
2025-03-28 14:46:49 +08:00
text-align: center;
2025-03-21 17:57:32 +08:00
image{
width: 14px;
height: 14px;
margin-right: 5px;
vertical-align: middle;
}
}
.btn{
color: #3471FF;
text-align: right;
padding: 0px 15px 0px;
}
.top{
padding: 10px 15px 0px;
display: flex;
align-items: center;
justify-content: space-between;
.tag{
color: white;
border-radius: 20px 0px 0px 20px;
padding: 3px 10px;
margin-right: -15px;
}
.right{
display: flex;
align-items: center;
.medal{
margin-right: 10px;
}
}
}
.name{
2025-04-08 09:30:48 +08:00
font-size: 30rpx;
2025-03-21 17:57:32 +08:00
font-weight: bold;
margin-right: 10px;
}
.cont{
padding: 0px 15px 10px;
font-size: 24rpx;
.title{
display: flex;
align-items: center;
justify-content: space-between;
color: #222222;
}
.ststus{
color: #666666;
}
.info,.desc{
color: #78758E;
line-height: 26px;
}
.sex{
margin-right: 5px;
}
.addr{
margin-left: 5px;
}
.type{
margin-left: 5px;
color: #3471FF;
}
}
}
}
2025-03-14 16:55:12 +08:00
.steps{
padding: 15px;
2025-03-19 15:39:21 +08:00
background: #fff;
2025-03-14 16:55:12 +08:00
image{
width: 44px;
height:44px;
}
.desc{
2025-03-28 14:46:49 +08:00
2025-03-14 16:55:12 +08:00
align-items: center;
color: #999999;
2025-03-28 14:46:49 +08:00
.lingh{
line-height: 40px;
}
.flex{
display: flex;
justify-content: space-between;
align-items: center;
}
2025-03-14 16:55:12 +08:00
}
.title{
2025-03-18 13:32:13 +08:00
display: flex;
align-items: center;
justify-content: space-between;
2025-03-14 16:55:12 +08:00
color: #666666;
font-size: 32rpx;
margin-bottom: 15px;
.status{
font-size: 28rpx;
margin-left: 10px;
}
2025-03-18 13:32:13 +08:00
.btnjl{
background: linear-gradient(to right, #3471FF, #6776FF);
color: white;
padding: 4px 10px;
border-radius: 20px;
2025-04-03 13:23:48 +08:00
font-size: 24rpx;
2025-03-18 13:32:13 +08:00
}
2025-03-14 16:55:12 +08:00
}
}
2025-03-28 14:46:49 +08:00
// 标签弹框
.popup-content {
padding: 20px;
}
.tag-list{
max-height: 900rpx;
margin-top: 20rpx;
.tags{
margin-top: 10px;
}
.name{
margin: 10px 0px;
}
.tagitem{
background: #ECF2FF;
border-radius: 8px;
color: #3471FF;
text-align: center;
2025-04-08 09:30:48 +08:00
padding: 5px 13px;
2025-03-28 14:46:49 +08:00
}
.row{
width: 100%;
}
.col4{
display: inline-block;
margin: 4px 3px;
2025-04-08 09:30:48 +08:00
// width: 30%;
2025-03-28 14:46:49 +08:00
}
}
.tagactive{
background: #3471FF !important;
color: #fff !important;
}
2025-03-14 16:55:12 +08:00
</style>