zj
2024-06-03 89d48809779ae41f8712539584798d5900b64b78
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
<template>
  <div>
    <div class="table transaction-table">
      <el-table
        stripe
        v-loading="loading"
        :data="list.list"
        height="250"
        style="width: 100%">
        <el-table-column
          width="180px"
          prop="stockName"
          label="股票名">
          <template slot-scope="scope">
            <p class="name">
              <span>{{scope.row.stockName}}/{{scope.row.stockCode}}</span>
            </p>
          </template>
        </el-table-column>
        <el-table-column
          prop="profitAndLose"
          label="浮动盈亏">
          <template slot-scope="scope">
            <p class="bounceIn">
              <span :class="scope.row.profitAndLose<0?'green':'red'">{{scope.row.profitAndLose}}</span>
            </p>
          </template>
        </el-table-column>
        <el-table-column
          prop="allProfitAndLose"
          label="总盈亏">
          <template slot-scope="scope">
            <p class="bounceIn">
              <span :class="scope.row.allProfitAndLose<0?'green':'red'">{{scope.row.allProfitAndLose}}</span>
            </p>
          </template>
        </el-table-column>
        <el-table-column
          prop="buyOrderPrice"
          label="买入价">
        </el-table-column>
        <el-table-column
          prop="sellOrderPrice"
          label="卖价">
        </el-table-column>
        <el-table-column
          width="110px"
          prop="orderNum"
          label="数量">
        </el-table-column>
        <el-table-column
          prop="orderDirection"
          label="方向">
          <template slot-scope="scope">
            <p>
              {{scope.row.orderDirection}}
              <i v-if="scope.row.orderDirection === '买涨'" class="red iconfont icon-up"></i>
              <i v-if="scope.row.orderDirection  === '买跌'" class="green iconfont icon-down"></i>
            </p>
          </template>
        </el-table-column>
        <!-- <el-table-column
         width="120px"
         prop="orderTotalPrice"
         label="总市值">
       </el-table-column> -->
      </el-table>
      <!-- <div class="page-box">
        <el-pagination
        class="pull-right"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="list.pageNum"
            :page-sizes="[10, 20, 30, 40,50]"
            :page-size="list.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="list.total">
          </el-pagination>
      </div> -->
 
    </div>
  </div>
 
</template>
 
<script>
  import * as api from '../../../axios/api'
 
  export default {
    components: {},
    props: {
      hasChangeSell: {
        type: Number,
        default: function () {
          return 0
        }
      }
    },
    data () {
      return {
        loading: false,
        pageNum: 1,
        pageSize: 10,
        currentNum: 0,
        list: {
          list: []
        },
        detail: null // 详情数据
      }
    },
    watch: {
      haslogin (newval, oldVal) {
        if (newval !== oldVal) {
          this.getList()
        }
      },
      hasChangeSell (newval, oldVal) {
        if (newval) {
          this.list = []
          this.getList()
        }
      },
      deep: true
    },
    computed: {
      haslogin () {
        return this.$store.state.haslogin
      }
    },
    created () {},
    mounted () {
      if (this.$store.state.haslogin) {
        this.getList()
      }
    },
    methods: {
      handleSizeChange (val) {
        this.form.pageSize = val
        this.getList()
        console.log(`每页 ${val} 条`)
      },
      handleCurrentChange (val) {
        this.form.pageNum = val
        console.log(`当前页: ${val}`)
        this.getList()
      },
      onSubmit () {
        // 查询表格
        this.getList()
      },
      async getList () {
        // 获取表格数据
        let opts = {
          state: 1,
          stockCode: '', // 代码
          stockSpell: '', // 简拼
          pageNum: this.pageNum,
          pageSize: this.pageSize
        }
        this.loading = true
        let data = await api.getOrderList(opts)
        this.loading = false
        if (data.status === 0) {
          this.list = data.data
        } else {
          this.$message.error(data.msg)
        }
      }
    }
  }
</script>