dcc
2024-06-13 3616db170333df7d668c97323344335b52c4153c
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
<template>
  <div class="nowSharesInventory">
    <sharesHeader
      :value1="headerList.availableLimit"
      :value2="headerList.inventoryGainsLosses"
      :value3="headerList.marketValue"
    />
    <div class="nowSharesInventory-box">
      <div class="nowSharesInventory-box-content" v-for="(item, index) in tableData" :key="index">
        <div class="nowSharesInventory-box-content-text flex-justify-align-center">
          <div class="flex-column-center align-center">
            <p class="text-white">{{ item.symbolName }}</p>
            <p>{{ item.symbolCode }}</p>
          </div>
          <!-- <div>
                <p class="text-white">{{item.createTime}}</p>
            </div> -->
        </div>
        <div class="nowSharesInventory-box-content-text" v-for="(val, key, i) in listValue" :key="i">
          <div>
            <p>{{ t(`message.user.${val}`) }}</p>
          </div>
          <div :class="i === 0 || i === 1 ? setColor(item[key]) : ''">
            <p>{{ i === 1 ? `${item[key]}%` : item[key] }}</p>
          </div>
        </div>
        <button class="nowSharesInventory-box-content-button" v-click="() => sellButton(item)">
          {{ t(`message.user.mai10`) }}
        </button>
      </div>
    </div>
    <pagination
      :total="total"
      v-model:page="pagination.current"
      v-model:limit="pagination.size"
      @pagination="getList"
    />
  </div>
</template>
 
<script setup>
import sharesHeader from "./components/sharesHeader.vue";
import Pagination from "@/components/Pagination/index.vue";
import Axios from "@/api/newShares";
import { useI18n } from "vue-i18n";
import { ElMessage } from "element-plus";
 
const { t } = useI18n();
const headerList = ref({});
 
onMounted(() => {
  getDataList();
 
  Axios.getNewSharesHeaderMessage({ type: 3 }).then((res) => {
    if (res.code === 0) {
      headerList.value = res.data;
    }
  });
});
 
const setColor = computed(() => {
  return function (val) {
    if (val > 0) {
      return "isRed";
    }
    if (val < 0) {
      return "isGreen";
    }
  };
});
 
const tableData = ref([]);
const total = ref(0);
const pagination = ref({
  current: 1,
  size: 10,
});
const getDataList = () => {
  Axios.getNewSharesOrderList({ type: 3, ...pagination.value }).then((res) => {
    if (res.code === 0) {
      tableData.value = res.data;
      total.value = res.total;
    }
  });
};
 
const listValue = {
  inventoryGainsLosses: "kucunshunyi",
  inventoryGainsLossesValue: "shunyibaifenbi",
  subNumber: "jiaoyigushi",
  marketValue: "kucunshizhi",
  subPrice: "mairu10",
  closePrice: "xianjia10",
};
 
const getList = (val) => {
  getDataList();
};
 
const resetPagination = () => {
  pagination.value.current = 1;
  pagination.value.size = 10;
};
 
const sellButton = (data) => {
  Axios.getNewSharesOrderList({ orderNo: data.orderNo }).then((res) => {
    if (res.code === 0) {
      ElMessage({
        message: t(`message.user.maichuchenggong`),
        type: "success",
      });
      resetPagination();
      getDataList();
    }
  });
};
</script>
 
<style lang="scss" scoped>
.nowSharesInventory {
  .nowSharesInventory-box {
    min-height: 500px;
    margin-top: 40px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .nowSharesInventory-box-content {
      width: 384px;
      height: 360px;
      padding: 18px 17px 28px 15px;
      background: #1d2336;
      border-radius: 15px;
      // margin-right: 24px;
      margin-bottom: 29px;
      color: #b7bdd1;
      font-size: 14px;
      &:nth-last-of-type(1) {
        margin-right: 0;
      }
      .nowSharesInventory-box-content-text {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
        &:nth-last-of-type(1) {
          margin-bottom: 30px;
        }
      }
      .isGreen {
        color: #05cda5;
      }
      .isRed {
        color: #f33368;
      }
      .nowSharesInventory-box-content-button {
        width: 100%;
        height: 42px;
        background: #f43368;
        color: #fff;
        border-radius: 5px;
      }
    }
  }
}
</style>