179 lines
4.0 KiB
JavaScript
179 lines
4.0 KiB
JavaScript
var app = getApp();
|
||
Component({
|
||
properties: {
|
||
stores: {
|
||
type: null
|
||
},
|
||
loading: {
|
||
type: null
|
||
},
|
||
page: {
|
||
type: null
|
||
},
|
||
totalPage: {
|
||
type: null
|
||
},
|
||
text: {
|
||
type: null
|
||
},
|
||
cityData: {
|
||
type: null
|
||
},
|
||
pointData: {
|
||
type: null
|
||
},
|
||
classifytype: {
|
||
type: null
|
||
},
|
||
is_open: {
|
||
type: null
|
||
},
|
||
noText:{
|
||
type:Boolean,
|
||
value:false
|
||
},
|
||
listStyle: {
|
||
type: null
|
||
},
|
||
},
|
||
data: {
|
||
language: '',
|
||
list: [],
|
||
show: false,
|
||
skipshow: false,
|
||
openTemplate: '01'
|
||
}, // 私有数据,可用于模板渲染
|
||
|
||
lifetimes: {
|
||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||
attached() {
|
||
let language = wx.getStorageSync('langIndex');
|
||
this.setData({ 'language': language.en});
|
||
if (this.data.page >= this.data.totalPage) {
|
||
this.setData({
|
||
show: false
|
||
});
|
||
} else {
|
||
this.setData({
|
||
show: true
|
||
});
|
||
}
|
||
|
||
},
|
||
moved() {},
|
||
detached() {},
|
||
},
|
||
|
||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||
attached() {
|
||
|
||
}, // 此处attached的声明会被lifetimes字段中的声明覆盖
|
||
ready() {
|
||
if (this.data.classifytype && this.data.classifytype == 1) {
|
||
this.setData({
|
||
skipshow: true
|
||
});
|
||
}
|
||
},
|
||
|
||
pageLifetimes: {
|
||
// 组件所在页面的生命周期函数
|
||
show() {},
|
||
hide() {},
|
||
resize() {},
|
||
},
|
||
|
||
methods: {
|
||
toGood(e) {
|
||
let id=e.currentTarget.dataset.goods_id;
|
||
wx.navigateTo({
|
||
url: '/packageA/detail_v2/detail_v2?id=' + id
|
||
});
|
||
},
|
||
goToAdress(e) {
|
||
let latitude = e.currentTarget.dataset.items.latitude;
|
||
let longitude = e.currentTarget.dataset.items.longitude;
|
||
let store_name = e.currentTarget.dataset.items.store_name;
|
||
let point = app.BMapTransqqMap(parseFloat(longitude), parseFloat(latitude));
|
||
wx.openLocation({
|
||
latitude: point.lat,
|
||
longitude: point.lng,
|
||
scale: 18,
|
||
name: store_name
|
||
});
|
||
},
|
||
toRouter(e) {
|
||
let specify_show = e.currentTarget.dataset.items.specify_show;
|
||
let item = e.currentTarget.dataset.items;
|
||
if (specify_show == 1) {
|
||
wx.navigateTo({
|
||
url: '/packageC/o2o/o2oStore/o2oStore?store_id=' + item.id
|
||
});
|
||
} else {
|
||
if(item.store_decorate == 1) {
|
||
wx.navigateTo({
|
||
url: "/packageG/o2o/HomeSeller/HomeSeller?store_id=" + item.id,
|
||
});
|
||
}else {
|
||
wx.navigateTo({
|
||
url: "/packageC/o2o/HomeSeller/HomeSeller?store_id=" + item.id,
|
||
});
|
||
}
|
||
}
|
||
},
|
||
//跳转至分类
|
||
toClassify(e) {
|
||
let id = e.currentTarget.dataset.id;
|
||
if (this.data.skipshow) {
|
||
wx.redirectTo({
|
||
url: '/packageC/o2o/o2oCategory/o2oCategory?id=' + id + '&city=' + this.data.cityData + '&point=' + JSON.stringify(
|
||
this.data.pointData)
|
||
});
|
||
} else {
|
||
wx.navigateTo({
|
||
url: '/packageC/o2o/o2oCategory/o2oCategory?id=' + id + '&city=' + this.data.cityData + '&point=' + JSON.stringify(
|
||
this.data.pointData)
|
||
});
|
||
}
|
||
},
|
||
gophone(e) {
|
||
let mobile = e.currentTarget.dataset.mobile;
|
||
wx.makePhoneCall({
|
||
phoneNumber: mobile
|
||
});
|
||
},
|
||
getMoreStores() {
|
||
this.triggerEvent("changList");
|
||
}
|
||
},
|
||
observers: {
|
||
'totalPage': function() {
|
||
if (this.data.page >= this.data.totalPage) {
|
||
this.setData({
|
||
show: false
|
||
});
|
||
} else {
|
||
this.setData({
|
||
show: true
|
||
});
|
||
}
|
||
},
|
||
'page': function() {
|
||
if (this.data.page >= this.data.totalPage) {
|
||
this.setData({
|
||
show: false
|
||
});
|
||
} else {
|
||
this.setData({
|
||
show: true
|
||
});
|
||
}
|
||
},
|
||
'listStyle': function() {
|
||
this.setData({
|
||
openTemplate: this.data.listStyle == 1 ? "02" : "01"
|
||
});
|
||
}
|
||
}
|
||
});
|