<template> <div> <div class="reimburse-container"> <div class="reimburse-icon"> <img :src="imgUrl" style="display:block;width:50px;height:50px" /> </div> <div class="reimburse-content"> <div class="content-title" :class="`title-color-${config.color}`"> <span>{{config.title}}</span> </div> <span class="content-total" @click="gotoQuery"> <span class="content-unit">¥</span> <countTo :startVal='0' :endVal='todoCount' :duration='500'></countTo> <span class="content-unit">元</span> </span> <div class="content-desc">{{config.desc}}</div> </div> </div> <div v-if="postionIndex === 0 || postionIndex === 2" class="reimburse-border"></div> </div> </template> <script> import countTo from 'vue-count-to' export default { components: { countTo }, props: { postionIndex: { type: Number }, config: { type: Object, default: () => {} }, }, computed: { imgUrl(){ return require(`../assets/img/${this.config.color}.png`) } }, data() { return { todoCount: 0 }; }, created() { this.getQuery(this.config.SQL) }, methods: { getQuery(val) { let url = `${osConfig.baseUrl}/rbc/bill/homePage/selectCount/${val}` $.ajax({ type:"GET", url:url, async:false, contentType: "application/json;", beforeSend: function(request) { request.setRequestHeader("Authorization", nros.SDK.utils.getToken()); }, success: (res) => { const {msg, code, data} = res if(code === 0) { this.todoCount = data } else { console.log('msg', msg) } }, error:function(error){ console.log('error', error) } }) // 封装的公共GMS根本不能用啊 // GMS.$http.get(url).then(res => { // console.log('res', res) // }).catch(error => { // console.log('error', error) // }) }, gotoQuery(){ GMS.$hideContainer.$router.push({ path: `/backToQuery/${this.config.templateName}` }) } } }; </script> <style lang="less" scoped> .reimburse-container{ width: 100%; height: 100%; padding: 46px 24px; .reimburse-content{ overflow: hidden; text-align: left; .content-title { height: 50px; font-size: 20px; line-height: 20px; } .content-total { cursor: pointer; font-size: 26px; font-weight: 400; color: #555555; } .content-unit{ color: #555555; font-size: 14px; } .content-desc { color: #888888; font-size: 14px; } } .reimburse-icon{ width: 50px; float: left; margin-right: 16px; font-size: 50px; text-align: center; } .title-color-info { color: #3F7AF2; } .title-color-success { color: #1BE1B2; } .title-color-warning { color: #F3B72C; } .title-color-error { color: #F34466; } } .reimburse-border { width: 1px; height: 80px; border-right: solid 1px #D8D8D8; position: absolute; top: 60px; right: 0; } </style>