| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798 |
- <template>
- <div class="assets">
- <div class="head">
- <img @click="back" src="@/assets/images/back.png" class="arrow_img" />
- <span>{{ $t('lang36') }}</span>
- </div>
- <div class="navbar">
- <span v-for="(item, index) in navList" :key="index" @click="changeNav(item, index)" :style="{ color: navIndex == index ? '#000' : '' }">{{ item.key }}</span>
- </div>
- <div class="pd" v-show="navIndex == 0">
- <div class="">
- <div class="total_box">
- <div>
- <span class="text">{{ $t('lang80') }}({{ $t('lang174') }})</span>
- </div>
- <div class="total">
- <span>{{ Math.floor(assets * 100) / 100 || 0 }}</span>
- </div>
- <div class="buy" @click="navigation('recharge')">
- <van-button class="buy_btn" type="primary">{{ $t('lang81') }}</van-button>
- </div>
- </div>
- <div class="bare" v-if="coinList.length <= 0">
- <span>{{ $t('lang82') }}</span>
- </div>
- <div v-else>
- <div class="list">
- <div v-for="(item, index) in coinList" :key="index" class="li">
- <div class="li_left">
- <!-- <div class="imgbox">
- <img :src="require('@/assets/images/wallet/' + item.coin_key + '.png')" class="li_img" />
- </div> -->
- <span class="title">{{ item.coin_name }}</span>
- </div>
- <div class="box">
- <div class="box_item">
- <span class="key">{{ $t('lang83') }}</span>
- <span class="num">{{ item.amount || 0 }}</span>
- </div>
- <div class="box_item">
- <span class="key">{{ $t('lang84') }}</span>
- <span class="num">{{ item.frozen_amount || 0 }}</span>
- </div>
- <!-- <div class="box_item">
- <span class="key">{{ $t('lang85') }}(CNY)</span>
- <span class="num">{{ Math.floor(item.amount * Number(item.convert_rate) * 100) / 100 || 0 }}</span>
- </div> -->
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="" v-show="navIndex == 1">
- <div class="pd1 goods_box" @scroll="handleScroll" v-if="nft_list.length > 0">
- <div class="goods_list jsb" v-for="(item, index) in nft_list" :key="index">
- <div class="tags" v-if="item.status == 2">{{ $t('lang141') }}</div>
- <div class="tags1" v-if="item.status == 3">{{ $t('lang142') }}</div>
- <van-image class="goods_list_img" radius="10" :src="item.img_url.split(',')[0]" />
- <div class="right" style="flex: 1">
- <span>{{ item.name }}</span>
- <div class="green">{{ item.title }}</div>
- <div class="cen">
- <span class="money">{{ item.price }}<span class="ssm">{{ $t('lang174') }}</span></span>
- </div>
- <div class="f-sa" v-if="item.status <= 1">
- <div class="buy" @click="pickup(item)">
- <van-button class="buy_btn btn1" type="primary">{{ $t('lang86') }}</van-button>
- </div>
- <div class="buy" @click="transfer(item)">
- <van-button class="buy_btn" type="primary">{{ $t('lang49') }}</van-button>
- </div>
- </div>
- <div class="f-sa buy1" v-if="item.status == 3">
- <div class="buy buy1">
- <van-button class="buy_btn btn1" type="primary">{{ $t('lang143') }}</van-button>
- </div>
- </div>
- <div class="f-sa buy1" v-else>
- <div class="buy">
- <van-button class="buy_btn btn3" type="primary" v-if="item.status == 2" @click="cancel(item)">{{ $t('lang144') }}</van-button>
- <van-button class="buy_btn btn3" type="primary" v-if="item.status == 4">{{ $t('lang145') }}</van-button>
- <van-button class="buy_btn btn3" type="primary" v-if="item.status == 5">{{ $t('lang146') }}</van-button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="bare" v-if="nft_list.length <= 0">
- <span>{{ $t('lang82') }}</span>
- </div>
- </div>
- <van-popup v-model="transferPopop" round position="bottom">
- <!-- <van-cascader v-model="cascaderValue" title="请选择所在地区" :options="options" @close="cascaderShow = false" @finish="onFinish" /> -->
- <div class="area">
- <div class="title">{{ $t('lang88') }}</div>
- <!-- <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad" class="vanlist">
- <van-cell class="item" v-for="item in arealist" :key="item.id" :title="item.address" />
- </van-list> -->
- <div class="box">
- <div class="f-r">
- <span> {{ $t('lang89') }} </span>
- <div class="d">
- <van-field v-model="price" :placeholder="$t('lang93')" class="input" />
- <span class="s">{{ $t('lang174') }}</span>
- </div>
- </div>
- <div class="f-r">
- <span> {{ $t('lang90') }} </span>
- <span class="s">{{ Math.floor(price * Number(transfes_fee) * 100) / 100 }} {{ $t('lang174') }}</span>
- </div>
- <div class="f-r">
- <span> {{ $t('lang91') }} </span>
- <span class="s">{{ transfes_txt }}</span>
- </div>
- </div>
- <div class="submit" @click="cascaderShow = true">
- <van-button class="submit_btn" type="primary" @click="submit">{{ $t('lang71') }}</van-button>
- </div>
- </div>
- </van-popup>
- <van-popup v-model="addresPopop" round position="bottom">
- <div class="area">
- <div class="title">{{ $t('lang157') }}</div>
- <van-address-edit :area-list="areaList" show-search-result :save-button-text="$t('lang111')" :area-columns-placeholder="[]" @save="onSave" />
- </div>
- </van-popup>
- </div>
- </template>
- <script>
- import { homeApi } from '@/api/index';
- import { dateFormat } from '@/utils/formatTool.js';
- import { areaList } from '@vant/area-data';
- import { Dialog, Notify, Toast } from 'vant';
- export default {
- data() {
- return {
- loading: false,
- finished: false,
- total: 1,
- nickname: '',
- assets: 0,
- coinList: [],
- showPopover: false,
- actionType: -1, //-1:全部 0:未知 1:租赁 2:直推奖励 3:团队的算力奖励 4:团队的平级算力奖励
- navIndex: 0,
- navList: [
- {
- key: this.$t('lang134'),
- value: 0,
- },
- {
- key: 'NFT',
- value: 1,
- },
- ],
- nft_list: [],
- transferPopop: false,
- cascaderShow: true,
- price: '', // 转让金额
- areaList: areaList,
- searchResult: [],
- addresPopop: false,
- page: 1,
- item: {},
- transfes_fee: 0, //转让费率
- transfes_txt: '', //手续费说明
- };
- },
- mounted() {
- this.nickname = JSON.parse(localStorage.getItem('userinfo')).nickname;
- this.actionGet();
- this.getNftList();
- },
- methods: {
- statusFn(status) {
- let result = '';
- switch (status) {
- case 0:
- result = this.$t('lang154');
- break;
- case 1:
- result = this.$t('lang155');
- break;
- case 2:
- result = this.$t('lang141');
- break;
- case 3:
- result = this.$t('lang156');
- break;
- case 4:
- result = this.$t('lang145');
- break;
- case 5:
- result = this.$t('lang146');
- break;
- default:
- break;
- }
- return result;
- },
- //返回上一页
- back() {
- this.$router.back();
- },
- navigation(name) {
- this.$router.push({ name });
- },
- changeNav(item, index) {
- this.navIndex = index;
- },
- dateFormatFn(date) {
- return dateFormat(new Date(date * 1000), 'yyyy-MM-dd hh:mm:ss');
- },
- getNftList() {
- homeApi.getNftList({ page: this.page }).then(res => {
- if (res.code == 200) {
- this.total = res.data.total;
- if (this.nft_list.length >= res.data.total) {
- this.page = -1; // 重置为 -1,表示没有更多数据
- } else {
- this.nft_list = [...this.nft_list, ...res.data.data];
- console.log(this.nft_list.length);
- if (this.nft_list.length >= res.data.total) {
- this.page = -1; // 重置为 -1,表示没有更多数据
- }
- }
- } else {
- }
- });
- },
- actionGet() {
- homeApi.assets().then(res => {
- if (res.code == 200) {
- this.assets = res.data.assets;
- this.transfes_txt = res.data.transfes_txt;
- this.transfes_fee = res.data.transfes_fee;
- this.coinList = res.data.coin_list;
- }
- });
- },
- pickup(item) {
- this.item = item;
- this.addresPopop = true;
- },
- onSave(e) {
- console.log(e);
- // this.$toast('save');
- homeApi.pickupOrder({ order_id: this.item.order_id, name: e.name, phone: e.tel, address: e.province + ' ' + e.city + ' ' + e.county + ' ' + e.addressDetail }).then(res => {
- if (res.code == 200) {
- this.addresPopop = false;
- this.page = 1;
- this.nft_list = [];
- this.getNftList();
- Notify({ type: 'success', message: this.$t('lang152') });
- } else {
- this.$toast(res.msg);
- }
- });
- },
- transfer(item) {
- this.transferPopop = true;
- this.item = item;
- },
- submit() {
- if (!this.price) {
- return this.$toast(this.$t('lang153'));
- }
- homeApi.transfer({ order_id: this.item.order_id, price: this.price }).then(res => {
- if (res.code == 200) {
- this.transferPopop = false;
- this.page = 1;
- this.nft_list = [];
- this.getNftList();
- Notify({ type: 'success', message: this.$t('lang152') });
- } else {
- this.$toast(res.msg);
- }
- });
- },
- cancel(item) {
- let _this = this;
- Dialog.confirm({
- title: _this.$t('lang136'),
- message: _this.$t('lang151'),
- confirmButtonText: _this.$t('lang111'),
- cancelButtonText: _this.$t('lang135'),
- })
- .then(() => {
- // this.loading = true;
- console.log(1111111, item.order_id);
- homeApi.cancel({ order_id: item.order_id }).then(res => {
- if (res.code == 200) {
- _this.page = 1;
- _this.nft_list = [];
- _this.getNftList();
- Notify({ type: 'success', message: _this.$t('lang150') });
- } else {
- _this.$toast(res.msg);
- }
- });
- })
- .catch(() => {
- // on cancel
- });
- },
- // getProductAddres() {
- // homeApi.getProductAddres({ product_id: id, search: this.search }).then(res => {
- // if (res.code == 200) {
- // this.arealist = res.data;
- // } else {
- // }
- // });
- // },
- handleScroll(event) {
- const container = event.target;
- const scrollTop = container.scrollTop; // 滚动距离
- const scrollHeight = container.scrollHeight; // 内容总高度
- const clientHeight = container.clientHeight; // 可视区域高度
- // 判断是否滑动到底部
- if (scrollTop + clientHeight >= scrollHeight - 10) {
- console.log(this.page);
- if (this.page != -1) {
- this.page++; // 页数加 1
- this.getNftList(); // 触发加载更多
- }
- }
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .head {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- color: rgba(#000, 0.8);
- letter-spacing: 1.2px;
- font-weight: 550;
- background: #fff;
- padding: 14px 0;
- z-index: 999;
- .arrow_img {
- position: absolute;
- left: 20px;
- width: 10px;
- height: 16px;
- // transform: translate(0, -50%);
- }
- }
- .f-sb {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .f-sa {
- display: flex;
- align-items: center;
- justify-content: space-around;
- }
- .f-sb-n {
- display: flex;
- align-items: flex-end;
- justify-content: space-between;
- }
- .f-col {
- display: flex;
- flex-direction: column;
- }
- .f-r {
- display: flex;
- align-items: center;
- }
- .assets {
- min-height: 100vh;
- padding: 50px 0 0;
- // background-color: #fafbfc;
- .top {
- color: #000;
- padding-bottom: 16px;
- margin: 0 6px;
- }
- .navbar {
- color: #000;
- height: 50px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- background-color: #fff;
- span {
- color: #aaaaaa;
- width: 50%;
- font-size: 14px;
- text-align: center;
- line-height: 50px;
- }
- }
- .pd {
- min-height: 100vh;
- padding: 4px;
- margin-top: 4px;
- background-color: #fff;
- }
- .total_box {
- position: relative;
- display: flex;
- align-items: center;
- flex-direction: column;
- justify-content: center;
- // position: relative;
- font-size: 12px;
- color: #fff;
- height: 140px;
- // border-radius: 16px;
- padding: 20px 20px 40px;
- box-sizing: border-box;
- border-radius: 10px;
- margin: 10px;
- background: linear-gradient(to right, #1ab986, #25d7bb);
- .total {
- font-size: 28px;
- text-align: center;
- padding-top: 10px;
- }
- .text {
- color: rgba(#fff, 0.8);
- }
- .buy {
- position: absolute;
- right: 14px;
- bottom: 14px;
- &_btn {
- color: #29b286;
- height: 30px;
- line-height: 30px;
- font-size: 14px;
- background-color: #ffffff;
- border: none;
- padding: 0 16px;
- white-space: nowrap;
- border-radius: 30px;
- }
- }
- }
- .balance_box {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-top: 16px;
- margin: 0 6px;
- border-radius: 20px;
- background-color: #ffffff;
- box-shadow: 4px 4px 15px 0px rgba(180, 212, 212, 0.29);
- .balance_li {
- color: #510fa8;
- display: flex;
- align-items: center;
- flex-direction: column;
- width: 48%;
- font-size: 13px;
- border-radius: 16px;
- padding: 16px 0;
- // box-shadow: 4px 4px 15px 0px rgba(180, 212, 212, 0.59);
- // background-color: rgba(255, 255, 255, 0.3);
- .icon {
- width: 20px;
- height: 20px;
- margin-bottom: 10px;
- }
- }
- }
- .bare {
- text-align: center;
- font-size: 14px;
- padding: 60px 14px;
- color: #aaa;
- }
- .list {
- border-radius: 20px;
- padding: 0 8px;
- margin-top: 16px;
- background-color: #fff;
- margin: 16px 6px;
- .li {
- // display: flex;
- // align-items: center;
- // justify-content: space-between;
- font-size: 14px;
- color: rgba(51, 51, 51, 1);
- padding: 14px 0;
- .li_left {
- // display: flex;
- // align-items: center;
- .imgbox {
- width: 40px;
- height: 40px;
- border-radius: 15px;
- background-color: #f1f1f1;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 6px;
- }
- .li_img {
- display: block;
- width: 32px;
- height: 32px;
- border-radius: 50%;
- }
- .title {
- color: #29b286;
- font-size: 14px;
- font-weight: bold;
- }
- }
- .box {
- padding-top: 10px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- &_item {
- width: 33%;
- display: flex;
- flex-direction: column;
- .key {
- color: #aaa;
- font-size: 12px;
- }
- .num {
- font-size: 14px;
- color: #000;
- padding-top: 2px;
- }
- }
- .box_item:last-child {
- text-align: right;
- }
- }
- }
- }
- .goods_box {
- // margin: 14px;
- height: 100vh;
- overflow: auto;
- border-radius: 14px;
- .good_icon {
- width: 16px;
- height: 16px;
- margin-right: 5px;
- }
- }
- .pd1 {
- padding: 14px;
- }
- .goods_list {
- position: relative;
- display: flex;
- // align-items: center;
- // justify-content: space-between;
- color: #000;
- padding: 14px;
- border-radius: 6px;
- // box-shadow: 0 4px 16px 0 rgba(53, 73, 93, 0.15);
- margin-bottom: 16px;
- // box-shadow: 4px 4px 15px 0px rgba(180, 212, 212, 0.29);
- background-color: #fff;
- // background-image: linear-gradient(90deg, rgba(217, 239, 239, 0.3) 0, rgba(217, 239, 239, 0.3) 0, rgba(225, 240, 242, 0.3) 100%, rgba(225, 240, 242, 0.3) 100%);
- .tags {
- position: absolute;
- left: 0;
- top: 0;
- font-size: 10px;
- color: #fff;
- padding: 4px 14px;
- z-index: 99;
- background-color: #29b2b0;
- border-radius: 6px 0 6px 0;
- }
- .tags1 {
- position: absolute;
- left: 0;
- top: 0;
- font-size: 10px;
- color: #fff;
- padding: 4px 14px;
- z-index: 99;
- background-color: #f4ab1e;
- border-radius: 6px 0 6px 0;
- }
- &_img {
- width: 110px;
- height: 120px;
- border-radius: 10px;
- margin-right: 10px;
- }
- .right {
- width: calc(100% - 100px);
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- font-size: 13px;
- box-sizing: border-box;
- padding: 6px 0;
- .time_text {
- color: #7f7f7f;
- font-weight: normal;
- font-size: 10px;
- text-decoration: line-through;
- }
- .cen {
- color: #000;
- font-size: 12px;
- }
- .money {
- font-size: 15px;
- }
- .ssm {
- font-size: 10px;
- font-weight: normal;
- }
- .mon_t {
- color: #3d3d3d;
- font-weight: normal;
- }
- .yel {
- background-color: #f9f6e5;
- font-weight: normal;
- margin-left: 8px;
- padding: 0px 8px;
- border-radius: 16px;
- white-space: nowrap;
- .count {
- color: #f7c35d;
- font-size: 9px;
- }
- }
- .green {
- width: fit-content;
- color: #29b286;
- background-color: #ddf2e7;
- font-size: 10px;
- font-weight: normal;
- padding: 2px 6px;
- border-radius: 6px;
- }
- .t2 {
- text-decoration: none;
- }
- }
- .buy {
- display: flex;
- align-items: flex-end;
- &_btn {
- height: 32px;
- line-height: 32px;
- font-size: 12px;
- border: none;
- padding: 0 26px;
- white-space: nowrap;
- border-radius: 30px;
- border: 1px solid #29b286;
- background-color: #29b286;
- }
- .btn1 {
- color: #29b286;
- background-color: #fff;
- }
- .btn3 {
- color: #b9b9b9;
- padding: 0 20px;
- border: 1px solid #b9b9b9;
- background-color: #fff;
- }
- }
- .buy1 {
- justify-content: flex-end;
- }
- }
- .area {
- color: #363636;
- font-size: 13px;
- padding: 20px 30px;
- width: 100%;
- box-sizing: border-box;
- position: relative;
- .title {
- color: #000;
- font-size: 15px;
- text-align: center;
- font-weight: bold;
- // padding: 0 0 14px;
- }
- .vanlist {
- max-height: 350px;
- overflow: auto;
- box-sizing: border-box;
- margin: 20px 0;
- border: none !important;
- .item {
- padding: 12px 0 !important;
- border-bottom: 0.5px solid rgba(190, 190, 190, 0.15);
- }
- }
- .box {
- margin: 20px 0;
- .f-r {
- padding: 6px 0;
- }
- .f-r span:first-child {
- padding-right: 8px;
- }
- .d {
- display: flex;
- align-items: flex-end;
- }
- .input {
- // width: 100%;
- // border: 1px solid #29b286;
- // border-radius: 20px;
- width: 100px;
- border-bottom: 0.5px solid rgba(27, 27, 27, 0.15);
- }
- .van-cell {
- padding: 0 !important;
- }
- .s {
- font-size: 11px;
- color: #999999;
- }
- }
- .submit {
- width: 100%;
- // position: fixed;
- bottom: 30px;
- box-sizing: border-box;
- &_btn {
- width: 100%;
- height: 40px;
- line-height: 40px;
- font-size: 14px;
- background-color: #29b286;
- border: none;
- white-space: nowrap;
- border-radius: 30px;
- }
- }
- ::v-deep .van-field__control {
- padding: 6px 12px 0;
- }
- ::v-deep .van-hairline--top-bottom::after,
- ::v-deep.van-hairline-unset--top-bottom::after {
- border: none;
- }
- }
- }
- ::v-deep .van-cell {
- padding: 10px 0 !important;
- }
- ::v-deep .van-button--danger {
- background-color: #29b286;
- border-color: #29b286;
- }
- ::v-deep .van-address-edit {
- padding: 10px 0;
- }
- ::v-deep .van-ellipsis {
- font-size: 10px !important;
- }
- ::v-deep .van-overlay {
- background-color: rgba(#000, 0.3);
- }
- </style>
|