<template>
  <div class='AbnormalPriceMonitoreStrategy'>
    <div class="quickOperation">
      快捷操作：
      <Button
        type="fcdefault"
        style="margin-right:8px"
        @click="saveAll"
      >
        保存
      </Button>
      <!-- <Button type="fcdefault" style="margin-right:8px" @click="refreshParams">刷新</Button> -->
      <Button type="fcdefault"
      @click="backToList"
      >
        返回
      </Button>
    </div>
    <div class="content">
      <div
        v-for="(item,tabId) in tabList"
        :key="tabId"
        class="block"
      >
        <foldPanel
          v-model="item.blockShow"
          :title="item.tabtext"
          :explain="item.explainText"
        >
          <div
            slot="content"
            class="block"
          >
            <div class="item">
              <Row>
              <div
                v-for="(i,cindex) in tabList[tabId].list"
                :key="cindex"
                class="form"
              >
                <Col span="8" v-if="i.standard" >
                    <div
                      v-if="i.title"
                      :class="{'title':true,'order-setting-input-error':i.required}"
                    >{{ i.title }}
                     <Tooltip
                      max-width="200"
                      :content="i.explainContent"
                      placement="bottom"
                    >
                      <img
                      v-if="i.explain"
                      class="img-framelanflag"
                      src="../../../assets/icon/help.png"
                      >
                    </Tooltip>
                    </div>
                    <DatePicker :value="i.VALUE" v-if='i.SKEY=="strategyTimeRange"' type="datetimerange" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择时间" style="width: 100%;max-width:400px;min-width: 180px;" :transfer="transfer" :clearable="clearable" @on-change="rangeDate"></DatePicker>
                  <Select v-model="i.VALUE" :filterable="i.SKEY=='shop_name'?true:false" :clearable='i.clearable' :disabled="i.disabled" class="input_box" v-else-if="(i.SKEY=='shop_name')"  @on-query-change="checkInputSKU($event,i)">
                      <Option v-for="d in i.optionList" :value="d.value" :key="d.value">{{ d.label }}</Option>
                  </Select>
                  <Input
                    v-else-if="i.SKEY=='strategyName'"
                    class="input_box"
                    v-model="i.VALUE"
                    placeholder="请输入策略名称"
                    :disabled="i.disabled"
                    @on-keypress='noSpaces($event,i)'
                  />
                </Col>
              </div>
              </Row>
            </div>
          </div>
        </foldpanel>
      </div>
    </div>
    <foldPanel title="创建拣货单" explainStyle="font-size: 10px;margin-left: 4px;color: #555;" explain="(按时间点创建：按照设置的创建时间点自动创建；按未拣货数创建：达到设置的未拣货数峰值的PO自动创建)">
      <div slot="content" class="block">
        <div class="tableArea priceMonitor" v-if="showDetailTable">
              <Row style="display: flex;
                align-items: center;
                height: 48px;">
                <Col span="12">
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;">
                    <span style='color: red;'>*</span>拣货单创建方式</label>
                    <RadioGroup v-model="detail.PriceMonitoreDimension" @on-change="selectPriceMonitoreDimension" :disabled='REVIEW_STATUS == "Y"'>
                      <Radio label="1" :disabled='REVIEW_STATUS == "Y"'><span>按时间点创建</span></Radio>
                      <Radio label="2" :disabled='REVIEW_STATUS == "Y"'><span>按未拣货数创建</span></Radio>
                    </RadioGroup>
                  </div>
                </Col>
              </Row>
              <Row style="display: flex; 
                align-items: center;
                height: 48px;
                margin-bottom: 16px;
                background: #F8F8F8;">
                <Col span='5' v-if='detail.PriceMonitoreDimension == "1"'>
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;"><span style='color: red;'>*</span>拣货单创建时间</label>
                    <TimePicker type="time" placeholder="" v-model="detail.MonitorSetValue" style="width: 220px" @on-enter="addReturnGoods"></TimePicker>
                  </div>
                </Col>
                <Col span='5' v-if='detail.PriceMonitoreDimension == "2"'>
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;"><span style='color: red;'>*</span>未拣货数峰值</label>
                    <Input style="width:220px" :regx='regx1' v-model="detail.MonitorSetValue" @on-enter="addReturnGoods"></Input>
                  </div>
                </Col>
                <Col span="5">
                  <div style="display: flex;align-items: center;">
                    <label style="width: 120px;text-align:right;margin-right:4px;"><span style='color: red;'>*</span>唯品会仓库</label>
                    <Select style='width:260px' v-model="detail.MonitorDimensionValue" label-in-value multiple filterable clearable class="input_box" @on-change="selectjitWarehouses">
                      <Option v-for="item in jitWarehouses" :key="item.value" :value="item.value">{{ item.label }}</Option>
                    </Select>
                  </div>
                </Col>
                <Col span="5">
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;"><span style='color: red;'>*</span>拣货单类型</label>
                    <Select
                      style="width:220px"
                      v-model="detail.MonitoreType"
                      @on-enter="addReturnGoods"
                      clearable
                    >
                      <Option v-for="(option,index) in MonitoreTypeList" :key="index" :value="option.value">{{option.label}}</Option>
                    </Select>
                  </div>
                </Col>
                <Col span="2" >
                  <Button type="primary" style='margin-left:20px;' icon="md-return-left" @click="addReturnGoods" v-if='REVIEW_STATUS !== "Y"'>添加明细</Button>
                </Col>
              </Row>
              <div class="handleBtn">
                <div class="handleItem" @click="deleteReturnGoods" v-if='REVIEW_STATUS !== "Y"'>【删除】</div>
                <div class="handleItem" @click="importStrategyDetailExcel" v-if='REVIEW_STATUS !== "Y"'>【导入】</div>
                <div class="handleItem" @click="exportStrategyDetailExcel">【导出】</div>
              </div>
              <Table height="300" 
                :columns="returnColumns" 
                :data="currentReturnData"
                @on-select="selectReturnData"
                @on-select-cancel="selectReturnCancel"
                @on-select-all="selectReturnDataAll"
                @on-select-all-cancel="selectReturnDataCancel"
              ></Table>
              <div class="pageContent">
                  <Page
                    size="small"
                    :current="returnCurrentPage"
                    show-elevator
                    :total="totalReturn"
                    show-total
                    show-sizer
                    @on-change="changePageReturn"
                    @on-page-size-change="changeSizeReturn"
                  />
              </div>
        </div>
      </div>
    </foldPanel>
    <foldPanel title="创建出仓单" explainStyle="font-size: 10px;margin-left: 4px;color: #555;" explain="(根据系统参数：出仓单创建维度控制，选择供应商ID，配货单创建出仓单时， 则会按JIT配货单店铺对应的供应商ID+JIT仓库编码+发货实体仓库+配送方式+PO创建。选择根据店铺， 则会按JIT配货单的店铺+JIT仓库编码+发货实体仓库+配送方式+PO创建)">
      <!-- style="display: none;" -->
      <div slot="content" class="block">
        <div class="tableArea priceMonitor" v-if="showDetailTableOne">
              <Row style="display: flex;
                align-items: center;
                height: 48px;">
                <Col span="6">
                  <div style="display: flex;align-items: center;">
                    <label style="width: 140px;text-align:right;margin-right:4px;">
                    <span style='color: red;'>*</span>配货单自动创建出仓单</label>
                    <Tooltip
                      max-width="200"
                      content="开启后默认按照店铺+JIT仓库+发货实体仓库的维度去汇总未确认的配货单，自动创建或匹配出仓单"
                      placement="bottom"
                    >
                      <img
                      class="img-framelanflag"
                      src="../../../assets/icon/help.png"
                      style='margin-right: 4px;'
                      >
                    </Tooltip>
                    <RadioGroup v-model="detailOne.autoCreateOut" @on-change="selectAutoCreateOut" :disabled='REVIEW_STATUS == "Y"'>
                      <Radio label="1" :disabled='REVIEW_STATUS == "Y"'><span>是</span></Radio>
                      <Radio label="2" :disabled='REVIEW_STATUS == "Y"'><span>否</span></Radio>
                    </RadioGroup>
                  </div>
                </Col>
                <!-- <Col span="6" v-if='showAutoCreatedOutFlag'>
                  <div style="display: flex;align-items: center;">
                    <label style="width: 140px;text-align:right;margin-right:4px;">
                    <span style='color: red;'>*</span>匹配出仓单时间范围</label>
                    <Tooltip
                      max-width="200"
                      content="根据出仓单创建时间跟系统时间比对，如果超出设置时间差则不自动匹配；如果没超出则自动匹配"
                      placement="bottom"
                    >
                      <img
                      class="img-framelanflag"
                      src="../../../assets/icon/help.png"
                      style='margin-right: 4px;'
                      >
                    </Tooltip>
                    <Input class="input_box" style='width:120px;' :regx='regx' :disabled='REVIEW_STATUS == "Y"' v-model="detailOne.autoCreateOutDays" placeholder="" />
                  </div>
                </Col> -->
              </Row>
              <Row style="display: flex; 
                align-items: center;
                height: 48px;
                background: #F8F8F8;"
                v-if='showAutoCreatedOutFlag'>
                <Col span='5'>
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;"><span style='color: red;'>*</span>配货单创建时间</label>
                    <TimePicker type="time" placeholder="" v-model="detailOne.outCreatedTime" style="width: 220px" @on-enter="addReturnOutGoods"></TimePicker>
                  </div>
                </Col>
                <Col span="5">
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;"><span style='color: red;' v-if='detailOne.carrier == 2'>*</span>配送方式</label>
                    <Select style="width:220px" v-model="detailOne.deliveryType" @on-enter="addReturnOutGoods" @on-change="selectDeliveryType" clearable>
                      <Option value="1">汽运</Option>
                      <Option value="2">空运</Option>
                    </Select>
                  </div>
                </Col>
                <Col span="5">
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;"><span style='color: red;'>*</span>承运商</label>
                    <Select style="width:220px" v-model="detailOne.carrier" @on-enter="addReturnOutGoods" clearable>
                      <Option value="1">唯品专配</Option>
                      <Option value="2">店铺所属承运商</Option>
                    </Select>
                  </div>
                </Col>
                <!-- <Col span="5">
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;">送货时间间隔</label>
                    <Select style="width:220px" v-model="detailOne.deliveryInterval" @on-enter="addReturnOutGoods" clearable>
                      <Option value="1">当天</Option>
                      <Option value="2">隔天</Option>
                    </Select>
                  </div>
                </Col> -->
              </Row>
              <Row style="display: flex; 
                align-items: center;
                height: 48px;
                margin-bottom: 16px;
                margin-top: -10px;
                background: #F8F8F8;"
                v-if='showAutoCreatedOutFlag'>
                <!-- <Col span='5'>
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;">送货时间</label>
                    <TimePicker type="time" placeholder="" v-model="detailOne.deliveryTime" style="width: 220px" @on-enter="addReturnOutGoods"></TimePicker>
                  </div>
                </Col> -->
                <Col span="5">
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;"><span style='color: red;' v-if='detailOne.carrier == 2'>*</span>到货时间间隔</label>
                    <Select style="width:220px" v-model="detailOne.arrivalInterval" @on-enter="addReturnOutGoods" @on-change="selectArrivalInterval" clearable>
                      <Option value="1">当天</Option>
                      <Option value="2">隔天</Option>
                    </Select>
                  </div>
                </Col>
                <Col span="5">
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;">到货时间</label>
                    <Select
                      style="width:220px"
                      v-model="detailOne.arrivalTime"
                      @on-enter="addReturnOutGoods"
                      clearable
                    >
                      <Option v-for="(option,index) in ArrivalTimeList" :key="index" :value="option.value">{{option.label}}</Option>
                    </Select>
                  </div>
                </Col>
                <Col span="5">
                  <div style="display: flex;align-items: center;">
                    <label style="width: 110px;text-align:right;margin-right:4px;"><span style='color: red;' v-if='detailOne.carrier == 1'>*</span>是否航空禁运</label>
                    <Select style="width:220px" v-model="detailOne.isEmbargo" @on-enter="addReturnOutGoods" clearable>
                      <Option value="1">是</Option>
                      <Option value="2">否</Option>
                    </Select>
                  </div>
                </Col>
                <Col span="2" >
                  <Button type="primary" style='margin-left:20px;' icon="md-return-left" @click="addReturnOutGoods" v-if='REVIEW_STATUS !== "Y"'>添加明细</Button>
                </Col>
              </Row>
              <div class="handleBtn" v-if='showAutoCreatedOutFlag'>
                <div class="handleItem" @click="deleteReturnOutGoods" v-if='REVIEW_STATUS !== "Y"'>【删除】</div>
                <!-- <div class="handleItem" @click="importStrategyOutDetailExcel" v-if='REVIEW_STATUS !== "Y"'>【导入】</div> -->
                <!-- <div class="handleItem" @click="exportStrategyDetailExcel('out')">【导出】</div> -->
              </div>
              <Table height="300" 
                v-if='showAutoCreatedOutFlag'
                :columns="returnOutColumns" 
                :data="currentReturnOutData"
                @on-select="selectReturnOutData"
                @on-select-cancel="selectReturnOutCancel"
                @on-select-all="selectReturnOutDataAll"
                @on-select-all-cancel="selectReturnOutDataCancel"
              ></Table>
              <div class="pageContent" v-if='showAutoCreatedOutFlag'>
                  <Page
                    size="small"
                    :current="returnOutCurrentPage"
                    show-elevator
                    :total="totalReturnOut"
                    show-total
                    show-sizer
                    @on-change="changePageReturnOut"
                    @on-page-size-change="changeSizeReturnOut"
                  />
              </div>
        </div>
      </div>
    </foldPanel>
    <Modal
      v-model="showTip"
      mask
      :mask-closable="maskClosable"
      title="警告"
      title-align="left"
      class-name="showTipModel"
      width="400px"
      @on-ok="closePage"
    >
      <p><i class="iconfont iconbj_doubt fcWarning " />修改的数据未保存，确定返回？</p>
    </Modal>
    <JITAutoDeatilImport :type='tabName' :visible='JITAutoDetailvisible' @closeActionDialog = 'closeActionDialog' :pageMsgId='pageMsgId'></JITAutoDeatilImport>
    <JITAutoOutDeatilImport :type='tabName' :visible='JITAutoOutDetailvisible' @closeActionDialog = 'closeOutActionDialog' :pageMsgId='pageMsgId'></JITAutoOutDeatilImport>
  </div>
