You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
198 lines
3.7 KiB
198 lines
3.7 KiB
// pages/list/theatre/index.js
|
|
import commonApi from "../../utils/https/common"
|
|
import util from "../../utils/util"
|
|
let app = getApp()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
list:[],
|
|
tagList: [
|
|
{id: 521, name: "品苏式面"},
|
|
{id: 522, name: "尝农家乐"},
|
|
// {id: 11, name: "鉴苏帮菜"},
|
|
// {id: 12, name: "寻夜食堂"},
|
|
], // 父标签477
|
|
total:1,
|
|
type:521,
|
|
|
|
areas: [],
|
|
areaIndex:0,
|
|
|
|
needDistance: false,
|
|
lat:"",
|
|
lon:"",
|
|
keywords:""
|
|
},
|
|
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
wx.showShareMenu({
|
|
withShareTicket: true,
|
|
menus: ['shareAppMessage', 'shareTimeline']
|
|
})
|
|
this.getList();
|
|
this.getAreas();
|
|
},
|
|
|
|
getAreas:function(){
|
|
commonApi._post("supplier/get_area_list",{pid:320500}).then(res=>{
|
|
this.setData({
|
|
areas: [{id:0, name:"选择地区"},...res.data]
|
|
})
|
|
})
|
|
},
|
|
changeArea:function(e){
|
|
this.setData({
|
|
areaIndex:e.detail.value,
|
|
list: [],
|
|
total:1,
|
|
})
|
|
this.getList()
|
|
},
|
|
selectDistance: function () {
|
|
this.setData({
|
|
needDistance: !this.data.needDistance,
|
|
list: [],
|
|
total:1,
|
|
})
|
|
this.getList()
|
|
},
|
|
|
|
search:function(e){
|
|
this.setData({
|
|
list:[],
|
|
keywords:e.detail.keywords,
|
|
total:1
|
|
})
|
|
this.getList()
|
|
},
|
|
gotoDetail:function(e){
|
|
let item = e.currentTarget.dataset.item;
|
|
// util.pagePoint({
|
|
// event: 'food_detail_click',
|
|
// param: {
|
|
// id:item.id
|
|
// }
|
|
// },1)
|
|
wx.navigateTo({
|
|
url: '/subPackages/foodNew/index?id='+item.id,
|
|
})
|
|
},
|
|
getList:function(){
|
|
let list = this.data.list,that = this;
|
|
if(list.length>=this.data.total) return;0
|
|
// // 距离排序
|
|
if(this.data.needDistance && !this.data.lon){
|
|
wx.getLocation({
|
|
type: 'gcj02',
|
|
success: function (res) {
|
|
that.setData({
|
|
lat:res.latitude,
|
|
lon:res.longitude
|
|
})
|
|
that.realgetList()
|
|
},
|
|
fail:function(){
|
|
that.realgetList()
|
|
}
|
|
})
|
|
}
|
|
else {
|
|
this.realgetList()
|
|
}
|
|
|
|
},
|
|
realgetList:function(){
|
|
let list = this.data.list;
|
|
|
|
let param = {}
|
|
if (this.data.needDistance) {
|
|
param = {lat:this.data.lat,lon:this.data.lon}
|
|
}
|
|
|
|
commonApi._post("supplier/get_supplier_list",{
|
|
supplier_tag_id: this.data.type,
|
|
area_id: (this.data.areas[this.data.areaIndex] || {id: 0}).id,
|
|
offset:list.length,
|
|
limit:10,
|
|
...param,
|
|
keyword:this.data.keywords
|
|
}).then(res=>{
|
|
this.setData({
|
|
list:list.concat(res.data.list),
|
|
total:res.data.total
|
|
})
|
|
})
|
|
},
|
|
changeType:function(e){
|
|
this.setData({
|
|
type:e.currentTarget.dataset.type,
|
|
list:[],
|
|
total:1
|
|
})
|
|
this.getList();
|
|
},
|
|
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
this.getList()
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
onShareTimeline: function() {
|
|
return {
|
|
title: '君到苏州-剧场演出',
|
|
query: '',
|
|
imageUrl: 'https://static.ticket.sz-trip.com/xcxImages/index/icon4New.png'
|
|
}
|
|
}
|
|
})
|