123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- var app = getApp()
- var publicData = require('../../../../constant/data.js')
- var businessT = require('../../../../tool/business-tool.js')
- var url = require('../../../../constant/url.js')
- import Net from '../../../../tool/net.js'
- var net = new Net()
- var businessType = require('../../../../public/business-type.js')
- var key = require('../../../../constant/key.js')
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- businessType: 's',
- header: {
- t: '',
- s: '省去繁琐流程,购买更快捷',
- src: ''
- },
- list: '',
- option: [
- {t: '', c: ''},
- {t: '', c: '', s: false, i: '1'}
- ],
- minMonths: 1,
- beginTime: '',
- isNeedSalary: false,
- minSalary: 2500,
- isInOffice: { t: '是否在职', s: false, tips: true, c: false, i: '2' },
- salary: { t: '社保流水', p: '', v: '', s: false },
- tipsInfo: { h: true, a: '' },
- },
- commitAction: businessT.action(function (sender) {
- var time = Number(sender.currentTarget.id)
- if (time < this.data.minMonths) {
- wx.showToast({
- title: '该城市需要至少购买' + this.data.minMonths + '个月',
- icon: 'none'
- })
- return
- }
- var order = app.purchase.order
- var isNeedSalary = false
- if ((this.data.businessType == 's' && this.data.isNeedSalary) || (this.data.businessType == 'a' && order.pack && this.data.isNeedSalary)) {
- if (!order.isInOffice) {
- if (order.salary == 0) {
- wx.showToast({
- title: '请填写范围内的社保流水',
- icon: 'none'
- })
- return
- }
- if (order.salary < this.data.minSalary || order.salary > 5000) {
- wx.showToast({
- title: '请填写范围内的社保流水',
- icon: 'none'
- })
- return
- }
- }
-
- isNeedSalary = true
- }
-
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- order.isNeedSalary = isNeedSalary
- order.timeInterval = time
- if (order.timeInterval == 1) {
- order.endTime = order.beginTime
- } else {
- var year = Number(order.beginTime.slice(0, 4))
- var month = Number(order.beginTime.slice(5, 7)) + order.timeInterval - 1
- if (month > 12) {
- year += 1
- month -= 12
- }
- if (month < 10) {
- order.endTime = year + '年0' + month + '月'
- } else {
- order.endTime = year + '年' + month + '月'
- }
- }
- if (this.data.businessType == 's') {
- order.payFor = order.pack ? businessType.PurchasePayFor.socialInsurancePackage : businessType.PurchasePayFor.socialInsurance
- var fund = order.pack ? Number(order.accumulationFund) : 0
- } else {
- order.payFor = order.pack ? businessType.PurchasePayFor.accumulationFundPackage : businessType.PurchasePayFor.accumulationFund
- var fund = Number(order.accumulationFund)
- }
-
- var obj = {
- sbuId: order.customerData.sbuId,
- cid: order.id,
- shebao_card: order.SSCard,
- hukou_type: order.accountType,
- month: businessT.changeTimeToNumber(order.beginTime),
- fund: fund,
- nums: order.timeInterval,
- pay_for: order.payFor
- }
- businessT.debugLog(obj)
- net.connectNeedLogin({
- url: url.app_host + url.getTotalFee,
- data: obj,
- success: (err, res) => {
- order.totalFee = res.data
- wx.hideLoading()
- wx.navigateTo({
- url: '../pay-order/pay-order',
- })
- },
- fail: (err, res) => {
- wx.hideLoading()
- businessT.showFailTips(err, '加载失败')
- }
- }, true)
- }),
- switchAction: function (sender) {
- var order = app.purchase.order
- if (sender.currentTarget.id == '1') {
- order.pack = sender.detail.value
- this.data.option[1].c = sender.detail.value
- } else if (sender.currentTarget.id == '2') {
- order.isInOffice = sender.detail.value
- this.data.isInOffice.c = sender.detail.value
- }
- this.judgeSalary()
- this.setData({
- option: this.data.option,
- salary: this.data.salary,
- isInOffice: this.data.isInOffice
- })
- },
- chooseTime: businessT.action(function (sender) {
- wx.navigateTo({
- url: '../choose-date/choose-date?type=single&beginTime=' + this.data.beginTime,
- })
- }),
- finishChooseDate: function (date) {
- businessT.debugLog(date)
- var order = app.purchase.order
- var beginMonth = date.beginMonth % 100
- if (beginMonth < 10) {
- order.beginTime = ((date.beginMonth / 100) | 0) + '年0' + beginMonth + '月'
- } else {
- order.beginTime = ((date.beginMonth / 100) | 0) + '年' + beginMonth + '月'
- }
- this.data.option[0].c = beginMonth + '月份'
- this.setData({
- option: this.data.option
- })
- },
- judgeSalary: function () {
- var order = app.purchase.order
- if ((this.data.businessType == 's' && this.data.isNeedSalary) || (this.data.businessType == 'a' && order.pack && this.data.isNeedSalary)) {
- this.data.isInOffice.s = true
- if (order.isInOffice) {
- this.data.salary.s = false
- } else {
- this.data.salary.s = true
- }
-
- } else {
- this.data.isInOffice.s = false
- this.data.salary.s = false
- }
- this.data.minSalary = wx.getStorageSync(key.StorageKey.minSalary)
- this.data.salary.p = this.data.minSalary + '元-5000元'
- },
- inputAction: function (sender) {
- businessT.debugLog(sender)
- this.changeSalary(sender.detail.value)
- },
- changeSalary: function (salary) {
- var order = app.purchase.order
- order.salary = salary
- this.data.salary.v = salary
- this.setData({
- salary: this.data.salary
- })
- },
- wxvoid: function () {
- },
- tipsInfo: businessT.action(function (sender) {
- if (!this.data.tipsInfo.h) {
- return
- }
- this.data.tipsInfo.h = false
- this.setData({
- tipsInfo: this.data.tipsInfo
- })
- var animation = wx.createAnimation({
- duration: 300,
- timingFunction: 'ease',
- })
- animation.bottom('0rpx').step()
- this.setData({
- tipsInfo: {
- a: animation.export(),
- h: false
- }
- })
- }),
- dismissSalaryInfo: businessT.action(function (sender) {
- var animation = wx.createAnimation({
- duration: 300,
- timingFunction: 'ease',
- })
- animation.bottom('-800rpx').step()
- this.setData({
- tipsInfo: {
- a: animation.export(),
- h: false
- }
- })
- setTimeout(function () {
- this.data.tipsInfo.h = true
- this.setData({
- tipsInfo: this.data.tipsInfo
- })
- }.bind(this), 300)
- }),
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- if (options.businessType) {
- this.data.businessType = options.businessType
- }
- this.data.minMonths = options.minMonths
- this.data.beginTime = options.beginTime
- this.data.isNeedSalary = options.isNeedSalary == 1
- // businessT.debugLog(options.businessType)
- this.judgeSalary()
- var order = app.purchase.order
- businessT.debugLog(order)
- this.data.list = order.customerData.user_name + '\n' + order.customerData.id_card + '\n' + publicData.accounts[order.accountType - 1] + '\n' + options.cityName
- var beginTime = Number(order.beginTime.slice(5, 7)) + '月份'
- if (this.data.businessType == 's') {
- this.data.header.t = '社保一键续缴'
- this.data.header.src = '../../../../icon/public/customer_header_s.png'
- this.data.option = [
- { t: '续缴月份', c: beginTime },
- { t: '是否同时购买公积金', c: order.pack, s: order.pack }
- ]
- wx.setNavigationBarTitle({
- title: '社保续缴',
- })
- } else {
- this.data.header.t = '公积金一键续存'
- this.data.header.src = '../../../../icon/public/customer_header_a.png'
- this.data.option = [
- { t: '续存月份', c: beginTime },
- { t: '是否同时购买社保', c: order.pack, s: order.pack }
- ]
- wx.setNavigationBarTitle({
- title: '公积金续存',
- })
- }
- this.setData({
- minMonths: this.data.minMonths,
- list: this.data.list,
- option: this.data.option,
- header: this.data.header,
- salary: this.data.salary,
- isInOffice: this.data.isInOffice
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
- /**
- * 用户点击右上角分享
- */
- // onShareAppMessage: function () {
-
- // }
- })
|