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
<template>
  <div class="pb-12 main recharge-withdraw-page">
    <!-- 头部  -->
    <div class="main-title">
      <div class="title-center">
        <!--  生成订单  -->
        <div class="title-left">
          <div class="title flex">
            <svg
              xmlns="http://www.w3.org/2000/svg"
              viewBox="0 0 24 24"
              fill="none"
              class="css-146agw4"
              @click="gotoPrePage"
              width="24"
            >
              <path
                fill-rule="evenodd"
                clip-rule="evenodd"
                d="M11.934 12l3.89 3.89-1.769 1.767L8.398 12l1.768-1.768 3.89-3.889 1.767 1.768-3.889 3.89z"
                fill="currentColor"
              ></path>
            </svg>
            {{ $t("message.user.dingdanyishengcheng") }}
          </div>
          <div class="text mt-2 flex ordering">
            {{ $t("message.user.pleaseAt") }}
            <span class="time">
              <span class="bg-time">{{ hour.substring(0, 1) }}</span>
              <span class="bg-time">{{ hour.substring(1, 2) }}</span>
              <span style="margin: 0 2.5px">:</span>
              <span class="bg-time">{{ minute }}</span>
              <span class="bg-time">{{ secound }}</span>
            </span>
            {{ $t("message.user.paymentSeller")
            }}{{ $t("message.user.maijia") }}
          </div>
        </div>
        <!--  订单号  -->
        <div class="title-right">
          <div class="order-c" style="margin-bottom: 15px">
            <span style="color: #727a89">{{
              $t("message.c2c.dingdanhao")
            }}</span>
            <span style="margin: 0 10px">{{ detailInfo?.orderNo }}</span>
            <img
              @click="handleCopy(detailInfo?.orderNo)"
              src="@/assets/images/c2c/orderSuccess/Group1884.png"
              style="width: 15px; height: 15px"
            />
          </div>
          <div class="order-c">
            <span style="color: #727a89">{{
              $t("message.c2c.chuangjianshijian")
            }}</span>
            <span style="margin: 0 10px">{{
              formatTime(detailInfo.createTime)
            }}</span>
          </div>
        </div>
      </div>
    </div>
    <!-- 中间部分 -->
    <div class="main-center justify-between">
      <div class="main-left">
        <!-- 在线客服 -->
        <div class="bg-gray-100 p-4 mt-5" @click="onRoute">
          <div class="flex">
            <img src="@/assets/images/wallet/chatBlue.svg" />
            <span class="mr-2 ml-2">{{ $t("message.home.dibu18") }}</span>
            <img class="gold" src="@/assets/images/wallet/gold.svg" />
            <img class="gold" src="@/assets/images/wallet/arrow-right.svg" />
          </div>
          <div class="flex step mt-5">
            <img
              class="success mr-1"
              src="@/assets/images/wallet/success.svg"
            />
 
            <!-- {{ $t("message.user.maijia") }}
            {{ detailInfo.currency }} -->
            {{ $t("message.user.Payconfidence") }}
          </div>
          <div class="flex mt-5">
            <div class="flex step flex-1">
              <img class="mr-2" src="@/assets/images/wallet/success.svg" />
              {{ $t("message.user.customerSupport") }}
            </div>
            <div class="pr-2">
              <el-icon :size="16" color="#9399A4"><ArrowRight /></el-icon>
            </div>
          </div>
        </div>
 
        <!-- 步骤条 -->
        <div class="main-main">
          <img
            src="@/assets/images/c2c/orderSuccess/line.png"
            class="left-line"
          />
          <div class="main-info">
            <!-- 购买usd -->
            <p class="font-semibold mb-4">
              {{ $t("message.user.goumai") }}USDT
            </p>
            <!-- 总额          :style="{ color: isBuy ? '#4ea372' : '#BD3F4D' }"-->
            <div class="total">
              <div class="t-box">
                <p class="label">
                  {{ $t("message.c2c.zongjia") }}
                </p>
                <p class="price" style="color: '#4ea372'">
                  {{ detailInfo.amount }}
                </p>
              </div>
              <!-- 银行名称 -->
              <div class="t-box">
                <p class="label">
                  {{ $t("message.user.yinhangmingcheng") }}
                </p>
                <p class="price">{{ detailInfo?.paramValue1 }}</p>
              </div>
              <!-- 账户地址 -->
              <div class="t-box">
                <p class="label">
                  {{ $t("message.user.zhanghudizhi") }}
                </p>
                <p class="price">{{ detailInfo.paramValue3 }}</p>
              </div>
            </div>
 
            <!-- 交易方式 -->
            <p class="font-semibold mb-4 mt-24">
              {{ $t("message.user.payType") }}
            </p>
            <div class="total">
              <div class="t-box">
                <p class="label">
                  {{ $t("message.user.leixing") }}
                </p>
                <p class="price">{{ $t("message.user.yinhangka") }}</p>
              </div>
            </div>
 
            <!-- 付款完成清联系客服 -->
            <p class="font-semibold mb-4 mt-24">
              {{ $t("message.user.fukuanwancheng") }}
            </p>
          </div>
        </div>
        <!-- 去付款 -->
        <div>
          <el-button type="primary" @click="handleGotoPay">{{
            $t("message.user.toPay")
          }}</el-button>
          <!-- <el-button text class="blue-color" @click="handleCancelOrder">取消订单</el-button> -->
        </div>
      </div>
      <!--右边聊天窗 -->
      <div>
        <div class="service" v-if="!chatShow">
          <img src="@/assets/images/wallet/chat.svg" />
          <div class="text-white ml-2 cursor-pointer" @click="handleShowChat">
            {{ $t("message.user.lianxikefu") }}
          </div>
        </div>
        <RightChat :detailInfo="detailInfo" v-else />
      </div>
    </div>
  </div>
