<template>
  <div class="ReleaseAndOccStock">
    <div class='ReleaseAndOccStockContent'>
        <div class='ReleaseStockContent'>
            <div class="conditionContent">
                <div class="itemContent">
                    <div class="itemLabel">
                        平台单号
                    </div>
                    <Input
                        style="width:100%"
                        v-model="form1.tids"
                        placeholder=""
                        @on-enter='getReleaseStockList("search")'
                        clearable
                    />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                        订单编号
                    </div>
                    <Input
                        style="width:100%"
                        v-model="form1.orderIds"
                        placeholder=""
                        @on-enter='getReleaseStockList("search")'
                        clearable
                    />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    订单店铺
                    </div>
                    <DropMultiSelectFilter
                    ref="ShopId"
                    class="input_box"
                    :data="ShopIdList"
                    :default-selected="defaultSelectedShopId"
                    :total-row-count="ShopIdtotalRowCount"
                    :show-colname-key="'isak'"
                    :columns="columns"
                    :auto-data="ShopIdAutoData"
                    placeholder=" "
                    @on-page-change="changePageShop($event,'ShopId')"
                    @on-input-value-change="InputValueChangeShop($event,'ShopId')"
                    @on-popper-show="searchShopData('ShopId')"
                    @on-fkrp-selected="checkDataShop($event,'ShopId')"
                    @on-focus="focusInputValueChangeShop($event,'ShopId')"
                    @on-clear="clearDataShop('ShopId')"
                    />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    平台
                    </div>
                    <Select style="width:100%" multiple transfer v-model="form1.pltIds" placeholder="" filterable clearable :disabled="disabled" @on-change="selectPlatform" @on-clear="selectPlatform"  @on-query-change="getPlatformList">
                        <Option v-for="item in platformList" :value="item.value" :key="item.value">{{ item.label }}</Option>
                    </Select>
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    发货仓库
                    </div>
                    <DropMultiSelectFilter
                        ref="warehouse"
                        class="input_box"
                        :data="warehouseList"
                        :default-selected="defaultSelectedwarehouse"
                        :total-row-count="warehousetotalRowCount"
                        :show-colname-key="'isak'"
                        :columns="columns"
                        :auto-data="warehouseAutoData"
                        placeholder=" "
                        @on-page-change="changePageShop($event,'warehouse')"
                        @on-input-value-change="InputValueChangeShop($event,'warehouse')"
                        @on-popper-show="searchShopData('warehouse')"
                        @on-fkrp-selected="checkDataShop($event,'warehouse')"
                        @on-focus="focusInputValueChangeShop($event,'warehouse')"
                        @on-clear="clearDataShop('warehouse')"
                        />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    所属SKU
                    </div>
                    <Input
                    style="width:100%"
                    v-model="form1.skus"
                    placeholder=""
                    @on-enter='getReleaseStockList("search")'
                    clearable
                    />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    下单时间
                    </div>
                    <DatePicker
                        type="datetimerange"
                        format="yyyy-MM-dd HH:mm:ss"
                        placeholder=""
                        style="width: 100%"
                        v-model="datetimerange1"
                        @on-change="changeCreatedtime1"
                    />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    物流公司
                    </div>
                    <DropMultiSelectFilter
                    ref="Express"
                    class="input_box"
                    :data="ExpressList"
                    :default-selected="defaultSelected"
                    :total-row-count="ExpresstotalRowCount"
                    :show-colname-key="'isak'"
                    :columns="columns"
                    :auto-data="ExpressAutoData"
                    placeholder=" "
                    @on-page-change="changePageShop($event,'Express')"
                    @on-input-value-change="InputValueChangeShop($event,'Express')"
                    @on-popper-show="searchShopData('Express')"
                    @on-fkrp-selected="checkDataShop($event,'Express')"
                    @on-focus="focusInputValueChangeShop($event,'Express')"
                    @on-clear="clearDataShop('Express')"
                    />
                </div>
            </div>
            <div class='searchBtnBox'>
                <el-button
                    class="submit"
                    type="primary"
                    size="small"
                    @click="getReleaseStockList"
                >
                    查询
                </el-button>
                <el-button
                    class="cancel"
                    type=""
                    size="small"
                    @click="resetForm1"
                >
                    重置
                </el-button>
            </div>
            <Table 
                :height="tableHeight" 
                :columns="releaseStockColumns" 
                :data="releaseStockData"
            ></Table>
            <div class="pageContent">
            <Page
                size="small"
                :current="ReleaseCurrentPage"
                show-elevator
                :total="totalRelease"
                show-total
                page-size='200'
                @on-change="changePageRelease"
                @on-page-size-change="changeSizeRelease"
            />
            <!-- show-sizer -->
            </div>
        </div>
        <div class='OccStockContent'>
            <div class="conditionContent">
                <div class="itemContent">
                    <div class="itemLabel">
                        平台单号
                    </div>
                    <Input
                        style="width:100%"
                        v-model="form2.tids"
                        placeholder=""
                        @on-enter='getReleaseStockList("search")'
                        clearable
                    />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                        订单编号
                    </div>
                    <Input
                        style="width:100%"
                        v-model="form2.orderIds"
                        placeholder=""
                        @on-enter='getReleaseStockList("search")'
                        clearable
                    />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    订单店铺
                    </div>
                    <DropMultiSelectFilter
                    ref="ShopId"
                    class="input_box"
                    :data="ShopIdList2"
                    :default-selected="defaultSelectedShopId2"
                    :total-row-count="ShopIdtotalRowCount2"
                    :show-colname-key="'isak'"
                    :columns="columns"
                    :auto-data="ShopIdAutoData2"
                    placeholder=" "
                    @on-page-change="changePageShop($event,'ShopId',2)"
                    @on-input-value-change="InputValueChangeShop($event,'ShopId',2)"
                    @on-popper-show="searchShopData('ShopId',2)"
                    @on-fkrp-selected="checkDataShop($event,'ShopId',2)"
                    @on-focus="focusInputValueChangeShop($event,'ShopId',2)"
                    @on-clear="clearDataShop('ShopId',2)"
                    />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    平台
                    </div>
                    <Select style="width:100%" multiple transfer v-model="form2.pltIds" placeholder="" filterable clearable :disabled="disabled" @on-change="selectPlatform" @on-clear="selectPlatform"  @on-query-change="getPlatformList">
                        <Option v-for="item in platformList" :value="item.value" :key="item.value">{{ item.label }}</Option>
                    </Select>
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    发货仓库
                    </div>
                    <DropMultiSelectFilter
                        ref="warehouse"
                        class="input_box"
                        :data="warehouseList2"
                        :default-selected="defaultSelectedwarehouse2"
                        :total-row-count="warehousetotalRowCount2"
                        :show-colname-key="'isak'"
                        :columns="columns"
                        :auto-data="warehouseAutoData2"
                        placeholder=" "
                        @on-page-change="changePageShop($event,'warehouse',2)"
                        @on-input-value-change="InputValueChangeShop($event,'warehouse',2)"
                        @on-popper-show="searchShopData('warehouse',2)"
                        @on-fkrp-selected="checkDataShop($event,'warehouse',2)"
                        @on-focus="focusInputValueChangeShop($event,'warehouse',2)"
                        @on-clear="clearDataShop('warehouse',2)"
                        />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    所属SKU
                    </div>
                    <Input
                    style="width:100%"
                    v-model="form2.skus"
                    placeholder=""
                    @on-enter='getReleaseStockList("search")'
                    clearable
                    />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    下单时间
                    </div>
                    <DatePicker
                        type="datetimerange"
                        format="yyyy-MM-dd HH:mm:ss"
                        placeholder=""
                        style="width: 100%"
                        v-model="datetimerange2"
                        @on-change="changeCreatedtime2"
                    />
                </div>
                <div class="itemContent">
                    <div class="itemLabel">
                    物流公司
                    </div>
                    <DropMultiSelectFilter
                    ref="Express"
                    class="input_box"
                    :data="ExpressList2"
                    :default-selected="defaultSelected2"
                    :total-row-count="ExpresstotalRowCount2"
                    :show-colname-key="'isak'"
                    :columns="columns"
                    :auto-data="ExpressAutoData2"
                    placeholder=" "
                    @on-page-change="changePageShop($event,'Express',2)"
                    @on-input-value-change="InputValueChangeShop($event,'Express',2)"
                    @on-popper-show="searchShopData('Express',2)"
                    @on-fkrp-selected="checkDataShop($event,'Express',2)"
                    @on-focus="focusInputValueChangeShop($event,'Express',2)"
                    @on-clear="clearDataShop('Express',2)"
                    />
                </div>
            </div>
            <div class='searchBtnBox'>
                <el-button
                    class="submit"
                    type="primary"
                    size="small"
                    @click="getOccStockList"
                >
                    查询
                </el-button>
                <el-button
                    class="cancel"
                    type=""
                    size="small"
                    @click="resetForm2"
                >
                    重置
                </el-button>
            </div>
            <Table 
                :height="tableHeight" 
                :columns="releaseStockColumns" 
                :data="occStockData"
            ></Table>
            <div class="pageContent">
            <Page
                size="small"
                :current="ReleaseCurrentPage2"
                show-elevator
                :total="totalRelease2"
                show-total
                page-size='200'
                @on-change="changePageRelease2"
                @on-page-size-change="changeSizeRelease2"
            />
            <!-- show-sizer -->
            </div>
        </div>
    </div>
    <div class='footerContent'>
        <footer style="display: flex; justify-content: center; padding-top: 16px;border-top: 1px solid #DEDEDE;;">
            <Button
            type="posdefault"
            @click="okReleaseAndOcc()"
            >
            确定
            </Button>
            <Button
            type="fcdefault"
            style="margin-left: 16px"
            @click="cancel"
            >
            取消
            </Button>
        </footer>
    </div>
  </div>
