tipDialog.vue 2.68 KB
<template>
  <el-dialog
    class="uploadHistoryDialog"
    :visible.sync="dialogVisible"
    width="35%"
    :show-close="true"
    :close-on-click-modal="false"
    center
  >
    <template slot="title">
      <div class="dialogTitle el-icon-warning"></div>
    </template>
    <div class="content">
      <div class="content-Item" v-html="tipcontent"></div>
      <div class="content-option">
        <el-checkbox v-model="checked" @change="checkChange">
          No more prompts in the future for the same situation
        </el-checkbox>
      </div>
    </div>
    <div align="center" style="margin-bottom: 20px">
      <el-button
        class="entrySaveButton entrySaveButton-background"
        @click="confirm"
      >
        CONFIRM
      </el-button>
      <el-button class="entrySaveButton" @click="cancel">CANCEL</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { uploadUserTipFlag } from "@/api/system/user.js";
export default {
  props: {
    dialogVisible: {
      type: Boolean,
      default: false,
    },
    tipcontent: {
      type: String,
      default: "",
    },
    typeStatus: {
      type: Number,
      default: 1,
    },
  },
  data() {
    return {
      checked: false,
    };
  },
  watch: {
    dialogVisible(val) {
      if (val) {
        if (typeStatus == 1) {
          this.checked =
            this.$store.getters.userData.addflag1 == 1 ? false : true;
        } else if (typeStatus == 2) {
          this.checked =
            this.$store.getters.userData.addflag2 == 1 ? false : true;
        }
      }
    },
  },
  methods: {
    checkChange(val) {
      let obj = {
        addFlag1: this.$store.getters.userData.addflag1,
        addFlag2: this.$store.getters.userData.addflag1,
      };
      if (typeStatus == 1) {
        obj.addFlag1 = val ? 2 : 1;
      } else if (typeStatus == 2) {
        obj.addFlag2 = val ? 2 : 1;
      }
      uploadUserTipFlag(obj)
        .then((res) => {
          if (res.code === 200) {
          } else {
            // this.alertWarningMsg(res.msg)
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    confirm() {
      this.$emit("cancel", true);
    },
    cancel() {
      this.$emit("cancel", false);
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/assets/styles/variables.scss";
.dialogTitle {
  font-size: 36px;
  color: $fedexBottonColor;
}
.content {
  text-align: center;
  .content-Item {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    line-height: 20px;
    margin-bottom: 20px;
  }

  .content-option {
    margin-bottom: 24px;
    .el-checkbox {
      .el-checkbox__label {
        color: $fedexButton !important;
      }
    }
  }
}
</style>