|
@@ -9,7 +9,7 @@ const payType = ref('0')
|
|
|
const route = useRoute()
|
|
|
const orderDetal = ref({})
|
|
|
const orderSn = ref(route.query.id || GetRequest('id'))
|
|
|
-const { getToken, openId, isEur, info, setUserData } = useUserStore()
|
|
|
+const { getToken, getOpenId, isEur, info, setUserData } = useUserStore()
|
|
|
const is_weixn = computed(() => {
|
|
|
var wx = window.navigator.userAgent.toLowerCase()
|
|
|
if (wx.match(/MicroMessenger/i) == 'micromessenger') {
|
|
@@ -18,6 +18,9 @@ const is_weixn = computed(() => {
|
|
|
return false
|
|
|
}
|
|
|
})
|
|
|
+const openId = computed(()=>{
|
|
|
+ return getOpenId
|
|
|
+})
|
|
|
// let PAYSID = {
|
|
|
// wechatPay: is_weixn.value ? 1 : 0,
|
|
|
// alipay: 4,
|
|
@@ -25,14 +28,14 @@ const is_weixn = computed(() => {
|
|
|
// }
|
|
|
//判断是否微信
|
|
|
onMounted(() => {
|
|
|
- console.log('useUserStore', getToken, openId, isEur, info, is_weixn)
|
|
|
+ console.log('useUserStore', getToken, openId.value, isEur, info, is_weixn)
|
|
|
getDetial()
|
|
|
})
|
|
|
async function handelPay() {
|
|
|
let apiData = {
|
|
|
orderSn: orderSn.value,
|
|
|
payType: is_weixn.value ? '1' : payType.value,
|
|
|
- openId
|
|
|
+ openId:openId.value,
|
|
|
}
|
|
|
console.log('handelPay', apiData)
|
|
|
const res = await openPay(apiData)
|
|
@@ -100,12 +103,14 @@ function handleType(params: string) {
|
|
|
function getDetial() {
|
|
|
getOrderInfo(orderSn.value).then((res) => {
|
|
|
orderDetal.value = res
|
|
|
- handleWxlogin(res.wxAppId)
|
|
|
+ if(is_weixn.value){
|
|
|
+ handleWxlogin(res.wxAppId)
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
async function handleWxlogin(wxAppId: string) {
|
|
|
const code = GetRequest('code')
|
|
|
- if (!openId && !code) {
|
|
|
+ if (!openId.value && !code) {
|
|
|
//微信登录
|
|
|
getWeChatCode(wxAppId)
|
|
|
} else if (code) {
|
|
@@ -120,7 +125,7 @@ async function handleOpenPay() {
|
|
|
openPay({
|
|
|
orderSn: GetRequest('orderSn'),
|
|
|
payType: payType.value,
|
|
|
- openId
|
|
|
+ openId:openId.value,
|
|
|
}).then((res) => {
|
|
|
let url = res.qrCodeUrl
|
|
|
})
|