|
|
@@ -40,6 +40,7 @@
|
|
|
import { getGhsData } from '@/api/ghs'
|
|
|
import { recharge } from '@/api/member'
|
|
|
import { getOrderShop } from '@/utils/config'
|
|
|
+ import { postWxCode } from '@/api/mini'
|
|
|
export default {
|
|
|
name: 'pay',
|
|
|
components: {
|
|
|
@@ -197,7 +198,26 @@
|
|
|
// 微信支付
|
|
|
wexinPayFn() {
|
|
|
this.payWay = 0
|
|
|
- this.toPay()
|
|
|
+ let that = this
|
|
|
+ let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
+ if (this.$util.isEmpty(currentMiniOpenId)){
|
|
|
+ uni.showLoading({mask:true})
|
|
|
+ uni.login({
|
|
|
+ provider: 'weixin',
|
|
|
+ success: res => {
|
|
|
+ postWxCode({ code: res.code }).then(subRes => {
|
|
|
+ uni.hideLoading()
|
|
|
+ if(subRes.data.currentMiniOpenId){
|
|
|
+ let thisMiniOpenId = subRes.data.currentMiniOpenId
|
|
|
+ uni.setStorageSync('currentMiniOpenId',thisMiniOpenId)
|
|
|
+ that.toPay()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ that.toPay()
|
|
|
+ }
|
|
|
},
|
|
|
paySuccess() {
|
|
|
this.$util.pageTo({url: '/admin/ghs/result?id='+this.id+'&salt='+this.salt,type: 2})
|