美文网首页
id作用,及js获取标签属性

id作用,及js获取标签属性

作者: 艾希_可可 | 来源:发表于2018-12-04 20:29 被阅读17次

包含样式


屏幕快照 2018-12-04 下午8.21.29.png

1、一个图标带文字和箭头样式
2、一个cell文字样式
3、收购价格旁边的打折图片

4、使用id,js获取标签修改属性值

2、一个cell文字样式

   <p style="line-height: 65px;display: flex;align-items: center;width: 100%;">
      <span style="font-size: 17px;color: #333333;margin-left: 15px;width: 50%;text-align: left;">转让清算</span>
      <span style="font-size: 12px;color: #666666;margin-right: 8px;width: 50%;text-align: right;" @click="turnRule">清算规则
      </span>
      <img src="https://lsdk.oss-cn-hangzhou.aliyuncs.com/webapp/rightarrow.png" style="height: 18px;margin-right: 15px;"/>
    </p>

4、使用id,js获取标签修改属性值

        document.getElementById('dddid').style.backgroundImage = 'url(' + this.discountbg + ')'

<template>
  <div style="background:white;">
    <div style="width: 100%;height:46px;background: white;" class="rec" v-if="topTabNav">
      <van-nav-bar class="debtDetailminetop"
                   title= "债转详情"
                   left-arrow
                   @click-left="debtdetailBackm"
      />
    </div>
    <div style="background: #FAFAFA;width: 100%;height: 10px;"></div>

    <div style="width: 100%; height: 9rem; display: flex; align-items:center;">
      <div style="width: 23%;">
        <img style="width: 5rem; height: 5rem;" :src="icon"/>
      </div>
      <div style="width: 53%">
        <p style="color: #333333; font-size: 1.8rem; font-weight: 450; text-align: left;">{{platName}}</p>
        <p style="display: flex; margin-top: 0.8rem;">
          <span style="color: #2A2A2A; font-size: 14px; line-height: 1.5rem;">
            <span style="color: #F74C4C;">¥100,000</span>
            债权现有余额
          </span>
        </p>
      </div>

      <div style="width: 24%;height: 9rem;">
      <p style="display: flex;align-items: center;line-height: 9rem;" @click="turnXieYi">
        <span style="font-size: 12px;line-height: 9rem;margin-right: 8px;width: 85%;text-align: right;">查看协议
        </span>
        <img src="https://lsdk.oss-cn-hangzhou.aliyuncs.com/webapp/rightarrow.png" style="height: 18px;margin-right: 15px;line-height: 9rem;"/>
      </p>
      </div>
    </div>

    <div style="background: #FAFAFA;width: 100%;height: 10px;"></div>
    <p style="line-height: 65px;display: flex;align-items: center;width: 100%;">
      <span style="font-size: 17px;color: #333333;margin-left: 15px;width: 50%;text-align: left;">转让清算</span>
      <span style="font-size: 12px;color: #666666;margin-right: 8px;width: 50%;text-align: right;" @click="turnRule">清算规则
      </span>
      <img src="https://lsdk.oss-cn-hangzhou.aliyuncs.com/webapp/rightarrow.png" style="height: 18px;margin-right: 15px;"/>
    </p>

    <div class="debtdatilLists">
      <p class="pstyle" style="font-size: 16px;color: black;">
        <span style="margin-left: 15px;">到账价值(元)</span>
        <span style="margin-right: 15px;">{{this.cash}}</span>
      </p>
      <div style="background: #FAFAFA;width: 90%;height: 1.5px;margin-left: 5%;"></div>
      <p class="pstyle">
        <!--<span style="margin-left: 15px;">收购价格 <img :src="discountbg" style="margin-top: 5px;width: 40px;"/></span>-->
        <!--<span style="margin-left: 15px;">收购价格 <span id="debtcashdiscountbgid" class="debtcashdiscountbg" style="background-image: url(http://lsdk.oss-cn-hangzhou.aliyuncs.com/webapp/webapp/sixbg.png)">4折</span> </span>-->
        <span style="margin-left: 15px;">收购价格 <span class="debtcashdiscountbg" id="dddid">{{this.calRate}}折</span> </span>

        <span style="margin-right: 15px;">{{this.discountAmount}}元</span>
      </p>
      <p class="pstyle">
      <span style="margin-left: 15px;">到账资产宝<span style="color: dodgerblue">{{this.zcbPercent}}%</span></span>
      <span style="margin-right: 15px;color: red">{{this.zcbCount}}个</span>
      </p>
      <p class="pstyle">
      <span style="margin-left: 15px;">到账现金<span style="color: dodgerblue">{{this.cashPercent}}%</span></span>
      <span style="margin-right: 15px;color: red">{{this.cash}}元</span>
      </p>
    </div>

    <div style="background: #FAFAFA;width: 100%;height: 10px;"></div>
    <div class="debtdatilLists">
      <p class="pstyle" style="font-size: 16px;color: black;">
        <span style="margin-left: 15px;">合计回收</span>
        <span style="margin-right: 15px;">{{this.discountAmountAndAlreadyCapital}}元</span>
      </p>
      <div style="background: #FAFAFA;width: 90%;height: 1.5px;margin-left: 5%;"></div>
      <p class="pstyle">
        <span style="margin-left: 15px;">原债权本金</span>
        <span style="margin-right: 15px;">{{this.totalCapital}}元</span>
      </p>
      <p class="pstyle">
        <span style="margin-left: 15px;">已回收本金</span>
        <span style="margin-right: 15px;">{{this.alreadyCapital}}元</span>
      </p>
      <p class="pstyle">
        <span style="margin-left: 15px;">债权现有余额</span>
        <span style="margin-right: 15px;">{{this.currentBalance}}元</span>
      </p>
      <p class="pstyle">
        <span style="margin-left: 15px;">拟收购价格</span>
        <span style="margin-right: 15px;">{{this.discountAmount}}元</span>
      </p>
    </div>

  </div>