</template>

<script>
  const R3 = window.R3;
  const { network, urlSearchParams, store } = R3;
  export default {
    data() {
      return {
        releaseStockColumns: [ //释放占单
            {
                type: 'index',
                align: 'center',
                title: '序号',
            },
            {
                title: '平台单号',
                align: 'center',
                key: 'tid'
            },
            {
                title: '订单编号',
                align: 'center',
                key: 'orderId'
            },
            {
                title: '订单店铺',
                align: 'center',
                key: 'shoptitle'
            },
            {
                title: '平台',
                align: 'center',
                key: 'platformname'
            },
            {
                title: '发货仓库',
                align: 'center',
                key: 'warehousename'
            },
            {
                title: '所属SKU',
                align: 'center',
                key: 'allsku'
            },
            {
                title: '下单时间',
                align: 'center',
                key: 'orderdate'
            },
            {
                title: '物流公司',
                align: 'center',
                key: 'shippername'
            },
            {
            title: '操作',
            key: 'action',
            fixed: 'right',
            width: 100,
            align: 'center',
            render: (h, params) => {
              const vm = this;
              return h('div', [
                h('a', {
                  attrs:{
                    class:'deleteBtnText'
                  },
                  on: {
                    click: () => {
                      this.deleteTable(params.row,params.index);
                    }
                  }
                },'删除' )
              ]);
            }
          }
        ],
        releaseStockData: [],
        occStockData: [],

        platformList:[],
        shopList:[],
        // 发货仓库参数
        warehouseList: {}, // 发货仓库下拉展示数据
        warehousetotalRowCount: 0,
        warehousecurrentIndex: 0, // 发货仓库搜索初始index
        columns: ['name', 'value'], // 展现的组
        warehouseAutoData: [], // 发货仓库模糊搜索的结果组

        // 占单发货仓库参数
        warehouseList2: {}, // 发货仓库下拉展示数据
        warehousetotalRowCount2: 0,
        warehousecurrentIndex2: 0, // 发货仓库搜索初始index
        warehouseAutoData2: [], // 发货仓库模糊搜索的结果组

        // 下单店铺参数
        ShopIdList: {}, // 下单店铺下拉展示数据
        ShopIdtotalRowCount: 0,
        ShopIdcurrentIndex: 0, // 下单店铺搜索初始index
        ShopIdAutoData: [], // 下单店铺模糊搜索的结果组

        // 占单下单店铺参数
        ShopIdList2: {}, // 下单店铺下拉展示数据
        ShopIdtotalRowCount2: 0,
        ShopIdcurrentIndex2: 0, // 下单店铺搜索初始index
        ShopIdAutoData2: [], // 下单店铺模糊搜索的结果组

        // 物流公司参数
        ExpressList: {}, // 物流公司下拉展示数据
        ExpresstotalRowCount: 0,
        ExpresscurrentIndex: 0, // 物流公司搜索初始index
        ExpressAutoData: [], // 物流公司模糊搜索的结果组

        // 占单物流公司参数
        ExpressList2: {}, // 物流公司下拉展示数据
        ExpresstotalRowCount2: 0,
        ExpresscurrentIndex2: 0, // 物流公司搜索初始index
        ExpressAutoData2: [], // 物流公司模糊搜索的结果组
        form1: {
            tids: '',
            orderIds: '',
            shopIds: [],
            warehouseIds: [],
            skus: '',
            orderDateStart: '',
            orderDateEnd: '',
            pltIds: [],
            logisticIds: []
        },
        form2: {
            tids: '',
            orderIds: '',
            shopIds: [],
            warehouseIds: [],
            skus: '',
            orderDateStart: '',
            orderDateEnd: '',
            pltIds: [],
            logisticIds: []
        },

        tableHeight: '520px', // 表格高度

        // 释放列表
        totalRelease: 0, // 总条数
        pageSizeRelease: 200, // 每页的条数
        ReleaseCurrentPage: 1,

        //占单列表
        totalRelease2: 0, // 总条数
        pageSizeRelease2: 200, // 每页的条数
        ReleaseCurrentPage2: 1,
      };
    },
    created() {
        this.getPlatformList(); //获取平台列表
        this.getShopList(); // 获取店铺列表
        this.getReleaseStockList();
        this.getOccStockList();
    },
    methods: {
        resetForm1() {
            this.form1 = {
                tids: '',
                orderIds: '',
                shopIds: [],
                warehouseIds: [],
                skus: '',
                orderDateStart: '',
                orderDateEnd: '',
                pltIds: [],
                logisticIds: []
            }
            this.defaultSelectedShopId = [];
            this.defaultSelectedwarehouse=[];
            this.defaultSelected=[]
            this.datetimerange1 = ''
            this.getReleaseStockList();
        },
        resetForm2() {
            this.form2 = {
                tids: '',
                orderIds: '',
                shopIds: [],
                warehouseIds: [],
                skus: '',
                orderDateStart: '',
                orderDateEnd: '',
                pltIds: [],
                logisticIds: []
            }
            this.defaultSelectedShopId2 = [];
            this.defaultSelectedwarehouse2=[];
            this.defaultSelected2=[]
            this.datetimerange2 = ''
            this.getOccStockList();
        },
        getPlatformList(query){
            let virtual={
                fixedcolumns: query?{PLATFORMNAME:query}:{},
                range: 1000,
                startindex: 0,
                table: 'T_V_OMSPLATFORM' 
            }
            network.post('/p/cs/list/query', virtual).then((res) => {
                this.platformList= res.data.rows.map(i=>{
                    return {
                        label:i.PLATFORMNAME.val,
                        value:i.ID.val
                    }
                })
            })
        },
        getShopList(){
            let virtual={
                fixedcolumns: {},
                range: 1000,
                startindex: 0,
                table: 'T_IESSHOP' 
            }
            network.post('/p/cs/list/query', virtual).then((res) => {
                this.shopList= res.data.rows.map(i=>{
                    return {
                        label:i.SHOPTITLE.val,
                        value:i.ID.val
                    }
                })
            })
        },
        getReleaseStockList() { // 获取执行释放占单的订单
            let params = {
                page: this.ReleaseCurrentPage, 
                size: this.pageSizeRelease,
                fixedcolumns: {
                    type: 0,
                    tids: this.form1.tids?(this.form1.tids.replace(/\s/g,",")).split(',').filter(function(n){return n}):[],
                    orderIds: this.form1.orderIds?(this.form1.orderIds.replace(/\s/g,",")).split(',').filter(function(n){return n}):[],
                    shopIds: this.form1.shopIds,
                    pltIds: this.form1.pltIds,
                    warehouseIds: this.form1.warehouseIds,
                    skus: this.form1.skus?(this.form1.skus.replace(/\s/g,",")).split(',').filter(function(n){return n}):[],
                    orderDateStart:this.form1.orderDateStart,
                    orderDateEnd:this.form1.orderDateEnd,
                    logisticIds:this.form1.logisticIds
                }
            }
            network.post('/p/cs/order/stock/release/occ/list',params).then(res => {
                if(res.data.code == 0) {
                    this.releaseStockData = res.data.data.rows
                    this.releaseStockData.forEach(item1 => {
                        item1.type = 'release'
                    })
                    this.totalRelease =res.data.data.totalRowCount
                }
            })
        },
        getOccStockList() {
            let params = {
                page: this.ReleaseCurrentPage2, 
                size: this.pageSizeRelease2,
                fixedcolumns: {
                    type: 1,
                    tids: this.form2.tids?(this.form2.tids.replace(/\s/g,",")).split(',').filter(function(n){return n}):[],
                    orderIds: this.form2.orderIds?(this.form2.orderIds.replace(/\s/g,",")).split(',').filter(function(n){return n}):[],
                    shopIds: this.form2.shopIds,
                    pltIds: this.form2.pltIds,
                    warehouseIds: this.form2.warehouseIds,
                    skus: this.form2.skus?(this.form2.skus.replace(/\s/g,",")).split(',').filter(function(n){return n}):[],
                    orderDateStart:this.form2.orderDateStart,
                    orderDateEnd:this.form2.orderDateEnd,
                    logisticIds:this.form2.logisticIds
                }
            }
            network.post('/p/cs/order/stock/release/occ/list',params).then(res => {
                if(res.data.code == 0) {
                    this.occStockData = res.data.data.rows
                    this.occStockData.forEach(item1 => {
                        item1.type = 'occ'
                    })
                    this.totalRelease2 =res.data.data.totalRowCount
                }
            })
        },

        // 选择入库单弹框中的筛选下拉框数据start
        // 单选下拉分页改变
        changePageShop(e,type,typeOne) {
            if (type == 'warehouse') {
                if(typeOne == 2){
                    this.warehousecurrentIndex2 = (e - 1) * 10;
                }else {
                    this.warehousecurrentIndex = (e - 1) * 10;
                }
                this.searchShopData(type,typeOne);
            } else if (type == 'Express') {
                if(typeOne == 2){
                    this.ExpresscurrentIndex2 = (e - 1) * 10;
                }else {
                    this.ExpresscurrentIndex = (e - 1) * 10;
                }
                this.searchShopData(type,typeOne);
            } else if (type == 'ShopId') {
                if(typeOne == 2){
                    this.ShopIdcurrentIndex2 = (e - 1) * 10;
                }else {
                    this.ShopIdcurrentIndex = (e - 1) * 10;
                }
                this.searchShopData(type,typeOne);
            }
        },
        // 外键下拉框
        searchShopData(type,typeOne) {
            let virtual = {};
            if (type === 'warehouse') {
                virtual = {
                    searchdata: {
                        isdroplistsearch: true,
                        refcolid: 196275,
                        startindex: typeOne==2?this.warehousecurrentIndex2:this.warehousecurrentIndex,
                        range: 10
                    }
                };
            } else if (type == 'Express') {
                virtual = {
                    searchdata: {
                        isdroplistsearch: true,
                        refcolid: 196700,
                        startindex: typeOne==2?this.ExpresscurrentIndex2:this.ExpresscurrentIndex2,
                        range: 10,
                    }
                };
            } else if (type == 'ShopId') {
                virtual = {
                    searchdata: {
                        isdroplistsearch: true,
                        refcolid: 194851,
                        startindex: typeOne==2?this.ShopIdcurrentIndex2:this.ShopIdcurrentIndex,
                        range: 10,
                    }
                };
            }
            network.post('/p/cs/QueryList', urlSearchParams(virtual)).then((res) => {
                if (res.data.code == 0) {
                    if (type === 'warehouse') {
                        if(typeOne == 2){
                            this.warehousetotalRowCount2 = res.data.data.totalRowCount;
                            this.warehouseList2 = res.data.data;
                            this.warehousecurrentIndex2 = 0;
                        }else {
                            this.warehousetotalRowCount = res.data.data.totalRowCount;
                            this.warehouseList = res.data.data;
                            this.warehousecurrentIndex = 0;
                        }
                    }else if(type == 'Express') {
                        if(typeOne == 2){
                            this.ExpresstotalRowCount2 = res.data.data.totalRowCount;
                            this.ExpressList2 = res.data.data;
                            this.ExpresscurrentIndex2 = 0;
                        }else {
                            this.ExpresstotalRowCount = res.data.data.totalRowCount;
                            this.ExpressList = res.data.data;
                            this.ExpresscurrentIndex = 0;
                        }
                    }else if(type == 'ShopId') {
                        if(typeOne == 2){
                            this.ShopIdtotalRowCount2 = res.data.data.totalRowCount;
                            this.ShopIdList2 = res.data.data;
                            this.ShopIdcurrentIndex2 = 0;
                        }else {
                            this.ShopIdtotalRowCount = res.data.data.totalRowCount;
                            this.ShopIdList = res.data.data;
                            this.ShopIdcurrentIndex = 0;
                        }
                    }
                }
            });
        },
        // 单选下拉模糊搜索数据
        InputValueChangeShop(e,type,typeOne) {
            let virtual = {};
            if (type === 'warehouse') {
                virtual = {
                    ak: e,
                    colid: 196275,
                    fixedcolumns: {}
                };
            } else if (type === 'Express') {
                virtual = {
                    ak: e,
                    colid: 196700,
                    fixedcolumns: {}
                };
            } else if (type === 'ShopId') {
                virtual = {
                    ak: e,
                    colid: 194851,
                    fixedcolumns: {}
                };
            }
            network.post('/p/cs/fuzzyquerybyak', urlSearchParams(virtual)).then((res) => {
                if (res.data.code == 0) {
                    let list = [];
                    res.data.data.forEach(item => {
                        let obj = {
                            value: item.value,
                            id: item.id
                        };
                        list.push(obj);
                    });
                    if (type === 'warehouse') {
                        if(typeOne == 2){
                            this.warehouseAutoData2 = list;
                        }else {
                            this.warehouseAutoData = list;
                        }
                    } else if (type === 'Express') {
                        if(typeOne == 2){
                            this.ExpressAutoData2 = list;
                        }else {
                            this.ExpressAutoData = list;
                        }
                    } else if (type === 'ShopId') {
                        if(typeOne == 2){
                            this.ShopIdAutoData2 = list;
                        }else {
                            this.ShopIdAutoData = list;
                        }
                    }
                }
            });
        },
        // 外键下拉框搜索
        focusInputValueChangeShop(e,type,typeOne) {
            let virtual = {};
            if (type === 'warehouse') {
                virtual = {
                    ak: e.target.value,
                    colid: 196275,
                    fixedcolumns: {}
                };
            } else if (type === 'Express') {
                virtual = {
                    ak: e.target.value,
                    colid: 196700,
                    fixedcolumns: {}
                };
            } else if (type === 'ShopId') {
                virtual = {
                    ak: e.target.value,
                    colid: 194851,
                    fixedcolumns: {}
                };
            }
            network.post('/p/cs/fuzzyquerybyak', urlSearchParams(virtual)).then((res) => {
            if (res.data.code == 0) {
                let list = [];
                res.data.data.forEach(item => {
                    let obj = {
                        value: item.value,
                        id: item.id
                    };
                    list.push(obj);
                });
                if (type === 'warehouse') {
                    if(typeOne == 2){
                        this.warehouseAutoData2 = list;
                    }else {
                        this.warehouseAutoData = list;
                    }
                } else if (type === 'Express') {
                    if(typeOne == 2){
                        this.ExpressAutoData2 = list;
                    }else {
                        this.ExpressAutoData = list;
                    }
                } else if (type === 'ShopId') {
                    if(typeOne == 2){
                        this.ShopIdAutoData2 = list;
                    }else {
                        this.ShopIdAutoData = list;
                    }
                }
            }
            });
        },
        // 单选下拉选中
        checkDataShop(val,type,typeOne) {
            let list = [];
            val.forEach(item => {
                list.push(item.ID)
            })
            if (type == 'warehouse') {
                if(typeOne == 2){
                    this.form2.warehouseIds = list;
                }else {
                    this.form1.warehouseIds = list;
                }
            } else if (type === 'Express') {
                if(typeOne == 2){
                    this.form2.logisticIds = list;
                }else {
                    this.form1.logisticIds = list;
                }
            } else if (type === 'ShopId') {
                if(typeOne == 2){
                    this.form2.shopIds = list;
                }else {
                    this.form1.shopIds = list;
                }
            }
        },
        clearDataShop(type,typeOne) {
            this.scanInStorageOrderMsg.expressName = [];
            if (type == 'warehouse') {
                if(typeOne == 2){
                    this.form2.warehouseIds = [];
                }else {
                    this.form1.warehouseIds = [];
                }
            } else if (type === 'Express') {
                if(typeOne == 2){
                    this.form2.logisticIds = [];
                }else {
                    this.form1.logisticIds = [];
                }
            } else if (type === 'ShopId') {
                if(typeOne == 2){
                    this.form2.shopIds = [];
                }else {
                    this.form1.shopIds = [];
                }
            }
        },
        // 选择入库单弹框中的筛选下拉框数据end 

        changeCreatedtime1(e) {
            this.form1.orderDateStart = e[0];
            this.form1.orderDateEnd = e[1];
        },

        changeCreatedtime2(e) {
            this.form2.orderDateStart = e[0];
            this.form2.orderDateEnd = e[1];
        },

        // 选择释放页码改变时触发
        changePageRelease(val) {
            // 1=>0 2=>10 3=>20 
            this.ReleaseCurrentPage = val;
            this.getReleaseStockList();
        },
        // 选择释放页数改变时触发
        changeSizeRelease(val) {
            this.pageSizeRelease = val;
            this.ReleaseCurrentPage = 1;
            this.getReleaseStockList();
        },
        // 选择占单页码改变时触发
        changePageRelease2(val) {
            // 1=>0 2=>10 3=>20 
            this.ReleaseCurrentPage2 = val;
            this.getOccStockList();
        },
        // 选择占单页数改变时触发
        changeSizeRelease2(val) {
            this.pageSizeRelease2 = val;
            this.ReleaseCurrentPage2 = 1;
            this.getOccStockList();
        },

        deleteTable(row,index) {
            if(row.type == 'release'){
                this.releaseStockData.splice(index, 1);
                this.totalRelease -= 1
            }else if(row.type == 'occ') {
                this.occStockData.splice(index, 1);
                this.totalRelease2 -= 1
            }
        },

        okReleaseAndOcc() {
            let release = [];
            let occ = [];
            this.releaseStockData.forEach(item => {
                release.push(item.orderId)
            })
            this.occStockData.forEach(item => {
                occ.push(item.orderId)
            })
            let params = {
                release,
                occ
            }
            network.post('/p/cs/order/stock/release/occ',params).then(res => {
                if(res.data.code == 0){
                    this.$Message.success(res.data.message);
                    this.cancel();
                }
            })
        },

        cancel(){
            const { fullPath } = this.$route;
            const {
                keepAliveModuleName,tableName
            } = this.$store.state.global.activeTab;
            this.$store.commit('global/tabCloseAppoint', {
                tableName,
                routeFullPath: fullPath,
                keepAliveModuleName,
                stopRouterPush: true,
            });
            // 跳转
            setTimeout(()=>{
                R3.store.commit('global/tabOpen', {
                    type: 'S',
                    tableName:'T_V_OMSONLINEORDER',
                    tableId:'10883',
                    back:true
                });
            },0)
        }
    }
  };
