10.10综合交易所原始源码_移动端
1
admin
2026-01-06 03043192ddf00f9a36b7454799a9152cd1b50a0b
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<template>
  <div class="pb-fix">
    <div class="container-box">
      <header class="header flex" @click="router.back()">
        <div class="icon back">
          <van-icon name="arrow-left" size="20" />
        </div>
        <p class="title">{{ isAdd == 0 ? t('createDustom') : t('updateDustom') }}</p>
      </header>
      <div class="content-container">
        <div class="text-filed">
          <van-field class="flex-1 text-gray-100" v-model="optionListName" @input="onInput"
            :placeholder="$t('EnterName')" maxlength="24">
            <template #button>
              <span class="len">{{ optionListName.length }} / 24</span>
            </template>
          </van-field>
        </div>
        <div class="select-container">
          <van-cell is-link @click="router.push('/optional/selectSymbol')" :title="t('defaultCurrency')"
            :value="currency" />
        </div>
        <footer class="footer">
          <div class="footer-btn">
            <van-button type="primary" @click="itemUserOptionaAddList">{{ t('Finish') }}</van-button>
          </div>
        </footer>
      </div>
    </div>
  </div>
</template>
 
<script setup>
import { ref, onMounted, reactive } from "vue";
import { useRouter, useRoute } from "vue-router";
import { useI18n } from "vue-i18n";
import { _itemUserOptionaAddList, _itemUserOptionalUpdate } from '@/service/quotes.api'
import { useQuotesStore } from '@/store/quotes.store';
import { showSuccessToast, showToast } from 'vant';
const quotesStore = useQuotesStore()
const { t } = useI18n()
const router = useRouter()
const route = useRoute()
const optionListName = ref('')
const { href } = location
const isAdd = ref(0)
const info = ref({})
const currency = ref('')
onMounted(() => {
  currency.value = quotesStore.$state.currency
  if (route.query.info) {
    info.value = JSON.parse(route.query.info)
    isAdd.value = 1
    optionListName.value = info.value.listName
    if (!info.value.currency) {
      currency.value = quotesStore.$state.currency
    } else {
      currency.value = info.value.currency
    }
    console.log(info.value)
  }
})
 
const handleShowPopup = () => {
  showPopup.value = true;
};
//新增自选分组
const itemUserOptionaAddList = () => {
  if (!optionListName.value) {
    showToast(t('请输入自选名称'));
    return
  }
  if (!currency.value) {
    showToast(t('请选择币种'));
    return
  }
  let obj = {
    name: optionListName.value,
    currency: currency.value
  }
  if (isAdd.value == 0) {
    _itemUserOptionaAddList(obj).then((res) => {
      showSuccessToast(t('Savesuccessfully'))
      setTimeout(() => {
        router.go(-1)
      }, 1000)
    })
  } else {
    obj.uuid = info.value.listId
    _itemUserOptionalUpdate(obj).then((res) => {
      showSuccessToast(t('SuccessfullyModified'))
      setTimeout(() => {
        router.go(-1)
      }, 1000)
    })
  }
}
</script>
 
<style lang="scss" scoped>
:deep(.van-cell) {
  background-color: $input_background1;
}
 
:deep(.van-field__control) {
  color: $text_color;
  caret-color: $color_main;
}
 
:deep(.van-field__control::placeholder) {
  color: #747A8F;
}
 
:deep(.van-field__button) {
  color: #747A8F;
}
 
:deep(.van-cell.van-cell--clickable) {
  color: $text_color;
}
 
:deep(.van-cell__value) {
  color: $text_color;
}
 
:deep(.van-icon-arrow:before) {
  color: $text_color;
}
 
.container-box {
  .header {
    padding: 0 12px;
    align-items: center;
 
    .title {
      font-size: 16px;
      color: $text_color;
      text-align: center;
      flex: 1;
      transform: translate(-20px, 0px);
    }
 
    .icon {
      display: inline-block;
      width: 20px;
      height: 20px;
    }
  }
 
  .title-box {
    margin-top: 10px;
    padding: 0 12px;
    height: 32px;
    background: $selectSymbol_background;
    line-height: 32px;
    font-weight: 400;
    font-size: 12px;
    color: #747A8F;
  }
 
  .content-container {
    .text-filed {
      margin-top: 10px;
      border-bottom: 1px solid $input-border;
    }
 
    .select-container {
      border-bottom: 1px solid $input-border;
    }
 
    .footer {
      widows: 100%;
      margin-top: 30px;
      text-align: center;
 
      .footer-btn {
        margin: 0 auto;
        width: 90%;
 
        .van-button {
          width: 100%;
          border: none;
          background: linear-gradient(90deg, #2C64D4 0%, #38AEEA 100%);
        }
      }
    }
 
  }
 
}
</style>