</template>
 
<script>
/* eslint-disable */
import { mapState } from "pinia";
import dayjs from "dayjs";
import Axios from "@/api/c2c.js";
import RightChat from "../components/rightChat.vue";
import { ArrowRight } from "@element-plus/icons-vue";
import { useUserStore } from "@/store/user";
 
export default {
  name: "orderSuccess",
  components: { RightChat,ArrowRight },
  data() {
    return {
      detailInfo: {},
      interval: null,
      minute: "",
      hour: "",
      secound: "",
      time: 0,
      message: "",
      timer: null,
      isTime: true,
      chatShow: false,
    };
  },
  watch: {
    "$route.query.id"() {},
  },
  computed: {
    ...mapState(useUserStore, ["existToken"]),
  },
  created() {
    this.getC2cOrderDetail();
  },
  methods: {
    handleShowChat() {
      this.chatShow = !this.chatShow;
    },
    handleGotoPay() {
      this.chatShow = true;
    },
    formatTime(time) {
      return dayjs(time).format("YY-MM-DD HH:mm:ss");
    },
    gotoPrePage() {
      this.$router.go(-1);
    },
 
    // handleCancelOrder(){
    //   if (this.time >= 0) {
    //     this.$router.push({ path: '/cryptos/cancelOrder' })
    //   } else {
    //     this.$message.error(this.$t('订单不能取消'))
    //     // Notify({ type: 'warning', message: this.$t('订单不能取消') })
    //   }
    // },
 
    //获取订单详情
    getC2cOrderDetail() {
      Axios.c2cOrderGetDetail({
        order_no: this.$route.query.id,
      }).then((res) => {
        if (res.code == "0") {
          this.detailInfo = res.data;
 
          this.time = parseInt(this.detailInfo.autoCancelTimeRemain);
          if (this.isTime) {
            this.countTime();
          }
 
          // this.fetchChatList();
        }
      });
    },
 
    //复制
    handleCopy(context) {
      navigator.clipboard.writeText(context).then(() => {
        this.$message.success(this.$t("message.user.fuzhichenggong"));
      });
    },
    //倒计时 时分秒
    countTime() {
      if (this.detailInfo.autoCancelTimeRemain == 0) {
        this.hour = "00";
        this.minute = "0";
        this.secound = "0";
        return;
      }
      this.isTime = false;
      // 用户输入任意秒数, 函数计算该毫秒数对应的时分秒, 并返回
      let _this = this;
      function getTime(time) {
        // 转换为式分秒
        let h = parseInt((time / 60 / 60) % 24);
        h = h < 10 ? "0" + h : h;
        let m = parseInt((time / 60) % 60);
        m = m < 10 ? "0" + m : m;
        let s = parseInt(time % 60);
        s = s < 10 ? "0" + s : s;
        _this.hour = h;
        _this.minute = m;
        _this.secound = s;
        // 作为返回值返回
        // return [h, m, s]
      }
      // 传入用户输入的数据
      this.interval = setInterval(() => {
        if (this.time <= 0) {
          clearInterval(this.interval);
          this.interval = null;
          this.hour = "0";
          this.minute = "0";
          this.secound = "0";
        }
        getTime(this.time);
        this.time--;
      }, 1000);
    },
  },
  unmounted() {
    if(this.interval){
      clearInterval(this.interval);
      this.interval = null;
    }
  },
};
</script>
 
<style lang="scss">
@import "@/assets/css/wallet/chat.scss";
.service {
  margin-top: 24px;
  padding: 10px;
  display: flex;
  background: #2555f8;
  border-radius: 40px 0 0 40px;
}
</style>