<template>
    <!-- -->
    <navigation title="我的运输打卡" :back-url="backUrl"></navigation>
    <view class="contentBox">
        <!-- 搜索框 -->
        <view class="topSearch">
            <uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :input-border="false"
                @icon-click="getList" placeholder="请输入搜索内容" />
        </view>
        <!-- 列表 -->
        <z-paging ref="pagingRef" class="containerBox" v-model="list" @query="getList">
            <uni-list class="listBox">
                <uni-list-item v-for="item in list" :key="item.id" clickable @tap="onDetail(item)">
                    <template v-slot:body>
                        <view style="display: flex; flex-direction: column; width: 100%;">
                            <view class="line title">
                                <p> 申报单号：{{ item.billNo }}</p>
                                <p>{{ getLabel(declareType, item?.status) }}</p>
                            </view>
                            <p class="line content">联系人：<text>{{ item?.contactName || '-' }}</text></p>
                            <p class="line content">联系电话：<text>{{ item?.contactPhone || '-' }}</text></p>
                            <p class="line content">地址:<text>{{ item?.address || '-' }}</text></p>
                            <p class="line content">申报时间： <text>{{ item?.createTime || '-' }}</text></p>
                        </view>
                    </template>
                </uni-list-item>
            </uni-list>
        </z-paging>
    </view>
</template>

<script setup>
import _ from 'lodash';
import { ref } from 'vue';
import { onShow, onLoad } from "@dcloudio/uni-app";
import Navigation from '../../components/Navigation.vue';
import { getLabel, declareType } from '../../until';

const OPERATE_CONFIG = {
    transport: {
        back: '/pages/warehousing/Transport/checkIn'
    },
    my: {
        back: 'pages/warehousing/index'
    },
}
const pagingRef = ref(null)
const list = ref([])
const backUrl = ref('')
const pathParams = ref('')
const queryParams = ref({ keyword: '' })

const onDetail = () => { }

const getList = (pageNo, pageSize) => {
    queryParams.value.pageNum = pageNo
}
// 数据：路径参数
onLoad(options => {
    pathParams.value = options;
    backUrl.value = OPERATE_CONFIG[options.type]?.back

})
onShow(() => {
    pagingRef.value?.reload?.()
})
</script>

<style scoped lang="scss">
/* 搜索框：放在导航栏下面，不覆盖 */
.topSearch {
    position: fixed;
    top: 65rpx;
    left: 0;
    right: 0;
    z-index: 99;
    padding: 8rpx 16rpx;
    background-color: #fff;
    border-bottom: 1px solid #eee;
    box-sizing: border-box;

}

.containerBox {
    padding-top: 125rpx !important;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

::v-deep .listBox {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background-color: #F8F8FF;

    .zp-l-text-rpx {
        font-size: 12px;
    }

    .uni-list--border-bottom {
        padding: 8px 12px 8px 15px;
    }

    .uni-list {
        background-color: #F8F8FF;
    }

    .uni-list-item {
        margin-bottom: 4rpx;
    }

    .line {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 0;
    }

    .title {
        justify-content: space-between;
        font-weight: 600;
        font-size: 13px;
    }

    .content {
        font-weight: 500;
        font-size: 13px;
        color: #696969;
    }
}
</style>