Files
fini-ui/src/views/login/components/Select.vue
T

457 lines
13 KiB
Vue
Raw Normal View History

2023-04-13 23:31:04 +08:00
<template>
<div class="selectWrap" v-if="showSelect" @click="preVant">
<div class="box">
<div class="content">
2023-04-21 16:54:59 +08:00
<li>
<div class="word" @click="checkAll(1)">
{{ $t(i18n.global.t('home.title.All')) }}
<div class="check">
<el-icon v-if="checkedAll==1">
<Check></Check>
</el-icon>
</div>
</div>
<div class="word" @click="checkAll(2)">{{ $t(i18n.global.t('home.title.None')) }}
<div class="check">
<el-icon v-if="checkedAll==2">
<Check></Check>
</el-icon>
</div>
</div>
</li>
<div class="title">{{ $t(i18n.global.t('home.title.IPOStatus')) }}</div>
2023-04-13 23:31:04 +08:00
<li>
<div class="word" v-for="item in obj.ipoStatus" :key="item.key" @click="ipoStatusSlect(item.key)">
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
</li>
2023-04-21 16:54:59 +08:00
<div class="title">{{ $t(i18n.global.t('home.title.TradingCurrency')) }}</div>
2023-04-13 23:31:04 +08:00
<li>
<div class="word" v-for="item in obj.tradingCurrency" :key="item.key"
@click="tradingCurrencySlect(item.key)">
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
</li>
2023-04-21 16:54:59 +08:00
<div class="title">{{ $t(i18n.global.t('home.title.OfferingType')) }}</div>
<li>
<div class="word" v-for="item in obj.offeringType" :key = "item.key" @click="offeringType(item.key)">
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
</li>
<div class="title">{{ $t(i18n.global.t('home.title.SecuritiestobeListed')) }}</div>
<li>
<div class="word" v-for="item in obj.SecuritiestobeListed" :key = "item.key" @click="SecuritiestobeListed(item.key)">
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
</li>
<div class="title">{{ $t(i18n.global.t('home.title.ListingPlatform')) }}</div>
<li>
<div class="word" v-for="item in obj.ListingPlatform" :key = "item.key" @click="ListingPlatform(item.key)">
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
</li>
<div class="title">{{ $t(i18n.global.t('home.title.ListingType')) }}</div>
<li>
<div class="word" v-for="item in obj.ListingType" :key = "item.key" @click="ListingType(item.key)">
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
</li>
2023-04-13 23:31:04 +08:00
</div>
<div class="footer">
2023-04-21 16:54:59 +08:00
<button @click="confirm">{{ $t(i18n.global.t('home.title.APPLY')) }}</button>
<button @click="confirm">{{ $t(i18n.global.t('home.title.Cancel')) }}</button>
2023-04-13 23:31:04 +08:00
</div>
</div>
</div>
</template>
<script lang="ts">
export default {
name: "XSelect",
};
</script>
<script lang="ts" setup>
import { ref, defineExpose, reactive } from 'vue';
2023-04-21 16:54:59 +08:00
import i18n from '@/locales'
import { getCurrentInstance } from 'vue'
type keyType='ipoStatus'|'tradingCurrency'|'offeringType'|'SecuritiestobeListed'|'ListingPlatform'|'ListingType'
const { proxy } = (getCurrentInstance() as any)
2023-04-13 23:31:04 +08:00
const showSelect = ref(false)
2023-04-21 16:54:59 +08:00
const checkedAll=ref(0)
2023-04-13 23:31:04 +08:00
const confirm = () => {
showSelect.value = false;
}
const preVant = (e: any) => {
e.stopPropagation();
}
const obj = reactive({
ipoStatus: [{
key: 25,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.DealInitiated'),
2023-04-13 23:31:04 +08:00
isSelcted: false
},
{
key: 30,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.PublicOfferClosed'),
2023-04-13 23:31:04 +08:00
isSelcted: true
}, {
key: 35,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.ApplicationValidated'),
2023-04-13 23:31:04 +08:00
isSelcted: true
}, {
key: 45,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.AllotmentConfirmed'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
key: 50,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.MoneySettlement'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
key: 55,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.AllocationConfirmed'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
key: 60,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.placingApproved'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
key: 65,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.AllotmentResultsApproved'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
key: 70,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.TradingStarted'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
key: 80,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.Suspended'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
key: 90,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.Cancelled'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}],
tradingCurrency: [
{
key: 'HKD',
value: 'Hong Kong Dollar',
isSelcted: false
},
{
key: 'CNY',
value: 'Chinese Yuan',
isSelcted: true
},
{
key: 'USD',
value: 'United States Dollar',
isSelcted: false
}
2023-04-21 16:54:59 +08:00
],
offeringType:[{
key:'1',
value:proxy.$t('ipo.TypeofListing.Globalofferplacingandpublicoffer'),
isSelcted: false
},{
key:'2',
value:proxy.$t('ipo.TypeofListing.Byplacingonly'),
isSelcted: false
},{
key:'3',
value:proxy.$t('ipo.TypeofListing.Bypublicofferonly'),
isSelcted: false
},{
key:'4',
value:proxy.$t('ipo.TypeofListing.Byintroduction'),
isSelcted: false
},
{
key:'5',
value:proxy.$t('ipo.TypeofListing.TransferfromGEM'),
isSelcted: true
}
],
SecuritiestobeListed:[{
key:'1',
value:proxy.$t('ipo.TypeofListing.Ordinaryshares'),
isSelcted: false
},{
key:'2',
value:proxy.$t('ipo.TypeofListing.OrdinarysharesHshares'),
isSelcted: false
},{
key:'3',
value:proxy.$t('ipo.TypeofListing.OrdinarysharesconversionfromBtoHshares'),
isSelcted: false
},{
key:'4',
value:proxy.$t('ipo.TypeofListing.Preferenceshares'),
isSelcted: false
},
{
key:'5',
value:proxy.$t('ipo.TypeofListing.RealEstateInvestmentTrust'),
isSelcted: true
},
{
key:'6',
value:proxy.$t('ipo.TypeofListing.ExchangeTradedProduct'),
isSelcted: true
},
{
key:'7',
value:proxy.$t('ipo.TypeofListing.DepositaryReceipts'),
isSelcted: true
},
{
key:'8',
value:proxy.$t('ipo.TypeofListing.ShareStapledUnits'),
isSelcted: true
},
{
key:'99',
value:proxy.$t('ipo.TypeofListing.Other'),
isSelcted: false
}
],
ListingPlatform:[{
key:'1',
value:proxy.$t('home.Mainboard'),
isSelcted: false
},{
key:'2',
value:proxy.$t('home.GEM'),
isSelcted: false
}],
ListingType:[{
key:'1',
value:proxy.$t('ipo.TypeofListing.Ordinaryshares'),
isSelcted: false
},{
key:'2',
value:proxy.$t('ipo.TypeofListing.OrdinarysharesHshares'),
isSelcted: false
},{
key:'3',
value:proxy.$t('ipo.TypeofListing.OrdinarysharesconversionfromBtoHshares'),
isSelcted: false
},{
key:'4',
value:proxy.$t('ipo.TypeofListing.Preferenceshares'),
isSelcted: false
},
{
key:'5',
value:proxy.$t('ipo.TypeofListing.RealEstateInvestmentTrust'),
isSelcted: true
},
{
key:'6',
value:proxy.$t('ipo.TypeofListing.ExchangeTradedProduct'),
isSelcted: true
},
{
key:'7',
value:proxy.$t('ipo.TypeofListing.DepositaryReceipts'),
isSelcted: true
},
{
key:'8',
value:proxy.$t('ipo.TypeofListing.ShareStapledUnits'),
isSelcted: true
},
{
key:'99',
value:proxy.$t('ipo.TypeofListing.Other'),
isSelcted: false
}
]
2023-04-13 23:31:04 +08:00
})
const ipoStatusSlect = (key: number) => {
obj.ipoStatus = obj.ipoStatus.map((item: any) => {
if (item.key == key) {
return { ...item, isSelcted: !item.isSelcted }
}
return item
})
}
const tradingCurrencySlect = (key: string) => {
obj.tradingCurrency = obj.tradingCurrency.map((item: any) => {
if (item.key == key) {
return { ...item, isSelcted: !item.isSelcted }
}
return item
})
}
2023-04-21 16:54:59 +08:00
const offeringType = (key: string) => {
obj.offeringType = obj.offeringType.map((item: any) => {
if (item.key == key) {
return { ...item, isSelcted: !item.isSelcted }
}
return item
})
}
const SecuritiestobeListed = (key: string) => {
obj.SecuritiestobeListed = obj.SecuritiestobeListed.map((item: any) => {
if (item.key == key) {
return { ...item, isSelcted: !item.isSelcted }
}
return item
})
}
const ListingPlatform = (key: string) => {
obj.ListingPlatform = obj.ListingPlatform.map((item: any) => {
if (item.key == key) {
return { ...item, isSelcted: !item.isSelcted }
}
return item
})
}
const ListingType = (key: string) => {
obj.ListingType = obj.ListingType.map((item: any) => {
if (item.key == key) {
return { ...item, isSelcted: !item.isSelcted }
}
return item
})
}
const checkAll = (number:number)=>{
if(checkedAll.value&&checkedAll.value==number){
checkedAll.value=0;
}else{
checkedAll.value=number;
selectAll(number as 1|2)
}
}
function selectAll(all:1|2){
// obj['ipoStatus']
var boolean=all==1?true:false;
Object.keys(obj).forEach((item:string)=>{
obj[item as keyType]=obj[item as keyType].map(element=>{
return {...element,isSelcted:boolean} as any;
})
})
}
2023-04-13 23:31:04 +08:00
defineExpose({
showSelect
})
</script>
<style lang="scss" scoped>
.selectWrap {
width: 800px;
2023-04-21 16:54:59 +08:00
height: 820px;
2023-04-13 23:31:04 +08:00
background-color: #fff;
border-radius: 20px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 10;
2023-04-21 16:54:59 +08:00
2023-04-13 23:31:04 +08:00
.box {
box-sizing: border-box;
padding: 10px 20px 20px 20px;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.content {
.title {
2023-04-21 16:54:59 +08:00
font-size: 18px;
color: #879db2;
2023-04-13 23:31:04 +08:00
margin-top: 10px;
}
li {
display: flex;
font-size: 18px;
flex-wrap: wrap;
.word {
margin-right: 10px;
margin-top: 5px;
border-radius: 20px;
// width: 50px;
height: 20px;
2023-04-21 16:54:59 +08:00
background-color: #eff1f4;
2023-04-13 23:31:04 +08:00
padding: 5px 15px 5px 10px;
2023-04-21 16:54:59 +08:00
color: #879db2;
2023-04-13 23:31:04 +08:00
display: flex;
justify-content: space-between;
cursor: pointer;
.check {
width: 30px;
span {
line-height: 35px;
}
}
}
}
}
.footer {
display: flex;
flex-direction: row-reverse;
// margin-bottom: 20px;
button {
margin-right: 10px;
font-size: 18px;
border: none;
font-weight: 600;
background-color: #fff;
2023-04-21 16:54:59 +08:00
color: #557795;
2023-04-13 23:31:04 +08:00
padding: 10px 20px 10px 20px;
&:hover {
background-color: #0F426F;
border-radius: 5px;
color: #fff;
}
}
}
}
</style>