home.vue 4.29 KB
<template>
  <div class="wrap">
    <div class="pay-wrap">
      <div class="title">订单支付</div>
      <div class="tipstext">{{ title }}</div>
      <div class="money">{{ money }}</div>
      <div class="choosetext">选择支付方式</div>
      <ul class="pay-way">
        <li v-for="(item, index) in payArr" :key="index" :class="{checkedClass : index===currentId}" @click="currentId = index">
          <span></span>
          {{ item }}
        </li>
      </ul>
      <div class="commit-btn" @click="commitsure">确认支付</div>
    </div>
    <Loading v-show="showflag"/>
  </div>
</template>

<script>
import Loading from './Loading'

export default {
  name: 'Home',
  components: {
    Loading
  },
  data() {
    return {
      showflag: true,
      title: '',
      money: '',
      payArr: ['支付宝支付', '微信支付'],
      currentId: 0
    }
  },
  computed: {
    // ...mapGetters([
    //   '_getshowflag', '_getPayFlag'
    // ])
  },
  created() {
    this.$http.get('http://39.98.54.240:8090/hmQrCodeInOutPark/noCarQRcodeInOutPark')
      .then(function(response) {
        console.log(response)
      })
      .catch(function(error) {
        console.log(error)
      })
    setTimeout(() => {
      this.showflag = false

      // $http.post('/user', {
      //   firstName: 'Fred',
      //   lastName: 'Flintstone'
      // })
      // .then(function (response) {
      //   console.log(response);
      // })
      // .catch(function (error) {
      //   console.log(error);
      // });

      // 模拟请求
      // this.$fetch('/api/v2/movie/top250').then((response) => {
      //   console.log(response)
      // })
      // },
      // this.handlePayFlag()
      this.title = '手机: 13911137584'
      this.money = '¥100.00'
    }, 2000)
  },
  methods: {
    commitsure() {
      alert(this.currentId)
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
  .wrap {
    width: 100%;
    height: 100%;
    position: relative;
    .pay-wrap {
      width: 100%;
      height: 100%;
      background-color: #eff4f5;
      text-align: center;
      .title {
        height: 42px;
        line-height: 42px;
        background-color: rgba(255, 255, 255, .9);
        font-size: 17px;
        color: #4A4A4A;
        font-weight: 500;
      }
      .tipstext {
        margin: 35px auto 35px;
        font-size: 18px;
        font-weight: bold;
        color: rgba(255, 7, 7, 1);
      }
      .money {
        height: 48px;
        line-height: 48px;
        font-size: 48px;
        font-weight: 400;
        color: rgba(74, 74, 74, 1);
      }
      .choosetext {
        padding-left: 10px;
        margin: 60px 0 10px;
        text-align: left;
        font-size: 17px;
        font-weight: 400;
        color: rgba(74, 74, 74, 1);
      }
      .pay-way {
        padding-left: 10px;
        padding-right: 18px;
        background-color: #fff;
        text-align: left;
        cursor: pointer;
        li {
          height: 43px;
          line-height: 43px;
          font-size: 14px;
          font-weight: 400;
          color: rgba(74, 74, 74, 1);
          background-image: url("../assets/unchecked-icon.png");
          background-repeat: no-repeat ;
          background-position: right center ;
          background-size: 18px 18px;
          span {
            width: 24px;
            height: 24px;
            display: inline-block;
            margin-right: 11px;
            vertical-align: middle;
          }
          &:nth-of-type(1) {
            border-bottom: 1px solid rgba(240, 244, 245, 1);
            span {
              background: url("../assets/ali-icon.png") no-repeat;
              background-size: 100% 100%;
            }
          }
          &:nth-of-type(2) {
            span {
              background: url("../assets/wechat-icon.png") no-repeat;
              background-size: 100% 100%;
            }
          }
        }
        .checkedClass{
          background-image: url("../assets/checked-icon.png");
        }
      }
      .commit-btn {
        width: 80%;
        height: 42px;
        line-height: 42px;
        margin: 120px auto 0;
        border-radius: 21px;
        background-color: #75CBBE;
        font-size: 18px;
        font-weight: 400;
        color: rgba(255, 255, 255, 1);
      }
    }
  }
</style>