<template>
    <!-- <div class="detail">
        <product-banner
            :startTime="startTime"
            :assignment="!!assignment"
            :info="info"
            @getProduct="getProduct"
        ></product-banner>
        <div class="info">
            <div class="info-title">
                <product-title :isSmall="info.name && info.name.length > 16">{{ info.name }}</product-title>
            </div>
            <div class="price-line">
                <div class="text" v-if="info.number">编号 {{ info.number }}</div>
                <div class="text total" v-if="info.salable && info.total > 1">
                    <span>限量</span>
                    <span>{{ info.total }}份</span>
                </div>
                <div class="text" v-if="info.salable && !isSold && info.total !== 1">
                    <span>已售 {{ Math.max(Math.min(info.sale, info.total), 0) }}</span>
                    <span>剩余 {{ Math.min(Math.max(info.stock, 0), info.total) }}</span>
                </div>
                <div class="text" v-if="info.couponPayment">优惠券藏品</div>
            </div>

            <tasks v-if="assignment && info.totalQuota" :info="info" v-model:assignments="assignments"></tasks>
            <div class="info-bottom">
            </div>
        </div>
        <div class="goods">
            <van-collapse v-model="activeNames">
                <van-collapse-item name="1" class="goods-info">
                    <template #title>
                        <div class="page-title">
                            <img src="@assets/fenxiang-icon.png" alt="" />
                            用户信息
                        </div>
                    </template>
                    <div class="user">
                        <van-cell
                            class="creator"
                            :to="{
                                path: '/creatorDetail',
                                query: {
                                    id: info.minterId
                                }
                            }"
                        >
                            <template #icon>
                                <van-image
                                    width="32"
                                    height="32"
                                    :src="info.minterAvatar || require('@assets/svgs/img_default_photo.svg')"
                                    fit="cover"
                                    radius="100"
                                />
                            </template>
                            <template #title>
                                <div class="text1">{{ info.minter }}</div>
                                <div class="text2">铸造者</div>
                            </template>
                        </van-cell>
                        <van-cell
                            v-if="info.ownerId !== info.minterId"
                            class="creator"
                            :to="{
                                path: '/creatorDetail',
                                query: {
                                    id: info.ownerId,
                                    type: 'DEFAULT'
                                }
                            }"
                        >
                            <template #icon>
                                <van-image
                                    width="32"
                                    height="32"
                                    class="user-img"
                                    :src="info.ownerAvatar || require('@assets/svgs/img_default_photo.svg')"
                                    fit="cover"
                                    radius="100"
                                />
                            </template>
                            <template #title>
                                <div class="text1 van-ellipsis">{{ info.owner }}</div>
                                <div class="text2">持有者</div>
                            </template>
                        </van-cell>
                    </div>
                </van-collapse-item>

                <van-collapse-item name="2" class="goods-info">
                    <template #title>
                        <div class="page-title"><img src="@assets/icon-miaoshu.png" alt="" />作品描述</div>
                    </template>
                    <swiper v-if="boxs.length > 0" :slidesPerView="'auto'" :spaceBetween="20" class="detail-swiper">
                        <swiper-slide v-for="(item, index) in boxs" :key="index">
                            <van-image
                                width="100%"
                                height="130"
                                :src="getImg(item, '', 1000)"
                                fit="cover"
                                radius="12"
                                @click="preview(index, boxs)"
                            />
                        </swiper-slide>
                    </swiper>
                    <div v-if="info.detail" class="page-text page-detail" v-html="info.detail"></div>
                </van-collapse-item>
                <van-collapse-item name="3" class="goods-info top1">
                    <template #title>
                        <div class="page-title"><img src="@assets/icon-lianshangxinxi.png" alt="" /> 类型</div>
                    </template>
                    <div class="top1">
                        <div v-if="info.category" class="category">
                            <span>{{ info.category }}</span>
                        </div>
                        <div v-else class="tips">铸造者未设置</div>
                    </div>
                </van-collapse-item>
                <van-collapse-item name="4" class="goods-info">
                    <template #title>
                        <div class="page-title">
                            <img src="@assets/qiaoqiaohua-icon-weidakai.png" alt="" /> 悄悄话<span
                                >（灰色表示已使用）</span
                            >
                        </div>
                    </template>
                    <div class="qiaohua" v-if="init2">
                        <img class="img" :src="init2.icon[0]" alt="" />
                        <div class="text4" :class="{ prim: init2.opened }">
                            {{ init2.opened ? '已打开' : '未打开' }}
                        </div>
                    </div>
                    <div class="tips" v-else>铸造者未设置</div>
                </van-collapse-item>
                <van-collapse-item name="5" class="goods-info">
                    <template #title>
                        <div class="titleIcon page-title">
                            <img src="@assets/icon-lianshangxinxi(1).png" alt="" />
                            持有特权
                            <span>（灰色表示已使用）</span>
                        </div>
                    </template>
                    <div class="prive" v-if="init.length > 0">
                        <div v-for="(item, index) in init" :key="index">
                            <div class="prive1">
                                <img class="img" :src="item.icon[0]" alt="" />
                                <div class="prive2">{{ item.name }}</div>
                            </div>
                        </div>
                    </div>
                    <div v-if="init.length === 0" class="tips">铸造者未设置</div>
                </van-collapse-item>
                <van-collapse-item name="6" class="goods-info">
                    <template #title>
                        <div class="page-title"><img src="@assets/icon-lianshangxinxi(2).png" alt="" />作品特性</div>
                    </template>
                    <div class="specific-list" v-if="properties.length > 0">
                        <div class="specific-item" v-for="(item, index) in properties" :key="index">
                            <div class="text1">{{ item.name }}</div>
                            <div class="text2">{{ item.value }}</div>
                        </div>
                    </div>
                    <div v-else class="textName">铸造者未设置</div>
                </van-collapse-item>
                <hash-code :info="info"></hash-code>
                <van-collapse-item name="8" class="goods-info">
                    <template #title>
                        <div class="page-title"><img src="@assets/info_icon_jiaoyijilu1.png" alt="" />交易记录</div>
                    </template>
                    <div v-if="list.length > 0">
                        <div class="content" v-for="item in list" :key="item.id">
                            <div class="user-detail">
                                <div class="text1 van-ellipsis">{{ item.fromUser || '保密' }}</div>
                                <div class="text2" v-if="item.price">{{ item.operation }}¥{{ item.price }}</div>
                                <div class="text2" v-else>{{ item.operation }}</div>
                                <div class="text3 van-ellipsis">{{ item.toUser || '保密' }}</div>
                                <div class="text4">{{ item.createdAt.substr(0, 16) }}</div>
                            </div>
                        </div>
                    </div>
                    <div v-else class="textName">暂无购买记录</div>
                </van-collapse-item>
            </van-collapse>
        </div>
        <div class="btn van-safe-area-bottom" ref="btn" v-if="info.onShelf && info.scheduleSale && !info.salable">
            <div class="btn-list">
                <div class="price-content">
                    <div class="price">
                        <img src="@assets/jiage_huang.png" alt="" />
                        {{ info.price }}
                    </div>
                    <div class="price-sub" v-if="info.originalPrice">¥{{ info.originalPrice || 0 }}</div>
                    <div class="sub" v-if="info.royalties">
                        含 <span>{{ info.royalties }}%</span> 版税
                    </div>
                </div>
                <div class="flex1"></div>
                <div class="btns">
                    <van-button class="no-btn" v-if="isAppointment" block round>
                        <div class="appoint">
                            <span>即将开售</span>
                            <span>{{ startTime }}</span>
                        </div>
                    </van-button>
                </div>
            </div>
        </div>
        <div class="btn van-safe-area-bottom" ref="btn" v-else-if="info.onShelf && info.salable">
            <div class="btn-list">
                <div class="price-content">
                    <div class="price">
                        <img src="@assets/jiage_huang.png" alt="" />
                        {{ info.price }}
                    </div>
                    <div class="price-sub" v-if="info.originalPrice">¥{{ info.originalPrice || 0 }}</div>
                    <div class="sub" v-if="info.royalties">
                        含 <span>{{ info.royalties }}%</span> 版税
                    </div>
                </div>
                <div class="flex1"></div>
                <div class="btns">
                    <van-button class="no-btn" v-if="isAppointment" block round>
                        <div class="appoint">
                            <span>即将开售</span>
                            <span>{{ startTime }}</span>
                        </div>
                    </van-button>

                    <van-button class="no-btn" v-else-if="isSolded" block round>已售罄</van-button>
                    <van-button class="no-btn" v-else-if="isSold" block round>即将售罄</van-button>
                    <van-button class="no-btn" v-else-if="limit.limit > 0 && limit.count >= limit.limit" block round>
                        限购{{ limit.limit }}件
                    </van-button>
                    <template v-else-if="assignment && ((isLogin && userInfo.vipPoint < 1) || !isLogin)">
                        <div class="btn-assignments" v-if="isLogin && userInfo.vipPurchase && info.openQuota">
                            <van-button @click="vipAssignment" class="vip" type="danger" block round>
                                vip通道
                            </van-button>
                            <van-button style="font-size: 12px" class="no-btn" v-if="!info.openQuota" block round>
                                名额为空
                            </van-button>
                            <van-button @click="share" v-else-if="info.totalQuota" type="primary" block round
                                >邀请获取
                            </van-button>
                        </div>
                        <van-button
                            style="font-size: 12px"
                            @click="showReason"
                            class="no-btn"
                            v-else-if="!info.openQuota"
                            block
                            round
                        >
                            活动名额已被抢光
                        </van-button>
                        <van-button
                            style="font-size: 12px"
                            @click="showReason"
                            class="no-btn"
                            v-else-if="noPay"
                            block
                            round
                        >
                            存在未支付无效订单
                        </van-button>
                        <van-button class="no-btn" v-else-if="!info.totalQuota" block round> 积分结算中 </van-button>

                        <van-button @click="share" v-else type="primary" block round>邀请获取白名单 </van-button>
                    </template>

                    <template v-else-if="assignment && isSale && info.timeDelay">
                        <van-button class="no-btn" block round>
                            <div class="appoint">
                                <span style="font-size: 12px">任务完成,即将开卖</span>
                                <span>{{ saleTime }}</span>
                            </div>
                        </van-button>
                    </template>

                    <van-button v-else type="primary" block round @click="buy">
                        {{ info.couponPayment ? '立即兑换' : '立即购买' }}
                    </van-button>
                </div>
            </div>
        </div>

        <div class="btn van-safe-area-bottom" v-else>
            <div class="status-text">仅展示</div>
        </div>
        <post ref="post" :info="info" noButton />
    </div> -->
    <!-- 顶部导航 -->
    <!-- <TopNavigation /> -->
    <!-- 详情内容 -->
    <div class="detail_content">
        <product-banner
            :startTime="startTime"
            :assignment="!!assignment"
            :info="info"
            @getProduct="getProduct"
        ></product-banner>
        <!-- <img src="" alt="" class="detail_content_img" />
        <div class="detail_content_one">
            <div class="detail_content_point">
                <img :src="info.liked == true ? likes : noLikes" alt="" class="detail_content_point_img" />
                <div class="detail_content_point_number">{{ info.likes }}</div>
            </div>
            <div class="detail_content_share">
                <img :src="require('@assets/icon-share.png')" alt="" class="detail_content_share_img" />
                <div class="detail_content_share_con">分享</div>
            </div>
        </div> -->
        <div :class="!!info.model3d ? 'detail_content_title' : 'detail_content_title_one'">{{ info.name }}</div>

        <div class="limited_label">
            <div class="limited_label_con">
                <div class="limited_label_name">限量</div>
                <div class="limited_label_number">{{ info.total }}份</div>
            </div>
            <div class="limited_label_collection">{{ info.category }}</div>
        </div>
        <!-- <div class="item_number" v-else>
            <div class="item_number_collection">收藏品</div>
            <div class="item_number_number">编号&nbsp;47475</div>
        </div> -->
        <div class="self_information">
            <div class="self_information_one">
                <div class="self_information_one_con">
                    <van-image
                        width="32px"
                        height="32px"
                        radius="23"
                        :src="info.minterAvatar || require('@assets/svgs/img_default_photo.svg')"
                        fit="cover"
                    />
                    <div class="self_information_one_text">
                        <div class="self_information_one_text_one">{{ info.minter }}</div>
                        <div class="self_information_one_text_two">创作者</div>
                    </div>
                </div>
                <div class="split_line" v-if="info.ownerId !== info.minterId"></div>
                <div class="self_information_one_con" v-if="info.ownerId !== info.minterId">
                    <van-image
                        width="32px"
                        height="32px"
                        radius="23"
                        :src="info.ownerAvatar || require('@assets/svgs/img_default_photo.svg')"
                        fit="cover"
                    />
                    <div class="self_information_one_text">
                        <div class="self_information_one_text_one">{{ info.owner }}</div>
                        <div class="self_information_one_text_two">持有者</div>
                    </div>
                </div>
            </div>
            <div class="description_of_works">
                <div class="description_of_works_title">作品描述</div>
                <div class="description_of_works_text" v-html="info.detail"></div>
                <!-- <div >{{title}}</div>
                <img :src="require('@assets/commodity-background-map.png')" alt="" class="description_of_works_img"> -->
            </div>
            <!-- 持有特权 -->
            <div class="hold_privileges">
                <div class="hold_privileges_title">
                    持有特权<span class="hold_privileges_tip">(灰色表示已使用)</span>
                </div>
                <div class="hold_privileges_name" v-if="init.length === 0">创作者者暂时未设置</div>
                <div class="hold_privileged_information" v-else>
                    <div class="hold_privileged_information_con" v-for="(item, index) in init" :key="index">
                        <van-image
                            width="18px"
                            height="18px"
                            :src="item.icon[0]"
                            fit="cover"
                            class="hold_privileged_information_con_img"
                        />
                        <div class="hold_privileged_information_con_title">{{ item.name }}</div>
                    </div>
                </div>
            </div>
            <!-- 作品特性 -->
            <div class="hold_privileges">
                <div class="hold_privileges_title">作品特性</div>
                <div class="hold_privileges_name" v-if="properties.length == 0">创作者者暂时未设置</div>
                <div class="digital_equity_card" v-else>
                    <div class="digital_equity_card_con" v-for="(item, index) in properties" :key="index">
                        <span class="digital_equity_card_con_one">{{ item.name }}</span>
                        <span class="digital_equity_card_con_two">{{ item.value }}</span>
                    </div>
                </div>
            </div>
            <div class="hold_privileges">
                <hash-code :info="info"></hash-code>
            </div>
            <div class="hold_privileges">
                <div class="hold_privileges_title">交易记录</div>
                <div v-if="list.length > 0">
                    <div class="hold_privileges_list" v-for="item in list" :key="item.id">
                        <div class="hold_privileges_list_con">
                            <div class="hold_privileges_list_con_one text1 van-ellipsis">
                                {{ item.fromUser || '保密' }}
                            </div>
                            <div class="hold_privileges_list_con_one text2" v-if="item.price">
                                {{ item.operation }}¥{{ item.price }}
                            </div>
                            <div class="hold_privileges_list_con_one text2" v-else>{{ item.operation }}</div>
                            <div class="hold_privileges_list_con_one text3 van-ellipsis">
                                {{ item.toUser || '保密' }}
                            </div>
                            <div class="hold_privileges_list_con_one text4">{{ item.createdAt.substr(0, 16) }}</div>
                        </div>
                    </div>
                </div>
                <div v-else class="textName">暂无购买记录</div>
                <!-- <div class="transaction_record_one">
                    <div>
                        <span class="user_information">用户信息</span>
                        <span>仅展示</span>
                    </div>
                    <div>
                        <span>2021-08-18</span>&nbsp;&nbsp;
                        <span>18:38:50</span>
                    </div>
                </div> -->
                <!-- <van-divider /> -->
                <!-- <div class="transaction_record_one transaction_record_two">
                    <div>
                        <span class="user_information">列奥那多</span>
                        <span class="selling_price">出售¥640</span>
                        <span>列奥</span>
                    </div>
                    <div>
                        <span>2021-08-18</span>&nbsp;&nbsp;
                        <span>18:38:50</span>
                    </div>
                </div> -->
            </div>
        </div>
        <!-- 交易按钮 -->
        <div class="transaction_button" v-if="info.onShelf && info.scheduleSale && !info.salable">
            <div class="transaction_button_left">
                <div class="transaction_price"><span class="amount_symbol">￥</span>{{ info.price }}</div>
                <div class="transaction_tax">
                    (含&nbsp;<span class="transaction_tax_con">{{ info.royalties }}%</span>&nbsp;版税)
                </div>
            </div>
            <div class="transaction_button_right">
                <div class="coming_on_sale" v-if="isAppointment" block round>
                    <div class="coming_on_sale_con">即将开售</div>
                    <div class="coming_on_sale_time">{{ startTime }}</div>
                    <!-- <van-count-down :time="time" format="DD天 HH:mm:ss" class="coming_on_sale_time" /> -->
                </div>
            </div>
        </div>
        <div class="transaction_button" v-else-if="info.onShelf && info.salable">
            <div class="transaction_button_left">
                <div class="transaction_price"><span class="amount_symbol">￥</span>{{ info.price }}</div>
                <div class="transaction_tax">
                    (含&nbsp;<span class="transaction_tax_con">{{ info.royalties }}%</span>&nbsp;版税)
                </div>
            </div>
            <div class="transaction_button_right">
                <div class="coming_on_sale" v-if="isAppointment" block round>
                    <div class="coming_on_sale_con">即将开售</div>
                    <div class="coming_on_sale_time">{{ startTime }}</div>
                    <!-- <van-count-down :time="time" format="DD天 HH:mm:ss" class="coming_on_sale_time" /> -->
                </div>

                <!-- <van-button class="no-btn" v-else-if="isSold" block round>已售罄</van-button> -->
                <div class="sold_out" v-else-if="isSolded" block round>已售罄</div>
                <div class="sold_out" v-else-if="isSold" block round>即将售罄</div>
                <div class="sold_out" v-else-if="limit.limit > 0 && limit.count >= limit.limit" block round>
                    限购{{ limit.limit }}件
                </div>

                <div class="buy_now" v-else @click="buyNow">
                    <div class="buy_now_con">立即购买</div>
                    <div>
                        <span class="purchase_sold">已售&nbsp;{{ info.sale }}</span>
                        <span class="Purchase_surplus">剩余{{ info.stock }}</span>
                    </div>
                </div>
            </div>
        </div>
        <!-- 购买之后交易按钮 -->
        <!-- <div class="purchase_transaction_button">
            <div class="purchase_transaction_button_give" @click="$router.push('/collectionGift')">赠送</div>
            <div class="purchase_transaction_button_right">
                <div class="public_display" @click="publicDisplay">公开展示</div>
                <div class="purchase_transaction_button_deposit" @click="consignmentOrNot">
                    {{ deposit ? '取消寄售' : '寄售上架' }}
                </div>
            </div>
        </div> -->
        <!-- 仅展示 -->
        <div class="show_only" v-else>
            <div class="show_only_con">仅展示</div>
        </div>
    </div>
