名片部分页面。地图定位。国家下拉搜索 回收站

This commit is contained in:
浅念
2025-03-25 13:12:24 +08:00
parent f7ff9d65a5
commit e3abe0bf18
18 changed files with 747 additions and 606 deletions
+152
View File
@@ -0,0 +1,152 @@
<template>
<view>
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000"
backgroundColor="#fff" :statusBar="true" :title="$t('navbar.businesscard')"></uni-nav-bar>
<view class="card">
<view class="img_top" ref="poster" id="poster">
<view class="name">
<view>刘亦菲</view>
<view>业务经理</view>
<view>13838225452</view>
</view>
<!-- <view class="code" :class=" activeImg === share_one ? 'code_one' : activeImg === share_two ? 'code_two' : activeImg === share_three ? 'code_three' : 'code_one'">
<qrcode-vue :value="codeUrl" :size="70"></qrcode-vue>
</view> -->
</view>
</view>
<view class="foot">
<button class="btn" @click="goDown">{{$t('submit')}}</button>
</view>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
import html2canvas from 'html2canvas';
export default {
data() {
return {
}
},
methods: {
saveImgFile(baseImg){
const bitmap = new plus.nativeObj.Bitmap('test')
bitmap.loadBase64Data(
baseImg,
function () {
const url = '_doc/' + new Date().getTime() + '.png' // url为时间戳命名方式
bitmap.save(
url,
{
overwrite: true // 是否覆盖
},
i => {
plus.gallery.save(
i.target,
function () {
uni.showToast({
title: '图片保存至相册成功',
icon: 'none'
});
bitmap.clear()
},
function (e) {
uni.showToast({
title: '图片保存至相册失败',
icon: 'none'
});
// console.log('图片保存至相册失败:' + JSON.stringify(e))
bitmap.clear()
}
)
},
e => {
uni.showToast({
title: '图片保存失败1',
icon: 'none'
});
bitmap.clear()
}
)
},
e => {
uni.showToast({
title: '图片保存失败2',
icon: 'none'
});
bitmap.clear()
}
)
},
downloadImage(url, filename) {
// 创建一个隐藏的 <a> 标签
const link = document.createElement('a');
link.href = url;
link.download = filename;
// 触发点击事件
link.click();
},
goDown(){
const element = document.getElementById('poster');
var that= this
html2canvas(element, {
backgroundColor: '#f5f5f5', //海报的背景颜色
useCORS: true // 允许跨域
}).then(canvas => {
// canvas 其实就是我们所讲的res 的意思 返回报文的意思
let baseImg = canvas.toDataURL('image/png')
uni.showModal({
title: '下载名片',
content: '确定下载当前名片图至相册嘛',
success: function (res) {
if (res.confirm) {
that.downloadImage(baseImg, 'screenshot.png');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
})
}
}
}
</script>
<style lang="scss">
.card{
padding: 15px;
}
.img_top{
background-image: url('/static/image/mine/cardbg.png');
background-size: 100% 100%;
background-repeat: no-repeat;
text-align: center;
position: relative;
width:690rpx;
height:1060rpx;
border-radius: 15px;
.name{
position: absolute;
top: 20%;
left: 10%;
}
}
.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%;
}
</style>
+109 -19
View File
@@ -57,7 +57,7 @@
<u-divider text=""></u-divider>
<view class="cell1">
<view class="item">{{$t('customer.Country')}}</view>
<view class="right select" @click="showarea = true">
<view class="right select" @click="showPicker = true">
<view class="" :class="['content2', { placeholder: !country_name }]">{{country_name || $t('customer.Countryinput')}}</view>
<u-icon class="arrowright" name="arrow-right" size="18" color="#747474"></u-icon>
</view>
@@ -66,16 +66,52 @@
<view class="foot">
<button class="btn" @click="bcFn">{{$t('save')}}</button>
</view>
<u-picker closeOnClickOverlay :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :defaultIndex="defaultIndexgj" :show="showarea" @cancel="cancel('showarea')" @close="close('showarea')" :columns="areaList" keyName="name" @confirm="areaChange"></u-picker>
<u-picker closeOnClickOverlay :cancel-text="$t('cancel')" :confirm-text="$t('confirm')" :defaultIndex="defaultIndexgs" :show="showcomp" @cancel="cancel('showcomp')" @close="close('showcomp')" :columns="company" keyName="name" @confirm="companyChange"></u-picker>
<u-popup closeOnClickOverlay :show="showPicker" mode="bottom" :round="10" @close="close('showPicker')">
<view class="text">
<view class="qx" @click="close('showPicker') ">{{$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>
</view>
</template>
<script>
import { nextTick } from "vue"
import { request,showToast } from '@/api/apiT.js'
export default {
data() {
return {
loca:uni.getLocale(),
actives:'',
showPicker: false, // 控制选择器显示
searchKeyword: "", // 搜索关键词
selectedLabel: "", // 选中的值(显示在输入框中)
filteredOptions: [], // 过滤后的数据
showarea: false,
showcomp: false,
country_name:'',
@@ -83,8 +119,6 @@
areaList:[],
defaultIndexgj:[0],
company_name:'',
company:[],
company1:[],
defaultIndexgs:[0],
imageStyles: {
border: true,
@@ -99,6 +133,34 @@
this.getinfo()
},
methods: {
// 搜索处理函数
handleSearch() {
var that = this
if (this.searchKeyword) {
console.log(this.searchKeyword)
this.filteredOptions = this.areaList1.filter((item) => item.name.includes(this.searchKeyword));
console.log(this.filteredOptions)
} else {
// 如果搜索框为空,显示全部数据
this.filteredOptions = this.areaList1;
}
},
// 选择选项
handleSelect(item) {
this.selectedLabel = item.name; // 回显选中的值
// this.searchKeyword = item.name
this.actives = item.id
// this.showPicker = false; // 关闭弹窗
console.log("选中的值:", item.id);
console.log("选中的值:", item.name);
},
arerfn(){
this.showPicker = false; // 关闭弹窗
this.country_name = this.selectedLabel
this.userinfo.country_id = this.actives
},
getinfo(){
var that= this;
request({
@@ -109,19 +171,13 @@
res.data.data.position=''
}
that.userinfo = res.data.data;
this.actives = res.data.data.country_id
this.country_name = res.data.data.country_name
that.select1()
})
},
select1(){
var that=this;
that.areaList1.forEach((item,index) => {
if(item.id == that.userinfo.country_id){
that.country_name = item.name
that.defaultIndexgj=[index]
console.log(that.country_name)
}
})
that.company1.forEach((item,index) => {
if(item.id == that.userinfo.sign){
that.company_name = item.name
@@ -129,12 +185,6 @@
}
})
},
//国家切换事件
areaChange(val){
this.userinfo.country_id = val.value[0].id
this.country_name = val.value[0].name
this.showarea = false
},
//国家
area(){
request({
@@ -143,7 +193,7 @@
}).then(res => {
var list = res.data.data
this.areaList1 = list
this.areaList = [list]
this.filteredOptions = list;
this.select1()
})
},
@@ -311,4 +361,44 @@
height: 35px;
border-radius: 50%;
}
//
.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;
}
</style>
+36 -55
View File
@@ -7,25 +7,9 @@
</template>
<view class="contents" >
<view class="colls" v-for="(item, index) in datalist" :key="index" >
<view class="" @click="detileClick(item)">
<view class="top">
<view class="name">{{item.contacts}}</view>
<view class="right">
<text class="medal" :style="{color:(item.magnitude == 0 ?'#F5AB00' : item.magnitude == 1 ?'#8495B8': '#9B7200')}">{{item.magnitude_txt}}</text>
</view>
</view>
<u-line margin="20rpx 0px" color="#fff" :hairline="false"></u-line>
<view class="cont">
<view class="title">
<view class=""><text class="name">{{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="edt">
<view class="btn" @click="editFn"><text> {{$t('mine.restore')}}</text></view>
<view class="cont">
<view class=""><text class="name">{{item.contacts}}</text><text>{{item.phone}}</text></view>
<view class="btn" @click="restoreFn(item)"><text> {{$t('mine.restore')}}</text></view>
</view>
</view>
</view>
@@ -51,6 +35,7 @@
data: {
page:pageNo,
per_page:10,
recycle:'recycle'
}
}).then(res => {
console.log(res.data)
@@ -58,15 +43,38 @@
var datas = res.data.data.list;
this.$refs.paging.complete(datas);
}else{
// this.$refs.paging.complete(null);
// that.listlength=0
}
uni.stopPullDownRefresh();
})
},
detileClick(item){
uni.navigateTo({
url: '/pages/mine/recyclebindetil?id='+item.id
restoreFn(item){
var that=this
uni.showModal({
title: this.$t('prompt'),
content: this.$t('restoremsg'),
success: function (res) {
if (res.confirm) {
request({
url:'customer/restore',
method:'post',
data: {
id:item.id,
}
}).then(res => {
uni.showToast({
title: res.data.message,
icon: 'none'
});
if(res.data.code ==0){
setTimeout(() => {
that.queryList(1, 10)
}, 1000);
}
})
} else if (res.cancel) {
}
}
});
}
}
@@ -95,39 +103,12 @@
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;
}
}
.edt{
padding: 15px 12px;
font-size: 28rpx;
display: flex;
justify-content: right;
padding-bottom: 10px;
padding-right: 15px;
align-items: center;
justify-content: space-between;
}
.btn{
background: linear-gradient(to right, #3471FF, #6776FF);
color: white;
-333
View File
@@ -1,333 +0,0 @@
<template>
<view>
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" :title="$t('details')"></uni-nav-bar>
<view class="content">
<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>
</view>
</view>
<u-line margin="20rpx 0px" color="#fff" :hairline="false"></u-line>
<view class="cont">
<view class="title">
<view class=""><text class="name">{{datas.phone}}</text></view>
<view class="ststus">渠道:{{datas.channel_name}}</view>
</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>
<view v-if="datas.email!=''">Email: {{datas.email}}</view>
<view v-if="datas.WhatsApp!=''">WhatsAPP: {{datas.WhatsApp}}</view>
<view v-if="datas.address!=''">公司: {{datas.address}}</view>
<view v-if="datas.describe!=''">备注: {{datas.describe}}</view>
</view>
</view>
<view class="cell">
<view class="item">{{$t('customer.Cstomerfj')}}</view>
<view class="right select">
<view class="" :class="['content2', { placeholder: !datas.grade_txt }]">{{datas.grade_txt || $t('customer.Cstomerfjinput')}}</view>
</view>
</view>
</view>
<u-gap height="10" bgColor="#F6F6F6"></u-gap>
<view class="steps">
<view class="title">
<view class="">
{{$t('customer.followrecord')}} <text class="status" :style="{color:(datas.follow == 0 ?'#3471FF' : datas.follow == 1 ?'#27C89C': '#FF4040')}">{{datas.follow_txt}}</text>
</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="">
{{$t('times')}} :{{item.created_at}}
</view>
<view class="">{{$t('address')}}:{{item.address}}</view>
<view class="">{{$t('customer.Visitcontent')}}:{{item.audio_text}}</view>
</view>
<view class="">
<image :src="item.oss_picture" mode=""></image>
</view>
</view>
<view class="" v-else>
<view class="">
{{$t('times')}}:{{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">{{$t('mine.restore')}}</button>
</view>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
export default {
data() {
return {
id:'',
followList:[],
grade_name:'',
form: {
grade:'',
},
datas:''
}
},
onLoad(options) {
console.log(options);
this.id = options.id;
var that = this
this.customerdetailfn()
},
onShow() {
this.followlistfn()
},
methods: {
leftClick(){
uni.navigateBack({})
},
gomap(){
uni.navigateTo({
url: '/pages/customer/map'
});
},
//客户详情
customerdetailfn(){
var that=this;
request({
url:'customer/detail',
method:'get',
data: {
id:this.id,
}
}).then(res => {
that.datas = res.data.data
that.form = 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)
})
},
nextFn(){
// 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;
}
.red{
color: red;
}
.zw{
height: 120px;
}
.uniui-right{
position: absolute;
top: 2px;
}
.cell{
position: relative;
display: flex;
justify-content:space-between;
padding: 18px 20px;
align-items: center;
font-weight: 500;
.item{
width: 90px;
color: #666666;
}
background: #f6f6f6;
border-radius: 10px;
}
.arrowright{
margin-right: -15px;
}
.right{
text-align: right;
}
.select{
display: flex;
position: relative;
margin-right: 10px;
}
.content{
padding: 10px 15px;
background: #FFFFFF;
.contents{
background-color:#F6F6F6;
border-radius: 10px;
margin-bottom: 10px;
.edt{
display: flex;
justify-content: right;
padding-bottom: 10px;
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;
}
}
.name{
font-size: 32rpx;
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;
}
}
}
}
.steps{
padding: 15px;
background: #fff;
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;
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>