QRCodeDetailDialog.vue 5.68 KB
<template>
  <div>
    <baseDialog :is-show.sync="dialogShow"
                :config="dialogConfig.setting"
                :dialog-config="dialogConfig.config"
                class="detail-content-warn">
      <div v-loading="loading">
        <div class="form_div">
          <el-form label-width="450px"
                   :inline="true">
            <el-form-item label="销售方名称:">
              {{ detailInfo.enterpriseName ? detailInfo.enterpriseName : "-" }}
            </el-form-item>
            <!-- <el-form-item label="企业联系电话:">
              {{ "-" }}
            </el-form-item> -->
            <el-form-item label="开票金额:">
              {{ detailInfo.invoiceAmount ? detailInfo.invoiceAmount : "-" }}
            </el-form-item>
            <el-form-item label="票通订单号:">
              {{ detailInfo.tradeNo ? detailInfo.tradeNo : "-" }}
            </el-form-item>
            <el-form-item label="生成时间:">
              {{ detailInfo.createdDate ? detailInfo.createdDate : "-" }}
            </el-form-item>
            <el-form-item label="二维码有效期:">
              {{ detailInfo.expireDay ? detailInfo.expireDay + '天' : "-" }}
            </el-form-item>
          </el-form>
          <div class="imgCon">
            <el-image id="printImage"
                      :src="detailInfo.invoiceQrCode"
                      class="imgSize"></el-image>
          </div>
          <div class="tips">
            您可以使用微信或支付宝,扫码开票
          </div>
        </div>
        <div class="footer">
          <el-button @click="dialogInnerShow = true"
                     type="primary">发送邮箱</el-button>
          <el-button @click="handlePrint">打印</el-button>
        </div>
      </div>
      <baseDialog :is-show.sync="dialogInnerShow"
                  :config="dialogInnerConfig.setting"
                  :dialog-config="dialogInnerConfig.config"
                  @handleClick="handleSendEmail">
        <el-form ref="sendFormRef"
                 :model="sendForm"
                 label-width="100px">
          <el-form-item prop="email"
                        label="邮箱"
                        :rules="[
                          { required: true, message: '请输入邮箱地址', trigger: 'blur' },
                          { type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }
                        ]">
            <el-input v-model="sendForm.email"
                      style="width: 300px;"></el-input>
          </el-form-item>
        </el-form>
      </baseDialog>
    </basedialog>
  </div>
</template>

<script>
import { getByQrcodeNo, sendEmail } from '@api/invoiceManage'
import { Util, deepClone } from "@/common/util"
export default {
  name: "InvoiceCodeDetailDialog",
  components: {
  },
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    paramsObj: {
      type: Object,
      default: {}
    }
  },
  computed: {
    dialogShow: {
      get() {
        return this.visible
      },
      set(val) {
        this.$emit('dialogClose')
      }
    }
  },
  mounted() {
    this.getDetail()
  },
  data() {
    return {
      dialogConfig: {
        setting: {
          showClose: true,
          appendToBody: true,
          btnList: []
        },
        config: {
          title: "查看二维码",
          width: "1080px"
        }
      },
      detailInfo: {},
      loading: true,
      dialogInnerShow: false,
      dialogInnerConfig: {
        setting: {
          showClose: true,
          appendToBody: true,
          isShowFooter: true,
          confirm_name: '发送',
          cancel_name: '取消'
        },
        config: {
          title: "发送邮箱",
          width: "500px"
        }
      },
      sendForm: {
        email: ''
      }
    }
  },
  methods: {
    getDetail() {
      var params = { qrcodeNo: this.paramsObj.qrcodeNo }
      getByQrcodeNo(params).then(res => {
        this.detailInfo = res
        this.loading = false
      })
    },

    handlePrint() {
      if (this.detailInfo.invoiceQrCode) {
        window.open(this.detailInfo.invoiceQrCode)
      }
    },

    handleSendEmail() {
      this.$refs.sendFormRef.validate(valid => {
        if (valid) {
          var params = deepClone(this.sendForm)
          params.qrcodeNo = this.detailInfo.qrcodeNo
          sendEmail(params).then(res => {
            this.notice.okTips('发送成功')
            this.dialogInnerShow = false
          })
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.detail-content-warn {
  .form_div {
    color: #333333;

    .el-form-item__content {
      display: inline-block;
      width: calc(100% - 150px);
      line-height: 24px;
    }

    .el-form-item__label {
      padding: 0;
      line-height: 24px;
    }
    .el-form-item {
      width: 100%;
      margin-bottom: 20px;
    }

    .edit-sub-block {
      // padding: 0 10px;

      .detail-txt {
        display: inline-block;
        width: 200px;
        vertical-align: bottom;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      ::v-deep .el-form-item__content {
        max-width: calc(100% - 110px);
        word-break: break-all;
      }
      .itemDiv {
        display: flex;
        .halfItem {
          width: 50%;
        }
      }
      .onLineItem {
        ::v-deep .el-form-item__content {
          max-width: 80%;
        }
      }
    }
    .imgCon {
      text-align: center;
      .imgSize {
        width: 120px;
        height: 120px;
      }
    }
    .tips {
      text-align: center;
      margin-top: 10px;
    }
  }
  .footer {
    text-align: center;
    margin-top: 50px;
  }
}
</style>