</template>

<script>
import { Button, Tab, Tabs, NavBar, Dialog, Toast} from 'vant'
export default {
  name: 'debtDetailmine',
  components: {Button, Tab, Tabs, NavBar, Dialog},
  data () {
    return {
      topTabNav: true,
      hasLogin: false,
      account: '',
      cash: '',
      cashPercent: '',
      discountAmount: '',
      icon: '',
      rate: '',
      totalAmount: '',
      zcbCount: '',
      zcbPercent: '',
      zcmReturn: '',
      discountbg: 'http://lsdk.oss-cn-hangzhou.aliyuncs.com/webapp/webapp/eightbg.png',
      discountAmountAndAlreadyCapital: '',
      totalCapital: '',
      alreadyCapital: '',
      currentBalance: '',
      calRate: '',
      platName: ''
    }
  },
  methods: {
    debtdetailBackm: function () {
      history.back(-1)
    },
    requestdebttransfer: function () {
      this.postRequest('/buyback/api/assetstar/my/transfer/detail', {
        'applyId': this.$route.query.applyid
      }).then(respond => {
        if (respond.status === 200) {
          if (respond.data.code === 1000) {
            console.log('成功')
            this.account = respond.data.result.account
            this.cash = respond.data.result.cash
            this.cashPercent = respond.data.result.cashPercent
            this.discountAmount = respond.data.result.discountAmount
            this.icon = respond.data.result.icon
            this.rate = respond.data.result.rate
            this.totalAmount = respond.data.result.totalAmount
            this.zcbCount = respond.data.result.zcbCount
            this.zcbPercent = respond.data.result.zcbPercent
            this.zcmReturn = respond.data.result.zcmReturn
            this.discountAmountAndAlreadyCapital = respond.data.result.discountAmountAndAlreadyCapital
            this.totalCapital = respond.data.result.totalCapital
            this.alreadyCapital = respond.data.result.alreadyCapital
            this.currentBalance = respond.data.result.currentBalance
            this.platName = respond.data.result.platformName
            this.calRate = parseFloat(this.rate) / 100

            if (parseInt(this.rate) / 100 < 5) {
              this.discountbg = 'http://lsdk.oss-cn-hangzhou.aliyuncs.com/webapp/webapp/fivebg.png'
            } else if (parseInt(this.rate) / 100 < 6) {
              this.discountbg = 'http://lsdk.oss-cn-hangzhou.aliyuncs.com/webapp/webapp/sixbg.png'
            } else if (parseInt(this.rate) / 100 < 7) {
              this.discountbg = 'http://lsdk.oss-cn-hangzhou.aliyuncs.com/webapp/webapp/sevenbg.png'
            } else if (parseInt(this.rate) / 100 < 8) {
              this.discountbg = 'http://lsdk.oss-cn-hangzhou.aliyuncs.com/webapp/webapp/eight.png'
            }
            document.getElementById('dddid').style.backgroundImage = 'url(' + this.discountbg + ')'
            console.log(respond.data.result)
          } else {
            console.log('失败1')
            console.log(respond.data.message)
          }
        }

        console.log(respond.code)
      })
    },
    turnRule: function () {
      this.$router.push({name: 'liquidationRule', query: {}})
    },
    turnXieYi: function () {
      this.$router.push({name: 'creditorcontract', query: {}})
    }
  },
  mounted () {
    if (localStorage.getItem('device') != null && localStorage.getItem('device') != '') {
      this.topTabNav = false
    } else {
      this.topTabNav = true
    }
    if (localStorage.getItem('token') != '' && localStorage.getItem('token') != undefined && localStorage.getItem('token') != null) {
    } else {
      this.$router.push({name: '', query: {}})
    }
    this.requestdebttransfer()
  }
}
</script>
<style lang="scss">
  .debtdatilLists{
    .pstyle{
      line-height: 40px;
      display: flex;
      justify-content: space-between;
      font-size: 14px;
      color: #999999;
    }
  }
  .debtdatilListp{
    display: flex;justify-content: space-around;width: 100%;font-size: 13px;line-height: 33px;text-align: center;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;
  }
  .debtdatilbottomleftBtn{
    line-height: 55px;width: 72%;height: 55px;background-color: #FFFFFF;color: #333333;font-size: 15px;text-align: left;flex: 1;
  }
  .debtDetailminetop{
    /*font-family: PingFangSC-Semibold;*/
    font-size: 17px;
    color: #030303;
    width: 100%;
    letter-spacing: -0.41px;
    text-align: center;
    position: fixed;top: 0;
    z-index: 99 !important;
  }
  .rec .van-nav-bar .van-icon {
    color: black;
    width: 12px;
    height: 28px;
    line-height: 28px;
    font-weight: bold;
  }
