|
@@ -22,7 +22,7 @@
|
|
<view class="c-row">
|
|
<view class="c-row">
|
|
<view class="title">打卡距离</view>
|
|
<view class="title">打卡距离</view>
|
|
<view class="con-list">
|
|
<view class="con-list">
|
|
- <input type="number" v-model='clockDistance' placeholder="重新获取" :disabled="true"></input>
|
|
|
|
|
|
+ <view>{{clockDistance}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -63,12 +63,13 @@
|
|
console.log(query)
|
|
console.log(query)
|
|
},
|
|
},
|
|
getWarehouse() {
|
|
getWarehouse() {
|
|
|
|
+ var that = this
|
|
this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouse', {
|
|
this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouse', {
|
|
compId: uni.getStorageSync("pcUserInfo").compId,
|
|
compId: uni.getStorageSync("pcUserInfo").compId,
|
|
warehouseType: '1'
|
|
warehouseType: '1'
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.data.data.length != 0) {
|
|
if (res.data.data.length != 0) {
|
|
- this.warehouseBaseInfoList = res.data.data
|
|
|
|
|
|
+ that.warehouseBaseInfoList = res.data.data
|
|
uni.getLocation({
|
|
uni.getLocation({
|
|
type: 'gcj02',
|
|
type: 'gcj02',
|
|
geocode: true,
|
|
geocode: true,
|
|
@@ -76,14 +77,15 @@
|
|
console.log('获取位置数据:', res);
|
|
console.log('获取位置数据:', res);
|
|
console.log('当前位置的经度:' + res.longitude);
|
|
console.log('当前位置的经度:' + res.longitude);
|
|
console.log('当前位置的纬度:' + res.latitude);
|
|
console.log('当前位置的纬度:' + res.latitude);
|
|
- this.lat2 = res.latitude
|
|
|
|
- this.lng2 = res.longitude
|
|
|
|
- if (this.warehouseBaseInfoList.length > 0) {
|
|
|
|
- this.clockDistance = this.utils.getDistance(this
|
|
|
|
|
|
+ that.lat2 = res.latitude
|
|
|
|
+ that.lng2 = res.longitude
|
|
|
|
+ if (that.warehouseBaseInfoList.length > 0) {
|
|
|
|
+ that.clockDistance = that.utils.getDistance(that
|
|
.warehouseBaseInfoList[0].warehousePositioning.split(',')[
|
|
.warehouseBaseInfoList[0].warehousePositioning.split(',')[
|
|
- 1],
|
|
|
|
- this.warehouseBaseInfoList[0].warehousePositioning.split(
|
|
|
|
- ',')[0], this.lat2, this.lng2)
|
|
|
|
|
|
+ 0],
|
|
|
|
+ that.warehouseBaseInfoList[0].warehousePositioning.split(
|
|
|
|
+ ',')[1], that.lat2, that.lng2)
|
|
|
|
+ that.detailData.targetLocation = that.warehouseBaseInfoList[0].warehouseName
|
|
}
|
|
}
|
|
},
|
|
},
|
|
fail: function(req) {
|
|
fail: function(req) {
|
|
@@ -97,8 +99,9 @@
|
|
targetLPicker(e) {
|
|
targetLPicker(e) {
|
|
this.detailData.targetLocation = this.warehouseBaseInfoList[e[0]].warehouseName
|
|
this.detailData.targetLocation = this.warehouseBaseInfoList[e[0]].warehouseName
|
|
this.clockDistance = this.utils.getDistance(this.warehouseBaseInfoList[e[0]].warehousePositioning.split(
|
|
this.clockDistance = this.utils.getDistance(this.warehouseBaseInfoList[e[0]].warehousePositioning.split(
|
|
- ',')[1],
|
|
|
|
- this.warehouseBaseInfoList[e[0]].warehousePositioning.split(',')[0], this.lat2, this.lng2)
|
|
|
|
|
|
+ ',')[0],
|
|
|
|
+ this.warehouseBaseInfoList[e[0]].warehousePositioning.split(',')[1], this.lat2, this.lng2)
|
|
|
|
+
|
|
},
|
|
},
|
|
submit() {
|
|
submit() {
|
|
if (!this.typevalue) {
|
|
if (!this.typevalue) {
|
|
@@ -122,9 +125,15 @@
|
|
that.detailData.phone = uni.getStorageSync('pcUserInfo').userMobilePhone
|
|
that.detailData.phone = uni.getStorageSync('pcUserInfo').userMobilePhone
|
|
that.detailData.empName = uni.getStorageSync('userInfo').userName
|
|
that.detailData.empName = uni.getStorageSync('userInfo').userName
|
|
that.detailData.clockType = that.typevalue
|
|
that.detailData.clockType = that.typevalue
|
|
- that.detailData.clockDistance = "100"
|
|
|
|
|
|
+ if(that.clockDistance.indexOf("km") > -1){
|
|
|
|
+ that.detailData.clockDistance = that.clockDistance.replace("km","")*1000
|
|
|
|
+ }else{
|
|
|
|
+ that.detailData.clockDistance = that.clockDistance.replace("m","")
|
|
|
|
+ }
|
|
|
|
+ console.log(that.detailData)
|
|
that.$api.doRequest('post', '/clockInfo/api/addClock', that.detailData)
|
|
that.$api.doRequest('post', '/clockInfo/api/addClock', that.detailData)
|
|
.then(res => {
|
|
.then(res => {
|
|
|
|
+ console.log(res.data)
|
|
if (res.data.code == 200) {
|
|
if (res.data.code == 200) {
|
|
that.$api.msg('提交成功')
|
|
that.$api.msg('提交成功')
|
|
} else {
|
|
} else {
|