123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- const app = getApp();
- var utils = require("../../../utils/http");
- const util = require("../../../utils/util");
- let page = 1;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- filtrateflag: false,
- orderBuildType: 'new',
- buildinglist:[],
- imgUrl: app.globalData.imgUrl,
- datashow:false,
- wshareshow:false,
- nowtitle: '',
- nowimg: '',
- buildVal: "",
- islist: false,
- nowtype:'building',
- personMsg:app.globalData.personMsg
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- page = 1;
- wx.showLoading({
- title: '加载中...',
- })
- this.getBuildingProgress();
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- page = 1;
- this.setData({
- personMsg:app.globalData.personMsg
- })
- },
- allfiltratetap: function () {
- this.data.filtrateflag = !this.data.filtrateflag;
- this.setData({
- filtrateflag: this.data.filtrateflag,
- })
- },
- closefiltratetap: function () {
- this.setData({
- filtrateflag: false
- })
- },
- buildValInput(e) {
- this.setData({
- buildVal:e.detail.value
- })
- },
- jumpUploadBuilding() {
- wx.navigateTo({
- url: '/pages/other/other?type=9889',
- })
- },
- searchFunc() {
- wx.showLoading({
- title: '加载中...',
- })
- page = 1;
- this.getBuildingProgress();
- },
- setBuildFilter(e) {
- wx.showLoading({
- title: '加载中...',
- })
- page = 1;
- this.setData({
- orderBuildType: e.currentTarget.dataset.type
- })
- this.getBuildingProgress();
- },
- getBuildingProgress() {
- var that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/building/index',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- order: that.data.orderBuildType,
- page: page,
- limit: "10",
- name: that.data.buildVal
- },
- success: function (res) {
- wx.hideLoading()
- if (res.data.code == 0) {
- res.data.data.forEach(v => {
- v.areastr = v.area_list.map(v => `${v}㎡`);
- v.update_time = v.update_time ? v.update_time.split(' ')[0] : '';
- v.duetime = v.duetime ? v.duetime.split(' ')[0] : '';
- })
- that.setData({
- buildinglist: res.data.data,
- datashow:true,
- })
- }
- }
- })
- },
- toPageDetail(e) {
- let id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '/index/pages/progressdetail/progressdetail?cid=' + id,
- })
- },
- progressShare(e) {
- this.setData({
- nowtype: 'building',
- nowid: e.currentTarget.dataset.cid,
- nowtitle: e.currentTarget.dataset.title,
- nowimg: e.currentTarget.dataset.img,
- wshareshow: true,
- })
- },
- handleCollect(e) {
- let collect = e.currentTarget.dataset.collect;
- let id = e.currentTarget.dataset.id;
- let index = e.currentTarget.dataset.index;
- let urllink = !collect ? app.globalData.webUrl + 'api/building/collect' : app.globalData.webUrl + 'api/building/collectCancel';
- utils.$post({
- url: urllink,
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: id,
- },
- success: (res) => {
- if (res.data.code == 0) {
- this.data.buildinglist[index].collected = !collect;
- this.setData({
- buildinglist: this.data.buildinglist
- })
- wx.showToast({
- title: res.data.msg,
- icon: 'none',
- duration: 1000
- })
- }
- }
- })
- },
- shareurltap: function () {
- let that = this;
- wx.showLoading({
- title: '加载中...',
- })
- util.schemefun('/share/pages/buildprogress/buildprogress', 'uid=' + app.globalData.personMsg.id + '&cid=' + that.data.nowid + '&ctp=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id, that.data.nowid, 'building', '');
- this.sharelogtap();
- },
- setpostertap: function () {
- let that = this;
- let type = "building", usrl = "";
- wx.navigateTo({
- url: '/index/pages/setposter/setposter?type=' + type + '&aid=' + this.data.nowid + "&listshare=" + (that.data.listshare ? '123' : '') + usrl,
- })
- },
- sendfriendtap: function () {
- this.sharelogtap();
- },
- sharelogtap: function (e) {
- var that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/share/addlog',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: that.data.nowid,
- type: that.data.nowtype,
- alertshow:'456'
- },
- success: function (r) {
- }
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- wx.showLoading({
- title: '加载中...',
- })
- page = 1;
- this.getBuildingProgress();
- wx.stopPullDownRefresh();
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- wx.showLoading({
- title: '加载中...',
- })
- var that = this;
- page = page * 1 + 1;
- utils.$post({
- url: app.globalData.webUrl + 'api/building/index',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- order: that.data.orderBuildType,
- page: page,
- limit: "10",
- name: that.data.buildVal
- },
- success: function (res) {
- wx.hideLoading()
- if (res.data.code == 0) {
- let list = that.data.buildinglist;
- res.data.data.forEach(v => {
- v.areastr = v.area_list.map(v => `${v}㎡`);
- v.update_time = v.update_time ? v.update_time.split(' ')[0] : '';
- v.duetime = v.duetime ? v.duetime.split(' ')[0] : '';
- })
- list = list.concat(res.data.data);
- that.setData({
- buildinglist: list
- })
- }
- }
- })
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage(e) {
- if (e.from == "menu") {
- return {
- title: "营销楼盘-"+app.globalData.companyobj.company_name,
- imageUrl: app.globalData.imgUrl + 'xcx/aaa/buildcover.png',
- path: '/share/pages/buildinglist/buildinglist?uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&emid=' + app.globalData.personMsg.binded.id
- }
- } else {
- let that = this;
- this.setData({
- wshareshow: false
- })
- this.sharelogtap();
- return {
- title: that.data.nowtitle,
- imageUrl: that.data.nowimg,
- path: '/share/pages/buildprogress/buildprogress?cid=' + that.data.nowid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id
- }
- }
- }
- })
|