</template>
<script>
  import common from '@yunque/service/modules/common';
  import foldPanel from '../../customizedContent/FoldPanel.vue'; // 折叠面板组件
  import ShrinkOrExtend from '../../customizedContent/shrinkOrExtend' //收缩伸展搜索条件组件 
  import tableFaker from '../../customizedContent/tableFaker.vue'; //表格组件
  import JITAutoDeatilImport from '../../modal/systemImport/JITAutoDeatilImport.vue'; // 拣货单导入弹框
  import JITAutoOutDeatilImport from '../../modal/systemImport/JITAutoOutDeatilImport.vue'; // 出仓单导入弹框

  
  import { DispatchEvent, R3_IMPORT } from '../../../assets/js/__utils__/dispatchEvent';

  const R3 = window.R3;
  const { network, urlSearchParams, store } = R3;
  export default {
    data() {
      return {
        JITAutoDetailvisible: false,
        JITAutoOutDetailvisible: false,
        selectReturnSKUID:'',//策略明细sku下拉框双向数据绑定
        regx1: /^\d{0,15}?$/, // 两位小数的正数
        formInline: {
          autoCreateOut: '2', // 配货单自动创建出仓单
        },
        ruleInline: {
          autoCreateOut: [
            { required: true, message: '请选择配货单自动创建出仓单', trigger: 'blur' },
          ],
        },
        tabList: [
          {
            tabId: '1',
            tabtext: '基本信息',
            blockShow: true,
            list: [
              {
                ID: '',
                SKEY: 'strategyName',
                title: '策略名称',
                VALUE: '',
                company: '',
                tips: '',
                disabled:false,
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                explain:false, //是否有解释
              },
              {
                ID: 'T_V_IESSHOP',
                SKEY: 'shop_name',
                title: '使用店铺',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                clearable:true,
                disabled:false,
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                standard:true,//标准输入框长度
                optionList:[]
              },
              {
                SKEY: 'strategyTimeRange',
                title: '起止时间',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:false,
                required: true, // 是否为必填项
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
              },
            ]
          },
        ],
        returnColumns: [ //策略明细
            {
              type: 'selection',
              width: 60,
              align: 'center'
            }, 
            {
              type: 'index',
              align: 'center',
              title: '序号',
            },
            {
              title: '拣货单创建方式',
              align: 'center',
              key: 'PriceMonitoreDimensionText',
            },
            {
              title: '拣货单创建时间',
              align: 'center',
              key: 'MonitorSetValue' 
            },
            {
              title: '唯品会仓库',
              align: 'center',
              key: 'MonitorDimensionValue', 
            },
            {
              title: '拣货单类型',
              align: 'center',
              key: 'MonitoreTypeText',
            },
        ],
        tableHeight:'200',//表格高度

        currentReturnData:[],//当前显示策略明细明细
        returnData:[],
        returnDataNoSame:[],//弹窗中没有的策略明细
        submitArrReturn:[],//选中的策略明细
        // 策略明细page
        returnCurrentPage:1,
        totalReturn: 0, // 总条数
        currentPageReturn: 0, // 页码
        pageSizeReturn: 10, // 每页的条数

        // 选择商品
        mask:true,
        closable: true,
        maskClosable: false,
        hideFoot: true,
        shrinkHeight: '58px',
        currentValue: false,//默认收缩

        showTip: false,
        showDetailTable: true, // 展示商品明细
        startTime: '',  // 活动开始时间
        endTime: '', // 活动结束时间

        detail:{
          PriceMonitoreDimension: '1', // 拣货单创建方式
          MonitorSetValue: '', // 拣货单创建时间/未拣货数峰值
          MonitorDimensionValue: [], // 唯品会仓库
          MonitoreType: 1, // 拣货单类型
        },
        MonitorDimensionValueTextList: [], // 唯品会仓库
        jitWarehouses: [], // 唯品会仓库
        MonitoreTypeList: [ // 拣货单类型
          {
            label: '全部',
            value: 1
          },
          {
            label: '普通',
            value: 2
          },
          {
            label: '补货单',
            value: 3
          },
        ],
        MonitorDimensionValue: {
          VALUE: '', //字段值
          clearable:true,
          tableName:'T_IESBRAND',//表名
          currentIndex:0,//当前页码
          dataEmptyMessage: '数据加载中...', // 无数据的提示
          columns:['name','value'],// 展现的组
          AutoData:[],//模糊搜索
          defaultSelected:[],//默认数据
          shopData:{},
        },
        MonitorSetValueContent: '根据商品成交单价/平台售价和预警折扣做比对', // 监控设置值解释 

        //编辑页面
        pageMsgId: '', // 当前策略id

        showAutoCreatedOutFlag: false, // 创建出仓单参数是否展示
        showDetailTableOne: true, // 出仓单展示
        detailOne: {
          autoCreateOut: '2', // 配货单自动创建出仓单
          // autoCreateOutDays: '0', // 匹配出仓单时间范围
          outCreatedTime: '', // 配货单创建时间
          deliveryType: '', // 配送方式
          carrier: '', // 承运商
          deliveryInterval: '', // 送货时间间隔
          deliveryTime: '', // 送货时间
          arrivalInterval: '', // 到货时间间隔
          arrivalTime: '', // 到货时间
          isEmbargo:'', // 是否航空禁运
        },
        ArrivalTimeList: [], // 到货时间枚举,汽运到货时间
        returnOutColumns: [ // 创建出仓单表格明细
            {
              type: 'selection',
              width: 60,
              align: 'center'
            }, 
            {
              type: 'index',
              align: 'center',
              title: '序号',
            },
            {
              title: '配货单创建时间',
              align: 'center',
              key: 'outCreatedTime' 
            },
            {
              title: '配送方式',
              align: 'center',
              key: 'deliveryTypeText', 
            },
            {
              title: '承运商',
              align: 'center',
              key: 'carrierText',
            },
            // {
            //   title: '送货时间间隔',
            //   align: 'center',
            //   key: 'deliveryIntervalText',
            // },
            // {
            //   title: '送货时间',
            //   align: 'center',
            //   key: 'deliveryTime',
            // },
            {
              title: '到货时间间隔',
              align: 'center',
              key: 'arrivalIntervalText',
            },
            {
              title: '到货时间',
              align: 'center',
              key: 'arrivalTime',
            },
            {
              title: '是否航空禁运',
              align: 'center',
              key: 'isEmbargoText',
            },
        ],
        currentReturnOutData:[],//出仓单表格当前显示策略明细明细
        returnOutData:[],
        submitArrReturnOut:[],//出仓单表格选中的策略明细
        // 出仓单表格明细page
        returnOutCurrentPage:1,
        totalReturnOut: 0, // 出仓单表格总条数
        currentPageReturnOut: 0, // 出仓单表格页码
        pageSizeReturnOut: 10, // 出仓单表格每页的条数
      };
    },
    components: {
      foldPanel,
      ShrinkOrExtend,
      tableFaker,
      JITAutoDeatilImport,
      JITAutoOutDeatilImport
    },
    created(){
      this.pageMsgId = window.parent.vm._route.params.customizedModuleId;
      this.getStategyDetail();
      this.getpageDetailList();
      this.getpageOutDetailList();
      this.getQuery('T_V_IESSHOP', {isactive: ["=Y"],PLATFORM:["=19"]})// 初始查询店铺名称列表
    },
    async mounted() {
      this.getJITWarehouse(); // 获取唯品会仓库
    },
    methods: {
      backToList() { // 返回策略列表页面
        let flag = true;
        for(let i = 0;i<this.tabList[0].list.length;i++){
          if(this.oldBaseMsg.name != this.tabList[0].list[0].VALUE){
            flag = false;
            break;
          }else if(this.oldBaseMsg.shopid != this.tabList[0].list[1].VALUE){
            flag = false;
            break;
          }else if(this.oldBaseMsg.startTime != this.startTime){
            flag = false;
            break;
          }else if(this.oldBaseMsg.endTime != this.endTime){
            flag = false;
            break;
          }
        }
        if(!flag){
          this.showTip = true;
        }else{
          this.closePage();
        }
      },
      getStategyDetail(){ // 编辑页面获取策略详情
        let params = {
          id: this.pageMsgId
        }
        network.post('/p/cs/policy/jitautomatic/detail',params).then(res => {
          if(res.data.code == 0){
            this.tabList[0].list[0].VALUE = res.data.data.name
            this.tabList[0].list[1].VALUE = String(res.data.data.shopid)
            this.tabList[0].list[2].VALUE = [res.data.data.startdate,res.data.data.enddate]
            this.startTime = res.data.data.startdate
            this.endTime = res.data.data.enddate
            this.detail.PriceMonitoreDimension = String(res.data.data.pickcreatemod)
            this.detailOne.autoCreateOut = String(res.data.data.autodelivery) == '0'?'2':'1'
            this.showAutoCreatedOutFlag = String(res.data.data.autodelivery) == '0'?false:true
            this.oldBaseMsg = {
              name: res.data.data.name, // 策略名称
              shopid: res.data.data.shopid, // 店铺
              startTime: res.data.data.startdate, // 开始时间
              endTime: res.data.data.enddate, // 结束时间
              type: res.data.data.type, // 策略类型
            }
            this.REVIEW_STATUS = res.data.data.isactive // Y为启用，N为停用
            if(res.data.data.isactive == 'Y') {
              this.tabList[0].list.forEach(item => {
                item.disabled = true;
              })
            }
            if(this.detail.PriceMonitoreDimension == '1'){
              this.returnColumns[3].title = '拣货单创建时间'
            }else {
              this.returnColumns[3].title = '未拣货数峰值'
            }
          }
        })
      },
      getpageDetailList(type){ // 获取拣货单表格数据
        let params = {
          id: this.pageMsgId,
          page: this.returnCurrentPage,
          pageSize: this.pageSizeReturn,
        }
        network.post('/p/cs/policy/jitautomatic/item/detail',params).then(res => {
          if(res.data.code == 0) {
            let currentPageData = [];
            if(type == 'table'){
              this.returnData = [];
            }
            if(res.data.data.resultList.length > 0){
              res.data.data.resultList.forEach(item => {
                let obj = {};
                obj = {
                  id: item.id,
                  PriceMonitoreDimension: Number(this.detail.PriceMonitoreDimension),
                  PriceMonitoreDimensionText: String(this.detail.PriceMonitoreDimension) == '1'?'按时间点创建':'按未拣货数创建',
                  MonitorDimensionValue: item.jitwarehousecode,
                  MonitorDimensionValueID: item.jitwarehouseid.split(','),
                  MonitoreType: item.picktype,
                  MonitoreTypeText: item.picktype == 0?'全部':item.picktype=='1'?'普通':'补货单',
                }
                if(this.detail.PriceMonitoreDimension == '1'){
                  obj.MonitorSetValue = item.pickcreatedate
                }else {
                  obj.MonitorSetValue = item.unpickpeakval
                }
                currentPageData.push(obj);
                if(this.returnData.length < res.data.data.total){
                  this.returnData.push(obj);
                }
              })
            }
            this.totalReturn=res.data.data.total
            // 截取数组
            // let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
            // let endIndex=startIndex+this.pageSizeReturn
            // this.returnData.slice(startIndex,endIndex)
            this.currentReturnData=currentPageData //当前页面显示明细
          }
        })
      },
      getpageOutDetailList(type){ // 获取出仓单表格数据
        let params = {
          id: this.pageMsgId,
          page: this.returnOutCurrentPage,
          pageSize: this.pageSizeReturnOut,
        }
        network.post('/p/cs/policy/jitautomatic/packitem/detail',params).then(res => {
          if(res.data.code == 0) {
            let currentPageData = [];
            if(type == 'table'){
              this.returnOutData = [];
            }
            if(res.data.data.resultList.length > 0){
              res.data.data.resultList.forEach(item => {
                let obj = {};
                obj = {
                  id: item.id,
                  MODIFYDISCERNID: (Math.random() * 9 + 1) * 100000,
                  outCreatedTime:item.time_period,
                  deliveryTypeText: item.ship_method == '1'?'汽运':item.ship_method == '2'?'空运':'',
                  deliveryType: item.ship_method,
                  carrierText: item.carrier == '1'?'唯品专配':item.carrier == '2'?'店铺所属承运商':'',
                  carrier: item.carrier,
                  // deliveryIntervalText:item.deliveryInterval == '1'?'当天':item.deliveryInterval == '2'?'隔天':'',
                  // deliveryInterval:item.deliveryInterval,
                  // deliveryTime: item.deliveryTime,
                  arrivalIntervalText:item.timegap == '0'?'当天':item.timegap == '1'?'隔天':'',
                  arrivalInterval:item.timegap,
                  arrivalTime: item.arrivaltime,
                  isEmbargoText: item.isembargo == '1'?'是':item.isembargo == '0'?'否':'',
                  isEmbargo: item.isembargo,
                }
                currentPageData.push(obj);
                if(this.returnOutData.length < res.data.data.total){
                  this.returnOutData.push(obj);
                }
              })
            }
            this.totalReturnOut=res.data.data.total
            // 截取数组
            // let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
            // let endIndex=startIndex+this.pageSizeReturn
            // this.returnData.slice(startIndex,endIndex)
            this.currentReturnOutData=currentPageData //当前页面显示明细
          }
        })
      },
      rangeDate(e) {
        this.startTime = e[0];
        this.endTime = e[1];
      },
      limitStartDate(e) {
        this.limitStartDate = e
      },
      limitEndDate(e) {
        this.limitEndDate = e
      },
      // 重置数据
      resetData(){
        this.tabList.forEach(item=>{
          item.list.forEach(i=>{
            if(i.TYPEONE=='checkbox'){
              i.VALUE=false
            }else{
              i.VALUE=''
            }
          })
        })
        this.showDetailTable = true;
        this.returnData = []; // 策略明细置空
        this.currentReturnData = []; // 策略明细置空

      },
      // 关闭当前页面
      closePage(){
        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_OMSJITAUTOMATICPOLICY',
            tableId:'11509',
            back:true
          });
        },0)
      },
      // 获取唯品会仓库
      async getJITWarehouse() {
        // 获取"JIT仓库"信息
        let jitWarehouseRsp = await common.listQuery({
          table: 'T_V_IESJITWAREHOUSE',
          fixedcolumns: {
            ISACTIVE: '=Y'
          },
          range: 1000
        });
        if (jitWarehouseRsp) {
          jitWarehouseRsp.rows.forEach(item => {
            let obj = {
              value: item.ID.val,
              label: item.JITWAREHOUSENAME.val,
            }
            this.jitWarehouses.push(obj);
          })
        }
      },

      // 监控维度option选中
      selectPriceMonitoreDimension(val){
        this.detail.MonitorSetValue = ''
        this.detail.MonitorDimensionValue = ''
        this.detail.MonitoreType = 1
        if(this.returnData.length>0){
          this.returnData.forEach(item => {
            if(item.PriceMonitoreDimension !== val){
              this.$Modal.fcWarning({
                title: '警告',
                mask: true,
                showCancel: true,
                content: '切换拣货单创建方式，明细数据将被清空，并同步数据库，是否确认切换？',
                onOk:()=>{
                  let params = {
                    id: this.pageMsgId,
                    pickcreatemod:  Number(this.detail.PriceMonitoreDimension)
                  }
                  network.post('/p/cs/policy/jitautomatic/item/clean',params).then(res => {
                    if(res.data.code == 0){
                      this.$Message.success('切换成功')
                    }
                  })
                  this.detail.MonitorSetValue = ''
                  this.detail.MonitorDimensionValue = ''
                  this.detail.MonitoreType = 1
                  if(val == '1'){
                    this.returnColumns[3].title = '拣货单创建时间'
                  }else if(val == '2') {
                    this.returnColumns[3].title = '未拣货数峰值'
                  }
                  this.returnData = [];
                  // 截取数组
                  let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                  let endIndex=startIndex+this.pageSizeReturn
                  this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                },
                onCancel:()=>{
                  this.detail.PriceMonitoreDimension=val=='1'?'2':'1';
                }
              })
            }
          })
        } else {
          // JIT没明细切换时也更新表头
          if(val == '1'){
            this.returnColumns[3].title = '拣货单创建时间'
          }else if(val == '2') {
            this.returnColumns[3].title = '未拣货数峰值'
          }
          this.returnData = [];
        }
      },

      // 添加策略明细到表格
      addReturnGoods(){
          if(this.detail.PriceMonitoreDimension==''){
            this.$Message.warning('拣货单创建方式不能为空');
            return
          }else if(this.detail.MonitorSetValue==''){
            if(this.detail.PriceMonitoreDimension=='1'){
              this.$Message.warning('拣货单创建时间不能为空');
              return
            }else if(this.detail.PriceMonitoreDimension=='2') {
              this.$Message.warning('未拣货数峰值不能为空');
              return
            }
          }else if(this.detail.MonitorDimensionValue.length==0){
            this.$Message.warning('唯品会仓库不能为空');
            return
          }else if(this.detail.MonitoreType==''){
            this.$Message.warning('拣货单类型不能为空');
            return
          }else {
            this.$Modal.fcWarning({
              title: '警告',
              mask: true,
              showCancel: true,
              content: '添加操作数据库数据会同时发生变化，是否确认添加？',
              onOk:()=>{
                let MonitorDimensionValueText = ''
                if(this.MonitorDimensionValueTextList.length > 0) {
                  this.MonitorDimensionValueTextList.forEach((item,index) => {
                    if(index != this.MonitorDimensionValueTextList.length - 1){
                      MonitorDimensionValueText += item.label + ','
                    }else {
                      MonitorDimensionValueText += item.label
                    }
                  })
                }
                let jitpolicyitem = {
                  policyid: this.pageMsgId,
                  jitwarehouseid: this.detail.MonitorDimensionValue,
                  jitwarehousecode: MonitorDimensionValueText, // VALUE
                  picktype: this.detail.MonitoreType,
                }
                if(this.detail.PriceMonitoreDimension == '1'){
                  jitpolicyitem.pickcreatedate = this.detail.MonitorSetValue
                }else {
                  jitpolicyitem.unpickpeakval = this.detail.MonitorSetValue
                }
                let jitpolicy = {
                  "pickcreatemod": Number(this.detail.PriceMonitoreDimension)
                }
                let params = {
                  jitpolicyitem: jitpolicyitem,
                  jitpolicy: jitpolicy,
                }
                
                network.post('/p/cs/policy/jitautomatic/item/add',params).then(res => {
                  if(res.data.code == 0){
                    this.detail={
                      PriceMonitoreDimension: this.detail.PriceMonitoreDimension, // 监控维度
                      MonitorDimensionValue: '', // 监控维度值
                      MonitoreType: 1, // 监控类型
                      MonitorSetValue: '', // 监控设置值
                    },
                    this.$Message.success('添加明细成功！')
                    this.getpageDetailList('table');
                  }
                })
              }
            })
          }
      },
      //初始查询标准下拉框数据
      getQuery(tableName,fixed){
        let virtual={
          fixedcolumns: fixed?fixed:{},
          range: 2000,
          startindex: 0,
          table: tableName
        }
        if(tableName=='T_V_IESSHOP'){
          virtual.isdroplistsearch = true
        }
          network.post('/p/cs/list/query', virtual).then((res) => {
            this.tabList[0].list.forEach(item=>{
              if(item.ID==tableName){
                if(tableName=='T_V_IESSHOP'){
                  item.optionList= res.data.rows.map(i=>{
                    return {
                      label:i.SHOPTITLE.val,
                      value:i.ID.val
                    }
                  })
                }else{
                  item.optionList= res.data.rows.map(i=>{
                    return {
                      label:i.NAME.val,
                      value:i.ID.val
                    }
                  })
                }
              }
            })
          })
      },

      // 策略明细表删除
      deleteReturnGoods(){
        this.$Modal.fcWarning({
          title: '警告',
          mask: true,
          showCancel: true,
          content: '删除操作数据库数据会同时被清除，是否确认删除？',
          onOk:()=>{
            let idArray=this.submitArrReturn.map(item=>item.id)
            let params = {
              ids: idArray
            }
            network.post('/p/cs/policy/jitautomatic/item/del',params).then(res => {
              if(res.data.code == 0){
                this.$Message.success('删除明细成功！');
                this.getpageDetailList('table');
              }
            })
          }
        })
      },
      
      // 策略明细页码改变时触发
      changePageReturn(val){
         // 1=>0 2=>10 3=>20 
         this.returnCurrentPage=val
        // 截取数组
        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturn
        this.currentReturnData=this.returnData.slice(startIndex,endIndex)
      },
      // 策略明细页数改变时触发
      changeSizeReturn(val){
        this.pageSizeReturn = val;
        this.returnCurrentPage=1;
        // this.currentReturnPage = 0;
        // 截取数组
        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturn
        this.currentReturnData=this.returnData.slice(startIndex,endIndex)
      },
      // 策略明细表格选中某项时触发
      selectReturnData(selection, row) {
        this.submitArrReturn = selection;
      },
      // 策略明细表格取消某项时触发
      selectReturnCancel(selection, row) {
        this.submitArrReturn = selection;
      },
      // 策略明细表格全选
      selectReturnDataAll(selection) {
        this.submitArrReturn = selection;
      },
      // 策略明细表格取消全选
      selectReturnDataCancel(selection) {
        this.submitArrReturn = selection;
      },
      //  出仓单添加策略明细到表格
      addReturnOutGoods(){
          // detailOne
          let obj=this.detailOne
          let flag = true;
          for(let i=0;i<this.returnOutData.length;i++){
            if((this.returnOutData[i].outCreatedTime == obj.outCreatedTime) && (this.returnOutData[i].deliveryType == obj.deliveryType)){
              this.$Message.warning('列表页数据有重复，不允许添加');
              flag = false;
              return;
            }
          }
          if(flag){
            if(!this.detailOne.carrier){
              this.$Message.warning('承运商不允许为空!');
              return
            } else if(this.detailOne.outCreatedTime==''){
              this.$Message.warning('配货单创建时间不允许为空!');
              // this.$Message.warning('当前必填项不允许为空');
              return
            } else if(this.detailOne.carrier=='2' && !this.detailOne.deliveryType){
              // this.$Message.warning('当前必填项不允许为空');
              this.$Message.warning('配送方式不允许为空!');
              return
            } else if(this.detailOne.carrier=='2' && !this.detailOne.arrivalInterval){
              // this.$Message.warning('当前必填项不允许为空');
              this.$Message.warning('到货时间间隔不允许为空!');
              return
            } else if(this.detailOne.carrier == '1' && !this.detailOne.isEmbargo){
              // this.$Message.warning('当前必填项不允许为空');
              this.$Message.warning('是否航空禁运不允许为空!');
              return
            }else {
              this.$Modal.fcWarning({
                title: '警告',
                mask: true,
                showCancel: true,
                content: '添加操作数据库数据会同时发生变化，是否确认添加？',
                onOk:()=>{
                  let jitOutPolicyitem = {
                    carrier: obj.carrier,//承运商(1唯品专配 2店铺所属承运商)
                    ship_method: obj.deliveryType,//配送方式(1汽运 2空运)
                    time_period: obj.outCreatedTime,//配货单创建时间段
                    arrivaltime: obj.arrivalTime,//到货时间
                    timegap: obj.arrivalInterval == '2'?1:obj.arrivalInterval == '1'?0:'', //到货时间间隔(0当天 1隔天)
                    isembargo: obj.isEmbargo == '1'?1:0 //是否航空禁运(0否 1是)
                  }
                  let params = {
                    id: this.pageMsgId,
                    packItems: jitOutPolicyitem,
                    // autodelivery: Number(this.formInline.autoCreateOut) == '2'?1:0,
                  }
                  
                  network.post('/p/cs/policy/jitautomatic/packitem/add',params).then(res => {
                    if(res.data.code == 0){
                      this.detailOne.outCreatedTime='' // 配货单创建时间
                      this.detailOne.deliveryType='' // 配送方式
                      this.detailOne.carrier='' // 承运商
                      this.detailOne.arrivalInterval='' // 到货时间间隔
                      this.detailOne.arrivalTime='' // 到货时间
                      this.detailOne.isEmbargo='' // 是否航空禁运
                      this.$Message.success('添加明细成功！')
                      this.getpageOutDetailList('table');
                    }
                  })
                }
              })
            }
          }
      },
      // 策略出仓单明细表删除
      deleteReturnOutGoods(){
        if(this.detailOne.autoCreateOut == '1' && this.returnOutData.length == 1){  // 未删除之前只剩下一条数据，不能删除
          return this.$Message.warning('当前设置，出仓单明细仅剩一条，不能执行删除操作！!');
        }
        this.$Modal.fcWarning({
          title: '警告',
          mask: true,
          showCancel: true,
          content: '删除操作数据库数据会同时被清除，是否确认删除？',
          onOk:()=>{
            let idArray=this.submitArrReturnOut.map(item=>item.id)
            let params = {
              ids: idArray
            }
            network.post('/p/cs/policy/jitautomatic/packitem/delete',params).then(res => {
              if(res.data.code == 0){
                this.$Message.success('删除明细成功！');
                this.getpageOutDetailList('table');
              }
            })
          }
        })
      },

      // 出仓单明细页码改变时触发
      changePageReturnOut(val){
         // 1=>0 2=>10 3=>20 
         this.returnOutCurrentPage=val
        // 截取数组
        let startIndex=this.pageSizeReturn*(this.returnOutCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturnOut
        this.currentReturnOutData=this.returnOutData.slice(startIndex,endIndex)
        this.getpageOutDetailList()
      },
      // 出仓单明细页数改变时触发
      changeSizeReturnOut(val){
        this.pageSizeReturnOut = val;
        this.returnOutCurrentPage=1;
        // this.currentReturnPage = 0;
        // 截取数组
        let startIndex=this.pageSizeReturnOut*(this.returnOutCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturnOut
        this.currentReturnOutData=this.returnOutData.slice(startIndex,endIndex)
        this.getpageOutDetailList()
      },
      // 出仓单明细表格选中某项时触发
      selectReturnOutData(selection, row) {
        this.submitArrReturnOut = selection;
      },
      // 出仓单明细表格取消某项时触发
      selectReturnOutCancel(selection, row) {
        this.submitArrReturnOut = selection;
      },
      // 出仓单明细表格全选
      selectReturnOutDataAll(selection) {
        this.submitArrReturnOut = selection;
      },
      // 出仓单明细表格取消全选
      selectReturnOutDataCancel(selection) {
        this.submitArrReturnOut = selection;
      },

      // 切换创建出仓单的自动创建出仓单参数
      selectAutoCreateOut(e) {
        if(e == 1){
          this.showAutoCreatedOutFlag = true;
        }else {
          this.showAutoCreatedOutFlag = false;
        }
      },
      // 切换配送方式
      // 切换配送方式
      selectDeliveryType(e) {
        if(this.detailOne.arrivalInterval){
          if(e == 2) { // 汽运
            this.ArrivalTimeList = [ // 到货时间枚举,汽运到货时间
              {
                label: '09:00:00',
                value: '09:00:00'
              },
              {
                label: '16:00:00',
                value: '16:00:00'
              },
              {
                label: '18:00:00',
                value: '18:00:00'
              },
              {
                label: '20:00:00',
                value: '20:00:00'
              },
              {
                label: '23:59:00',
                value: '23:59:00'
              },
            ]
          }else if(e == 1) { // 空运
            this.ArrivalTimeList = [ // 到货时间枚举,空运到货时间
              {
                label: '02:00:00',
                value: '02:00:00'
              },
              {
                label: '09:00:00',
                value: '09:00:00'
              },
              {
                label: '10:00:00',
                value: '10:00:00'
              },
              {
                label: '16:00:00',
                value: '16:00:00'
              },
              {
                label: '19:00:00',
                value: '19:00:00'
              },
              {
                label: '20:00:00',
                value: '20:00:00'
              },
              {
                label: '22:00:00',
                value: '22:00:00'
              },
              {
                label: '23:59:00',
                value: '23:59:00'
              },
            ]
          }else {
            this.ArrivalTimeList = [];
          }
        }else {
          this.ArrivalTimeList = [];
        }
      },

      // 切换到货时间间隔
      selectArrivalInterval(e) {
        if(e) {
          if(this.detailOne.deliveryType == 2){  // 汽运
            this.ArrivalTimeList = [ // 到货时间枚举,汽运到货时间
              {
                label: '09:00:00',
                value: '09:00:00'
              },
              {
                label: '16:00:00',
                value: '16:00:00'
              },
              {
                label: '18:00:00',
                value: '18:00:00'
              },
              {
                label: '20:00:00',
                value: '20:00:00'
              },
              {
                label: '23:59:00',
                value: '23:59:00'
              },
            ]
          } else if(this.detailOne.deliveryType == 1){ // 空运
            this.ArrivalTimeList = [ // 到货时间枚举,空运到货时间
              {
                label: '02:00:00',
                value: '02:00:00'
              },
              {
                label: '09:00:00',
                value: '09:00:00'
              },
              {
                label: '10:00:00',
                value: '10:00:00'
              },
              {
                label: '16:00:00',
                value: '16:00:00'
              },
              {
                label: '19:00:00',
                value: '19:00:00'
              },
              {
                label: '20:00:00',
                value: '20:00:00'
              },
              {
                label: '22:00:00',
                value: '22:00:00'
              },
              {
                label: '23:59:00',
                value: '23:59:00'
              },
            ]
          } else{
            this.ArrivalTimeList = [];
          }
        }else {
          this.ArrivalTimeList = [];
        }
      },

      parser(value) {
        if((typeof value=='string')){
          return parseFloat(value.replace(/[^\d\.-]/g, ''));
        }else{
          return value
        }
        
      },
      
      checkInputSKU(e,i){
        let tableName=i.ID
        if(tableName=='T_V_IESSHOP'){
          this.getQuery(tableName,{SHOPTITLE:e})
        }
      },
      // 唯品会仓库选中值发生改变
      selectjitWarehouses(val) {
        this.MonitorDimensionValueTextList = val;
      },
      // 平台单号，退款单号(换货单没有)，退回物流单号禁止输入空格
      noSpaces(e,i){
        if(i.SKEY=='satisfied_amount'||i.SKEY=='satisfied_pieces'){
          if(e.keyCode == 32) e.returnValue = false
        }
      },
        checkDataSame(arr){
            for (var i=0; i<arr.length; i++) {
                for (var j=i+1; j<arr.length; j++) {
                    if ((arr[i].outCreatedTime == arr[j].outCreatedTime) && (arr[i].deliveryType == arr[j].deliveryType)) {
                        return true;
                    }
                }
            }
        },
        //将时分秒转为时间戳
        time_to_sec(time) {
          if (time !== null) {
            var s = "";
            var hour = time.split(":")[0];
            var min = time.split(":")[1];
            var sec = time.split(":")[2];
            s = Number(hour * 3600) + Number(min * 60) + Number(sec);
            return s;
          }
        },
        // 如果time2大于time1 返回true 否则 返回false
        compareTime(time1,time2) {
          if(this.time_to_sec(time2)-this.time_to_sec(time1)>0){ 
              return true;
          }
          return false;
        },
        // 保存
        saveAll(){
          let baseMsg = this.tabList[0]; //基本设置
          if(!baseMsg.list[0].VALUE){
            return this.$Message.warning('策略名称不能为空！');
          }
          if(!baseMsg.list[1].VALUE){
            return this.$Message.warning('使用店铺不能为空！');
          }
          if(!this.startTime || !this.endTime){
            return this.$Message.warning('起止时间不能为空！');
          }
          if((new Date(this.endTime).getTime())<(new Date().getTime())){
            return this.$Message.warning('结束时间必须大于当前系统时间！');
          }
          let params = { // 保存接口参数
            id: this.pageMsgId,
            name: baseMsg.list[0].VALUE,
            shopid: baseMsg.list[1].VALUE,
            startdate: this.startTime,
            enddate: this.endTime,
            pickcreatemod: Number(this.returnData[0].PriceMonitoreDimension),
            // autodelivery: Number(this.formInline.autoCreateOut) == 1?0:1,
            autodelivery: Number(this.detailOne.autoCreateOut) == '2'?0:1,
            // autodelivery: 0//20220922热修默认传递为否
          }
          this.saveSubmit(params)
        },
        saveSubmit(params) {
          network.post('/p/cs/policy/jitautomatic/edit',params).then(res => {
            if(res.data.code == 0){
              this.$Message.success('新建策略成功！');
              this.closePage();
            }
          })
        },
        getTime(date){
          let time = new Date(date).getTime();
        },
      // 策略明细表导入
      importStrategyDetailExcel() {
        this.JITAutoDetailvisible = true;
      },
      // 出仓单策略明细表导入
      importStrategyOutDetailExcel() {
        this.JITAutoOutDetailvisible = true;
      },
      // 策略明细表导出
      async exportStrategyDetailExcel(type) {
        let userId = JSON.parse(localStorage.getItem('userInfo')).id;
        let data = await network.get(`/p/cs/judge/export_the_verification_code?tableName='T_OMSJITAUTOPOLICYITEM'`);
        if (data.data.data) {
          let virtual = {
            table: 'V_USERS', // USERS
            objid: userId,
          };
          this.$network.post('/p/cs/object/query', virtual).then((res) => {
            let str = res.data.MOBIL;
            let a = /^1\d{10}$/;
            if (str && a.test(str)) {
              let MOBIL = str;
              let refresh = this.searchClickData;
              this.$R3Dialog({
                dialogComponentName: 'exportValidate', // 自定义的弹框组件
                title: '导出校验', // 弹框标题
                footerHide: true,
                externalOptions: {
                  massage: MOBIL,
                  refresh
                }
              }, () => {
                this.batchExport(type); // 调用框架导出
              });
            } else {
              this.$Modal.fcError({
                title: '错误',
                content: '当前用户手机号为空或格式不正确，请联系管理员在【用户档案】中进行修改',
                mask: true,
              });
            }
          });
        }else {
          this.batchExport(type); // 调用框架导出
        }
      },
      batchExport(type){
        let searchdata = {}
        let fd = new FormData();
        if(type == 'out'){ // 出仓单表格导出
          searchdata = {"table":"T_OMSJITAUTOPOLICYITEM","startIndex":0,"fixedcolumns":{},"range":1000,"column_include_uicontroller":true}
        }else { // 拣货单表格导出
          searchdata = {"table":"T_OMSJITAUTOPOLICYITEM","startIndex":0,"fixedcolumns":{},"range":1000,"column_include_uicontroller":true}
        }
        fd.append('policyId', this.pageMsgId);
        network.post('/p/cs/jit/autopolicy/item/export',fd).then(res => {
          if(res.data.code == 0){
            this.$Modal.fcSuccess({
              title: '成功',
              mask: true,
              content: res.data.message
            });
            const asyncTaskScheme = () => (window.ProjectConfig && window.ProjectConfig.asyncTaskScheme ? window.ProjectConfig.asyncTaskScheme : '');  // 异步导出设计方案
            if(asyncTaskScheme() === 'skq') {
              const params = {
                detail: {
                  type: 'notice'
                }
              }
              DispatchEvent(R3_IMPORT, params)
              this.$R3loading.hide(this.loadingName);
              // this.closeDialog()
              return
            }
          }
        })
      },
      // 策略明细表导入弹框关闭
      closeActionDialog() {
        this.JITAutoDetailvisible = false;
      },
      // 策略明细表导入弹框关闭
      closeOutActionDialog() {
        this.JITAutoOutDetailvisible = false;
      },
    }
  };
