Browse Source

打卡地址记录

aleyds 3 years ago
parent
commit
c0b6eba273
1 changed files with 7 additions and 1 deletions
  1. 7 1
      pages/attence/attence.vue

+ 7 - 1
pages/attence/attence.vue

@@ -112,6 +112,7 @@
 				punchDistance:0, //打卡距离
 				punchRange:0, //打卡范围
 				outwork:0, //是否外勤 0-否 1-是
+				punchAddress:'', //打卡地址
 				// 地图
 				covers: [],
 				circles:[{  
@@ -150,14 +151,18 @@
 				let that = this;
 				uni.getLocation({
 					type:"gcj02",
+					geocode: true,
 					success : function (res) {
 						uni.hideLoading();
 						var dst = `${that.payeeinfo.latitude},${that.payeeinfo.longitude}`;
 						var src = res.latitude + ',' + res.longitude;
+						ALog?.info({msg: "返回数据:" + JSON.stringify(res)});
 						var locRet = location?.distance?.(src, dst);
 						that.positionInfo = true;
 						that.punchDistance = locRet.distance;
 						that.punchRange = that.payeeinfo.workDistance;
+						that.punchAddress = res?.address?.province + res?.address?.city 
+						+ res?.address?.district + res?.address?.street + res?.address?.streetNum;
 						if(locRet.distance <= that.payeeinfo.workDistance){//在打卡范围内
 							that.outPosition = false;
 							that.outwork = 0;
@@ -229,7 +234,8 @@
 					workType:that.workType,
 					punchDistance: that.punchDistance,
 					punchRange: that.punchRange,
-					outwork: that.outwork
+					outwork: that.outwork,
+					punchAddress: that.punchAddress
 				}
 				that.$u.api.punchIn(param)
 				.then(res=>{