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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
<template>
  <div class="w-full">
    <!-- 表头 -->
    <div
      class="table-header flex items-center justify-between w-full font-14"
      style="color: #78808e"
      :class="{ 'opacity-6': isSwitch }"
    >
      <div class="w200">{{ $t("message.c2c.chengduishang") }}</div>
      <div class="w140 flex items-center">
        <div>{{ $t("message.c2c.jiage") }}</div>
        <div
          class="p-2 ml-4 rounded-md"
          style="background: #eff7ff; color: #1a6ebd"
        >
          {{ $t("message.c2c.congdidaogao") }}
        </div>
      </div>
      <div class="w200">{{ $t("message.c2c.xianeshuliang") }}</div>
      <div class="w140">{{ $t("message.c2c.zhifufangshi") }}</div>
      <div class="w200 flex items-center">
        <div class="mr-4">{{ $t("message.c2c.jiaoyi") }}</div>
        <div class="p-2 rounded" style="color: #4ea372; background: #ebfef2">
          {{ $t("message.c2c.tip9") }}
        </div>
      </div>
    </div>
    <!-- 数据 -->
    <div class="main w-full">
      <div class="w-full mt-4" v-for="(item, index) in data" :key="index">
        <div class="tr w-full mb-30">
          <!-- 列表页 -->
          <div v-show="!item.trade">
            <div class="flex justify-between">
              <!-- 承兑商  -->
              <div class="w200 flex flex-col">
                <div class="flex items-center mb-4">
                  <span class="mr-4 font-16" style="color: #1a6ebd">{{
                    item.nick_name
                  }}</span>
                  <img
                    class="w-4 h-4"
                    src="@/assets/images/c2c/orderSuccess/Group1160.png"
                    alt=""
                  />
                </div>
                <div class="flex items-center font-14 text-black">
                  <div>
                    {{ item.thirty_days_order }}
                    {{ $t("message.c2c.chengjiaoliang") }}
                  </div>
                  <div class="w-1 h-8 mx-4 bg-f5"></div>
                  <div>
                    {{ item.thirty_days_order_ratio }}%
                    {{ $t("message.c2c.chengjiaolv") }}
                  </div>
                </div>
              </div>
              <!-- 价格  -->
              <div class="w140 flex flex-col">
                <p>
                  <span class="mr-4 font-20">{{ item.symbol_value }}</span>
                  <span>{{ fiatCurrency.currencySymbol }}</span>
                </p>
              </div>
              <!-- 限额/数量  -->
              <div
                class="w200 flex flex-col font-14 font-500"
                style="color: #78808e"
              >
                <p class="mb-4">
                  <span class="mr-4">{{ $t("message.c2c.shuliang") }}</span>
                  <span
                    >{{ item.coin_amount
                    }}{{ fiatCurrency.currencySymbol }}</span
                  >
                </p>
                <p>
                  <span class="mr-4">{{ $t("message.c2c.xiane") }}</span>
                  <span
                    >{{ fiatCurrency.currencySymbol
                    }}{{ item.investment_min }} -
                    {{ fiatCurrency.currencySymbol
                    }}{{ item.investment_max }}</span
                  >
                </p>
              </div>
              <!-- 支付方式 -->
              <div class="w140 font-14">
                <div
                  class="mr-18 font-600 text-underline text-black"
                  v-for="(_item, _index) in item.pay_type_name.split(',')"
                  :key="_index"
                >
                  {{ _item }}
                </div>
              </div>
              <!-- 买卖按钮 -->
              <div class="w200 flex flex-col">
                <el-button
                  v-show="type === 'buy'"
                  @click="handleClick(index, 0)"
                  class="ml-0 rounded-md"
                  style="background: #62c887"
                  :class="{ disabled: item.unable }"
                  :disabled="item.unable"
                  >{{ $t("message.c2c.goumai") }}{{ exchangeCurrency.symbol }}
                </el-button>
 
                <el-button
                  v-show="type === 'sell'"
                  @click="handleClick(index, 1)"
                  class="rounded-md"
                  style="margin-left: 0; background: #e05461"
                  :class="{ disabled: item.unable }"
                  :disabled="item.unable"
                  >{{ $t("message.c2c.chushou") }}
                </el-button>
              </div>
            </div>
          </div>
          <!-- 购买点击之后的页面 -->
          <div
            class="flex box-border pl-8 trade-item-wrapper h480"
            v-show="item.trade"
          >
            <!-- 左边 -->
            <div class="flex-1 h-full pt-8 font-14">
              <div class="flex items-center mb-23">
                <div class="flex items-center mr-26">
                  <span class="mr-8 font-16" style="color: #1a6ebd">{{
                    item.nick_name
                  }}</span>
                  <img
                    class="w-4 h-4"
                    src="@/assets/images/c2c/want-buy/Group1160.png"
                    alt=""
                  />
                </div>
                <div class="flex items-center font-14 text-black">
                  <div>
                    {{ item.thirty_days_order }}
                    {{ $t("message.c2c.chengjiaoliang") }}
                  </div>
                  <div class="w-1 h-8 mx-12 bg-f5"></div>
                  <div>
                    {{ item.thirty_days_order_ratio }}%
                    {{ $t("message.c2c.chengjiaolv") }}
                  </div>
                </div>
              </div>
              <!-- 价格那一列 -->
              <div class="flex mb-4">
                <p class="pay-title">
                  <span class="mr-4 color-788">{{
                    $t("message.hangqing.jiage")
                  }}</span>
                  <span class="font-500 text-black"
                    >{{ item.symbol_value }}
                    {{ fiatCurrency.currencySymbol }}</span
                  >
                </p>
                <p class="pay-title">
                  <span class="mr-4 color-788">{{
                    $t("message.c2c.shuliang")
                  }}</span>
                  <span class="font-500 text-black"
                    >{{ item.coin_amount
                    }}{{ fiatCurrency.currencySymbol }}</span
                  >
                </p>
              </div>
              <!-- 支付时效那一列 -->
              <div class="flex">
                <!-- 支付时效 -->
                <p class="pay-title">
                  <span class="mr-4 color-788">{{
                    $t("message.c2c.zhifushixiao")
                  }}</span>
                  <span class="font-500 text-black"
                    >{{ detail.expire_time
                    }}{{ $t("message.c2c.fenzhong") }}</span
                  >
                </p>
                <!-- 卖家收款方式 -->
                <p class="pay-title">
                  <span class="mr-4 color-788">{{
                    $t("message.c2c.tip147")
                  }}</span>
                  <span class="font-500 text-black text-underline">
                    <span
                      style="margin-right: 10px"
                      v-for="(_item, _index) in item.pay_type_name.split(',')"
                      :key="_index"
                      >{{ _item }}</span
                    >
                  </span>
                </p>
              </div>
              <!-- 交易条款-->
              <div class="mt-10 font-16 font-500 text-black">
                {{ $t("message.c2c.jiaoyitiaokuan") }}
              </div>
              <div class="mt-4 font-16 font-500 color-788">
                {{ $t("message.c2c.tip148") }}
              </div>
            </div>
            <!-- 右边 -->
            <div class="w480 h-full pt-4 px-4 input-item box-border">
              <!-- 我要支付 -->
              <input-item
                :isNumber="true"
                :type="type"
                :dataInfo="item"
                :exchangeCurrency="exchangeCurrency"
                :PaymentMethodInfo="item.selectPay"
                @getDetail="getDetail"
                :PaymentMethodList="item.payList"
                :fiatCurrency="fiatCurrency"
                v-show="type === 'buy'"
                @cancel="cancel(index)"
              />
              <input-item
                :isNumber="true"
                :type="type"
                :dataInfo="item"
                :exchangeCurrency="exchangeCurrency"
                :PaymentMethodInfo="item.selectPay"
                @getDetail="getDetail"
                :PaymentMethodList="item.payList"
                :fiatCurrency="fiatCurrency"
                v-show="type === 'sell'"
                @cancel="cancel(index)"
              >
              </input-item>
              <!-- 支付方式 -->
              <div class="mt-8">
                <div class="font-14 color-788">
                  {{ $t("message.c2c.zhifufangshi") }}
                </div>
                <div
                  class="relative w-full h-12 border-1px rounded font-14 font-600 text-black cursor-pointer"
                  @click="handleMouseOver"
                  @mouseleave="handleMouseOut"
                >
                  <!-- 如果 没有付款方式-->
                  <div
                    @click="openUrl('/c2c/user')"
                    v-if="!item.isPay"
                    class="flex justify-center items-center w-full h-full"
                  >
                    <span class="font-14 font-500 blue">{{
                      $t("message.c2c.shezhishoukuanfangshi")
                    }}</span>
                  </div>
                  <!--有付款方式-->
                  <div
                    v-else
                    class="flex justify-center items-center w-full h-full"
                    style="position: relative; z-index: 100"
                  >
                    <div class="flex items-center w-full h-full">
                      <div class="flex-1 flex items-center">
                        <div
                          class="flex justify-center items-center w-100 h-27 ml-9 mr-12 rounded"
                          style="background: #fafafa"
                        >
                          <div
                            class="w-px h-4 mr-6 rounded-lg"
                            style="background: #e6ba41"
                          ></div>
                          <div>{{ item.selectPay.methodName }}</div>
                        </div>
                        <div>{{ item.selectPay.realName }}</div>
                      </div>
                      <img
                        class="Subtract w-4 mr-4"
                        src="@/assets/images/c2c/want-buy/Subtract.png"
                        alt=""
                      />
                    </div>
                    <!-- 选择支付方式   -->
                    <transition name="el-fade-in-linear">
                      <otc-select
                        class="absolute left-0 top-22 w-full"
                        @click="handleMouseOver"
                        v-show="item.isShow"
                        @mouseleave="handleMouseOut"
                      >
                        <div>
                          <div class="px-9">
                            <div
                              class="flex items-center mb-15 py-4 border-b-1px"
                              @click.stop="handleSelectPay(item)"
                              v-for="(item, index) in item.payList"
                              :key="index"
                            >
                              <div
                                class="flex justify-center items-center w-100 h-27 mr-12 rounded"
                                style="background: #fafafa"
                              >
                                <div
                                  class="w-px h-4 mr-6 rounded-lg"
                                  style="background: #e6ba41"
                                ></div>
                                <div>{{ item.methodName }}</div>
                              </div>
                              <div>{{ item.realName }}</div>
                            </div>
                          </div>
                          <div
                            @click="openUrl('/c2c/user')"
                            class="flex items-center pl-8 py-4"
                          >
                            <img
                              class="w-4 h-4"
                              src="@/assets/images/c2c/want-buy/Vector(1).png"
                              alt=""
                            />
                            <span class="ml-4 font-14 font-400 text-black">{{
                              $t("message.user.tianjiashoukuanfangshi")
                            }}</span>
                          </div>
                        </div>
                      </otc-select>
                    </transition>
                  </div>
                </div>
              </div>
              <!-- </template> -->
            </div>
          </div>
        </div>
        <el-divider class="bg-f5" />
      </div>
    </div>
  </div>
