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

69
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,36 +661,25 @@
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) => {
if (res.code == 200) {
if(status == 2 || status == 3){
that.pageData.splice(index, 1)
}else{
that.pageData[index].arriveTime = "qq"
}
that.tui.toast(res.message,200);
/* 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);
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)
}else{
that.pageData[index].arriveTime = "qq"
}
that.tui.toast(res.message,200);
/* that.searchForm.pageNum = 1
that.getDelivery() */
that.$forceUpdate();
} else {
that.tui.toast(res.message,200);
return;
}
});
uni.hideLoading();
}).catch((res) => {});
},
checkTab1(type) {
this.tab1Checked = type

Loading…
Cancel
Save