zj
2024-06-03 561ca040085b6fd6766e471a70b4a3c682deadc2
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
<template>
  <div class="order-data">
    <div class="flex items-center font-31 mb-42 c2cColor">
      <span class="title" :style="{ 'color': detail.direction === 'buy' ? '#2EBD85' : '#E35461' }">
        {{ detail.direction === 'buy' ? $t('购买') : $t('卖出') }}
      </span>
      <span class="mx-15">{{ detail.symbol && detail.symbol.toUpperCase() }}</span>
      <img class="w-36 h-36" src="~@/assets/image/c2c/U1.png" alt="">
    </div>
    <van-cell-group>
      <van-cell :title="$t('总额')">
        <template #default>
          <h2 class="font-700 font-36">{{ currencySymbol }} {{ detail.amount }}</h2>
        </template>
      </van-cell>
      <van-cell :title="$t('单价')">
        <template #default>
          <span>{{ currencySymbol }} </span>
          <span>{{ detail.symbolValue }}</span>
        </template>
      </van-cell>
      <van-cell :title="$t('数量')"
        :value="`${detail.symbol == 'usdt' ? Math.floor(detail.coinAmount * 100) / 100 : Math.floor(detail.coinAmount * 1000000) / 1000000} ${detail.symbol && detail.symbol.toUpperCase()}`" />
      <slot name="default"></slot>
      <van-cell class="order-number">
        <template slot="title">
          <div class="w-100">{{ $t('订单号') }}</div>
        </template>
        <template>
          <div class="flex justify-end">
            <span class="mr-14">{{ detail.orderNo }}</span>
            <img class="relative top-4 w-30 h-34" src="~@/assets/image/c2c/Group1168.png" alt=""
              @click="copy(detail.orderNo)">
          </div>
        </template>
      </van-cell>
      <van-cell v-if="detail.createTime" :title="$t('创建时间')" :value="detail.createTime | format" />
      <van-cell v-if="detail.sellerName">
        <template #title>
          <span>{{ clientType }}</span>
        </template>
        <template #default>
          <span class="mr-20">{{ sellerName }}</span>
          <van-icon class="font-700 text-grey" name="arrow" />
        </template>
      </van-cell>
    </van-cell-group>
  </div>
</template>
 
<script>
import {
  mapState,
  mapGetters
} from "vuex";
import { Cell, CellGroup, Icon, Toast } from "vant"
 
export default {
  name: "OrderDate",
  // props: ['count', 'totalPrice', 'orderNumber', 'sellerName', 'createOrderTime'],
  props: {
    clientType: {
      default: '卖家昵称'
    },
    detail: {
      type: Object,
      default() {
        return {}
      }
    },
    // // count: {},
    // totalPrice: {},
    // // orderNumber: {},
    // sellerName: {},
    // createOrderTime: {},
    // unitPrice: {
    //   // required: true,
    // }
  },
  filters: {
    format(time) {
      const _time = new Date(time)
      return [_time.getFullYear(), _time.getMonth() + 1, _time.getDate()].join('/') + ' ' + [_time.getHours(), _time.getMinutes(), _time.getSeconds()].join(":")
    }
  },
  methods: {
    copy(text) {
      this.$copyText(text).then(() => {
        Toast(this.$t('复制成功'))
      })
    }
  },
  computed: {
    ...mapState('home', ['currency']),
    ...mapGetters('c2c', ['currencySymbol'])
  },
  components: {
    [Cell.name]: Cell,
    [CellGroup.name]: CellGroup,
    [Icon.name]: Icon,
  }
}
</script>
 
<style lang="scss" scoped>
::v-deep .van-cell {
  margin-bottom: 46px;
}
 
::v-deep .order-number {
  .van-cell__title {
    flex: inherit;
  }
}
 
.order-data {
 
  ::v-deep .van-cell-group,
  .van-cell {
    margin-bottom: 46px;
 
    @include themify() {
      color: themed("text_color");
    }
 
    @include themify() {
      background: themed("main_background");
    }
  }
 
  ::v-deep .van-cell__value {
    @include themify() {
      color: themed("text_color");
    }
  }
}
</style>