index.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. // page/home/index.js
  2. var businessT = require('../../tool/business-tool.js')
  3. var login = require('../../public/login.js')
  4. var url = require('../../constant/url.js')
  5. import Net from '../../tool/net.js'
  6. var net = new Net()
  7. var key = require('../../constant/key.js')
  8. var businessType = require('../../public/business-type.js')
  9. var p = require('public/model/public.js')
  10. import PurchaseOrder from 'public/model/purchaseOrder.js'
  11. var publicData = require('../../constant/data.js')
  12. var app = getApp()
  13. Page({
  14. strategyAction: businessT.action(function (sender) {
  15. businessT.debugLog(sender)
  16. switch (sender.currentTarget.id) {
  17. case '1': {
  18. wx.navigateTo({
  19. url: 'pages/strategy-s/strategy-s?page=0'
  20. });
  21. break
  22. }
  23. case '2': {
  24. wx.navigateTo({
  25. url: 'pages/strategy-s/strategy-s?page=1'
  26. });
  27. break
  28. }
  29. case '3': {
  30. wx.navigateTo({
  31. url: 'pages/strategy-s/strategy-s?page=2'
  32. });
  33. break
  34. }
  35. case '4': {
  36. wx.navigateTo({
  37. url: 'pages/strategy-a/strategy-a?page=0'
  38. });
  39. break
  40. }
  41. case '5': {
  42. wx.navigateTo({
  43. url: 'pages/strategy-a/strategy-a?page=1'
  44. });
  45. break
  46. }
  47. case '6': {
  48. wx.navigateTo({
  49. url: 'pages/strategy-a/strategy-a?page=2'
  50. });
  51. break
  52. }
  53. default: break
  54. }
  55. }),
  56. // 隔离
  57. /**
  58. * 页面的初始数据
  59. */
  60. data: {
  61. collegeTips: "点击'添加到我的小程序'",
  62. purchase: [
  63. ['purchase_s', '社保缴纳', '异地买房买车、子女就读必备', '1000'],
  64. ['purchase_a', '公积金缴存', '买房贷款必备省钱神器', '3000'],
  65. ['s_pay_s', '社保补缴', '解决社保中断问题', '2000'],
  66. ['s_pay_a', '公积金补缴', '解决公积金中断问题', '4000']
  67. ],
  68. region:['新鲜服务','特色服务','新手指南'],
  69. Strategy: [
  70. { img:'shebao', t: '社保缴纳查询攻略', c: '社保缴纳、查询不求人' },
  71. { img:'gjj', t: '公积金缴存查询攻略', c:'买房贷款必备神器'}
  72. ],
  73. WxAdvertisement:[
  74. { img: 'qujianbu', t: '趣健步', c: '微信步数领红包', id: '1' },
  75. { img: 'tuodan', t: '脱单请点我', c: '领取一个优质对象', id: '2' },
  76. { img: 'nearjob', t: '附近的工作', c: '走路上班回家吃饭', id: '3' },
  77. { img: 'banruo', t: '般若商城', c: '招财 姻缘 风水', id: '4' }
  78. ],
  79. flow_id: app.globalData.flow_id,
  80. flow_name: app.globalData.flow_name
  81. },
  82. //新鲜服务-跳转小程序
  83. goAdWx(e){
  84. let id = e.currentTarget.dataset.id
  85. switch(id){
  86. case "1": {
  87. wx.navigateToMiniProgram({
  88. appId: 'wxdb674acb1231c231',
  89. path:'pages/index/index?channel=shanpin&ald_media_id=24879&ald_link_key=5024e38cd497a4ed',
  90. extraData: {
  91. },
  92. success(res) {
  93. // 打开成功
  94. businessT.debugLog("跳转趣健步小程序成功")
  95. }
  96. });
  97. break
  98. }
  99. case "2": {
  100. wx.navigateToMiniProgram({
  101. appId: 'wx4882c703815c5602',
  102. path: '/pages/index/index?promotion=nZW2FKJWji&tl=&nc=',
  103. extraData: {
  104. },
  105. success(res) {
  106. // 打开成功
  107. businessT.debugLog("跳转比心单身小程序成功")
  108. }
  109. });
  110. break
  111. }
  112. case "3": {
  113. wx.navigateToMiniProgram({
  114. appId: 'wx0fdd65237732c014',
  115. extraData: {
  116. },
  117. success(res) {
  118. // 打开成功
  119. businessT.debugLog("跳转职友集小程序成功")
  120. }
  121. });
  122. break
  123. }
  124. case "4": {
  125. wx.navigateToMiniProgram({
  126. appId: 'wx7ab08191e61478c5',
  127. extraData: {
  128. },
  129. success(res) {
  130. // 打开成功
  131. businessT.debugLog("跳转般若商城小程序成功")
  132. }
  133. });
  134. break
  135. }
  136. }
  137. },
  138. //退休养老金
  139. goPensionWx(e) {
  140. wx.navigateToMiniProgram({
  141. appId: 'wxcb0ec6ae8c422c3b',
  142. extraData: {
  143. },
  144. success(res) {
  145. // 打开成功
  146. console.log("跳转养老金小程序成功")
  147. }
  148. })
  149. },
  150. //banner跳H5
  151. gobannerH5(e){
  152. let url = 'https://www.wodeshebao.com/flow2/why.html'
  153. wx.navigateTo({
  154. url: '../../public/pages/web-view-H5/web-view-H5?url=' + url,
  155. })
  156. },
  157. //社保公积金
  158. goInsuranceH5(e) {
  159. wx.navigateTo({
  160. url: '../../public/pages/web-view-H5/web-view-H5?par=' + 1001,
  161. })
  162. },
  163. //企业人事服务
  164. goPersonnelService(e){
  165. let url = 'https://www.wodeshebao.com/flow2/en.html'
  166. businessT.debugLog(url)
  167. wx.navigateTo({
  168. url: '../../public/pages/web-view-H5/web-view-H5?url=' + url,
  169. })
  170. },
  171. //显示收藏小程序提示
  172. showModal() {
  173. // 创建动画
  174. var animation = wx.createAnimation({
  175. duration: 1000,
  176. timingFunction: "ease-in-out",
  177. delay: 0
  178. })
  179. this.animation = animation
  180. animation.translateX(0).step()
  181. this.setData({
  182. animationData: animation.export(), // export 方法每次调用后会清掉之前的动画操作。
  183. showShopPopup: true
  184. })
  185. animation.translateX(-202).step()
  186. this.setData({
  187. animationData: animation.export(), // export 方法每次调用后会清掉之前的动画操作。
  188. showShopPopup: true
  189. })
  190. setTimeout(() => {
  191. animation.translateX(0).step()
  192. this.setData({
  193. animationData: animation.export(), // export 方法每次调用后会清掉之前的动画操作。
  194. showShopPopup: true
  195. })
  196. }, 2500)
  197. },
  198. tips: function (sender) {
  199. if (sender.currentTarget.id == '0') {
  200. wx.navigateTo({
  201. url: 'pages/strategy-s/strategy-s',
  202. })
  203. } else {
  204. wx.navigateTo({
  205. url: 'pages/strategy-a/strategy-a',
  206. })
  207. }
  208. },
  209. purchase: businessT.action(function (sender) {
  210. businessT.debugLog(sender.currentTarget.id)
  211. var order = p.getOrder()
  212. switch (sender.currentTarget.id) {
  213. case '1000':
  214. wx.navigateTo({
  215. url: 'pages/purchase-s-details/purchase-s-details?isSupplementaryPay=0',
  216. })
  217. break
  218. case '2000':
  219. wx.navigateTo({
  220. url: 'pages/purchase-s-details/purchase-s-details?isSupplementaryPay=1',
  221. })
  222. break
  223. case '3000':
  224. wx.navigateTo({
  225. url: 'pages/purchase-a-details/purchase-a-details?isSupplementaryPay=0',
  226. })
  227. break
  228. case '4000':
  229. wx.navigateTo({
  230. url:'pages/purchase-a-details/purchase-a-details?isSupplementaryPay=1',
  231. })
  232. break
  233. default:
  234. break
  235. }
  236. }),
  237. getVersion: function () {
  238. businessT.debugLog('getVersion')
  239. net.connect({
  240. url: url.www_host + url.getVersion,
  241. data: {},
  242. method: 'GET',
  243. success: (err, res) => {
  244. businessT.debugLog(res.data.tel)
  245. if (res.data.tel) {
  246. wx.setStorage({
  247. key: key.StorageKey.servicePhone,
  248. data: res.data.tel,
  249. })
  250. }
  251. if (res.data.city) {
  252. try {
  253. var cityTime = wx.getStorageSync(key.StorageKey.purchaseCityTime)
  254. if (!cityTime) {
  255. cityTime = 0
  256. }
  257. } catch (e) {
  258. var cityTime = 0
  259. }
  260. if (cityTime != res.data.city) {
  261. this.getPurchaseCity(res.data.city)
  262. }
  263. }
  264. },
  265. fail: (err, res) => {
  266. businessT.debugLog(err)
  267. }
  268. }, true)
  269. },
  270. getPurchaseCity: function (time) {
  271. net.connect({
  272. url: url.app_host + url.getPurchaseCity,
  273. data: {},
  274. method: 'GET',
  275. success: (err, res) => {
  276. var d = {}
  277. var p = []
  278. for (var i in res.data) {
  279. if (res.data[i].isCity == 0) {
  280. p.push({ name: res.data[i].name, id: res.data[i].id })
  281. } else if (res.data[i].isCity == 1) {
  282. if (!d[res.data[i].pid]) {
  283. d[res.data[i].pid] = []
  284. }
  285. d[res.data[i].pid].push({ name: res.data[i].name, id: res.data[i].id })
  286. }
  287. }
  288. d.p = p
  289. publicData.purchaseCity = d
  290. wx.setStorageSync(key.StorageKey.purchaseCityTime, time)
  291. wx.setStorageSync(key.StorageKey.purchaseCity, d)
  292. businessT.debugLog(d)
  293. }
  294. }, true)
  295. },
  296. route: function (path) {
  297. var pages = getCurrentPages()
  298. wx.navigateBack({
  299. delta: pages.length
  300. })
  301. setTimeout(function () {
  302. wx.navigateTo({
  303. url: path,
  304. })
  305. }.bind(this), 500)
  306. },
  307. /**
  308. * 生命周期函数--监听页面加载
  309. */
  310. onLoad: function (options) {
  311. this.getVersion()
  312. login.autoLogin(true)
  313. // app.getRedDot()
  314. this.showModal();
  315. },
  316. /**
  317. * 生命周期函数--监听页面初次渲染完成
  318. */
  319. onReady: function () {
  320. },
  321. /**
  322. * 生命周期函数--监听页面显示
  323. */
  324. onShow: function (options) {
  325. var order = new PurchaseOrder()
  326. p.setOrder(order)
  327. if (typeof this.getTabBar === 'function' &&
  328. this.getTabBar()) {
  329. this.getTabBar().setData({
  330. redDot: app.tabRedDot,
  331. selected: 0
  332. })
  333. }
  334. // this.showModal();
  335. net.connect({
  336. url: url.app_host + url.getCashCouponCount,
  337. data: {},
  338. method: 'POST',
  339. success: (err, res) => {
  340. businessT.debugLog(res)
  341. console.log("测试")
  342. console.log(res)
  343. },
  344. fail: (err, res) => {
  345. businessT.debugLog(err)
  346. }
  347. }, true)
  348. },
  349. /**
  350. * 生命周期函数--监听页面隐藏
  351. */
  352. onHide: function () {
  353. },
  354. /**
  355. * 生命周期函数--监听页面卸载
  356. */
  357. onUnload: function () {
  358. },
  359. /**
  360. * 页面相关事件处理函数--监听用户下拉动作
  361. */
  362. onPullDownRefresh: function () {
  363. },
  364. /**
  365. * 页面上拉触底事件的处理函数
  366. */
  367. onReachBottom: function () {
  368. },
  369. /**
  370. * 用户点击右上角分享
  371. */
  372. onShareAppMessage: function () {
  373. return {
  374. imageUrl: '../../icon/public/share_img.png',
  375. title: '自助缴社保公积金,覆盖200多个城市,专业团队操作'
  376. }
  377. }
  378. })