123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552 |
- // pages/findcustomertool/findcustomertool.js
- var app = getApp();
- const utils = require("../../utils/http");
- var stoptime = 0;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- agentName: app.globalData.agentName,
- webUrl: '',
- share_user_id: '',
- imgUrl: app.globalData.imgUrl,
- mattertype: '辅助业主',
- datashow: false,
- type: 1,
- turntableDetail: {},
- activityInfo: {},
- havePinTuan: 0,
- toolnumobj:{},
- activitynum:0,
- showMask: false,
- hallvrarr:[],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({
- type: options.type,
- imgUrl: app.globalData.imgUrl
- })
- wx.setNavigationBarTitle({
- title: options.type == 1 ? (app.globalData.companyobj.company_name+'智慧屏' ): '转化工具',
- })
- wx.hideShareMenu({
- menus: ['shareAppMessage', 'shareTimeline']
- })
- wx.showLoading({
- title: '加载中...',
- })
- this.setData({
- webUrl: app.globalData.webUrl + 'applet.html#/findcustomertool?token=' + app.globalData.token,
- })
- if(this.data.type==1){
- this.getvrhall();
- }
- this.getTurntableDetail();
- this.getActivityInfo();
- this.getPinTuanData();
- this.getdenumfun();
- },
- getvrhall(){
- const that=this;
- utils.$post({
- url: app.globalData.webUrl + 'api/index/compvrshow_list',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {},
- success: function (res) {
- if (res.data.code == '0') {
- that.setData({
- hallvrarr:res.data.data
- })
- }
- }
- })
- },
- showvrtap(){
- this.setData({
- showMask:true
- })
- },
- getdenumfun(){
- const that=this;
- utils.$post({
- url: app.globalData.webUrl + 'api/index/afszxy_count',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {},
- success: function (res) {
- if (res.data.code == '0') {
- that.setData({
- toolnumobj: res.data.data,
- activitynum:res.data.data.activity_num?res.data.data.activity_num:0
- })
- }
- }
- })
- },
- closeMaskView() {
- this.setData({
- showMask: false,
- })
- },
- setypetap(e) {
- this.setData({
- type: e.currentTarget.dataset.type
- })
- },
- tooltap: function (e) {
- this.setData({
- mattertype: e.currentTarget.dataset.type
- })
- },
- toViewBuilding () {
- wx.navigateTo({
- url: '/index/pages/viewbuilding/viewbuilding?type=1',
- })
- },
- housestyleBtn: function () {
- wx.navigateTo({
- url: "/pages/housestyle/housestyle",
- });
- },
- offerTap: function () {
- wx.navigateTo({
- url: "/pages/decorateoffer/decorateoffer",
- });
- },
- collageTap: function () {
- wx.navigateTo({
- url: "/pages/other/other?type=121",
- });
- },
- designertap() {
- wx.navigateTo({
- url: "/customer/pages/designerlist/designerlist?type=1",
- });
- },
- oldhouserenovationTap: function () {
- wx.navigateTo({
- url: "/pages/oldhouserenovation/oldhouserenovation",
- });
- },
- decorationhelpTap: function () {
- wx.navigateTo({
- url: "/index/pages/decorationhelp/decorationhelp",
- });
- },
- toSmartScreenPage: function () {
- wx.reLaunch({
- url: '/pages/index/index?state=1',
- })
- },
- nameCardTap: function () {
- wx.navigateTo({
- url: '/index/pages/namecard/namecard',
- })
- },
- desarotelistap: function () {
- wx.navigateTo({
- url: "/index/pages/indexlist/indexlist",
- });
- },
- brokerManager: function() {
- wx.navigateTo({
- url: '/pages/other/other?type=9009',
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- vrtap() {
- if (this.data.hallvrarr.length==0) {
- wx.navigateTo({
- url: '/pages/noneData/noneData?type=2',
- })
- return false;
- }else if(this.data.hallvrarr.length==1){
- wx.navigateTo({
- url: '/pages/other/other?type=111&ctp='+ app.globalData.clientype+'&uid='+ app.globalData.personMsg.id+'&aid=' + this.data.hallvrarr[0].id + '&cty=company'+'&vrurl='+escape(this.data.hallvrarr[0].url),
- })
- }else{
- this.setData({
- showMask:true
- })
- }
- },
- lvrtap(e){
- let num=e.currentTarget.dataset.idx;
- wx.navigateTo({
- url: '/pages/other/other?type=111&ctp='+ app.globalData.clientype+'&uid='+ app.globalData.personMsg.id+'&aid=' + this.data.hallvrarr[num].id + '&cty=company'+'&vrurl='+escape(this.data.hallvrarr[num].url),
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- var that = this;
- stoptime = 0;
- setTimeout(function () {
- stoptime = stoptime * 1 + 1;
- that.setData({
- datashow: true
- })
- wx.hideLoading()
- }, 1000)
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- var timearr = app.globalData.timearr,
- flag = false;
- for (var i = 0; i < timearr.length; i++) {
- if (timearr[i].type == 'customertool') {
- timearr[i].time = timearr[i].time * 1 + stoptime * 1;
- flag = true;
- }
- }
- if (!flag) {
- var obj = {
- type: 'customertool',
- time: stoptime
- };
- app.globalData.timearr.push(obj);
- } else {
- app.globalData.timearr = timearr;
- }
- },
- networktap: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- strengthtap() {
- wx.navigateTo({
- url: '/customer/pages/companystrength/companystrength?type=1'
- })
- },
- publicpraisetap() {
- wx.navigateTo({
- url: '/customer/pages/publicpraise/publicpraise?type=1'
- })
- },
- caseBtn() {
- wx.navigateTo({
- url: '/pages/decorateguide/decorateguide?type=1'
- })
- },
- turntable() {
- wx.navigateTo({
- url: '/customer/pages/activitydetail/activitydetail',
- })
- },
- smashGoldenEggs() {
- wx.navigateTo({
- url: '/customer/pages/goldeneggact/goldeneggact',
- })
- },
- activityap() {
- wx.navigateTo({
- url: '/customer/pages/activitylist/activitylist',
- })
- },
- /**
- * 大转盘砸金蛋-员工转发活动记录
- */
- shareCountRecord(actid) {
- var that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/lottery/act_forward_log',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- actid: actid
- },
- success: function (res) {
- if (res.data.code == '0') {
- console.log('成功')
- }
- }
- })
- },
- /**
- * 大转盘活动
- */
- getTurntableDetail() {
- var that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/lottery/act_detail',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {},
- success: function (res) {
- if (res.data.code == '0') {
- that.setData({
- turntableDetail: res.data.data || {},
- })
- }
- }
- })
- },
- addsharetap: function (type) {
- let that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/share/addlog',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: '0',
- type: type,
- },
- success: function (r) {}
- })
- },
- /**
- * 砸金蛋获取活动详情
- */
- getActivityInfo() {
- var that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/lottery/egg_act_detail',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {},
- success: function (res) {
- if (res.data.code == '0') {
- that.setData({
- activityInfo: res.data.data || {},
- })
- }
- }
- })
- },
- /**
- * 获取拼团
- */
- getPinTuanData() {
- let that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/spellgroup/sel_company_spellact',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {},
- success: function (res) {
- console.log(res, '<<><><>');
- //1->活动下架,2->已参加过,3->拼团人数已满,4->拼团时限结束,0->拼团成功
- if (res.data.code == '0') {
- that.setData({
- havePinTuan: res.data.data
- })
- }
- }
- })
- },
- /**
- * 没有拼团活动提示
- */
- handleTips(e) {
- let type = e.currentTarget.dataset.type;
- if (type == 'collage') {
- wx.navigateTo({
- url: '/pages/noneData/noneData?type=5',
- })
- } else if (type == 'turntable') {
- wx.navigateTo({
- url: '/pages/noneData/noneData?type=4',
- })
- } else if (type == 'goldenEggs') {
- wx.navigateTo({
- url: '/pages/noneData/noneData?type=3',
- })
- }
- },
- /**
- * 大转盘-抽奖客户
- */
- lotteryClient() {
- if (!this.data.turntableDetail.id) {
- wx.navigateTo({
- url: '/pages/noneData/noneData?type=4',
- })
- return;
- }
- wx.navigateTo({
- url: '/pages/other/other?type=29&actid=' + this.data.turntableDetail.id,
- })
- },
- /**
- * 砸金蛋-抽奖客户
- */
- joinCustomer() {
- if (!this.data.activityInfo.id) {
- wx.navigateTo({
- url: '/pages/noneData/noneData?type=3',
- })
- return;
- }
- wx.navigateTo({
- url: '/pages/other/other?type=29' + '&actid=' + this.data.activityInfo.id,
- })
- },
- buildtap:function(){
- wx.navigateTo({
- url: '/customer/pages/site/site?type=2',
- })
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- dothis(){},
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- // */
- onShareAppMessage: function (e) {
- let that = this;
- if (e.target.dataset.type == 'style') {
- that.addsharetap('customerJsAll');
- return {
- title: '装修风格测一测', // 默认是小程序的名称(可以写slogan等)
- path: '/share/pages/beforetest/beforetest?type=housestyle&share_user_id=' + app.globalData.personMsg.id + "&clientype=" + app.globalData.clientype, // 默认是当前页面,必须是以‘/’开头的完整路径
- imageUrl: app.globalData.imgUrl + 'xcx/styletool.jpg', //自定义图片路径,图片长宽比是 5:4
- }
- } else if (e.target.dataset.type == 'old') {
- that.addsharetap('customerJsAll');
- return {
- title: '老房翻新风格测一测', // 默认是小程序的名称(可以写slogan等)
- path: '/share/pages/beforetest/beforetest?type=oldhouserenovation&share_user_id=' + app.globalData.personMsg.id + "&clientype=" + app.globalData.clientype, // 默认是当前页面,必须是以‘/’开头的完整路径
- imageUrl: app.globalData.imgUrl + 'xcx/oldbewell.jpg', //自定义图片路径,图片长宽比是 5:4
- }
- } else if (e.target.dataset.type == 'price') {
- that.addsharetap('customerJsAll');
- return {
- title: '装修报价算一算', // 默认是小程序的名称(可以写slogan等)
- path: '/share/pages/beforetest/beforetest?type=decorateoffer&share_user_id=' + app.globalData.personMsg.id + "&clientype=" + app.globalData.clientype, // 默认是当前页面,必须是以‘/’开头的完整路径
- imageUrl: app.globalData.imgUrl + 'xcx/pricetool.jpg', //自定义图片路径,图片长宽比是 5:4
- }
- } else if (e.target.dataset.type == 'index') {
- that.addsharetap('toolAll');
- return {
- title: app.globalData.personMsg.binded.name + '的微官网', // 默认是小程序的名称(可以写slogan等)
- path: '/pages/index/index?type=share&share_user_id=' + app.globalData.personMsg.id + "&clientype=" + app.globalData.clientype + "&state=1", // 默认是当前页面,必须是以‘/’开头的完整路径
- imageUrl: app.globalData.imgUrl + 'xcx/xcxweiw.jpg', //自定义图片路径,图片长宽比是 5:4
- }
- } else if (e.target.dataset.type == 'case') {
- that.addsharetap('toolAll');
- return {
- title: app.globalData.personMsg.binded.name + "的装修案例",
- imageUrl: app.globalData.imgUrl + "xcx/caseposter.jpg",
- path: '/share/pages/caselist/caselist?u=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&c=&s=&st=&e=&h='
- }
- } else if (e.target.dataset.type == 'publicpraise') {
- that.addsharetap('toolAll');
- return {
- title: "业主好评-"+app.globalData.companyobj.company_name,
- imageUrl: app.globalData.imgUrl + "xcx/praiseimg.jpg",
- path: '/share/pages/praiselist/praiselist?uid=' + app.globalData.personMsg.id + '&cate=&ctp=' + app.globalData.clientype
- }
- } else if (e.target.dataset.type == 'designer') {
- that.addsharetap('toolAll');
- return {
- title: "设计大师-"+app.globalData.companyobj.company_name,
- imageUrl: app.globalData.imgUrl + "/xcx/designerlisticon.jpg",
- path: '/share/pages/designerlist/designerlist?uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
- }
- } else if (e.target.dataset.type == 'namecard') {
- return {
- title: app.globalData.personMsg.binded.name + "的个人名片",
- imageUrl: app.globalData.imgUrl + "/xcx/sharenamecard.png",
- path: '/share/pages/shareCard/shareCard?uid=' + app.globalData.shareuserid + '&empid=' + app.globalData.personMsg.binded.id + '&ctp=' + app.globalData.clientype,
- };
- } else if (e.target.dataset.type == 'turntable') {
- that.addsharetap('customerJsAll');
- that.shareCountRecord(that.data.turntableDetail.id);
- return {
- title: that.data.turntableDetail.title,
- imageUrl:app.globalData.imgUrl + "xcx/shareturntable.jpg",
- path: '/share/pages/activity/activity?uid=' + app.globalData.personMsg.id + '&clientype=' + app.globalData.clientype + '&actid=' + that.data.turntableDetail.id + '&empid=' + app.globalData.currentUserId,
- };
- } else if (e.target.dataset.type == 'goldenEggs') {
- that.addsharetap('customerJsAll');
- that.shareCountRecord(that.data.activityInfo.id);
- return {
- title: that.data.activityInfo.title,
- imageUrl: app.globalData.imgUrl + "xcx/shareGoldenEgg.jpg",
- path: '/share/pages/eggsactivity/eggsactivity?uid=' + app.globalData.personMsg.id + '&clientype=' + app.globalData.clientype + '&actid=' + that.data.activityInfo.id + '&empid=' + app.globalData.currentUserId,
- };
- } else if (e.target.dataset.type == 'collage') {
- that.addsharetap('customerJsAll');
- return {
- title: app.globalData.personMsg.binded.name + "的装修拼团",
- imageUrl: app.globalData.imgUrl + "xcx/collageimg.png",
- path: '/share/pages/collagemsg/collagemsg?empid=' + app.globalData.personMsg.binded.id + '&clientype=' + app.globalData.clientype + '&uid=' + app.globalData.personMsg.id,
- };
- } else if (e.target.dataset.type == 'vrshow') {
- that.addsharetap('toolAll');
- let str = escape(e.target.dataset.url);
- return {
- title: "在线逛展厅-"+app.globalData.companyobj.company_name,
- imageUrl:app.globalData.imgUrl + 'xcx/aaa/vrcover.png',
- path: '/pages/other/other?ctp=' + app.globalData.clientype+'&uid='+ app.globalData.personMsg.id + '&type=vr&vrurl=' + str + '&aid=' + e.target.dataset.id + '&cty=company'
- };
- } else if (e.target.dataset.type == 'broker') {
- that.addsharetap('customerJsAll');
- return {
- title: app.globalData.personMsg.binded.name + "邀请您成为" + (that.data.agentName||'装修推荐官'),
- imageUrl: '../../img/brokerShare.png', //自定义图片路径,图片长宽比是 5:4
- path: '/share/pages/brokerRegister/brokerRegister?id=' + app.globalData.personMsg.binded.id + '&cli=' + app.globalData.clientype + '&uid=' + app.globalData.personMsg.id,
- };
- } else if (e.target.dataset.type == 'constructe') {
- that.addsharetap('toolAll');
- return {
- title: '在施工地-'+app.globalData.companyobj.company_name,
- imageUrl: app.globalData.imgUrl + 'xcx/aaa/constructcover.png',
- path: '/share/pages/constructsitelist/constructsitelist?uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
- }
- } else if (e.target.dataset.type == 'buildinglist') {
- that.addsharetap('toolAll');
- 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 if (e.target.dataset.type == 'strength') {
- that.addsharetap('toolAll');
- return {
- title: "公司实力-"+app.globalData.companyobj.company_name,
- imageUrl: app.globalData.imgUrl + 'xcx/aaa/strengthcover.png',
- path: '/share/pages/companystrength/companystrength?uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&emid=' + app.globalData.personMsg.binded.id
- }
- }
- }
- })
|