</template>

<script>
import { ImagePreview } from 'vant';
import product from '../../mixins/product';
import coupon from '../../mixins/coupon';
// import HashCode from '../../components/product/HashCode.vue';
// import ProductTitle from '../../components/product/ProductTitle.vue';
// import { Swiper, SwiperSlide } from 'swiper/vue';
import { mapState } from 'vuex';

import 'swiper/swiper.min.css';
import 'swiper/swiper-bundle.min.css';

import SwiperCore, { Pagination } from 'swiper';
// import Post from '../../components/Post.vue';
// import Tasks from '../../components/product/Tasks.vue';

SwiperCore.use([Pagination]);

let inWeixin = /micromessenger/i.test(navigator.userAgent);
import { Dialog } from 'vant';
// import TopNavigation from '../../components/TopNavigation.vue';
import ProductBanner from '../../components/product/ProductBanner.vue';
import HashCode from '../../components/product/HashCode.vue';
export default {
    components: {
        // HashCode,
        // ProductTitle,
        ProductBanner,
        HashCode
        // Swiper,
        // SwiperSlide,
        // Post,
        // Tasks,
        // TopNavigation
    },
    mixins: [product, coupon],
    name: 'productDetail',
    data() {
        return {
            activeName: '1',
            info: {},
            liked: false,
            btn: null,
            blindBoxItems: [],
            init: [],
            init2: null,
            list: [],
            activeNames: ['1', '2', '3', '4', '5', '6', 'hashCode', '8'],
            inWeixin,
            limit: {},
            couponList: [],
            assignments: [],
            noPay: false,
            collectionId: '',
            // purchaseStatus: false,
            holdPrivileges: false,
            digitalEquityCard: false,
            time: 4353536,
            transactionStatus: 'buyNow',
            deposit: false,
            showOnly: false,
            noLikes: require('@assets/icon-dianzan.png'),
            likes: require('@assets/icon-dianzan@2x.png')
        };
    },
    computed: {
        ...mapState(['userInfo']),
        banners() {
            return this.info.pic || [];
        },
        properties() {
            return this.info.properties || [];
        },
        isBuy() {
            return this.info.stock > 0 && this.info.onShelf && this.info.salable;
        },
        boxs() {
            let list = [...this.blindBoxItems];
            return list.map(item => {
                return this.changeImgs(item.pic);
            });
        }
    },
    mounted() {
        this.$store.dispatch('getUsedBuy');
        this.$store.dispatch('getTime');
        this.$store.dispatch('getUserInfo');
        console.log(this.$route.params);
        if (this.$route.query.collectionId) {
            this.collectionId = this.$route.query.collectionId;
        }
        this.$http.get('/order/checkLimit', { collectionId: this.collectionId }).then(res => {
            this.limit = res;
        });
        this.getProduct();
        // if (this.isLogin) {
        //     this.$http
        //         .post(
        //             '/order/all',
        //             {
        //                 query: {
        //                     userId: this.$store.state.userInfo.id,
        //                     collectionId: this.collectionId,
        //                     status: 'NOT_PAID'
        //                 }
        //             },
        //             { body: 'json' }
        //         )
        //         .then(res => {
        //             if (!res.empty) {
        //                 this.noPay = true;
        //             }
        //         });
        // }
    },
    methods: {
        preview(index = 0, list = []) {
            ImagePreview({
                images: [...list].map(item => {
                    return item;
                }),
                startPosition: index
            });
        },
        appointment() {
            if (this.info.appointment) {
                return;
            }
            this.$http
                .post('/collection/appointment?id=' + this.info.id)
                .then(res => {
                    this.getProduct();
                    this.$toast.success('预约成功');
                })
                .catch(e => {
                    if (e.error) {
                        this.$toast.warning(e.error);
                    }
                });
        },
        getProduct() {
            this.$toast.loading({
                message: '加载中...',
                forbidClick: true
            });
            this.$http
                .get('/collection/get/' + this.collectionId)
                .then(res => {
                    if (this.$store.state.from === 'scanCode') {
                        res.onShelf = true;
                        this.checkLogin();
                    }
                    console.log(res);
                    this.info = res;
                    //优惠券
                    if (res.couponPayment) {
                        this.getCouponList();
                    }
                    if (this.inWeixin) {
                        wx.updateAppMessageShareData({
                            title: '第九空间-' + res.name,
                            desc: '全球首个基于区块链的游戏资产集换中心',
                            link: location.origin + '/9th/productDetail/' + res.id,
                            imgUrl: this.getImg(this.changeImgs(this.banners), '', 300)
                        });
                        wx.updateTimelineShareData({
                            title: '第九空间-' + res.name,
                            link: location.origin + '/9th/productDetail/' + res.id,
                            imgUrl: this.getImg(this.changeImgs(this.banners), '', 300)
                        });
                        console.log(wx);
                    }
                    if (res.assetId) {
                        this.$http.get('/asset/get/' + res.assetId).then(res => {
                            console.log(res);
                            this.info = {
                                ...res,
                                ...this.info
                            };
                            this.$http
                                .get('/asset/tokenHistory', {
                                    tokenId: res.tokenId,
                                    assetId: res.collectionId
                                })
                                .then(res => {
                                    console.log(res);
                                    this.list = res;
                                });
                        });
                    }
                    if (res.privileges) {
                        this.init2 = res.privileges.find(item => {
                            return item.name === '悄悄话';
                        });
                    }
                    if (res.privileges) {
                        this.init = res.privileges.filter(item => {
                            return item.name !== '悄悄话';
                        });
                    }
                    this.getTime(res.startTime);
                    if (res.saleTime) {
                        this.getTime(res.saleTime, 'saleTime');
                    }
                    this.$nextTick(() => {
                        if (this.isBuy) {
                            this.btn = this.$refs.btn;
                        }
                    });
                    this.$toast.clear();

                    if (res.type === 'BLIND_BOX') {
                        return this.$http.post(
                            '/blindBoxItem/all',
                            {
                                query: {
                                    blindBoxId: res.id
                                }
                            },
                            { body: 'json' }
                        );
                    } else {
                        return Promise.resolve();
                    }
                })
                .then(res => {
                    if (res) {
                        this.blindBoxItems = res.content;
                    }
                })
                .catch(e => {
                    this.$toast.clear();
                    if (e && e.error) {
                        this.$dialog
                            .alert({
                                title: '提示',
                                message: e.error
                            })
                            .then(res => {
                                this.$router.back();
                            });
                    }
                });
        },
        showReason() {
            this.$dialog.alert({
                title: '提示',
                message: '若存在未支付无效订单，请等待订单自动5分钟内取消，退回白名单资格。'
            });
        },
        getCouponList() {
            if (!this.isLogin) {
                return;
            }
            this.$http
                .post(
                    '/userCoupon/all',
                    {
                        query: { userId: this.$store.state.userInfo.id, used: false }
                    },
                    { body: 'json' }
                )
                .then(res => {
                    this.couponList = [...res.content].filter(item => {
                        return this.checkTime(item) && this.checkUse(item, this.info.id);
                    });
                });
        },
        buyNow() {
            this.checkLogin().then(() => {
                if (this.info.couponPayment && this.couponList.length === 0) {
                    this.$dialog
                        .alert({
                            title: '提示',
                            message: '该藏品为特殊藏品，需要使用优惠券才能兑换'
                        })
                        .then(() => {});
                } else if (!this.usedBuy && this.info.source === 'TRANSFER') {
                    this.$toast('该通道暂且关闭');
                }
                // else if (this.authStatus !== '已认证') {
                //     this.$dialog
                //         .alert({
                //             title: '提示',
                //             message: '实名认证后才可进行藏品购买'
                //         })
                //         .then(() => {
                //             this.goAuth();
                //         });
                // }
                else {
                    this.$router.push({
                        path: '/submit',
                        query: {
                            id: this.collectionId,
                            invitor: this.$route.query.invitor
                        }
                    });
                }
            });
        },
        goAuth() {
            if (this.authStatus === '认证中' || this.authStatus === '认证失败') {
                this.$router.push('/waiting');
            } else if (this.authStatus === '未认证') {
                this.$router.push('/Authentication');
            }
        },
        share() {
            if (this.assignment && !this.isLogin) {
                this.checkLogin();
            } else {
                this.$refs.post.init();
            }
        },
        vipAssignment() {
            if (this.info.vipSurplus <= 0) {
                this.$dialog
                    .alert({
                        title: '通道已关闭',
                        message: '您的vip购买次数已经用完啦，请完成邀请任务继续购买吧~'
                    })
                    .then(res => {
                        if (this.info.totalQuota) {
                            this.share();
                        }
                    });
            } else {
                this.buy();
            }
        }
    }
};
</script>