.debtcashdiscountbg{
  line-height: 26px;
  display: inline-block;
  align-items: center;
  width: 55px;
  height: 26px;
  background-size: 100% 100%;
  color: white;
  font-size: 13px;
  background-repeat: no-repeat;
}
</style>

相关文章

  • id作用,及js获取标签属性

    包含样式 1、一个图标带文字和箭头样式2、一个cell文字样式3、收购价格旁边的打折图片 4、使用id,js获取标...

  • video标签属性方法和事件

    标签的属性 html 代码: //audio和video都可以通过JS获取对象,JS通过id获取video和aud...

  • HTML的form

    1.form:作用:收集并提交用户的信息属性:id 表单的id,用于js获取表单name 表单的名字,...

  • 开发基础(DOM)

    获取HTML标签元素getElementById('tagId') //通过id属性获取getElements...

  • JS获取DOM元素的方法(8种)

    通过ID获取(getElementById) 通过name属性(getElementsByName) 通过标签名(...

  • form表单知识总结

    form表单的作用及input标签 form表单的作用 填写用户信息,提交给后台。 标签及属性 input标签及属...

  • JavaScript属性获取

    一、操作标签的合法属性 合法属性:比如id、class、title、href、src等。 获取合法属性:获取元素之...

  • Bean标签中的常用属性

    Bean标签中常用的属性 id属性:名称,id属性值名称任意命名,但不能包含特殊符号,根据id值可以获取到配置对象...

  • Dom操作

    js获取元素的几种方式 根据id属性的值获取元素,返回来的是一个元素对象 根据标签名字获取元素,返回来的是一个伪数...

  • python - BeautifulSoup 简单使用

    find 查询一个标签 根据class找出标签内的内容 根据id找出标签内的内容 获取标签的属性 获取标签里面的内...

网友评论

      本文标题:id作用,及js获取标签属性

      本文链接:https://www.haomeiwen.com/subject/csgvcqtx.html