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

Loading…
Cancel
Save