Files
gterFang/src/components/edit/choosingIdentity.vue
2024-03-25 12:14:40 +08:00

367 lines
11 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="btn" v-if="popType == ''" @click="ClickBtn()"></div>
<div class="pop-mask flexcenter" v-else>
<div class="pop-box" :style="{ width: popType == 'choice' ? '520px' : '' }">
<div v-if="popType == 'choice'">
<img class="close-icon" @click="popType = ''" src="@/assets/img/edit/close-icon.svg" />
<div class="pop-header flexcenter">发布房源</div>
<div class="please-choose">请选择</div>
<div class="choice-box flexflex flex1">
<div v-for="(item, index) in identityList" :key="index">
<div v-if="index == identityList.length - 1 && index % 2 !== 1" class="choice-long-item flexacenter"
@click="choiceItem(item.key)">
<div class="choice-long-left">
<div class="choice-name">{{ item.value }}</div>
<div class="choice-explain">{{ item.desc }}</div>
</div>
<div class="choice-arrows"></div>
</div>
<div v-else class="choice-item" @click="choiceItem(item.key)">
<div class="choice-name">{{ item.value }}</div>
<div class="choice-explain">{{ item.desc }}</div>
<div class="choice-arrows"></div>
</div>
</div>
</div>
</div>
<div class="agent" v-else>
<div class="pop-header flexcenter">身份确认</div>
<div class="affirm-hint affirm-a-hint" v-if="popType == 'agent'">确认中介身份后将不能更改</div>
<div class="affirm-hint affirm-b-hint" v-else>由于您上架的房源信息中包括了中介房源系统需要确认您是否属于中介身份</div>
<div class="rules-box">
<div class="rules-item flexflex" v-for="(item, index) in showList" :key="index">
<img class="rules-icon" src="@/assets/img/edit/green-arrow.svg" alt="">
<div class="rules-text" v-html="item"></div>
</div>
</div>
<div class="footer flexcenter">
<div v-if="popType == 'agent'" class="footer-item flexcenter" @click="backChoice">重新选择</div>
<div v-else class="footer-item flexcenter" @click="confirmIntermediary(-1)">我不是中介</div>
<div class="footer-item affirm flexcenter" @click="confirmIntermediary(1)">{{ popType == 'agent' ?
'确认并不再修改' : '我是中介' }}</div>
</div>
</div>
</div>
</div>
</template>
<!-- <script> -->
<script setup>
import { ElLoading } from 'element-plus'
import { ref, reactive, onMounted, getCurrentInstance, defineEmits } from 'vue'
import { useRouter, useRoute } from 'vue-router'
const { proxy } = getCurrentInstance()
const router = useRouter()
const route = useRoute();
let identityList = ref([])
let popType = ref('') // choice agent: 确认是否是中介(有个人房源) affirmAgent: 确认是否是中介(有中介房源)
let agent = ref([`中介账号发布的房源信息,均展示在“<span style="color: #000; font-weight:650;">中介房源</span>”频道中,即不能发布“<span style="color: #000; font-weight:650;">个人房源</span>”、“<span style="color: #000; font-weight:650;">求房源</span>”;如您已上架个人房源或求房源信息,在你确认中介身份后,将会自动下架`])
let affirmAgent = ref([`个人账号只能发布“<span style="color: #000; font-weight:650;">个人房源</span>”、“<span style="color: #000; font-weight:650;">求房源</span>”,在您确认不是中介身份后,将会自动下架您的中介房源;`, `中介账号只能发布“<span style="color: #000; font-weight:650;">中介房源</span>”,如您已上架个人房源或求房源信息,在你确认中介身份后,将会自动下架;`])
let rulesList = ref([`中介账号(未认证)最多可同时上架 <span style="color: #000; font-weight:650;">3</span> 条房源信息`, `中介账号(有认证)最多可同时上架 <span style="color: #000; font-weight:650;">20</span> 条房源信息`, `中介帐号(有认证)拥有搜索、过滤“<span style="color: #000; font-weight:650;">求房源</span>”信息的功能`,])
let showList = ref([]) //展示的规则
let identityKey = ref(1)
let housingnum = ref(0)
let isintermediary = ref(0)
let loading = ref(null) // 加载
// 点击按钮
const ClickBtn = () => {
if (identityList.value.length == 0) init()
else popType.value = 'choice'
}
if (route.path == "/choosing-identity") ClickBtn()
async function init() {
loading = ElLoading.service({
lock: true,
text: 'Loading',
background: 'rgba(0, 0, 0, 0.7)',
})
proxy.$post("/tenement/pc/api/publish/checkidentity").then(res => {
if (res.code != 200) return
let data = res.data
identityList.value = data.data
housingnum.value = data.housingnum
// housingnum.value = 10
isintermediary.value = data.isintermediary
// isintermediary.value = 1
// console.log("data.isintermediary",data.isintermediary);
// if (data['ispopup'] == 0) overallJump()
if (data['ispopup'] == 0) overallJump()
else popType.value = 'choice'
}).finally(() => {
loading.close()
})
}
// 返回选择 重新选择
let backChoice = () => popType.value = "choice"
// 选择身份
let choiceItem = (key) => {
identityKey.value = key
if (key == 1) {
popType.value = "agent"
showList.value = [...agent.value, ...rulesList.value]
} else {
showList.value = [...affirmAgent.value, ...rulesList.value]
if (housingnum.value == 0) overallJump()
else popType.value = "affirmAgent"
}
}
let overallJump = () => {
router.push(`/edit?intermediary=${identityKey.value}`)
popType.value = ''
}
let confirmIntermediary = (isintermediary) => {
if (isintermediary == 1) identityKey.value = 1
overallJump()
// return
proxy.$post("/tenement/pc/api/publish/submitidentity", {
isintermediary
}).then(res => {
popType.value = ''
})
}
</script>
<style lang="less" scoped>
.btn {
position: absolute;
top: 0;
left: 0;
// background-color: #50e3c2;
width: 100%;
height: 100%;
}
.pop-mask {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.817647058823529);
z-index: 1000;
}
.pop-box {
position: relative;
z-index: 1111;
box-sizing: border-box;
border-radius: 16px;
padding-top: 39px;
background-color: #ffffff;
// width: 520px;
width: 640px;
height: auto !important;
-moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.117647058823529);
-webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.117647058823529);
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.117647058823529);
line-height: normal;
}
.pop-header {
font-size: 24px;
font-weight: 650;
color: #000000;
// margin-bottom: 35px;
}
.please-choose {
color: #555555;
font-size: 14px;
margin-top: 26px;
margin-bottom: 24px;
padding-left: 35px;
}
.choice-box {
justify-content: space-between;
flex-wrap: wrap;
padding: 0 35px 49px;
.choice-item,
.choice-long-item {
background-color: #f6f6f6;
height: 160px;
width: 220px;
border-radius: 16px;
margin-bottom: 10px;
box-sizing: border-box;
padding-top: 18px;
.choice-name {
font-weight: 650;
font-size: 18px;
color: #000000;
position: relative;
padding-left: 34px;
text-align: left;
&::after {
content: "";
position: absolute;
top: 50%;
left: 16px;
transform: translateY(-50%);
background-color: #50e3c2;
width: 6px;
height: 16px;
border-radius: 3px;
}
}
&:hover {
cursor: pointer;
background-color: rgb(242, 242, 242);
.choice-arrows {
background-color: #000;
background-image: url('@/assets/img/edit/selectArrow-white.svg');
}
}
}
.choice-long-item {
width: 450px;
justify-content: space-between;
height: 100px;
padding-right: 20px;
.choice-arrows {
margin: 0;
margin-top: -18px;
}
}
.choice-explain {
color: #555555;
font-size: 14px;
font-weight: 400;
margin-top: 10px;
margin-bottom: 21px;
padding-left: 34px;
text-align: left;
}
.choice-arrows {
width: 40px;
height: 40px;
background-color: #fddf6d;
border-radius: 50%;
margin: 0 auto;
background-image: url('@/assets/img/edit/selectArrow.png');
background-size: 24px;
background-repeat: no-repeat;
background-position: center;
}
}
.close-icon {
position: absolute;
top: 20px;
right: 14px;
width: 14px;
height: 14px;
cursor: pointer;
}
.affirm-hint {
color: #333333;
margin: 0 auto;
text-align: left;
padding: 0 30px;
}
.affirm-a-hint {
text-align: center;
margin-top: 20px;
}
.affirm-b-hint {
margin: 36px auto 0;
}
.rules-box {
background: rgba(246, 246, 246, 1);
margin: 30px;
border-radius: 10px;
padding: 15px;
.rules-item {
line-height: 24px;
&:not(:last-of-type) .rules-text {
border-bottom: 1px dashed #ebebeb;
}
.rules-text {
padding: 20px 0;
font-size: 15px;
}
}
.rules-icon {
width: 15px;
height: 15px;
margin-top: 25px;
margin-right: 12px;
}
}
.footer {
padding: 0 15px;
height: 100px;
border-top: 1px solid #ebebeb;
.footer-item {
width: 200px;
height: 50px;
border-radius: 40px;
font-size: 20px;
cursor: pointer;
background-color: #ffffff;
border: 1px solid rgba(215, 215, 215, 1);
&:first-of-type {
margin-right: 20px;
}
&.affirm {
border: none;
background-color: rgba(98, 177, 255, 1);
color: #ffffff;
font-weight: 650;
}
}
}
</style>