</script>
<style lang="less">

.quickOperation{
  height: 64px;
  border-bottom: 1px solid #D8D8D8;
  display: flex;
  align-items: center;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #333333;
}
.content{
  .block{
    padding-top: 24px;
  }
  .ark-col{
    display: flex;
    align-items: center;
    // justify-content: flex-end;
    margin-bottom: 16px;
    .input_box{
      max-width: 400px;
      min-width: 180px;
    }
    
   .ark-input-wrapper /deep/ textarea{
      resize: none;
      min-height: 36px!important;
    }
    .title{
      min-width: 100px;
      display: flex;
      justify-content: flex-end;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #333333;
      display: flex;
      align-items: center;
      margin-right: 8px;
      img{
        margin-left: 5px;
        width: 16px;
      }
    }
  }
 
}
.refund-content{
    margin:0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;

    .count-part{
        height: 60px;
        margin-bottom: 16px;
        border-bottom: 1px solid #D8D8D8;
        .item{
            display: flex;
            align-items: center;
            .text{
                font-size: 14px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #333333;
            }
        }
        .img-framelanflag{
            cursor: pointer;
            vertical-align: middle;
            margin-top: -3px;
            margin-left: 5px;
            width: 16px;
        }
        .input-money{
            width: 80px;margin:0 8px
        }
        .plus{
            margin: 0 16px;
            font-size: 14px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #979797;
        }
    }
    .total-part{
        display: flex;
        align-items: center;
        font-size: 14px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #333333;
    }
}

