PhoneView.vue 8.67 KB
<!--
 * @Author: 前端 qianduan01@didihu.com.cn
 * @Date: 2023-05-15 15:08:32
 * @LastEditors: yangming yangming@didihu.com.cn
 * @LastEditTime: 2023-05-31 17:18:14
 * @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="review-body">
    <img src="@/assets/phone.png" class="review-phone" />
    <div class="review-title_top">{{ detail.title }}</div>
    <div class="review-content">
      <div class="review-main">
        <div class="main-title" :style="{ top: item.y + 'px', 'font-size': item.fontSize + 'px', color: item.color }" v-for="(item, index) in textList" :key="index">{{ item.text }}</div>
        <div class="review-bg-img">
          <img :src="detail.backgroundImg" v-if="detail.backgroundImg" />
        </div>
        <div class="review-main-img">
          <img :src="detail.captionImg" v-if="detail.captionImg" />
        </div>
      </div>
      <div class="review-package">
        <div class="review-goods" v-if="selectedGoodsList && selectedGoodsList.length">
          <div class="goods-item" v-for="(item, index) in selectedGoodsList" :key="index">
            <div class="service-desc">
              <div class="title">{{ item.brandName }}{{ item.goodsName }}</div>
              <div class="content">x{{ item.couponAmount }} 抵扣券</div>
            </div>
            <div class="service-price">
              {{ (item.denomination / 100).toFixed(2) }}
              <span>元</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      detail: {},
      cavansObj: {
        1: {
          titleStyle: {
            x: 82,
            y: 224,
            fontSize: 52,
            color: '#AD604C'
          },
          subTitleStyle: {
            x: 66,
            y: 292,
            fontSize: 28,
            color: '#AD604C'
          }
        },
        2: {
          titleStyle: {
            x: 10,
            y: 168,
            fontSize: 36,
            color: '#185D5E'
          },
          subTitleStyle: {
            x: 10,
            y: 212,
            fontSize: 16,
            color: '#185D5E'
          }
        }
      },
      discount: {
        2: '折扣券',
        3: '代金券',
        4: '兑换券',
        7: '服务券'
      }
    }
  },
  props: {
    editForm: {
      type: Object,
      default: () => {}
    },
    selectedGoodsList: {
      type: Object,
      default: () => {}
    }
  },
  watch: {
    editForm: {
      handler(val) {
        const mainTitle = this.cavansObj[val.id],
          { title, subTitle } = val,
          textList = []
        if (mainTitle) {
          title.split(' ').forEach((item, index) => {
            textList.push({
              x: mainTitle.titleStyle.x * 0.7,
              y: (mainTitle.titleStyle.y + index * mainTitle.titleStyle.fontSize * 1.1) * 0.7,
              fontSize: mainTitle.titleStyle.fontSize * 0.7,
              color: mainTitle.titleStyle.color,
              text: item
            })
          })
          new Array(subTitle).forEach((item, index) => {
            textList.push({
              x: mainTitle.subTitleStyle.x * 0.7,
              y: (mainTitle.subTitleStyle.y + mainTitle.titleStyle.fontSize * 1.1 * (textList.length - 1)) * 0.7,
              fontSize: mainTitle.subTitleStyle.fontSize * 0.7,
              color: mainTitle.subTitleStyle.color,
              text: item
            })
          })
        }
        this.textList = textList
        this.detail = val
      },
      deep: true,
      immediate: true
    }
  }
}
</script>
<style lang="scss" scoped>
.review-body {
  margin: 10px auto;
  width: 305px;
  height: 645px;
  position: relative;
  .review-phone {
    width: 100%;
  }
  .review-title_top {
    position: absolute;
    top: 38px;
    left: 0px;
    width: 100%;
    text-align: center;
    line-height: 40px;
  }
  .review-footer {
    position: absolute;
    bottom: 52px;
    left: 109px;
    color: #f13c3d;
    font-size: 22px;
    label {
      font-size: 12px;
    }
  }
  .review-content {
    position: absolute;
    width: calc(100% - 20px);
    height: 504px;
    overflow-y: auto;
    top: 77px;
    left: 13px;
    .review-main {
      position: relative;
      .main-title {
        width: 100%;
        position: absolute;
        text-align: center;
      }
      img {
        width: 275px;
      }
    }
    .review-package {
      background: #ddd8c0;
      padding: 16px;
      .review-equity,
      .review-service,
      .review-goods {
        background: #ffffff;
        border-radius: 12px;
        padding: 10px;
        margin-bottom: 10px;
      }
      .service-item {
        height: 48px;
        background-image: linear-gradient(117deg, #ffead3 3%, #f0ca90 92%);
        border-radius: 4px;
        display: flex;
        align-items: center;
        padding: 4px;
        margin-top: 5px;
        &:first-child {
          margin-top: 0px;
        }
        .service-title {
          width: 74%;
          height: 40px;
          background: #ffffff;
          border-radius: 6px;
          font-size: 14px;
          color: #333333;
          line-height: 40px;
          padding-left: 12px;
        }

        .service-time {
          color: #8e5310;
          text-align: center;
          flex: 1;
          font-size: 12px;
          line-height: 48px;
        }
      }
      .coupon-item {
        height: 48px;
        background: #fff5f3;
        border-radius: 4px;
        display: flex;
        align-items: center;
        padding: 4px;
        margin-top: 5px;
        &:first-child {
          margin-top: 0px;
        }
        .service-title {
          width: 64%;
          height: 40px;
          background: #ffffff;
          border-radius: 6px;
          font-size: 14px;
          color: #333333;
          line-height: 40px;
          padding: 0px 12px;
          display: flex;
          justify-content: space-between;
          span {
            font-size: 14px;
            color: #333333;
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
            &:last-child {
              font-size: 11px;
              color: #9b9b9b;
            }
          }
        }

        .service-time {
          color: #fc5b32;
          text-align: center;
          flex: 1;
          font-size: 12px;
          line-height: 48px;
        }
      }
      .goods-item {
        display: flex;
        border-bottom: 1px solid #f8f7f2;
        padding: 5px;
        &:last-child {
          border-bottom: none;
        }
        .service-logo {
          width: 32px;
          height: 32px;
          margin-right: 10px;
        }

        .service-desc {
          width: 55%;
          .title {
            font-size: 12px;
            color: #111111;
          }

          .content {
            font-size: 11px;
            color: #9b9b9b;
          }
        }

        .service-price {
          margin-left: auto;
          color: #fc5b32;
          font-size: 14px;

          span {
            font-size: 12px;
          }
        }
      }
      .review-address {
        .title {
          display: flex;
          align-items: center;
          justify-content: space-between;
          width: 100%;
          height: 32px;
          background: rgba(255, 255, 255, 0.8);
          border-radius: 8px 8px 0 0;
          padding: 0px 10px;
          box-sizing: border-box;
        }

        .title-l {
          font-size: 15px;
          color: #333333;
        }

        .title-r {
          font-size: 10px;
          color: #9b9b9b;
          letter-spacing: 2px;
          span {
            margin-right: 5px;
          }
        }
        .address {
          display: flex;
          padding: 10px;
          background: #ffffff;
          .store {
            font-weight: 500;
            font-size: 14px;
            color: #2c2c2c;
            line-height: 20px;
          }
          .detail {
            font-weight: 400;
            font-size: 12px;
            color: #656566;
            margin: 2px 0 8px 0;
          }
        }
      }
      .review-line {
        color: #999999;
        font-size: 12px;
        font-weight: 400;
        background: #ffffff;
        border-radius: 4px;
        padding: 14px 10px;
        margin: 10px 0px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        img {
          width: 36px;
          margin-right: 10px;
        }
        i {
          margin-left: auto;
          color: #fc643e;
        }
      }
    }
  }
}
</style>