|
|
@@ -222,68 +222,78 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
async load() {
|
|
|
- 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
|
|
|
+ try {
|
|
|
+ wx.showLoading({
|
|
|
+ icon: 'none',
|
|
|
+ title: '定位中...',
|
|
|
})
|
|
|
- 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) {
|
|
|
+ const data = await this.location()
|
|
|
+ wx.hideLoading()
|
|
|
+ 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({
|
|
|
- statusImage: `${imgServerUrl}/images/clock/clock-beyond.png`,
|
|
|
- statusIcon: `${imgServerUrl}/images/clock/clock-waring.png`,
|
|
|
- statusMessage: `请进入企业后再进行打卡`,
|
|
|
+ approveStatus: authenticationStatus, // 认证状态(0:未认证 1:等待认证 2:未通过 3:已认证) ,
|
|
|
+ startPunch,
|
|
|
+ endPunch,
|
|
|
+ todayMoney,
|
|
|
+ clockType,
|
|
|
+ sumDuration,
|
|
|
+ sumMoney,
|
|
|
+ wsPunchClockId
|
|
|
})
|
|
|
- }
|
|
|
- if (clockType === 4) {
|
|
|
- this.setData({
|
|
|
- statusImage: `${imgServerUrl}/images/clock/clock-done.png`,
|
|
|
- statusIcon: `${imgServerUrl}/images/clock/clock-can.png`,
|
|
|
- statusMessage: `今日打卡已完成`,
|
|
|
- })
|
|
|
- }
|
|
|
- }).catch(data => {
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ } catch (e) {
|
|
|
+ wx.hideLoading()
|
|
|
locationStatus = true
|
|
|
- })
|
|
|
+ }
|
|
|
},
|
|
|
reload() {
|
|
|
if (locationStatus) {
|