md
This commit is contained in:
parent
6d87feaa93
commit
cb0444f757
82
common/geo/XDGeoSdk.js
Normal file
82
common/geo/XDGeoSdk.js
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
import * as turf from '@turf/turf';
|
||||||
|
import { deepClone } from '@/common/custom.js'
|
||||||
|
/*
|
||||||
|
中国边界数据 来源 阿里-高德
|
||||||
|
https://datav.aliyun.com/portal/school/atlas/area_selector
|
||||||
|
*/
|
||||||
|
import chinaBoundary from './china-boundary.json';
|
||||||
|
/*
|
||||||
|
XDGeoSdk
|
||||||
|
*/
|
||||||
|
class XDGeoSdk {
|
||||||
|
|
||||||
|
geoJson = null;
|
||||||
|
geoSimpleJson = null;
|
||||||
|
|
||||||
|
chinaPolygon = null;
|
||||||
|
|
||||||
|
chinaAreaBoundary = null;
|
||||||
|
chinaAreaMainLandBoundary = null;
|
||||||
|
chinaBox = null;
|
||||||
|
|
||||||
|
|
||||||
|
static instance = null;
|
||||||
|
constructor() {
|
||||||
|
this.instance = null
|
||||||
|
this.geoJson=chinaBoundary;
|
||||||
|
this.chinaAreaBoundary=deepClone(chinaBoundary.features[0].geometry.coordinates);
|
||||||
|
this.chinaAreaMainLandBoundary=this.chinaAreaBoundary[0][0];
|
||||||
|
this.chinaPolygon = chinaBoundary.features[0].geometry;
|
||||||
|
this.chinaBox=turf.bbox(this.chinaPolygon);
|
||||||
|
var options = {tolerance: 0.01, highQuality: false};
|
||||||
|
this.geoSimpleJson = turf.simplify(this.geoJson, options);
|
||||||
|
|
||||||
|
// console.log("===>this.chinaPolygon==>",this.chinaPolygon);
|
||||||
|
// console.log("===>geoSimpleJson==>",this.geoSimpleJson);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static getInstance() {
|
||||||
|
if (!this.instance) {
|
||||||
|
this.instance = new XDGeoSdk()
|
||||||
|
}
|
||||||
|
return this.instance
|
||||||
|
}
|
||||||
|
|
||||||
|
getChinaGeoJson(){
|
||||||
|
return this.geoJson;
|
||||||
|
// return this.geoSimpleJson;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getChinaPolygon(){
|
||||||
|
return this.chinaAreaBoundary;
|
||||||
|
}
|
||||||
|
|
||||||
|
getChinaMainLandPolygon(){
|
||||||
|
return this.chinaAreaMainLandBoundary;
|
||||||
|
}
|
||||||
|
|
||||||
|
isInChina(lat,lng) {
|
||||||
|
// [minLng, minLat, maxLng, maxLat]
|
||||||
|
const bbox = this.chinaBox;
|
||||||
|
const isInBbox = lng >= bbox[0] && lng <= bbox[2] && lat >= bbox[1] && lat <= bbox[3];
|
||||||
|
if (!isInBbox) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const point = turf.point([lng, lat]);
|
||||||
|
const chinaPolygon = this.chinaPolygon;
|
||||||
|
let rst=turf.booleanPointInPolygon(point, chinaPolygon);
|
||||||
|
return rst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default XDGeoSdk;
|
||||||
1
common/geo/china-boundary.json
Normal file
1
common/geo/china-boundary.json
Normal file
File diff suppressed because one or more lines are too long
16
common/geo/chinaGeo.js
Normal file
16
common/geo/chinaGeo.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import XDGeoSdk from './XDGeoSdk';
|
||||||
|
const xdGeoSdk = XDGeoSdk.getInstance();
|
||||||
|
|
||||||
|
export function getChinaGeoJson() {
|
||||||
|
return xdGeoSdk.getChinaGeoJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getChinaPolygon() {
|
||||||
|
return xdGeoSdk.getChinaPolygon();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isInChina(lat,lng) {
|
||||||
|
return xdGeoSdk.isInChina(lat,lng)
|
||||||
|
}
|
||||||
|
|
||||||
110
components/buns-post-detail-templates/bpd-map-reciever-panel.vue
Normal file
110
components/buns-post-detail-templates/bpd-map-reciever-panel.vue
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<template>
|
||||||
|
<u-row justify="between">
|
||||||
|
<u-row @click="setClipboardData(modelInfo.billCode)">
|
||||||
|
<view>
|
||||||
|
<u-text v-if="modelInfo.billCode" :text="`运单号:${modelInfo.billCode}` " size="26"></u-text>
|
||||||
|
<u-text v-else :text="`订单号:${modelInfo.orderSn}` " size="26"></u-text>
|
||||||
|
</view>
|
||||||
|
<view class="pl-10">
|
||||||
|
<u-icon name="file-text" size="32" custom-style=""></u-icon>
|
||||||
|
</view>
|
||||||
|
</u-row>
|
||||||
|
<view>
|
||||||
|
<view v-if="showInfoBtn" @click="goto(`post/detail?billCode=${modelInfo.billCode}`)" class="com-tag-grey">
|
||||||
|
运单信息
|
||||||
|
</view>
|
||||||
|
<tpx-text-dic v-if="!showInfoBtn" :value="modelInfo.orderStatus" :list="dicData.emis_order_status" ></tpx-text-dic>
|
||||||
|
</view>
|
||||||
|
</u-row>
|
||||||
|
|
||||||
|
<view @click="goto(`post/detail?billCode=${modelInfo.billCode}`)">
|
||||||
|
<u-row custom-style="margin-top: 5rpx;" justify="center">
|
||||||
|
<u-col span="4">
|
||||||
|
<u-text :text="(sender.countryName + sender.provinceName)||'-'" size="30" :bold="true" align="center"></u-text>
|
||||||
|
<!-- <u-text :text="sender.name" size="26" color="#999" margin="20rpx 0 0 0"
|
||||||
|
align="center"></u-text> -->
|
||||||
|
</u-col>
|
||||||
|
<u-col span="4" justify="center" align="center" custom-style="text-align: center;">
|
||||||
|
<image style="width: 70rpx;height: 14rpx;" :src="getCdnUrl('post/toline.png')">
|
||||||
|
</image>
|
||||||
|
<!-- getCdnUrl('post/toline-grey.png') -->
|
||||||
|
<view class="mt-10">
|
||||||
|
<tpx-text-dic :value="modelInfo.waybillStatus" :list="dicData.emis_waybill_status" ></tpx-text-dic>
|
||||||
|
</view>
|
||||||
|
</u-col>
|
||||||
|
<u-col span="4">
|
||||||
|
<u-text :text="(reciever.countryName + reciever.provinceName)||'-'" size="30" :bold="true" align="center"></u-text>
|
||||||
|
<!-- <u-text :text="reciever.name" size="26" color="#999" margin="20rpx 0 0 0"
|
||||||
|
align="center"></u-text> -->
|
||||||
|
</u-col>
|
||||||
|
</u-row>
|
||||||
|
|
||||||
|
<u-text v-if="modelInfo.blSign!=1" :text="`下单时间:${modelInfo.sendDate}`" color="#999" size="24"
|
||||||
|
margin="10rpx 0 0 0"></u-text>
|
||||||
|
|
||||||
|
<u-text v-if="modelInfo.blSign==1" :text="`签收时间:${modelInfo.signDate}`" color="#999" size="24"
|
||||||
|
margin="10rpx 0 0 0"></u-text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
computed: {
|
||||||
|
modelInfo: {
|
||||||
|
get() {
|
||||||
|
return this.value
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sender() {
|
||||||
|
let obj = JSON.parse(JSON.stringify(this.value?.sender || this.value || {}))
|
||||||
|
obj.countryName = obj.sendCountryName || obj.countryName
|
||||||
|
obj.provinceName = obj.sendProvinceName || obj.provinceName
|
||||||
|
obj.name = obj.sendName || obj.name
|
||||||
|
return obj
|
||||||
|
},
|
||||||
|
reciever() {
|
||||||
|
let obj = JSON.parse(JSON.stringify(this.value?.reciever || this.value || {}))
|
||||||
|
obj.countryName = obj.receiveCountryName || obj.countryName
|
||||||
|
obj.provinceName = obj.receiveProvinceName || obj.provinceName
|
||||||
|
obj.name = obj.receiveName || obj.name
|
||||||
|
return obj
|
||||||
|
},
|
||||||
|
dicData() {
|
||||||
|
return this.$store.getters.dicData
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
default () {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showInfoBtn: {
|
||||||
|
default () {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user