</script>

<style lang='less' scoped>
    .ReleaseAndOccStock {
        min-width: 1300px;
        height: 100%;
    }
    .ReleaseAndOccStockContent {
        display: flex;
        // height: calc(100% - 60px);
        .ReleaseStockContent {
            width: 50%;
            // height: 100%;
            padding-right:5px;
            border-right: 1px solid rgb(222, 222, 222);
        }
        .OccStockContent {
            width: 50%;
            height: 100%;
            padding-left:5px;
        }
    }
    .conditionContent {
      width: 100%;
      display: flex;
      max-height: 3000px;
      overflow: hidden;
      flex-wrap: wrap;
      padding-top: 8px;
      .itemContent {
        width: calc(100%  / 3);
        display: flex;
        align-items: center;
        margin: 0 0px 10px;
        .itemLabel {
          // min-width: 80px;
          width: 70px;
          font-size: 12px;
          font-weight: 500;
          color: #4C4C4C;
          line-height: 17px;
          margin-left: 8px;
        //   margin-right: 8px;
          text-align: left;
        }
        .posterType {
          width: calc(100% - 84px);
        }
      }
      #dropMultiSelectFilter {
        width: 100%;
      }
    }
    .pageContent {
        margin-top: 12px;
        margin-bottom: 12px;
        display: flex;
        justify-content: flex-end;
    }
    .searchBtnBox {
        margin-bottom: 12px;
        margin-right: 5px;
        display: flex;
        justify-content: flex-end;
    }
</style>
