提交 daf010af authored 作者: pengxiaohui's avatar pengxiaohui

修复存储openId错误的bug

上级 9b312992
......@@ -52,7 +52,7 @@
<script>
import BuyPopup from './components/BuyPopup.vue'
import PhoneCodeLoginPopup from '@/components/PhoneCodeLoginPopup.vue'
import { getGoodsList, getShopList, createOrder, checkPayStatus } from '@/api/common.js'
import { getGoodsList, getShopList, createOrder } from '@/api/common.js'
import { getOpenId } from '@/api/account.js'
import store from '@/store'
import { mapGetters } from 'vuex'
......@@ -72,11 +72,12 @@ export default {
payment_order_id: '',
payment_method: '12',
order_params: '',
order_details_url: window.location.origin + '/order-details'
order_details_url: window.location.origin + '/order-details',
openId: ''
}
},
computed: {
...mapGetters(['user', 'isWxBrowser']),
...mapGetters(['user', 'isWxBrowser', 'isPhone']),
query() {
return this.$route.query
},
......@@ -85,12 +86,6 @@ export default {
},
shop_id () {
return this.query.shop_id || '6800681447305773056'
},
isBackFormPay () {
return window.sessionStorage.getItem('isBackFormPay')
},
openId () {
return window.localStorage.getItem('openId') // 'oF3a-t9pFpmL2gWuTmtWs5HlDGkU'
}
},
beforeMount() {
......@@ -151,8 +146,10 @@ export default {
fetchOpenId(code) {
getOpenId({ code, identity: 'ezijing' }).then(response => {
if (response.code === 0) {
this.openId = response.openid
window.localStorage.setItem('openId', this.openId)
if (response.openid) {
this.openId = response.openid || ''
window.localStorage.setItem('openId', response.openid || '')
} else window.localStorage.removeItem('openId')
} else {
this.getCode()
}
......@@ -200,10 +197,6 @@ export default {
}
})
},
fetchCheckPayStatus() {
const id = window.sessionStorage.getItem('payment_order_id') || ''
checkPayStatus({ payment_order_id: id }).then(res => {})
},
placeOrderCallback(res) {
const payType = this.payment_method
window.localStorage.setItem('payment_order_id', res.payment_order_id)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论