123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607 |
- var sysT = require('../../../../tool/sys-tool.js')
- var businessT = require('../../../../tool/business-tool.js')
- var purchaseO = require('../../public/model/purchaseOrder.js')
- var p = require('../../public/model/public.js')
- var app = getApp()
- var publicData = require('../../../../constant/data.js')
- var purchaseData = require('../../public/model/purchase-details.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')
- import PurchaseOrder from '../../public/model/purchaseOrder.js'
- var login = require('../../../../public/login.js')
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- isFirstLoad: true,
- ui: {
- tips: {
- explain: [],
- choose: [],
- process: 'process_a',
- question: {},
- tips: []
- }
- },
- adapter: {
- suffix: '',
- isSupplementaryPay: false,
- leftButton: '一键续缴',
- rightButton: '立即缴存',
- city: {
- t: '缴存城市',
- c: ''
- },
- charge: 0,
- count: 10000
- },
- tips: {
- s: false,
- t: []
- },
- showContact: false,
- showContactHeight: -68,
- scroll: true,
- choseCity: {},
- limit: [0, 0],
- scrollView: {
- top: 0
- },
- positionHeight: [0, 0, 0, 0, 0],
- chooseHidden: true,
- chooseing: false,//是否点击选择购买流程等
- //客服需要的
- isLogin: false,
- userInfo: {
- avatarUrl: ''
- },
- params: {
- }
- },
- hiddenContactListener: function (e) {
- businessT.debugLog('hiddenContactListener')
- this.setData({
- scroll: true
- })
- },
- judgeIsLogin: function () {
- if (app.loginStatus.key == "") {
- wx.navigateTo({
- url: '../../../login/index',
- })
- return false
- }
- return true
- },
- contactAction: function (sender) {
- businessT.debugLog('contact')
- if (!this.judgeIsLogin()) {
- return
- }
- // wx.navigateTo({
- // url: '../../../../public/pages/html/html?host=https://kf.shanp.com/user.html&channel=h5XCX&phone=' + app.globalData.userInfo.phone + '&uid=' + app.globalData.userInfo.uid + '&t=' + new Date().getTime(),
- // })
- },
- phoneAction: function (sender) {
- this.setData({
- showContact: true,
- scroll: false
- })
- },
- supplementaryPay: function (sender) {
- if (!this.judgeIsLogin()) {
- return
- }
- var purchase = app.purchase.purchaseData
- if (purchase.addedf_num == 0) {
- wx.showToast({
- title: '该城市不支持补缴公积金',
- icon: 'none'
- })
- return
- }
- if (!purchase.fund_buy) {
- var tips = '该城市不支持单独补缴公积金,请确保已补缴同月份社保,有任何疑问咨询' + businessT.getPhone()
- var that = this
- wx.showModal({
- title: '',
- content: tips,
- confirmColor: '#3296FB',
- cancelColor: '#3296FB',
- confirmText: '暂不补缴',
- cancelText: '我要补缴',
- success: function (res) {
- if (res.cancel) {
- that.toCustomer()
- }
- }
- })
- return
- }
- this.toCustomer()
- },
- toCustomer: function () {
- if (app.globalData.customerList.length > 0) {
- wx.navigateTo({
- url: '../../../../public/pages/customer-view/customer-view?type=nPurchase',
- })
- return
- }
- wx.navigateTo({
- url: '../new-customer/new-customer',
- })
- },
- quickPurchase: function (sender) {
- if (!this.judgeIsLogin()) {
- return
- }
- if (app.globalData.customerList.length == 0) {
- wx.showToast({
- title: '你还没有参保记录,请选择“立即缴存”',
- icon: 'none'
- })
- return
- }
- wx.navigateTo({
- url: '../../../../public/pages/customer-view/customer-view?type=qPurchase&businessType=a',
- })
- },
- purchase: function (sender) {
- if (!this.judgeIsLogin()) {
- return
- }
- var purchase = app.purchase.purchaseData
- if (!purchase.fund_buy && !purchase.pack) {
- wx.showToast({
- title: '该城市不能购买公积金',
- icon: 'none'
- })
- return
- }
- if (!purchase.fund_buy) {
- var that = this
- wx.showModal({
- title: '',
- content: '该城市不支持单独购买公积金,您将打包社保一起购买',
- confirmColor: '#3296FB',
- cancelColor: '#3296FB',
- confirmText: '重新选择',
- cancelText: '确定',
- success: function (res) {
- if (res.cancel) {
- var order = p.getOrder()
- p.setOrderPack(true)
- that.toCustomer()
- }
- }
- })
- return
- }
- this.toCustomer()
- },
- chooseCity: function (sender) {
- //防止第一列还在滑动就确定,再次展示会错位
- this.data.adapter.city.d[1] = publicData.purchaseCity[(publicData.purchaseCity.p)[sender.detail.value[0]].id]
- this.data.adapter.city.v = sender.detail.value
- var pr = publicData.purchaseCity.p[sender.detail.value[0]].id
- var c = publicData.purchaseCity[pr][sender.detail.value[1]]
- if (!c) {
- c = publicData.purchaseCity[pr][0]
- this.data.adapter.city.v[1] = 0
- }
- this.data.choseCity = c
- this.setData({
- adapter: this.data.adapter
- })
- this.getData(c.id)
- },
- chooseCityColumn: function (sender) {
- if (sender.detail.column == 0) {
- this.data.adapter.city.d[1] = publicData.purchaseCity[(publicData.purchaseCity.p)[sender.detail.value].id]
- this.data.adapter.city.v = [sender.detail.value, 0]
- this.setData({
- adapter: this.data.adapter
- })
- }
- },
- chooseView: businessT.action(function (sender) {
- businessT.debugLog('chooseView')
- }),
- getData: function (cityId) {
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- var order = p.getOrder()
- var path = order.isSupplementaryPay ? url.getSupplementaryPurchaseData : url.getNormalPurchaseData
- net.connect({
- url: url.app_host + path,
- method: 'POST',
- data: {
- city_code: cityId,
- type: 2
- },
- success: (err, res) => {
- if (Object.prototype.toString.call(res.data) == '[object Array]' && res.data.length > 0) {
- purchaseData.handleData(res.data)
-
- this.handleData()
- if (order.isSupplementaryPay) {
- wx.setStorageSync(key.StorageKey.lastCity_s, this.data.choseCity)
- } else {
- wx.setStorageSync(key.StorageKey.lastCity_n, this.data.choseCity)
- }
- wx.hideLoading()
- } else {
- this.getDataFail()
- businessT.showFailTips({ code: 0, msg: '' }, '加载失败')
- }
-
- },
- fail: (err, res) => {
- this.getDataFail()
- businessT.showFailTips(err, '加载失败')
- }
- }, true)
- },
- getDataFail: function () {
- wx.hideLoading()
- var order = p.getOrder()
- this.data.choseCity = { name: order.cityName, id: order.city }
- this.data.adapter.city.c = this.data.choseCity.name
- this.setData({
- adapter: this.data.adapter
- })
- if (app.purchase.purchaseData == null) {
- setTimeout(function () {
- wx.navigateBack({
- })
- }.bind(this), 1000)
- }
- },
- handleData: function () {
- if (this.data.ui.tips.question.height[0] == 0) {
- businessT.debugLog('算问题')
- var query = wx.createSelectorQuery();
- for (var i in this.data.ui.tips.question.ids) {
- var id = this.data.ui.tips.question.ids[i]
- query.select('#' + id).boundingClientRect()
- }
- var that = this;
- query.exec(function (res) {
- //res就是 该元素的信息 数组
- businessT.debugLog(res)
- for (var i in res) {
- that.data.ui.tips.question.height[i] = res[i].height
- }
- that.setData({
- ui: that.data.ui
- })
- })
- }
- var order = p.getOrder()
- var data = app.purchase.purchaseData
- this.data.adapter.city.c = this.data.choseCity.name
- this.data.adapter.charge = order.isSupplementaryPay ? data.added_charge : data.fund_charge
- this.data.adapter.city.des = '目前可购买' + data.month + '及之后月份,截止时间为' + purchaseData.getPurchaseDeadline(data.inc_date) + '月' + data.inc_date + '日'
- if (order.isSupplementaryPay) {
- if (data.fund_note == '') {
- this.data.tips.t = []
- } else {
- this.data.tips.t = data.fund_note.split('\n')
- }
- } else {
- if (data.fund_desc == '') {
- this.data.tips.t = []
- } else {
- this.data.tips.t = data.fund_desc.split('\n')
- }
- }
- if (this.data.tips.t.length > 0) {
- this.data.tips.s = true
- } else {
- this.data.tips.s = false
- }
- this.data.limit = [data.funds[order.accountType - 1][0], data.funds[order.accountType - 1][1]]
- purchaseData.changeShebaoDataToCustomerData()
- order.cityName = this.data.choseCity.name
- this.setData({
- adapter: this.data.adapter,
- tips: this.data.tips,
- limit: this.data.limit
- })
- this.calculateHeight()
- },
- scroll: function (sender) {
- this.data.scrollView.top = sender.detail.scrollTop
- if (sender.detail.scrollTop >= this.data.positionHeight[0]) {
- this.data.chooseHidden = false
- this.setData({
- chooseHidden: this.data.chooseHidden
- })
- if (this.data.chooseing) {
- this.data.chooseing = false
- return
- }
- var chooseHeight = this.data.positionHeight[1] - this.data.positionHeight[0]
- if (sender.detail.scrollTop >= this.data.positionHeight[4] - chooseHeight) {
- this.changeChoose(3)
- } else if (sender.detail.scrollTop >= this.data.positionHeight[3] - chooseHeight) {
- this.changeChoose(2)
- } else if (sender.detail.scrollTop >= this.data.positionHeight[2] - chooseHeight) {
- this.changeChoose(1)
- } else if (sender.detail.scrollTop >= this.data.positionHeight[1] - chooseHeight) {
- this.changeChoose(0)
- }
- } else {
- this.data.chooseHidden = true
- this.setData({
- chooseHidden: this.data.chooseHidden
- })
- }
- },
- tipsChoose: businessT.action(function (sender) {
- businessT.debugLog(sender.currentTarget.id)
- var index = Number(sender.currentTarget.id)
- var chooseHeight = this.data.positionHeight[1] - this.data.positionHeight[0]
- this.data.scrollView.top = this.data.positionHeight[index + 1] - chooseHeight
- this.setData({
- scrollView: this.data.scrollView
- })
- this.data.chooseing = true
- this.changeChoose(index)
- }),
- changeChoose: function (index) {
- var animation = wx.createAnimation({
- duration: 300,
- timingFunction: 'ease',
- })
- animation.translateX(index * 190 * sysT.rpxToPx()).step()
- this.data.ui.tips.choose.animation = animation.export()
- this.data.ui.tips.choose.c = index
- this.setData({
- ui: this.data.ui
- })
- },
- calculateHeight: function () {
- //purchase-details-choose
- var query = wx.createSelectorQuery();
- var that = this;
- //选择id
- query.select('#purchase-details-choose').boundingClientRect()
- query.select('#purchase-details-process').boundingClientRect()
- query.select('#purchase-details-advantage').boundingClientRect()
- query.select('#purchase-details-question').boundingClientRect()
- query.select('#purchase-details-tips').boundingClientRect()
- query.exec(function (res) {
- //res就是 该元素的信息 数组
- that.data.positionHeight[0] = res[0].top + that.data.scrollView.top
- that.data.positionHeight[1] = res[1].top + that.data.scrollView.top
- that.data.positionHeight[2] = res[2].top + that.data.scrollView.top
- that.data.positionHeight[3] = res[3].top + that.data.scrollView.top
- that.data.positionHeight[4] = res[4].top + that.data.scrollView.top
- businessT.debugLog(that.data.positionHeight)
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- if (options.first) {
- login.autoLogin(true)
- }
- var order = p.getOrder()
- if (!order) {
- var order = new PurchaseOrder()
- p.setOrder(order)
- }
- if (options.isSupplementaryPay == 1) {
- order.isSupplementaryPay = true
- } else {
- order.isSupplementaryPay = false
- }
- order.setCity()
- order.purchaseType = businessType.PurchaseType.accumulationFund
- this.data.choseCity = { name: order.cityName, id: order.city }
- var title
- var tips
- if (order.isSupplementaryPay) {
- title = '公积金补缴详情'
- tips = {
- explain: ['补缴必须与正常月份一起操作,所以下补缴单前请先下一个月正常单(点击首页-缴公积金)', '补缴不能跨月操作。例如,现在可以下10月份订单,那么补缴必须从9月份开始往前连续购买,不可从8月份或其他月份开始(若9月份已缴费就不能操作补缴了)。']
- }
- } else {
- title = '公积金缴存详情'
- tips = {
- explain: ['以前曾在单位缴存过公积金,第一次下单购买前,请先确认前单位是否已经封存公积金,否则导致购买不成功,本平台不负责哦。', '每月公积金缴费额要一致,第一次下单确定后不要随意更改。一般每年7月通知调整一次,需要调整的请提前致电客服。'],
- attention: ['若您停止购买后,本平台通常会于次月截止时间后的一周操作封存公积金(部分地区可能会有延迟),需提前封存的用户,请提前3-7工作日联系客服。', '如果您当月申请封存后,又想重新购买当月的公积金,请务必先联系客服撤销封存,避免漏缴。'],
- attentionT: '公积金封存注意事项'
- }
- }
- tips.choose = {
- t: ['购买流程', '平台优势', '常见问题', '温馨提示'],
- c: 0,
- animation: {}
- }
- tips.process = 'process_a'
- tips.tips = ['本平台仅支持代缴服务,不支持证明出具,如有疑问请咨询客服。',
- '避免因错过了截止时间忘记下单,造成公积金断缴的,建议一次性购买多个月份。若有新的工作单位,未缴费的月份可申请退款。',
- '每年政府会调整公积金缴费基数,我们会在第一时间通知您。若因政府调整通知滞后导致划扣金额不准确的,我们承诺多退少补,童叟无欺。',
- '本套餐适合于16岁至法定退休年龄之间的用户购买。']
- tips.question = { t: '公积金购买常见问题', c: [
- '付款成功后,一般什么时候可以查询公积金缴费情况呢?',
- ['当月下单截止后,专员会开始进行跟进。\n如有异常,则会通过信息或电话通知您;没有通知则表示正常操作,一般可于','次月1日-15日查询','缴费情况。'],
- '如果公积金缴费没有成功,你们会给予退款么?',
- '会的,因您自身原因办理不成功,或符合申请退款条件的,则可退款。但支付宝或微信平台收取0.6%的手续费需由您承担。\n退款一般会于月底或次月初前原路退还给您。',
- '缴存公积金后,会有公积金对账薄/卡么?',
- '首次缴存公积金,仅少数城市默认办理公积金对账薄/卡(如湛江、佛山、汕头)。\n不出对账薄 / 卡的城市,您本人可以去有公积金业务的银行,办理公积金联名卡。'
- ], ids: ['questionLeft1', 'questionRight1', 'questionLeft2', 'questionRight2', 'questionLeft3', 'questionRight3'], height: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }
- this.data.ui.tips = tips
- wx.setNavigationBarTitle({
- title: title
- })
- var cityData = [publicData.purchaseCity.p, publicData.purchaseCity[(publicData.purchaseCity.p)[0].id]]
- this.data.adapter = {
- suffix: sysT.suffixOfClass(),
- isSupplementaryPay: order.isSupplementaryPay,
- banner: order.isSupplementaryPay ? '../../../../icon/home/a_s_banner.png' : '../../../../icon/home/a_p_banner.png',
- title: '自助缴公积金,方便快捷,全面优质服务',
- leftButton: '一键续缴',
- rightButton: '立即缴存',
- city: {
- t: '缴存城市',
- c: this.data.choseCity.name,
- d: cityData,
- v: [0, 0],
- des: ''
- },
- charge: 0,
- count: 10000,
- //客服需要的
- isLogin: false,
- userInfo: {
- avatarUrl: ''
- },
- params: {
- }
- }
- this.setData({
- choseCity: this.data.choseCity,
- adapter: this.data.adapter,
- ui: this.data.ui,
- limit: this.data.limit,
- showContactHeight: sysT.suffixOfClass() == '-X' ? 0 : -68
- })
- this.getData(this.data.choseCity.id)
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- // var order = p.getOrder()
- // if (order.isSupplementaryPay) {
- // app.purchase.purchaseDataArray = app.purchase.supplementaryPurchaseDataArray
- // } else {
- // app.purchase.purchaseDataArray = app.purchase.normalPurchaseDataArray
- // }
- // var purchaseArray = app.purchase.purchaseDataArray
- // if (purchaseArray.length > 0) {
- // var purchase = purchaseArray[0]
- // if (purchase.city_code == this.data.choseCity.id && purchase.pack == 1) {
- // app.purchase.purchaseData = purchase
- // this.handleData()
- // } else {
- // app.purchase.purchaseDataArray = []
- // app.purchase.purchaseData = null
- // this.getData(this.data.choseCity.id)
- // }
- // } else {
- // this.getData(this.data.choseCity.id)
- // }
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- //客服
- this.data.adapter.isLogin = app.loginStatus.isLogin
- this.data.adapter.userInfo.nickName = app.globalData.userInfo.phone
- this.data.adapter.params.phone = app.globalData.userInfo.phone
- this.data.adapter.params.userId = app.globalData.userInfo.uid
- this.setData({
- adapter: this.data.adapter
- })
- if (this.data.isFirstLoad) {
- this.data.isFirstLoad = false
- return
- }
- var order = p.getOrder()
- this.data.choseCity = { name: order.cityName, id: order.city }
- this.handleData()
- businessT.debugLog(this.data.tips)
-
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- return {
- path: '/page/home/index',
- imageUrl: '../../../../icon/public/share_img.png',
- title: '自助缴社保公积金,覆盖200多个城市,专业团队操作'
- }
- }
- })
|