recharge.vue 7.71 KB
<template>
  <div class="main">
    <div class="box">
      <div class="box-h">
        <div class="recharge-title">充值账号</div>
        <van-field v-model="rechargeNumber" class="input-recharge" placeholder="请输入充值账号"/>
      </div>
      <div class="recharge-select">
        <div class="recharge-select-name">充值类型</div>
        <div class="recharge-select-panel">
          <div class="recharge-select-item" :class="{'checked':typeSno == index}" @click="selectType(index)" v-for="(item,index) in  businessList" :key="index">
            {{ item.productName }}</div>
        </div>
      </div>
      <div class="recharge-select">
        <div class="recharge-select-name">充值面额</div>
        <div class="recharge-select-panel">
          <div class="recharge-select-item2" :class="{'checked':amountSno == index}" @click="selectAmount(index)" v-for="(item,index) in  denominationList" :key="index">
            <div class="recharge-item-time recharge-im">{{ item.denomination }}</div>
            <div class="recharge-item-total recharge-im">售价{{ item.salesPrice }}元</div>
            <div class="recharge-item-total2" v-if="!isOpen">权益价{{ item.lineationPrice }}元</div>
            <div class="recharge-item-total2 line-through" v-else>官方价{{ item.lineationPrice }}元</div>
          </div>
        </div>
      </div>
      <div class="recharge-tips">
        <h3>温馨提示</h3>
        <p>1.还是大家来看涉及到法律会计师</p>
      </div>
    </div>
    <div class="recharge-footer">
      <div class="card-roll" @click="getCard">
        <van-icon name="coupon-o" class="card-roll-icon"/>
        <div>我的卡券</div>
      </div>
      <div class="card-roll" @click="jumpCustomer">
        <van-icon name="smile-comment-o" class="card-roll-icon"/>
        <div>客服</div>
      </div>
      <template v-if="isOpen">
        <div class="recharge-operation" @click="chooseWXPay"><span>{{denomination.salesPrice}}元</span>立即充值</div>
      </template>
      <template v-else>
        <div class="recharge-operation" @click="jumpOpening">去开通权益</div>
      </template>
    </div>
  </div>
</template>

<script type='text/ecmascript-6'>
import { pay} from '@/mixins'
import {commodity} from "@r/api";
export default {
  mixins: [pay],
  name: "recharge",
  data() {
    return {
      isOpen: sessionStorage.getItem('CODE_STATUS'),
      appearance: 2,
      rechargeNumber: '',
      businessStatus: 1,
      denomination: {},
      denominationList: [],
      businessList: [],
      mobile: '',
      reType: [2,3,4,5],
      typeSno: 0,
      amountSno: 0,
      brandId: '',
      supplier: ''
    }
  },
  mounted() {
    this.showLoading();
    let {brandId,supplier} = this.$route.query;
    this.brandId = brandId;
    this.supplier = supplier;
    let para = {
      brandId,
      supplier
    }
    commodity.getChargeDetail(para).then(res => {
      this.hideLoading()
      let { code, data, message } = res
      if (code == 0) {
        this.businessList = data;
        this.denominationList = this.businessList[0].denominationList;
        this.denomination = this.denominationList[0];
      } else {
        this.showToast(message)
      }
    })
  },
  methods: {
    jumpOpening() {
      window.vm.$router.push({ name: 'cardRoll.opening' })
    },
    getCard() {
      window.vm.$router.push({ name: 'cardRoll.index',query:{appearance:this.appearance} })
    },
    jumpCustomer() {
      window.vm.$router.push({ name: 'cardRoll.customer'});
    },
    //充值类型
    selectType(item) {
      this.typeSno = item;
      this.amountSno = 0;
      this.denominationList = this.businessList[item].denominationList;
      this.denomination = this.businessList[item].denominationList[0];
    },
    //选择面额
    selectAmount(item) {
      this.amountSno = item;
      this.denomination = this.denominationList[item]
    }
  }
}
</script>

<style scoped lang="scss">
  .main {
    .box {
      padding: 0px 10px;
      .box-h {
        border-bottom: 1px solid #ebedf0;
        margin-top: 20px;
        .recharge-title {
          font-size: 14px;
          font-weight: 600;
          color: #333333;
        }
        .input-recharge {
          height: 36px;
          margin-bottom: 16px;
          font-size: 18px;
          font-weight: 500;
          color: #333333;
        }
      }
      .recharge-select {
        &-name {
          margin-top: 20px;
          font-size: 14px;
          font-weight: 600;
          color: #333333;
        }
        &-panel {
          display: grid;
          grid-template-columns: 33.3% 33.3% 33.3%;
          margin-top: 10px;
          .recharge-select-item {
            width: 105px;
            height: 50px;
            border-radius: 4px;
            border: 1px solid #E9E9E9;
            line-height: 50px;
            text-align: center;
            margin: 10px 10px 0px 0px;
            color: #666666;
            &.checked {
              background: #E6F4FF;
              border-radius: 4px;
              border: 1px solid #008FFF;
              color: #008FFF;
            }
          }
          .recharge-select-item2 {
            width: 108px;
            height: 80px;
            border-radius: 4px;
            border: 1px solid #E9E9E9;
            text-align: center;
            margin-bottom: 10px;
            &.checked {
              font-weight: 700;
              background: #E6F4FF;
              border-radius: 4px;
              border: 1px solid #008FFF;

              > .recharge-item-time {
                color: #333333;
                &.recharge-im {
                  color: #008FFF;
                }
              }

              > .recharge-item-total {
                color: #333333;
                &.recharge-im {
                  color: #008FFF;
                }
              }

              > .recharge-item-total2 {
                color: #008FFF;
              }
            }
            .recharge-item-time {
              line-height: 30px;
              font-size: 16px;
              font-weight: 400;
              color: #666666;
            }
            .recharge-item-total {
              line-height: 20px;
              font-size: 14px;
              font-weight: 400;
              color: #666666;
            }
            .recharge-item-total2 {
              line-height: 25px;
              font-size: 12px;
              color: #A3A3A3;
            }
          }
        }
      }
      .recharge-tips {
        padding: 20px;
        margin-bottom: 70px;
        >h3 {
          height: 22px;
          line-height: 22px;
          font-size: 16px;
          color: #333333;
          position: relative;
          padding-left: 10px;
          &:before {
            content: '';
            position: absolute;
            width: 3px;
            top: 3px;
            left: 0px;
            height: 16px;
            background: #008FFF;
          }
        }
        >p {
          line-height: 25px;
          font-size: 14px;
          color: #333333;
        }
      }
    }
  }
  .recharge-footer {
    position: fixed;
    width: 375px;
    bottom: 0px;
    padding: 0px 16px;
    box-sizing: border-box;
    height: 50px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .card-roll {
      text-align: center;
      flex: 1;
      &-icon {
        font-size: 26px;
        color: #666666;
      }
      >div {
        color: #666666;
        font-size: 12px;
        line-height: 14px;
      }
    }
    .recharge-operation {
      width: 234px;
      height: 40px;
      background: #008FFF;
      border-radius: 100px;
      line-height: 40px;
      text-align: center;
      font-size: 14px;
      color: #FFFFFF;
      >span {
        margin-right: 10px;
      }
    }
  }
</style>