|
@@ -61,13 +61,11 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
- if(!uni.getStorageSync("clockwerehouse")){
|
|
|
- this.getWarehouse()
|
|
|
- }else{
|
|
|
+ if(uni.getStorageSync("clockwerehouse")){
|
|
|
this.detailData.targetLocation=uni.getStorageSync("clockwerehouse")
|
|
|
}
|
|
|
-
|
|
|
- // this.getLocation()
|
|
|
+ this.getWarehouse()
|
|
|
+ this.getLocation()
|
|
|
},
|
|
|
methods: {
|
|
|
calculate() {
|
|
@@ -77,6 +75,9 @@
|
|
|
},
|
|
|
getWarehouse() {
|
|
|
var that = this
|
|
|
+ uni.showLoading({
|
|
|
+ title: "正在加载"
|
|
|
+ })
|
|
|
this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouse', {
|
|
|
compId: uni.getStorageSync("pcUserInfo").compId,
|
|
|
warehouseType: '1'
|
|
@@ -93,12 +94,25 @@
|
|
|
that.lat2 = res.latitude
|
|
|
that.lng2 = res.longitude
|
|
|
if (that.warehouseBaseInfoList.length > 0) {
|
|
|
- that.clockDistance = that.utils.getDistance(that
|
|
|
+ if(that.detailData.targetLocation){
|
|
|
+ for(var i = 0 ; i < that.warehouseBaseInfoList.length ; i++){
|
|
|
+ if(that.warehouseBaseInfoList[i].warehouseName==that.detailData.targetLocation){
|
|
|
+ that.clockDistance = that.utils.getDistance(that
|
|
|
+ .warehouseBaseInfoList[i].warehousePositioning.split(',')[
|
|
|
+ 0],
|
|
|
+ that.warehouseBaseInfoList[i].warehousePositioning.split(
|
|
|
+ ',')[1], that.lat2, that.lng2)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ that.clockDistance = that.utils.getDistance(that
|
|
|
.warehouseBaseInfoList[0].warehousePositioning.split(',')[
|
|
|
0],
|
|
|
that.warehouseBaseInfoList[0].warehousePositioning.split(
|
|
|
',')[1], that.lat2, that.lng2)
|
|
|
that.detailData.targetLocation = that.warehouseBaseInfoList[0].warehouseName
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
fail: function(req) {
|
|
@@ -107,6 +121,7 @@
|
|
|
});
|
|
|
|
|
|
}
|
|
|
+ uni.hideLoading()
|
|
|
})
|
|
|
},
|
|
|
targetLPicker(e) {
|