mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 21:36:38 +08:00
游湖代码
This commit is contained in:
parent
0e92b6febb
commit
a9afac5068
@ -169,3 +169,29 @@ export function refreshUserOpenId(_objData){
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新用户
|
||||||
|
* @param {Object} _objData
|
||||||
|
*/
|
||||||
|
export function getOpenIdFromAliPay(_objData){
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
requestNoAuth({
|
||||||
|
url: url.getOpenIdFromAliPay,
|
||||||
|
method: "GET",
|
||||||
|
data: _objData, //动态数据
|
||||||
|
success: function(res) {
|
||||||
|
if (res.statusCode == 200) {
|
||||||
|
resolve(res.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject();
|
||||||
|
},
|
||||||
|
fail: function(e) {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
export default function isWxOrAli() {
|
export default function isWxOrAli() {
|
||||||
var ua = window.navigator.userAgent.toLowerCase();
|
let _env = "WECHAT"
|
||||||
console.log(ua.match(/MicroMessenger/i));
|
if (/MicroMessenger/.test(window.navigator.userAgent)) {
|
||||||
//判断是不是微信
|
_env = "WECHAT"
|
||||||
if (ua.match(/MicroMessenger/i) == "micromessenger") {
|
} else if (/AlipayClient/.test(window.navigator.userAgent)) {
|
||||||
return "Wechat";
|
_env = "ALI"
|
||||||
}
|
} else {
|
||||||
console.log(ua.match(/AlipayClient/i));
|
_env = "OTHER"
|
||||||
//判断是不是支付宝
|
|
||||||
if (ua.match(/AlipayClient/i) == "alipayclient") {
|
|
||||||
return "AliPay";
|
|
||||||
}
|
}
|
||||||
|
return _env;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,12 +47,13 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class=" temp-history">
|
<view class=" temp-history">
|
||||||
<view class="padding"><text>往期记录</text></view>
|
<view class="padding"><text>往期记录</text></view>
|
||||||
<view class="flex justify-start">
|
<view class="flex justify-start">
|
||||||
<view class="padding-left" v-for="(item,index) in carNums" :key="index" @tap="_loadTempFee(item.carNum)">{{item.carNum}}
|
<view class="padding-left" v-for="(item,index) in carNums" :key="index"
|
||||||
|
@tap="_loadTempFee(item.carNum)">{{item.carNum}}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
<view class='plate-input-flag' bindtap='changeplate'>
|
<view class='plate-input-flag' bindtap='changeplate'>
|
||||||
<text>{{carNumBtn}}</text>
|
<text>{{carNumBtn}}</text>
|
||||||
</view>
|
</view>
|
||||||
@ -87,7 +88,8 @@
|
|||||||
isNotNull
|
isNotNull
|
||||||
} from '../../lib/java110/utils/StringUtil.js'
|
} from '../../lib/java110/utils/StringUtil.js'
|
||||||
import {
|
import {
|
||||||
refreshUserOpenId
|
refreshUserOpenId,
|
||||||
|
getOpenIdFromAliPay
|
||||||
} from '../../api/user/userApi.js'
|
} from '../../api/user/userApi.js'
|
||||||
import {
|
import {
|
||||||
isWxOrAli
|
isWxOrAli
|
||||||
@ -113,23 +115,40 @@
|
|||||||
carNum: '',
|
carNum: '',
|
||||||
paId: '',
|
paId: '',
|
||||||
appId: '',
|
appId: '',
|
||||||
|
aliAppId: '',
|
||||||
openId: '',
|
openId: '',
|
||||||
machineId: '',
|
machineId: '',
|
||||||
|
communityId:'',
|
||||||
carNums: []
|
carNums: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
selectCarNum
|
selectCarNum
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
// #ifdef H5
|
||||||
|
if (isWxOrAli() == "ALIPAY") {
|
||||||
|
const oScript = document.createElement('script');
|
||||||
|
oScript.type = 'text/javascript';
|
||||||
|
oScript.src = 'https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js';
|
||||||
|
document.body.appendChild(oScript);
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.paId = options.paId;
|
this.paId = options.paId;
|
||||||
this.appId = options.appId;
|
this.appId = options.appId;
|
||||||
this.openId = options.openId;
|
this.openId = options.openId;
|
||||||
this.machineId = options.machineId;
|
this.machineId = options.machineId;
|
||||||
|
this.communityId = options.communityId;
|
||||||
uni.setStorageSync(mapping.W_APP_ID, this.appId)
|
uni.setStorageSync(mapping.W_APP_ID, this.appId)
|
||||||
if (!isNotNull(this.openId)) {
|
if (!isNotNull(this.openId)) {
|
||||||
//刷新 openId
|
//刷新 openId
|
||||||
this._refreshWechatOpenId();
|
if (isWxOrAli() == 'ALIPAY') {
|
||||||
|
this._refreshAliPayOpenId();
|
||||||
|
} else {
|
||||||
|
this._refreshWechatOpenId();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._loadExistsCarNum();
|
this._loadExistsCarNum();
|
||||||
@ -206,16 +225,28 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
_refreshAliPayOpenId: function() {
|
||||||
|
// console.log("判断微信还是支付宝");
|
||||||
|
// console.log(isWxOrAli());
|
||||||
|
let _that = this;
|
||||||
|
ap.getAuthCode({
|
||||||
|
appId: this.aliAppId,
|
||||||
|
scopes: ['auth_base'],
|
||||||
|
}, function(res) {
|
||||||
|
ap.alert(JSON.stringify(res));
|
||||||
|
getOpenIdFromAliPay({
|
||||||
|
authCode:res.authCode,
|
||||||
|
communityId:_that.communityId
|
||||||
|
}).then(_data=>{
|
||||||
|
_that.openId = _data.data;
|
||||||
|
_that._loadExistsCarNum();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
_refreshWechatOpenId: function() {
|
_refreshWechatOpenId: function() {
|
||||||
// console.log("判断微信还是支付宝");
|
// console.log("判断微信还是支付宝");
|
||||||
// console.log(isWxOrAli());
|
// console.log(isWxOrAli());
|
||||||
// if (isWxOrAli() == 'AliPay') {
|
|
||||||
// uni.showToast({
|
|
||||||
// icon: 'none',
|
|
||||||
// title: '支付宝暂时未开通,敬请期待'
|
|
||||||
// })
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
let _redirectUrl = window.location.href;
|
let _redirectUrl = window.location.href;
|
||||||
refreshUserOpenId({
|
refreshUserOpenId({
|
||||||
redirectUrl: _redirectUrl,
|
redirectUrl: _redirectUrl,
|
||||||
@ -230,9 +261,14 @@
|
|||||||
},
|
},
|
||||||
_loadExistsCarNum: function() {
|
_loadExistsCarNum: function() {
|
||||||
let _that = this;
|
let _that = this;
|
||||||
|
let _openType = "WECHAT";
|
||||||
|
if(isWxOrAli == 'ALIPAY'){
|
||||||
|
_openType = 'ALIPAY'
|
||||||
|
}
|
||||||
queryWaitPayFeeTempCar({
|
queryWaitPayFeeTempCar({
|
||||||
openId: this.openId,
|
openId: this.openId,
|
||||||
machineId: this.machineId
|
machineId: this.machineId,
|
||||||
|
openType:_openType
|
||||||
}).then(_json => {
|
}).then(_json => {
|
||||||
_that.carNums = _json.data;
|
_that.carNums = _json.data;
|
||||||
if (_json.data && _json.data.length == 1) {
|
if (_json.data && _json.data.length == 1) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user