index.js 10 KB

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