<<template>
    <view>
        <head-view :title="title"></head-view>
        <view class="content contentFixed">
			<view class="liBox">
				<view class="title">
					<text>提单信息</text>
				</view>
                <uni-table stripe emptyText="暂无更多数据">
						<!-- 表头行 -->
						<uni-tr>
							<uni-th width="10">序号</uni-th>
							<uni-th width="15">提单号</uni-th>
							<uni-th width="15">品牌</uni-th>
							<uni-th width="15">车型</uni-th>
							<uni-th width="15">车型明细</uni-th>
							<uni-th width="10">数量</uni-th>
							<uni-th width="18">场位</uni-th>
							<uni-th width="10">待装数量</uni-th>
						</uni-tr>
						<!-- 表格数据行 -->
						<uni-tr v-for="(item,index) in tableList" :key="index">
							<uni-td>{{index + 1}}</uni-td>
							<uni-td><text class="operate" @click="toDetails(item.spsId)">{{item.mnfBl}}</text></uni-td>
							<uni-td>{{item.brdName}}</uni-td>
							<uni-td>{{item.goodsTypeName}}</uni-td>
							<uni-td>{{item.bvdName}}</uni-td>
							<uni-td>{{item.amount}}</uni-td>
							<uni-td>{{item.yardPos}}</uni-td>
							<uni-td>{{item.readyLoadNum}}</uni-td>
						</uni-tr>
					</uni-table>
            </view>    
        </view>
    </view>
</template>

<script>
	import HeadInfo from '@/components/head-info/head-info';
    export default {
		data() {
			return {
               loginObj: {},
               title:'',
               objInfo:{},
               tableList:[]
            }
        },
        components: {
			HeadInfo
		},
        onLoad(options) {
			this.objInfo = JSON.parse(decodeURIComponent(options.params))
            this.loginObj = uni.getStorageSync('loginObj')
            this.title = this.objInfo.shipInfo.spmIdDesc + ' / ' + this.objInfo.shipInfo.vvyName + ' ' + this.objInfo.CW
			console.log(this.objInfo)
            this.getQueryBillOfLading()
		},
        methods: {
            // 获取提单号数据
            getQueryBillOfLading() {
                uni.request({
					url: `${this.$local}/api/loadShipCommand/queryBillOfLading?lwpId=${this.objInfo.id}`,
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
						'Authorization': `Bearer ${this.loginObj.access_token}`
					},
					method: 'GET', //请求方式，必须为大写
					success: (res) => {
						if (res.data.status == 200) {
							// console.log(res.data.data);
                            this.tableList = res.data.data
						}
					}
				})
            },
            toDetails(id) {
				let obj = {
					id: id,
					tradeName: "W",
					shipInfo: this.objInfo.shipInfo
				}
				const params = encodeURIComponent(JSON.stringify(obj));
				uni.navigateTo({
					url: '/pages/index/instructDetails?params=' + params
				})
			},

        }
    }
</script>

<style lang="less" scoped>
		.content {
			padding: 16px;
            .liBox {
				width: 100%;
				padding: 24px 16px 24px;
				background-color: #fff;
                .title {
					display: flex;
					margin-bottom: 20px;
                    font-size: 20px;
                    font-weight: 500;
                }
                .operate {
					color: #2979ff;
				}
            }
        }
</style>