<template>
  <div class="hello">hello</div>
</template>

<script>
// eslint-disable-next-line no-unused-vars
import { InsertPay } from '@/common/api/loginApi.js'
export default {
  name: 'login',
  data () {
    return {
    }
  },
  created () {
    // 'snake'、'fading-circle'、'double-bounce'、'triple-bounce'
    // Indicator.open({
    //   text: "Loading...",
    //   spinnerType: "triple-bounce"
    // });
    // this.getOpenId()
    this.InsertPayInfo()
  },
  methods: {
    InsertPayInfo: function () {
      var that = this
      let info = JSON.parse(that.$cookie.get('jiaofei'))

      let data = {
        farwarid: info.farerowid,
        money: info.nneedpaymny + '',
        ownername: info.ownername,
        hname: info.hname,
        ownerid: 'wx',
        paytype: '1005'
      }// 根据后端所需传参数

      InsertPay(data).then(res => {
        console.info('data', res)
        if (!res.isSuccess) {
          that.$toast(res.errMsg)
        } else {
          that.$toast({
            message: '支付成功',
            duration: 2000
          })
          that.$router.push('/Getfdc_pm_revfare')
        }
        // this.weChatParameter=res
        // this.weixinPay()
      })
    }
    // getQueryString (name) {
    //   var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
    //   var r = window.location.search.substr(1).match(reg)
    //   if (r != null) return unescape(r[2])
    //   return null
    // },
    // getOpenId: function () {
    //   var code = this.getQueryString('code')
    //   this.$store.commit('setWxCode', code)
    //   getOpenId(code).then(res => {
    //     let obj = res
    //     if (!obj.isSuccess) {
    //       this.$toast(obj.errMsg)
    //       return
    //     }
    //     this.$store.commit('setResult', obj.isSuccess)
    //     this.$store.commit('setCode', obj.code)
    //     this.$store.commit('setMsg', obj.errMsg)
    //     // eslint-disable-next-line eqeqeq
    //     if (obj.msg == 'bind') {
    //       // Indicator.close()
    //       this.$store.commit('setwxopenid', obj.openId)

    //       this.$store.commit('setData', obj.data)
    //       this.$store.commit('setToken', obj.tnToken)

    //       this.$cookie.set('obj', JSON.stringify(obj)) // 设置cookie
    //       this.$router.push('/BindHouse')
    //     // eslint-disable-next-line eqeqeq
    //     } else if (obj.msg == 'newopenid') {
    //       this.$store.commit('setwxopenid', obj.openId)
    //       // Indicator.close()
    //       this.$router.push('/loginbytel')
    //     }
    //   })
    //     // eslint-disable-next-line handle-callback-err
    //     .catch(err => {})
    // }
  }
}
</script>

<style scoped>
</style>
