467 lines
11 KiB
Vue
467 lines
11 KiB
Vue
<template>
|
|
<view class="conts">
|
|
<z-paging ref="paging" v-model="datalist" @query="queryList" :empty-view-text="$t('Nodata')">
|
|
<template #top>
|
|
<view class="top">
|
|
<!-- <view class="navbar">{{$t('customer.title')}}</view> -->
|
|
<uni-nav-bar leftText=" " :fixed="true" :border="false" @clickLeft="leftClick" color="#fff" backgroundColor="#3471ff" :statusBar="true" :title="$t('customer.title')"></uni-nav-bar>
|
|
|
|
<view class="topSearch">
|
|
<view class="left">
|
|
<u-search v-model="keyword" bgColor="#fff" search-icon=" " :show-action="false" :placeholder="$t('customer.inputhd')"></u-search>
|
|
<view @click="searchCli" class="search">
|
|
<image src="/static/image/customer/search1.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<view class="right">
|
|
<image src="/static/image/customer/search.png" @click="show = true" mode=""></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tabsbg">
|
|
<u-tabs :list="list1" :current="current" lineColor="#fff" :scrollable="false" @click="tabclick" :inactiveStyle="{color: '#fff'}" :activeStyle="{color: '#fff',fontWeight: '500',transform: 'scale(1.05)'}"></u-tabs>
|
|
</view>
|
|
</template>
|
|
<view class="list">
|
|
<u-swipe-action>
|
|
<u-swipe-action-item :options="options1" v-for="(item, index) in datalist" :key="index" @click="delClick(item)">
|
|
<view class="contents" >
|
|
<view class="" @click="godetile(item)">
|
|
<view class="top">
|
|
<view class="">{{item.created_at}}</view>
|
|
<view class="right">
|
|
<text class="medal" :style="{color:(item.magnitude == 0 ?'#F5AB00' : item.magnitude == 1 ?'#8495B8': '#9B7200')}">{{item.magnitude_txt}}</text>
|
|
<text class="tag" :style="{background:(item.follow == 0 ?'#3471FF' : item.follow == 1 ?'#27C89C': '#FF4040')}">{{item.follow==0?$t('followup'):item.follow==1?$t('deal'):$t('lost')}}</text>
|
|
</view>
|
|
</view>
|
|
<u-line margin="20rpx 0px"></u-line>
|
|
<view class="cont">
|
|
<view class="title">
|
|
<view class=""><text class="name">{{item.contacts}}</text><text class="phone">{{item.phone}}</text></view>
|
|
<view class="ststus">{{item.grade_txt}}</view>
|
|
</view>
|
|
<view class="info"><text class="sex">{{item.sex_txt}}</text> | <text class="addr">{{item.country_name}}</text><text class="type">{{item.car_type_name}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="desc1">
|
|
<view class="" @click="callPhone(item)"><image src="/static/image/customer/phone.png" mode=""></image> {{$t('call')}}</view>
|
|
<view class="" @click="editClick(item)"><image src="/static/image/customer/edit.png" mode=""></image> {{$t('customer.addfollow')}}</view>
|
|
<!-- <view class="" @click="delClick(item)"><image src="/static/image/customer/trash.png" mode=""></image> {{$t('delete')}}</view> -->
|
|
</view>
|
|
</view>
|
|
</u-swipe-action-item>
|
|
</u-swipe-action>
|
|
</view>
|
|
</z-paging>
|
|
<u-picker closeOnClickOverlay :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :show="show" :columns="columns" @cancel="cancel" @close="cancel" @confirm="confirm" :title="$t('customer.CustomerScreening')" keyName="label"></u-picker>
|
|
<u-popup :show="showts" :closeOnClickOverlay="false" :round="20" mode="center">
|
|
<view class="popupcontent">
|
|
<view class="title">{{$t('prompt')}}</view>
|
|
<view class="text">
|
|
{{$t('deletemsg')}}
|
|
</view>
|
|
</view>
|
|
<view class="cent">
|
|
<view class="btn1" @click="showts = !showts">{{$t('cancel')}}</view>
|
|
<view class="btn" @click="delfn()">{{$t('confirm')}}</view>
|
|
</view>
|
|
</u-popup>
|
|
<movable-area class="movable-area">
|
|
<movable-view class="movable-view" :x="x" :y="y" direction="all">
|
|
<view class="index" @tap="addcustomer">
|
|
<image src="/static/image/customer/add.png" mode="widthFix">
|
|
</view>
|
|
</movable-view>
|
|
</movable-area>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { request,showToast } from '@/api/apiT.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
current:0,
|
|
options1: [],
|
|
x: 300, //x坐标
|
|
y: 550, //y坐标
|
|
keyword:'',
|
|
follow_last:'',
|
|
follow:'',
|
|
show:false,
|
|
showts:false,
|
|
del_id:'',
|
|
columns:[],
|
|
list1: [],
|
|
datalist:[],
|
|
}
|
|
},
|
|
onLoad(e) {
|
|
console.log(e)
|
|
if(e.tab){
|
|
this.follow=e.tab - 1
|
|
this.current = e.tab
|
|
this.datalist=[]
|
|
// this.queryList(1, 10)
|
|
}
|
|
const { windowWidth, windowHeight } = uni.getSystemInfoSync();
|
|
this.x = windowWidth-70
|
|
this.y = windowHeight-55
|
|
uni.removeStorageSync('location')
|
|
},
|
|
onShow() {
|
|
this.queryList(1, 10)
|
|
this.options1=[{
|
|
text: this.$t('delete'),
|
|
style: {
|
|
backgroundColor: '#f56c6c'
|
|
}
|
|
}]
|
|
this.list1=[{
|
|
name: this.$t('all'),
|
|
id:'all'
|
|
}, {
|
|
name: this.$t('followup'),
|
|
id:'followup'
|
|
}, {
|
|
name: this.$t('deal'),
|
|
id:'deal'
|
|
}, {
|
|
name: this.$t('lost'),
|
|
id:'lost'
|
|
}]
|
|
this.columns=[
|
|
[{
|
|
label: this.$t('all'),
|
|
id:''
|
|
},{
|
|
label:this.$t('tday'),
|
|
id: 0
|
|
}, {
|
|
label: this.$t('threeday'),
|
|
id: 1
|
|
}, {
|
|
label: this.$t('sevenday'),
|
|
id: 2
|
|
}]
|
|
]
|
|
uni.setTabBarItem({
|
|
index: 0,
|
|
text: this.$t('tabbar.home')
|
|
})
|
|
uni.setTabBarItem({
|
|
index: 1,
|
|
text: this.$t('tabbar.highseas')
|
|
})
|
|
uni.setTabBarItem({
|
|
index: 2,
|
|
text: this.$t('tabbar.customer')
|
|
})
|
|
uni.setTabBarItem({
|
|
index: 3,
|
|
text: this.$t('tabbar.mine')
|
|
})
|
|
},
|
|
methods: {
|
|
searchCli(){
|
|
this.queryList(1, 10)
|
|
},
|
|
close() {
|
|
this.show= false
|
|
},
|
|
confirm(e) {
|
|
console.log(e)
|
|
this.follow_last = e.value[0].id
|
|
this.show = false
|
|
this.queryList(1, 10)
|
|
},
|
|
cancel() {
|
|
this.show = false
|
|
},
|
|
//tab标签切换
|
|
tabclick(e){
|
|
console.log(e)
|
|
if(e.id=='all'){
|
|
this.follow=''
|
|
}else{
|
|
this.follow=e.index - 1
|
|
}
|
|
this.datalist=[]
|
|
this.queryList(1, 10)
|
|
},
|
|
//客户列表数据
|
|
queryList(pageNo, pageSize) {
|
|
var that = this;
|
|
request({
|
|
url:'customer/list',
|
|
method:'get',
|
|
data: {
|
|
follow:this.follow,
|
|
page:pageNo,
|
|
per_page:10,
|
|
keyword:this.keyword,
|
|
follow_last:this.follow_last,
|
|
}
|
|
}).then(res => {
|
|
console.log(res.data)
|
|
if(res.data.code ==0){
|
|
var datas = res.data.data.list;
|
|
this.$refs.paging.complete(datas);
|
|
}else{
|
|
// this.$refs.paging.complete(null);
|
|
// that.listlength=0
|
|
}
|
|
uni.stopPullDownRefresh();
|
|
})
|
|
},
|
|
godetile(item){
|
|
console.log(item)
|
|
uni.navigateTo({
|
|
url: '/pages/customer/detile?id='+item.id
|
|
});
|
|
},
|
|
// 拨打电话
|
|
callPhone(item) {
|
|
var phoneNumber= item.phone
|
|
if (!phoneNumber) {
|
|
uni.showToast({
|
|
title: this.$t('callPhonemsg'),
|
|
icon: 'none',
|
|
});
|
|
return;
|
|
}
|
|
|
|
uni.makePhoneCall({
|
|
phoneNumber: phoneNumber,
|
|
success: () => {
|
|
console.log('拨打电话成功');
|
|
},
|
|
fail: (err) => {
|
|
console.log('拨打电话失败', err);
|
|
},
|
|
});
|
|
},
|
|
editClick(item){
|
|
uni.navigateTo({
|
|
url: '/pages/customer/followup?id='+item.id
|
|
});
|
|
},
|
|
delClick(item){
|
|
this.del_id = item.id
|
|
this.showts=true
|
|
},
|
|
delfn(){
|
|
this.showts=false
|
|
request({
|
|
url:'customer/delete',
|
|
method:'get',
|
|
data: {
|
|
id:this.del_id,
|
|
}
|
|
}).then(res => {
|
|
uni.showToast({
|
|
title: res.data.message,
|
|
icon: 'none'
|
|
});
|
|
if(res.data.code ==0){
|
|
setTimeout(() => {
|
|
uni.reLaunch({
|
|
url: '/pages/index/customer',// 替换为你要跳转的页面路径
|
|
});
|
|
}, 1000);
|
|
}
|
|
})
|
|
},
|
|
addcustomer(){
|
|
uni.navigateTo({
|
|
url: '/pages/customer/add'
|
|
});
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
uni-page-body {
|
|
background-color: #F6F6F6 !important;
|
|
}
|
|
.u-swipe-action-item {
|
|
margin-bottom: 10px;
|
|
border-radius: 10px;
|
|
}
|
|
.conts{
|
|
background-image: url("/static/image/customer/bg.png");
|
|
background-size: 100%;
|
|
background-repeat: no-repeat;
|
|
height: calc(100vh - 50px);
|
|
}
|
|
.navbar{
|
|
/* #ifdef APP-PLUS */
|
|
// padding-top: 20px;
|
|
/* #endif */
|
|
height: 44px;
|
|
line-height: 44px;
|
|
text-align: center;
|
|
color: #fff;
|
|
font-size: 32rpx;
|
|
}
|
|
.topSearch {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 10px 15px 5px;
|
|
.left {
|
|
position: relative;
|
|
width: 88%;
|
|
}
|
|
|
|
.right {
|
|
flex: 1;
|
|
text-align: right;
|
|
image{
|
|
width: 24px;
|
|
height: 20px;
|
|
margin-top: 5px;
|
|
}
|
|
}
|
|
.search{
|
|
background: linear-gradient(to right, #3471FF, #6776FF);
|
|
color: white;
|
|
border-radius: 20px;
|
|
padding: 6px 16px 2px;
|
|
text-align: center;
|
|
position: absolute;
|
|
/* #ifdef APP-PLUS */
|
|
top: 3px;
|
|
/* #endif */
|
|
top: 2px;
|
|
right: 5px;
|
|
font-size: 12px;
|
|
image{
|
|
width: 16px;
|
|
height: 16px;
|
|
|
|
}
|
|
}
|
|
}
|
|
.list{
|
|
padding: 15px;
|
|
overflow: auto;
|
|
// height: calc(100vh - 350rpx);
|
|
.contents{
|
|
background-color: #FFFFFF;
|
|
border-radius: 10px;
|
|
margin-bottom: 10px;
|
|
.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;
|
|
}
|
|
}
|
|
}
|
|
.cont{
|
|
padding: 0px 15px 10px;
|
|
font-size: 24rpx;
|
|
.title{
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
color: #222222;
|
|
.name{
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
margin-right: 10px;
|
|
}
|
|
.phone{
|
|
font-size: 28rpx;
|
|
}
|
|
}
|
|
.ststus{
|
|
color: #666666;
|
|
}
|
|
.info,.desc{
|
|
color: #78758E;
|
|
line-height: 26px;
|
|
}
|
|
.sex{
|
|
margin-right: 5px;
|
|
}
|
|
.addr{
|
|
margin-left: 5px;
|
|
}
|
|
.type{
|
|
margin-left: 5px;
|
|
color: #3471FF;
|
|
}
|
|
}
|
|
}
|
|
.desc1{
|
|
padding: 0px 15px 10px;
|
|
color: #3471FF;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
view{
|
|
margin-left:15px;
|
|
}
|
|
image{
|
|
width: 14px;
|
|
height: 14px;
|
|
// vertical-align: sub;
|
|
margin-right: 5px;
|
|
}
|
|
}
|
|
}
|
|
.popupcontent{
|
|
text-align: center;
|
|
padding: 10px 40px 20px;
|
|
.title{
|
|
font-size: 18px;
|
|
color: #333333;
|
|
line-height: 60px;
|
|
}
|
|
.text{
|
|
color: #666666;
|
|
font-size: 16px;
|
|
}
|
|
}
|
|
.cent{
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-around;
|
|
padding: 0px 10px 20px;
|
|
text-align: center;
|
|
.btn1{
|
|
background-color: #F6F6F6;
|
|
border: 1px solid #F6F6F6;
|
|
color: #333333;
|
|
border-radius: 50px;
|
|
width: 46%;
|
|
margin: 10px 0px 20px;
|
|
height: 40px;
|
|
line-height: 40px;
|
|
}
|
|
.btn{
|
|
background-color: #3471FF;
|
|
color: white;
|
|
border-radius: 50px;
|
|
width: 46%;
|
|
margin: 10px 0px 20px;
|
|
height: 40px;
|
|
line-height: 40px;
|
|
}
|
|
}
|
|
|
|
</style>
|