tianyi 4 weeks ago
parent
commit
55533cb7a3
  1. 39
      components/tab-bar/delivery.vue

39
components/tab-bar/delivery.vue

@ -380,6 +380,10 @@
},
methods: {
init() {
let worker = uni.getStorageSync('worker')
if (worker == '' || worker == undefined || worker == null) {
this.tui.toast('您还没有注册兼职')
}
console.log("配送初始化")
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
this.isOnLine = uni.getStorageSync('worker').isOnLine
@ -389,13 +393,29 @@
if(uni.getStorageSync('worker')){
this.searchForm.workerId = uni.getStorageSync('worker').workerId
}
this.getDelivery()
this.$forceUpdate()
this.getDelivery()
},
//
getUserLocation() {
getUserLocation(item) {
let that = this;
uni.getLocation({
type: 'gcj02',
isHighAccuracy:true,
success: (res) => {
console.log('位置', res)
that.latitude = res.latitude;
that.longitude = res.longitude;
that.tui.request('/worker/admin/editLocation', "POST", {workerId:item.workerId,geolocation:that.latitude + ',' + that.longitude}, false, false,false).then((res) => {
}).catch((res) => {});
},
fail: (err) => {
console.log('获取位置失败', err);
}
});
},
onReachPage(){
console.log("11111")
@ -641,15 +661,9 @@
url = "/mall/delivery/arriveShop"
}
let that = this
uni.getLocation({
type: 'gcj02', //
isHighAccuracy:true,
success: (res) => {
console.log('位置', res)
that.latitude = res.latitude;
that.longitude = res.longitude;
that.tui.request(url, "POST", {regionId:regionId,deliveryId:item.id,workerId:item.workerId,geolocation:that.latitude + ',' + that.longitude}, false, true).then((res) => {
this.getUserLocation(item)
that.tui.request(url, "POST", {regionId:regionId,deliveryId:item.id,workerId:item.workerId}, false, true).then((res) => {
if (res.code == 200) {
if(status == 2 || status == 3){
that.pageData.splice(index, 1)
@ -667,11 +681,6 @@
uni.hideLoading();
}).catch((res) => {});
},
fail: (err) => {
console.log('获取位置失败', err);
}
});
},
checkTab1(type) {
this.tab1Checked = type
if(type == 'daiqu'){

Loading…
Cancel
Save