index.vue 6.58 KB
<template>
  <view
    class="container"
    @click="handleTouchStart"
  >
    <view :class="['home', { show: !id }]">
      <left-side
        :userInfo="userInfo"
        :tabIndex.sync="tabIndex"
        @changeTab="$emit('changeTab', $event)"
        @stopAudio="stopAudio"
      />
      <view class="right-side">
        <template v-if="tabIndex == 0">
          <view class="right-content">
            <view
              class="start"
              @click="$emit('start')"
            >
              <image
                class="start-btn"
                src="../../assets/images/home/start.gif"
                alt="开始接待"
              />
              <image
                class="start-border"
                src="../../assets/images/home/start-border.png"
              />
            </view>
            <view class="module-list">
              <slot name="module" />
            </view>
          </view>
        </template>
        <template v-else>
          <component
            :is="componentName"
            :userInfo="userInfo"
          />
        </template>
        <view class="store-addr">
          <view class="icon-addr sprite-icon icon-addr"></view>
          <view class="addr-text">{{ userInfo.shopMerchantName }}</view>
        </view>
      </view>
    </view>
    <view :class="['detail', { show: id }]">
      <slot name="detail" />
    </view>
    <!-- 未点击开始接待,弹窗 -->
    <MessageBox
      ref="previewRef"
      @confirm="$emit('preview')"
      :popupW="704"
      content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」"
      confirmBtnText="预览素材"
      @cancel="$emit('previewCancel')"
    ></MessageBox>
    <!-- 停留弹框 -->
    <MessageBox
      ref="tipBox"
      @cancel="tipCancel"
      @confirm="tipConfirm"
      content="系统检测到您在当前页面停留较久,是否仍在客户接待中?"
      cancelBtnText="否"
      confirmBtnText="是"
    ></MessageBox>
    <!-- 退出弹框 -->
    <MessageBox
      :popupW="704"
      ref="finish"
      :content="finishContene"
      :isFooter="false"
    >
      <view class="footer">
        <view
          class="footer-btn confirm flex"
          @click="$emit('openStep')"
        >
          <template v-if="finishDoneText">
            {{ finishDoneText }}
          </template>
          <template v-else> 完成接待<text>(推荐)</text> </template>
        </view>
        <view
          class="footer-btn cancel flex"
          @click="$emit('backHome')"
        >
          仍要退出<text>(不推荐)</text>
        </view>
      </view>
    </MessageBox>
    <!-- 升级弹框 -->
    <update-box />
    <slot name="content" />
    <web-view
      @message="handlerMessage"
      ref="webview"
      src="/hybrid/html/index.html"
    ></web-view>
  </view>
</template>
<script>

import RecordList from "./components/RecordList.vue";
import myClick from "@/mixin/click";
import uploader from "@/mixin/uploader.js";
import CustomerFile from './components/CustomerFile.vue';
import LeftSide from './components/LeftSide.vue';
export default {
  mixins: [myClick, uploader],
  components: { RecordList, CustomerFile, LeftSide },
  props: {
    id: [String, Number],
    finishDoneText: String,
    finishContene: {
      type: String,
      default: "当前操作视为强制退出接待,若需正常流程完成接待请点击“完成接待”",
    },
  },
  data () {
    return {
      userInfo: {},
      tabIndex: 0
    };
  },
  mounted () {
    const userInfo = uni.$storage.get("userInfo") || {};
    this.userInfo = userInfo;
  },
  computed: {
    previewRef () {
      return this.$refs.previewRef;
    },
    finishRef () {
      return this.$refs.finish;
    },
    componentName () {
      if (this.tabIndex == 0) return 'HomeSlot'
      else if (this.tabIndex == 1) return 'RecordList'
      else return 'CustomerFile'
    },
  },
  methods: {
  },
};
</script>
<style scoped lang="scss">
.container {
  position: relative;
  &::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('@/assets/images/common/home-bg.webp');
    background-size: 100% 100%;
  }
  .home,
  .detail {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    top: 0;
    left: 0;
    visibility: hidden;
  }
  .home {
    display: flex;
    height: 100vh;
  }
  .show {
    position: absolute;
    z-index: 1;
    visibility: visible;
    animation: show-content-left 0.15s forwards;
  }
}
@keyframes show-content-left {
  0% {
    left: 100%;
  }
  100% {
    left: 0;
  }
}

.right-side {
  flex: 1;
  position: relative;
  .right-content {
    padding-top: 92rpx;
    height: 100vh;
    box-sizing: border-box;
    position: relative;
    animation: show-box 0.15s forwards;
  }
  @keyframes show-box {
    0% {
      left: 100%;
    }
    100% {
      left: 0;
    }
  }
  .start {
    &-btn {
      position: absolute;
      width: calc(100% - 64rpx);
      height: calc(100% - 64rpx);
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      vertical-align: top;
    }
    &-border {
      position: absolute;
      width: 100%;
      height: 100%;
      left: 0;
      top: 0;
      vertical-align: top;
    }
    width: calc(100% - 64rpx);
    height: 336rpx;

    position: relative;
  }
  .module-list {
    height: calc(100% - 336rpx);
  }
  .store-addr {
    position: absolute;
    left: 50%;
    bottom: 24rpx;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    margin-top: 38rpx;
    .icon-addr {
      width: 32rpx;
      height: 32rpx;
      flex-shrink: 0;
    }
    .addr-text {
      font-size: 24rpx;
      color: #999999;
      word-wrap: break-word;
      white-space: normal;
      line-height: 32rpx;
      margin-left: 4rpx;
      flex-shrink: 0;
    }
    &::before,
    &::after {
      content: '';
      width: 600rpx;
      height: 2rpx;

      margin: 0 40rpx;
    }
    &::before {
      background-image: linear-gradient(270deg, #eeeeee 0%, #d8d8d800 100%);
    }
    &::after {
      background-image: linear-gradient(90deg, #eeeeee 0%, #d8d8d800 100%);
    }
  }
}
.footer {
  border-top: 2rpx solid #eff0f2;
  font-weight: 600;
  font-size: 32rpx;
  margin-top: 48rpx;
  .footer-btn {
    justify-content: center;
    margin-top: 16rpx;
  }
  .confirm {
    width: 608rpx;
    height: 80rpx;
    background: #2c66f7;
    border-radius: 40rpx;
    color: #fff;
  }
  .cancel {
    width: 608rpx;
    height: 80rpx;
    background: #ffffff00;
    border-radius: 40rpx;
    color: #2c66f7;
  }
  text {
    font-size: 24rpx;
  }
}
</style>