175 lines
3.8 KiB
JavaScript
175 lines
3.8 KiB
JavaScript
// packageE/appointment/appointment_index.js
|
|
var app = getApp();
|
|
var location = require("../../mybehaviors/location/location");
|
|
|
|
Page({
|
|
behaviors: [location],
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
yz_basic_info: {},
|
|
address: "",
|
|
showContent: false,
|
|
carousels: [],
|
|
projects: [],
|
|
workers: [],
|
|
appointmentLang: {},
|
|
city: "",
|
|
title: "",
|
|
pos: {},
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this._getLocation((res, e) => {
|
|
let point = app.qqMapTransBMap(parseFloat(e.lng),parseFloat(e.lat));
|
|
this.setData({ point })
|
|
this.getIndexData();
|
|
this.setData({
|
|
appointmentLang: wx.getStorageSync("yz_basic_info").lang.appointment,
|
|
});
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {},
|
|
tolocation() {
|
|
wx.navigateTo({
|
|
url: "/packageC/o2o/o2oLocation/o2oLocation?tag=appointment",
|
|
});
|
|
},
|
|
toList() {
|
|
var str = JSON.stringify(this.data.appointmentLang);
|
|
wx.navigateTo({
|
|
url:
|
|
"/packageE/appointment/ProjectList/ProjectList?appointmentLang=" + str,
|
|
});
|
|
},
|
|
toTechnicianDetails(e) {
|
|
let id = e.currentTarget.dataset.id;
|
|
let point = JSON.stringify(this.data.point);
|
|
wx.navigateTo({
|
|
url:
|
|
"/packageE/appointment/technician_details/technician_details?worker_id=" +
|
|
id +
|
|
"&point=" +
|
|
point,
|
|
});
|
|
},
|
|
toDetails(e) {
|
|
let id = e.currentTarget.dataset.id;
|
|
let point = JSON.stringify(this.data.point);
|
|
wx.navigateTo({
|
|
url:
|
|
"/packageE/appointment/ProjectDetails/ProjectDetails?project_id=" +
|
|
id +
|
|
"&point=" +
|
|
point,
|
|
});
|
|
},
|
|
toHot() {
|
|
if (!this.data.city) {
|
|
wx.showToast({
|
|
title: "请先选择城市",
|
|
icon: "none",
|
|
});
|
|
return;
|
|
}
|
|
let point = JSON.stringify(this.data.point);
|
|
wx.navigateTo({
|
|
url:
|
|
"/packageE/appointment/hot_technician/hot_technician?city=" +
|
|
this.data.city +
|
|
"&point=" +
|
|
point,
|
|
});
|
|
},
|
|
toUrl() {
|
|
var str = JSON.stringify(this.data.appointmentLang);
|
|
wx.navigateTo({
|
|
url: "/packageE/appointment/mine/mine?appointmentLang=" + str,
|
|
});
|
|
},
|
|
getIndexData() {
|
|
let urlStr = app.getNetAddresss(
|
|
"plugin.appointment.frontend.index.get-data"
|
|
);
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
success: (resdata) => {
|
|
let res = resdata.data;
|
|
if (res.result !== 1) return this.tips(res.msg);
|
|
this.setData({
|
|
carousels: res.data.carousels,
|
|
projects: res.data.projects,
|
|
workers: res.data.workers,
|
|
});
|
|
this.setData({
|
|
appointmentLang: wx.getStorageSync("yz_basic_info").lang.appointment,
|
|
});
|
|
},
|
|
});
|
|
},
|
|
tosearch() {
|
|
if (!this.data.city) {
|
|
wx.showToast({
|
|
title: "请先选择城市",
|
|
icon: "none",
|
|
});
|
|
return;
|
|
}
|
|
let point = JSON.stringify(this.data.point);
|
|
wx.navigateTo({
|
|
url:
|
|
"/packageE/appointment/search/search?city=" +
|
|
this.data.city +
|
|
"&point=" +
|
|
point,
|
|
});
|
|
},
|
|
tips(msg) {
|
|
wx.showToast({
|
|
title: msg,
|
|
icon: "none",
|
|
duration: 2000,
|
|
});
|
|
return false;
|
|
},
|
|
});
|