<template>
  <div class="cards">
    <div class="ctop">
      <span class="icon">&#xe646;</span>
      <span class="ctitle">{{ form.companyName }}</span>
      <span class="ckk" @click="op('info')">查看</span>
      <img :src="rz" class="rz" />
      <span class="icon qr" title="点击查看企业二维码" @click="op('qr')">&#xe643;</span>
    </div>
    <div class="desc">账户余额（元）</div>
    <div class="money" @click="op('record')">
      <span>{{ form.money }}</span>
      <span class="mingxi">明细</span>
    </div>
    <el-row :gutter="10" class="btm" v-if="bar">
      <el-button type="primary" icon="el-icon-minus" @click="op('out')" v-hasPermi="['work:out:add']">提现</el-button>
      <el-button type="primary" icon="el-icon-plus" @click="op('add')" v-hasPermi="['work:recharge:add']">充值</el-button>
      <el-button type="primary" icon="el-icon-document" @click="op('recharge_list')" v-hasPermi="['work:recharge:list']">充值明细</el-button>
      <el-button type="primary" icon="el-icon-s-promotion" @click="op('out_list')" v-hasPermi="['work:out:list']">提现明细</el-button>
    </el-row>
    <el-row :gutter="10" class="btm" v-if="show">
      <el-button type="primary" icon="el-icon-minus" @click="op('out')" v-hasPermi="['work:out:add']">提现</el-button>
      <el-button type="primary" icon="el-icon-plus" @click="op('add')" v-hasPermi="['work:recharge:add']">充值</el-button>
    </el-row>
  </div>
</template>

<script>
import out_edit from '@/views/work/money/out/edit.vue';
import record_list from '@/views/work/money/record/index.vue';
import out_list from '@/views/work/money/out/record.vue';
import recharge_edit from '@/views/work/money/recharge/edit.vue';
import recharge_list from '@/views/work/money/recharge/record.vue';
import qr from '@/components/qr';
import rz from '@/assets/images/rz.png';
import company from '@/views/work/company/detail.vue';
export default {
  props: {
    bar: {
      type: Boolean,
      default: false
    },
    show: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      rz: rz,
      form: {}
    };
  },
  mounted() {
    this.ajax({ url: '/work/company/index' }).then((response) => {
      this.form = response.data;
    });
  },
  methods: {
    op(tag, row) {
      if (tag == 'record') {
        this.iframe({ obj: record_list, param: {}, title: '资金交易明细', width: '55%', height: '70%' });
      }
      if (tag == 'info') {
        this.iframe({ obj: company, param: { id: this.form.id, detail: true }, title: '企业信息', width: '60%', height: '70%' });
      }
      if (tag == 'qr') {
        this.iframe({ obj: qr, param: {}, title: '查看企业二维码', width: '27%', height: '45%' });
      }
      if (tag == 'out') {
        this.iframe({ obj: out_edit, param: { company: this.form }, title: '提现申请', width: '40%', height: '55%' });
      }
      if (tag == 'add') {
        this.iframe({ obj: recharge_edit, param: {}, title: '充值申请', width: '40%', height: '65%' });
      }
      if (tag == 'recharge_list') {
        this.iframe({ obj: recharge_list, param: {}, title: '充值明细', width: '72%', height: '70%' });
      }
      if (tag == 'out_list') {
        this.iframe({ obj: out_list, param: {}, title: '提现明细', width: '72%', height: '70%' });
      }
    }
  }
};
</script>
