findcustomertool.js 18 KB

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