MyModal.vue 5.25 KB
<template>
  <div class="my-modal">
    <van-overlay
      z-index="101"
      :show="showModal"
      @click.stop="onCancel"
    >
      <div class="new_modal_body">
        <div class="new_modal_content" :style="{height:open?'249px':'306px'}">
          <div class="modal_top_icon"></div>
          <div class="modal_main" :style="{height:open?'219px':'276px'}">
            <div class="modal_title">
              <span class="modal_title_text">温馨提示</span>
            </div>
            <div class="modal_con" :style="{height:open?'205px':'262px'}">
              <div class="modal_info">
                卡券
                <span class="name_text">【{{ coupons.productName }}】</span>
                有效期为
                <span class="name_text">{{ coupons.warrantyPeriod || 0 }}</span>
                小时,为避免过期导致卡券失效,请于
                <span class="name_text">{{ coupons.warrantyPeriod || 0 }}</span>
                小时内兑换使用,如介意请勿拍哦
              </div>
              <div v-if="!open" class="other_info">
                开通会员本商品可再减<span class="name_text">{{price}}</span>元
              </div>
              <div v-if="!open" class="open_btn" @click.stop="toOpenPage">
                点我开通
              </div>
              <div class="modal_btn_wrapper">
                <div class="btn_wrap" @click.stop="onCancel">取消</div>
                <div class="btn_wrap comfirmText" @click.stop="onComfirm">
                  确定购买
                </div>
                <div class="dr_line"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </van-overlay>
  </div>
</template>

<script type='text/ecmascript-6'>
export default {
  name: "MyModal",
  data() {
    return {};
  },
  props: {
    showModal: {
      type: Boolean,
      default: false,
    },
    coupons: Object,
    type: {
      type: Number,
      default: 1, //
    },
    open: {
      type: Boolean,
      default: false,
    },
    price: {
      type: Number,
      default: 0,
    },
  },

  mounted() {},
  methods: {
    onCancel() {
      this.$emit("cancel");
    },
    onComfirm() {
      this.$emit("comfirm");
    },
    toOpenPage() {
      window.vm.$router.push({
        name: "cardRoll.opening",
        query: { payStatus: 1 },
      });
      this.setLocalStorage("whereInOpen", "goods");
    },
  },
};
</script>

<style scoped lang='scss'>
.new_modal_body {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  .new_modal_content {
    width: 72%;
    height: 306px;
    .modal_top_icon {
      width: 144px;
      height: 30px;
      background-image: url("~@a/images/equity/scrm_modal_top_icon.png");
      background-size: 144px 30px;
      margin: 0 auto;
    }
    .modal_main {
      border-radius: 4px;
      height: 276px;
      position: relative;
      .modal_title {
        position: absolute;
        left: 50%;
        top: 0;
        transform: translate(-50%, 0);
        height: 28px;
        width: 160px;
        background-image: linear-gradient(142deg, #ffead1 0%, #e6bb8a 100%);
        border-radius: 18px;
        z-index: 1;
        text-align: center;
        line-height: 28px;
        .modal_title_text::before {
          content: "";
          position: absolute;
          top: 50%;
          left: -70%;
          transform: translate(0, -50%);
          width: 31px;
          height: 1px;
          background: #683800;
        }
        .modal_title_text {
          color: #683800;
          font-size: 14px;
          position: relative;
        }
        .modal_title_text::after {
          content: "";
          position: absolute;
          top: 50%;
          right: -70%;
          transform: translate(0, -50%);
          width: 31px;
          height: 1px;
          background: #683800;
        }
      }
      .modal_con {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 262px;
        background: #ffffff;
        width: 100%;
        border-radius: 4px;
        .modal_info {
          width: 100%;
          box-sizing: border-box;
          padding: 34px 24px 20px 24px;
          font-size: 14px;
          color: #606060;
        }
        .modal_btn_wrapper {
          position: absolute;
          left: 0;
          right: 0;
          bottom: 0;
          height: 44px;
          display: flex;
          border-top: 1px solid #e5e5e5;
          .btn_wrap {
            text-align: center;
            line-height: 44px;
            color: #333333;
            font-size: 14px;
            width: 50%;
          }
          .comfirmText {
            color: #fc5b32;
          }
          .dr_line {
            position: absolute;
            left: 50%;
            top: 0;
            bottom: 0;
            width: 1px;
            transform: translate(-50%, 0);
            background: #e5e5e5;
          }
        }
        .other_info {
          text-align: center;
          color: #333;
          font-size: 14px;
        }
        .open_btn {
          color: #19c34e;
          font-size: 14px;
          text-align: center;
          text-decoration: underline;
          margin-top: 3px;
        }
      }
    }
  }
}
.name_text {
  color: #ee6723;
}
</style>