固定资产功能完善

This commit is contained in:
THK3121 2023-08-25 10:16:31 +08:00
parent f63c1416b9
commit 486cdb205a

View File

@ -1,67 +1,73 @@
<template>
<view>
<view v-if="false">
<!-- 有车辆 -->
<view v-if="1">
<view class="content">
<view class="map" style="position: relative;">
<map :class="mapClass" id="map" @markertap='mapFun' :enable-zoom="true" :polyline="polyline"
:markers='markers' :scale="scale" style="width:100%;height: 100%;"
:latitude="markers[0].latitude" :enable-scroll="true" :longitude="markers[0].longitude">
<view :class="allMap?'map1':'map2'" style="position: relative;">
<map :class="mapClass" id="map" :enable-zoom="true" :polyline="polyline" :markers='markers'
:scale="scale" style="width:100%;height: 100%;" :latitude="markers[0].latitude"
:enable-scroll="true" :longitude="markers[0].longitude" @tap="allMap=!allMap">
</map>
</view>
<view class="personnel_list" @click="toDetail('/subpkg/property/vehicle')">
<view class="cards">
<view class="cards_head">
<text>车牌号</text>
<view v-if="!allMap">
<view class="query">
<!-- <u--input placeholder="请选择日期" suffixIcon="clock" class="ipt" border="surround"
v-model="queryData" @focus='fousFn'></u--input> -->
<view class="ipt" @click="showDate=true">
<text>{{queryData}}</text>
<u-icon name="clock" size="24"></u-icon>
</view>
<view class="cards_content">
<view class="right">
<view class="li">
<text>行驶总里程: </text>
<text> { item.name }</text>
</view>
<view class="li">
<text>本公司签约时间: </text>
<text>{ item.phone }</text>
</view>
<view class="li">
<text>承租公司: </text>
<text> 所属片区 </text>
</view>
<view class="li">
<text>负责人: </text>
<text> 所属片区 </text>
</view>
<view class="li">
<text>联系方式: </text>
<text> 所属片区 </text>
</view>
<view class="li">
<text>所属区域: </text>
<text> 所属片区 </text>
</view>
<view class="li">
<text>承租时间: </text>
<text> 所属片区 </text>
<u-button type="primary" class='poline_btn' @click="showPloyline" text="显示轨迹"></u-button>
</view>
<view class="personnel_list" @click="toDetail('/subpkg/property/vehicle')">
<view class="cards">
<view class="cards_head">
<text>车牌号</text>
</view>
<view class="cards_content">
<view class="right">
<view class="li">
<text>行驶总里程: </text>
<text> { item.name }</text>
</view>
<view class="li">
<text>本公司签约时间: </text>
<text>{ item.phone }</text>
</view>
<view class="li">
<text>承租公司: </text>
<text> 所属片区 </text>
</view>
<view class="li">
<text>负责人: </text>
<text> 所属片区 </text>
</view>
<view class="li">
<text>联系方式: </text>
<text> 所属片区 </text>
</view>
<view class="li">
<text>所属区域: </text>
<text> 所属片区 </text>
</view>
<view class="li">
<text>承租时间: </text>
<text> 所属片区 </text>
</view>
</view>
</view>
</view>
<view class="fooot">
<!-- <mybtn></mybtn> -->
<u-button text="续约" color="#0122C7"></u-button>
</view>
</view>
</view>
</view>
<u-calendar @close='showDate=false' :show="showDate" @confirm="dataFn"></u-calendar>
</view>
<!-- 没有车辆 -->
<view class="" v-else>
<view class="" v-if="!isMycar">
<view class="empty_car">
@ -79,10 +85,7 @@
</view>
</u-modal>
</view>
</view>
<view style="text-align: center;margin-top: 100rpx;" v-if="isMycar">
您上传自有车两,系统正在审核中,请耐心等待
</view>
@ -91,9 +94,6 @@
</view>
</template>
<script>
@ -111,16 +111,14 @@
},
data() {
return {
allMap: false,
showDate: false,
isMycar: false,
myCarnum: "",
modelShow: false,
status: 1,
mapClass: 'custom-map',
showLoading: true,
showPop: false,
goodsDetil: undefined,
queryData: "请选择时间",
myCarnum: "",
mapClass: 'custom-map',
scale: 17,
nowAddress: "无",
markers: [
//
{
@ -132,29 +130,30 @@
//
{
id: 2,
latitude: undefined,
longitude: undefined,
latitude: 28.8733,
longitude: 105.444828,
iconPath: '../../static/img/logistics/QS.png', //
}
],
polyline: [],
task_id: -1,
address: {
terminus: {
status: 1
},
transfer: {
status: 1
}
}
}
},
onLoad(options) {
this.task_id = options.task_id;
this.initPosition();
this.locationFn();
},
methods: {
fousFn() {
uni.hideKeyboard()
this.showDate = true
},
dataFn(e) {
console.log(e)
this.queryData = e[0]
this.showDate = false
},
confirm() {
if (this.myCarnum) {
console.log(this.myCarnum)
@ -162,197 +161,159 @@
this.isMycar = true
}
},
//
async initPosition() {
let res = await taskTricycleDetail({
id: this.task_id
});
this.address = res.data.extend;
if (res.data.extend?.update?.terminus?.lnglat[0]) { //,
this.markers[0].latitude = +res.data.extend.transfer.lnglat[1];
this.markers[0].longitude = +res.data.extend.transfer.lnglat[0];
this.status = 2;
this.address.terminus['status'] = 2;
} else { // ,
this.markers[0].latitude = +res.data.extend.terminus.lnglat[1];
this.markers[0].longitude = +res.data.extend.terminus.lnglat[0];
this.address.terminus['status'] = 1;
}
if (res.data.extend?.update?.transfer?.lnglat[0] || res.data.status == 3) {
this.address.transfer['status'] = 2;
this.status = 3;
} else this.address.transfer['status'] = 1;
if (res.data.status == 5) {
this.status = 5;
}
},
//
locationFn() {
let that = this
//#ifdef APP
uni.getLocation({
type: 'gcj02',
geocode: true,
isHighAccuracy: true,
success: function async (res) {
that.markers[1].latitude = res.latitude
that.markers[1].longitude = res.longitude
that.getDriverLine()
}
});
//#endif
},
//
test() {
if (this.is_captain) return
var packageName = 'com.autonavi.minimap';
var main = plus.android.runtimeMainActivity();
var packageManager = main.getPackageManager();
var PackageManager = plus.android.importClass(packageManager)
var packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
if (packageInfo) {
var Uri = plus.android.importClass("android.net.Uri");
var url =
`amapuri://route/plan?sourceApplication=maxuslife+
&sid=A&slat=36.702558&slon=116.876678&sname=我的位置&did=B&dlat=${this.markers[0].latitude}&dlon=${this.markers[0].longitude}&dname=${this.goodsDetil.logistics.shop_name}&dev=0&t=0`;
var Intent = plus.android.importClass('android.content.Intent');
var intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT);
var uri = Uri.parse(url);
//SchemeURIdata
intent.setData(uri);
intent.setPackage("com.autonavi.minimap");
var main = plus.android.runtimeMainActivity();
main.startActivity(intent);
} else {
// alert('' + packageName + '')
uni.showToast({
title: `只支持高德地图`,
icon: 'none'
})
}
console.log("唤醒高德线路规划")
},
showToast() {
this.$refs.uToast.show({
type: 'success',
title: '成功主题(带图标)',
message: "操作成功",
iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
})
},
mapFun() {
uni.openLocation({
latitude: Number(this.goodsDetil.logistics.shop_lat),
longitude: Number(this.goodsDetil.logistics.shop_long),
address: this.goodsDetil.logistics.shop_address,
name: this.goodsDetil.logistics.shop_name,
scale: 15,
});
},
showToast() {
this.$refs.uToast.show({
type: 'success',
title: '成功主题(带图标)',
message: "操作成功",
iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
})
},
//
getDistance(point1, point2) {
const rad = Math.PI / 180.0;
const lat1 = point1.latitude;
const lng1 = point1.longitude;
const lat2 = point2.latitude;
const lng2 = point2.longitude;
const dlat = lat2 - lat1;
const dlng = lng2 - lng1;
const a =
Math.sin(dlat / 2 * rad) * Math.sin(dlat / 2 * rad) +
Math.cos(lat1 * rad) * Math.cos(lat2 * rad) *
Math.sin(dlng / 2 * rad) * Math.sin(dlng / 2 * rad);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const distance = 6378137 * c;
return distance;
},
//
getFn() {
uni.showLoading({
title: '上传中',
mask: true
})
this.locationFn()
// console.log(this.getDistance(this.markers[0], this.markers[1]))
if ((this.getDistance(this.markers[0], this.markers[1]) >> 0) > 10000) {
return Toast('距离目标位置过远');
} else {
let data;
if (this.status == 1) data = {
id: this.task_id,
terminus: {
lnglat: [
this.markers[1].longitude,
this.markers[1].latitude
]
}
};
else data = {
id: this.task_id,
transfer: {
lnglat: [
this.markers[1].longitude,
this.markers[1].latitude
]
}
};
taskAddTricycleCoordinate(data).then(() => {
uni.hideLoading()
Toast('上传成功!')
this.initPosition();
this.locationFn();
})
}
},
getDriverLine() {
const that = this;
const key = "997c9a3d88154fa78f4d28bebc1dd84f";
const origin = `${this.markers[1].longitude},${this.markers[1].latitude}`;
const destination = `${this.markers[0].longitude},${this.markers[0].latitude}`;
uni.request({
// url: `https://restapi.amap.com/v3/direction/walking?key=${key}&origin=105.43639400000002,28.908854&destination=105.439304,28.908447`,
url: `https:restapi.amap.com/v4/direction/bicycling?key=${key}&origin=${origin}&destination=${destination}`,
success: (res) => {
const data = res.data.data;
var points = [];
if (data.paths && data.paths[0] && data.paths[0].steps) {
var steps = data.paths[0].steps;
for (var i = 0; i < steps.length; i++) {
//points
var poLen = steps[i].polyline.split(";");
for (var j = 0; j < poLen.length; j++) {
points.push({
longitude: parseFloat(poLen[j].split(",")[0]),
latitude: parseFloat(poLen[j].split(",")[1]),
});
}
}
that.runningRoute = data.paths[0].steps[0].instruction;
}
that.polyline = [{
points: points,
color: "#0091ff",
dottedLine: true,
width: 30,
}, ];
showPloyline() {
// points: points,
// color: "#0091ff",
// dottedLine: true,
// width: 30,
let points = [{
latitude: 28.916022,
longitude: 105.442732,
},
fail: function(res) {
console.log("获取路线失败", res);
{
latitude: 28.916848,
longitude: 105.443175,
},
});
{
latitude: 28.916918,
longitude: 105.443269,
},
{
latitude: 28.917041,
longitude: 105.443466,
},
{
latitude: 28.917073,
longitude: 105.443522,
},
{
latitude: 28.91705,
longitude: 105.443607,
},
{
latitude: 28.917057,
longitude: 105.443643,
},
{
latitude: 28.916925,
longitude: 105.443546,
},
{
latitude: 28.916796,
longitude: 105.443466,
},
{
latitude: 28.916615,
longitude: 105.443344,
},
{
latitude: 28.916437,
longitude: 105.443274,
},
{
latitude: 28.916356,
longitude: 105.443222,
},
{
latitude: 28.916515,
longitude: 105.442643,
},
{
latitude: 28.916591,
longitude: 105.442448,
},
{
latitude: 28.916944,
longitude: 105.442338,
},
{
latitude: 28.91706,
longitude: 105.442376,
},
{
latitude: 28.917169,
longitude: 105.442489,
},
{
latitude: 28.917345,
longitude: 105.442601,
},
{
latitude: 28.917433,
longitude: 105.442663,
},
{
latitude: 28.917461,
longitude: 105.442683,
},
{
latitude: 28.917461,
longitude: 105.442683,
},
{
latitude: 28.917518,
longitude: 105.442874,
},
{
latitude: 28.917537,
longitude: 105.443032,
},
{
latitude: 28.917537,
longitude: 105.443032,
},
{
latitude: 28.917497,
longitude: 105.443198,
},
{
latitude: 28.917409,
longitude: 105.443256,
},
{
latitude: 28.91732,
longitude: 105.443318,
},
{
latitude: 28.917234,
longitude: 105.443442,
},
{
latitude: 28.917072,
longitude: 105.443497,
},
{
latitude: 28.916977,
longitude: 105.443539,
},
{
latitude: 28.916867,
longitude: 105.443529,
},
{
latitude: 28.916867,
longitude: 105.443529,
},
{
latitude: 28.916761,
longitude: 105.443404,
},
{
latitude: 28.916722,
longitude: 105.443274,
},
{
latitude: 28.916762,
longitude: 105.443132,
},
]
this.polyline = [{
points: points,
color: "#0091ff",
dottedLine: true,
width: 30,
}]
},
},
onPullDownRefresh() {
// this.getOrderList();
@ -364,19 +325,8 @@
</script>
<style lang='scss' scoped>
.serch {
margin: 28rpx 28rpx 0 28rpx;
}
.add {
position: fixed;
bottom: 100rpx;
right: 0;
}
.empty_car {
padding: 200rpx 50rpx;
/* text-align: center; */
.btn_cls {
background-color: #0122C7;
@ -386,12 +336,38 @@
}
}
.query {
display: flex;
background-color: #F5F5F5;
margin: 20rpx 0 0 0;
.ipt {
background-color: white;
width: 60vw;
border-radius: 10rpx;
padding: 10rpx;
display: flex;
justify-content: space-between;
line-height: 60rpx;
padding-left: 30rpx;
/* margin: 0 auto; */
/* line-height: auto; */
}
.poline_btn {
width: 20vw;
margin-left: 20rpx;
background-color: $theme-oa-color;
border: none;
}
}
.personnel_list {
padding: 28rpx 0;
margin-bottom: 130rpx;
.empty {
padding-top: 200rpx;
text-align: center;
@ -479,70 +455,6 @@
}
}
.cover {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(#000, 0.3);
.cover_model {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 650rpx;
/* height: 300rpx; */
background-color: #fff;
border-radius: 6px;
display: flex;
flex-direction: column;
justify-content: space-between;
.model_title {
height: 92rpx;
line-height: 92rpx;
text-align: center;
font-size: 16px;
font-weight: bold;
}
.model_content {
margin: 12px 25px 25px 25px;
font-size: 15px;
}
.model_btn {
display: flex;
height: 96rpx;
font-size: 16px;
.item {
flex: 1;
text-align: center;
line-height: 96rpx;
}
.model_confirm {
color: #0122c7;
}
}
}
}
.red {
color: #ff0000;
}
.green {
color: #40bc5e;
}
.yellow {
color: #ff7c32;
}
.custom-map /deep/ .polyline {
stroke-width: 20px;
}
@ -554,47 +466,16 @@
box-sizing: border-box;
}
.map {
height: 40vh;
.map1 {
height: 100vh;
width: 100vw;
border-radius: 2vw;
overflow: hidden;
}
.map_address {
background-color: white;
padding: 20rpx 10rpx;
border-radius: 0 0 14rpx 14rpx;
.li {
margin: 20rpx 0;
line-height: 40rpx;
}
.cir {
display: inline-block;
width: 2vw;
height: 2vw;
border-radius: 2vw;
margin: 0 20rpx;
}
}
.map_btn {
width: 50px;
height: 50px;
position: absolute;
bottom: 0px;
right: 0;
z-index: 9999999;
}
.btn {
position: fixed;
bottom: 20rpx;
width: 90vw;
left: 50%;
transform: translateX(-50%);
.map2 {
height: 30vh;
border-radius: 2vw;
overflow: hidden;
}
</style>