123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- import HTTP from "../../../../../requestFn/Api"
- var QQMapWX = require('../../../utils/qqmap-wx-jssdk.min.js');
- var qqmapsdk = new QQMapWX({
- key: 'ZZFBZ-RK6L6-FPZS5-E3MBZ-63LS2-7WBJE' // 必填
- });
- const app = getApp();
- import openIM from "../../../../../utils/openim"
- Page({
- data: {
- detail: {},
- current: 0,
- autoplay: true,
- duration: 500,
- interval: 5000,
- garden_id: null,
- pay_time_type: {
- 1: '月付',
- 2: '季付',
- 3: '半年付',
- 4: '年付'
- },
- direction: {
- 1: '东',
- 2: '南',
- 3: '西',
- 4: '北'
- },
- rent_type: {
- 1: '整租',
- 2: '合租',
- 3: '转租'
- },
- special_conf: {
- 1: '智能门锁',
- 2: 'WIFI',
- 3: '近地铁',
- 4: '停车位',
- 5: '独卫',
- 6: '私人阳台',
- 7: '首次出租'
- },
- base_conf: {
- 1: {
- name: "床",
- icon: "/static/base_conf/ic_bedroom.png"
- },
- 2: {
- name: "天然气",
- icon: "/static/base_conf/meiqitianranqi.png"
- },
- 3: {
- name: "暖气",
- icon: "/static/base_conf/nuanqi.png"
- },
- 4: {
- name: "宽带",
- icon: "/static/base_conf/kuandai.png"
- },
- 5: {
- name: "冰箱",
- icon: "/static/base_conf/bingxiang.png"
- },
- 6: {
- name: "衣柜",
- icon: "/static/base_conf/yigui.png"
- },
- 7: {
- name: "沙发",
- icon: "/static/base_conf/shafa.png"
- },
- 8: {
- name: "空调",
- icon: "/static/base_conf/kongtiao.png"
- },
- 9: {
- name: "电视机",
- icon: "/static/base_conf/dianshiji-.png"
- },
- 10: {
- name: "热水器",
- icon: "/static/base_conf/reshuiqi.png"
- },
- 11: {
- name: "洗衣机",
- icon: "/static/base_conf/xiyiji.png"
- },
- },
- manager_list: [],
- garden_info: {},
- total: 0,
- tabList: [{
- text: '交通',
- key: "交通"
- }, {
- text: '商超',
- key: "商超"
- }, {
- text: '教育',
- key: "教育"
- }, {
- text: '餐饮',
- key: "餐饮"
- }, {
- text: '金融',
- key: "金融"
- }, {
- text: '医疗',
- key: "医疗"
- }, {
- text: '外卖',
- key: "外卖"
- }, ],
- renthouse_list: [],
- bottom: 0,
- keyword: "交通",
- longitude: 0,
- latitude: 0
- },
- onLoad() {
- const {
- screenHeight,
- safeArea
- } = app.globalData.systemInfo;
- const {
- bottom
- } = safeArea;
- let safeHeight = screenHeight - bottom;
- this.setData({
- bottom: safeHeight
- });
- },
- onShow(options) {
- const that = this;
- const eventChannel = that.getOpenerEventChannel()
- eventChannel.on('acceptDataFromOpenerPage', function (data) {
- const strData = JSON.stringify(data);
- const {
- garden_id,
- id,
- lat: latitude,
- lnt: longitude
- } = data.data[0]
- that.setData({
- detail: {
- ...data.data[0],
- rent_id: data.data[0].id
- },
- latitude,
- longitude,
- strData
- })
- that.getHouse_manager(garden_id, id);
- that.getGardenInfo(garden_id);
- that.getRentHouse(garden_id);
- that.nearby_search()
- })
- },
- previewImage(e) {
- wx.previewImage({
- current: this.data.detail.house_pic[e.currentTarget.dataset.index],
- urls: this.data.detail.house_pic,
- });
- },
- getHouse_manager(garden_id, rent_id) {
- HTTP.HouseManager({
- garden_id,
- rent_id
- }).then(res => {
- this.setData({
- manager_list: res.list
- })
- })
- },
- callManager(e) {
- const {
- id
- } = e.currentTarget;
- const {
- name,
- phone
- } = this.data.manager_list.filter(item => item.id == id)[0]
- wx.navigateTo({
- url: `../manager/manager?name=${name}&phone=${phone}`,
- })
- },
- getGardenInfo(garden_id) {
- HTTP.GardenInfo({
- garden_id
- }).then(res => {
- this.setData({
- garden_info: res
- })
- })
- },
- async getRentHouse(garden_id) {
- let data = await HTTP.RentHouse({
- garden_id,
- approve_status: 2,
- page: 1,
- page_size: 9999
- })
- const {
- list,
- total
- } = data;
- let newarr = list.slice(0, 5)
- this.setData({
- total: total,
- renthouse_list: newarr
- })
- },
- goRentHouse() {
- // const {
- // garden_id,
- // garden_name
- // } = this.data.detail;
- // let pages = getCurrentPages();
- // let prevPage = pages[pages.length - 2];
- // prevPage.setData({
- // searchData: {
- // garden_id
- // }
- // })
- wx.navigateTo({
- url: '../renthouse/renthouse',
- })
- },
- tabChangeHandle(e) {
- const {
- value: keyword
- } = e.detail;
- this.setData({
- keyword,
- })
- this.nearby_search();
- },
- phoneManager() {
- wx.makePhoneCall({
- phoneNumber: this.data.detail.contact_phone,
- })
- },
- CallManager(e) {
- const {
- phone: phoneNumber
- } = e.currentTarget.dataset;
- wx.makePhoneCall({
- phoneNumber,
- })
- },
- garden_detail() {
- const {
- garden_info,
- detail
- } = this.data;
- wx.navigateTo({
- url: '../garden-detail/garden-detail',
- success: function (res) {
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- garden_info: {
- ...detail,
- ...garden_info,
- }
- })
- }
- })
- },
- appointmentHouse() {
- const that = this;
- wx.navigateTo({
- url: '../appointment/appointment',
- success: function (res) {
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- detail: {
- ...that.data.detail,
- rent_id: that.data.detail.id
- }
- })
- }
- })
- },
- goHouseDetail(e) {
- const {
- house
- } = e.currentTarget.dataset;
- let data = [house]
- wx.navigateTo({
- url: '../detail/detail',
- success: function (res) {
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- data
- })
- }
- })
- },
- goMapPlan() {
- const {
- addr,
- lat,
- lnt
- } = this.data.detail;
- // let plugin = requirePlugin('routePlan');
- // let key = 'ZZFBZ-RK6L6-FPZS5-E3MBZ-63LS2-7WBJE'; //使用在腾讯位置服务申请的key
- // let referer = '易小居'; //调用插件的app的名称
- // let endPoint = JSON.stringify({ //终点
- // 'name': addr,
- // 'latitude': lat,
- // 'longitude': lnt
- // });
- // wx.navigateTo({
- // url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint
- // })
- // wx.navigateTo({
- // url: `../map/map?lat=${lat}&lnt=${lnt}`,
- // })
- wx.openLocation({
- latitude: lat,
- longitude: lnt,
- address: addr,
- scale: 18,
- fail(err) {
- wx.showToast({
- title: '请再次尝试',
- icon: "none"
- })
- }
- })
- },
- nearby_search() {
- var _this = this;
- const {
- keyword,
- latitude,
- longitude
- } = _this.data;
- // 调用接口
- qqmapsdk.search({
- keyword, //搜索关键词
- location: {
- latitude,
- longitude
- },
- success: function (res) { //搜索成功后的回调
- var mks = []
- for (var i = 0; i < res.data.length; i++) {
- mks.push({ // 获取返回结果,放到mks数组中
- title: res.data[i].title,
- id: i,
- latitude: res.data[i].location.lat,
- longitude: res.data[i].location.lng,
- width: 20,
- height: 20,
- callout: {
- content: res.data[i].title,
- color: '#333',
- fontSize: 14,
- padding: 8,
- display: 'BYCLICK',
- textAlign: 'center'
- }
- })
- }
- _this.setData({ //设置markers属性,将搜索结果显示在地图中
- markers: mks
- })
- },
- fail: function (res) {
- wx.showToast({
- title: '查询失败',
- icon: "none"
- })
- },
- });
- },
- goChat() {
- const that =this;
- const {
- manager_list,
- strData: cardDesc,
- } = that.data;
- const itemList = manager_list.map(item => item.name);
- wx.showActionSheet({
- itemList,
- itemColor: "#03BB7A",
- success(res) {
- app.sendCard(cardDesc,that,res);
- }
- })
- }
- })
|