jhzh
2025-04-03 db12897dc68c68d40c557aa59ad78022e2b30ac2
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
<template>
    <v-page class="layout-main">
      <v-header :title="$t('first.a6')"></v-header>
      <view class="d-flex border-b">
        <view class="d-flex rounded-lg justify-between w-max p-b-xs">
          <view
            @click="active = 0"
            class="p-y-xs p-x-lg fn-center w-50"
            >
                <text :class="{ 'color-theme-1 active p-b-xs': active == 0 }">{{$t('first.a7')}}</text>
            </view>
          <view
            @click="active = 1"
            class="p-y-xs p-x-lg fn-center w-50"
            >
                <text :class="{ 'color-theme-1 active p-b-xs': active == 1 }">{{$t('first.a8')}}</text>
          </view
          >
        </view>
      </view>
      <v-paging :ajax="getCurrentEntrust" :key="1" ref="list" tag="div" v-if="active==0">
        <template #box="list">
          <not-data v-if="!$list(list).length"></not-data>
          <div v-for="item in $list(list)" class="item bg-panel-4 m-md rounded-sm box-shadow" :key="item.order_no">
            <div class="head d-flex align-center border-b p-x-md p-y-xs justify-between">
              <div class="d-flex">
                <div v-if="item.entrust_type==1" class="suatus color-buy fn-20 m-r-xs rounded">{{$t('exchange.b5')}}</div>
                <div v-if="item.entrust_type==2" class="suatus color-sell fn-20 m-r-xs rounded">{{$t('exchange.b6')}}</div>
                <div>
                  <div class="color-light fn-20">{{item.symbol}}</div>
                  <div class="fn-10">{{item.created_at}}</div>
                </div>
              </div>
              <div class="d-flex">
                <span>{{item.status_text}}</span>
              </div>
            </div>
            <div class="p-x-md p-y-xs">
              <div class="row d-flex m-y-xs justify-between">
                <div class="label fn-sm">{{$t('exchange.b7')}}</div>
                <div class="color-light">{{item.entrust_price}}</div>
              </div>
              <div class="row d-flex m-y-xs justify-between">
                <div class="label fn-sm">{{$t('exchange.b8')}}</div>
                <div class="color-light">
                  <template v-if="item.type==1">{{$t('exchange.b9')}}</template>
                  <template v-if="item.type==2">{{$t('exchange.c0')}}</template>
                </div>
              </div>
              <div class="row d-flex m-y-xs justify-between">
                <div class="label fn-sm">{{$t('exchange.c1')}}</div>
                <div class="color-buy">{{item.traded_amount}}</div>
              </div>
              <div class="row d-flex m-y-xs justify-between">
                <div class="label fn-sm">{{$t('exchange.c2')}}</div>
                <div class="color-light">{{item.amount}}</div>
              </div>
              <div class="row d-flex m-y-xs justify-between">
                <div class="label fn-sm">{{$t('exchange.g3')}}</div>
                <div class="color-light">
                  <v-button type="red" class="rounded-xs" size="mini" @click="ifCancel(item)">{{$t('exchange.g4')}}</v-button>
                </div>
              </div>
            </div>
          </div>
        </template>
      </v-paging>
      
      <v-paging class="layout-main" :key="2" :ajax="getHistoryEntrust" v-if="active==1">
          <template #box="list">
            <not-data v-if="!$list(list).length"></not-data>
            <div v-for="item in $list(list)" class="item bg-panel-4 m-md rounded-sm box-shadow" :key="item.order_no">
              <div class="head d-flex align-center border-b p-x-md p-y-xs justify-between">
                <div class="d-flex">
                  <div v-if="item.entrust_type==1" class="suatus color-buy fn-20 m-r-xs rounded">{{$t('exchange.b5')}}</div>
                  <div v-if="item.entrust_type==2" class="suatus color-sell fn-20 m-r-xs rounded">{{$t('exchange.b6')}}</div>
                  <div>
                    <div class="color-light fn-20">{{item.symbol}}</div>
                    <div class="fn-10">{{item.created_at}}</div>
                  </div>
                </div>
                <div>{{item.status_text}}</div>
              </div>
              <div class="p-x-md p-y-xs">
                <div class="row d-flex m-y-xs justify-between">
                  <div class="label fn-sm">{{$t('exchange.b7')}}</div>
                  <div class="color-light">{{item.entrust_price}}</div>
                </div>
                <div class="row d-flex m-y-xs justify-between">
                  <div class="label fn-sm">{{$t('exchange.b8')}}</div>
                  <div class="color-light">
                    <template v-if="item.type==1">{{$t('exchange.b9')}}</template>
                    <template v-if="item.type==2">{{$t('exchange.c0')}}</template>
                  </div>
                </div>
                <div class="row d-flex m-y-xs justify-between">
                  <div class="label fn-sm">{{$t('exchange.c1')}}</div>
                  <div class="color-buy">{{item.traded_amount}}</div>
                </div>
                <div class="row d-flex m-y-xs justify-between">
                  <div class="label fn-sm">{{$t('exchange.e2')}}</div>
                  <div class="color-light">{{item.avg_price}}</div>
                </div>
            
                <div class="row d-flex m-y-xs justify-between">
                  <div class="label fn-sm">{{$t('exchange.c2')}}</div>
                  <div class="color-light">{{item.amount}}</div>
                </div>
              </div>
            </div>
          </template>
        </v-paging>
    </v-page>
</template>
<script>
import Order from "@/api/order";
import math from '@/utils/class/math'
export default {
    data(){
        return {
            active: 0,
            getHistoryEntrust: Order.getHistoryEntrust,
            getCurrentEntrust: Order.getCurrentEntrust,
        }
    },
    methods:{
      division:math.division,
      ifCancel(item) {
        this.$dialog
          .confirm({
            title: this.$t('common.tips'),
            message: this.$t('exchange.g5')+'?',
            confirmButtonText:  this.$t("common.confirm"),
            cancelButtonText: this.$t("common.cancel")
          })
          .then(() => {
            this.cancelEntrust(item);
          })
          .catch(() => {});
      },
      // 撤销委托
      cancelEntrust(item) {
        let data = {
          entrust_id: item.id,
          entrust_type: item.entrust_type,
          symbol: item.symbol,
        };
        Order.cancelEntrust(data).then(() => {
          this.$toast.success(this.$t('exchange.g6'));
          this.$refs.list.list.forEach((ele, idx) => {
            if (item.id == ele.id) {
              this.$refs.list.list.splice(idx, 1);
            }
          });
        });
      },
    }
}
</script>
<style lang="scss" scoped>
    .active{
        position: relative;
        // border-bottom: 1px solid $theme-1;
    }
    .active:after{
        position: absolute;
        content: "";
        width: 30%;
        height: 2px;
        background-color: $theme-1;
        bottom: 0;
        left: 35%;
    }
    .w-50{
        width: 50%;
    }
</style>