tianyi 4 weeks ago
parent
commit
307d2092ac
  1. 90
      pages/index/index.vue

90
pages/index/index.vue

@ -932,45 +932,36 @@
regionId: JSON.parse(uni.getStorageSync('area')).id,
geolocation: that.latitude + ',' + that.longitude
}
uni.getLocation({
type: 'gcj02', //
isHighAccuracy:true,
success: (res) => {
console.log('位置', res)
that.latitude = res.latitude;
that.longitude = res.longitude;
that.tui.request("/mall/delivery/accept", "POST", data, false, true).then((res) => {
that.loadStatus = 'nomore';
if (res.code == 200) {
if (!uni.getStorageSync('worker') && res.result != null) {
uni.setStorageSync('worker', res.result)
}
that.deliveryItem.splice(index, 1)
that.tui.toast(res.message);
if (item.workerId != null && item.workerId != undefined && item.workerId != '') {
that.zhipaiCount -= 1
} else {
if (item.deliveryType == 1) {
that.waimaiCount -= 1
} else if (item.deliveryType == 2) {
that.kuaidiCount -= 1
} else if (item.deliveryType == 3) {
that.paotuiCount -= 1
}
}
that.$forceUpdate();
} else {
that.tui.toast(res.message);
return;
that.tui.request("/mall/delivery/accept", "POST", data, false, true).then((res) => {
that.loadStatus = 'nomore';
if (res.code == 200) {
if (!uni.getStorageSync('worker') && res.result != null) {
uni.setStorageSync('worker', res.result)
}
that.deliveryItem.splice(index, 1)
that.tui.toast(res.message);
if (item.workerId != null && item.workerId != undefined && item.workerId != '') {
that.zhipaiCount -= 1
} else {
if (item.deliveryType == 1) {
that.waimaiCount -= 1
} else if (item.deliveryType == 2) {
that.kuaidiCount -= 1
} else if (item.deliveryType == 3) {
that.paotuiCount -= 1
}
uni.hideLoading();
}).catch((res) => {});
},
fail: (err) => {
console.log('获取位置失败', err);
}
setTimeout(res => {
this.getUserLocation(uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : res.result.workerId)
}, 2000)
that.$forceUpdate();
} else {
that.tui.toast(res.message);
return;
}
});
uni.hideLoading();
}).catch((res) => {});
},
rejectOrder(item, index) {
@ -1184,9 +1175,23 @@
this.getDelivery();
},
//
getUserLocation() {
getUserLocation(id) {
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:id,geolocation:that.latitude + ',' + that.longitude}, false, false,false).then((res) => {
}).catch((res) => {});
},
fail: (err) => {
console.log('获取位置失败', err);
}
});
},
checkTab1(type) {
this.checked = type
@ -1275,12 +1280,7 @@
this.indexInit()
break;
case 1:
let worker = uni.getStorageSync('worker')
if (worker == '' || worker == undefined || worker == null) {
this.tui.toast('您还没有注册兼职')
} else {
that.$refs.deLiveryPage.init()
}
that.$refs.deLiveryPage.init()
break;
case 2:
uni.navigateTo({

Loading…
Cancel
Save