Commit bad8ce4a authored by verestrasz's avatar verestrasz

Merge branch 'dev' of https://gitlab.33.cn/yimu/h5-front into dev

parents 610c1e16 f7b67171
......@@ -126,4 +126,23 @@ export const AssetsRecordTypeObj = {
export const TransferType = {
SINGLE: 1,
PACKAGE: 2
}
export const AssetsRecordStatus = {
FAIL: 1,
SUCCESS: 2,
CONFIRM: 3
}
export const AssetsRecordStatusObj = {
[AssetsRecordStatus.FAIL]: {
label: "失败",
},
[AssetsRecordStatus.SUCCESS]: {
label: "成功",
},
[AssetsRecordStatus.CONFIRM]: {
label: "确认中",
},
}
\ No newline at end of file
......@@ -97,6 +97,7 @@ const ViewsCom = {
IntegralDetail: () => import("@/views/user-center/assets/integral/detail"),
IntegralTransfer: () => import("@/views/user-center/assets/integral/transfer"),
IntegralCollection: () => import("@/views/user-center/assets/integral/collection"),
AssetsRecordDetail: () => import("@/views/user-center/assets/record-detail"),
// 优惠券
CouponList: () => import("@/views/user-center/coupon/index"),
......@@ -122,20 +123,20 @@ const routes = [
tabIndex: 1
}
},
{
path: '/shopping-cart',
name: 'shopping-cart',
component: ViewsCom.ShoppingCart,
meta: {
tabIndex: 2
}
},
// {
// path: '/shopping-cart',
// name: 'shopping-cart',
// component: ViewsCom.ShoppingCart,
// meta: {
// tabIndex: 2
// }
// },
{
path: '/user-center',
name: 'user-center',
component: ViewsCom.UserCenter,
meta: {
tabIndex: 3
tabIndex: 2
}
},
......@@ -658,6 +659,15 @@ const routes = [
name: 'integral-collection',
component: ViewsCom.IntegralCollection,
},
{
path: '/user-center/assets/record-detail',
name: 'assets-record-detail',
component: ViewsCom.AssetsRecordDetail,
meta: {
showNavBar: true,
title: "交易记录详情"
},
},
// 优惠券
{
path: '/user-center/coupon/list',
......
......@@ -94,6 +94,7 @@
:skuId="skuId"
:tab="item"
:index="tabIndex"
:assets="userAssets"
/>
</van-swipe-item>
</van-swipe>
......
......@@ -6,13 +6,18 @@
:up="upOptions"
>
<div class="list-wrap">
<div class="list-item" v-for="item of ListData" :key="item.id">
<div
class="list-item"
v-for="item of ListData"
:key="item.id"
@click="goRecordDetail(item)"
>
<div class="item-top flex-default">
<div class="number" :class="{ reduce: item.type === 18 }">
<div class="number" :class="{ reduce: item.typeObj.symbol == '-' }">
{{ AssetsRecordTypeObj[item.type].symbol }}{{ item.amount }}
</div>
<div class="status" :class="{ fail: item.status === 1 }">
{{ item.status === 1 ? "失败" : "成功" }}
<div class="status" :class="{ fail: item.status == AssetsRecordStatus.FAIL }">
{{ AssetsRecordStatusObj[item.status].label }}
</div>
</div>
<div class="item-footer flex-default">
......@@ -32,19 +37,27 @@
<script>
import { MescrollMixin, MescrollMoreItemMixin } from "@/mixins";
import { formatTime } from "@/utils/common";
import { AssetsRecordType, AssetsRecordTypeObj } from "@/enums";
import {
AssetsRecordType,
AssetsRecordTypeObj,
AssetsRecordStatus,
AssetsRecordStatusObj,
} from "@/enums";
export default {
mixins: [MescrollMixin, MescrollMoreItemMixin],
props: {
coin: String,
tab: Object,
index: Number,
skuId: String
skuId: String,
assets: Object,
},
data() {
return {
AssetsRecordType,
AssetsRecordTypeObj,
AssetsRecordStatus,
AssetsRecordStatusObj,
downOptions: {
autoShowLoading: false,
auto: false,
......@@ -80,9 +93,15 @@ export default {
payment: this.tab.payment,
page: page.num,
size: page.size,
skuId: this.skuId
skuId: this.skuId,
},
success: (res) => {
if (res.data) {
res.data.forEach((item) => {
item.typeObj = { ...AssetsRecordTypeObj[item.type] } || {};
});
}
if (page.num == 1) {
this.ListData = res.data;
} else {
......@@ -104,6 +123,44 @@ export default {
upCallback(page) {
this.requestData(page);
},
goRecordDetail(item) {
let data = {
title: this.assets.skuVo.name,
num: (item.typeObj.symbol || "") + item.amount,
status: AssetsRecordStatusObj[item.status].label,
infoList: [
{ label: "交易类型", val: item.typeObj.label },
{ label: "TokenID", val: this.assets.coin },
{ label: "交易时间", val: formatTime(item.createTime) },
],
};
if (item.status == AssetsRecordStatus.SUCCESS && item.hash) {
data.infoList.push({ label: "交易哈希", val: item.hash, hash: true });
}
if (!item.note) {
item.note = "--";
}
switch (+item.type) {
case AssetsRecordType.TRANSFER_GIFT_IN:
data.infoList = data.infoList.concat([
{ label: "转赠人地址", val: item.otherSide },
{ label: "受赠人地址", val: this.assets.address },
{ label: "备注", val: item.note },
]);
break;
case AssetsRecordType.TRANSFER_GIFT_OUT:
data.infoList = data.infoList.concat([
{ label: "转赠人地址", val: this.assets.address },
{ label: "受赠人地址", val: item.otherSide },
{ label: "备注", val: item.note },
]);
break;
default:
break;
}
this.$router.push({ name: "assets-record-detail", query: data });
},
},
};
</script>
......
<template>
<div class="assets-record-detail-con bg-grey">
<div class="detail-con">
<p class="name">{{ data.title }}</p>
<p class="num">{{ data.num }}</p>
<p class="status">{{ data.status }}</p>
<div class="info-con">
<div
class="info-item"
v-for="(item, index) of data.infoList"
:key="`info-item-${index}`"
>
<div class="label">{{ item.label }}</div>
<div
class="val"
:class="{ 'hash-link': item.hash && !!item.val }"
@click="handleClick(item)"
>
{{ item.val || "--" }}
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
data: {
infoList: [],
},
};
},
methods: {
handleClick(item) {
// if (item.hash && item.val) {
// this.goChainExploreTxDetail(item.val);
// }
},
},
mounted() {
this.data = this.$route.query;
},
};
</script>
<style lang="less">
.assets-record-detail-con {
padding: 0 16px;
> .detail-con {
margin-top: 50px;
padding: 30px 20px;
background: #ffffff;
border-radius: 6px;
> .name {
text-align: center;
font-weight: bold;
font-size: 14px;
margin-bottom: 15px;
}
> .num {
text-align: center;
font-size: 30px;
margin-bottom: 12px;
font-family: DINAlternate-Bold;
}
> .status {
text-align: center;
color: #999999;
font-size: 14px;
margin-bottom: 20px;
}
> .info-con {
padding-top: 20px;
border-top: 1px solid #f1f1f1;
.info-item {
display: flex;
align-items: flex-start;
margin-bottom: 12px;
}
.info-item .label {
width: 70px;
margin-right: 20px;
color: #666666;
font-size: 14px;
}
.info-item .val {
flex: 1;
word-break: break-all;
font-size: 14px;
// &.hash-link {
// color: #4a9bf7;
// }
}
}
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment