<template>
  <div style="padding-top: 50px">
    <div class="pay-result">
      <div :style="{'background-image': 'url('+resultBG+')'}" class="result-bg"></div>
      <div>{{payMsg}}</div>
    </div>
  </div>
</template>

<script>

import oKBg from '../assets/images/ok.png'
import noBg from '../assets/images/no.png'
import { queryBankOrderState } from '@/api/payResult/payResult'

export default {
  name: 'payResult',
  data() {
    return {
      resultBG: '',
      payMsg: '支付成功',
      orderId:''
    }
  },
  created(){
    // console.log(this.$route.query.ID)

    this.resultBG = oKBg
    this.orderId = localStorage.getItem("OrderNum")
    this.queryBankOrderState()
    // alert(window.location.href)
    // alert(this.$router.query.ID)
  },
  mounted(){
    // alert(window.location.href)
  },
  methods:{
    queryBankOrderState:function () {
      let me = this
      let params = {
        payOrderId : me.orderId
      }
      queryBankOrderState(params).then(response => {
        console.log(response)
        if(response.data.payResultEnum == 'PAY_SUCCESS'){
          me.resultBG = oKBg
          me.payMsg = '支付成功'
        }else{
          me.resultBG = noBg
          me.payMsg = '支付失败'
        }

      })
    }
  }

}
</script>

<style scoped lang="scss">
  .pay-result {
    /*width: 150px;*/
    margin: 0 auto;
    text-align: center;
  }
  .result-bg {
    display: inline-block;
    width: 70px;
    height: 70px;
    background-position: center 0;
    background-size: 100% 100%;
  }


</style>
