<template>
  <div>
    <van-button type="primary" @click="goPay">默认按钮</van-button>
    <pay-h5 :requestParam="requestParam"></pay-h5>
  </div>
</template>
<script>
// import * as api from '@/api/pay.js'
export default {
  components: {
  },
  data() {
    return {
      requestParam: {
        product_id: '', // 提前设定
        open_id: '', // 通过微信授权获取
        prepay_id: '', // 通过调用接口获取
        app_id: '', // 提前设定
        app_secret: '' // 提前设定
      }
    }
  },
  mounted() {
    this.getOpenid()
    this.getGoodsDetail()
  },
  methods: {
    getOpenid() {
      console.log(window.G, '======')
      // api.getOpenid().then(res => {
      //   console.log(res)
      // })
    },
    getGoodsDetail() {
      // api.getGoodsDetails('6682927830365372416').then(res => {
      //   console.log(res)
      // })
    },
    goPay () {
      this.VueEvent.$emit('pay-wx-h5', {
        data: {},
        callback: function (obj) {
          console.log(obj)
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
