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

Loading…
Cancel
Save