<template>
    <navigation :title="title" :back-url="backUrl">
        <template #right>
            <my-link @tap="toMyTransport" style="font-size: 14px;">我的</my-link>
        </template>
    </navigation>
    <view class="contentBox">
        <!-- 仓库信息 - 仓库、存储区 -->
        <warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo"
            :pathParams="{ ...pathParams, type: 'transport' }" />
        <!-- 物料列表 - 添加物料 -->
        <material-list ref="materialRef" :formData="formData" isEdit="4" :backStr="transport"
            :pathParams="pathParams" />
        <!-- 底部操作栏 -->
        <view class="bottom">
            <uv-button @tap="scanCode">扫码添加</uv-button>
            <uv-button type="primary" @tap="submitForm">打卡</uv-button>
        </view>
    </view>
</template>

<script setup>

import _ from 'lodash';
import { ref } from 'vue';
import { objectToQuery, } from '../../until';

import { onLoad } from "@dcloudio/uni-app";
import MaterialList from '../../components/MaterialList.vue';
import WarehousingInfo from '../../components/WarehousingInfo.vue';
import Navigation from '../../components/Navigation.vue';
// const OPERATE_CONFIG = {
//     // 创建
//     transport: {
//         back: 'pages/warehousing/index',
//         title: '运输打卡'
//     },
//     // 编辑
//     transport_edit: {
//         back: '/pages/warehousing/stockIn/components/detail',
//         title: ''
//     },
// }
// 数据：路径参数
const pathParams = ref('')
// 标志：是否为编辑
const isEdit = ref('')

// ref：标题
const title = ref('运输打卡')
const backUrl = ref('pages/warehousing/index')
const formData = ref([{ remark: '', material: [] }])
// 数据：仓库信息
const warehouseInfo = ref({ warehousing: {}, storageArea: {}, remark: '' })

// 数据：获取缓存信息
const getMaterialList = () => {

}
getMaterialList();

// 扫码添加
const scanCode = () => {

};
const toMyTransport = () => {
    const query = objectToQuery(pathParams.value)
    uni.navigateTo({
        url: `/pages/warehousing/Transport/my${query}`
    });
}
// 提交表单
const submitForm = () => {

}

// 数据：路径参数
onLoad((options) => {
    pathParams.value = options

})

</script>

<style lang="scss" scoped>
.contentBox {
    background: #f5f5f5;
    min-height: 100vh;
}

/* 底部按钮 */
::v-deep .bottom {
    position: fixed;
    bottom: 0;
    height: 60rpx;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;

    .uv-button-wrapper {
        width: 50%;
        border-radius: 0;
    }

    .uv-button--info {
        background-color: #07c160;
        color: #fff;

    }
}
</style>