123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- var businessT = require('../../../../tool/business-tool.js')
- var sysT = require('../../../../tool/sys-tool.js')
- var url = require('../../../../constant/url.js')
- import Net from '../../../../tool/net.js'
- var net = new Net()
- var app = getApp()
- Page({
- data: {
- current: 0,
- isEmpty: false,
- },
- getSysInfo() {
- swan.getSystemInfo({
- success: res => {
- var width = res.windowWidth
- this.setData({ width: res.windowWidth })
- },
- });
- setTimeout(() => {
- var tabWidth, tabItemWidth
- swan.createSelectorQuery().select('#tabWrap').boundingClientRect((rect) => {
- tabWidth = rect.width
- }).exec()
- swan.createSelectorQuery().select('#tabItem').boundingClientRect((rect) => {
- tabItemWidth = rect.width
- var moveX = tabWidth - tabItemWidth
- this.setData({ moveX })
- }).exec()
- }, 300)
- },
- initData() {
- swan.showLoading({
- title: '请稍后...',
- mask: true,
- });
- net.connectNeedLogin({
- url: url.app_host + url.getDoneSalaryList,
- data: {},
- success: (err, res) => {
- this.getMonth(res.data, 'isPay')
- },
- failed: (err, res) => {
- swan.hideLoading();
- businessT.showFailTips(err)
- }
- })
- net.connectNeedLogin({
- url: url.app_host + url.getUndoneSalaryList,
- data: {},
- success: (err, res) => {
- this.getMonth(res.data, 'notPay')
- swan.hideLoading();
- },
- failed: (err, res) => {
- swan.hideLoading();
- businessT.showFailTips(err)
- }
- })
- },
- getMonth(res, type) {
- var isPay, notPay
- res.forEach((item) => {
- item.year = String(item.opt_month).substring(0, 4)
- item.month = String(item.opt_month).slice(-2)
- item.charge = Number(item.charge).toFixed(2)
- item.wage = Number(item.wage).toFixed(2)
- item.total_fee = Number(item.total_fee).toFixed(2)
- item.gen_time = item.gen_time.slice(0, -3)
- if (item.pay_time) {
- item.pay_time = item.pay_time.slice(0, -3)
- item.payTime = item.pay_time.slice(5)
- }
- if (item.hf_time) {
- item.hf_time = item.hf_time.slice(0, -3)
- item.hfTime = item.hf_time.slice(5)
- }
- })
- if (type == 'isPay') {
- this.setData({ isPay: res })
- } else {
- this.setData({ notPay: res })
- }
- this.changData()
- },
- changData() {
- var list = []
- list[0] = this.data.notPay.slice(0, 10)
- list[1] = this.data.isPay.slice(0, 10)
- this.setData({ list })
- },
- loadMore(e) {
- if (e.currentTarget.dataset.index == 0) {
- this.data.list[0] = this.data.notPay.slice(0, this.data.list[0].length + 10)
- } else {
- this.data.list[1] = this.data.isPay.slice(0, this.data.list[1].length + 10)
- }
- this.setData({ list: this.data.list })
- },
- openModal(e) {
- const animation = swan.createAnimation()
- animation.translateY(-500).step();
- this.setData({
- modalStatus: true
- }, () => {
- this.setData({
- animationData: animation.export()
- })
- })
- var detail = this.data.list[this.data.current][e.currentTarget.dataset.index]
- app.globalData.customerList.forEach((item) => {
- if (item.id == detail.sbu_id) {
- detail.bank = item.bank
- detail.bank_code = item.bank_code.slice(-4)
- }
- })
- this.setData({ detail })
- if (e.currentTarget.dataset.type == "progress") {
- this.fanhuanStatus(null, true)
- }
- if(!detail.bank_code){
- this.setData({addCard:true})
- }else{
- this.setData({addCard:false})
- }
- this.getParams()
- },
- closeModal() {
- const animation = swan.createAnimation()
- animation.translateY(0).step();
- const animation1 = swan.createAnimation({ duration: 0 })
- animation1.translateX(0).step();
- this.setData({
- animationData: animation.export()
- })
- setTimeout(() => {
- this.setData({
- modalStatus: false,
- modalType: '',
- modalAnimation: animation1.export()
- })
- }, 400)
- },
- move(e) {
- const animationLine = swan.createAnimation()
- const animationContent = swan.createAnimation()
- if (e.currentTarget.dataset.index == 1) {
- animationLine.translateX(this.data.moveX).step()
- animationContent.translateX(-this.data.width).step();
- } else {
- animationLine.translateX(0).step()
- animationContent.translateX(0).step();
- }
- this.setData({
- current: e.currentTarget.dataset.index,
- animationLine: animationLine.export(),
- animationContent: animationContent.export()
- })
- },
- addCard() {
- var arr = app.globalData.customerList.filter(item => {
- return this.data.detail.sbu_id == item.id
- })
- swan.navigateTo({
- url: '../../../../public/pages/edit-bank/edit-bank?current=' + JSON.stringify(arr[0])
- });
- },
- getParams() {
- this.setData({ payData: { order_no: this.data.detail.order_no, pay_channel: 13 } })
- },
- pay() {
- net.connectNeedLogin({
- url: url.app_host + url.createSalaryOrder,
- data: this.data.payData,
- success: (err, res) => {
- swan.requestPolymerPayment({
- orderInfo: res.data,
- success: res => {
- if (app.sbuids.indexOf(this.data.detail.sbu_id) != -1) {
- swan.navigateTo({
- url: '../../../../public/pages/pay-success/pay-success?type=addCard&id=' + this.data.detail.sbu_id
- });
- }else{
- swan.navigateTo({
- url: '../../../../public/pages/pay-success/pay-success?type=share'
- });
- }
- },
- fail: err => {
- swan.showToast({
- title: '支付失败',
- icon: 'none'
- });
- }
- });
- },
- fail: (err, res) => {
- swan.hideLoading()
- businessT.showFailTips(err, '提交订单失败')
- },
- complete: () => {
- this.closeModal()
- }
- }, true)
- },
- payAction(e) {
- var detail = this.data.list[0][e.currentTarget.dataset.index]
- this.setData({ detail })
- this.getParams()
- this.pay()
- },
- fanhuanStatus(e, res) {
- var animation
- if (res) {
- animation = swan.createAnimation({ duration: 0 })
- } else {
- animation = swan.createAnimation()
- }
- animation.translateX(-this.data.width).step();
- this.setData({ modalType: 'progress', modalAnimation: animation.export() })
- },
- onLoad: function () {
- // 监听页面加载的生命周期函数
- this.initData()
- this.setData({ suffix: sysT.suffixOfClass() })
- },
- onReady: function () {
- // 监听页面初次渲染完成的生命周期函数
- this.getSysInfo()
- },
- onShow: function () {
- // 监听页面显示的生命周期函数
- swan.setPageInfo && swan.setPageInfo({
- title: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
- keywords: '我的社保,我的社保网,我的社保APP,社会保障,社保,社保代缴,公积金代缴,社会保险,五险一金,医保,医疗保险,公积金,养老,生育,工伤,失业,住房公积金,社保代理,代缴社保,公积金代理,查悦社保,大社保,亲亲小保,社保掌上通,招聘求职,创业,买房,贷款,计算器,人社局,摇号',
- description: '我的社保APP是为个人、企业提供社保代缴代扣、公积金代扣代缴、社保查询、公积金查询服务的名牌产品。解决个体工商户、自由职业者、待业人员、全职妈妈、创业者等的个人社保公积金断缴难题,同时解决贷款, 买房, 买车, 养老, 医疗, 生育, 医疗报销等难题。同时为企业提供全国专业社保代理和公积金代理。',
- articleTitle: '【我的社保】官方APP-社保挂靠公积金代理全国自助缴纳查询社保公积金_主页',
- release_date: '2019-02-23 20:00:00',
- success: function () {
- console.log('页面基础信息设置完成');
- },
- fail: function (res) {
- console.log('设置失败');
- },
- })
- },
- onHide: function () {
- // 监听页面隐藏的生命周期函数
- },
- onUnload: function () {
- // 监听页面卸载的生命周期函数
- },
- onPullDownRefresh: function () {
- // 监听用户下拉动作
- },
- onReachBottom: function () {
- // 页面上拉触底事件的处理函数
- },
- onShareAppMessage: function () {
- // 用户点击右上角转发
- }
- });
|