|
|
@@ -32,6 +32,7 @@
|
|
|
import { purchaseClearWxPay } from "@/api/purchase/index";
|
|
|
import wexinPay from "@/utils/pay/wxPay";
|
|
|
import { mapGetters } from "vuex";
|
|
|
+import { postWxCode } from '@/api/mini'
|
|
|
export default {
|
|
|
name: "callback",
|
|
|
data () {
|
|
|
@@ -66,6 +67,27 @@ export default {
|
|
|
},1000)
|
|
|
},
|
|
|
_wxPay () {
|
|
|
+ let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
+ let that = this
|
|
|
+ if(!this.$util.isEmpty(currentMiniOpenId)){
|
|
|
+ that.weixinPay()
|
|
|
+ }else{
|
|
|
+ //没有miniOpenId补miniOpenId
|
|
|
+ uni.login({
|
|
|
+ provider: 'weixin',
|
|
|
+ success: res => {
|
|
|
+ postWxCode({ code: res.code }).then(subRes => {
|
|
|
+ if(subRes.data.currentMiniOpenId){
|
|
|
+ let thisMiniOpenId = subRes.data.currentMiniOpenId
|
|
|
+ uni.setStorageSync('currentMiniOpenId',thisMiniOpenId)
|
|
|
+ that.weixinPay()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ weixinPay(){
|
|
|
let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
purchaseClearWxPay({ orderSn: this.orderSn,currentMiniOpenId:currentMiniOpenId }).then(res => {
|
|
|
wexinPay(res.data, this.getSuccess, this.getError)
|