<template>
    <div class="LackSkuDetailTable">
        <Table 
        :height="tableHeight" 
        :columns="LackStockColumns" 
        :data="LackStockData"
        highlight-row
        ></Table>
    </div>
</template>
<script>
    const R3 = window.R3;
    const { network, urlSearchParams, store } = R3;
    export default {
        data() {
            return {
                tableHeight:'200',//表格高度
                LackStockColumns:[
                    {
                        title: '供货逻辑仓',
                        key: 'STORENAME',
                        align: 'center',
                    },
                    {
                        title: '可用库存',
                        key: 'QTYFEE',
                        align: 'center',
                    },
                ],
                LackStockData: [],
            }
        },
        created(){
            this.getLackStockDetail();
        },
        methods:{
            getLackStockDetail(){
                let params = {
                    table: 'T_RB_LACKSKUDETAIL',
                    startindex: 0,
                    range: 1000,
                    isdroplistsearch: true,
                    fixedcolumns: { ID: this.$route.params.itemId }
                };
                network.post('/p/cs/list/query',params).then(res => {
                    let ordershopid = res.data.rows[0].ORDERSHOPID.refobjid;
                    let ieswarehouseid = res.data.rows[0].IESWAREHOUSEID.refobjid;
                    let sku = res.data.rows[0].IESSKUID.val;
                    this.getLackStockList(ordershopid,ieswarehouseid,sku)
                })
            },
            getLackStockList(ordershopid,ieswarehouseid,sku) {
                let params = {
                    ordershopid,
                    ieswarehouseid,
                    sku
                }
                network.post('/p/cs/lackSkuDetail/query',params).then(res => {
                    if(res.data.code == 0){
                        this.LackStockData = res.data.data;
                    }
                })
            }
        }
    };
</script>
<style lang="less" scoped>
    .LackSkuDetailTable {
        margin: 16px;
    }
</style>