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

        <view class="list-wrap">
            <ListBox v-if="detailItem.rating_code" leftTitle="评级部门" :rightTitle="detailItem.rating_department" />
            <ListBox v-if="detailItem.rating_code" leftTitle="评级编号" :rightTitle="detailItem.rating_code" />
            <ListBox v-if="detailItem.material" leftTitle="材质" :rightTitle="detailItem.material" />
            <ListBox v-if="detailItem.deal_with" leftTitle="处理" :rightTitle="detailItem.deal_with" />
            <ListBox v-if="detailItem.pay_for_level" leftTitle="赔付等级" :rightTitle="detailItem.pay_for_level" />
            <ListBox v-if="detailItem.grade" leftTitle="分数" :rightTitle="detailItem.grade" />
            <ListBox v-if="detailItem.size" leftTitle="尺寸" :rightTitle="detailItem.size" />
            <ListBox v-if="detailItem.remark" leftTitle="备注" :rightTitle="detailItem.remark" />
            <!-- 详情页面展示 -->
            <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: {},
            scan_code_detail:''
        }
    },
    watch: {
        scanCodeDetail(newVal, oldVal) {
            this.detailItem = {...newVal}//更新
        }
    },
	mounted(){
        if(this.scanCodeDetail && 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>