<template>
|
<ContentView :paddingH="false" class="expect-position-view">
|
<PositionSelectView v-model="positionList" />
|
</ContentView>
|
<PageFooter>
|
<div class="expect-position-page-footer">
|
<div class="expect-position-select-wrapper" v-if="checkdList.length > 0">
|
<div class="expect-position-select-item" v-for="(item, index) in checkdList" :key="index">
|
<div class="expect-position-select-item-text">{{ item.name }}</div>
|
<div class="expect-position-select-item-icon-wrapper">
|
<Close
|
:size="8"
|
class="expect-position-select-item-icon"
|
@click="handleDelete(item.id)"
|
/>
|
</div>
|
</div>
|
</div>
|
<PageFooterBtn type="primary" @click="handleConfirm">保存</PageFooterBtn>
|
</div>
|
</PageFooter>
|
</template>
|
|
<script setup lang="ts">
|
import { PositionSelectView } from '@12333/components';
|
import { SearchType } from '@12333/constants';
|
import { useSearchSettingType } from '@12333/hooks';
|
import { Close } from '@nutui/icons-vue-taro';
|
import Taro from '@tarojs/taro';
|
import { size } from 'lodash';
|
import { useEvent, useEventChannel } from 'senin-mini/hooks';
|
|
defineOptions({
|
name: 'InnerPage',
|
});
|
|
const eventChannel = useEventChannel();
|
|
useEvent('updatePosition', function (data: { content: string[] }) {
|
if (data.content.length) {
|
positionList.value = [...data.content];
|
}
|
});
|
|
const positionList = ref([]);
|
|
const { searchSettingTypeList: position } = useSearchSettingType({
|
searchType: SearchType.Position,
|
});
|
|
const checkdList = computed(() => {
|
if (!positionList.value.length) return [];
|
return position.value.filter((x) => positionList.value.includes(x.id));
|
});
|
|
function handleDelete(id: string) {
|
positionList.value = positionList.value.filter((x) => x !== id);
|
}
|
|
function handleConfirm() {
|
eventChannel.emit('addPosition', {
|
content: positionList.value,
|
});
|
Taro.navigateBack({ delta: 1 });
|
}
|
</script>
|
|
<style lang="scss">
|
@import '@/styles/common.scss';
|
|
.expectPosition-page-wrapper {
|
.expect-position-view {
|
flex: 1;
|
min-height: 0;
|
|
.nut-category {
|
height: 100%;
|
}
|
}
|
|
.expect-position-page-footer {
|
width: 100%;
|
padding: 0 boleGetCssVar('size', 'body-padding-h');
|
|
.page-footer-btn {
|
margin: 0;
|
width: 100%;
|
}
|
|
.expect-position-select-wrapper {
|
display: flex;
|
flex-wrap: wrap;
|
margin-bottom: 40px;
|
column-gap: 16px;
|
row-gap: 24px;
|
padding-top: 24px;
|
|
.expect-position-select-item {
|
display: flex;
|
align-items: center;
|
padding: 0 28px;
|
height: 64px;
|
border-radius: 32px;
|
background-color: #f6faff;
|
|
.expect-position-select-item-text {
|
font-weight: 400;
|
font-size: 24px;
|
color: #536077;
|
line-height: 24px;
|
}
|
|
.expect-position-select-item-icon-wrapper {
|
padding: 8px;
|
padding-right: 0;
|
padding-left: 30px;
|
display: flex;
|
align-items: center;
|
}
|
|
.expect-position-select-item-icon {
|
color: boleGetCssVar('text-color', 'secondary');
|
}
|
}
|
}
|
}
|
}
|
</style>
|