增加发票识别和定位

This commit is contained in:
chenrx
2024-06-07 15:42:10 +08:00
parent c7e7ec4904
commit a93fdfe6fd
4 changed files with 79 additions and 47 deletions
+50 -26
View File
@@ -78,34 +78,39 @@ Page({
* 接口请求小程序码
*/
getappSignConf() {
if (this.loading) return
wx.showLoading({
title: '重新生成中...',
mask: true
})
if (wxTimer) {
wxTimer.stop();
wxTimer = null
}
this.setData({
wxTimerList: {},
wxTimer: null,
loading: true
})
/////接口方法
_.apiQuery.getappSignConf().then(res => {
this.getUserLocation().then(() => {
if (this.loading) return
wx.showLoading({
title: '重新生成中...',
mask: true
})
if (wxTimer) {
wxTimer.stop();
wxTimer = null
}
this.setData({
qrcode_img: res.data.qcode,
qrcode_count_time: parseInt(res.data.qrcode_count_time),
loading: false,
info: res.data
}, () => {
wx.hideLoading()
this.getTimes(this.data.qrcode_count_time).then(() => {
this.getappSignConf()
wxTimerList: {},
wxTimer: null,
loading: true
})
const params = {
lat: this.data.lat,
lng: this.data.lng
}
/////接口方法
_.apiQuery.getappSignConf(params).then(res => {
this.setData({
qrcode_img: res.data.qcode,
qrcode_count_time: parseInt(res.data.qrcode_count_time),
loading: false,
info: res.data
}, () => {
wx.hideLoading()
this.getTimes(this.data.qrcode_count_time).then(() => {
this.getappSignConf()
})
this.setScreenBright()
})
this.setScreenBright()
})
})
},
@@ -158,4 +163,23 @@ Page({
}
},
/**
* 授权地理位置
*/
getUserLocation() {
let that = this
return new Promise(function (resolve, reject) {
_.userManager.getUserLocation().then(location => {
that.setData({
lat: location.lat,
lng: location.lng
}, () => {
resolve()
})
}).catch(res => {
reject(res)
})
})
},
})
+1 -1
View File
@@ -16,7 +16,7 @@
<view class="text-center">
<image class="img-400x400" src="data:image/PNG;base64,{{qrcode_img}}" />
<view class="text-center font-28 fn-flex fn-flex-center fn-flex-middle mt30 color-999">
<text>{{wxTimerList.wxTimer.tim||0}}秒后失效</text>
<text wx:if="{{info}}">{{wxTimerList.wxTimer.tim||0}}秒后失效</text>
<view class="ml15 font-24" style="color:#36f" bindtap="getappSignConf">立即刷新</view>
</view>
<view class="font-24 mt30" style="color:#f10">客户点击签到,授权手机号及地理位置方可签到成功</view>
+27 -19
View File
@@ -146,27 +146,37 @@ Page({
getUserLocation() {
let that = this
return new Promise(function (resolve, reject) {
if (app.getStorageByKey('u_lat') && app.getStorageByKey('u_lng')) {
_.userManager.getUserLocation().then(location => {
that.setData({
lat: app.getStorageByKey('u_lat'),
lng: app.getStorageByKey('u_lng')
lat: location.lat,
lng: location.lng
}, () => {
resolve()
})
} else {
//u_lat u_lng
_.userManager.getUserLocation().then(location => {
console.log(location)
that.setData({
lat: location.lat,
lng: location.lng
}, () => {
resolve()
})
}).catch(res => {
reject(res)
})
}
}).catch(res => {
reject(res)
})
// if (app.getStorageByKey('u_lat') && app.getStorageByKey('u_lng')) {
// that.setData({
// lat: app.getStorageByKey('u_lat'),
// lng: app.getStorageByKey('u_lng')
// }, () => {
// resolve()
// })
// } else {
// //u_lat u_lng
// _.userManager.getUserLocation().then(location => {
// console.log(location)
// that.setData({
// lat: location.lat,
// lng: location.lng
// }, () => {
// resolve()
// })
// }).catch(res => {
// reject(res)
// })
// }
})
},
@@ -180,8 +190,6 @@ Page({
'lng': this.data.lng.toFixed(11),
'lat': this.data.lat.toFixed(11)
}
console.log(this.data.lng)
console.log(this.data.lat)
_.apiQuery.postAppSign(params).then(res => {
let arr = [];
for (const key in res.data) {
+1 -1
View File
@@ -11,7 +11,7 @@
{
"name": "pages/signup/index",
"pathName": "pages/signup/index",
"query": "scene=fwef5165we",
"query": "scene=25lzwSFJ3QcXvMLR6WIE2",
"launchMode": "default",
"scene": 1047
},