findcustomertool.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. // pages/findcustomertool/findcustomertool.js
  2. var app = getApp();
  3. const utils = require("../../utils/http");
  4. var stoptime = 0;
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. agentName: app.globalData.agentName,
  11. webUrl: '',
  12. share_user_id: '',
  13. imgUrl: app.globalData.imgUrl,
  14. mattertype: '辅助业主',
  15. datashow: false,
  16. type: 1,
  17. turntableDetail: {},
  18. activityInfo: {},
  19. havePinTuan: 0,
  20. toolnumobj:{},
  21. activitynum:0,
  22. showMask: false,
  23. hallvrarr:[],
  24. },
  25. /**
  26. * 生命周期函数--监听页面加载
  27. */
  28. onLoad: function (options) {
  29. this.setData({
  30. type: options.type,
  31. imgUrl: app.globalData.imgUrl
  32. })
  33. wx.setNavigationBarTitle({
  34. title: options.type == 1 ? (app.globalData.companyobj.company_name+'智慧屏' ): '转化工具',
  35. })
  36. wx.hideShareMenu({
  37. menus: ['shareAppMessage', 'shareTimeline']
  38. })
  39. wx.showLoading({
  40. title: '加载中...',
  41. })
  42. this.setData({
  43. webUrl: app.globalData.webUrl + 'applet.html#/findcustomertool?token=' + app.globalData.token,
  44. })
  45. if(this.data.type==1){
  46. this.getvrhall();
  47. }
  48. this.getTurntableDetail();
  49. this.getActivityInfo();
  50. this.getPinTuanData();
  51. this.getdenumfun();
  52. },
  53. getvrhall(){
  54. const that=this;
  55. utils.$post({
  56. url: app.globalData.webUrl + 'api/index/compvrshow_list',
  57. header: {
  58. 'Authorization': 'bearer ' + app.globalData.token
  59. },
  60. data: {},
  61. success: function (res) {
  62. if (res.data.code == '0') {
  63. that.setData({
  64. hallvrarr:res.data.data
  65. })
  66. }
  67. }
  68. })
  69. },
  70. showvrtap(){
  71. this.setData({
  72. showMask:true
  73. })
  74. },
  75. getdenumfun(){
  76. const that=this;
  77. utils.$post({
  78. url: app.globalData.webUrl + 'api/index/afszxy_count',
  79. header: {
  80. 'Authorization': 'bearer ' + app.globalData.token
  81. },
  82. data: {},
  83. success: function (res) {
  84. if (res.data.code == '0') {
  85. that.setData({
  86. toolnumobj: res.data.data,
  87. activitynum:res.data.data.activity_num?res.data.data.activity_num:0
  88. })
  89. }
  90. }
  91. })
  92. },
  93. closeMaskView() {
  94. this.setData({
  95. showMask: false,
  96. })
  97. },
  98. setypetap(e) {
  99. this.setData({
  100. type: e.currentTarget.dataset.type
  101. })
  102. },
  103. tooltap: function (e) {
  104. this.setData({
  105. mattertype: e.currentTarget.dataset.type
  106. })
  107. },
  108. toViewBuilding () {
  109. wx.navigateTo({
  110. url: '/index/pages/viewbuilding/viewbuilding?type=1',
  111. })
  112. },
  113. housestyleBtn: function () {
  114. wx.navigateTo({
  115. url: "/pages/housestyle/housestyle",
  116. });
  117. },
  118. offerTap: function () {
  119. wx.navigateTo({
  120. url: "/pages/decorateoffer/decorateoffer",
  121. });
  122. },
  123. collageTap: function () {
  124. wx.navigateTo({
  125. url: "/pages/other/other?type=121",
  126. });
  127. },
  128. designertap() {
  129. wx.navigateTo({
  130. url: "/customer/pages/designerlist/designerlist?type=1",
  131. });
  132. },
  133. oldhouserenovationTap: function () {
  134. wx.navigateTo({
  135. url: "/pages/oldhouserenovation/oldhouserenovation",
  136. });
  137. },
  138. decorationhelpTap: function () {
  139. wx.navigateTo({
  140. url: "/index/pages/decorationhelp/decorationhelp",
  141. });
  142. },
  143. toSmartScreenPage: function () {
  144. wx.reLaunch({
  145. url: '/pages/index/index?state=1',
  146. })
  147. },
  148. nameCardTap: function () {
  149. wx.navigateTo({
  150. url: '/index/pages/namecard/namecard',
  151. })
  152. },
  153. desarotelistap: function () {
  154. wx.navigateTo({
  155. url: "/index/pages/indexlist/indexlist",
  156. });
  157. },
  158. brokerManager: function() {
  159. wx.navigateTo({
  160. url: '/pages/other/other?type=9009',
  161. })
  162. },
  163. /**
  164. * 生命周期函数--监听页面初次渲染完成
  165. */
  166. onReady: function () {
  167. },
  168. vrtap() {
  169. if (this.data.hallvrarr.length==0) {
  170. wx.navigateTo({
  171. url: '/pages/noneData/noneData?type=2',
  172. })
  173. return false;
  174. }else if(this.data.hallvrarr.length==1){
  175. wx.navigateTo({
  176. 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),
  177. })
  178. }else{
  179. this.setData({
  180. showMask:true
  181. })
  182. }
  183. },
  184. lvrtap(e){
  185. let num=e.currentTarget.dataset.idx;
  186. wx.navigateTo({
  187. 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),
  188. })
  189. },
  190. /**
  191. * 生命周期函数--监听页面显示
  192. */
  193. onShow: function () {
  194. var that = this;
  195. stoptime = 0;
  196. setTimeout(function () {
  197. stoptime = stoptime * 1 + 1;
  198. that.setData({
  199. datashow: true
  200. })
  201. wx.hideLoading()
  202. }, 1000)
  203. },
  204. /**
  205. * 生命周期函数--监听页面隐藏
  206. */
  207. onHide: function () {
  208. var timearr = app.globalData.timearr,
  209. flag = false;
  210. for (var i = 0; i < timearr.length; i++) {
  211. if (timearr[i].type == 'customertool') {
  212. timearr[i].time = timearr[i].time * 1 + stoptime * 1;
  213. flag = true;
  214. }
  215. }
  216. if (!flag) {
  217. var obj = {
  218. type: 'customertool',
  219. time: stoptime
  220. };
  221. app.globalData.timearr.push(obj);
  222. } else {
  223. app.globalData.timearr = timearr;
  224. }
  225. },
  226. networktap: function () {
  227. },
  228. /**
  229. * 生命周期函数--监听页面卸载
  230. */
  231. onUnload: function () {
  232. },
  233. strengthtap() {
  234. wx.navigateTo({
  235. url: '/customer/pages/companystrength/companystrength?type=1'
  236. })
  237. },
  238. publicpraisetap() {
  239. wx.navigateTo({
  240. url: '/customer/pages/publicpraise/publicpraise?type=1'
  241. })
  242. },
  243. caseBtn() {
  244. wx.navigateTo({
  245. url: '/pages/decorateguide/decorateguide?type=1'
  246. })
  247. },
  248. turntable() {
  249. wx.navigateTo({
  250. url: '/customer/pages/activitydetail/activitydetail',
  251. })
  252. },
  253. smashGoldenEggs() {
  254. wx.navigateTo({
  255. url: '/customer/pages/goldeneggact/goldeneggact',
  256. })
  257. },
  258. activityap() {
  259. wx.navigateTo({
  260. url: '/customer/pages/activitylist/activitylist',
  261. })
  262. },
  263. /**
  264. * 大转盘砸金蛋-员工转发活动记录
  265. */
  266. shareCountRecord(actid) {
  267. var that = this;
  268. utils.$post({
  269. url: app.globalData.webUrl + 'api/lottery/act_forward_log',
  270. header: {
  271. 'Authorization': 'bearer ' + app.globalData.token
  272. },
  273. data: {
  274. actid: actid
  275. },
  276. success: function (res) {
  277. if (res.data.code == '0') {
  278. console.log('成功')
  279. }
  280. }
  281. })
  282. },
  283. /**
  284. * 大转盘活动
  285. */
  286. getTurntableDetail() {
  287. var that = this;
  288. utils.$post({
  289. url: app.globalData.webUrl + 'api/lottery/act_detail',
  290. header: {
  291. 'Authorization': 'bearer ' + app.globalData.token
  292. },
  293. data: {},
  294. success: function (res) {
  295. if (res.data.code == '0') {
  296. that.setData({
  297. turntableDetail: res.data.data || {},
  298. })
  299. }
  300. }
  301. })
  302. },
  303. addsharetap: function (type) {
  304. let that = this;
  305. utils.$post({
  306. url: app.globalData.webUrl + 'api/share/addlog',
  307. header: {
  308. 'Authorization': 'bearer ' + app.globalData.token
  309. },
  310. data: {
  311. id: '0',
  312. type: type,
  313. },
  314. success: function (r) {}
  315. })
  316. },
  317. /**
  318. * 砸金蛋获取活动详情
  319. */
  320. getActivityInfo() {
  321. var that = this;
  322. utils.$post({
  323. url: app.globalData.webUrl + 'api/lottery/egg_act_detail',
  324. header: {
  325. 'Authorization': 'bearer ' + app.globalData.token
  326. },
  327. data: {},
  328. success: function (res) {
  329. if (res.data.code == '0') {
  330. that.setData({
  331. activityInfo: res.data.data || {},
  332. })
  333. }
  334. }
  335. })
  336. },
  337. /**
  338. * 获取拼团
  339. */
  340. getPinTuanData() {
  341. let that = this;
  342. utils.$post({
  343. url: app.globalData.webUrl + 'api/spellgroup/sel_company_spellact',
  344. header: {
  345. 'Authorization': 'bearer ' + app.globalData.token
  346. },
  347. data: {},
  348. success: function (res) {
  349. console.log(res, '<<><><>');
  350. //1->活动下架,2->已参加过,3->拼团人数已满,4->拼团时限结束,0->拼团成功
  351. if (res.data.code == '0') {
  352. that.setData({
  353. havePinTuan: res.data.data
  354. })
  355. }
  356. }
  357. })
  358. },
  359. /**
  360. * 没有拼团活动提示
  361. */
  362. handleTips(e) {
  363. let type = e.currentTarget.dataset.type;
  364. if (type == 'collage') {
  365. wx.navigateTo({
  366. url: '/pages/noneData/noneData?type=5',
  367. })
  368. } else if (type == 'turntable') {
  369. wx.navigateTo({
  370. url: '/pages/noneData/noneData?type=4',
  371. })
  372. } else if (type == 'goldenEggs') {
  373. wx.navigateTo({
  374. url: '/pages/noneData/noneData?type=3',
  375. })
  376. }
  377. },
  378. /**
  379. * 大转盘-抽奖客户
  380. */
  381. lotteryClient() {
  382. if (!this.data.turntableDetail.id) {
  383. wx.navigateTo({
  384. url: '/pages/noneData/noneData?type=4',
  385. })
  386. return;
  387. }
  388. wx.navigateTo({
  389. url: '/pages/other/other?type=29&actid=' + this.data.turntableDetail.id,
  390. })
  391. },
  392. /**
  393. * 砸金蛋-抽奖客户
  394. */
  395. joinCustomer() {
  396. if (!this.data.activityInfo.id) {
  397. wx.navigateTo({
  398. url: '/pages/noneData/noneData?type=3',
  399. })
  400. return;
  401. }
  402. wx.navigateTo({
  403. url: '/pages/other/other?type=29' + '&actid=' + this.data.activityInfo.id,
  404. })
  405. },
  406. buildtap:function(){
  407. wx.navigateTo({
  408. url: '/customer/pages/site/site?type=2',
  409. })
  410. },
  411. /**
  412. * 页面相关事件处理函数--监听用户下拉动作
  413. */
  414. onPullDownRefresh: function () {
  415. },
  416. dothis(){},
  417. /**
  418. * 页面上拉触底事件的处理函数
  419. */
  420. onReachBottom: function () {
  421. },
  422. /**
  423. * 用户点击右上角分享
  424. // */
  425. onShareAppMessage: function (e) {
  426. let that = this;
  427. if (e.target.dataset.type == 'style') {
  428. that.addsharetap('customerJsAll');
  429. return {
  430. title: '装修风格测一测', // 默认是小程序的名称(可以写slogan等)
  431. path: '/share/pages/beforetest/beforetest?type=housestyle&share_user_id=' + app.globalData.personMsg.id + "&clientype=" + app.globalData.clientype, // 默认是当前页面,必须是以‘/’开头的完整路径
  432. imageUrl: app.globalData.imgUrl + 'xcx/styletool.jpg', //自定义图片路径,图片长宽比是 5:4
  433. }
  434. } else if (e.target.dataset.type == 'old') {
  435. that.addsharetap('customerJsAll');
  436. return {
  437. title: '老房翻新风格测一测', // 默认是小程序的名称(可以写slogan等)
  438. path: '/share/pages/beforetest/beforetest?type=oldhouserenovation&share_user_id=' + app.globalData.personMsg.id + "&clientype=" + app.globalData.clientype, // 默认是当前页面,必须是以‘/’开头的完整路径
  439. imageUrl: app.globalData.imgUrl + 'xcx/oldbewell.jpg', //自定义图片路径,图片长宽比是 5:4
  440. }
  441. } else if (e.target.dataset.type == 'price') {
  442. that.addsharetap('customerJsAll');
  443. return {
  444. title: '装修报价算一算', // 默认是小程序的名称(可以写slogan等)
  445. path: '/share/pages/beforetest/beforetest?type=decorateoffer&share_user_id=' + app.globalData.personMsg.id + "&clientype=" + app.globalData.clientype, // 默认是当前页面,必须是以‘/’开头的完整路径
  446. imageUrl: app.globalData.imgUrl + 'xcx/pricetool.jpg', //自定义图片路径,图片长宽比是 5:4
  447. }
  448. } else if (e.target.dataset.type == 'index') {
  449. that.addsharetap('toolAll');
  450. return {
  451. title: app.globalData.personMsg.binded.name + '的微官网', // 默认是小程序的名称(可以写slogan等)
  452. path: '/pages/index/index?type=share&share_user_id=' + app.globalData.personMsg.id + "&clientype=" + app.globalData.clientype + "&state=1", // 默认是当前页面,必须是以‘/’开头的完整路径
  453. imageUrl: app.globalData.imgUrl + 'xcx/xcxweiw.jpg', //自定义图片路径,图片长宽比是 5:4
  454. }
  455. } else if (e.target.dataset.type == 'case') {
  456. that.addsharetap('toolAll');
  457. return {
  458. title: app.globalData.personMsg.binded.name + "的装修案例",
  459. imageUrl: app.globalData.imgUrl + "xcx/caseposter.jpg",
  460. path: '/share/pages/caselist/caselist?u=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&c=&s=&st=&e=&h='
  461. }
  462. } else if (e.target.dataset.type == 'publicpraise') {
  463. that.addsharetap('toolAll');
  464. return {
  465. title: "业主好评-"+app.globalData.companyobj.company_name,
  466. imageUrl: app.globalData.imgUrl + "xcx/praiseimg.jpg",
  467. path: '/share/pages/praiselist/praiselist?uid=' + app.globalData.personMsg.id + '&cate=&ctp=' + app.globalData.clientype
  468. }
  469. } else if (e.target.dataset.type == 'designer') {
  470. that.addsharetap('toolAll');
  471. return {
  472. title: "设计大师-"+app.globalData.companyobj.company_name,
  473. imageUrl: app.globalData.imgUrl + "/xcx/designerlisticon.jpg",
  474. path: '/share/pages/designerlist/designerlist?uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
  475. }
  476. } else if (e.target.dataset.type == 'namecard') {
  477. return {
  478. title: app.globalData.personMsg.binded.name + "的个人名片",
  479. imageUrl: app.globalData.imgUrl + "/xcx/sharenamecard.png",
  480. path: '/share/pages/shareCard/shareCard?uid=' + app.globalData.shareuserid + '&empid=' + app.globalData.personMsg.binded.id + '&ctp=' + app.globalData.clientype,
  481. };
  482. } else if (e.target.dataset.type == 'turntable') {
  483. that.addsharetap('customerJsAll');
  484. that.shareCountRecord(that.data.turntableDetail.id);
  485. return {
  486. title: that.data.turntableDetail.title,
  487. imageUrl:app.globalData.imgUrl + "xcx/shareturntable.jpg",
  488. path: '/share/pages/activity/activity?uid=' + app.globalData.personMsg.id + '&clientype=' + app.globalData.clientype + '&actid=' + that.data.turntableDetail.id + '&empid=' + app.globalData.currentUserId,
  489. };
  490. } else if (e.target.dataset.type == 'goldenEggs') {
  491. that.addsharetap('customerJsAll');
  492. that.shareCountRecord(that.data.activityInfo.id);
  493. return {
  494. title: that.data.activityInfo.title,
  495. imageUrl: app.globalData.imgUrl + "xcx/shareGoldenEgg.jpg",
  496. path: '/share/pages/eggsactivity/eggsactivity?uid=' + app.globalData.personMsg.id + '&clientype=' + app.globalData.clientype + '&actid=' + that.data.activityInfo.id + '&empid=' + app.globalData.currentUserId,
  497. };
  498. } else if (e.target.dataset.type == 'collage') {
  499. that.addsharetap('customerJsAll');
  500. return {
  501. title: app.globalData.personMsg.binded.name + "的装修拼团",
  502. imageUrl: app.globalData.imgUrl + "xcx/collageimg.png",
  503. path: '/share/pages/collagemsg/collagemsg?empid=' + app.globalData.personMsg.binded.id + '&clientype=' + app.globalData.clientype + '&uid=' + app.globalData.personMsg.id,
  504. };
  505. } else if (e.target.dataset.type == 'vrshow') {
  506. that.addsharetap('toolAll');
  507. let str = escape(e.target.dataset.url);
  508. return {
  509. title: "在线逛展厅-"+app.globalData.companyobj.company_name,
  510. imageUrl:app.globalData.imgUrl + 'xcx/aaa/vrcover.png',
  511. path: '/pages/other/other?ctp=' + app.globalData.clientype+'&uid='+ app.globalData.personMsg.id + '&type=vr&vrurl=' + str + '&aid=' + e.target.dataset.id + '&cty=company'
  512. };
  513. } else if (e.target.dataset.type == 'broker') {
  514. that.addsharetap('customerJsAll');
  515. return {
  516. title: app.globalData.personMsg.binded.name + "邀请您成为" + (that.data.agentName||'装修推荐官'),
  517. imageUrl: '../../img/brokerShare.png', //自定义图片路径,图片长宽比是 5:4
  518. path: '/share/pages/brokerRegister/brokerRegister?id=' + app.globalData.personMsg.binded.id + '&cli=' + app.globalData.clientype + '&uid=' + app.globalData.personMsg.id,
  519. };
  520. } else if (e.target.dataset.type == 'constructe') {
  521. that.addsharetap('toolAll');
  522. return {
  523. title: '在施工地-'+app.globalData.companyobj.company_name,
  524. imageUrl: app.globalData.imgUrl + 'xcx/aaa/constructcover.png',
  525. path: '/share/pages/constructsitelist/constructsitelist?uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
  526. }
  527. } else if (e.target.dataset.type == 'buildinglist') {
  528. that.addsharetap('toolAll');
  529. return {
  530. title: "营销楼盘-"+app.globalData.companyobj.company_name,
  531. imageUrl: app.globalData.imgUrl + 'xcx/aaa/buildcover.png',
  532. path: '/share/pages/buildinglist/buildinglist?uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&emid=' + app.globalData.personMsg.binded.id
  533. }
  534. }else if (e.target.dataset.type == 'strength') {
  535. that.addsharetap('toolAll');
  536. return {
  537. title: "公司实力-"+app.globalData.companyobj.company_name,
  538. imageUrl: app.globalData.imgUrl + 'xcx/aaa/strengthcover.png',
  539. path: '/share/pages/companystrength/companystrength?uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&emid=' + app.globalData.personMsg.binded.id
  540. }
  541. }
  542. }
  543. })