// page/home/index.js var businessT = require('../../tool/business-tool.js') var login = require('../../public/login.js') var url = require('../../constant/url.js') import Net from '../../tool/net.js' var net = new Net() var key = require('../../constant/key.js') var businessType = require('../../public/business-type.js') var p = require('public/model/public.js') import PurchaseOrder from 'public/model/purchaseOrder.js' var publicData = require('../../constant/data.js') var app = getApp() Page({ strategyAction: businessT.action(function (sender) { businessT.debugLog(sender) switch (sender.currentTarget.id) { case '1': { wx.navigateTo({ url: 'pages/strategy-s/strategy-s?page=0' }); break } case '2': { wx.navigateTo({ url: 'pages/strategy-s/strategy-s?page=1' }); break } case '3': { wx.navigateTo({ url: 'pages/strategy-s/strategy-s?page=2' }); break } case '4': { wx.navigateTo({ url: 'pages/strategy-a/strategy-a?page=0' }); break } case '5': { wx.navigateTo({ url: 'pages/strategy-a/strategy-a?page=1' }); break } case '6': { wx.navigateTo({ url: 'pages/strategy-a/strategy-a?page=2' }); break } default: break } }), // 隔离 /** * 页面的初始数据 */ data: { collegeTips: "点击'添加到我的小程序'", purchase: [ ['purchase_s', '社保缴纳', '异地买房买车、子女就读必备', '1000'], ['purchase_a', '公积金缴存', '买房贷款必备省钱神器', '3000'], ['s_pay_s', '社保补缴', '解决社保中断问题', '2000'], ['s_pay_a', '公积金补缴', '解决公积金中断问题', '4000'] ], region:['新鲜服务','特色服务','新手指南'], Strategy: [ { img:'shebao', t: '社保缴纳查询攻略', c: '社保缴纳、查询不求人' }, { img:'gjj', t: '公积金缴存查询攻略', c:'买房贷款必备神器'} ], WxAdvertisement:[ { img: 'qujianbu', t: '趣健步', c: '微信步数领红包', id: '1' }, { img: 'tuodan', t: '脱单请点我', c: '领取一个优质对象', id: '2' }, { img: 'nearjob', t: '附近的工作', c: '走路上班回家吃饭', id: '3' }, { img: 'banruo', t: '般若商城', c: '招财 姻缘 风水', id: '4' } ], flow_id: app.globalData.flow_id, flow_name: app.globalData.flow_name }, //新鲜服务-跳转小程序 goAdWx(e){ let id = e.currentTarget.dataset.id switch(id){ case "1": { wx.navigateToMiniProgram({ appId: 'wxdb674acb1231c231', path:'pages/index/index?channel=shanpin&ald_media_id=24879&ald_link_key=5024e38cd497a4ed', extraData: { }, success(res) { // 打开成功 businessT.debugLog("跳转趣健步小程序成功") } }); break } case "2": { wx.navigateToMiniProgram({ appId: 'wx4882c703815c5602', path: '/pages/index/index?promotion=nZW2FKJWji&tl=&nc=', extraData: { }, success(res) { // 打开成功 businessT.debugLog("跳转比心单身小程序成功") } }); break } case "3": { wx.navigateToMiniProgram({ appId: 'wx0fdd65237732c014', extraData: { }, success(res) { // 打开成功 businessT.debugLog("跳转职友集小程序成功") } }); break } case "4": { wx.navigateToMiniProgram({ appId: 'wx7ab08191e61478c5', extraData: { }, success(res) { // 打开成功 businessT.debugLog("跳转般若商城小程序成功") } }); break } } }, //退休养老金 goPensionWx(e) { wx.navigateToMiniProgram({ appId: 'wxcb0ec6ae8c422c3b', extraData: { }, success(res) { // 打开成功 console.log("跳转养老金小程序成功") } }) }, //banner跳H5 gobannerH5(e){ let url = 'https://www.wodeshebao.com/flow2/why.html' wx.navigateTo({ url: '../../public/pages/web-view-H5/web-view-H5?url=' + url, }) }, //社保公积金 goInsuranceH5(e) { wx.navigateTo({ url: '../../public/pages/web-view-H5/web-view-H5?par=' + 1001, }) }, //企业人事服务 goPersonnelService(e){ let url = 'https://www.wodeshebao.com/flow2/en.html' businessT.debugLog(url) wx.navigateTo({ url: '../../public/pages/web-view-H5/web-view-H5?url=' + url, }) }, //显示收藏小程序提示 showModal() { // 创建动画 var animation = wx.createAnimation({ duration: 1000, timingFunction: "ease-in-out", delay: 0 }) this.animation = animation animation.translateX(0).step() this.setData({ animationData: animation.export(), // export 方法每次调用后会清掉之前的动画操作。 showShopPopup: true }) animation.translateX(-202).step() this.setData({ animationData: animation.export(), // export 方法每次调用后会清掉之前的动画操作。 showShopPopup: true }) setTimeout(() => { animation.translateX(0).step() this.setData({ animationData: animation.export(), // export 方法每次调用后会清掉之前的动画操作。 showShopPopup: true }) }, 2500) }, tips: function (sender) { if (sender.currentTarget.id == '0') { wx.navigateTo({ url: 'pages/strategy-s/strategy-s', }) } else { wx.navigateTo({ url: 'pages/strategy-a/strategy-a', }) } }, purchase: businessT.action(function (sender) { businessT.debugLog(sender.currentTarget.id) var order = p.getOrder() switch (sender.currentTarget.id) { case '1000': wx.navigateTo({ url: 'pages/purchase-s-details/purchase-s-details?isSupplementaryPay=0', }) break case '2000': wx.navigateTo({ url: 'pages/purchase-s-details/purchase-s-details?isSupplementaryPay=1', }) break case '3000': wx.navigateTo({ url: 'pages/purchase-a-details/purchase-a-details?isSupplementaryPay=0', }) break case '4000': wx.navigateTo({ url:'pages/purchase-a-details/purchase-a-details?isSupplementaryPay=1', }) break default: break } }), getVersion: function () { businessT.debugLog('getVersion') net.connect({ url: url.www_host + url.getVersion, data: {}, method: 'GET', success: (err, res) => { businessT.debugLog(res.data.tel) if (res.data.tel) { wx.setStorage({ key: key.StorageKey.servicePhone, data: res.data.tel, }) } if (res.data.city) { try { var cityTime = wx.getStorageSync(key.StorageKey.purchaseCityTime) if (!cityTime) { cityTime = 0 } } catch (e) { var cityTime = 0 } if (cityTime != res.data.city) { this.getPurchaseCity(res.data.city) } } }, fail: (err, res) => { businessT.debugLog(err) } }, true) }, getPurchaseCity: function (time) { net.connect({ url: url.app_host + url.getPurchaseCity, data: {}, method: 'GET', success: (err, res) => { var d = {} var p = [] for (var i in res.data) { if (res.data[i].isCity == 0) { p.push({ name: res.data[i].name, id: res.data[i].id }) } else if (res.data[i].isCity == 1) { if (!d[res.data[i].pid]) { d[res.data[i].pid] = [] } d[res.data[i].pid].push({ name: res.data[i].name, id: res.data[i].id }) } } d.p = p publicData.purchaseCity = d wx.setStorageSync(key.StorageKey.purchaseCityTime, time) wx.setStorageSync(key.StorageKey.purchaseCity, d) businessT.debugLog(d) } }, true) }, route: function (path) { var pages = getCurrentPages() wx.navigateBack({ delta: pages.length }) setTimeout(function () { wx.navigateTo({ url: path, }) }.bind(this), 500) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getVersion() login.autoLogin(true) // app.getRedDot() this.showModal(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function (options) { var order = new PurchaseOrder() p.setOrder(order) if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ redDot: app.tabRedDot, selected: 0 }) } // this.showModal(); net.connect({ url: url.app_host + url.getCashCouponCount, data: {}, method: 'POST', success: (err, res) => { businessT.debugLog(res) console.log("测试") console.log(res) }, fail: (err, res) => { businessT.debugLog(err) } }, true) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { return { imageUrl: '../../icon/public/share_img.png', title: '自助缴社保公积金,覆盖200多个城市,专业团队操作' } } })