<style lang="less" scoped>
.navBar {
    width: 100%;
    height: 44px;
}
.detail_content {
    width: 100%;
    background: #0f0f27;
    // .detail_content_top {
    //     height: 380px;
    // }
    .detail_content_img {
        margin-top: 30px;
        padding: 0px 57px;
        box-sizing: border-box;
        width: 100%;
        height: 260px;
        border-radius: 30px;
        margin-bottom: 20px;
    }
    .detail_content_one {
        width: 100%;
        padding: 0px 128px;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        margin-bottom: 16px;
        .detail_content_point {
            display: flex;
            .detail_content_point_img {
                width: 18px;
                height: 18px;
                margin-right: 2px;
            }
            .detail_content_point_number {
                font-size: 12px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #939599;
            }
        }
        .detail_content_share {
            display: flex;
            // margin-left: 41px;
            .detail_content_share_img {
                width: 18px;
                height: 18px;
                margin-right: 2px;
            }
            .detail_content_share_con {
                font-size: 12px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #939599;
            }
        }
    }
    .detail_content_title_one {
        padding: 0 20px;
        box-sizing: border-box;
        font-size: 18px;
        // margin-top: -25px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #ffffff;
        line-height: 24px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        margin-bottom: 12px;
        text-align: center;
    }
    .detail_content_title {
        padding: 0 20px;
        box-sizing: border-box;
        font-size: 18px;
        margin-top: 25px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #ffffff;
        line-height: 24px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        margin-bottom: 12px;
        text-align: center;
    }
    .item_number {
        padding: 0 117px;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        font-size: 10px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #28b6ff;
        margin-bottom: 20px;
        .item_number_collection {
            width: 54px;
            height: 18px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            line-height: 18px;
            text-align: center;
        }
        .item_number_number {
            width: 77px;
            height: 18px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            line-height: 18px;
            text-align: center;
        }
    }
    .limited_label {
        // padding: 0px 108px;
        // box-sizing: border-box;
        margin-bottom: 20px;
        display: flex;
        justify-content: center;
        .limited_label_con {
            display: flex;
            margin-right: 10px;
        }
        .limited_label_name {
            width: 44px;
            height: 18px;
            background: #28b6ff;
            border-radius: 4px 0px 0px 4px;
            font-size: 10px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #ffffff;
            text-align: center;
            line-height: 18px;
        }
        .limited_label_number {
            // width: 51px;
            height: 18px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 0px 4px 4px 0px;
            padding: 0px 12px;
            box-sizing: border-box;
            font-size: 10px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #28b6ff;
            line-height: 18px;
            text-align: center;
            // margin-right: 10px;
        }
        .limited_label_collection {
            width: 54px;
            height: 18px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            font-size: 10px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #28b6ff;
            line-height: 18px;
            text-align: center;
        }
    }
    .self_information {
        padding: 0 10px;
        padding-bottom: 53px;
        box-sizing: border-box;
        .display_price {
            width: 100%;
            height: 56px;
            background: #29293f;
            border-radius: 8px;
            padding-left: 10px;
            box-sizing: border-box;
            display: flex;
            margin-bottom: 10px;
            .display_price_left {
                font-size: 12px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #939599;
                padding-top: 28px;
                box-sizing: border-box;
                margin-right: 4px;
            }
            .display_price_right {
                display: flex;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #ffffff;
                .display_price_right_symbol {
                    font-size: 14px;
                    padding-top: 27px;
                    box-sizing: border-box;
                }
                .display_price_right_number {
                    font-size: 26px;
                    padding-top: 15px;
                    box-sizing: border-box;
                }
            }
        }
        .self_information_one {
            padding: 12px 10px;
            box-sizing: border-box;
            background: #29293f;
            border-radius: 8px;
            margin-bottom: 10px;
            display: flex;
            justify-content: space-between;
            position: relative;
            .self_information_one_con {
                // width: 50%;
                display: flex;
                .self_information_one_text {
                    font-size: 12px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    margin-left: 6px;
                }
                .self_information_one_text_one {
                    color: #ffffff;
                }
                .self_information_one_text_two {
                    color: #939599;
                }
            }
            .split_line {
                position: absolute;
                left: 48%;
                top: 12px;
                width: 1px;
                height: 34px;
                background: rgba(95, 100, 111, 0.2);
                // opacity: 0.2;
                // border: 1px solid #5F646F;
                // box-sizing: border-box;
            }
        }
        .description_of_works {
            width: 100%;
            background: #29293f;
            border-radius: 8px;
            padding: 10px;
            box-sizing: border-box;
            .description_of_works_title {
                font-size: 14px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #ffffff;
                margin-bottom: 10px;
            }
            .description_of_works_text {
                font-size: 14px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #939599;
                line-height: 20px;
                margin-bottom: 10px;
            }
            .description_of_works_img {
                width: 100%;
                height: 489px;
                border-radius: 8px;
            }
        }
        .hold_privileges {
            background: #29293f;
            border-radius: 8px;
            padding: 10px;
            box-sizing: border-box;
            margin: 10px 0;
            .hold_privileges_title {
                font-size: 14px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #ffffff;
            }
            .hold_privileges_list {
                .hold_privileges_list_con {
                    display: flex;
                    padding: 10px 0px;
                    border-bottom: 1px solid #5f646f;
                    box-sizing: border-box;
                    .hold_privileges_list_con_one {
                        overflow: hidden;
                        text-overflow: ellipsis;
                        white-space: nowrap;
                        flex: 1;
                        font-size: 12px;
                        font-family: PingFangSC-Regular, PingFang SC;
                        font-weight: 400;
                        color: #939599;
                        margin-left: 20px;
                        line-height: 37px;
                        margin-right: 10px;
                        // text-align: center;
                    }
                    .hold_privileges_list_con_one {
                        margin-left: 0;
                    }
                    .text3 {
                        flex: 2;
                    }
                    .text4 {
                        flex: 2;
                    }
                }
                .hold_privileges_list_con:last-child {
                    padding-bottom: 0;
                    border-bottom: none;
                }
            }
            .hold_privileges_tip {
                font-size: 12px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #939599;
                margin-left: 6px;
            }
            .hold_privileges_name {
                margin-top: 10px;
                font-size: 14px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #939599;
            }
        }
        .hold_privileges:last-child {
            margin-bottom: 30px;
            .textName {
                color: #939599;
                margin-top: 10px;
                // text-align: center;
            }
        }
        .transaction_record_one {
            display: flex;
            justify-content: space-between;
            margin: 10px 0;
            font-size: 12px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #939599;
            .user_information {
                margin-right: 20px;
            }
        }
        .transaction_record_two {
            margin-bottom: 0;
            .selling_price {
                margin-right: 32px;
            }
        }
    }
    .hold_privileged_information {
        display: flex;
        flex-wrap: wrap;
        margin-top: 10px;
        .hold_privileged_information_con {
            width: 94px;
            height: 24px;
            background: #28b6ff;
            border-radius: 4px;
            margin-right: 26px;
            margin-bottom: 10px;
            display: flex;
            .hold_privileged_information_con_img {
                width: 18px;
                height: 18px;
                margin-right: 3px;
                padding-top: 6px;
                margin-left: 12px;
                box-sizing: border-box;
            }
            .hold_privileged_information_con_title {
                width: 100%;
                padding-top: 3px;
                box-sizing: border-box;
                font-size: 12px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #ffffff;
                text-align: center;
            }
        }
        .hold_privileged_information_con:nth-of-type(3n) {
            margin-right: 0;
        }
    }
    .digital_equity_card {
        margin-top: 10px;
        .digital_equity_card_con {
            width: 100%;
            height: 24px;
            border-radius: 4px;
            border: 1px solid #28b6ff;
            padding-left: 10px;
            box-sizing: border-box;
            line-height: 23px;
            font-size: 12px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            margin-bottom: 10px;
            .digital_equity_card_con_one {
                color: #f5f7fa;
                margin-right: 12px;
            }
            .digital_equity_card_con_two {
                color: #28b6ff;
            }
        }
        .digital_equity_card_con:last-child {
            margin-bottom: 0;
        }
    }
    @bottom: 6px;
    .transaction_button {
        width: 100%;
        background: #15152d;
        padding: 0 16px;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        position: fixed;
        bottom: 0;
        padding-bottom: calc(@bottom+ constant(safe-area-inset-bottom));
        padding-bottom: calc(@bottom + env(safe-area-inset-bottom));
        .transaction_button_left {
            display: flex;
            .transaction_price {
                padding: 18px 0 12px 12px;
                box-sizing: border-box;
                font-size: 26px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #ffffff;
                position: relative;
                margin-right: 4px;
                .amount_symbol {
                    font-size: 14px;
                    position: absolute;
                    bottom: 16px;
                    left: 0px;
                }
            }
            .transaction_tax {
                padding: 31px 0 12px 0;
                box-sizing: border-box;
                font-size: 12px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #949699;
                .transaction_tax_con {
                    color: #ffffff;
                }
            }
        }
        .transaction_button_right {
            padding-top: 10px;
            box-sizing: border-box;
            .sold_out {
                width: 160px;
                height: 46px;
                background: #29293f;
                border-radius: 8px;
                font-size: 16px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #939599;
                line-height: 46px;
                text-align: center;
            }
            .coming_on_sale {
                width: 160px;
                height: 46px;
                background: #29293f;
                border-radius: 8px;
                padding-top: 6px;
                box-sizing: border-box;
                text-align: center;
                .coming_on_sale_con {
                    font-size: 14px;
                    font-family: PingFangSC-Medium, PingFang SC;
                    font-weight: 500;
                    color: #939599;
                }
                .coming_on_sale_time {
                    font-size: 10px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #939599;
                }
            }
            .buy_now {
                width: 160px;
                height: 46px;
                background: #28b6ff;
                border-radius: 8px;
                padding-top: 6px;
                box-sizing: border-box;
                text-align: center;
                .buy_now_con {
                    font-size: 14px;
                    font-family: PingFangSC-Medium, PingFang SC;
                    font-weight: 500;
                    color: #ffffff;
                }
                .purchase_sold {
                    font-size: 10px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #f5f7fa;
                    margin-right: 12px;
                }
                .Purchase_surplus {
                    font-size: 10px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #f5f7fa;
                }
            }
        }
    }
    .purchase_transaction_button {
        width: 100%;
        height: 56px;
        background: #15152d;
        position: fixed;
        bottom: 0;
        padding: 8px 16px;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        font-size: 16px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        .purchase_transaction_button_give {
            width: 80px;
            height: 40px;
            border-radius: 8px;
            border: 1px solid #28b6ff;
            box-sizing: border-box;
            color: #28b6ff;
            line-height: 38px;
            text-align: center;
        }
        .purchase_transaction_button_right {
            display: flex;
        }
        .public_display {
            width: 126px;
            height: 40px;
            border-radius: 8px 0px 0px 8px;
            border: 1px solid #28b6ff;
            box-sizing: border-box;
            color: #28b6ff;
            line-height: 38px;
            text-align: center;
        }
        .purchase_transaction_button_deposit {
            width: 126px;
            height: 40px;
            background: #28b6ff;
            border-radius: 0px 8px 8px 0px;
            color: #ffffff;
            line-height: 40px;
            text-align: center;
        }
    }
    .show_only {
        width: 100%;
        height: 56px;
        background: #15152d;
        padding: 8px 16px;
        box-sizing: border-box;
        position: fixed;
        bottom: 0;
        padding-bottom: calc(@bottom+ constant(safe-area-inset-bottom));
        padding-bottom: calc(@bottom + env(safe-area-inset-bottom));
        .show_only_con {
            width: 100%;
            height: 40px;
            background: #29293f;
            border-radius: 8px;
            font-size: 16px;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: #939599;
            line-height: 40px;
            text-align: center;
        }
    }
}
</style>
