Files
crm-uni/pages/customer/detile.vue
T
2025-03-18 13:32:13 +08:00

455 lines
12 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view>
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" title="客户资料"></uni-nav-bar>
<view class="content">
<view class="cell">
<view>渠道</view>
<view class="right select" @click="showchannel = true">
<input placeholder="选择渠道" disabled v-model="channel_name" />
<u-picker :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :defaultIndex="defaultIndexqd" :show="showchannel" @cancel="cancel('showchannel')" :columns="channelList" keyName="name" @confirm="channelChange"></u-picker>
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
</view>
</view>
<u-line></u-line>
<view class="cell">
<view>客户商机</view>
<view class="right select" @click="showmagnitude = true">
<input placeholder="选择客户商机" disabled v-model="magnitude_name" />
<u-picker :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :defaultIndex="defaultIndexsj" :show="showmagnitude" @cancel="cancel('showmagnitude')" :columns="magnitudeList" keyName="name" @confirm="magnitudeChange"></u-picker>
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
</view>
</view>
<u-line></u-line>
<view class="cell">
<view>客户名称 <text class="red">*</text></view>
<view class="right">
<input placeholder="输入名称" v-model="form.contacts" />
</view>
</view>
<u-line></u-line>
<view class="cell">
<view>性别</view>
<view class="right">
<u-radio-group v-model="form.sex">
<u-radio name="0">未知</u-radio>
<u-radio name="1">男</u-radio>
<u-radio name="2">女</u-radio>
</u-radio-group>
</view>
</view>
<u-line></u-line>
<view class="cell">
<view>联系方式 <text class="red">*</text></view>
<view class="right">
<input placeholder="输入联系方式" v-model="form.phone" />
</view>
</view>
<u-line></u-line>
<view class="cell">
<view>Email</view>
<view class="right">
<input placeholder="输入Email" v-model="form.email" />
</view>
</view>
<u-line></u-line>
<view class="cell">
<view>WhatsApp</view>
<view class="right">
<input placeholder="输入WhatsApp" v-model="form.WhatsApp" />
</view>
</view>
<u-line></u-line>
<view class="cell">
<view>客户偏好</view>
<view class="right select" @click="showcartype = true">
<input placeholder="选择客户偏好" disabled v-model="car_type_name" />
<u-picker :cancel-text="$t('cancel')" :confirm-text="$t('confirm')":defaultIndex="defaultIndexph" :show="showcartype" @cancel="cancel('showcartype')" :columns="carTypeList" keyName="name" @confirm="cartypesChange"></u-picker>
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
</view>
</view>
<u-line></u-line>
<view class="cell">
<view>客户分级</view>
<view class="right select" @click="showgrade = true">
<input placeholder="选择客户分级" disabled v-model="grade_name" />
<u-picker :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :defaultIndex="defaultIndexfj" :show="showgrade" @cancel="cancel('showgrade')" :columns="getGradeList" keyName="name" @confirm="gradeHandler"></u-picker>
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
</view>
</view>
<u-line></u-line>
<view class="cell">
<view>国家</view>
<view class="right select" @click="showarea = true">
<input placeholder="选择国家" disabled v-model="country_name" />
<u-picker :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :defaultIndex="defaultIndexgj" :show="showarea" @cancel="cancel('showarea')" :columns="areaList" keyName="name" @confirm="areaChange"></u-picker>
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
</view>
</view>
<u-line></u-line>
<view class="cell">
<view>公司</view>
<view class="right select" @click="showmap = true">
<input placeholder="去定位" type="text" disabled v-model="form.address"/>
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
</view>
</view>
<u-line></u-line>
<view class="cell1">
<view>备注(非必填)</view>
<view class="">
<textarea auto-height v-model="form.describe" placeholder="请输入备注内容~"/>
</view>
</view>
</view>
<u-gap height="10" bgColor="#F6F6F6"></u-gap>
<view class="steps">
<view class="title">
<view class="">
跟进记录 <text class="status">跟进中</text>
</view>
<view class="btnjl" @click="followupFn">
添加记录
</view>
</view>
<u-steps v-if="followList.length>0" :current="followList.length" direction="column" dot>
<u-steps-item :title="item.type_txt" v-for="(item, index) in followList" :key="index">
<view slot="desc" class="desc">
<view class="" v-if="item.type==0">
<view class="">
<view class="">
时间:{{item.created_at}}
</view>
<view class="">地址:{{item.address}}</view>
<view class="">拜访内容:{{item.audio_text}}</view>
</view>
<view class="">
<image :src="item.oss_picture" mode=""></image>
</view>
</view>
<view class="" v-else>
<view class="">
时间:{{item.created_at}}
</view>
<view class="">
<image :src="item.oss_picture" mode=""></image>
</view>
</view>
</view>
</u-steps-item>
</u-steps>
<empty :list="followList"></empty>
</view>
<view class="zw"></view>
<view class="foot">
<button class="btn" @click="nextFn">提交</button>
</view>
<u-popup :show="showmap" :round="10" mode="bottom" @close="mapclose">
<view class="mapcont">
<view class="header">
<view class="cancel" @click="mapclose">取消</view>
<view class="title">地图位置</view>
<view class="confirm" @click="mapconfirm">确定</view>
</view>
<view class="map">
</view>
</view>
</u-popup>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
export default {
data() {
return {
id:'',
followList:[],
showmap: false,
showmagnitude: false,
showgrade: false,
showcartype: false,
showchannel: false,
showarea: false,
getGradeList:[],
carTypeList:[],
channelList:[],
magnitudeList:[],
areaList:[],
grade_name:'',
car_type_name:'',
country_name:'',
channel_name:'',
magnitude_name:'',
defaultIndexqd:[0],
defaultIndexsj:[0],
defaultIndexph:[0],
defaultIndexfj:[0],
defaultIndexgj:[0],
form: {
contacts: '',
sex: '0',
phone: '',
email: '',
describe: '',
grade:'',
country_id:'',
car_type_id:'',
channel_id:'',
magnitude:'',
address:'',
}
}
},
onLoad(options) {
console.log(options);
this.id = options.id;
var that = this
this.getChannel()
this.getMagnitude()
this.getGrade()
this.carType()
this.area()
this.customerdetailfn()
},
onShow() {
this.followlistfn()
},
methods: {
leftClick(){
uni.navigateBack({})
},
//客户详情
customerdetailfn(){
request({
url:'customer/detail',
method:'get',
data: {
id:this.id,
}
}).then(res => {
this.form = res.data.data
that.channelList.forEach((item,index) => {
if(item.id == this.form.channel_id){
that.channel_name = item.name
that.defaultIndexqd=[index]
}
})
console.log(res.data.data)
})
},
// 跟进记录
followlistfn(){
request({
url:'follow/list',
method:'get',
data: {
customer_id:this.id,
}
}).then(res => {
this.followList = res.data.data
console.log(res.data.data)
})
},
//添加跟进
followupFn(){
uni.navigateTo({
url: '/pages/customer/followup?id='+this.id
});
},
mapclose(){
this.showmap = false
},
mapconfirm(){
this.showmap = false
},
//渠道
getChannel(){
request({
url:'customer/getChannel',
method:'get',
}).then(res => {
var list = res.data.data
this.channelList = [list]
})
},
//客户等级
getGrade(){
request({
url:'customer/getGrade',
method:'get',
}).then(res => {
var list = res.data.data
this.getGradeList = [list]
})
},
//偏好
carType(){
request({
url:'carType/getAll',
method:'get',
}).then(res => {
var list = res.data.data
this.carTypeList = [list]
})
},
//国家
area(){
request({
url:'area/getCountry',
method:'get',
}).then(res => {
var list = res.data.data
this.areaList = [list]
})
},
//商机
getMagnitude(){
request({
url:'customer/getMagnitude',
method:'get',
}).then(res => {
var list = res.data.data
this.magnitudeList = [list]
})
},
//商机切换事件
magnitudeChange(val){
this.form.magnitude = val.value[0].id
this.magnitude_name = val.value[0].name
this.showmagnitude = false
},
//通道切换事件
channelChange(val){
this.form.channel_id = val.value[0].id
this.channel_name = val.value[0].name
this.showchannel = false
},
//客户等级切换事件
gradeHandler(val){
this.form.grade = val.value[0].id
this.grade_name = val.value[0].name
this.showgrade = false
},
//国家切换事件
areaChange(val){
this.form.country_id = val.value[0].id
this.country_name = val.value[0].name
this.showarea = false
},
//偏好切换事件
cartypesChange(val){
this.form.car_type_id = val.value[0].id
this.car_type_name = val.value[0].name
this.showcartype = false
},
cancel(val){
this[val] = false
},
nextFn(){
}
}
}
</script>
<style lang="scss">
textarea {
min-height: 200rpx;// 设置默认高度 ,解决设置自适应高度之后高度无效问题
margin-top: 15px;
background-color: #F6F6F6;
padding: 15px;
border-radius: 10px;
}
.red{
color: red;
}
.zw{
height: 120px;
}
.uniui-right{
position: absolute;
top: 2px;
}
.content{
padding-top: 10px;
background: #FFFFFF;
}
.cell{
position: relative;
display: flex;
justify-content:space-between;
padding: 18px 20px;
align-items: center;
font-weight: 500;
}
.arrowright{
margin-right: -15px;
}
.cell1{
font-size: 32rpx;
padding: 18px 20px;
align-items: center;
font-weight: 500;
}
.right{
text-align: right;
}
.select{
display: flex;
position: relative;
margin-right: 10px;
}
.steps{
padding: 15px;
image{
width: 44px;
height:44px;
}
.desc{
display: flex;
justify-content: space-between;
align-items: center;
color: #999999;
}
.title{
display: flex;
align-items: center;
justify-content: space-between;
color: #666666;
font-size: 32rpx;
margin-bottom: 15px;
.status{
font-size: 28rpx;
color: #3471FF;
margin-left: 10px;
}
.btnjl{
background: linear-gradient(to right, #3471FF, #6776FF);
color: white;
padding: 4px 10px;
border-radius: 20px;
font-size: 28rpx;
}
}
}
.foot{
position: fixed;
bottom: 0px;
width: 100%;
height: 160rpx;
background: #FFFFFF;
z-index: 1;
}
.btn{
background: linear-gradient(to right, #3471FF, #6776FF);
color: white;
border-radius: 50px;
width: 92%;
margin-bottom: 40px;
margin: 15px 4%;
}
</style>