APP-活动报告,签到打卡页面功能实现。
This commit is contained in:
270
src/pages/business/CRM/map/addRearkSignIn.vue
Normal file
270
src/pages/business/CRM/map/addRearkSignIn.vue
Normal file
@@ -0,0 +1,270 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<!-- 头部 -->
|
||||
<customHeader ref="customHeaderRef" :title="'签到打卡'" :leftFlag="true" :rightFlag="false"></customHeader>
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height" :style="{ paddingTop: navBarPaddingTop + 'px' }"></view>
|
||||
|
||||
<view class="inner-box">
|
||||
<view class="cu-form-group">
|
||||
<textarea v-model="form.remark" placeholder="请输入签到备注内容" name="input"></textarea>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<button type="primary" @click="addInsertMapClockIn">签到</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { addStartMap } from '../../../../api/crm/activity/map';
|
||||
import { dateFormat } from '../../../../utils/formatter';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { getNavBarPaddingTop } from '@/utils/system.js'
|
||||
let form = reactive({
|
||||
addressForStart: null,
|
||||
addressForEnd: null,
|
||||
createId: null,
|
||||
staffName: null,
|
||||
visistCode: null,
|
||||
visistId: null,
|
||||
mapId: null,
|
||||
remark: null
|
||||
})
|
||||
|
||||
// 获取导航栏高度用于内容区域padding
|
||||
const navBarPaddingTop = ref(0);
|
||||
onMounted(() => {
|
||||
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
|
||||
})
|
||||
|
||||
onLoad(option => {
|
||||
form.visistId = option.visistId
|
||||
let date = new Date();
|
||||
form.craeteTime = dateFormat("YYYY-mm-dd", date)
|
||||
})
|
||||
|
||||
function addInsertMapClockIn() {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: (res) => {
|
||||
const latiude = res.latitude; //纬度
|
||||
const longitude = res.longitude; //经度
|
||||
//进行解析
|
||||
inverseGeocoding(latiude, longitude);
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log("获取地址失败" + err)
|
||||
}
|
||||
})
|
||||
}
|
||||
function isWithinRange(lat, lon, centerLat, centerLon, rangeKm) {
|
||||
const distance = haversineDistance(centerLat, centerLon, lat, lon);
|
||||
return distance <= rangeKm;
|
||||
}
|
||||
function haversineDistance(lat1, lon1, lat2, lon2, radius = 6371) {
|
||||
const dLat = degToRad(lat2 - lat1);
|
||||
const dLon = degToRad(lon2 - lon1);
|
||||
const a =
|
||||
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
||||
Math.cos(degToRad(lat1)) * Math.cos(degToRad(lat2)) *
|
||||
Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
||||
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
return radius * c; // 距离,单位:公里
|
||||
}
|
||||
function degToRad(deg) {
|
||||
return deg * (Math.PI / 180);
|
||||
}
|
||||
function inverseGeocoding(latiude, longitude) {
|
||||
let points = longitude + ',' + latiude
|
||||
//URL
|
||||
const apiURL = 'https://tiles.geovisearth.com/geo/v1/geocode/regeo';
|
||||
const params = {
|
||||
lat: latiude,
|
||||
lng: longitude,
|
||||
radius: 1000,
|
||||
pageSize: 1,
|
||||
currentPage: 1,
|
||||
};
|
||||
const token = '66c87c897f0251295afdc794e4fbf73046a070338a726fe04f06cece6cb1ffdf';
|
||||
uni.request({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
data: params,
|
||||
header: {
|
||||
'Authorization': 'Bearer ' + token
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.statusCode == 200 && res.data.status == 200) {
|
||||
let resdata = res.data.data.rows[0].address
|
||||
if (resdata == null) {
|
||||
const latiude1 = ref(34.1360);
|
||||
const longitude1 = ref(108.9126);
|
||||
if (isWithinRange(latiude1.value, longitude1.value, latiude, longitude, 1)) {
|
||||
form.addressForStart = "西安办事处位置签到"
|
||||
uni.showModal({
|
||||
title: '确定要在此处签到吗',
|
||||
content: form.addressForStart,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
var data = {
|
||||
mapId: form.mapId,
|
||||
addressForStart: form.addressForStart,
|
||||
cusName: form.cusName,
|
||||
cusId: form.cusId,
|
||||
remark: form.remark,
|
||||
path: longitude1 + "," + latiude1
|
||||
}
|
||||
addStartMap(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: res.msg,
|
||||
duration: 1500,
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack(1)
|
||||
}, 500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg,
|
||||
});
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
form.addressForStart = resdata;
|
||||
uni.showModal({
|
||||
title: '确定要在此处签到吗',
|
||||
content: form.addressForStart,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
var data = {
|
||||
mapId: form.mapId,
|
||||
addressForStart: form
|
||||
.addressForStart,
|
||||
cusName: form.cusName,
|
||||
cusId: form.cusId,
|
||||
remark: form.remark,
|
||||
path: points
|
||||
}
|
||||
addStartMap(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: res.msg,
|
||||
duration: 1500,
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack(1)
|
||||
}, 500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg,
|
||||
});
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
form.addressForStart = "第三方维护签到"
|
||||
uni.showModal({
|
||||
title: '确定要在此处签到吗',
|
||||
content: form.addressForStart,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
var data = {
|
||||
mapId: form.mapId,
|
||||
addressForStart: form.addressForStart,
|
||||
cusName: form.cusName,
|
||||
cusId: form.cusId,
|
||||
path: points
|
||||
}
|
||||
addStartMap(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '第三方维护签到',
|
||||
duration: 1500,
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg,
|
||||
});
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(e) {
|
||||
console.log("获取位置失败", e)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.con-bg {
|
||||
background: white;
|
||||
}
|
||||
|
||||
/* Container for the checkbox group */
|
||||
.checkbox-group.block {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Each item row */
|
||||
.itemClass {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 0;
|
||||
margin-left: 15rpx;
|
||||
border-bottom: 1px solid #eee;
|
||||
/* optional divider */
|
||||
}
|
||||
|
||||
/* Checkbox styling */
|
||||
.checkBoxClass {
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
/* Content container */
|
||||
.clientClass {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
font-size: 36rpx;
|
||||
color: #333;
|
||||
/* default text color */
|
||||
}
|
||||
|
||||
/* Blue username text */
|
||||
.blue-text {
|
||||
/* or any blue you prefer */
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
</style>
|
||||
164
src/pages/business/CRM/map/checkInView.vue
Normal file
164
src/pages/business/CRM/map/checkInView.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<!-- 头部 -->
|
||||
<customHeader ref="customHeaderRef" :title="'考勤查看'" :leftFlag="true" :rightFlag="false"></customHeader>
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height" :style="{ paddingTop: navBarPaddingTop + 'px' }"></view>
|
||||
|
||||
<!-- 正文内容 -->
|
||||
<view>
|
||||
<!-- 搜索 -->
|
||||
<view class="search">
|
||||
<picker mode="date" :value="defaultDate" :start="startDate" :end="endDate" @change="bindDateChange"
|
||||
class="picker-bg">
|
||||
<view class="picker">
|
||||
<uni-icons custom-prefix="iconfont" color="#ffffff" type="icon-phoneshizhong"
|
||||
size="18"></uni-icons>
|
||||
<view>{{ defaultDate }}</view>
|
||||
<uni-icons type="down" size="18"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
<button type="default" @click="handleSearch" size="mini" class="btn-search">查询</button>
|
||||
</view>
|
||||
|
||||
<!-- 分页部分 -->
|
||||
<view class="white-bg margin-bottom20" v-for="(item, index) in list">
|
||||
<view class="report-list" >
|
||||
<view class="title"
|
||||
:style="{color: item.mapType == 1 ? '#F5813A' : '#1989FA'}"
|
||||
>类型:{{ item.mapType == 1 ? '签到' : '打卡' }}</view>
|
||||
<view class="r-list">
|
||||
<view class="r-left">开始签到时间</view>
|
||||
<view class="r-right">{{ item.goVisistStartTime }}</view>
|
||||
</view>
|
||||
<view class="border-bottom"></view>
|
||||
<view class="r-list">
|
||||
<view class="r-left">开始签到地点</view>
|
||||
<view class="r-right">{{ item.addressForStart }}</view>
|
||||
</view>
|
||||
<view class="border-bottom"></view>
|
||||
<view class="r-list">
|
||||
<view class="r-left">结束签到时间</view>
|
||||
<view class="r-right">{{ item.goVisistEndTime }}</view>
|
||||
</view>
|
||||
<view class="border-bottom"></view>
|
||||
<view class="r-list">
|
||||
<view class="r-left">结束签到地点</view>
|
||||
<view class="r-right">{{ item.addressForEnd }}</view>
|
||||
</view>
|
||||
<view class="r-list" v-if="item.remark != null">
|
||||
<view class="r-left">备注内容</view>
|
||||
<view class="r-right">{{ item.remark }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import { getNavBarPaddingTop } from '@/utils/system.js'
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { getDate } from '@/utils/datetime.js'
|
||||
import { CheckInInformationViewing } from '../../../../api/crm/activity/map';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
const navBarPaddingTop = ref(0);
|
||||
onMounted(() => {
|
||||
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
|
||||
})
|
||||
|
||||
// 开始时间
|
||||
let startDate = getDate('start');
|
||||
// 结束时间,间隔10年
|
||||
let endDate = getDate('end');
|
||||
let defaultDate = getDate({ format: true })
|
||||
let bindDateChange = (e) => {
|
||||
defaultDate = e.detail.value
|
||||
}
|
||||
|
||||
//获取list集合信息
|
||||
let list = ref([])
|
||||
function getList() {
|
||||
CheckInInformationViewing().then(res => {
|
||||
list.value = res.rows
|
||||
})
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.search {
|
||||
display: flex;
|
||||
margin-bottom: 30rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.search .btn-search {
|
||||
border: none;
|
||||
background: none;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
/* 调整为更合适的字号 */
|
||||
font-weight: normal;
|
||||
/* 如果不需要加粗,可以去掉 bolder */
|
||||
margin-left: 0rpx;
|
||||
padding: 0 20rpx;
|
||||
/* 调整 padding,去掉 padding-top */
|
||||
height: 56rpx;
|
||||
/* 固定高度,确保与 picker 对齐 */
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.search .btn-search::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.search .picker-bg {
|
||||
display: flex;
|
||||
background-color: #6FA2F8;
|
||||
border-radius: 25px;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
padding: 0rpx 20rpx;
|
||||
/* #ifndef APP-PLUS */
|
||||
padding: 10rpx 20rpx 0 20rpx;
|
||||
/* #endif */
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.search .picker-bg .picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* #ifndef APP-PLUS */
|
||||
padding-top: 2rpx;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.search .picker-bg .picker .uni-icons {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.search .picker-bg .picker .uni-icons:first-child {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.search .picker-bg .picker .uniui-down {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
</style>
|
||||
285
src/pages/business/CRM/map/checkinStatistics.vue
Normal file
285
src/pages/business/CRM/map/checkinStatistics.vue
Normal file
@@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<!-- 头部 -->
|
||||
<customHeader ref="customHeaderRef" :title="'打卡统计'" :leftFlag="true" :rightFlag="false"></customHeader>
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
|
||||
<!-- 正文内容 -->
|
||||
<view>
|
||||
<!-- 搜索 -->
|
||||
<view class="search">
|
||||
<picker @change="bindPickerChange" :value="cityIndex" :range="cityArr" class="picker-bg">
|
||||
<view class="picker">
|
||||
<uni-icons type="location" size="18"></uni-icons>
|
||||
<view>{{ cityArr[cityIndex] }}</view>
|
||||
<uni-icons type="down" size="18"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
<picker mode="date" :value="defaultDate" :start="startDate" :end="endDate" @change="bindDateChange"
|
||||
class="picker-bg">
|
||||
<view class="picker">
|
||||
<uni-icons custom-prefix="iconfont" color="#ffffff" type="icon-phoneshizhong"
|
||||
size="18"></uni-icons>
|
||||
<view>{{ defaultDate }}</view>
|
||||
<uni-icons type="down" size="18"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
<button type="default" @click="handleSearch" size="mini" class="btn-search">查询</button>
|
||||
</view>
|
||||
<!-- 签到打卡 -->
|
||||
<view class="checkin-tab">
|
||||
<view class="checkin-tab-item" :class="{ active: tabType == 0 }" @click="handleTab(0)">
|
||||
<view class="tab-item-title">{{ signCount }}</view>
|
||||
<view class="tab-item-name">最新签到打卡</view>
|
||||
</view>
|
||||
<view class="checkin-tab-item" :class="{ active: tabType == 1 }" @click="handleTab(1)">
|
||||
<view class="tab-item-title">{{ noSignCount }}</view>
|
||||
<view class="tab-item-name">未签到打卡</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- tab切换显示 -->
|
||||
<view class="white-bg">
|
||||
<!-- 最新签到列表 -->
|
||||
<view class="tab-con" v-if="tabType == 0">
|
||||
<view class="tab-title" v-for="(item, index) in singInList" :key="index">
|
||||
{{ item }}
|
||||
<uni-icons type="checkbox-filled" size="26" color="#02C74C"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 未签到列表 -->
|
||||
<view class="tab-con" v-if="tabType == 1">
|
||||
<view class="tab-title" v-for="(item, index) in singInNoList" :key="index">
|
||||
{{ item }}
|
||||
<uni-icons type="info-filled" size="26" color="#FF8059"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import { getDate } from '@/utils/datetime.js'
|
||||
import { getNoSigninList, getSigninList } from '../../../../api/crm/activity/map';
|
||||
|
||||
//进入页面初始化页面
|
||||
onMounted(() => {
|
||||
getSignListMethod();
|
||||
getNoSignListMethod();
|
||||
})
|
||||
|
||||
let cityIndex = ref(0);
|
||||
let cityArr = ['市场一部','市场二部','市场三部',"北京大区", "南方大区",'北方大区','西部大区'];
|
||||
// 选择大区列表
|
||||
let bindPickerChange = (e) => {
|
||||
console.log('picker发送选择改变,携带值为', e.detail.value)
|
||||
cityIndex.value = e.detail.value
|
||||
}
|
||||
|
||||
// 开始时间
|
||||
let startDate = getDate('start');
|
||||
// 结束时间,间隔10年
|
||||
let endDate = getDate('end');
|
||||
let defaultDate = getDate({ format: true })
|
||||
let bindDateChange = (e) => {
|
||||
defaultDate = e.detail.value
|
||||
}
|
||||
|
||||
let searchValue = ref(null)
|
||||
// 查询搜索跳转
|
||||
let handleSearch = () => {
|
||||
queryForm.tadayDate = defaultDate
|
||||
queryForm.region = cityArr[cityIndex.value]
|
||||
getSignListMethod();
|
||||
getNoSignListMethod();
|
||||
}
|
||||
|
||||
// 列表
|
||||
let signCount = ref(0)
|
||||
let singInList = ref([]);
|
||||
let noSignCount = ref(0)
|
||||
let singInNoList = ref([]);
|
||||
|
||||
//查询表单,默认有个北京大区的参数
|
||||
let queryForm = reactive({
|
||||
region: "北京大区"
|
||||
})
|
||||
// tab 切换
|
||||
let tabType = ref(0)
|
||||
let handleTab = (type) => {
|
||||
tabType.value = type;
|
||||
//最新签到列表
|
||||
if (type === 0) {
|
||||
getSignListMethod();
|
||||
|
||||
}
|
||||
//未签到列表
|
||||
else if (type === 1) {
|
||||
getNoSignListMethod();
|
||||
}
|
||||
}
|
||||
|
||||
function getSignListMethod() {
|
||||
getSigninList(queryForm).then(res => {
|
||||
signCount.value = res.total
|
||||
singInList.value = res.rows.map(item => item.userName)
|
||||
})
|
||||
}
|
||||
|
||||
function getNoSignListMethod() {
|
||||
getNoSigninList(queryForm).then(res => {
|
||||
noSignCount.value = res.total
|
||||
singInNoList.value = res.rows.map(item => item.userName);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 确定
|
||||
let handleSubmit = () => {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.search {
|
||||
display: flex;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.search .btn-search {
|
||||
border: none;
|
||||
background: none;
|
||||
line-height: normal;
|
||||
color: #fff;
|
||||
line-height: 56rpx !important;
|
||||
padding: 10rpx 0 0;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.search .btn-search::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.search .picker-bg {
|
||||
display: flex;
|
||||
background-color: #6FA2F8;
|
||||
border-radius: 25px;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
padding: 0rpx 20rpx;
|
||||
/* #ifndef APP-PLUS */
|
||||
padding: 10rpx 20rpx 0 20rpx;
|
||||
/* #endif */
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.search .picker-bg .picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* #ifndef APP-PLUS */
|
||||
padding-top: 2rpx;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.search .picker-bg .picker .uni-icons {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.search .picker-bg .picker .uni-icons:first-child {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.search .picker-bg .picker .uniui-down {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.checkin-tab {
|
||||
margin-top: 35rpx;
|
||||
display: flex;
|
||||
padding: 0 30rpx;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.checkin-tab-item {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
text-align: center;
|
||||
margin-right: 30rpx;
|
||||
font-weight: bold;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.checkin-tab-item.active {
|
||||
position: relative;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.checkin-tab-item.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background-color: #fff;
|
||||
width: 100rpx;
|
||||
height: 8rpx;
|
||||
}
|
||||
|
||||
.checkin-tab-item .tab-item-title {
|
||||
font-size: 60rpx;
|
||||
}
|
||||
|
||||
|
||||
.white-bg {
|
||||
width: 670rpx;
|
||||
margin: 0;
|
||||
border-radius: 8px 8px 0 0;
|
||||
padding: 50rpx 40rpx;
|
||||
margin-top: 20rpx;
|
||||
/* #ifdef APP-PLUS */
|
||||
height: calc(100vh - 260px);
|
||||
/* #endif */
|
||||
/* #ifndef APP-PLUS */
|
||||
height: calc(100vh - 230px);
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.tab-con {
|
||||
display: flex;
|
||||
flex-flow: row wrap
|
||||
}
|
||||
|
||||
.tab-con .tab-title {
|
||||
border: 1px solid #E8E8E8;
|
||||
text-align: center;
|
||||
border-radius: 5px;
|
||||
position: relative;
|
||||
/* padding:10rpx 20rpx; */
|
||||
margin-right: 20rpx;
|
||||
margin-bottom: 30rpx;
|
||||
width: 148rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.tab-con .tab-title:nth-child(4n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.tab-con .uni-icons {
|
||||
position: absolute;
|
||||
right: -10px;
|
||||
top: -10px;
|
||||
}
|
||||
</style>
|
||||
363
src/pages/business/CRM/map/vistorCheckin.vue
Normal file
363
src/pages/business/CRM/map/vistorCheckin.vue
Normal file
@@ -0,0 +1,363 @@
|
||||
<template>
|
||||
<view class="con-body">
|
||||
<view class="con-bg">
|
||||
<!-- 头部 -->
|
||||
<customHeader ref="customHeaderRef" :title="'签到打卡'" :leftFlag="true" :rightFlag="false"></customHeader>
|
||||
|
||||
<!-- 高度来避免头部遮挡 -->
|
||||
<view class="top-height"></view>
|
||||
|
||||
<!-- 正文内容 -->
|
||||
<view class="white-bg">
|
||||
<image src="../../../../static/images/business/btn-qd.png" class="btn-image" @click="handleCheckIn" />
|
||||
<image src="../../../../static/images/business/btn-dk.png" class="btn-image" @click="handleClockIn" />
|
||||
<view class="check-desc">
|
||||
业务人员可通过<text class="font-orange">签到</text>或<text
|
||||
class="font-blue">打卡</text>进行行为记录,该时间会和走访报告中的时间进行关联,便于查看。
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 打卡遮罩层 -->
|
||||
<!-- <view class="check-con" v-if="checkFlag">
|
||||
<view class="check-in">
|
||||
<view class="check-tip">打卡</view>
|
||||
<view class="check-title">确定要在此处打卡吗?</view>
|
||||
<view class="check-location">
|
||||
<uni-icons type="location-filled" size="30" color="#0395E0"></uni-icons> 亚洲金融大厦
|
||||
</view>
|
||||
<view class="check-address">北京市朝阳区天辰东路1号院</view>
|
||||
<view class="check-footer">
|
||||
<button class="btn-default" type="default" @click="handleCancel" size="mini">取 消</button>
|
||||
<button class="btn-primary" type="primary" @click="handleSubmit" size="mini">确 定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import customHeader from '@/components/customHeader.vue'
|
||||
import { addStartMapForClockIn } from '../../../../api/crm/activity/map';
|
||||
|
||||
let form = reactive({
|
||||
addressForStart: null,
|
||||
addressForEnd: null,
|
||||
createId: null,
|
||||
staffName: null,
|
||||
visistCode: null,
|
||||
visistId: null,
|
||||
mapId: null
|
||||
})
|
||||
// 签到
|
||||
let handleCheckIn = () => {
|
||||
uni.navigateTo({
|
||||
url: './addRearkSignIn'
|
||||
})
|
||||
}
|
||||
// 打卡
|
||||
let handleClockIn = () => {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: (res) => {
|
||||
const latiude = res.latitude;
|
||||
const longitude = res.longitude;
|
||||
//进行解析
|
||||
inverseGeocoding(latiude, longitude);
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log("获取地址失败" + err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function isWithinRange(lat, lon, centerLat, centerLon, rangeKm) {
|
||||
const distance = haversineDistance(centerLat, centerLon, lat, lon);
|
||||
return distance <= rangeKm;
|
||||
}
|
||||
function haversineDistance(lat1, lon1, lat2, lon2, radius = 6371) {
|
||||
const dLat = degToRad(lat2 - lat1);
|
||||
const dLon = degToRad(lon2 - lon1);
|
||||
const a =
|
||||
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
||||
Math.cos(degToRad(lat1)) * Math.cos(degToRad(lat2)) *
|
||||
Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
||||
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
return radius * c; // 距离,单位:公里
|
||||
}
|
||||
function degToRad(deg) {
|
||||
return deg * (Math.PI / 180);
|
||||
}
|
||||
|
||||
//解析地址
|
||||
function inverseGeocoding(latiude, longitude) {
|
||||
let points = longitude + ',' + latiude
|
||||
const apiURL = 'https://tiles.geovisearth.com/geo/v1/geocode/regeo';
|
||||
const params = {
|
||||
lat: latiude,
|
||||
lng: longitude,
|
||||
radius: 1000,
|
||||
pageSize: 1,
|
||||
currentPage: 1,
|
||||
//classify: 220100
|
||||
};
|
||||
const token = '66c87c897f0251295afdc794e4fbf73046a070338a726fe04f06cece6cb1ffdf';
|
||||
uni.request({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
data: params,
|
||||
header: {
|
||||
'Authorization': 'Bearer ' + token
|
||||
},
|
||||
success: (res) => {
|
||||
console.log(res, "----")
|
||||
if (res.statusCode == 200 && res.data.status == 200) {
|
||||
let resdata = res.data.data.rows[0].address
|
||||
if (resdata == null) {
|
||||
console.log(resdata.srcLat)
|
||||
const latiude1 = 34.1360;
|
||||
const longitude1 = 108.9126;
|
||||
if (isWithinRange(latiude1, longitude1, latiude, longitude, 1)) {
|
||||
form.addressForStart = "西安办事处位置打卡"
|
||||
uni.showModal({
|
||||
title: '确定要在此处打卡吗',
|
||||
content: form.addressForStart,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
var data = {
|
||||
mapId: form.mapId,
|
||||
addressForStart: form.addressForStart,
|
||||
cusName: form.cusName,
|
||||
cusId: form.cusId,
|
||||
remark: form.remark,
|
||||
path: longitude1 + "," + latiude1
|
||||
}
|
||||
addStartMapForClockIn(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: res.msg,
|
||||
duration: 1500,
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack(1)
|
||||
}, 500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg,
|
||||
});
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
form.addressForStart = resdata;
|
||||
uni.showModal({
|
||||
title: '确定要在此处打卡吗',
|
||||
content: form.addressForStart,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
var data = {
|
||||
mapId: form.mapId,
|
||||
addressForStart: form.addressForStart,
|
||||
cusName: form.cusName,
|
||||
cusId: form.cusId,
|
||||
path: points
|
||||
}
|
||||
addStartMapForClockIn(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: res.msg,
|
||||
duration: 1500,
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg,
|
||||
});
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
form.addressForStart = "第三方维护打卡"
|
||||
uni.showModal({
|
||||
title: '确定要在此处打卡吗',
|
||||
content: form.addressForStart,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
var data = {
|
||||
mapId: form.mapId,
|
||||
addressForStart: form.addressForStart,
|
||||
cusName: form.cusName,
|
||||
cusId: form.cusId,
|
||||
path: points
|
||||
}
|
||||
addStartMapForClockIn(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '第三方维护打卡',
|
||||
duration: 1500,
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg,
|
||||
});
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
fail(e) {
|
||||
console.log("获取位置失败", e)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.white-bg {
|
||||
width: 650rpx;
|
||||
margin: 0;
|
||||
border-radius: 8px 8px 0 0;
|
||||
padding: 50rpx;
|
||||
/* #ifdef APP-PLUS */
|
||||
height: calc(100vh - 125px);
|
||||
/* #endif */
|
||||
/* #ifndef APP-PLUS */
|
||||
height: calc(100vh - 98px);
|
||||
/* #endif */
|
||||
|
||||
|
||||
}
|
||||
|
||||
.btn-image {
|
||||
width: 340rpx;
|
||||
height: 340rpx;
|
||||
margin: 30rpx auto 60rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.check-desc {
|
||||
background-color: #F5F5F5;
|
||||
padding: 40rpx 50rpx;
|
||||
font-size: 28rpx;
|
||||
border-radius: 10px;
|
||||
margin-top: 100rpx;
|
||||
}
|
||||
|
||||
.check-desc .font-orange {
|
||||
color: #F5813A;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.check-desc .font-blue {
|
||||
color: #2CBAEF;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 弹窗处理 */
|
||||
.check-con {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
/* 遮罩层内容样式 */
|
||||
.check-in {
|
||||
background-color: #fff;
|
||||
padding: 40rpx 30rpx 60rpx;
|
||||
border-radius: 10px;
|
||||
/* width: 620rpx; */
|
||||
width: 560rpx;
|
||||
position: absolute;
|
||||
top: 48%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.check-in .check-tip {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.check-in .check-title {
|
||||
font-size: 32rpx;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.check-in .check-location {
|
||||
color: #0395E0;
|
||||
font-size: 42rpx;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
|
||||
.check-in .check-location .uniui-location-filled {
|
||||
font-weight: normal;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.check-in .check-address {
|
||||
color: #919191;
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 80rpx;
|
||||
}
|
||||
|
||||
.check-in .check-footer {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.check-in .check-footer .btn-default,
|
||||
.check-in .check-footer .btn-primary {
|
||||
background-color: #fff;
|
||||
border: 1px solid #05A3F4;
|
||||
color: #05A3F4;
|
||||
border-radius: 25px;
|
||||
padding: 0rpx 80rpx;
|
||||
font-size: 34rpx;
|
||||
/* margin-left: 0;
|
||||
margin-right: 20rpx; */
|
||||
}
|
||||
|
||||
.check-in .check-footer .btn-primary {
|
||||
background-color: #05A3F4;
|
||||
border: 1px solid #05A3F4;
|
||||
color: #fff;
|
||||
/* padding: 0rpx 60rpx; */
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user