MyModal.vue 8.18 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"
              :class="!open && !noMemberPrice ? 'new_content' : ''"
              :style="{ height: open ? '205px' : '262px' }"
            >
              <div
                v-if="
                  (pageType == 1 && coupons.noMemberPrice) ||
                  (pageType == 1 && open)
                "
                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="pageType == 1 && !open && !coupons.noMemberPrice"
                class="modal_info"
              >
                卡券
                <span class="name_text">【{{ coupons.productName }}】</span>
                为会员专属商品,您可在成为会员后发起购买
              </div>
              <div
                v-if="
                  (pageType == 2 && open) || (pageType == 2 && noMemberPrice)
                "
                class="modal_info"
              >
                <div class="info_title">请您核对账号,确保无误</div>
                <div class="info_tip">充值账号</div>
                <div class="info_num">{{ rechargeNum }}</div>
              </div>
              <div
                v-if="pageType == 2 && !open && !noMemberPrice"
                class="modal_info"
              >
                <span class="name_text"
                  >【{{ brandName }}{{ rechageName }}{{denominationName}}】</span
                >
                为会员专属充值,您可在成为会员后进行充值
              </div>
              <div
                v-if="pageType == 2 && !open && noMemberPrice"
                class="info_line"
              ></div>
              <div v-if="!open && price&&noMemberPrice" class="other_info">
                开通会员本商品可再减<span class="name_text name_text_max">{{
                  price
                }}</span
                >元
              </div>
              <div
                v-if="!open && noMemberPrice"
                class="open_btn"
                @click.stop="toOpenPage"
              >
                点我开通
              </div>
              <div class="modal_btn_wrapper">
                <div class="btn_wrap" @click.stop="onCancel">取消</div>
                <div
                  v-if="!open && !noMemberPrice"
                  class="btn_wrap comfirmText"
                  @click.stop="toOpenPage"
                >
                  开通会员
                </div>
                <div
                  v-else
                  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,
    rechageName: String,
    pageType: {
      type: Number,
      default: 1, //1商品详情  2直充
    },
    open: {
      type: Boolean,
      default: false,
    },
    price: {
      type: Number,
      default: 0,
    },
    rechargeNum: String,
    noMemberPrice: null,
    brandName: String,
    denominationName:String
  },

  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;
        }
        .info_title {
          text-align: center;
          color: #333333;
          font-size: 14px;
        }
        .info_tip {
          text-align: center;
          color: #666666;
          font-size: 12px;
          margin-top: 17px;
        }
        .info_num {
          text-align: center;
          color: #fc5b32;
          font-size: 14px;
          margin-top: 2px;
        }
        .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;
          }
        }
        .info_line {
          width: calc(100% - 24px);
          height: 1px;
          background: rgba($color: #000000, $alpha: 0.1);
          margin: 0 auto;
          margin-bottom: 12px;
        }
        .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;
        }
      }
      .new_content {
        position: absolute;
        left: 0;
        right: 0;
        top: 14px;
        height: 150px !important;
      }
    }
  }
}
.name_text {
  color: #ee6723;
}
.name_text_max {
  font-size: 18px;
}
</style>