wupengfei
2025-03-21 1bbd7061dac79cacf5513234a04cac8ba0be5c6f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<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>