<template>
  <div class="container">
    <!-- 申请报销头部模块 -->
    <div>
      <el-form :inline="true" :model="reimbursementQurey">
        <el-form-item label="项目名称">
          <el-input
            v-model="reimbursementQurey.projectName"
            placeholder="项目名称"
          ></el-input>
        </el-form-item>
        <el-form-item label="状态">
          <el-select
            v-model="reimbursementQurey.reimbursementState"
            placeholder="请选择"
          >
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="query()"
            >查询</el-button
          >
          <el-button
            type="primary"
            icon="el-icon-refresh-right"
            @click="reset()"
            >重置</el-button
          >
        </el-form-item>
        <el-form-item>
          <el-button
            type="success"
            icon="el-icon-circle-plus-outline"
            @click="addreimbursement()"
            >申请报销</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <!-- 表格模块 -->
    <div class="conter">
      <el-table
        :data="reimbursementList"
        style="width: 100%; text-align: center"
        border
      >
        <el-table-column type="expand">
          <template slot-scope="props">
            <div style="padding: 10px">
              <el-descriptions title="报销详情" :column="5" border>
                <el-descriptions-item label="支付方式" :span="5">{{
                  props.row.paymentMethod
                }}</el-descriptions-item>
                <el-descriptions-item label="组长审批状态" :span="2">
                  <el-tag
                    :type="
                      props.row.reimbursementState == 0
                        ? 'info'
                        : props.row.reimbursementState == 2
                        ? 'danger'
                        : 'success'
                    "
                  >
                    {{
                      props.row.reimbursementState == 0
                        ? "待审批"
                        : props.row.reimbursementState == 2
                        ? "驳回"
                        : "通过"
                    }}
                  </el-tag>
                </el-descriptions-item>
                <el-descriptions-item label="组长审批时间" :span="3">{{
                  props.row.headmanTime
                }}</el-descriptions-item>
                <el-descriptions-item label="组长驳回缘由" :span="5">{{
                  props.row.headmanRefute || "无"
                }}</el-descriptions-item>
                <el-descriptions-item label="财务审批状态" :span="2">
                  <el-tag
                    :type="
                      props.row.reimbursementState == 4
                        ? 'danger'
                        : props.row.reimbursementState == 3
                        ? 'success'
                        : 'info'
                    "
                  >
                    {{
                      props.row.reimbursementState == 4
                        ? "驳回"
                        : props.row.reimbursementState == 3
                        ? "通过"
                        : "待审批"
                    }}
                  </el-tag>
                </el-descriptions-item>
                <el-descriptions-item label="财务审批时间" :span="3">{{
                  props.row.financeTime
                }}</el-descriptions-item>
                <el-descriptions-item label="财务驳回缘由" :span="5">{{
                  props.row.finaceRefute || "无"
                }}</el-descriptions-item>
                <el-descriptions-item label="查看详情" :span="5">
                  <el-button
                    @click="getdetails(props.row)"
                    type="primary"
                    style="margin: 5px"
                    size="mini"
                    >查看详情
                  </el-button>
                </el-descriptions-item>
              </el-descriptions>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="序号" width="50px" align="center">
          <template slot-scope="scope">
            {{
              (reimbursementQurey.pageNum - 1) * reimbursementQurey.pageSize +
              scope.$index +
              1
            }}
          </template>
        </el-table-column>
        <el-table-column prop="projectName" label="项目" align="center" />
        <el-table-column
          prop="applyTotalAmountSmall"
          label="申报总金额(元)"
          align="center"
        />
        <el-table-column label="核报总金额(元)" align="center">
          <template slot-scope="props">
            {{ props.row.verifyTotalAmountSmall || "还未核实金额" }}
          </template>
        </el-table-column>
        <el-table-column label="组长审批人" align="center">
          <template slot-scope="props">
            {{ props.row.financeName || "暂无" }}
          </template>
        </el-table-column>
        <el-table-column label="财务审批人" align="center">
          <template slot-scope="props">
            {{ props.row.financeName || "暂无" }}
          </template>
        </el-table-column>
        <el-table-column
          prop="fillingTime"
          label="报销日期"
          align="center"
          :formatter="timestampToTime"
        ></el-table-column>
        <el-table-column prop="prop" label="发票图片" align="center">
          <template slot-scope="scope">
            <el-button
              style="margin: 5px"
              type="primary"
              size="mini"
              @click="ReviseImage(scope.row)"
              >点击查看</el-button
            >
          </template>
        </el-table-column>
        <el-table-column prop="prop" label="附件下载" align="center">
          <template slot-scope="scope">
            <el-button
              type="success"
              size="mini"
              @click="getenclosure(scope.row)"
              >点击下载</el-button
            >
          </template>
        </el-table-column>
        <el-table-column prop="reimbursementState" label="状态" align="center">
          <template slot-scope="props">
            <el-tag
              :type="
                props.row.reimbursementState == 0 ||
                props.row.reimbursementState == 1
                  ? 'info'
                  : props.row.reimbursementState == 3
                  ? 'success'
                  : 'danger'
              "
            >
              {{
                props.row.reimbursementState == 0
                  ? "待小组长通过"
                  : props.row.reimbursementState == 1
                  ? "待财务长通过"
                  : props.row.reimbursementState == 2
                  ? "小组长驳回"
                  : props.row.reimbursementState == 3
                  ? "财务长通过"
                  : "财务长驳回"
              }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" align="center">
          <template slot-scope="scope">
            <el-button
              style="margin: 5px"
              size="mini"
              type="info"
              @click="withdraw(scope.row)"
              v-if="scope.row.reimbursementState == 0"
            >
              撤回</el-button
            >
            <el-button
              style="margin: 5px"
              size="mini"
              icon="el-icon-edit"
              type="info"
              @click="updataReimbursement(scope.row)"
              v-if="
                scope.row.reimbursementState != 3 &&
                scope.row.reimbursementState != 1 &&
                scope.row.reimbursementState != 2 &&
                scope.row.reimbursementState != 4
              "
              >修改信息</el-button
            >

            <el-button
              style="margin: 5px"
              size="mini"
              type="danger"
              @click="Resubmit(scope.row)"
              v-if="
                scope.row.reimbursementState == 2 ||
                scope.row.reimbursementState == 4
              "
              >重新提交</el-button
            >

            <div
              v-if="scope.row.reimbursementState == 3"
              style="width：100%;text-align: center ; color:#67C23A;"
            >
              已通过
            </div>
            <div
              v-if="scope.row.reimbursementState == 1"
              style="width：100%;text-align: center ; color:darkgray;"
            >
              待审批
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 列表中的发票详情，发票信息修改，附件 -->
    <div>
      <!-- 发票详情 -->
      <el-drawer
        title="发票详情"
        :visible.sync="invoiceShow"
        :direction="direction"
        size="30%"
      >
        <el-table
          :data="getinvoivelist"
          style="width: 100%; text-align: center"
          border
        >
          <el-table-column
            type="index"
            label="序号"
            width="80"
          ></el-table-column>
          <el-table-column prop="prop" label="发票详情">
            <template slot-scope="scope">
              <div v-if="formatProtocolType(scope.row)">
                <el-image
                  style="width: 80px; height: 80px"
                  :src="scope.row.fileUrl"
                  :preview-src-list="srcList"
                >
                </el-image>
              </div>
              <div v-else>
                <a class="a-style" @click="handlePreView(scope.row)"
                  >点击查看文件</a
                >
              </div>
            </template>
          </el-table-column>
        </el-table>
      </el-drawer>
      <!-- 查看详情 -->
      <el-drawer
        title="查看详情"
        :visible.sync="drawer"
        :direction="direction"
        size="45%"
      >
        <div class="cd">
          <el-row justify="center" align="middle">
            <el-col
              v-for="(item, index) in reimbursementDetails.list"
              :key="index"
              :span="20"
            >
              <el-descriptions
                :title="item.name"
                border
                :column="1"
                style="margin: 10px 0"
              >
                <el-descriptions-item
                  label="金额"
                  :contentStyle="contentStyle"
                  :labelStyle="labelStyle"
                  >{{ item.money }}元
                </el-descriptions-item>
                <el-descriptions-item
                  label="备注"
                  :contentStyle="contentStyle"
                  :labelStyle="labelStyle"
                  >{{ item.explain }}</el-descriptions-item
                >
                <el-descriptions-item
                  label="说明"
                  :contentStyle="contentStyle"
                  :labelStyle="labelStyle"
                  >{{ item.remarks }}</el-descriptions-item
                >
              </el-descriptions>
            </el-col>
          </el-row>
        </div>
      </el-drawer>
      <!-- 附件查看 -->
      <el-drawer
        title="附件操作"
        :visible.sync="drawer2"
        :direction="direction"
        size="50%"
      >
        <el-button
          type="primary"
          style="margin-left: 5%; margin: 30px 50px"
          @click="addenclosure"
          :disabled="isDisabled"
        >
          添加附件</el-button
        >
        <el-card
          class="box-card"
          style="width: 90%; margin-left: 5%; margin-top: 20px"
          v-show="getshow == 1"
        >
          <el-row class="row-bg">
            <div
              v-for="index in queryDTOList"
              :key="index.enclosureId"
              class="lsitall"
            >
              <el-col :span="10">
                <div style="margin-top: 6px; margin-left: 40px">
                  附件{{ index.enclosureId }}
                </div>
              </el-col>
              <el-col :span="12" style="margin-left: -50px">
                <el-button
                  type="primary"
                  icon="el-icon-folder-checked"
                  class="a-style"
                  size="mini"
                  style="font-size: 13px"
                  @click="loadenclosure(index)"
                  >下载</el-button
                >
                <el-popover placement="top" width="160" v-model="index.visible">
                  <p>确定要删除此条附件吗</p>
                  <div style="text-align: right; margin: 0">
                    <el-button
                      size="mini"
                      type="text"
                      @click="index.visible = false"
                      >取消</el-button
                    >
                    <el-button
                      type="primary"
                      size="mini"
                      @click="delenclosure(index)"
                      >确定</el-button
                    >
                  </div>
                  <el-button
                    type="danger"
                    icon="el-icon-delete"
                    class="a-style"
                    size="mini "
                    style="font-size: 13px"
                    slot="reference"
                    :disabled="isDisabled"
                    >删除</el-button
                  >
                </el-popover>
              </el-col>
            </div>
          </el-row>
        </el-card>
        <!-- 附件上传 -->
        <el-card
          class="box-card"
          style="width: 90%; margin-left: 5%; margin-top: 20px"
          v-show="getshow == 0"
        >
          <div style="width: 60%; margin-left: 30px">
            <el-input
              type="textarea"
              :rows="2"
              placeholder="请输入附件详情"
              v-model="enclosurelist.enclosureDescribe"
              style="margin: 20px 0px"
            ></el-input>
            <el-upload
              class="upload-demo"
              ref="upload1"
              drag
              :headers="fileUploadHeader"
              :action="action1"
              :file-list="fileList1"
              :on-remove="delfile1"
              :auto-upload="false"
              :on-change="onChangepdf"
              :on-success="Refresh"
              :data="enclosurelist"
              multiple
              style="margin: 20px 0px"
            >
              <i class="el-icon-upload"></i>
              <div class="el-upload__text">
                将文件拖到此处，或
                <em>点击上传附件</em>
              </div>
              <div class="el-upload__tip" slot="tip">
                只能上传文件，且不超过500kb
              </div>
            </el-upload>
          </div>
          <div style="margin-left: 75%">
            <el-button @click="cancel()">取 消</el-button>
            <el-button
              type="primary"
              @click="determine()"
              style="margin-top: 20px"
              >确 定</el-button
            >
          </div>
        </el-card>
        <div class="box-card" v-show="getshow == 3">
          <el-empty description="没有附件哦！"></el-empty>
        </div>
      </el-drawer>
    </div>
    <div class="footer">
      <el-pagination
        @current-change="handleCurrentChange"
        :current-page.sync="reimbursementQurey.pageNum"
        :page-size="reimbursementQurey.pageSize"
        layout="total, prev, pager, next"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
import { queryBypage, reimbursementId, resubmit } from "@/api/reimbursement";
import { selectAllById, selectByIdF, deleteById } from "@/api/project";
import { getFileUrl } from "@/api/companyFile";
import { selectByReimbursementId } from "@/api/reimbursementDetails";
export default {
  data() {
    return {
      //获取列表全部数据所需要的值
      reimbursementQurey: {
        userId: null,
        pageNum: 1,
        pageSize: 5,
      },
      //手动下拉框赋值（搜索）
      options: [
        {
          value: "0",
          label: "待小组长通过",
        },
        {
          value: "1",
          label: "待财务长通过",
        },
        {
          value: "2",
          label: "小组长驳回",
        },
        {
          value: "3",
          label: "财务长通过",
        },
        {
          value: "4",
          label: "财务长驳回",
        },
      ],
      reimbursementList: [], //存放列表的数据
      total: 0,
      invoiceShow: false, //发票详情的抽屉
      //查询图片给的值
      getinvoiveId: {
        companyId: null,
        reimbursementId: 0,
      },
      direction: "rtl", //发票详情抽屉打开的方向
      getinvoivelist: [], //可以选择的发票号
      srcList: [],
      drawer: false, //判断是否打开查看详情窗口
      reimbursementDetails: {
        list: [],
      }, //获取报销项列表
      //label样式
      labelStyle: { width: "80px" },
      //内容样式
      contentStyle: {
        "text-align": "center",
      },
      drawer2: false, //判断是否打开下载附件
      //查询附件
      queryDTO: {
        companyId: null,
        reimbursementId: null,
      },
      queryDTOList: [], //收集附件的数据
      getshow: 1, //判断show的显示与隐藏,
      isDisabled: false, //判断是否显示附件的删除按钮
      //附件上传携带参数
      enclosurelist: {
        Id: null,
        enclosureDescribe: "",
        status: 2, //0收入 1支出
        companyId: null,
        userId: null,
      },
      fileList1: [], //合同文件
      fileTypepdf: false, //判断附件是否存在
      fileUploadHeader: {
        "X-Token": null,
      },
    };
  },
  created() {
    this.reimbursementQurey.userId = this.$store.getters.urId;
    this.getinvoiveId.companyId = this.$store.getters.companyId;
    this.queryDTO.companyId = this.$store.getters.companyId;
    this.action1 = process.env.VUE_APP_BASE_API + "/file/updataEnclosures"; //保存附件与下载的接口
    this.fileUploadHeader["X-Token"] = this.$store.getters.token;
    this.getReimbursement();
  },
  methods: {
    //申请报销
    addreimbursement() {
      this.$router.push({ path: "/reimbursementAdd" });
    },
    //重置
    reset() {
      this.reimbursementQurey = {
        pageNum: 1,
        pageSize: 10,
        userId: null,
      };
      this.reimbursementQurey.userId = this.$store.getters.urId;
      this.getReimbursement();
    },
    //搜索
    query() {
      this.reimbursementQurey.pageNum = 1;
      this.getReimbursement();
    },
    //获取申请报销列表
    getReimbursement() {
      queryBypage(this.reimbursementQurey)
        .then((res) => {
          if (res.success) {
            this.reimbursementList = res.data.list;
            this.total = res.data.total;
          } else {
            this.$message.error(res.msg);
          }
        })
        .catch((error) => {
          this.$message.error("获取数据失败");
        });
    },
    //时间处理
    timestampToTime(row, column, cellValue) {
      return cellValue.split(" ")[0];
    },
    //换页
    handleCurrentChange(val) {
      this.reimbursementQurey.pageNum = val;
      this.getReimbursement();
    },
    //点击查看发票图片
    ReviseImage(row) {
      this.invoiceShow = true;
      this.getinvoiveId.reimbursementId = row.reimbursementId;
      this.Selectinsertlsit();
    },
    //查询发票图片
    Selectinsertlsit() {
      selectAllById(this.getinvoiveId).then((res) => {
        if (res.success) {
          this.getinvoivelist = res.data;
          this.getinvoivelist.forEach((e) => {
            let Newfilepath = e.filePath;
            let filepdf = Newfilepath.substring(Newfilepath.lastIndexOf("."));
            getFileUrl(e.filePath).then((res) => {
              if (res.success) {
                let url = res.data;
                e.fileUrl = url;
                if (filepdf != ".pdf") {
                  this.srcList.push(url);
                }
              }
            });
          });
        }
      });
    },
    //图片样式
    formatProtocolType(row) {
      //这里判断的是是否有文件
      if (row.filePath == null) {
        return flase;
      } else {
        let Newfilepath = row.filePath;
        let filepdf = Newfilepath.substring(Newfilepath.lastIndexOf("."));
        if (filepdf != ".pdf") {
          return true;
        } else {
          return false;
        }
      }
    },
    //pdf样式，展示
    handlePreView(row) {
      const photopath = row.fileUrl;
      window.open(photopath, "_blank");
    },
    //返回添加发票列表
    returnlist() {
      this.getinvoive(data);
    },
    //撤回
    withdraw(data) {
      this.$confirm("是否同意撤回?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          reimbursementId(data.reimbursementId).then((res) => {
            if (res.success) {
              if (
                this.reimbursementQurey.pageNum != 1 &&
                this.reimbursementList.length == 1
              ) {
                this.reimbursementQurey.pageNum--;
              }
              this.getReimbursement();
            } else {
              this.$message.error(res.msg);
            }
          });
        })
        .catch((error) => {
          this.$message("取消撤回申请");
          // this.back();
        });
    },
    //重新提交
    Resubmit(data) {
      //重新提交就要让之前的数据回复。
      //两个审批人的id、状态、审批时间、驳回缘由、核实金额
      //删除记录在重新填，或者删除字段记录
      data.reimbursementState = 0; //状态
      data.verifyTotalAmountLarge = null; //核实金额
      data.verifyTotalAmountSmall = null; //核实金额
      data.headmanRefute = null; //驳回缘由
      data.finaceRefute = null; //驳回缘由
      data.financeTime = null; //审批时间
      data.headmanTime = null; //审批时间
      data.financeId = null; //审批人的id
      data.headmanId = null; //审批人的id
      resubmit(data)
        .then((res) => {
          if (res.success) {
            this.$message.success("重新提交成功，等待审批");
            this.getReimbursement();
          } else {
            this.$message.error(res.msg);
          }
        })
        .catch((error) => {
          this.$message.error("重新提交失败");
        });
    },
    //查看报销项详情
    getdetails(data) {
      this.drawer = true;
      let param = {
        reimbursementId: data.reimbursementId,
      }; //接口是一个以对象的形式传值 所以定义了一个对象去拿这个参数
      selectByReimbursementId(param)
        .then((res) => {
          if (res.success) {
            this.reimbursementDetails.list = res.data;
          } else {
            this.$message.error(res.msg);
          }
        })
        .catch((error) => {
          this.$message.error("查询失败");
        });
    },
    //附件添加
    addenclosure() {
      this.getshow = 0;
      this.disabled = true;
      // this.$nextTick(()=>{
      //   this.$refs.upload1.clearFile()
      // })
      this.clearFile();
    },
    //附件的显示
    getenclosure(row) {
      this.drawer2 = true;
      if (
        row.reimbursementState == 1 ||
        row.reimbursementState == 3 ||
        row.reimbursementState == 2 ||
        row.reimbursementState == 4
      ) {
        this.isDisabled = true;
      } else {
        this.isDisabled = false;
      }
      (this.queryDTO.reimbursementId = row.reimbursementId),
        (this.enclosurelist.Id = row.reimbursementId);
      selectByIdF(this.queryDTO)
        .then((res) => {
          if (res.success) {
            this.queryDTOList = res.data;
            if (this.queryDTOList.length > 0) {
              this.getshow = 1;
              this.disabled = false;
            } else {
              this.disabled = false;
              this.getshow = 3;
            }
          } else {
            this.$message.error(res.msg);
          }
        })
        .catch((error) => {
          this.$message.error("获取附件文件失败");
        });
    },
    //附件上传失败回调
    delfile1(file) {
      this.$message.error("上传附件失败");

    },
    //文件清除
    clearFile(){
      this.fileList1 = []
      this.fileTypepdf = false;
      this.enclosurelist.enclosureDescribe = "";
    },
    //附件的刷新
    Refresh(res) {
      this.queryDTO.reimbursementId = this.enclosurelist.Id;
      if (res.success) {
        selectByIdF(this.queryDTO)
          .then((res) => {
            if (res.success) {
              this.queryDTOList = res.data;
              this.enclosurelist.enclosureDescribe = ""; //初始化数据
            } else {
              this.$message.error(res.msg);
            }
          })
          .catch((error) => {
            this.$message.error(error.msg);
          });
      } else {
        this.$message.error(res.msg);
      }
    },
    //删除附件
    delenclosure(row) {
      if (
        row.reimbursementState == 1 ||
        row.reimbursementState == 3 ||
        row.reimbursementState == 2 ||
        row.reimbursementState == 4
      ) {
        this.isDisabled = true;
      } else {
        this.isDisabled = false;
      }
      deleteById(row)
        .then((res) => {
          if (res.success) {
            this.getenclosure(row);
            this.$message({
              message: "删除成功",
              type: "success",
            });
            this.visible = false;
          } else {
            this.$message.error(res.msg);
          }
        })
        .catch((error) => {
          this.$message.success("删除成功");
        });
    },
    //取消附件的添加啊
    cancel() {
      if (this.queryDTOList.length > 0) {
        this.getshow = 1;
        this.disabled = false;
        this.clearFile();
      } else {
        this.getshow = 3;
        this.disabled = false;
        this.clearFile();
      }
    },
    //确定添加附件
    determine() {
      //判断是否有附件文件
      if (this.fileTypepdf) {
        this.enclosurelist.userId = this.$store.getters.urId;
        this.enclosurelist.companyId = this.$store.getters.companyId;
        this.$refs.upload1.submit();
        this.getshow = 1; //隐藏与显示
        this.disabled = false;
        this.$message({
          showClose: true,
          message: "上传附件成功",
          type: "success",
        });
      } else {
        this.$message.error("请添加附件，在进行提交");
      }
    },
    //附件文件的校验
    onChangepdf(file) {
      const fileNamepdf = file.name;
      let fileType = fileNamepdf.substring(fileNamepdf.lastIndexOf("."));
      if (fileType != "") {
        this.fileTypepdf = true;
      } else {
        this.$message.warning("附件只能只能上传文件");
        this.$refs.upload1.clearFiles();
        this.fileTypepdf = false;
      }
    },
    //附件的下载
    async loadenclosure(row) {
      //下载附件
      var a = document.createElement("a"); //创建一个<a></a>标签
      a.href = (await getFileUrl(row.enclosureFile)).data;
      a.target = "_blank";
      a.style.display = "none"; // 障眼法藏起来a标签
      document.body.appendChild(a); // 将a标签追加到文档对象中
      a.click(); // 模拟点击了a标签，会触发a标签的href的读取，浏览器就会自动下载了
      a.remove(); // 一次性的，用完就删除a标签
    },
    //修改信息
    updataReimbursement(data) {
      //data是列表中所有的数据
      console.log(data);
      this.$router.push({
        path: "/reimbursementUpdata",
        //query 找到我们需要的字段
        query: {
          reimbursementId: data.reimbursementId, //传那一行数据的id
          projectId: data.projectId, //项目id 下拉框根据项目id选择
          typeId: data.typeId, //报销类别id
          money: data.money, //备注
          applyTotalAmountLarge: data.applyTotalAmountLarge, //大写金额
          applyTotalAmountSmall: data.applyTotalAmountSmall, //小写金额
          summary: data.summary, //摘要
          paymentMethod: data.paymentMethod, //支付方式
        },
      });
    },
  },
};
</script>

<style scoped>
.container {
  padding: 10px;
}

.conter {
  margin-bottom: 10px;
}

.footer {
  text-align: right;
}

.lsitall .el-col {
  margin: 20px 10px;
}

.lsitall .el-button {
  margin-left: 16px;
}

.row-bg {
  margin-left: 15%;
}

.dialog-footer {
  width: 90%;
  margin: 20px 5%;
}

.lsitall .el-col {
  margin: 20px 10px;
}

.lsitall .el-button {
  margin-left: 16px;
}

.row-bg {
  margin-left: 15%;
}

.dialog-footer {
  width: 90%;
  margin: 20px 5%;
}

.cd {
  width: 90%;
  margin: 30px 5%;
}
</style>