677 lines
18 KiB
Vue
677 lines
18 KiB
Vue
<template>
|
|
<view>
|
|
<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>
|
|
<view class="content">
|
|
<view class="cell">
|
|
<view class="item">{{$t('customer.CustomerChannel')}} <text class="red">*</text></view>
|
|
<view class="right select" @click="showchannel = true">
|
|
<view class="" :class="['content2', { placeholder: !channel_name }]">{{channel_name || $t('customer.CustomerChannelinput')}}</view>
|
|
<!-- <input :placeholder="$t('customer.CustomerChannelinput')" disabled v-model="channel_name" /> -->
|
|
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">{{$t('customer.Medal')}}</view>
|
|
<view class="right select" @click="showmagnitude = true">
|
|
<view class="" :class="['content2', { placeholder: !magnitude_name }]">{{magnitude_name || $t('customer.Medalinput')}}</view>
|
|
<!-- <input :placeholder="$t('customer.Medalinput')" disabled v-model="magnitude_name" /> -->
|
|
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">{{$t('customer.CustomerName')}} <text class="red">*</text></view>
|
|
<view class="right">
|
|
<input :placeholder="$t('customer.CustomerNameinput')" v-model="form.contacts" />
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">{{$t('gender')}}</view>
|
|
<view class="right">
|
|
<u-radio-group v-model="form.sex">
|
|
<u-radio name="0">{{$t('gender0')}}</u-radio>
|
|
<u-radio name="1" class="u-m-lr-10">{{$t('gender1')}}</u-radio>
|
|
<u-radio name="2">{{$t('gender2')}}</u-radio>
|
|
</u-radio-group>
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">{{$t('mine.lxcall')}} <text class="red">*</text></view>
|
|
<view class="right">
|
|
<input :placeholder="$t('mine.lxcallinputhd')" v-model="form.phone" />
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">Email</view>
|
|
<view class="right">
|
|
<input :placeholder="$t('customer.Emailinput')" v-model="form.email" />
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">WhatsApp</view>
|
|
<view class="right">
|
|
<input :placeholder="$t('customer.WhatsAppinput')" v-model="form.WhatsApp" />
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">{{$t('customer.Customerph')}} <text class="red">*</text></view>
|
|
<view class="right select" @click="showcartype = true">
|
|
<view class="" :class="['content2', { placeholder: !car_type_name }]">{{car_type_name || $t('customer.Customerphinput')}}</view>
|
|
<!-- <input :placeholder="$t('customer.Customerphinput')" disabled v-model="car_type_name" /> -->
|
|
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">{{$t('customer.Cstomerfj')}}</view>
|
|
<view class="right select" @click="showgrade = true">
|
|
<view class="" :class="['content2', { placeholder: !grade_name }]">{{grade_name || $t('customer.Cstomerfjinput')}}</view>
|
|
<!-- <input :placeholder="$t('customer.Cstomerfjinput')" disabled v-model="grade_name" /> -->
|
|
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">{{$t('customer.Cstomertag')}}</view>
|
|
<view class="right select" @click="showtag = true">
|
|
<view class="" :class="['content2', { placeholder: !grade_name }]">{{grade_name || $t('customer.Cstomertaginput')}}</view>
|
|
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">{{$t('customer.Country')}}</view>
|
|
<view class="right select" @click="showarea = true">
|
|
<view class="" :class="['content2', { placeholder: !country_name }]">{{country_name || $t('customer.Countryinput')}}</view>
|
|
<!-- <input :placeholder="$t('customer.Countryinput')" disabled v-model="country_name" /> -->
|
|
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
|
|
</view>
|
|
</view>
|
|
<u-line></u-line>
|
|
<view class="cell">
|
|
<view class="item">{{$t('customer.Company')}}</view>
|
|
<view class="right select" @click="gomap">
|
|
<view class="" :class="['content2', { placeholder: !form.address }]">{{form.address || $t('customer.Companyinput')}}</view>
|
|
<!-- <input :placeholder="$t('customer.Companyinput')" 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="cell">
|
|
<view>首次跟进</view>
|
|
<view class="right">
|
|
<input placeholder="首次跟进" type="text" v-model="form.mileage"/>
|
|
</view>
|
|
</view> -->
|
|
<u-line></u-line>
|
|
<view class="cell1">
|
|
<view class="item">{{$t('customer.Remarks')}}</view>
|
|
<view class="">
|
|
<textarea auto-height v-model="form.describe" :placeholder="$t('customer.Remarksinputhd')"/>
|
|
</view>
|
|
</view>
|
|
<u-gap height="100" bgColor="#fff"></u-gap>
|
|
</view>
|
|
<view class="foot">
|
|
<button class="btn" @click="saveFn">{{$t('submit')}}</button>
|
|
</view>
|
|
<u-picker closeOnClickOverlay :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="showchannel" @cancel="cancel('showchannel')" @close="close('showchannel')" :columns="channelList" keyName="name" @confirm="channelChange"></u-picker>
|
|
<u-picker closeOnClickOverlay :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="showmagnitude" @cancel="cancel('showmagnitude')" @close="close('showmagnitude')" :columns="magnitudeList" keyName="name" @confirm="magnitudeChange"></u-picker>
|
|
<u-picker closeOnClickOverlay :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="showcartype" @cancel="cancel('showcartype')" @close="close('showcartype')" :columns="carTypeList" keyName="name" @confirm="cartypesChange"></u-picker>
|
|
<u-picker closeOnClickOverlay :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="showgrade" @cancel="cancel('showgrade')" @close="close('showgrade')" :columns="getGradeList" keyName="name" @confirm="gradeHandler"></u-picker>
|
|
<!-- <u-picker closeOnClickOverlay :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="showarea" @cancel="cancel('showarea')" @close="close('showarea')" :columns="areaList" keyName="name" @confirm="areaChange"></u-picker> -->
|
|
<!-- 国家选择 -->
|
|
<u-popup closeOnClickOverlay :show="showarea" mode="bottom" :round="10" @close="close('showarea')">
|
|
<view class="text">
|
|
<view class="qx" @click="close('showarea') ">{{$t('cancel')}}</view>
|
|
<view class="qd" @click="arerfn">{{$t('confirm')}}</view>
|
|
</view>
|
|
<view class="popup-content">
|
|
<!-- 搜索框 -->
|
|
<u-input
|
|
v-model="searchKeyword"
|
|
:placeholder="$t('keyword')"
|
|
@input="handleSearch"
|
|
></u-input>
|
|
|
|
<!-- 选项列表 -->
|
|
<scroll-view scroll-y class="option-list">
|
|
<view
|
|
v-for="(item, index) in filteredOptions"
|
|
:key="index"
|
|
class="option-item"
|
|
@click="handleSelect(item)"
|
|
:class="actives==item.id?'actives':''"
|
|
>
|
|
{{ item.name }}
|
|
</view>
|
|
<view v-if="filteredOptions.length === 0" class="no-data">
|
|
{{$t('noresults')}}
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</u-popup>
|
|
<!-- 客户标签 -->
|
|
<u-popup closeOnClickOverlay :show="showtag" mode="bottom" :round="10" title="客户标签" @close="close('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.child" :class="{ 'tagactive': isActive(item1.pid, item1.id) }" @click="tagSelect(item1)" :key="index1">
|
|
{{ item1.name }}
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</u-popup>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import { request,showToast } from '@/api/apiT.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
actives:'',
|
|
activetags:'',
|
|
searchKeyword: "", // 搜索关键词
|
|
selectedLabel: "", // 选中的值(显示在输入框中)
|
|
filteredOptions: [], // 过滤后的数据
|
|
mapUrl: '',
|
|
showtag: false,
|
|
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:'',
|
|
form: {
|
|
contacts: '',
|
|
sex: '0',
|
|
phone: '',
|
|
email: '',
|
|
describe: '',
|
|
grade:'',
|
|
country_id:'',
|
|
car_type_id:'',
|
|
channel_id:'',
|
|
magnitude:'',
|
|
address:'',
|
|
lat:'',
|
|
lng:'',
|
|
},
|
|
location:{},
|
|
activeMap: {}, // 存储每个父级下选中的子项 { 父ID: 子ID }
|
|
taglist:[
|
|
{
|
|
name:'客户价值',
|
|
id:'1',
|
|
child:[
|
|
{name:'高价值',id:1,pid:1},
|
|
{name:'中价值',id:2,pid:1},
|
|
{name:'低价值',id:3,pid:1},
|
|
{name:'潜在高价值',id:4,pid:1},
|
|
]
|
|
},
|
|
{
|
|
name:'生命周期',
|
|
id:'2',
|
|
child:[
|
|
{name:'新客户',id:5,pid:2},
|
|
{name:'活跃',id:6,pid:2},
|
|
{name:'沉默',id:7,pid:2},
|
|
{name:'流失',id:8,pid:2},
|
|
]
|
|
},
|
|
{
|
|
name:'行为标签',
|
|
id:'3',
|
|
child:[
|
|
{name:'高频购买',id:9,pid:3},
|
|
{name:'大单',id:10,pid:3},
|
|
{name:'促销敏感',id:11,pid:3},
|
|
{name:'忠诚',id:12,pid:3},
|
|
]
|
|
},
|
|
{
|
|
name:'需求标签',
|
|
id:'4',
|
|
child:[
|
|
{name:'价格敏感',id:13,pid:4},
|
|
{name:'品质追求',id:14,pid:4},
|
|
{name:'服务',id:15,pid:4},
|
|
{name:'定制化',id:16,pid:4},
|
|
]
|
|
},
|
|
{
|
|
name:'来源标签',
|
|
id:'5',
|
|
child:[
|
|
{name:'线上',id:17,pid:5},
|
|
{name:'线下',id:18,pid:5},
|
|
{name:'推荐',id:19,pid:5},
|
|
{name:'合作伙伴',id:20,pid:5},
|
|
]
|
|
},
|
|
{
|
|
name:'风险标签',
|
|
id:'6',
|
|
child:[
|
|
{name:'高',id:21,pid:6},
|
|
{name:'中',id:22,pid:6},
|
|
{name:'低',id:23,pid:6},
|
|
]
|
|
},
|
|
{
|
|
name:'满意度标签',
|
|
id:'7',
|
|
child:[
|
|
{name:'高',id:24,pid:7},
|
|
{name:'中',id:25,pid:7},
|
|
{name:'低',id:26,pid:7},
|
|
]
|
|
},
|
|
{
|
|
name:'忠诚度标签',
|
|
id:'8',
|
|
child:[
|
|
{name:'高',id:27,pid:8},
|
|
{name:'中',id:28,pid:8},
|
|
{name:'低',id:29,pid:8},
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.getChannel()
|
|
this.getMagnitude()
|
|
this.getGrade()
|
|
this.carType()
|
|
this.area()
|
|
},
|
|
onShow() {
|
|
console.log(uni.getStorageSync('location'))
|
|
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
|
|
console.log(this.location)
|
|
}
|
|
},
|
|
mounted() {
|
|
// this.initMap();
|
|
},
|
|
methods: {
|
|
leftClick(){
|
|
uni.navigateBack({})
|
|
},
|
|
gomap(){
|
|
// #ifdef H5
|
|
uni.navigateTo({
|
|
url: '/pages/customer/maph5'
|
|
});
|
|
// #endif
|
|
// #ifdef APP-PLUS
|
|
uni.navigateTo({
|
|
url: '/pages/customer/map'
|
|
});
|
|
// #endif
|
|
},
|
|
gomap1(){
|
|
uni.navigateTo({
|
|
url: '/pages/customer/map'
|
|
});
|
|
},
|
|
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
|
|
this.filteredOptions = 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
|
|
},
|
|
// 国家搜索处理函数
|
|
handleSearch() {
|
|
if (this.searchKeyword) {
|
|
console.log(this.searchKeyword)
|
|
this.filteredOptions = this.areaList.filter((item) =>
|
|
item.name.includes(this.searchKeyword)
|
|
);
|
|
console.log(this.filteredOptions)
|
|
} else {
|
|
// 如果搜索框为空,显示全部数据
|
|
this.filteredOptions = this.areaList;
|
|
}
|
|
},
|
|
// 选择选项
|
|
handleSelect(item) {
|
|
this.selectedLabel = item.name; // 回显选中的值
|
|
this.actives = item.id
|
|
console.log("选中的值:", item.id);
|
|
console.log("选中的值:", item.name);
|
|
},
|
|
arerfn(){
|
|
this.showarea = false; // 关闭弹窗
|
|
this.country_name = this.selectedLabel
|
|
this.form.country_id = this.actives
|
|
},
|
|
cancel(val){
|
|
this[val] = false
|
|
},
|
|
close(val){
|
|
this[val] = false
|
|
},
|
|
//标签点击
|
|
tagSelect(item) {
|
|
this.$set(this.activeMap, item.pid, item.id);
|
|
},
|
|
isActive(parentId, childId) {
|
|
return this.activeMap[parentId] === childId;
|
|
},
|
|
//提交保存
|
|
saveFn(){
|
|
if(this.form.contacts==''){
|
|
uni.showToast({
|
|
title:this.$t('customer.CustomerNameinput'),
|
|
icon: 'none'
|
|
});
|
|
return false
|
|
}
|
|
console.log(this.form)
|
|
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);
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.u-m-lr-10{
|
|
margin: 0px 10px;
|
|
}
|
|
.placeholder {
|
|
color: #999; /* 占位符颜色 */
|
|
}
|
|
textarea {
|
|
min-height: 200rpx;// 设置默认高度 ,解决设置自适应高度之后高度无效问题
|
|
margin-top: 15px;
|
|
background-color: #F6F6F6;
|
|
padding: 15px;
|
|
border-radius: 10px;
|
|
}
|
|
.uniui-right{
|
|
position: absolute;
|
|
top: 2px;
|
|
}
|
|
.red{
|
|
color: red;
|
|
}
|
|
.content{
|
|
padding-top: 10px;
|
|
}
|
|
.cell{
|
|
position: relative;
|
|
display: flex;
|
|
justify-content:space-between;
|
|
padding: 18px 20px;
|
|
align-items: center;
|
|
font-size: 32rpx;
|
|
font-weight: 500;
|
|
font-size: 32rpx;
|
|
color: #666666;
|
|
.item{
|
|
width: 90px;
|
|
}
|
|
}
|
|
.arrowright{
|
|
margin-right: -15px;
|
|
}
|
|
.cell1{
|
|
font-size: 32rpx;
|
|
padding: 18px 20px;
|
|
align-items: center;
|
|
font-weight: 500;
|
|
color: #666666;
|
|
.item{
|
|
width: 100px;
|
|
}
|
|
}
|
|
.right{
|
|
text-align: right;
|
|
color: #222222;
|
|
}
|
|
.select{
|
|
display: flex;
|
|
position: relative;
|
|
margin-right: 10px;
|
|
}
|
|
.foot{
|
|
position: fixed;
|
|
bottom: 0px;
|
|
width: 100%;
|
|
height: 90px;
|
|
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%;
|
|
}
|
|
.mapcont{
|
|
.header{
|
|
line-height: 50px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
text-align: center;
|
|
.cancel{
|
|
width: 20%;
|
|
color: #999999;
|
|
}
|
|
.confirm{
|
|
width: 20%;
|
|
color: #3471FF;
|
|
}
|
|
}
|
|
.map{
|
|
height: 350px;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
.actives{
|
|
background-color: #dfdfdf;
|
|
}
|
|
.text{
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
line-height: 30px;
|
|
padding: 10px 15px 0px;
|
|
.qd{
|
|
color: #3471FF;
|
|
}
|
|
}
|
|
.popup-content {
|
|
padding: 20px;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.option-list {
|
|
max-height: 400rpx;
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.option-item {
|
|
padding: 20rpx;
|
|
border-bottom: 1rpx solid #eee;
|
|
}
|
|
|
|
.option-item:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.no-data {
|
|
text-align: center;
|
|
padding: 20rpx;
|
|
color: #999;
|
|
}
|
|
|
|
// 标签弹框
|
|
.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;
|
|
padding: 5px 0px;
|
|
}
|
|
.row{
|
|
width: 100%;
|
|
}
|
|
.col4{
|
|
display: inline-block;
|
|
margin: 4px 3px;
|
|
width: 30%;
|
|
}
|
|
}
|
|
.tagactive{
|
|
background: #3471FF !important;
|
|
color: #fff !important;
|
|
}
|
|
|
|
</style>
|