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

73
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,36 +661,25 @@
url = "/mall/delivery/arriveShop" url = "/mall/delivery/arriveShop"
} }
let that = this let that = this
uni.getLocation({
type: 'gcj02', // this.getUserLocation(item)
isHighAccuracy:true, that.tui.request(url, "POST", {regionId:regionId,deliveryId:item.id,workerId:item.workerId}, false, true).then((res) => {
success: (res) => { if (res.code == 200) {
console.log('位置', res) if(status == 2 || status == 3){
that.latitude = res.latitude; that.pageData.splice(index, 1)
that.longitude = res.longitude; }else{
that.pageData[index].arriveTime = "qq"
that.tui.request(url, "POST", {regionId:regionId,deliveryId:item.id,workerId:item.workerId,geolocation:that.latitude + ',' + that.longitude}, false, true).then((res) => { }
if (res.code == 200) { that.tui.toast(res.message,200);
if(status == 2 || status == 3){ /* that.searchForm.pageNum = 1
that.pageData.splice(index, 1) that.getDelivery() */
}else{ that.$forceUpdate();
that.pageData[index].arriveTime = "qq" } else {
} that.tui.toast(res.message,200);
that.tui.toast(res.message,200); return;
/* that.searchForm.pageNum = 1
that.getDelivery() */
that.$forceUpdate();
} else {
that.tui.toast(res.message,200);
return;
}
uni.hideLoading();
}).catch((res) => {});
},
fail: (err) => {
console.log('获取位置失败', err);
} }
}); uni.hideLoading();
}).catch((res) => {});
}, },
checkTab1(type) { checkTab1(type) {
this.tab1Checked = type this.tab1Checked = type

Loading…
Cancel
Save