|
@@ -21,14 +21,7 @@ export default {
|
|
|
latitude: '',
|
|
|
optionsName:'荆州',
|
|
|
options1:[
|
|
|
- {
|
|
|
- label: '荆州',
|
|
|
- value: '荆州',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '沙市',
|
|
|
- value: '沙市',
|
|
|
- },
|
|
|
+
|
|
|
],
|
|
|
list: [ ],
|
|
|
siteList:[
|
|
@@ -196,10 +189,104 @@ export default {
|
|
|
}).catch(error => {
|
|
|
this.$refs.common.alert( error);
|
|
|
})
|
|
|
+ },
|
|
|
+ getOwnerRegion(){
|
|
|
+ var obj={
|
|
|
+ longitude:this.longitude,
|
|
|
+ latitude:this.latitude
|
|
|
+ }
|
|
|
+ API.getOwnerRegion(obj).then((res) => {
|
|
|
+ //this.options1=res.data;
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.common.alert( error);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setRegion(){
|
|
|
+ var obj={
|
|
|
+ longitude:this.longitude,
|
|
|
+ latitude:this.latitude
|
|
|
+ }
|
|
|
+ API.getOwnerRegion(obj).then((res) => {
|
|
|
+
|
|
|
+ var index=0;
|
|
|
+ var regionN = this.carhelp.get("car_region");
|
|
|
+ var region=res.data.id;
|
|
|
+ var obj1={};
|
|
|
+ var obj2={};
|
|
|
+ for(var i in this.options1 ){
|
|
|
+ if(this.options1[i].id==region){
|
|
|
+ index=i;
|
|
|
+ obj1=this.options1[i]
|
|
|
+ }
|
|
|
+ if(this.options1[i].id==regionN){
|
|
|
+ this.index=i;
|
|
|
+ obj2=this.options1[i]
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(regionN&®ionN!=region){
|
|
|
+
|
|
|
+ var nowDate =new Date();
|
|
|
+ var curDay=nowDate.getFullYear()*10000+(nowDate.getMonth()+1)*10000+nowDate.getDate()*10000+nowDate.getHours()*100+nowDate.getMinutes();
|
|
|
+ var temp = this.carhelp.get("car_region_cur");
|
|
|
+ var i=30;
|
|
|
+ if(process.car.NODE_ENV!="prod"){
|
|
|
+ i=3
|
|
|
+ }
|
|
|
+
|
|
|
+ if(temp&&temp+i>curDay){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.carhelp.set("car_region_cur",curDay);
|
|
|
+
|
|
|
+ //是否切换
|
|
|
+ this.$refs.common.setFnc(()=>{
|
|
|
+ this.index=index;
|
|
|
+ this.carhelp.set("car_region",region);
|
|
|
+ })
|
|
|
+ this.$refs.common.confirm('定位显示您在“'+obj1.name+'”,是否切换','切换')
|
|
|
+ }else{
|
|
|
+ this.index=index;
|
|
|
+ this.carhelp.set("car_region",region);
|
|
|
+ }
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.common.alert( error);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getRegion(bl) {
|
|
|
+ API.getRegionList().then((res) => {
|
|
|
+ this.options1=res.data;
|
|
|
+ if(this.options1.length){
|
|
|
+ this.carhelp.set("car_region_temp", this.options1[0].id);
|
|
|
+ }
|
|
|
+ var region= this.carhelp.get("car_region");
|
|
|
+ if(region){
|
|
|
+ for(var i in this.options1 ){
|
|
|
+ if(this.options1[i].id==region){
|
|
|
+ this.index=i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(bl){
|
|
|
+ this.setRegion();
|
|
|
+ }
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.common.alert( error);
|
|
|
+ })
|
|
|
},
|
|
|
bindPickerChange: function(e) {
|
|
|
- // console.log('picker发送选择改变,携带值为', e.target.value)
|
|
|
+
|
|
|
this.index = e.target.value
|
|
|
+ var obj=this.options1[ this.index];
|
|
|
+ var nowDate=new Date();
|
|
|
+ var curDay=nowDate.getFullYear()*10000+(nowDate.getMonth()+1)*10000+nowDate.getDate()*10000+nowDate.getHours()*100+nowDate.getMinutes();
|
|
|
+ this.carhelp.set("car_region_cur",curDay);
|
|
|
+ this.carhelp.set("car_region",obj.id);
|
|
|
+
|
|
|
},
|
|
|
gotoQuery(){
|
|
|
uni.navigateTo({
|
|
@@ -230,6 +317,9 @@ export default {
|
|
|
|
|
|
this.latitude = latitude;
|
|
|
this.longitude = longitude;
|
|
|
+
|
|
|
+ this.getRegion(true);
|
|
|
+
|
|
|
//this.$refs.common.alert("定位中...",);
|
|
|
this.passengerNearbyStation()
|
|
|
this.getPointBl=true
|
|
@@ -311,6 +401,7 @@ export default {
|
|
|
this.getNewNum();
|
|
|
this.getRemindInfo();
|
|
|
this.getBtn();
|
|
|
+ this.getRegion();
|
|
|
//清空缓存
|
|
|
this.carhelp.set("form",{});
|
|
|
this.isReady=true;
|