<template>
    <view class="coinsDetail-wrap">
        <!-- :visitorInfo="visitorInfo" -->
        <view style="margin-top: 20rpx;">
            <VisitorInfo :visitorInfo="detailItem"/>
        </view>

        <view class="list-wrap">
            <ListBox leftTitle="评级部门" :rightTitle="detailItem.rating_department" />
            <ListBox leftTitle="评级编号" :rightTitle="detailItem.rating_code" />
            <ListBox leftTitle="分数" :rightTitle="detailItem.grade" />
            <ListBox leftTitle="尺寸" :rightTitle="detailItem.size" />
            <!-- 详情页面展示 -->
            <ListBox v-if="id" leftTitle="操作人" :rightTitle="detailItem.operator" />
        </view>

    </view>
</template>
<script>
import ListBox from '@/components/listBox.vue';
import VisitorInfo from '@/components/visitorInfo.vue';

export default {
    name: "coinsDetail",
    props:['scanCodeDetail'],
    components: {
        VisitorInfo,
        ListBox
    },
    data() {
        return {
            visitorInfo: {},
            id:'',
            detailItem: {
                // "rating_agency_id": "1", //评级机构id
                // "coin_name": "机制光绪通宝", //名称
                // "rating_code": "1310684212", //评级编号
                // "rating_department": "北京公博二部", //评级部门
                // "grade": "AU 58", //分数
                // "size": "24.0*1.1mm,3.5g", //尺寸
                // "year": "1889", //年份
                // "format": "库平一钱满汉广", //版式
                // "ancient_coin_status": 0, //状态
                // "ancient_coin_status_desc": "未入库" //状态描述
            },
            scan_code_detail:''
        }
    },
    watch: {
        scanCodeDetail(newVal, oldVal) {
            // console.log('someProp changed:', newVal, 'from', oldVal);
            this.detailItem = {...newVal}//更新
        }
    },
	mounted(){
        if(Object.keys(this.scanCodeDetail).length > 0){
            this.detailItem = {...this.scanCodeDetail}
        }
	},
    onLoad(options) {
        // console.log(options,'this.$route.query-=',this.scanCodeDetail);
        const {id} = options;
            // 跳转详情页
        if(id){
            this.id = id;
            let detailItem = uni.getStorageSync('detail')
            if (detailItem)this.detailItem = JSON.parse(detailItem)
        }
        // else{
        //     // 扫描后的弹出框信息
        //     // scanCodeDetail props传参
        //     this.detailItem = {...this.scanCodeDetail}
        // }
    },
};
</script>
<style lang="scss" scoped>
.coinsDetail-wrap {
    .list-wrap {
        padding: 0 18rpx 20rpx 18rpx;;
    }
}
</style>