|
|
|
@ -9,6 +9,7 @@ Page({ |
|
|
|
* 页面的初始数据 |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
showAllMask:false, |
|
|
|
seachHeight:height, |
|
|
|
topHeight:rect.top, |
|
|
|
areas:['姑苏','吴江','苏州'], |
|
|
|
@ -19,7 +20,12 @@ Page({ |
|
|
|
keywords:"", |
|
|
|
list:[], |
|
|
|
showInfo:false, |
|
|
|
info:null |
|
|
|
info:null, |
|
|
|
menus:[], |
|
|
|
menuIndex:-1, |
|
|
|
productList:[], |
|
|
|
productPage:1, |
|
|
|
productTotal:1 |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
@ -46,11 +52,12 @@ Page({ |
|
|
|
}) |
|
|
|
that.setData({ |
|
|
|
areas:res.data, |
|
|
|
areaIndex:0 |
|
|
|
areaIndex:0, |
|
|
|
longitude:r.longitude, |
|
|
|
latitude:r.latitude |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
commonApi._post("pbservice/Other/getClientConfig",{ |
|
|
|
unique_key:"wechatxcx" |
|
|
|
}).then(res=>{ |
|
|
|
@ -87,20 +94,184 @@ Page({ |
|
|
|
}, |
|
|
|
onTapMarker:function(e){ |
|
|
|
console.log(e) |
|
|
|
let info = this.data.list[e.detail.markerId]; |
|
|
|
if(info.info.type=='tenscenic'){ |
|
|
|
// 运河十景需要先获取景点详情
|
|
|
|
commonApi._post("scene/detail",{ |
|
|
|
id:info.info.id |
|
|
|
}).then(res=>{ |
|
|
|
if(res.data){ |
|
|
|
res.data.display_tags = res.data.display_tags?res.data.display_tags.split(","):[]; |
|
|
|
res.data.display_tags = res.data.display_tags.slice(0,2); |
|
|
|
} |
|
|
|
info.info = res.data; |
|
|
|
this.setData({ |
|
|
|
info:info, |
|
|
|
showInfo:true, |
|
|
|
showAllMask:true, |
|
|
|
menus:[], |
|
|
|
menuIndex:-1, |
|
|
|
productList:[], |
|
|
|
productTotal:1, |
|
|
|
productPage:1 |
|
|
|
}) |
|
|
|
}) |
|
|
|
// 运河十景还需要获取是否有购票、线路、住宿、攻略菜单栏 如果没有的话菜单栏要隐藏
|
|
|
|
let ajaxes = [commonApi._post("product/get_product_by_type",{ |
|
|
|
type:"ticket", |
|
|
|
type_id:"", |
|
|
|
tenscenic_id:info.info.id, |
|
|
|
offset:0, |
|
|
|
limit:10 |
|
|
|
}), |
|
|
|
commonApi._post("product/get_product_by_type",{ |
|
|
|
type:"line", |
|
|
|
type_id:"", |
|
|
|
tenscenic_id:info.info.id, |
|
|
|
offset:0, |
|
|
|
limit:10 |
|
|
|
}), |
|
|
|
commonApi._post("scene/get_scene_by_type",{ |
|
|
|
type_id:"2", |
|
|
|
tenscenic_id:info.info.id, |
|
|
|
offset:0, |
|
|
|
limit:10 |
|
|
|
}), |
|
|
|
commonApi._post("travels/getList",{ |
|
|
|
tenscenic_id:info.info.id, |
|
|
|
page_no:1, |
|
|
|
page_num:10 |
|
|
|
})] |
|
|
|
Promise.all(ajaxes).then(res=>{ |
|
|
|
let menus = [],menuIndex=-1; |
|
|
|
if(res[0].data.total>0){ |
|
|
|
menuIndex = 0; |
|
|
|
menus[0] = "购票" |
|
|
|
} |
|
|
|
if(res[1].data.total>0){ |
|
|
|
if(menuIndex==-1) menuIndex = 1; |
|
|
|
menus[1] = "线路" |
|
|
|
} |
|
|
|
if(res[2].data.total>0){ |
|
|
|
if(menuIndex==-1) menuIndex = 2; |
|
|
|
menus[2] = "住宿" |
|
|
|
} |
|
|
|
if(res[3].data.total>0){ |
|
|
|
if(menuIndex==-1) menuIndex = 3; |
|
|
|
menus[3] = "攻略" |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
menus:menus, |
|
|
|
menuIndex:menuIndex |
|
|
|
}) |
|
|
|
this.getProductList() |
|
|
|
}) |
|
|
|
return; |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
info:info, |
|
|
|
showInfo:true, |
|
|
|
showAllMask:false |
|
|
|
}) |
|
|
|
}, |
|
|
|
changeMenu:function(e){ |
|
|
|
let index = e.currentTarget.dataset.index; |
|
|
|
if(this.data.menuIndex==index) return; |
|
|
|
this.setData({ |
|
|
|
menuIndex:index, |
|
|
|
productPage:1, |
|
|
|
productTotal:1, |
|
|
|
productList:[] |
|
|
|
}) |
|
|
|
this.getProductList(); |
|
|
|
}, |
|
|
|
// 获取运河实景的产品、景点、攻略列表
|
|
|
|
getProductList:function(){ |
|
|
|
let info = this.data.info; |
|
|
|
if(info && info.info && info.info.id && this.data.showInfo && info.info.type=='tenscenic'){ |
|
|
|
// 如果是运河十景的话
|
|
|
|
// 如果已经到底了
|
|
|
|
if(this.data.productList.length>=this.data.productTotal) return; |
|
|
|
let menu = this.data.menus[this.data.menuIndex],data={ |
|
|
|
type:"ticket", |
|
|
|
type_id:"", |
|
|
|
tenscenic_id:info.info.id, |
|
|
|
offset:this.data.productList.length, |
|
|
|
limit:10, |
|
|
|
page_no:this.data.productPage, |
|
|
|
page_num:10, |
|
|
|
lon:this.data.longitude, |
|
|
|
lat:this.data.latitude |
|
|
|
},service="product/get_product_by_type"; |
|
|
|
switch(menu){ |
|
|
|
case "购票": |
|
|
|
break; |
|
|
|
case "线路": |
|
|
|
data.type="line"; |
|
|
|
break; |
|
|
|
case "住宿": |
|
|
|
data.type_id="2"; |
|
|
|
data.type=null; |
|
|
|
service="scene/get_scene_by_type"; |
|
|
|
break; |
|
|
|
case "攻略": |
|
|
|
delete data.type; |
|
|
|
delete data.type_id; |
|
|
|
delete data.offset; |
|
|
|
delete data.limit; |
|
|
|
service="travels/getList"; |
|
|
|
break; |
|
|
|
} |
|
|
|
commonApi._post(service,data).then(res=>{ |
|
|
|
let list = res.data.list || res.data.rows; |
|
|
|
list.map(item=>{ |
|
|
|
item.display_tags = item.display_tags?item.display_tags.split(","):[]; |
|
|
|
item.display_tags = item.display_tags.slice(0,2); |
|
|
|
if(item.distance){ |
|
|
|
if(item.distance>=1000){ |
|
|
|
item.distance = item.distance/1000+"km" |
|
|
|
} |
|
|
|
else { |
|
|
|
item.distance = item.distance+"m" |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
productTotal:res.data.productTotal, |
|
|
|
productPage:this.data.productPage+1, |
|
|
|
productList:this.data.productList.concat(list) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
gotoDetail:function(e){ |
|
|
|
let item = e.currentTarget.dataset.item; |
|
|
|
util.gotoDetail(item); |
|
|
|
}, |
|
|
|
showImages:function(e){ |
|
|
|
let index = e.currentTarget.dataset.index,info = this.data.info; |
|
|
|
wx.previewImage({ |
|
|
|
urls: info.info.listimg, |
|
|
|
current:info.info.listimg[index] |
|
|
|
}) |
|
|
|
}, |
|
|
|
closeMask:function(){ |
|
|
|
this.setData({ |
|
|
|
info:this.data.list[e.detail.markerId], |
|
|
|
showInfo:true |
|
|
|
showAllMask:false |
|
|
|
}) |
|
|
|
}, |
|
|
|
hideInfo:function(){ |
|
|
|
this.setData({ |
|
|
|
info:null, |
|
|
|
showInfo:false |
|
|
|
showInfo:false, |
|
|
|
showAllMask:false |
|
|
|
}) |
|
|
|
}, |
|
|
|
changeType:function(e){ |
|
|
|
this.setData({ |
|
|
|
type:e.currentTarget.dataset.type |
|
|
|
type:e.currentTarget.dataset.type, |
|
|
|
showInfo:false, |
|
|
|
info:null |
|
|
|
}) |
|
|
|
this.getList() |
|
|
|
}, |
|
|
|
|