123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534 |
- const app = getApp()
- const util = require("../../../utils/util");
- const api = require('../../../api/api.js');
- // const update = require('../../../api/update.js');
- const user = require('../../../utils/user.js');
- import moment from 'moment'
- Page({
- data: {
- showjz:false,
- interviewInfo: [],
- interviewShow: false,
- userInfo: {},
- labelName: [],
- homeInfo: {
- onPositionYear: '',
- salary: '',
- total: '',
- unReadSize: "",
- workerInfo: {},
- workerNotice: [],
- stationAdminName: '',
- stationAdminTel: '',
- },
- salary: {
- salary: '',
- total: ''
- },
- hasLogin: true,
- currentDate: moment(new Date()).format('YYYY-MM-DD'),
- currentWeek: '',
- myRebuyInfo: {
- looseOrderRebuy: 0,
- looseOrder: 0,
- cycleOrderRebuy: 0,
- cycleOrder: 0,
- looseOrderRebuyRate: 0,
- cycleOrderRebuyRate: 0
- },
- animate: false,
- msgList: [
- ],
- modalShow: false,
- unReadSize: "",
- workerInfo: {},
- workerNotice: [],
- workerNoticeAlert: [],
- alertNoticeInfo: {
- },
- isUat: false
- },
- goFeedback() {
- if (this.data.alertNoticeInfo.isFeedback == 1) {
- // 跳转到回执页面
- // app.globalData.alertNoticeInfo=this.data.alertNoticeInfo;
- wx.navigateTo({
- url: '/pages/upgrade/msgReceipt/msgReceipt?id=' + this.data.alertNoticeInfo.id
- });
- } else if (this.data.alertNoticeInfo.isFeedback != 1 && this.data.alertNoticeInfo.pagePath == '') {
- // 调已读接口
- util.request(api.readNotice, {
- id: this.data.alertNoticeInfo.id
- }, 'GET').then(res => {
- if (res.errno === 0) {
- this.getMsgCenter();
- }
- });
- } else {
- // 调已读接口
- util.request(api.readNotice, {
- id: this.data.alertNoticeInfo.id
- }, 'GET').then(res => {
- if (res.errno === 0) {
- // 跳转其他页面
- wx.navigateTo({
- url: this.data.alertNoticeInfo.pagePath
- });
- }
- });
- }
- },
- goJoinCp() {
- wx.navigateTo({
- url: '/pages/upgrade/cp/join',
- })
- },
- toDxkOrder(){
- wx.navigateTo({
- url: '/pages/mall/goods/goods?id=288',
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- // val(this.messageScroll,2000);
- // let week=util.getWeek(this.data.currentDate);
- // this.setData({
- // currentWeek:week
- // });
- // this.getRebuyInfo();
- this.isNewYearReport();
- // this.getHomeInfo()
- // wx.hideTabBar();
- },
- isNewYearReport() { //是否新年报备
- util.request(api.NewYearReported).then(res => {
- if (res.data) {
- wx.showModal({
- title: '返乡调查',
- content: '新年返乡调查已开始,是否现在去报备?',
- success: function (sm) {
- if (sm.confirm) {
- wx.navigateTo({
- url: '/pages/servant/gohome/report',
- })
- }
- }
- });
- }
- })
- },
- lastWeek() {
- let current = moment(new Date((new Date(this.data.currentDate)).getTime() - 7 * 24 * 60 * 60 * 1000)).format('YYYY-MM-DD');
- console.log(current);
- let week = util.getWeek(current);
- this.setData({
- currentDate: current,
- currentWeek: week
- });
- this.getRebuyInfo();
- },
- nextWeek() {
- let current = moment(new Date((new Date(this.data.currentDate)).getTime() + 7 * 24 * 60 * 60 * 1000)).format('YYYY-MM-DD');
- console.log(current);
- let week = util.getWeek(current);
- this.setData({
- currentDate: current,
- currentWeek: week
- });
- this.getRebuyInfo();
- },
- getRebuyInfo() {
- util.request(api.myRebuyInfo, {
- date: this.data.currentDate,
- }, 'GET').then(res => {
- if (res.errno === 0) {
- this.setData({
- myRebuyInfo: res.data
- });
- }
- });
- },
- messageScroll() {
- this.setData({
- animate: true
- });
- setTimeout(() => {
- let list = this.data.msgList;
- list.push(list[0]);
- this.setData({
- msgList: list
- });
- list.shift();
- this.setData({
- msgList: list,
- animate: false
- });
- }, 3000);
- },
- makeCall(e) {
- let mobile = e.currentTarget.dataset.mobile;
- wx.makePhoneCall({
- phoneNumber: mobile,
- })
- },
- exitLogin: function () {
- wx.showModal({
- title: '',
- confirmColor: '#b4282d',
- content: '退出登录?',
- success: function (res) {
- if (!res.confirm) {
- return;
- }
- util.request(api.AuthLogout, {}, 'POST');
- app.globalData.hasLogin = false;
- wx.removeStorageSync('token');
- wx.removeStorageSync('userInfo');
- wx.redirectTo({
- url: '/pages/index/index'
- });
- }
- })
- },
- getInterview() {
- util.request(api.interview, {
- // workerNo:this.data.userInfo.workerNo,
- // status:1,
- }, 'GET').then(res => {
- console.log(res);
- if (res.errno == 0) {
- // if(res.data&&res.data!=null){
- // if(res.data.length>=1){
- this.setData({
- interviewInfo: res.data
- });
- // }
- // }
- }
- });
- },
- operateInterview(e) {
- let type = e.currentTarget.dataset.type;
- let id = e.currentTarget.dataset.id;
- let content = (type == 1 ? '确定接受邀请么?' : '确定拒绝邀请么?')
- wx.showModal({
- title: '',
- content: content,
- success: res => {
- if (res.confirm) {
- util.request(api.acceptOrRefuseInterview, {
- interviewId: id,
- isAccept: type,
- }, 'GET').then(res => {
- console.log(res);
- if (res.errno == 0) {
- this.getInterview();
- }
- });
- }
- }
- });
- },
- getHomeInfo() {
- util.request(api.homeInfo, {}, 'GET').then(res => {
- console.log(res);
- if (res.errno === 0) {
- console.log(res.data.workerInfo.labelNames);
- console.log(res.data.workerInfo.labelNames.split(','));
- this.setData({
- homeInfo: res.data,
- labelName: res.data.workerInfo.labelNames == "" ? [] : res.data.workerInfo.labelNames.split(','),
- // 'homeInfo.unReadSize':res.data.unReadSize>99?99:res.data.unReadSize
- });
- }
- });
- },
- goLeave() { //请假
- wx.navigateTo({
- url: '/pages/servant/leave/leave',
- });
- // wx.showModal({
- // title: '提醒',
- // content: '暂未开通,敬请期待',
- // showCancel: false
- // });
- },
- goHouse() {
- wx.showModal({
- title: '提醒',
- content: '暂未开通,敬请期待',
- showCancel: false
- })
- },
- getPerfect() {
- // wx.navigateTo({
- // url: '/pages/servant/perfect/perfectWorkerInfo'
- // });
- wx.navigateTo({
- url: '/pages/upgrade/completeInfo/completeInfo'
- });
- },
- goBookIndex(e) {
- if (this.data.hasLogin) {
- let tab = e.currentTarget.dataset.index
- let route = e.currentTarget.dataset.route
- try {
- wx.setStorageSync('tab', tab);
- } catch (e) {
- }
- wx.navigateTo({
- url: route,
- })
- } else {
- wx.navigateTo({
- url: "/pages/index/index"
- });
- };
- },
- // goNucleicList() {
- // wx.navigateTo({
- // url: '/pages/servant/nucleic/list'
- // });
- // wx.navigateTo({
- // url: '/pages/servant/gohome/report',
- // })
- // },
- goMessage() {
- wx.navigateTo({
- url: '/pages/upgrade/messageList/messageList'
- })
- },
- goSalaryDetail(e) { //查询工资明细
- // const {
- // year,
- // month
- // } = calendar.getCurrentYM();
- // let m = '11';
- // if (m < 10) m = '0' + String(m);
- // let year='2022-';
- let month = moment(new Date()).format('YYYY-MM');
- let type = e.currentTarget.dataset.type;
- let total = (type == 1 ? this.data.homeInfo.salary : this.data.homeInfo.total);
- //servantType 表示服务者身份99是临时服务者 明细页可以显示提现按钮
- wx.navigateTo({
- url: '/pages/servant/salary/detail/detail?month=' + month + '&total=' + total + '&type=' + type + '&servantType=' + '' + '&blance=' + this.data.homeInfo.salary
- });
- },
- goNucleicList() {
- // wx.navigateTo({
- // url: '/pages/servant/nucleic/list'
- // })
- wx.navigateTo({
- url: '/pages/servant/gohome/report',
- })
- },
- copyNum() {
- wx.setClipboardData({
- data: this.data.homeInfo.workerShareCode,
- success: function (res) {
- console.log(res);
- wx.showToast({
- title: '复制成功',
- icon: 'none',
- duration: 2000
- });
- }
- })
- },
- goLearnCenter() {
- wx.navigateTo({
- url: '/pages/upgrade/learnCenter/learnCenter',
- })
- },
- closeModal() {
- this.setData({
- modalShow: false
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- let week = util.getWeek(this.data.currentDate);
- let userInfo = wx.getStorageSync('userInfo');
- this.setData({
- currentWeek: week,
- userInfo: userInfo,
- showjz: userInfo.ofJz == 293
- });
- if (userInfo && userInfo.id < 0) {
- // 未入职状态
- this.setData({
- interviewShow: true
- });
- this.getInterview();
- this.getHomeInfo();
- return;
- }
- // setInterval(this.messageScroll,2000);
- this.getRebuyInfo();
- this.isNewYearReport();
- this.getHomeInfo();
- this.getMsgCenter();
- //是否测试环境
- // if(api.WxApiRoot.indexOf("uat")){
- // this.setData({
- // isUat:true
- // })
- // }
- this.setData({
- isUat: wx.getStorageSync('isUat')
- })
- },
- getMsgCenter() {
- if(!this.data.showjz){
- return;//非鲸致全职不展示通知
- }
- let userInfo = wx.getStorageSync('userInfo');
- util.request(api.getMsgCenter, {
- workerNo: userInfo.workerNo,
- }, 'GET').then(res => {
- if (res.errno === 0) {
- this.setData({
- unReadSize: res.data.unReadSize > 99 ? 99 : res.data.unReadSize,
- workerNotice: res.data.workerNotice,
- workerNoticeAlert: res.data.workerNoticeAlert,
- modalShow: res.data.workerNoticeAlert.length > 0 ? true : false,
- alertNoticeInfo: res.data.workerNoticeAlert.length > 0 ? res.data.workerNoticeAlert[0] : {}
- });
- }
- });
- },
- goMaster(){
- // util.request(api.transferIntroductionQrCode, {
-
- // }, 'POST').then(res=> {
- // if (res.errno === 0) {
- // let url=res.data;
- // wx.previewImage({
- // current: url, // 当前显示图片的http链接
- // urls: [url] // 需要预览的图片http链接列表
- // })
-
- // }else{
- // wx.showToast({
- // title: res.errmsg,
- // icon:'none'
- // })
- // }
- // });
- // meetZzy 1有资格 0没资格
- // pauseZzy 1暂停 0没有暂停
- let meetZzy=this.data.homeInfo.workerInfo.meetZzy;
- let pauseZzy=this.data.homeInfo.workerInfo.pauseZzy;
- if(meetZzy==0){
- wx.navigateTo({
- url: '/pages/master/joinGain/joinGain',
- });
- }else if(meetZzy==1&&pauseZzy==1){
- // 已暂停
- wx.navigateTo({
- url: '/pages/master/pauseMaster/pauseMaster',
- })
- }else{
- // wx.navigateTo({
- // url: '/pages/master/shareMaster/shareMaster?rid='+this.data.userInfo.id,
- // });
- wx.navigateTo({
- url: '/pages/master/shareIndex/shareIndex?rid='+this.data.userInfo.id,
- });
- }
-
- },
- goIm(){
- wx.navigateTo({
- url: '/pages/chat/im/im'
- });
- },
- onHide: function () {
- },
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- })
|