.AbnormalPriceMonitoreStrategy .ark-upload-drag {
  border: none;
}
.AbnormalPriceMonitoreStrategy .ark-select-multiple .ark-select-item.ark-select-item-all {
  display: none;
}
.priceMonitor .img-framelanflag {
  cursor: pointer;
  vertical-align: middle;
  margin-top: 0px;
  margin-left: 0px;
  width: 16px;
}
.AbnormalPriceMonitoreStrategy .input_box.ark-fkrp-select {
  width: 220px;
}

</style>
<style lang="less" scoped>
  .AbnormalPriceMonitoreStrategy {
    min-width: 1380px;
  }
 .pageContent {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
  }
  .order-setting-input-error:before{
    content: '*';
    color: red;
  }
  .conditionContent,.conditionContentOne {
    width: 100%;
    display: flex;
    max-height: 3000px;
    overflow: hidden;
    flex-wrap: wrap;
    padding-top: 8px;   
    justify-content: space-between;
    .itemContent {
      width: calc((100% - 120px) / 3);
      display: flex;
      align-items: center;
      margin:0 20px 24px;
      .itemLabel {
        min-width: 84px;
        font-size: 12px;
        font-weight: 500;
        color: #4C4C4C;
        line-height: 17px;
        margin-right: 8px;
        text-align: right;
      }
      .posterType {
        width: calc(100% - 84px);
      }
    }
  }
  .tableArea /deep/ .ark-tabs-bar{
    margin-bottom: 0px;
    .ark-tabs-tab{
      line-height: 22px !important;
    }
  }
  .tableArea{
    // padding-top:24px;
    .handleBtn{
        height:16px;
        margin-bottom:16px;
        display:flex;
        .handleItem{
          width: 48px;
          height: 16px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: var(--primary-color);
          line-height: 16px;
          margin: 0 2px;
          cursor: pointer;
        }
    }
  }
  .content /deep/ .ark-select-input[disabled]{
      color: #575757;
  }
  .bottomTips {
    color: #989898;
    font-size: 12px;
    line-height: 20px;
    margin-top: 6px;
  }
</style>
