|
@@ -1,22 +1,25 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
- <view>
|
|
|
- <view class='wrap'>
|
|
|
- <view class="c-row">
|
|
|
- <view class="title">车牌号</view>
|
|
|
- <view class="con-list">
|
|
|
- <input v-model='detailData.carNo' placeholder="请输入车牌号" maxlength="7"></input>
|
|
|
- </view>
|
|
|
+ <map :latitude="detailData.originLatitude" :longitude="detailData.originLongitude" :markers="covers"
|
|
|
+ class="map"></map>
|
|
|
+ <view class='wrap'>
|
|
|
+ <view class="c-row">
|
|
|
+ <view class="title">车牌号</view>
|
|
|
+ <view class="con-list">
|
|
|
+ <input v-model='detailData.carNo' placeholder="请输入车牌号" maxlength="7"></input>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view @click='startTrack' class="button" v-if='titleBtn=="开始轨迹"'>{{titleBtn}}</view>
|
|
|
- <view @click='startTrack' class="button1" v-if='titleBtn=="结束轨迹"'>{{titleBtn}}</view>
|
|
|
- <view @click='startTrack' class="button2" v-if='titleBtn=="申请报销"'>{{titleBtn}}</view>
|
|
|
+ <view @click='endTrack' class="button1" v-if='titleBtn=="结束轨迹"'>{{titleBtn}}</view>
|
|
|
+ <view @click='reimbursement' class="button2" v-if='titleBtn=="申请报销"'>{{titleBtn}}</view>
|
|
|
</view>
|
|
|
+
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ var that
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -40,11 +43,16 @@
|
|
|
fillingNo: '',
|
|
|
strokeType: '1',
|
|
|
},
|
|
|
+ covers: [],
|
|
|
titleBtn: "开始轨迹",
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
this.id = options.id
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ this.getLngLat();
|
|
|
+ // #endif
|
|
|
+ that = this
|
|
|
},
|
|
|
onShow() {
|
|
|
var that = this
|
|
@@ -53,6 +61,131 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ getLngLat() {
|
|
|
+ this.checkOpenGPSServiceByAndroidIOS()
|
|
|
+ var that = this
|
|
|
+ uni.showLoading({
|
|
|
+ title: '获取定位中',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'gcj02',
|
|
|
+ geocode: true,
|
|
|
+ success: res => {
|
|
|
+ if (res.latitude) {
|
|
|
+ console.log(res)
|
|
|
+ that.detailData.originLongitude = res.longitude;
|
|
|
+ that.detailData.originLatitude = res.latitude;
|
|
|
+ that.detailData.destinationCity = that.$helper.filterUrban(res.address.city)
|
|
|
+ that.detailData.originArea = that.$helper.filterUrban(res.address.district)
|
|
|
+ this.covers = [{
|
|
|
+ id: 0,
|
|
|
+ latitude: res.latitude,
|
|
|
+ longitude: res.longitude,
|
|
|
+ iconPath: '../../../static/img/location.png',
|
|
|
+ }]
|
|
|
+ that.$forceUpdate()
|
|
|
+ uni.hideLoading()
|
|
|
+ } else {
|
|
|
+ if (uni.getSystemInfoSync().platform == 'android') {
|
|
|
+ var context = plus.android.importClass("android.content.Context");
|
|
|
+ var locationManager = plus.android.importClass(
|
|
|
+ "android.location.LocationManager");
|
|
|
+ var main = plus.android.runtimeMainActivity();
|
|
|
+ var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
|
|
|
+ that.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
|
|
|
+ }
|
|
|
+ if (that.bool === false) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '请打开定位服务',
|
|
|
+ success: ({
|
|
|
+ confirm,
|
|
|
+ cancel
|
|
|
+ }) => {
|
|
|
+ if (confirm) {
|
|
|
+ if (uni.getSystemInfoSync().platform == 'android') {
|
|
|
+ var Intent = plus.android.importClass(
|
|
|
+ 'android.content.Intent');
|
|
|
+ var Settings = plus.android.importClass(
|
|
|
+ 'android.provider.Settings');
|
|
|
+ var intent = new Intent(Settings
|
|
|
+ .ACTION_LOCATION_SOURCE_SETTINGS);
|
|
|
+ var main = plus.android.runtimeMainActivity();
|
|
|
+ main.startActivity(intent); // 打开系统设置GPS服务页面
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ uni.hideLoading()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: res => {
|
|
|
+ console.log('定位失败')
|
|
|
+ console.log(res)
|
|
|
+ uni.hideLoading()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ checkOpenGPSServiceByAndroidIOS() {
|
|
|
+ let system = uni.getSystemInfoSync(); // 获取系统信息
|
|
|
+ if (system.platform === 'android') { // 判断平台
|
|
|
+ var context = plus.android.importClass("android.content.Context");
|
|
|
+ var locationManager = plus.android.importClass("android.location.LocationManager");
|
|
|
+ var main = plus.android.runtimeMainActivity();
|
|
|
+ var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
|
|
|
+ if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '请打开定位服务功能',
|
|
|
+ // showCancel: false, // 不显示取消按钮
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
|
|
|
+ var Intent = plus.android.importClass('android.content.Intent');
|
|
|
+ var Settings = plus.android.importClass('android.provider.Settings');
|
|
|
+ var intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
|
|
+ main.startActivity(intent); // 打开系统设置GPS服务页面
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else if (system.platform === 'ios') {
|
|
|
+ // console.log("苹果");
|
|
|
+ var cllocationManger = plus.ios.import("CLLocationManager");
|
|
|
+ var enable = cllocationManger.locationServicesEnabled();
|
|
|
+ var status = cllocationManger.authorizationStatus();
|
|
|
+ plus.ios.deleteObject(cllocationManger);
|
|
|
+ if (enable && status != 2) {
|
|
|
+ console.log("手机系统的定位已经打开");
|
|
|
+ } else {
|
|
|
+ console.log("手机系统的定位没有打开");
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '请前往设置-隐私-定位服务打开定位服务功能',
|
|
|
+ // showCancel: false, // 不显示取消按钮
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ var UIApplication = plus.ios.import("UIApplication");
|
|
|
+ var application2 = UIApplication.sharedApplication();
|
|
|
+ var NSURL2 = plus.ios.import("NSURL");
|
|
|
+ // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
|
|
|
+ // var setting2 = NSURL2.URLWithString("App-Prefs:root=LOCATION_SERVICES");
|
|
|
+ // var setting2 = NSURL2.URLWithString("app-settings");
|
|
|
+ var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION");
|
|
|
+ // var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION_SERVICES");
|
|
|
+ application2.openURL(setting2);
|
|
|
+ plus.ios.deleteObject(setting2);
|
|
|
+ plus.ios.deleteObject(NSURL2);
|
|
|
+ plus.ios.deleteObject(application2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
seeInfo() {
|
|
|
this.$api.doRequest('get', '/fuelFillingInfo/getFilling', {
|
|
|
id: this.id
|
|
@@ -67,76 +200,160 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 申请报销
|
|
|
+ reimbursement() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/fuelfilling/apply_for_reimbursement?id=' + this.id
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 结束轨迹
|
|
|
+ endTrack() {
|
|
|
+ if (that.$helper.fUN_AmapLocation) {
|
|
|
+ that.$helper.fUN_AmapLocation.stop({}, result => {
|
|
|
+ console.log('====fUN_AmapLocation定位stop====', JSON.stringify(result));
|
|
|
+ // 更新轨迹结束地点
|
|
|
+
|
|
|
+ this.titleBtn = "申请报销"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //开始轨迹
|
|
|
startTrack() {
|
|
|
- if (this.titleBtn == "开始轨迹") {
|
|
|
- var that = this
|
|
|
- uni.showModal({
|
|
|
- content: "确定开始轨迹?",
|
|
|
- showCancel: true,
|
|
|
- confirmText: '确定',
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
|
|
|
- that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
|
|
|
- that.detailData.driverName = uni.getStorageSync('userInfo').userName
|
|
|
- that.detailData.trackFlag = "0"
|
|
|
- that.detailData.fillingNo = "202207040001"
|
|
|
- that.detailData.originProvince = "辽宁省"
|
|
|
- that.detailData.originCity = "营口市"
|
|
|
- that.detailData.originArea = "鲅鱼圈区"
|
|
|
- that.detailData.originLongitude = "122.21"
|
|
|
- that.detailData.originLatitude = "40.664"
|
|
|
- that.$api.doRequest('post', '/fuelFillingInfo/api/addFilling',
|
|
|
- that.detailData
|
|
|
- )
|
|
|
- .then(res => {
|
|
|
- that.id = res.data.data
|
|
|
- if (res.data.code == 200) {
|
|
|
- that.$api.msg('提交成功')
|
|
|
- that.titleBtn = "结束轨迹"
|
|
|
- } else {
|
|
|
- that.$api.msg('提交失败')
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- } else if (this.titleBtn == "结束轨迹") {
|
|
|
- var that = this
|
|
|
- uni.showModal({
|
|
|
- content: "确定结束轨迹?",
|
|
|
- showCancel: true,
|
|
|
- confirmText: '确定',
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
|
|
|
- that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
|
|
|
- that.detailData.driverName = uni.getStorageSync('userInfo').userName
|
|
|
- that.detailData.trackFlag = "1"
|
|
|
- that.detailData.destinationProvince = "江苏省"
|
|
|
- that.detailData.destinationCity = "宿迁市"
|
|
|
- that.detailData.destinationArea = "宿城区"
|
|
|
- that.detailData.destinationLongitude = "118.291"
|
|
|
- that.detailData.destinationLatitude = "33.942"
|
|
|
- that.$api.doRequest('post', '/fuelFillingInfo/api/addFilling',
|
|
|
- that.detailData
|
|
|
- )
|
|
|
- .then(res => {
|
|
|
- if (res.data.code == 200) {
|
|
|
- that.$api.msg('提交成功')
|
|
|
- that.titleBtn = "申请报销"
|
|
|
- } else {
|
|
|
- that.$api.msg('提交失败')
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
|
|
|
+ that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
|
|
|
+ that.detailData.driverName = uni.getStorageSync('userInfo').userName
|
|
|
+ that.detailData.trackFlag = "1"
|
|
|
+ that.detailData.destinationProvince = ""
|
|
|
+ that.detailData.destinationCity = ""
|
|
|
+ that.detailData.destinationArea = ""
|
|
|
+ that.detailData.destinationLongitude = ""
|
|
|
+ that.detailData.destinationLatitude = ""
|
|
|
+ that.$api.doRequest('post', '/fuelFillingInfo/api/addFilling', that.detailData).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ uni.hideLoading()
|
|
|
+ that.$helper.fUN_AmapLocation.start({
|
|
|
+ intervalTime: 5000,
|
|
|
+ isReport: false
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ let _data = {
|
|
|
+ orderId: that.id,
|
|
|
+ longitude: res.longitude,
|
|
|
+ latitude: res.latitude,
|
|
|
+ province: res.province,
|
|
|
+ city: res.city,
|
|
|
+ area: res.district
|
|
|
+ }
|
|
|
+ // if (this.shippingNoteInfos && this.shippingNoteInfos.length > 0) { //更新持续定位经纬度
|
|
|
+ // for (let i = 0; i < this.shippingNoteInfos.length; i++) {
|
|
|
+ // this.shippingNoteInfos[i].startLatitude = _data.latitude //纬度
|
|
|
+ // this.shippingNoteInfos[i].startLocationText = _data.city //起点
|
|
|
+ // this.shippingNoteInfos[i].startLongitude = _data.longitude //经度
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ this.$helper.gjList.push(_data)
|
|
|
+ uni.setStorageSync('mapGJ', this.$helper.gjList);
|
|
|
+ // console.log('this.$helper.gjList')
|
|
|
+ // console.log(this.$helper.gjList)
|
|
|
+ // console.log("条数", uni.getStorageSync('mapGJ').length)
|
|
|
+ if (uni.getStorageSync('mapGJ').length > 100) {
|
|
|
+ //存储轨迹经纬度list
|
|
|
+ this.$request.baseRequest('post', 'xx', {
|
|
|
+ orderId: that.id,
|
|
|
+ longitudeLatitude: JSON.stringify(uni.getStorageSync('mapGJ'))
|
|
|
+ }).then(res => {
|
|
|
+ uni.removeStorageSync('mapGJ');
|
|
|
+ this.$helper.gjList = []
|
|
|
+ })
|
|
|
+ .catch(res => {
|
|
|
+ uni.$u.toast(res.message);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: 'success',
|
|
|
+ message: "轨迹持续监控中!",
|
|
|
+ complete() {
|
|
|
+ this.titleBtn = '结束轨迹'
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
- } else {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/fuelfilling/apply_for_reimbursement?id=' + this.id
|
|
|
- })
|
|
|
- }
|
|
|
+ .catch(res => {
|
|
|
+ uni.$u.toast(res.message);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ // if (this.titleBtn == "开始轨迹") {
|
|
|
+ // var that = this
|
|
|
+ // uni.showModal({
|
|
|
+ // content: "确定开始轨迹?",
|
|
|
+ // showCancel: true,
|
|
|
+ // confirmText: '确定',
|
|
|
+ // success: function(res) {
|
|
|
+ // if (res.confirm) {
|
|
|
+ // that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
|
|
|
+ // that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
|
|
|
+ // that.detailData.driverName = uni.getStorageSync('userInfo').userName
|
|
|
+ // that.detailData.trackFlag = "0"
|
|
|
+ // that.detailData.fillingNo = "202207040001"
|
|
|
+ // that.detailData.originProvince = "辽宁省"
|
|
|
+ // that.detailData.originCity = "营口市"
|
|
|
+ // that.detailData.originArea = "鲅鱼圈区"
|
|
|
+ // that.detailData.originLongitude = "122.21"
|
|
|
+ // that.detailData.originLatitude = "40.664"
|
|
|
+ // that.$api.doRequest('post', '/fuelFillingInfo/api/addFilling',
|
|
|
+ // that.detailData
|
|
|
+ // )
|
|
|
+ // .then(res => {
|
|
|
+ // that.id = res.data.data
|
|
|
+ // if (res.data.code == 200) {
|
|
|
+ // that.$api.msg('提交成功')
|
|
|
+ // that.titleBtn = "结束轨迹"
|
|
|
+ // } else {
|
|
|
+ // that.$api.msg('提交失败')
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // } else if (this.titleBtn == "结束轨迹") {
|
|
|
+ // var that = this
|
|
|
+ // uni.showModal({
|
|
|
+ // content: "确定结束轨迹?",
|
|
|
+ // showCancel: true,
|
|
|
+ // confirmText: '确定',
|
|
|
+ // success: function(res) {
|
|
|
+ // if (res.confirm) {
|
|
|
+ // that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
|
|
|
+ // that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
|
|
|
+ // that.detailData.driverName = uni.getStorageSync('userInfo').userName
|
|
|
+ // that.detailData.trackFlag = "1"
|
|
|
+ // that.detailData.destinationProvince = "江苏省"
|
|
|
+ // that.detailData.destinationCity = "宿迁市"
|
|
|
+ // that.detailData.destinationArea = "宿城区"
|
|
|
+ // that.detailData.destinationLongitude = "118.291"
|
|
|
+ // that.detailData.destinationLatitude = "33.942"
|
|
|
+ // that.$api.doRequest('post', '/fuelFillingInfo/api/addFilling',
|
|
|
+ // that.detailData
|
|
|
+ // )
|
|
|
+ // .then(res => {
|
|
|
+ // if (res.data.code == 200) {
|
|
|
+ // that.$api.msg('提交成功')
|
|
|
+ // that.titleBtn = "申请报销"
|
|
|
+ // } else {
|
|
|
+ // that.$api.msg('提交失败')
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: '/pages/fuelfilling/apply_for_reimbursement?id=' + this.id
|
|
|
+ // })
|
|
|
+ // }
|
|
|
},
|
|
|
}
|
|
|
}
|
|
@@ -161,7 +378,10 @@
|
|
|
-webkit-box-align: center;
|
|
|
-webkit-align-items: center;
|
|
|
align-items: center;
|
|
|
- padding: 20rpx 30rpx;
|
|
|
+ /* padding: 20rpx 30rpx;
|
|
|
+ margin: 20rpx 0; */
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
.con-list {
|
|
@@ -182,24 +402,16 @@
|
|
|
}
|
|
|
|
|
|
.wrap {
|
|
|
- font-size: 14px;
|
|
|
background: #fff;
|
|
|
- margin: 10px;
|
|
|
- border-radius: 15px 10px;
|
|
|
-
|
|
|
- input {
|
|
|
- font-size: 14px;
|
|
|
- }
|
|
|
-
|
|
|
- >.title {
|
|
|
- padding: 10px 16px;
|
|
|
- }
|
|
|
+ padding: 40rpx 20rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ height: 20vh;
|
|
|
}
|
|
|
|
|
|
.button {
|
|
|
background: #22C572;
|
|
|
width: 90%;
|
|
|
- margin: 250px auto;
|
|
|
+ margin: 40rpx auto;
|
|
|
padding: 10px;
|
|
|
color: #fff;
|
|
|
text-align: center;
|
|
@@ -209,7 +421,7 @@
|
|
|
.button1 {
|
|
|
background: #ff0000;
|
|
|
width: 90%;
|
|
|
- margin: 250px auto;
|
|
|
+ margin: 0 auto;
|
|
|
padding: 10px;
|
|
|
color: #fff;
|
|
|
text-align: center;
|
|
@@ -219,7 +431,7 @@
|
|
|
.button2 {
|
|
|
background: #4089ff;
|
|
|
width: 90%;
|
|
|
- margin: 250px auto;
|
|
|
+ margin: 0 auto;
|
|
|
padding: 10px;
|
|
|
color: #fff;
|
|
|
text-align: center;
|
|
@@ -253,4 +465,10 @@
|
|
|
background: #F9F9FA;
|
|
|
border: 1px solid #EEEEEE;
|
|
|
}
|
|
|
+
|
|
|
+ .map {
|
|
|
+ width: 100vw;
|
|
|
+ height: 80vh;
|
|
|
+
|
|
|
+ }
|
|
|
</style>
|