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
| <template>
| <div class="ware">
| <div style="padding: 0 0.4rem 0.4rem">
| <div class="tabs-box" onscroll="handleScroll">
| <div
| v-for="(item, index) in tabsArr"
| :key="index"
| :class="
| item.name == active ? 'tabs-item-active tabs-item' : 'tabs-item'
| "
| @click="onClick(item)"
| >
| {{ item.title }}
| </div>
| </div>
|
| <template v-if="active === '1'">
| <div v-for="(item, index) in tabsArr" :key="index">
| <card :item="item" />
| </div>
| </template>
| <template v-else>
| <itemCard :activeObj="activeObj" :itemClick="itemClick" />
| </template>
| <div v-show="active !== '1'">
| <dataList ref="dataListref" :activeObj="activeObj" />
| </div>
| </div>
| </div>
| </template>
|
| <script>
| import card from "./Warehouse/card.vue";
| import itemCard from "./Warehouse/item.card.vue";
| import dataList from "./Warehouse/data.list.vue";
| import { getMoney } from "../../axios/api";
|
| export default {
| components: { card, itemCard, dataList },
| data() {
| return {
| actives: "1",
| active: "1",
| activeObj: {},
| tabsArr: [
| {
| title: this.$t("hometips"),
| name: "1",
| bgc: "rgb(8, 82, 196)",
| laber: "ALL",
| symbolCode: "USD",
| symbol: "$",
| },
| {
| title: this.$t("mggs"),
| name: "2",
| bgc: "rgb(12, 175, 226)",
| laber: "US",
| symbolCode: "USD",
| symbol: "$",
| },
| {
| title: this.$t("ydgs"),
| name: "3",
| bgc: "rgb(255, 91, 150)",
| laber: "IN",
| symbolCode: "USD",
| symbol: "$",
| },
| {
| title: this.$t("马来西亚"),
| name: "4",
| bgc: "rgb(163, 91, 255)",
| laber: "MAS",
| symbolCode: "MYR",
| symbol: "RM",
| },
| ],
| getMoneyList: [],
| };
| },
| created() {
| this.getMoneys();
| },
| methods: {
| itemClick() {
| this.$refs.dataListref.getList(this.activeObj.laber);
| },
| async getMoneys() {
| const res = await getMoney();
| if (res.status === 0) {
| let arr = [];
| this.tabsArr.map((item) => {
| res.data.map((items) => {
| if (items.accectType === item.laber) {
| item = { ...item, ...items, laber: items.accectType };
| arr.push(item);
| }
| });
| });
| this.tabsArr = arr;
| this.$forceUpdate(); // 强制Vue重新渲染
| }
| },
| onClick(e) {
| this.active = e.name;
| this.activeObj = e;
| this.getMoneys();
| if (e.name !== "1") {
| this.$refs.dataListref.getList(e.laber);
| }
|
| // console.log(e);
| },
| },
| };
| </script>
|
| <style lang="less" scoped>
| .ware {
| overflow: hidden;
| min-height: 100vh;
| // padding: 0 0.4rem 0.4rem;
| background-color: #fff;
| padding-bottom: 100px;
| }
| .tabs-box {
| display: flex;
| overflow-x: auto;
| width: 100%; /* Ensures it takes full width of the container */
| white-space: nowrap; /* Prevents text wrapping */
| background: rgb(247, 247, 250);
| margin-top: 20px;
| border-radius: 20px;
| padding-right: 20px;
| }
| .tabs-box::-webkit-scrollbar {
| display: none; /* Chrome, Safari, Opera */
| }
| .tabs-item {
| cursor: pointer;
| flex: 0 0 auto; /* Ensures items do not grow or shrink */
| padding: 15px; /* Adjust padding as needed */
| // border: 1px solid #ccc; /* Just for demonstration, you can style as needed */
| margin-right: 10px; /* Adjust margin as needed */
| min-width: 100px; /* Minimum width for each item */
| text-align: center;
| color: rgb(140, 159, 173);
| font-size: 16px;
| // padding: 0.10667rem 0.34667rem;
| }
| .tabs-item-active {
| border-radius: 20px;
| background: #39a08e;
| // padding: 0.10667rem 0.34667rem;
| color: #fff;
| }
| </style>
|
|