123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- // pages/recordPages/yyjl/yyjl.js
- import {
- xcxqxyy,
- xcxyyhh,
- xcxsxph
- } from "../../../apis/index"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- infos: {},
- nowTime: "",
- timer: null,
- khh: false
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- let that = this
- that.init(options)
- that.setData({
- nowTime: that.getTime()
- })
- },
- init(e) {
- let that = this
- if (e) {
- if (e.infos) {
- let infos = JSON.parse(e.infos)
- that.setData({
- infos: infos
- })
- if (infos.ztDm == 2 || infos.ztDm == 3) {
- that.chageNum()
- }
- if (infos.ztDm == 0) {
- let datetime = {
- date: that.data.infos.yybsrq,
- time: that.data.infos.yysjd
- }
- that.setData({
- khh: that.timeFormat(datetime)
- })
- }
- }
- }
- },
- getTime() {
- let date = new Date()
- let y = date.getFullYear()
- let m = date.getMonth() + 1 < 10 ? '0' + date.getMonth() + 1 : date.getMonth() + 1
- let d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
- let h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
- let mm = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
- let ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
- return y + '-' + m + '-' + d + ' ' + h + ':' + mm + ':' + ss
- },
- cansole() {
- let that = this
- wx.showLoading({
- title: '正在取消...',
- })
- xcxqxyy({
- yymxxh: that.data.infos.yymxxh
- }).then(res => {
- wx.hideLoading()
- if (res.code == 200) {
- wx.showToast({
- title: '取消成功',
- duration: 2000
- })
- setTimeout(() => {
- wx.navigateBack()
- }, 2000);
- } else {
- wx.showToast({
- title: res.msg || res.message,
- icon: "none",
- duration: 5000
- })
- }
- })
- },
- timeFormat(e) {
- let date = e.date
- let time1 = e.time1
- let time2 = e.time2
- let date1 = date + 'T' + time1
- let date2 = date + 'T' + time2
- let timestamp1 = new Date(date1).getTime()
- let timestamp2 = new Date(date2).getTime()
- let nowstamp = new Date().getTime()
- if (nowstamp >= timestamp1 && nowstamp < timestamp2) {
- return true
- } else {
- return false
- }
- },
- chageNum() {
- let that = this
- let datetime = {
- date: that.data.infos.yybsrq,
- time1: that.data.infos.yyqpkssj,
- time2: that.data.infos.yyqpjssj
- }
- if (that.timeFormat(datetime)) {
- wx.showLoading({
- title: '',
- })
- let form = {
- unionid: wx.getStorageSync('PUBLIC_ID').unionid,
- yymxxh: that.data.infos.yymxxh
- }
- xcxyyhh(form).then(res => {
- wx.hideLoading()
- if (res.code == 200) {
- res.data.ztDm = 2
- that.setData({
- infos: {
- ...that.data.infos,
- ...res.data
- }
- })
- } else if (res.code == 201) {
- res.data.ztDm = 2
- that.setData({
- infos: {
- ...that.data.infos,
- ...res.data
- }
- })
- } else {
- wx.showToast({
- title: res.msg || res.message,
- icon: "none",
- duration: 5000
- })
- }
- })
- }
- },
- brush() {
- let that = this
- let infos = that.data.infos
- wx.showLoading({
- title: '正在刷新...',
- })
- xcxsxph({
- bsfwtDm: infos.bsfwtDm,
- phhm: infos.ticketNum,
- qpsj: infos.createTime
- }).then(res => {
- wx.hideLoading()
- if (res.code == 200) {
- if (res.data.phzt == 0) {
- that.setData({
- infos: {
- ...that.data.infos,
- ...res.data
- }
- })
- } else {
- that.setData({
- infos: {
- ...that.data.infos,
- ...res.data
- }
- })
- if (res.data.fwztDm == 0) {
- wx.showModal({
- title: '提示',
- content: '当前已叫到您的号码,请立即前往' + res.data.ckhm + "窗口进行办理业务。",
- })
- } else {
- wx.showModal({
- title: '提示',
- content: '当前号码已经叫过了,请前往' + res.data.ckhm + "窗口进行咨询。"
- })
- }
- }
- } else {
- wx.showToast({
- title: res.msg || res.message,
- icon: "none",
- duration: 5000
- })
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- let that = this
- let timer = that.data.timer
- clearInterval(timer)
- timer = setInterval(() => {
- that.setData({
- nowTime: that.getTime()
- })
- if (that.data.infos.ztDm == 0) {
- let datetime = {
- date: that.data.infos.yybsrq,
- time: that.data.infos.yysjd
- }
- that.setData({
- khh: that.timeFormat(datetime)
- })
- }
- }, 1000);
- that.setData({
- timer: timer
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- let that = this
- let timer = that.data.timer
- clearInterval(timer)
- that.setData({
- timer: null
- })
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- let that = this
- let timer = that.data.timer
- clearInterval(timer)
- that.setData({
- timer: null
- })
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|