</template>
 
<script>
import OtcSelect from "./OtcSelect.vue";
import InputItem from "./InputItem.vue";
import Axios from "@/api/c2c.js";
import { getParamsLang } from "@/utils/index";
 
export default {
  name: "WantBuyTabel",
  props: ["type", "list", "fiatCurrency", "payList", "exchangeCurrency"],
  data() {
    return {
      isSwitch: false, //在table下展开买卖详情
      showPayment: false,
      data: [], //承兑商列表
      dataInfo: {}, //选中了某一个承兑商
      PaymentMethodList: [],
 
      detail: {},
    };
  },
  watch: {
    list(val) {
      this.data = val.map((item) => {
        item = {
          ...item,
          isPay: false, //默认是没有支付方式的
          isShow: false,
          payList: [],
          selectPay: {},
        };
 
        return item;
      });
    },
  },
  methods: {
    getParamsLang,
    // 购买/出售 点击
    handleClick(index, val) {
      this.dataInfo = this.data[index]; //当前点击的承兑商数据
      this.data[index].trade = true;
      this.isSwitch = true;
      if (val == 0) {
        // 购买
        this.getPayList();
      } else {
        // 出售
        this.getMyPayList();
      }
    },
    getDetail(val) {
      this.detail = val;
    },
    cancel(index) {
      this.data[index].trade = false;
      this.isSwitch = false;
    },
    handleMouseOver() {
      this.dataInfo.isShow = true;
    },
    handleMouseOut() {
      this.dataInfo.isShow = false;
    },
    handleSelectPay(item) {
      this.dataInfo.selectPay = item;
      this.dataInfo.isShow = false;
    },
    // 获取当前承兑商的支付方式
    getPayList() {
      Axios.ctcPaymentMethodPayList({
        id: this.dataInfo.id,
        language: this.getParamsLang(),
      }).then((res) => {
        if (res.code == "0") {
          let payArry = this.dataInfo.pay_type_name.split(",");
          payArry.map((item) => {
            res.data.map((item1) => {
              if (item == item1.methodName) {
                //有配置对应支付方式
                this.dataInfo?.payList.push(item1);
              }
            });
          });
          console.log(
            "获取当前承兑商的支付方式",
            this.dataInfo,
            this.dataInfo.payList
          );
          if (this.dataInfo.payList.length > 0) {
            this.dataInfo.selectPay = this.dataInfo.payList[0];
            this.dataInfo.isPay = true;
          } else {
            this.dataInfo.isPay = false;
          }
        }
      });
    },
    getMyPayList() {
      let language = this.getParamsLang();
      this.PaymentMethodList = [];
      Axios.userC2cPaymentMethodList({ language, type: 2 }).then((res) => {
        if (res.code == "0") {
          let payArry = this.dataInfo.pay_type_name.split(",");
          payArry.map((item) => {
            res.data.map((item1) => {
              if (item == item1.methodName) {
                //有配置对应支付方式
                this.dataInfo.payList.push(item1);
              }
            });
          });
          if (this.dataInfo.payList.length > 0) {
            this.dataInfo.selectPay = this.dataInfo.payList[0];
            this.dataInfo.isPay = true;
          } else {
            this.dataInfo.isPay = false;
          }
        }
      });
    },
    openUrl(val) {
      this.$router.push(val);
    },
  },
  components: {
    OtcSelect,
    InputItem,
  },
};
</script>
 
<style lang="scss" scoped>
.w480 {
  width: 480px;
}
 
.w200 {
  width: 200px;
}
.w140 {
  width: 140px;
}
.h480 {
  height: 480px;
}
 
.top-22 {
  top: 50px;
}
.text-underline {
  text-decoration: underline;
}
 
.blue {
  color: #1a6ebd;
}
 
.border-1px {
  border: 1px solid #e9ebf1;
}
 
.border-b-1px {
  border-bottom: 1px solid #e9ebf1;
}
 
:deep {
  .el-button {
    width: 136px;
    border: none;
    padding: 9px 32px;
    font-weight: 600;
    font-size: 16px;
    color: #fff;
  }
 
  .el-divider {
    background: #f5f5f5;
  }
 
  .disabled {
    background: #eaecef !important;
    color: #b8bdc5;
  }
}
 
.trade-item-wrapper {
  background: #ffffff;
  box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.15);
}
 
.color-788 {
  color: #78808e;
}
 
.opacity-6 {
  opacity: 0.6;
}
 
.input-item {
  border-left: 1px solid #eaecef;
}
.pay-title {
  width: 300px;
}
</style>