var businessT = require('../../../tools/business-tool.js') var sysT = require('../../../tools/sys-tool.js') const average = [7425, 7480, 7706, 7132] const result = [ { status: '有点寒碜', introductions: '努力提高你的工资吧' }, { status: '衣食无忧', introductions: '不缺吃不缺穿,偶尔下馆子' }, { status: '小资', introductions: '不愁吃不愁穿,还能旅个游' }, { status: '土豪君', introductions: '可随便吃喝玩乐,任性不差钱' } ] var app = getApp() Page({ /** * 页面的初始数据 */ data: { isRelay: false, result: {status: '', introductions: ''}, ui: { nick: "", avatar: "", A: '', B: '', C: '', income: '', city: '' }, interval: 0, medical: { s: false, d: '' }, data: [] }, yearAction: businessT.action(function (sender) { wx.navigateTo({ url: '../year/year', }) }), getResult: function (income, city) { var a = average[3] businessT.debugLog(city); businessT.debugLog(a) if (income >= a * 1.5) { return result[3] } else if (income >= a) { return result[2] } else if (income >= a * 3 / 5) { return result[1] } else { return result[0] } }, calculatorAction: businessT.action(function (sender) { wx.reLaunch({ url: '../index', }) }), //跳转社保小程序 toPurchase: businessT.action(function (sender) { wx.navigateToMiniProgram({ appId: 'wxbf3f03f8a7d0cdcf', }) }), /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { businessT.debugLog(options) this.data.ui.avatar = options.url this.data.ui.nick = options.nick this.data.ui.A = options.A this.data.ui.B = options.B this.data.ui.C = options.C this.data.ui.income = options.income this.data.ui.city = options.city this.data.result = this.getResult(options.income, options.city) if (options.isRelay) { this.data.isRelay = options.isRelay } //年度个税 this.data.data = app.result this.data.medical.s = app.medical.s this.data.medical.d = app.medical.rebate.toFixed(2) this.setData({ ui: this.data.ui, isRelay: this.data.isRelay, result: this.data.result, data: this.data.data, medical: this.data.medical }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { return { title: this.data.ui.nick + ',邀请你PK税后工资', path: 'page/home/result/result?url=' + this.data.ui.avatar + '&nick=' + this.data.ui.nick + '&A=' + this.data.ui.A + '&B=' + this.data.ui.B + '&C=' + this.data.ui.C + '&income=' + this.data.ui.income + '&city=' + this.data.ui.city + '&isRelay=1' } } })