|
@@ -112,8 +112,124 @@ export default {
|
|
}
|
|
}
|
|
this.$store.commit('SET_UNLICENSED_INFO', {});
|
|
this.$store.commit('SET_UNLICENSED_INFO', {});
|
|
},
|
|
},
|
|
|
|
+ getParam(url, key) {
|
|
|
|
+ let u = url.split('?')[1]
|
|
|
|
+ let l = u.split('&')
|
|
|
|
+ let o = {}
|
|
|
|
+ l.forEach(i => {
|
|
|
|
+ let key = i.split('=')[0]
|
|
|
|
+ let value = i.split('=')[1]
|
|
|
|
+ if (key == 'type') {
|
|
|
|
+ if (value != 'test') {
|
|
|
|
+ o[key] = value
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ o[key] = value
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return o[key]
|
|
|
|
+ },
|
|
|
|
+ get_sa_utm(options) {
|
|
|
|
+ return new Promise((resolve) => {
|
|
|
|
+ try {
|
|
|
|
+ let temp = ''
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
|
+ if (options.q) {
|
|
|
|
+ temp = decodeURIComponent(options.q)
|
|
|
|
+ }
|
|
|
|
+ // #endif
|
|
|
|
+ // #ifdef MP-ALIPAY
|
|
|
|
+ // 如果是支付宝这边已经解析过了,则返回false,不做二次解析
|
|
|
|
+ // const query = CacheTool.getMiniAppOptionsQuery()
|
|
|
|
+ console.log('options.options::::', options.options)
|
|
|
|
+ if (options.options.qrCode) {
|
|
|
|
+ temp = decodeURIComponent(options.options.qrCode)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // #endif
|
|
|
|
+ // temp = https://crm.kerryplus.com/t-parking?sa_utm=iE
|
|
|
|
+ if (temp && temp.indexOf('?') > -1) {
|
|
|
|
+ const sa_utm = this.getParam(temp, 'sa_utm');
|
|
|
|
+ console.log('utm参数', sa_utm)
|
|
|
|
+ return resolve(sa_utm || false)
|
|
|
|
+ }
|
|
|
|
+ console.log('二码合一参数解析失败', temp);
|
|
|
|
+ return resolve(false)
|
|
|
|
+ } catch (err) {
|
|
|
|
+ resolve(false)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ asyncRequest(url, data, method = 'GET') {
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ uni.request({
|
|
|
|
+ url: url,
|
|
|
|
+ data: data,
|
|
|
|
+ header: JSON.parse(uni.getStorageSync('handleUser') || "{}"),
|
|
|
|
+ method: method,
|
|
|
|
+ success: (res) => {
|
|
|
|
+ resolve(res.data);
|
|
|
|
+ },
|
|
|
|
+ fail: (err) => {
|
|
|
|
+ reject(err);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 在异步函数中调用异步请求
|
|
|
|
+ fetchData(id) {
|
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
|
+ try {
|
|
|
|
+ const res = await this.asyncRequest(`${'https://pq.kerryplus.com'}/c/${id}`);
|
|
|
|
+ console.log('baseURLQrCode:::', res)
|
|
|
|
+ // console.log('baseURLQrCodebaseURLQrCode::', res.data);
|
|
|
|
+ if (res?.code == 200) {
|
|
|
|
+ // console.log('77777777', res, queryStringToObject(res.data.url));
|
|
|
|
+ // const [baseURL, key, value] = res.data.url.match(/(.*)=(.*)/)
|
|
|
|
+ if (res?.data?.url) {
|
|
|
|
+ // resolve({ key, value })
|
|
|
|
+ const insideUrl =
|
|
|
|
+ `/pages/package-parkingFee/parkingFeeWebViewLogin?${res.data.url}`
|
|
|
|
+
|
|
|
|
+ // resolve(queryStringToObject(`t-page?${res.data.url}`))
|
|
|
|
+ my.navigateTo({
|
|
|
|
+ url: `/pages/package-parkingFee/parkingFeeWebViewLogin?${res.data.url}`,
|
|
|
|
+ complete: function (res) {
|
|
|
|
+ console.log('回调::', res)
|
|
|
|
+ },
|
|
|
|
+ success: function (res) {
|
|
|
|
+ console.log('跳转成功::', res)
|
|
|
|
+ },
|
|
|
|
+ fail: function (err) {
|
|
|
|
+ console.log('跳转失败::', res)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ reject(false)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error('请求失败', error);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ async getqrcode (options) {
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ const sa_utm = await this.get_sa_utm(options);
|
|
|
|
+ if (sa_utm) {
|
|
|
|
+ const params = await this.fetchData(sa_utm)
|
|
|
|
+
|
|
|
|
+ console.log('二码合一参数::::', params)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } catch(err) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 无牌车闸机扫码
|
|
// 无牌车闸机扫码
|
|
async scanCarCode() {
|
|
async scanCarCode() {
|
|
|
|
+ var _this = this
|
|
const runScanFn = (res) => {
|
|
const runScanFn = (res) => {
|
|
/*
|
|
/*
|
|
针对微信的小程序码进行的兼容改造
|
|
针对微信的小程序码进行的兼容改造
|
|
@@ -149,14 +265,24 @@ export default {
|
|
// window.location.reload()
|
|
// window.location.reload()
|
|
// return
|
|
// return
|
|
// }
|
|
// }
|
|
- window.toWXSendMsg({
|
|
|
|
- type: 'scanQRCode',
|
|
|
|
- });
|
|
|
|
- // TODO 兼容支付宝无牌车扫码
|
|
|
|
- window.subscribe('scanQRCodeOver', (options) => {
|
|
|
|
- // console.log('微信扫码结束之后的返回参数', options);
|
|
|
|
- runScanFn(options.options);
|
|
|
|
- });
|
|
|
|
|
|
+ // 调用支付宝扫一扫功能
|
|
|
|
+ window.toWXSendMsg({
|
|
|
|
+ type: 'scanQRCode',
|
|
|
|
+ });
|
|
|
|
+ console.log('二码合一参数::::')
|
|
|
|
+
|
|
|
|
+ // runScanFn({type: "scanQRCodeOver", options: {imageChannel: "camera", qrCode: "https://crm.kerryplus.com/t-parking?sa_utm=mJ", rawData: "aHR0cHM6Ly9jcm0ua2VycnlwbHVzLmNvbS90LXBhcmtpbmc/c2FfdXRtPW1K", result: "https://crm.kerryplus.com/t-parking?sa_utm=mJ", scanType: "QR", errMsg: "scanCode:ok"}});
|
|
|
|
+ // TODO 兼容支付宝无牌车扫码
|
|
|
|
+ // this.getqrcode({type: "scanQRCodeOver", options: {imageChannel: "camera", qrCode: "https://crm.kerryplus.com/t-parking?sa_utm=mJ", rawData: "aHR0cHM6Ly9jcm0ua2VycnlwbHVzLmNvbS90LXBhcmtpbmc/c2FfdXRtPW1K", result: "https://crm.kerryplus.com/t-parking?sa_utm=mJ", scanType: "QR", errMsg: "scanCode:ok"}})
|
|
|
|
+ window.subscribe('scanQRCodeOver', (options) => {
|
|
|
|
+ console.log('微信扫码结束之后的返回参数', {type: "scanQRCodeOver", options: {imageChannel: "camera", qrCode: "https://crm.kerryplus.com/t-parking?sa_utm=mJ", rawData: "aHR0cHM6Ly9jcm0ua2VycnlwbHVzLmNvbS90LXBhcmtpbmc/c2FfdXRtPW1K", result: "https://crm.kerryplus.com/t-parking?sa_utm=mJ", scanType: "QR", errMsg: "scanCode:ok"}});
|
|
|
|
+ // const sa_utm = await this.get_sa_utm(options);
|
|
|
|
+ // console.log('sa_utm:::', sa_utm)
|
|
|
|
+ _this.getqrcode(options)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // runScanFn(options);
|
|
|
|
+ });
|
|
} else {
|
|
} else {
|
|
try {
|
|
try {
|
|
this.$wx.scanQRCode({
|
|
this.$wx.scanQRCode({
|