|
@@ -194,70 +194,73 @@ Page({
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
async load() {
|
|
async load() {
|
|
|
- if (locationStatus) {
|
|
|
|
|
- locationStatus = false
|
|
|
|
|
- const data = await this.location()
|
|
|
|
|
- punchClockNeedInfo({ longitude: data.longitude, latitude: data.latitude }).then(data => {
|
|
|
|
|
- // punchClockNeedInfo({ longitude: 120.353312, latitude: 31.535582 }).then(data => {
|
|
|
|
|
- locationStatus = true
|
|
|
|
|
- let {
|
|
|
|
|
- authenticationStatus,
|
|
|
|
|
- startPunch,
|
|
|
|
|
- endPunch,
|
|
|
|
|
- todayMoney,
|
|
|
|
|
- clockType, // 1:上班打卡 2:下班打卡 3:超出范围 4:已完成
|
|
|
|
|
- sumDuration,
|
|
|
|
|
- sumMoney,
|
|
|
|
|
- wsPunchClockId,
|
|
|
|
|
- dailyAvailableMinHour
|
|
|
|
|
- } = data.data
|
|
|
|
|
|
|
+ const data = await this.location()
|
|
|
|
|
+ punchClockNeedInfo({ longitude: data.longitude, latitude: data.latitude }).then(data => {
|
|
|
|
|
+ // punchClockNeedInfo({ longitude: 120.353312, latitude: 31.535582 }).then(data => {
|
|
|
|
|
+ locationStatus = true
|
|
|
|
|
+ let {
|
|
|
|
|
+ authenticationStatus,
|
|
|
|
|
+ startPunch,
|
|
|
|
|
+ endPunch,
|
|
|
|
|
+ todayMoney,
|
|
|
|
|
+ clockType, // 1:上班打卡 2:下班打卡 3:超出范围 4:已完成
|
|
|
|
|
+ sumDuration,
|
|
|
|
|
+ sumMoney,
|
|
|
|
|
+ wsPunchClockId,
|
|
|
|
|
+ dailyAvailableMinHour
|
|
|
|
|
+ } = data.data
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ approveStatus: authenticationStatus, // 认证状态(0:未认证 1:等待认证 2:未通过 3:已认证) ,
|
|
|
|
|
+ startPunch,
|
|
|
|
|
+ endPunch,
|
|
|
|
|
+ todayMoney,
|
|
|
|
|
+ clockType,
|
|
|
|
|
+ sumDuration,
|
|
|
|
|
+ sumMoney,
|
|
|
|
|
+ wsPunchClockId
|
|
|
|
|
+ })
|
|
|
|
|
+ if (clockType === 1 && !wsPunchClockId) {
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- approveStatus: authenticationStatus, // 认证状态(0:未认证 1:等待认证 2:未通过 3:已认证) ,
|
|
|
|
|
- startPunch,
|
|
|
|
|
- endPunch,
|
|
|
|
|
- todayMoney,
|
|
|
|
|
- clockType,
|
|
|
|
|
- sumDuration,
|
|
|
|
|
- sumMoney,
|
|
|
|
|
- wsPunchClockId
|
|
|
|
|
|
|
+ statusImage: `${imgServerUrl}/images/clock/clock-in.png`,
|
|
|
|
|
+ statusIcon: `${imgServerUrl}/images/clock/clock-can.png`,
|
|
|
})
|
|
})
|
|
|
- if (clockType === 1 && !wsPunchClockId) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- statusImage: `${imgServerUrl}/images/clock/clock-in.png`,
|
|
|
|
|
- statusIcon: `${imgServerUrl}/images/clock/clock-can.png`,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- if (clockType === 1 && wsPunchClockId) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- statusImage: `${imgServerUrl}/images/clock/clock-out-disabled.png`,
|
|
|
|
|
- statusIcon: `${imgServerUrl}/images/clock/clock-waring.png`,
|
|
|
|
|
- statusMessage: `上班${dailyAvailableMinHour}小时候才能进行下班打卡`,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- if (clockType === 2 && wsPunchClockId) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- statusImage: `${imgServerUrl}/images/clock/clock-out.png`,
|
|
|
|
|
- statusIcon: `${imgServerUrl}/images/clock/clock-can.png`,
|
|
|
|
|
- statusMessage: `已进入考勤打卡范围`,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- if (clockType === 3) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- statusImage: `${imgServerUrl}/images/clock/clock-beyond.png`,
|
|
|
|
|
- statusIcon: `${imgServerUrl}/images/clock/clock-waring.png`,
|
|
|
|
|
- statusMessage: `请进入企业后再进行打卡`,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- if (clockType === 4) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- statusImage: `${imgServerUrl}/images/clock/clock-done.png`,
|
|
|
|
|
- statusIcon: `${imgServerUrl}/images/clock/clock-can.png`,
|
|
|
|
|
- statusMessage: `今日打卡已完成`,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- }).catch(data => {
|
|
|
|
|
- locationStatus = true
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clockType === 1 && wsPunchClockId) {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ statusImage: `${imgServerUrl}/images/clock/clock-out-disabled.png`,
|
|
|
|
|
+ statusIcon: `${imgServerUrl}/images/clock/clock-waring.png`,
|
|
|
|
|
+ statusMessage: `上班${dailyAvailableMinHour}小时候才能进行下班打卡`,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clockType === 2 && wsPunchClockId) {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ statusImage: `${imgServerUrl}/images/clock/clock-out.png`,
|
|
|
|
|
+ statusIcon: `${imgServerUrl}/images/clock/clock-can.png`,
|
|
|
|
|
+ statusMessage: `已进入考勤打卡范围`,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clockType === 3) {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ statusImage: `${imgServerUrl}/images/clock/clock-beyond.png`,
|
|
|
|
|
+ statusIcon: `${imgServerUrl}/images/clock/clock-waring.png`,
|
|
|
|
|
+ statusMessage: `请进入企业后再进行打卡`,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ if (clockType === 4) {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ statusImage: `${imgServerUrl}/images/clock/clock-done.png`,
|
|
|
|
|
+ statusIcon: `${imgServerUrl}/images/clock/clock-can.png`,
|
|
|
|
|
+ statusMessage: `今日打卡已完成`,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(data => {
|
|
|
|
|
+ locationStatus = true
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ reload() {
|
|
|
|
|
+ if (locationStatus) {
|
|
|
|
|
+ locationStatus = false
|
|
|
|
|
+ this.load()
|
|
|
} else {
|
|
} else {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
icon: 'none',
|
|
icon: 'none',
|