<template>
  <div class='onlyReturnMoneyOrder' data-key='EDITOR_ACTIVE'>
    <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="closePage"
      >
        关闭
      </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 v-if='i.SKEY=="orderTimeRange"' v-model="i.VALUE" type="datetimerange" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择时间" style="width: 100%;max-width:400px;min-width: 180px;" transfer  @on-change="rangeDate"></DatePicker>
                    <TimePicker v-if='i.SKEY=="limit_time"' @on-change="onEventHandler(i, i.onChange, $event)" v-model="i.VALUE" :type="i.type"  :format="i.format" placeholder="请选择时间" style="width: 100%;max-width:400px;min-width: 180px;"></TimePicker>
                    <TimePicker v-if='i.SKEY=="limit_range_time_start"' v-model="i.VALUE" format="HH:mm" placeholder="请选择时间" style="width: 100%;max-width:400px;min-width: 180px;" @on-change="setLimitStartDate"></TimePicker>
                    <TimePicker v-if='i.SKEY=="limit_range_time_end"' v-model="i.VALUE" format="HH:mm" placeholder="请选择时间" style="width: 100%;max-width:400px;min-width: 180px;" @on-change="setLimitEndDate"></TimePicker>
                    <div v-if='i.SKEY=="refund_imgUrl"'>
                      <ImageUpload
                        multiple
                        :dataitem="dataitem"
                        @uploadFileChangeSuccess='changeSuccess'
                        @deleteImg="deleteImg"
                      ></ImageUpload>
                    </div>
                    <DropDownSelectFilter
                            :single="true"
                            v-if="(i.SKEY=='refund_reason') || (i.SKEY=='PAYTYPE')"
                            class="input_box"
                            :data="i.shopData"
                            :totalRowCount="i.shopData.totalRowCount"
                            :showColnameKey="'isak'"
                            :defaultSelected="i.defaultSelected"
                            @on-page-change="changePageShop($event,i)"
                            @on-input-value-change="InputValueChangeShop($event,i)"
                            @on-popper-show="searchShopData(i)"
                            @on-fkrp-selected="checkDataShop($event,i)"
                            @on-focus="focusInputValueChangeShop($event,i)"
                            @on-blur="changeDataShop($event,i)"
                            @on-clear="clearDataShop(i)"
                            :dataEmptyMessage="i.dataEmptyMessage"
                            :columns="i.columns"
                            :AutoData="i.AutoData">
                    </DropDownSelectFilter>
                  <Select v-model="i.VALUE" @on-change="onEventHandler(i, i.onChange, $event)" :multiple="(i.SKEY=='shop_name' || i.SKEY=='warehouse_name' || i.SKEY=='brand_name' || i.SKEY=='region_name')?true:false" :filterable="(i.SKEY=='shop_name' || i.SKEY=='warehouse_name' || i.SKEY=='brand_name')?true:false" clearable :disabled="i.disabled" class="input_box" v-else-if="(i.SKEY=='shop_name')||(i.SKEY=='warehouse_name')||(i.SKEY=='brand_name')||(i.SKEY=='orderType')
                    ||(i.SKEY=='orderTimeType')
                    ||(i.SKEY=='region_name') || (i.SKEY == 'restricted_double11_presale') || (i.SKEY == 'restricted_double11_presale_node') || (i.SKEY == 'gift_method') || (i.SKEY == 'activegoodstype')"  @on-query-change="checkInputSKU($event,i)">
                      <Option v-for="d in i.optionList" :value="d.value" :key="d.value">{{ d.label }}</Option>
                  </Select>
                  <Button v-else-if="i.SKEY === 'setSendAreaBtn'" size='small' type="fcdefault" @click="setSendAreaHandle">{{ i.btnTxt }}</Button>
                  <Input
                    v-else-if="
                    (i.SKEY=='activeName')
                    ||(i.SKEY=='satisfied_amount')
                    ||(i.SKEY=='satisfied_pieces')
                    ||(i.SKEY=='limit_buy_number')
                    ||(i.SKEY=='ALLHOSTNO')
                    "
                    class="input_box"
                    v-model="i.VALUE"
                    placeholder="请输入内容"
                    :disabled="i.disabled"
                    :regx="i.regx"
                    @on-keypress='noSpaces($event,i)'
                  />
                  <InputNumber v-else-if="(i.SKEY=='priority')" :min="1" v-model="i.VALUE" style="width: 100%;max-width:400px;min-width: 180px;"></InputNumber>
                  <Checkbox v-model="i.VALUE"
                    v-if="i.SKEY=='Enable' || i.SKEY=='activity_accumulation' || i.SKEY=='out_of_stock_gift' || i.SKEY=='activity_grouping' || i.SKEY=='multiple_gifts' || i.SKEY=='restricted_goods' || i.SKEY=='exclude_goods' || i.SKEY == 'is_send_later' || i.SKEY == 'one_yuan_reservation'"
                    :disabled="i.disabled"
                    @on-change="changCheckbox($event,i)"></Checkbox>
                </Col>
                <Col span="24"  v-else-if="i.remark" style="align-items: flex-start;">
                  <div
                      v-if="i.title"
                      :class="{'title':true,'order-setting-input-error':i.required}"
                      style="margin-top: 6px;"
                    >{{ 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>
                  <Input
                    style="max-width: 1000px;"
                    :rows="2"
                    v-model="i.VALUE"
                    :disabled="i.disabled"
                    type="textarea"
                    v-if="(i.SKEY=='remark' || i.SKEY=='REMARKEGIFT')"
                    placeholder="请输入内容" />
                </Col>
              </div>
              </Row>
            </div>
          </div>
        </foldpanel>
      </div>
    </div>
    <div class="tableArea" v-if="showDetailTable">
      <Tabs type="card" :value='tabName' v-model='tabName'>
        <TabPane label="赠送商品" name="name1">
            <Row style="display: flex;
                justify-content: space-around;
                align-items: center;
                height: 48px;
                margin-bottom: 16px;
                background: #F8F8F8;">
              <Col span="4">
              <div style="display: flex;align-items: center;">
                <label style="width: 30px;">SKU</label>
                <Select
                  ref="returnSelect"
                  style="width:240px"
                  v-model="selectReturnSKUID"
                  @on-query-change="getReturnSkuList"
                  @on-change="selectReturnGoods"
                  @on-enter="addReturnGoods"
                  filterable
                  clearable
                >
                  <Option v-for="(option,index) in SKUArrReturn" :key="index" :value="option.value" :label="option.label">{{option.label}} {{option.NORMS1NAME || '  '}} {{option.NORMS1CODE || '  '}} {{option.NORMS2NAME || '  '}} {{option.NORMS2CODE || '  '}}</Option>
                </Select>
                <img
                  style="width:16px;margin-left:8px"
                  src="../../assets/icon/search.png"
                  @click="searchGoods('return')"
                  >
              </div>
              </Col>
              <Col span="4" >
              <div style="display: flex;align-items: center;">
                <label style="width: 40px;">数量</label>
                <Input style="width:240px" :regx='regx' v-model="returnGoodsNum" @on-enter="addReturnGoods"></Input>
              </div>
              </Col>
              <Col span="2" >
              <Button type="primary" icon="md-return-left" @click="addReturnGoods">添加商品</Button>
              </Col>
              <Col span="4" ></Col>
              <Col span="4" ></Col>

            </Row>
            <div class="handleBtn">
              <div class="operate-wrap-left">
                <div class="handleItem" @click="deleteReturnGoods">【删除】</div>
                <!-- 赠送方式不能为空，根据赠送方式配置模板和导入 -->
                <div class="handleItem" v-if='tabList[1].list.find(item=>item.SKEY=="gift_method").VALUE' @click="importGiftGoodsExcel">【导入】</div>
                <div class="handleItem" @click="commonExportHandle">【导出】</div>
              </div>
              <div class="operate-wrap-right" style="display: flex;width: 60%;justify-content:end">
                <filterGoods ref="freeFilterGoods" :optionList="searchOption" v-on:commonSearchFn="filterSearchHandle" />
              </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"
                :page-size="pageSizeReturn"
                :page-size-opts="pageSizeOpts"
                show-total
                show-sizer
                @on-change="changePageReturn"
                @on-page-size-change="changeSizeReturn"
              />
            </div>
        </TabPane>
        <TabPane label="指定商品" name="name2" v-if='tabList[1].list.find(item=>item.SKEY=="activegoodstype").VALUE == 1'>
            <Row style="display: flex;
                justify-content: space-around;
                align-items: center;
                height: 48px;
                margin-bottom: 16px;
                background: #F8F8F8;">
              <Col span="8">
              <div style="display: flex;align-items: center;">
                <label style="width: 50px;">商品选择</label>
                <Select
                  ref="JoinSelect"
                  style="width:130px;margin: 0 6px;"
                  v-model='selectGoodTypeOne'
                  @on-change="changeSelectGoodTypeOne">
                  <Option v-for="(option,index) in selectGoodTypeList" :key="index" :value="option.value">{{option.label}}</Option>
                </Select>
                <Select
                  ref="JoinSelect"
                  style="width:240px"
                  v-model="selectJoinSKUID"
                  @on-query-change="getJoinSkuList"
                  @on-change="selectJoinGoods"
                  @on-enter="addJoinGoods"
                  filterable
                  clearable
                >
                  <Option v-for="(option,index) in SKUArrJoin" :key="index" :value="option.value">{{option.label}}</Option>
                </Select>
                <img
                  style="width:16px;margin-left:8px"
                  src="../../assets/icon/search.png"
                  @click="searchGoods('return')"
                  >
                  <!--  -->
              </div>
              </Col>
              <Col span="2" >
              <Button type="primary" icon="md-return-left" @click="addJoinGoods">添加商品</Button>
              </Col>
              <Col span="4" >
              <!-- <div style="display: flex;align-items: center;">
                <label style="width: 40px;">数量</label>
                <Input style="width:240px" :regx='regx' v-model="JoinGoodsNum" @on-enter="addJoinGoods"></Input>
              </div> -->
              </Col>
              <Col span="4" ></Col>
            </Row>
            <div class="handleBtn" v-if='!tabList[0].list.find(item=>item.SKEY=="Enable").VALUE'>
              <div class="operate-wrap-left">
                <div class="handleItem" @click="deleteJoinGoods">【删除】</div>
                <div class="handleItem" @click="exportJoinGoods">【导入】</div>
                <div class="handleItem" @click="commonExportHandle">【导出】</div>
              </div>
              <div class="operate-wrap-right" style="display: flex;width: 60%;justify-content:end">
                <filterGoods ref="joinFilterGoods" :optionList="searchOption" v-on:commonSearchFn="filterSearchHandle" />
              </div>
            </div>
           <Table height="300"
            :columns="JoinColumns"
            :data="currentJoinData"
            @on-select="selectJoinData"
            @on-select-cancel="selectJoinCancel"
            @on-select-all="selectJoinDataAll"
            @on-select-all-cancel="selectJoinDataCancel"
           ></Table>
           <div class="pageContent">
              <Page
                size="small"
                :current="JoinCurrentPage"
                show-elevator
                :total="totalJoin"
                :page-size="pageSizeJoin"
                :page-size-opts="pageSizeOpts"
                show-total
                show-sizer
                @on-change="changePageJoin"
                @on-page-size-change="changeSizeJoin"
              />
            </div>
        </TabPane>
        <TabPane label="排除商品" name="name3" v-if='tabList[1].list.find(item=>item.SKEY=="activegoodstype").VALUE == 2'>
            <Row style="display: flex;
                justify-content: space-around;
                align-items: center;
                height: 48px;
                margin-bottom: 16px;
                background: #F8F8F8;">
              <Col span="8">
              <div style="display: flex;align-items: center;">
                <label style="width: 50px;">商品选择</label>
                <Select
                  ref="JoinSelect"
                  style="width:130px;margin: 0 6px;"
                  v-model='selectGoodTypeTwo'
                  @on-change="changeSelectGoodTypeTwo">
                  <Option v-for="(option,index) in selectGoodTypeList" :key="index" :value="option.value">{{option.label}}</Option>
                </Select>
                <Select
                  ref="ExcludeSelect"
                  style="width:240px"
                  v-model="selectExcludeSKUID"
                  @on-query-change="getExcludeSkuList"
                  @on-change="selectExcludeGoods"
                  @on-enter="addExcludeGoods"
                  filterable
                  clearable
                >
                  <Option v-for="(option,index) in SKUArrExclude" :key="index" :value="option.value">{{option.label}}</Option>
                </Select>
                <img
                  style="width:16px;margin-left:8px"
                  src="../../assets/icon/search.png"
                  @click="searchGoods('return')"
                  >
              </div>
              </Col>
              <Col span="2" >
              <Button type="primary" icon="md-return-left" @click="addExcludeGoods">添加商品</Button>
              </Col>
              <Col span="4" >
              <!-- <div style="display: flex;align-items: center;">
                <label style="width: 40px;">数量</label>
                <Input style="width:240px" :regx='regx' v-model="ExcludeGoodsNum" @on-enter="addExcludeGoods"></Input>
              </div> -->
              </Col>

              <Col span="4" ></Col>
            </Row>
            <div class="handleBtn" v-if='!tabList[0].list.find(item=>item.SKEY=="Enable").VALUE'>
              <div class="operate-wrap-left">
                <div class="handleItem" @click="deleteExcludeGoods">【删除】</div>
                <div class="handleItem" @click="exportJoinGoods">【导入】</div>
                <div class="handleItem" @click="commonExportHandle">【导出】</div>
              </div>
              <div class="operate-wrap-right" style="display: flex;width: 60%;justify-content:end">
                <filterGoods ref="excludeFilterGoods" :optionList="searchOption" v-on:commonSearchFn="filterSearchHandle" />
              </div>
            </div>
           <Table height="300"
            :columns="ExcludeColumns"
            :data="currentExcludeData"
            @on-select="selectExcludeData"
            @on-select-cancel="selectExcludeCancel"
            @on-select-all="selectExcludeDataAll"
            @on-select-all-cancel="selectExcludeDataCancel"
           ></Table>
           <div class="pageContent">
              <Page
                size="small"
                :current="ExcludeCurrentPage"
                show-elevator
                :total="totalExclude"
                :page-size="pageSizeExclude"
                :page-size-opts="pageSizeOpts"
                show-total
                show-sizer
                @on-change="changePageExclude"
                @on-page-size-change="changeSizeExclude"
              />
            </div>
        </TabPane>
        <TabPane label="参与活动订单" name="name4" v-if='ISShowTab4'>
           <Table height="300"
            :columns="JoinActiveOrdersColumns"
            :data="currentJoinActiveOrdersData"
           ></Table>
           <div class="pageContent">
              <Page
                size="small"
                :current="JoinActiveOrdersCurrentPage"
                show-elevator
                :total="totalJoinActiveOrders"
                show-total
                show-sizer
                @on-change="changePageJoinActiveOrders"
                @on-page-size-change="changeSizeJoinActiveOrders"
              />
            </div>
        </TabPane>
        <TabPane label="参与活动买家" name="name5" v-if='ISShowTab5'>
          <div class="handleBtnSearch">
            <div class='searchList'>
              <Input
                style="width:180px"
                v-model="buyerOpenID"
                placeholder="请输入买家openid"
                @on-enter="getOMSACTIVEBUYER(buyerOpenID)"
              ></Input>
              <Button
                type="fcdefault"
                style="width:54px;height:24px;line-height:5px;margin-left:2px;margin-top:2px;padding:unset;"
                @click="getOMSACTIVEBUYER(buyerOpenID)"
              >搜索</Button>
            </div>
          </div>
           <Table height="300"
            :columns="JoinActiveBuyersColumns"
            :data="currentJoinActiveBuyersData"
           ></Table>
           <div class="pageContent">
              <Page
                size="small"
                :current="JoinActiveBuyersCurrentPage"
                show-elevator
                :total="totalJoinActiveBuyers"
                show-total
                show-sizer
                @on-change="changePageJoinActiveBuyers"
                @on-page-size-change="changeSizeJoinActiveBuyers"
              />
            </div>
        </TabPane>
        <TabPane label="日志明细表" name="name6" v-if='ISShowTab6'>
           <Table height="300"
            :columns="logsColumns"
            :data="currentLogsData"
           ></Table>
           <div class="pageContent">
              <Page
                size="small"
                :current="LogsCurrentPage"
                show-elevator
                :total="totalLogs"
                show-total
                show-sizer
                @on-change="changePageLogs"
                @on-page-size-change="changeSizeLogs"
              />
            </div>
        </TabPane>
      </Tabs>
    </div>
    <Modal
      v-model="selectGoodsModal"
      title="选择商品"
      width="900"
      :mask="mask"
      :closable="closable"
      :mask-closable="maskClosable"
      :footer-hide="hideFoot"
      @on-cancel="cancelSelectGoods">
        <div class="conditionContent">
          <div class="itemContent">
            <div class="itemLabel">
              商品名称
            </div>
            <Input
              style="width:240px"
              v-model="selectGoodsData.PRODUCTNAME"
              clearable
            />
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              商品编码
            </div>
            <Input
              style="width:240px"
              v-model="selectGoodsData.PRODUCTCODE"
              clearable
            />
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              SKU
            </div>
            <Input
              v-model="selectGoodsData.SKU"
              clearable
            />
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              国标码
            </div>
            <Input
              v-model="selectGoodsData.GBCODE"
              clearable
            ></Input>
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              颜色
            </div>
            <Input
              v-model="selectGoodsData.NORMS1NAME"
              clearable
            ></Input>
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              尺寸
            </div>
            <Input
              v-model="selectGoodsData.NORMS2NAME"
              clearable
            ></Input>
          </div>

        </div>
        <ShrinkOrExtend
          :height="shrinkHeight"
          :current-value="currentValue"
          @click="upOrDown(shrinkHeight)"
          @on-reset="resetGoodsData"
          @on-query="searchGoodsData"
        />
        <Table
        :height="tableHeight"
        :columns="SKUColumns"
        :data="GoodsData"
        highlight-row
        @on-current-change="selectGoods"
        ></Table>
        <div class="pageContent">
          <Page
            size="small"
            :current="GoodsCurrentPage"
            show-elevator
            :total="totalGoods"
            show-total
            show-sizer
            @on-change="changePageGoods"
            @on-page-size-change="changeSizeGoods"
          />
        </div>
      <footer style="display: flex; justify-content: center; margin-top: 12px;padding-top: 16px;border-top: 1px solid #DEDEDE;;">
        <Button
          type="fcdefault"
          @click="cancelSelectGoods"
        >
          取消
        </Button>
        <Button
          type="posdefault"
          style="margin-left: 16px"
          @click="okSelectGoods"
        >
          确认
        </Button>
      </footer>
    </Modal>
    <Modal
      v-model="selectPlatformGoodsModal"
      title="选择平台商品"
      width="900"
      :mask="mask"
      :closable="closable"
      :mask-closable="maskClosable"
      :footer-hide="hideFoot"
      @on-cancel="cancelSelectPlatformGoods">
        <div class="conditionContentOne">
          <div class="itemContent">
            <div class="itemLabel">
              系统商品编码
            </div>
            <Input
              style="width:240px"
              v-model="selectPlatformGoodsData.PRODUCTCODE"
              clearable
            />
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              系统SKU编码
            </div>
            <DropMultiSelectFilter
                  ref="SKUID"
                  single
                  class="input_box"
                  :data="SystemSKUList"
                  :default-selected="defaultSelectedSystemSKU"
                  :total-row-count="SystemSKUtotalRowCount"
                  :show-colname-key="'isak'"
                  :columns="columnsSystemSKU"
                  :auto-data="SystemSKUAutoData"
                  @on-page-change="changePageShop($event,'SKUID')"
                  @on-input-value-change="InputValueChangeShop($event,'SKUID')"
                  @on-popper-show="searchShopData('SKUID')"
                  @on-fkrp-selected="checkDataShop($event,'SKUID')"
                  @on-focus="focusInputValueChangeShop($event,'SKUID')"
                  @on-clear="clearDataShop('SKUID')"
                />
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              店铺
            </div>
            <!-- <Input
              v-model="selectPlatformGoodsData.SHOPID"
              clearable
            /> -->
            <DropMultiSelectFilter
                  ref="shopID"
                  single
                  class="input_box"
                  :data="shopIDList"
                  :default-selected="defaultSelectedshopID"
                  :total-row-count="shopIDtotalRowCount"
                  :show-colname-key="'isak'"
                  :columns="columnsshopID"
                  :auto-data="shopIDAutoData"
                  @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>
            <Input
              v-model="selectPlatformGoodsData.NUMIID"
              clearable
            ></Input>
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              平台SKU编码
            </div>
            <Input
              v-model="selectPlatformGoodsData.EXTSKUID"
              clearable
            ></Input>
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              平台商品标题
            </div>
            <Input
              v-model="selectPlatformGoodsData.TITLE"
              clearable
            ></Input>
          </div>

        </div>
        <ShrinkOrExtend
          :height="shrinkHeight"
          :current-value="currentPlatformValue"
          @click="upOrDownOne(shrinkHeight)"
          @on-reset="resetPlatformGoodsData"
          @on-query="searchPlatformGoodsData"
        />
        <Table
        :height="tableHeight"
        :columns="SKUPlatformColumns"
        :data="PlatformGoodsData"
        highlight-row
        @on-current-change="selectPlatformGoods"
        ></Table>
        <div class="pageContent">
          <Page
            size="small"
            :current="PlatformGoodsCurrentPage"
            show-elevator
            :total="totalPlatformGoods"
            show-total
            show-sizer
            @on-change="changePagePlatformGoods"
            @on-page-size-change="changeSizePlatformGoods"
          />
        </div>
      <footer style="display: flex; justify-content: center; margin-top: 12px;padding-top: 16px;border-top: 1px solid #DEDEDE;;">
        <Button
          type="fcdefault"
          @click="cancelSelectPlatformGoods"
        >
          取消
        </Button>
        <Button
          type="posdefault"
          style="margin-left: 16px"
          @click="okSelectPlatformGoods"
        >
          确认
        </Button>
      </footer>
    </Modal>
    <Modal
      v-model="showTip"
      mask
      :mask-closable="maskClosable"
      title="警告"
      title-align="left"
      class-name="showTipModel"
      width="400px"
      @on-ok="resetData"
    >
      <p><i class="iconfont iconbj_doubt fcWarning " />修改的数据未保存，确定刷新？</p>
    </Modal>
    <GiftActiveGoodsImport :visible='GiftActiveGoodsvisible' :giftType='tabList[1].list.find(item=>item.SKEY=="gift_method").VALUE' :isGroup="this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').VALUE" @closeActionDialog = 'closeActionDialogGift' :pageMsgId='pageMsgId' @changeGiftGoods="changeGiftGoodsImport"></GiftActiveGoodsImport>
    <JoinActiveGoodsImport :type='tabName' :visible='JoinActiveGoodsvisible' @closeActionDialog = 'closeActionDialog' :pageMsgId='pageMsgId'></JoinActiveGoodsImport>
    <Modal
      v-model="showArea"
      mask
      footer-hide
      :mask-closable="maskClosable"
      title="设置指定区域"
      title-align="left"
      width="800px">
      <setSendArea fromType="omsActive" :areaList="sendAreaList" v-on:callBack="areaBackFn" />
    </Modal>
  </div>
</template>
<script>
  import foldPanel from '../customizedContent/FoldPanel.vue'; // 折叠面板组件
  import ShrinkOrExtend from '../customizedContent/shrinkOrExtend' //收缩伸展搜索条件组件
  import tableFaker from '../customizedContent/tableFaker.vue'; //表格组件
  import JoinActiveGoodsImport from '../modal/JoinActiveGoodsImport.vue'; // 指定商品导入弹框
  import GiftActiveGoodsImport from '../modal/GiftActiveGoodsImport.vue'; // 赠送商品导入弹框
  import setSendArea from '../modal/setSendArea/setSendArea.vue';//设置区域
  import filterGoods from './components/activeFilter/activeFilter.vue'; // 公用的商品查询
  const R3 = window.R3;
  const { network, urlSearchParams, store } = R3;
  export default {
    data() {
      return {
        isShowLimitGiftNum: false,
        NORMSTYPEOptions:[ // 参与活动规格类型
        {
            name: '尺寸名称',
            value: 1
          },
          {
            name: '尺寸code',
            value: 2
          },
          {
            name: '颜色名称',
            value: 3
          },
          {
            name: '颜色code',
            value: 4
          },
        ],
        GiftActiveGoodsvisible: false,
        JoinActiveGoodsvisible: false,
        tabName: 'name1',
        ISShowTab4: false,
        ISShowTab5: false,
        ISShowTab6: false,
        // 指定商品，排除商品筛选类型
        selectGoodTypeOne: '1',
        selectGoodTypeTwo: '1',
        selectGoodTypeList: [
          {
            label: '按系统SKU编码',
            value: '1'
          },{
            label: '按系统商品编码',
            value: '2'
          },{
            label: '按平台SKU编码',
            value: '3'
          },{
            label: '按平台商品编码',
            value: '4'
          },
        ],
        SKUArrReturn:[],//赠送商品SKU下拉框列表
        SKUAllDataReturn:[],//赠送商品SKU下拉框列表完整数据
        selectReturnSKUData:{},//赠送商品选中的SKU数据
        selectReturnSKUID:'',//赠送商品sku下拉框双向数据绑定
        returnGoodsNum:1,//赠送商品数量

        SKUArrJoin:[],//指定商品SKU下拉框列表
        SKUAllDataJoin:[],//指定商品SKU下拉框列表完整数据
        selectJoinSKUData:{},//指定商品选中的SKU数据
        selectJoinSKUID:'',//指定商品sku下拉框双向数据绑定
        JoinGoodsNum:'',//指定商品数量

        SKUArrExclude:[],//排除商品SKU下拉框列表
        SKUAllDataExclude:[],//排除商品SKU下拉框列表完整数据
        selectExcludeSKUData:{},//排除商品选中的SKU数据
        selectExcludeSKUID:'',//排除商品sku下拉框双向数据绑定
        ExcludeGoodsNum:'',//排除商品数量

        regx: /^\d{0,15}?$/, // 正整数
        regx1: /^-?\d{0,15}(\.[0-9]{0,2})?$/,
        tabList: [
          {
            tabId: '1',
            tabtext: '基本设置',
            explainText: '(活动启用后，不允许修改)',
            blockShow: true,
            list: [
              {
                ID: '',
                SKEY: 'activeName',
                title: '活动名称',
                VALUE: '',
                company: '',
                tips: '',
                disabled:false,
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                explain:false, //是否有解释
              },
              {
                SKEY: 'priority',
                title: '优先级',
                VALUE: 1,
                defaultvalue: '',
                explain: true, //是否有解释
                company: '',
                tips: '',
                disabled:false,
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                explainContent:'数字越大，优先级越高',//解释文字
              },
              {
                SKEY: 'orderType',
                title: '订单类型',
                VALUE: '1',
                defaultvalue: '1',
                company: '',
                tips: '',
                disabled:false,
                required: true, // 是否为必填项
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                optionList:[
                  { label: '在线支付',value: '1' },
                  { label: '货到付款',value: '2' },
                  { label: '换货',value: '3' },
                ]
              },
              {
                ID: 'T_V_IESSHOP',
                SKEY: 'shop_name',
                title: '活动店铺',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:false,
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                standard:true,//标准输入框长度
                optionList:[]
              },
              {
                ID: 'T_IESWAREHOUSE',
                SKEY: 'warehouse_name',
                title: '活动仓库',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:false,
                flag: false, // 控制必填校验样式展示
                required: false, // 是否为必填项
                standard:true,//标准输入框长度
                optionList:[]
              },
              {
                ID: 'T_IESBRAND',
                SKEY: 'brand_name',
                title: '活动品牌',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:false,
                flag: false, // 控制必填校验样式展示
                required: false, // 是否为必填项
                standard:true,//标准输入框长度
                optionList:[]
              },
              {
                SKEY: 'orderTimeType',
                title: '时间类型',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:false,
                required: true, // 是否为必填项
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                optionList:[
                  { label: '支付时间',value: '1' },
                  { label: '下单时间',value: '2' }
                ]
              },
              {
                SKEY: 'orderTimeRange',
                title: '起止时间',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:false,
                required: true, // 是否为必填项
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
              },
              {
                standard:true,
                SKEY: 'setSendAreaBtn',
                title: '设置指定区域',
                btnTxt: '设置'
              },
              // {
              //   ID: 'T_OMSREGION',
              //   SKEY: 'region_name',
              //   title: '排除省',
              //   VALUE: [],
              //   defaultvalue: [],
              //   explain: true, //是否有解释
              //   company: '',
              //   tips: '',
              //   disabled:false,
              //   flag: false, // 控制必填校验样式展示
              //   required: false, // 是否为必填项
              //   standard:true,//标准输入框长度
              //   explainContent:'订单收货地址中被排除的省份，将不参与活动赠送',//解释文字
              //   optionList:[]
              // },
              {
                ID: '',
                SKEY: 'Enable',
                title: '启用',
                VALUE: true,
                defaultvalue: '',
                disabled:true,
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                TYPEONE: 'checkbox'
              },
              {
                ID: '',
                SKEY: 'remark',
                title: '活动描述',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:false,//标准输入框长度
                remark:true,//备注栏
                flag: false, // 控制必填校验样式展示
              },
            ]
          },
          {
            tabId: '2',
            tabtext: '特殊设置',
            blockShow: true,
            list: [
              {
                ID: '',
                SKEY: 'activity_accumulation',
                title: '活动累加',
                VALUE: false,
                defaultvalue: '',
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                explain:true, //是否有解释
                explainContent:'如果一个订单满足多个活动，是否还继续赠送该活动，对于优先级最高的活动无效，只针对优先级低的活动',
                TYPEONE: 'checkbox'
              },
              {
                ID: '',
                SKEY: 'multiple_gifts',
                title: '多倍赠送',
                VALUE: false,
                defaultvalue: '',
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                explain:true, //是否有解释
                explainContent:'如果本次订单中多倍满足了本次活动内容（满足金额或者满足件数），是否叠加赠送。注：金额或者件数以不为零的作为叠加条件，都不为零以金额优先。',
                TYPEONE: 'checkbox'
              },
              {
                ID: '',
                SKEY: 'out_of_stock_gift',
                title: '缺货赠送',
                VALUE: false,
                defaultvalue: '',
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                explain:true, //是否有解释
                explainContent:'勾选后，若赠送商品缺货，订单也会赠送',
                TYPEONE: 'checkbox'
              },
              {
                ID: '',
                SKEY: 'is_send_later',
                title: '赠品后发',
                VALUE: false,
                defaultvalue: '',
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                explain:true, //是否有解释
                explainContent:'勾选后，系统赠品将单独拆为一单，并在主品发货后根据系统参数中【赠品后发的发货节点】进行发货',
                TYPEONE: 'checkbox'
              },
              {
                ID: '',
                SKEY: 'activity_grouping',
                title: '活动分组',
                VALUE: false,
                disabled:false,
                defaultvalue: '',
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                TYPEONE: 'checkbox',
                explain:true,
                explainContent:'勾选后，一个促销可赠送多个赠品，组号相同的赠品会一起赠送',
              },
              {
                ID: '',
                SKEY: 'one_yuan_reservation',
                title: '仅1元预定订单参与',
                VALUE: false,
                disabled:false,
                defaultvalue: '',
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                TYPEONE: 'checkbox',
                explain:true,
                explainContent:'勾选后，将限制活动仅针对被识别为1元预定的主商品订单生效',
              },
              {
                ID: '',
                SKEY: 'limit_time',
                title: '限制时间',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                // TYPEONE: 'checkbox',
                type: 'timerange',
                format: 'HH:mm:ss',
                explain:true,
                explainContent:'仅在限制时间范围内的订单才参与促销活动',
                onChange: (value) => {
                  this.limitStartDate = value[0]
                  this.limitEndDate = value[1]
                }
              },
              {
                SKEY: 'restricted_double11_presale',
                title: '定金预售',
                VALUE: '2',
                defaultvalue: '2',
                company: '',
                tips: '',
                disabled:false,
                required: true, // 是否为必填项
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                optionList:[
                  { label: '定金预售订单不参与促销',value: '0' },
                  { label: '仅定金预售订单参与促销',value: '1' },
                  { label: '不限制',value: '2' }
                ],
                explain:true,
                explainContent:'配置定金预售订单是否参与促销，或仅定金预售订单参与促销',
                onChange: (e) => {
                  if(e == 0){
                    this.tabList[1].list.find(item=>item.SKEY=='restricted_double11_presale_node').standard = false;
                  }else {
                    this.tabList[1].list.find(item=>item.SKEY=='restricted_double11_presale_node').standard = true;
                  }
                }
              },
              {
                SKEY: 'restricted_double11_presale_node',
                title: '定金预售订单执行促销节点',
                VALUE: '0',
                defaultvalue: '0',
                company: '',
                tips: '',
                disabled:false,
                required: true, // 是否为必填项
                standard: true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                optionList:[
                  { label: '支付定金时执行促销',value: '0' },
                  { label: '支付尾款后执行促销',value: '1' }
                ],
                explain:true,
                explainContent:'设置定金预售订单在支付定金/支付尾款时执行促销，需结合店铺的预售未付尾款订单转换进订单管理节点一起判断；支付定金时执行促销，判断的金额是支付的定金金额',
              },
              // {
              //   SKEY: 'limit_range_time_start',
              //   title: '限时开始',
              //   VALUE: '',
              //   defaultvalue: '',
              //   company: '',
              //   tips: '',
              //   disabled:false,
              //   required: false, // 是否为必填项
              //   standard:true,//标准输入框长度
              //   flag: true, // 控制必填校验样式展示
              // },
              // {
              //   SKEY: 'limit_range_time_end',
              //   title: '限时结束',
              //   VALUE: '',
              //   defaultvalue: '',
              //   company: '',
              //   tips: '',
              //   disabled:false,
              //   required: false, // 是否为必填项
              //   standard:true,//标准输入框长度
              //   flag: true, // 控制必填校验样式展示
              // },
              {
                ID: '',
                SKEY: 'satisfied_amount',
                title: '满足金额',
                VALUE: '',
                company: '',
                tips: '',
                disabled:false,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                required: false, // 是否为必填项
                explain:true, //是否有解释
                explainContent:'订单满足金额才会参与促销，会根据指定/排除商品过滤',
              },
              {
                ID: '',
                SKEY: 'satisfied_pieces',
                title: '满足件数',
                VALUE: '',
                company: '',
                tips: '',
                disabled:false,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                required: false, // 是否为必填项
                explain:true, //是否有解释
                explainContent:'订单满足数量才会参与促销，会根据指定/排除商品过滤',
              },
              {
                SKEY: 'gift_method',
                title: '赠送方式',
                VALUE: '1',
                defaultvalue: '1',
                company: '',
                tips: '',
                disabled:false,
                required: true, // 是否为必填项
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                optionList:[
                  { label: '普通赠送',value: '1' },
                  { label: '满金额件数赠送',value: '2' },
                  { label: '按排名分组赠送',value: '3' },
                  { label: '随机分组赠送',value: '4' },
                  { label: '按尺码对应赠送',value: '5' },
                  { label: '按买家备注赠送',value: '6' },
                  { label: '按卖家备注赠送',value: '7' },
                  { label: '按金额阶梯赠送',value: '8' },
                  { label: '按数量阶梯赠送',value: '9' },
                ],
                onChange: (e) => {
                  // 删除组号
                  const index = this.returnColumns.findIndex(item => item.key === 'ORDERBY')
                  if(index > -1) {
                    this.returnColumns.splice(index,1)
                  }

                  // 表单里联动显示备注字段
                  this.showKeyWord(e)

                  // 选择“按金额阶梯赠送”
                  this.priceLinkage(e)

                  // 选择“按数量阶梯赠送”
                  this.numLinkage(e)
                }
              },
              {
                SKEY: 'activegoodstype',
                title: '指定/排除商品',
                VALUE: '0',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:false,
                required: true, // 是否为必填项
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                optionList:[
                  { label: '不指定不排除',value: '0' },
                  { label: '指定商品',value: '1' },
                  { label: '排除商品',value: '2' },
                ]
              },
              {
                SKEY: 'ALLHOSTNO',
                title: '主播ID',
                VALUE: '',
                defaultvalue: '',
                explain: true, //是否有解释
                company: '',
                tips: '',
                disabled:false,
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                explainContent:'支持输入多个，多个用英文逗号、分号、空格隔开',
               
              },
            ]
          },
        ],
        returnColumns: [ //赠送商品
            {
              type: 'selection',
              width: 60,
              align: 'center'
            },
            {
              type: 'index',
              align: 'center',
              title: '序号',
            },
            {
              title: '商品名称',
              align: 'center',
              key: 'TITLE'
            },
            {
              title: '商品SKU',
              align: 'center',
              key: 'SKU'
            },
            // 新增字段
            {
              title: '赠送件数',
              align: 'center',
              key: 'NUM',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.NUM,
                      number: true
                    },
                    on: {
                      'on-blur': (event) => {
                        let chengeData=this.currentReturnData[params.index]
                        // this.returnData[params.index].NUM = event.target.value
                        // this.returnData.forEach((item)=>{
                        //     if((item.SKU==chengeData.SKU)){
                        //       item.NUM = event.target.value
                        //     }
                        // })
                        const value = event.target.value
                        const index = ((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index
                        this.returnData[index].NUM = value;
                        this.totalReturn=this.returnData.length;
                        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                        let endIndex=startIndex+this.pageSizeReturn
                        this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                      }
                    }
                  },
                );
              },
            },
            {
              title: '总共要送的件数',
              align: 'center',
              key: 'ALLNUM',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.ALLNUM
                    },
                    on: {
                      'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          // event.target.value=this.parser(event.target.value)
                          // this.returnData[params.index].ALLNUM = this.parser(event.target.value);
                          // this.returnData.forEach((item)=>{
                          //   if((item.SKU==chengeData.SKU)){
                          //     item.ALLNUM = event.target.value
                          //   }
                          // })
                          const value = event.target.value
                          const index = ((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index
                          this.returnData[index].ALLNUM = value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                      }
                    }
                  },
                );
              },
            },
            {
              title: '已赠送数量',
              align: 'center',
              key: 'CURNUM',
            },
            {
              title: '赠品无需退回',
              align: 'center',
              key: 'AUTOREFUND',
              render: (h, params) => {
                let this_=this
                return h(
                  'Checkbox',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.AUTOREFUND
                    },
                    on: {
                      'on-change': (event) => {
                        const currentData=this.currentReturnData[params.index]
                        this.returnData.forEach((item)=>{
                            if((item.SKU==currentData.SKU)){
                              item.AUTOREFUND = event
                            }
                        })
                      }
                    }
                  },
                );
              },
            },
        ],
        tableHeight:'200',//表格高度

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

        // 指定商品
        JoinColumns: [ //指定商品
            {
              type: 'selection',
              width: 60,
              align: 'center'
            },
            {
              type: 'index',
              align: 'center',
              title: '序号',
            },
            {
              title: '商品选择',
              align: 'center',
              key: 'GoodsTypeName'
            },
            {
              title: '商品编码信息',
              align: 'center',
              key: 'GOODCODE'
            },
            {
              title: '商品名称信息',
              align: 'center',
              key: 'TITLE'
            },
            // 新增字段
            // {
            //   title: '数量',
            //   align: 'center',
            //   key: 'NUM',
            //   render: (h, params) => {
            //     let this_=this
            //     return h(
            //       'Input',
            //       {
            //         style: {
            //           width:'66px'
            //         },
            //         props: {
            //           value: params.row.NUM,
            //           number: true
            //         },
            //         on: {
            //           'on-blur': (event) => {
            //             let chengeData=this.currentReturnData[params.index]
            //             this.returnData[params.index].NUM = event.target.value
            //             this.totalReturn=this.returnData.length;
            //             let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
            //             let endIndex=startIndex+this.pageSizeReturn
            //             this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
            //           }
            //         }
            //       },
            //     );
            //   },
            // },
        ],
        currentJoinData:[],//当前显示指定商品明细
        JoinData:[],
        JoinDataNoSame:[],//弹窗中没有的指定商品
        submitArrJoin:[],//选中的指定商品
        // 指定商品page
        JoinCurrentPage:1,
        totalJoin: 0, // 总条数
        currentPageJoin: 0, // 页码
        pageSizeJoin: 20, // 每页的条数

        // 排除商品
        ExcludeColumns: [ //排除商品
            {
              type: 'selection',
              width: 60,
              align: 'center'
            },
            {
              type: 'index',
              align: 'center',
              title: '序号',
            },
            {
              title: '商品选择',
              align: 'center',
              key: 'GoodsTypeName'
            },
            {
              title: '商品编码信息',
              align: 'center',
              key: 'GOODCODE'
            },
            {
              title: '商品名称信息',
              align: 'center',
              key: 'TITLE'
            },
        ],
        currentExcludeData:[],//当前显示排除商品明细
        ExcludeData:[],
        ExcludeDataNoSame:[],//弹窗中没有的排除商品
        submitArrExclude:[],//选中的排除商品
        // 排除商品page
        ExcludeCurrentPage:1,
        totalExclude: 0, // 总条数
        currentPageExclude: 0, // 页码
        pageSizeExclude: 20, // 每页的条数

        // 参与活动订单
        JoinActiveOrdersColumns: [ //参与活动订单
            {
              type: 'index',
              align: 'center',
              title: '序号',
            },
            {
              title: '活动编号',
              align: 'center',
              key: 'OMSACTIVEID'
            },
            {
              title: '订单编号',
              align: 'center',
              key: 'OMSONLINEORDERID'
            },
            {
              title: '是否赠送',
              align: 'center',
              key: 'IS_SEND'
            },
            {
              title: '赠品条码',
              align: 'center',
              key: 'SKU'
            },
            {
              title: '赠送数量',
              align: 'center',
              key: 'NUM'
            },
            {
              title: '活动组号',
              align: 'center',
              key: 'ORDERBY'
            },
            {
              title: '活动明细ID',
              align: 'center',
              key: 'OMSACTIVESKU_ID'
            }
        ],
        currentJoinActiveOrdersData:[],//当前显示参与活动订单明细
        JoinActiveOrdersData:[],
        JoinActiveOrdersDataNoSame:[],//弹窗中没有的参与活动订单
        submitArrJoinActiveOrders:[],//选中的参与活动订单
        // 参与活动订单page
        JoinActiveOrdersCurrentPage:1,
        totalJoinActiveOrders: 0, // 总条数
        currentPageJoinActiveOrders: 0, // 页码
        pageSizeJoinActiveOrders: 10, // 每页的条数

        // 参与活动买家
        buyerOpenID: '',//搜索框
        JoinActiveBuyersColumns: [ //参与活动买家
            {
              type: 'index',
              align: 'center',
              title: '序号',
            },
            {
              title: '活动编号',
              align: 'center',
              key: 'OMSACTIVEID'
            },
            {
              title: '参与活动次数',
              align: 'center',
              key: 'JOINACTIVENUM'
            },
            {
              title: '买家openid',
              align: 'center',
              key: 'USERNICK'
            },
        ],
        currentJoinActiveBuyersData:[],//当前显示参与活动买家明细
        JoinActiveBuyersData:[],
        JoinActiveBuyersDataNoSame:[],//弹窗中没有的参与活动买家
        submitArrJoinActiveBuyers:[],//选中的参与活动买家
        // 参与活动订单page
        JoinActiveBuyersCurrentPage:1,
        totalJoinActiveBuyers: 0, // 总条数
        currentPageJoinActiveBuyers: 0, // 页码
        pageSizeJoinActiveBuyers: 10, // 每页的条数

        // 日志明细表
        logsColumns: [
            {
              type: 'index',
              align: 'center',
              title: '序号'
            },
            {
              title: '日志类型',
              align: 'center',
              key: 'LOGTYPE'
            },
            {
              title: '日志内容',
              align: 'center',
              width: 900,
              tooltip: true,
              key: 'LOGMSG'
            },
            {
              title: '操作人',
              align: 'center',
              key: 'OWNERID'
            },
            {
              title: '操作时间',
              align: 'center',
              key: 'CREATIONDATE'
            },
          ],
          logsData:[],
          currentLogsData: [],
          LogsCurrentPage:1,
          totalLogs: 0, // 总条数
          currentPageLogs: 0, // 页码
          pageSizeLogs: 10, // 每页的条数

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

        // 系统商品选择商品弹框
        selectGoodsModal:false,//选择商品弹窗
        nowGoodsType:'',//当前商品表类型
        selectGoodsData:{//选择商品搜索条件
          NORMS1NAME:'',//颜色
          NORMS2NAME:'',//尺寸
          SKU:'',//SKU
          GBCODE:'',//国标码
          PRODUCTCODE:'',//商品编码
          PRODUCTNAME:''//商品名称
        },
        submitArrGoods:[],//选择商品表格选中项
        SKUColumns:[
          {
            title: 'SKU',
            key: 'SKU'
          },
          {
            title: '商品编码',
            key: 'PRODUCTCODE'
          },
          {
            title: '销售价',
            key: 'SELLPRICE'
          },
          {
            title: '商品名称',
            key: 'PRODUCTNAME'
          },
          {
            title: '颜色',
            key: 'NORMS1NAME'
          },
          {
            title: '尺寸',
            key: 'NORMS2NAME'
          },
          {
            title: '重量',
            key: 'WEIGHT'
          },
          {
            title: '库位',
            key: 'STORESITE'
          },
          {
            title: '国标码',
            key: 'GBCODE'
          },
          {
            title:'图片地址',
             key: 'PICTUREURL',
              render: (h, params) => {
                return h(
                  'div',
                  {
                    class:{
                      imgBox:true
                    },
                    style: {
                      zIndex: 999,
                      width:'60px',
                      height:'60px',
                      position:'relative'
                    },

                  },
                  [
                    h('Img',
                    {
                       style: {
                          width:'60px',
                          height:'60px'
                        },
                      attrs: {
                        src:params.row.PICTUREURL==''?'../../../static/img/camera.jpg':params.row.PICTUREURL,
                      },
                      on:{
                        'mouseenter':(e)=>{
                          var txt3=document.createElement("img");
                          txt3.id='enlargeImg'
                          txt3.src=params.row.PICTUREURL==''?'../../../static/img/camera.jpg':params.row.PICTUREURL
                          txt3.style.height='120px'
                          txt3.style.width='120px'
                          txt3.style.position='fixed'
                          if(this.currentValue){
                            txt3.style.top=($(".imgBox")[params.index].offsetParent.offsetHeight + $(".imgBox")[params.index].offsetTop - $(".imgBox")[params.index].offsetParent.scrollTop + 30)-100+'px';
                          }else{
                            txt3.style.top=($(".imgBox")[params.index].offsetParent.offsetHeight + $(".imgBox")[params.index].offsetTop - $(".imgBox")[params.index].offsetParent.scrollTop + 30)+'px';
                          }
                          txt3.style.left=($(".imgBox")[0].offsetLeft-$(".imgBox")[params.index].offsetParent.scrollLeft + 60 + 30)+'px'
                          $(".imgBox")[params.index].append(txt3)
                        },
                        'mouseleave':(e)=>{
                          $("#enlargeImg").remove();
                        }
                      }
                    },
                    )
                  ]

                )
              }
          },
          {
            title: 'SKU是否有效',
            key: 'ISVALID',
            render: (h, params) => {
              const vm = this;
              return h(
                'div',
                {
                  style: {
                   color:params.row.ISVALID==1?'#63A4FE':'#D70017'
                  },
                },
                [params.row.ISVALID==1?'是':'否']
              );
            },
          },
          {
            title: '安全库存数',
            key: 'SECURITYSTOCK'
          },
        ],
        GoodsData:[],//选择商品数据
        // 换货商品page
        totalGoods: 0, // 总条数
        currentGoodsPage:0, // 页码
        pageSizeGoods: 10, // 每页的条数
        GoodsCurrentPage: 1,

        // 平台商品选择商品弹框
        selectPlatformGoodsModal:false,//选择商品弹窗
        selectPlatformGoodsData:{//选择商品搜索条件
          SHOPID:'',//店铺
          SKUID:'',//系统SKU编码
          EXTSKUID:'',//平台SKU编码
          NUMIID:'',//平台商品编码
          PRODUCTCODE:'',//系统商品编码
          TITLE:''//平台商品标题
        },
        submitArrPlatformGoods:[],//选择商品表格选中项
        SKUPlatformColumns:[
          {
            title: '平台',
            key: 'PLATFORM'
          },
          {
            title: '店铺',
            key: 'SHOPID'
          },
          {
            title: '系统商品编码',
            key: 'PRODUCTCODE'
          },
          {
            title: '系统SKU编码',
            key: 'SKUID'
          },
          {
            title: '平台商品编码',
            key: 'NUMIID'
          },
          {
            title: '平台SKU编码',
            key: 'EXTSKUID'
          },
          {
            title: '平台商品标题',
            key: 'TITLE'
          },
        ],
        PlatformGoodsData:[],//选择商品数据
        // 换货商品page
        totalPlatformGoods: 0, // 总条数PlatformGoodsCurrentPage
        currentPlatformGoodsPage:0, // 页码
        pageSizePlatformGoods: 10, // 每页的条数
        PlatformGoodsCurrentPage: 1,

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

        // 平台商品选择商品弹框系统SKU编码参数
        SystemSKUList: {}, // 系统SKU编码下拉展示数据
        SystemSKUtotalRowCount: 0,
        SystemSKUcurrentIndex: 0, // 系统SKU编码搜索初始index
        SystemSKUAutoData: [], // 系统SKU编码模糊搜索的结果组
        columnsSystemSKU: ['name', 'value'], // 展现的组
        defaultSelectedSystemSKU: [],

        // 平台商品选择商品弹框店铺参数
        shopIDList: {}, // 店铺下拉展示数据
        shopIDtotalRowCount: 0,
        shopIDcurrentIndex: 0, // 店铺搜索初始index
        shopIDAutoData: [], // 店铺模糊搜索的结果组
        columnsshopID: ['name', 'value'], // 展现的组
        defaultSelectedshopID: [],

        VIRSTATUS: '', //当前订单状态

        limitGoodsType: 1, // 默认限制排除商品类型
        currentPlatformValue: '',
        limitStartDate: '',
        limitEndDate: '',
        LIMITGIFTNUM: '',
        showArea: false, // 是否显示设置配送区域
        sendAreaList: [],// 设置配送区域列表 [{ RECEIVPROVINCE: 420000, RECEIVCITY: 420100, RECEIVAREA: 420103 }]
        pageSizeOpts: [20, 50, 100, 500], // 数据权限弹窗更改每页多少条
        searchOption: [ { label: '商品名称', value: 'TITLE' }, { label: '商品SKU', value: 'SKU' }],
        freeFilterData: [], // 赠送商品搜索总数据-仅仅展示
        freeFilterOption: {}, // 搜索参数 key:value
        joinFilterData: [], // 指定商品搜索总数据-仅仅展示
        joinFilterOption: {}, // 搜索参数 key:value
        excludeFilterData: [], // 排除商品搜索总数据-仅仅展示
        excludeFilterOption: {}, // 搜索参数 key:value
      };
    },
    components: {
      foldPanel,
      ShrinkOrExtend,
      tableFaker,
      JoinActiveGoodsImport,
      GiftActiveGoodsImport,
      setSendArea,
      filterGoods,
    },
    watch: {
      // 弹框关闭时还原敏感列
      tabName(newVal, oldVal) {
        console.log(newVal, oldVal, 'newVal, oldVal')
        if(newVal && oldVal && newVal !== oldVal) {
          this.filterSearchFn(newVal);
        }
      }
    },
    created(){
      this.pageMsgId = this.$route.params.customizedModuleId;
      this.getOMSACTIVE(); // 获取活动主表信息
      this.getQuery('T_V_IESSHOP', { isactive: ['=Y'] });// 初始查询店铺名称列表
      this.getQuery('T_IESWAREHOUSE');// 初始查询仓库名称列表
      this.getQuery('T_IESBRAND');// 初始查询品牌名称列表
      // this.getQuery('T_OMSREGION', { regtype: ['=2'] });// 初始查询省份列表
      this.getOMSActiveSku(); // 获取活动赠送商品表
      this.getOMSACTIVEORDERS(); // 获取参与活动订单
      this.getOMSACTIVEBUYER(); // 获取参与活动买家
      this.getOMSActiveLogs(); // 获取日志明细
      this.getSendAreaFn();// 获取设置配送区域
    },
    methods: {
      // 清除查询的参数
      clearSearchFn() {
        switch (this.tabName) {
          case 'name1':
            this.freeFilterData = [];
            this.$refs.freeFilterGoods.clearSearch();
            break;
          case 'name2':
          this.joinFilterData = [];
          this.$refs.joinFilterGoods.clearSearch();
            break;
          case 'name3':
          this.excludeFilterData = [];
          this.$refs.excludeFilterGoods.clearSearch();
            break;
          default:
            break;
        }
      },
      // 过滤赠送商品
      filterFreeGoodsFn(option) {
        const { reFilter, filterKey, filterValue } = option || {};
        if (reFilter) {
          this.returnCurrentPage = 1; // 不管有没有都第一页开始
        }
        let copyData = JSON.parse(JSON.stringify(this.returnData));
        let endFilterData = copyData || [];
        if (filterValue) {
          endFilterData = copyData.filter(item => (item[filterKey] || "").indexOf(filterValue) >= 0);
        }
        this.freeFilterData = JSON.parse(JSON.stringify(endFilterData));
        this.totalReturn = this.freeFilterData.length;
        let startIndex = this.pageSizeReturn * (this.returnCurrentPage-1)
        let endIndex = startIndex + this.pageSizeReturn
        this.currentReturnData = this.freeFilterData.slice(startIndex, endIndex) //当前页面显示明细
      },
      // 过滤指定或者排除商品
      filterJoinFn(option) {
        const { reFilter, filterKey, filterValue } = option || {};
        if (reFilter) {
          this.JoinCurrentPage = 1;// 不管有没有都第一页开始
        }
        let copyData = JSON.parse(JSON.stringify(this.JoinData));
        let endFilterData = copyData || [];
        if (filterValue) {
          endFilterData = copyData.filter(item => (item[filterKey] || "").indexOf(filterValue) >= 0);
        }
        this.joinFilterData = JSON.parse(JSON.stringify(endFilterData));
        this.totalJoin = this.joinFilterData.length;
        let startIndex = this.pageSizeJoin * (this.JoinCurrentPage -1)
        let endIndex = startIndex + this.pageSizeJoin;
        this.currentJoinData = this.joinFilterData.slice(startIndex, endIndex) //当前页面显示明细
      },
      filterExcludeFn(option) {
        const { reFilter, filterKey, filterValue } = option || {};
        if (reFilter) {
          this.ExcludeCurrentPage = 1;// 不管有没有都第一页开始
        }
        let copyData = JSON.parse(JSON.stringify(this.ExcludeData));
        let endFilterData = copyData || [];
        if (filterValue) {
          endFilterData = copyData.filter(item => (item[filterKey] || "").indexOf(filterValue) >= 0);
        }
        this.excludeFilterData = JSON.parse(JSON.stringify(endFilterData));
        this.totalExclude = this.excludeFilterData.length;
        let startIndex = this.pageSizeExclude * (this.ExcludeCurrentPage -1);
        let endIndex = startIndex + this.pageSizeExclude
        this.currentExcludeData = this.excludeFilterData.slice(startIndex,endIndex)//当前页面显示明细
      },
      filterSearchHandle(option) {
        switch (this.tabName) {
          case 'name1':
            this.freeFilterOption = option;
            this.filterFreeGoodsFn(option);
            break;
          case 'name2':
            this.joinFilterOption = option;
            this.filterJoinFn(option);
            break;
          case 'name3':
            this.excludeFilterOption = option;
            this.filterExcludeFn(option);
            break;
          default:
            break;
        }
        console.log(this.returnData, '赠送商品');
        console.log(this.JoinData, '指定');
        console.log(this.ExcludeData, '排除');
      },
      filterSearchFn(tabVal) {
        let tempKey = tabVal;
        if (tabVal === 'name2' || tabVal === 'name3') {
          tempKey = 'same23'
        }
        const allOptions = {
          name1: [
            { label: '商品名称', value: 'TITLE' },
            { label: '商品SKU', value: 'SKU' },
          ],
          // 排除和指定一样
          same23: [
            { label: '商品编码信息', value: 'GOODCODE' },
            { label: '商品名称', value: 'TITLE' },
          ],
        }
        if (tempKey) {
          const tempOption = allOptions[tempKey];
          this.searchOption = tempOption;
        }
      },
      /**
       * 公用的导出，指定和排除表名一样
       * 赠送商品,指定商品,排除商品
       * FREE GOODS, SPECIFIED GOODS, EXCLUDED GOODS
       */
      commonExportHandle() {
        // 截取数组
        const start1 = this.pageSizeReturn * (this.returnCurrentPage - 1);
        const start2 = this.pageSizeJoin * (this.JoinCurrentPage - 1);
        const start3 = this.pageSizeExclude * (this.ExcludeCurrentPage - 1);
        const exportTypes = {
          name1: {
            title: '赠送商品',
            tableName: 'T_OMSACTIVESKU',
            akId: '195202',
            startNum: start1,
            pageSize: this.pageSizeReturn,
          },
          name2: {
            title: '指定商品',
            tableName: 'T_OMSACTIVEJOINGOODS',
            akId: '202809',
            startNum: start2,
            pageSize: this.pageSizeJoin,
          },
          name3: {
            title: '排除商品',
            tableName: 'T_OMSACTIVEJOINGOODS',
            akId: '202809',
            startNum: start3,
            pageSize: this.pageSizeExclude,
          },
        }
        const curItem = exportTypes[this.tabName] || null;
        const { title, tableName, akId, startNum, pageSize } = curItem || {};
        if (tableName) {
          const exportOprion = {
            searchdata: {
              table: tableName,
              startIndex: startNum,
              range: pageSize || 1000,
              fixedcolumns: {
                ID: null
              },
              // 字段 OMSACTIVEID
              objectIds:`${akId}=${this.pageMsgId}`,
              column_include_uicontroller: true,
            },
            filename: title,
            filetype: '.xlsx',
            showColumnName: true,
            menu: title,
          }
          this.$comUtils.globalExportFn(exportOprion);
          console.log(this.tabName, exportOprion, 'pending_export_01')
        }
      },
      // 获取配送区域
      async getSendAreaFn() {
        let virtual = {
          "table": "T_OMSACTIVEAREA",
          "startindex": 0,
          "range": 10000,
          "fixedcolumns": { "OMSActiveId": ["="+this.pageMsgId] }
        }
        const res = await network.post('/p/cs/list/query', virtual);
        const resData = res.data || {};
        const { rows } = resData || {};
        if (rows && rows.length) {
          this.sendAreaList = rows.map(item => {
            return {
              RECEIVPROVINCE: item.RECEIVPROVINCE.refobjid || '',
              RECEIVCITY: item.RECEIVCITY.val || '',
              RECEIVAREA: item.RECEIVAREA.val || '',// 区域弹框内部是否选中只用到了这个值
              ID: item.ID.val || '', // 编辑时不改变直接保存
              OMSACTIVEID: this.pageMsgId,
            }
          })
          // console.log(this.sendAreaList, 'this.sendAreaList_01');
        }
      },
      /**
       * @param {*} option 
       * backInfo 内包含省市区
       */
      areaBackFn(option) {
        const { isShow, allInfo = {}} = option;
        // console.log(allInfo, 'allInfo_01')
        this.showArea = isShow;
        if (allInfo && Object.keys(allInfo).length) {
          const {
            RECEIVPROVINCE:provinceList,
            RECEIVCITY:cityList,
            RECEIVAREA:otherList,
          } = allInfo
          let provArr = [];
          let cityArr = [];
          let areaArr = [];
          if (provinceList.length) {
            provArr = provinceList.map(prov => {
              return {
                RECEIVPROVINCE: prov.ID || '',
                RECEIVCITY: '',
                RECEIVAREA: '',
                OMSACTIVEID: this.pageMsgId,
              }
            })
          }
          if (cityList.length) {
            cityArr = cityList.map(city => {
              return {
                RECEIVPROVINCE: city.PARENTID || '',
                RECEIVCITY: city.ID || '',
                RECEIVAREA: '',
                OMSACTIVEID: this.pageMsgId,
              }
            })
          }
          if (otherList.length) {
            const realAreaList = otherList.filter(item => (item.PARPARENTID != 0 && item.PARPARENTID != 1)) || [];
            areaArr = realAreaList.map(area => {
              return {
                RECEIVPROVINCE: area.PARPARENTID || '',
                RECEIVCITY: area.PARENTID || '',
                RECEIVAREA: area.ID || '',
                OMSACTIVEID: this.pageMsgId,
              }
            })
          }
          this.sendAreaList = [...provArr, ...cityArr, ...areaArr];
        }
        // console.log(this.sendAreaList, 'this.sendAreaList')
      },
      setSendAreaHandle() {
        this.showArea = true;
      },
      tooltipRenderHeader(tip) {
        return (h, params) => {
          return h('span', [
            h('Poptip', {
              style: {},
              props: {
                trigger: 'hover',
                transfer: true,
                wordWrap: true,
                content: 'content',
                placement: 'top'

              },
              scopedSlots: {
                default: () => h('div', {
                  style: {},
                  domProps: {
                    innerHTML: `<span>${params.column.title}</span> <i class="iconfont comment iconios-information-circle-outline" style="color: orangered;vertical-align: -1px;"></i>`
                  }
                }),
                content: () => h('div', {
                  style: {
                    width: '120px',
                    lineHeight: '16px'
                  },
                  domProps: {
                    innerHTML: `<span>${tip}</span>`
                  }
                }),
              },
            })
          ]);
        }
      },
      // 统一处理事件
      onEventHandler(i, hanlder, ...param) {
        if(hanlder) {
          hanlder(...param)
        }
        if(i.SKEY == 'shop_name' && i.VALUE.length > 0){
          let params = {
            ids: i.VALUE
          }
          this.judgeIsLimitBuyersNum(params);
        }else if(i.SKEY == 'shop_name' && i.VALUE.length == 0) {
          this.clearAfterJudgeIsLimitBuyersNum();
        }
      },

      // 判断是否需要展示限制买家参与次数参数
      judgeIsLimitBuyersNum(params) {
        network.post('/p/cs/giftActive/queryLimitGiftNum',params).then(res => {
          if(res.data.code == 0){
            this.isShowLimitGiftNum = res.data.data;
            const limitItemIndex = this.tabList[1].list.findIndex(item=>item.SKEY=='limit_buy_number')
            if(res.data.data){
              if(limitItemIndex > -1) {
                return
              }
              const multipleItemIndex = this.tabList[1].list.findIndex(item=>item.SKEY=='multiple_gifts')
              const formItem = {
                ID: '',
                SKEY: 'limit_buy_number',
                title: '限制买家参与次数',
                VALUE: '',
                company: '',
                tips: '',
                regx: /^[1-9]\d{0,7}?$/, // 正整数  /^\d{0,15}?$/
                disabled:false,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                required: false, // 是否为必填项
                explain:true, //是否有解释
                explainContent:'填写后，该店铺下的同一买家限制参与促销活动的次数',
              }
              this.tabList[1].list.splice(multipleItemIndex+1, 0, formItem)
              console.log(this.LIMITGIFTNUM)
              this.tabList[1].list.find(item=>item.SKEY=='limit_buy_number').VALUE = this.LIMITGIFTNUM
            } else {
              if(limitItemIndex>-1){
                this.tabList[1].list.splice(limitItemIndex, 1)
              }
            }
          }
        })
      },

      // 清空店铺后判断是否需要展示限制买家参与次数参数
      clearAfterJudgeIsLimitBuyersNum() {
        const limitItemIndex = this.tabList[1].list.findIndex(item=>item.SKEY=='limit_buy_number')
        if(limitItemIndex>-1){
          this.tabList[1].list.splice(limitItemIndex, 1)
        }
      },

      // 获取活动主表信息
      getOMSACTIVE() {
        let virtual = {
          "table":"T_V_OMSACTIVE",
          "startindex":0,
          "range":1000,
          "fixedcolumns":{"ID":["="+this.pageMsgId]}
        }
        network.post('/p/cs/list/query',virtual).then(res => {
          this.VIRSTATUS = res.data.rows[0].VIRSTATUS.val; // 当前活动状态
          // 基础设置
          this.tabList[0].list.find(item=>item.SKEY=='activeName').VALUE = res.data.rows[0].TITLE.val; // 活动名称
          this.ACTIVENAME = res.data.rows[0].TITLE.val;// 活动名称
          this.tabList[0].list.find(item=>item.SKEY=='priority').VALUE = res.data.rows[0].RANK.val || 1; // 优先级
          this.tabList[0].list.find(item=>item.SKEY=='orderType').VALUE = String(res.data.rows[0].ORDERTYPE.refobjval); // 订单类型
          this.tabList[0].list.find(item=>item.SKEY=='shop_name').VALUE = String(res.data.rows[0].SHOPID.refobjid).split(','); // 活动店铺
          this.tabList[0].list.find(item=>item.SKEY=='warehouse_name').VALUE = res.data.rows[0].IESWAREHOUSEIDS.refobjid!='-1'?String(res.data.rows[0].IESWAREHOUSEIDS.refobjid).split(','):''; // 活动仓库
          this.tabList[0].list.find(item=>item.SKEY=='brand_name').VALUE = res.data.rows[0].IESBRANDIDS.refobjid!='-1'?String(res.data.rows[0].IESBRANDIDS.refobjid).split(','):''; // 活动品牌
          this.tabList[0].list.find(item=>item.SKEY=='orderTimeType').VALUE = String(res.data.rows[0].TIMESIGN.refobjval); // 时间类型
          this.tabList[0].list.find(item=>item.SKEY=='orderTimeRange').VALUE = [res.data.rows[0].STARTTIME.val,res.data.rows[0].ENDTIME.val]; // 起止时间
          this.oldstartTime = res.data.rows[0].STARTTIME.val;
          this.oldendTime = res.data.rows[0].ENDTIME.val;
          this.startTime = res.data.rows[0].STARTTIME.val;
          this.endTime = res.data.rows[0].ENDTIME.val;
          // this.tabList[0].list.find(item=>item.SKEY=='region_name').VALUE = res.data.rows[0].EXPROVINCEIDS.refobjid!='-1'?String(res.data.rows[0].EXPROVINCEIDS.refobjid).split(','):''; // 排除省
          this.tabList[0].list.find(item=>item.SKEY=='Enable').VALUE = res.data.rows[0].ISACTIVE.refobjval == 'Y'?true:false; // 启用
          this.tabList[0].list.find(item=>item.SKEY=='remark').VALUE = res.data.rows[0].REMARK.val; // 活动描述

          // 特殊设置
          this.tabList[1].list.find(item=>item.SKEY=='activity_accumulation').VALUE = res.data.rows[0].ISADD.refobjval == '1'?true:false; // 活动累加
          this.tabList[1].list.find(item=>item.SKEY=='out_of_stock_gift').VALUE = res.data.rows[0].ISOOSGIFT.refobjval == '1'?true:false; // 缺货赠送
          this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').VALUE = res.data.rows[0].ISGROUPACTIVITY.refobjval == '1'?true:false; // 活动分组
          this.tabList[1].list.find(item=>item.SKEY=='one_yuan_reservation').VALUE = res.data.rows[0].ONE_YUAN_RESERVATION.refobjval == '1'?true:false; // 仅1元预定订单参与
          this.tabList[1].list.find(item=>item.SKEY=='multiple_gifts').VALUE = res.data.rows[0].ISSUPERIMPOSE.refobjval == '1'?true:false; // 多倍赠送
          this.tabList[1].list.find(item=>item.SKEY=='is_send_later').VALUE = res.data.rows[0].ISSENDLATER.refobjval == '1'?true:false; // 赠品后发
          this.tabList[1].list.find(item=>item.SKEY=='restricted_double11_presale').VALUE = String(res.data.rows[0].ISLIMITBOOKORDER.refobjval); // 限制双十一预售
          if(this.tabList[1].list.find(item=>item.SKEY=='restricted_double11_presale').VALUE == 0){
            this.tabList[1].list.find(item=>item.SKEY=='restricted_double11_presale_node').standard = false;
            this.tabList[1].list.find(item=>item.SKEY=='restricted_double11_presale_node').VALUE = '0'; // 定金预售订单执行促销节点
          }else {
            this.tabList[1].list.find(item=>item.SKEY=='restricted_double11_presale_node').standard = true;
            this.tabList[1].list.find(item=>item.SKEY=='restricted_double11_presale_node').VALUE = String(res.data.rows[0].PREORDER_PAYTIME_NODES.refobjval); // 定金预售订单执行促销节点
          }
          this.tabList[1].list.find(item=>item.SKEY=='ALLHOSTNO').VALUE = String(res.data.rows[0].ALLHOSTNO.val); // 定金预售订单执行促销节点

          
          // 限制时间，通过旧数据的【限时开始】和【限时结束】字段获取
          let startTime = ''
          let endTime = ''
          if(res.data.rows[0].ACTIVESTARTTIME.val) {
            startTime = res.data.rows[0].ACTIVESTARTTIME.val + ':00'
          }
          if(res.data.rows[0].ACTIVEENDTIME.val) {
            endTime = res.data.rows[0].ACTIVEENDTIME.val + ':00'
          }
          if(startTime && endTime) {
            this.tabList[1].list.find(item=>item.SKEY=='limit_time').VALUE = [startTime, endTime]
          } else {
            this.tabList[1].list.find(item=>item.SKEY=='limit_time').VALUE = ''
          }
          // this.tabList[1].list.find(item=>item.SKEY=='limit_time').VALUE = res.data.rows[0].ISLIMITTIME.refobjval == '1'?true:false; // 限制时间
          // this.tabList[1].list.find(item=>item.SKEY=='limit_range_time_start').VALUE = res.data.rows[0].ACTIVESTARTTIME.val; // 限时开始
          // this.tabList[1].list.find(item=>item.SKEY=='limit_range_time_end').VALUE = res.data.rows[0].ACTIVEENDTIME.val; // 限时结束
          this.tabList[1].list.find(item=>item.SKEY=='gift_method').VALUE = String(res.data.rows[0].GIFTTYPE.refobjval); // 赠送方式

          if(this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').VALUE){
            let obj = {
              title: '组号',
              align: 'center',
              key: 'ORDERBY',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.ORDERBY,
                    },
                    on: {
                      'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          // this.returnData[params.index].ORDERBY = event.target.value;
                          this.returnData[((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index].ORDERBY = this.parser(event.target.value);
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                      }
                    }
                  },
                );
              },
            }
            // this.returnColumns.push(obj);
          }
          if(this.tabList[1].list.find(item=>item.SKEY=='gift_method').VALUE == '4'){
            if(!this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').VALUE){
              this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').VALUE = true;
            }
            this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').disabled = true;
            if(this.returnColumns.length == '7'){
              let obj = {
                title: '组号',
                align: 'center',
                key: 'ORDERBY',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        value: params.row.ORDERBY,
                      },
                      on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                            event.target.value=event.target.value
                            // this.returnData[params.index].ORDERBY = event.target.value;
                            this.returnData[((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index].ORDERBY = this.parser(event.target.value);
                            this.totalReturn=this.returnData.length;
                            let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                            let endIndex=startIndex+this.pageSizeReturn
                            this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              }
              // this.returnColumns.push(obj);
            }
          }else if(this.tabList[1].list.find(item=>item.SKEY=='gift_method').VALUE == '2'){
            this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').disabled = false;
            let obj = [
              {
                title: '满足金额',
                align: 'center',
                key: 'PRODUCTBUYPRICE',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        regx: this.regx,
                        value: params.row.PRODUCTBUYPRICE,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          this.returnData[params.index].PRODUCTBUYPRICE = event.target.value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              },
              {
                title: '满足件数',
                align: 'center',
                key: 'PRODUCTBUYUNIT',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        regx: this.regx,
                        value: params.row.PRODUCTBUYUNIT,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          this.returnData[params.index].PRODUCTBUYUNIT = event.target.value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              }
            ]
            obj.forEach(item => {
              this.returnColumns.push(item)
            })
          }else if(this.tabList[1].list.find(item=>item.SKEY=='gift_method').VALUE == '3'){
            this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').disabled = false;
            let obj = [
              {
                title: '起始排名',
                align: 'center',
                key: 'STARTSECTION',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        regx: this.regx,
                        value: params.row.STARTSECTION,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          this.returnData[params.index].STARTSECTION = event.target.value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              },
              {
                title: '结束排名',
                align: 'center',
                key: 'ENDSECTION',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        regx: this.regx,
                        value: params.row.ENDSECTION,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          this.returnData[params.index].ENDSECTION = event.target.value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              },
              {
                title: '指定排名',
                align: 'center',
                key: 'APPOINTRANGE',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        value: params.row.APPOINTRANGE,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=this.parser(event.target.value)
                          this.returnData[params.index].APPOINTRANGE = this.parser(event.target.value);
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              }
            ]
            obj.forEach(item => {
              this.returnColumns.push(item)
            })
          }else if(this.tabList[1].list.find(item=>item.SKEY=='gift_method').VALUE == '5'){
            this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').disabled = false;
            this.tabList[1].list.find(item=>item.SKEY=='satisfied_amount').disabled = true;
            this.tabList[1].list.find(item=>item.SKEY=='satisfied_pieces').disabled = true;
            this.tabList[1].list.find(item=>item.SKEY=='satisfied_amount').VALUE = '';
            this.tabList[1].list.find(item=>item.SKEY=='satisfied_pieces').VALUE = '';
            let obj = [
              {
                title: '参与活动规格类型',
                align: 'center',
                key: 'NORMSTYPE',
                render: (h, params) => {
                  const vm = this;
                  return h('Select', {
                    style: {
                      width:'100px',
                      zIndex: 999,
                    },
                    props: {
                      transfer: true,
                      value: Number(params.row.NORMSTYPE), // 获取选择的下拉框的值
                    },
                      on: {
                        'on-change': (e) => {
                          let chengeData=vm.currentReturnData[params.index]
                            vm.returnData.forEach((item)=>{
                              if((item.SKU==chengeData.SKU)){
                                  item.NORMSTYPE =e;
                              }
                            })
                          vm.totalReturn=vm.returnData.length;
                          let startIndex=vm.pageSizeReturn*(vm.returnCurrentPage-1)
                          let endIndex=startIndex+vm.pageSizeReturn
                          vm.currentReturnData=vm.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                    vm.NORMSTYPEOptions.map(item => h('Option', {
                      props: {
                        value: item.value, // 绑定的值
                      }
                    }, item.name)
                  ));
                }
              },
              {
                title: '参与活动规格值',
                align: 'center',
                key: 'NORMSVALUES',
                renderHeader: this.tooltipRenderHeader('多个可使用英文逗号/分号或空格分隔'),
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'100px'
                      },
                      props: {
                        value: params.row.NORMSVALUES,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          this.returnData[params.index].NORMSVALUES = event.target.value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              },
            ]
            obj.forEach(item => {
              this.returnColumns.push(item)
            })
          }else {
            this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').disabled = false;
          }

          const gift_method = this.tabList[1].list.find(item=>item.SKEY=='gift_method').VALUE
          if(['6','7'].includes(gift_method)) {
            this.showKeyWord(gift_method)
            const giftItem = this.tabList[1].list.find(item=>item.SKEY=='REMARKEGIFT')
            if(giftItem) {
              giftItem.VALUE = res.data.rows[0].REMARKEGIFT.val
            }
          } else if(gift_method === '8') {
            this.priceLinkage(gift_method)
          } else if(gift_method === '9') {
            this.numLinkage(gift_method)
          }

          this.tabList[1].list.find(item=>item.SKEY=='satisfied_amount').VALUE = gift_method==5?'':res.data.rows[0].BUYPRICE.val; // 满足金额
          this.tabList[1].list.find(item=>item.SKEY=='satisfied_pieces').VALUE = gift_method==5?'':res.data.rows[0].BUYUNIT.val; // 满足件数
          const activegoodstypeStr = String(res.data.rows[0].ACTIVEGOODSTYPE.refobjval); // 指定/排除商品
          this.limitGoodsType = activegoodstypeStr;// 1指定商品，2排除商品
          if (activegoodstypeStr == '1' || activegoodstypeStr == '2') {
            this.getOMSACTIVEJOINGOODS(); // 获取活动参与（排除）商品表
          }
          this.tabList[1].list.find(item=>item.SKEY=='activegoodstype').VALUE = activegoodstypeStr;
          if(res.data.rows[0].ISGROUPACTIVITY.refobjval == '1'){ // 活动分组
            let obj = {
              title: '组号',
              align: 'center',
              key: 'ORDERBY',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.ORDERBY,
                    },
                    on: {
                      'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          // this.returnData[params.index].ORDERBY = event.target.value;
                          this.returnData[((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index].ORDERBY = this.parser(event.target.value);
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                      }
                    }
                  },
                );
              },
            }
            this.returnColumns.push(obj);
          }
          this.ISShowTab4 = true;
          
          // 是否有限制参与活动次数
          if(res.data.rows[0].LIMITGIFTNUM.val){
            this.LIMITGIFTNUM = res.data.rows[0].LIMITGIFTNUM.val
            this.ISShowTab5 = true;
          }else {
            this.LIMITGIFTNUM = ''
          }

          this.ISShowTab6 = true;
          
        })
      },

      // 联动显示关键字
      showKeyWord(e) {
        const keywordItemIndex = this.tabList[1].list.findIndex(item=>item.SKEY=='REMARKEGIFT')
        if(['6', '7'].includes(e)) {
          if(keywordItemIndex > -1) {
            return
          }
          const giftItemIndex = this.tabList[1].list.findIndex(item=>item.SKEY=='gift_method')
          const formItem = {
            ID: '',
            SKEY: 'REMARKEGIFT',
            title: '备注关键字',
            VALUE: '',
            defaultvalue: '',
            company: '',
            tips: '',
            standard:false,//标准输入框长度
            remark:true,//备注栏
            required: true,
            flag: true, // 控制必填校验样式展示
            explain:true,
            explainContent:'支持填写多个关键字，用英文逗号隔开',
          }
          this.tabList[1].list.splice(giftItemIndex+1, 0, formItem )
        } else {
          if(keywordItemIndex > -1) {
            this.tabList[1].list.splice(keywordItemIndex, 1)
          }
        }
      },

      // 金额阶梯赠送联动
      priceLinkage(e) {
        const activityItem = this.tabList[1].list.find(item=>item.SKEY=='activity_grouping')
        if(['8', '9'].includes(e)) {
          // 活动分组字段置灰不可选
          activityItem.VALUE = false;
          activityItem.disabled = true;
        } else {
          activityItem.disabled = false;
        }

        if(e==='8'){
          const column = {
            title: '阶梯金额',
            align: 'center',
            key: 'PRODUCTBUYPRICE',
            render: (h, params) => {
              return h(
                'Input',
                {
                  style: {
                    width:'66px'
                  },
                  props: {
                    value: params.row.PRODUCTBUYPRICE,
                  },
                  on: {
                    'on-blur': (event) => {
                      const tempVal = event.target.value;
                      const endVal = this.$comUtils.globalCarryAppend(tempVal, this.carryMethod);
                      event.target.value = endVal;
                      const index = ((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index
                      this.returnData[index].PRODUCTBUYPRICE = endVal;
                    }
                  }
                },
              );
            }
          }
          this.returnColumns.push(column)
        } else {
          const index = this.returnColumns.findIndex(item => item.key === 'PRODUCTBUYPRICE')
          if(index > -1) {
            this.returnColumns.splice(index,1)
          }
        }
      },

      // 数量阶梯赠送联动
      numLinkage(e) {
        const activityItem = this.tabList[1].list.find(item=>item.SKEY=='activity_grouping')
        if(['8', '9'].includes(e)) {
          // 活动分组字段置灰不可选
          activityItem.VALUE = false;
          activityItem.disabled = true;
        } else {
          activityItem.disabled = false;
        }

        if(e==='9'){
          const column = {
            title: '阶梯数量',
            align: 'center',
            key: 'PRODUCTBUYUNIT',
            render: (h, params) => {
              let this_=this
              return h(
                'Input',
                {
                  style: {
                    width:'66px'
                  },
                  props: {
                    value: params.row.PRODUCTBUYUNIT,
                  },
                  on: {
                    'on-blur': (event) => {
                      const value = event.target.value
                      const index = ((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index
                      this.returnData[index].PRODUCTBUYUNIT = value;
                    }
                  }
                },
              );
            }
          }
          this.returnColumns.push(column)
        } else {
          const index = this.returnColumns.findIndex(item => item.key === 'PRODUCTBUYUNIT')
          if(index > -1) {
            this.returnColumns.splice(index,1)
          }
        }
      },

      // 获取活动赠送商品表
      getOMSActiveSku() {
        let virtual = {
          "table":"T_OMSACTIVESKU",
          "startindex":0,
          "range":10000,
          "fixedcolumns":{"OMSActiveId":["="+this.pageMsgId]}
        }
        network.post('/p/cs/list/query',virtual).then(res => {
          if(res.data.rows && res.data.rows.length > 0){
            let data=[]
            for (let i = 0; i < res.data.rows.length; i++) {
              for (let j = 0; j < Object.keys(res.data.rows[i]).length; j++) {
                let keyName = Object.keys(res.data.rows[i])[j];
                if(keyName == 'NORMSTYPE'){
                  res.data.rows[i][keyName] = res.data.rows[i][keyName].refobjval?String(res.data.rows[i][keyName].refobjval):'';
                }else {
                  res.data.rows[i][keyName] = res.data.rows[i][keyName].val;
                }
                if(keyName === 'AUTOREFUND') {
                  res.data.rows[i][keyName] = res.data.rows[i][keyName] === '是' ? true : false
                }
              }
              data.push(res.data.rows[i]);
            }
            this.returnData=data
            this.totalReturn=this.returnData.length;
            let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
            let endIndex=startIndex+this.pageSizeReturn
            this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
          }
        })
      },
      //获取活动参与（排除）商品表
      getOMSACTIVEJOINGOODS() { // T_OMSACTIVEJOINGOODS
        let virtual = {
          "table":"T_OMSACTIVEJOINGOODS",
          "startindex":0,
          "range":10000,
          "fixedcolumns":{"OMSActiveId":["="+this.pageMsgId]}
        }
        network.post('/p/cs/list/query',virtual).then(res => {
          if(res.data.rows && res.data.rows.length > 0){
            if(this.limitGoodsType == '1'){
              this.totalJoin=res.data.total;
              let startIndex=this.pageSizeJoin*(this.JoinCurrentPage-1)
              let endIndex=startIndex+this.pageSizeJoin
              let data=[]
              for (let i = 0; i < res.data.rows.length; i++) {
                for (let j = 0; j < Object.keys(res.data.rows[i]).length; j++) {
                  let keyName = Object.keys(res.data.rows[i])[j];
                  if(keyName == 'GOODSTYPE'){
                    res.data.rows[i]['GoodsTypeName'] = res.data.rows[i][keyName].val;
                    res.data.rows[i]['GoodsType'] = res.data.rows[i][keyName].val == '按系统SKU编码'?1:res.data.rows[i][keyName].val == '按系统商品编码'?2:res.data.rows[i][keyName].val == '按平台SKU编码'?3:4;
                  }else if(keyName == 'GOODSCODE'){
                    res.data.rows[i]['GOODCODE'] = res.data.rows[i][keyName].val;
                  }else if(keyName == 'TITLE'){
                    res.data.rows[i]['TITLE'] = res.data.rows[i][keyName].val;
                  }else if(keyName == 'ID'){
                    res.data.rows[i]['ID'] = res.data.rows[i][keyName].val;
                  }
                }
                data.push(res.data.rows[i]);
              }
              this.JoinData=data;
              this.currentJoinData=this.JoinData.slice(startIndex,endIndex) //当前页面显示明细
              this.totalJoin = res.data.total;
              this.JoinData = JSON.parse(JSON.stringify(this.JoinData))
              this.currentJoinData = JSON.parse(JSON.stringify(this.currentJoinData))
            }else if(this.limitGoodsType == '2') {
              this.totalExclude=res.data.total;
              let startIndex=this.pageSizeExclude*(this.ExcludeCurrentPage-1)
              let endIndex=startIndex+this.pageSizeExclude
              let data=[]
              for (let i = 0; i < res.data.rows.length; i++) {
                for (let j = 0; j < Object.keys(res.data.rows[i]).length; j++) {
                  let keyName = Object.keys(res.data.rows[i])[j];
                  if(keyName == 'GOODSTYPE'){
                    res.data.rows[i]['GoodsTypeName'] = res.data.rows[i][keyName].val;
                    res.data.rows[i]['GoodsType'] = res.data.rows[i][keyName].val == '按系统SKU编码'?1:res.data.rows[i][keyName].val == '按系统商品编码'?2:res.data.rows[i][keyName].val == '按平台SKU编码'?3:4;
                  }else if(keyName == 'GOODSCODE'){
                    res.data.rows[i]['GOODCODE'] = res.data.rows[i][keyName].val;
                  }else if(keyName == 'TITLE'){
                    res.data.rows[i]['TITLE'] = res.data.rows[i][keyName].val;
                  }else if(keyName == 'ID'){
                    res.data.rows[i]['ID'] = res.data.rows[i][keyName].val;
                  }
                }
                data.push(res.data.rows[i]);
              }
              this.ExcludeData=data
              this.currentExcludeData=this.ExcludeData.slice(startIndex,endIndex)//当前页面显示明细
              this.totalExclude = res.data.total;
              this.ExcludeData = JSON.parse(JSON.stringify(this.ExcludeData))
              this.currentExcludeData = JSON.parse(JSON.stringify(this.currentExcludeData))
            }
          }
          this.ISShowTab4 = true;
          this.ISShowTab5 = this.LIMITGIFTNUM?true:false;
          this.ISShowTab6 = true;
          
        })
      },
      // 获取参与活动订单
      getOMSACTIVEORDERS() {
        let virtual = {
          "table":"T_OMSACTIVEORDERS",
          "startindex":0,
          "range":10000,
          "fixedcolumns":{"OMSActiveId":["="+this.pageMsgId]}
        }
        network.post('/p/cs/list/query',virtual).then(res => {
          if(res.data.rows && res.data.rows.length > 0){
            this.totalJoinActiveOrders=res.data.rows.length;
            let startIndex=this.pageSizeJoinActiveOrders*(this.JoinActiveOrdersCurrentPage-1)
            let endIndex=startIndex+this.pageSizeJoinActiveOrders
            let data=[]
            for (let i = 0; i < res.data.rows.length; i++) {
              for (let j = 0; j < Object.keys(res.data.rows[i]).length; j++) {
                let keyName = Object.keys(res.data.rows[i])[j];
                res.data.rows[i][keyName] = res.data.rows[i][keyName].val;
              }
              data.push(res.data.rows[i]);
            }
            this.JoinActiveOrdersData=data
            this.currentJoinActiveOrdersData=this.JoinActiveOrdersData.slice(startIndex,endIndex) //当前页面显示明细
          }
        })
      },
      // 获取参与活动买家  T_OMSACTIVEHASSENDMEMBER
      getOMSACTIVEBUYER(val) {
        let virtual = {
          "table":"T_OMSACTIVEHASSENDMEMBER",
          "startindex":0,
          "range":10000,
          "fixedcolumns":{"OMSActiveId":["="+this.pageMsgId]}
        }
        if(val){
          virtual.fixedcolumns={"OMSActiveId":["="+this.pageMsgId],"USERNICK":[val]}
        }
        network.post('/p/cs/list/query',virtual).then(res => {
          if(res.data.rows && res.data.rows.length > 0){
            this.totalJoinActiveBuyers=res.data.rows.length;
            let startIndex=this.pageSizeJoinActiveBuyers*(this.JoinActiveBuyersCurrentPage-1)
            let endIndex=startIndex+this.pageSizeJoinActiveBuyers
            let data=[]
            for (let i = 0; i < res.data.rows.length; i++) {
              for (let j = 0; j < Object.keys(res.data.rows[i]).length; j++) {
                let keyName = Object.keys(res.data.rows[i])[j];
                res.data.rows[i][keyName] = res.data.rows[i][keyName].val;
              }
              res.data.rows[i].OMSACTIVEID = this.ACTIVENAME; 
              data.push(res.data.rows[i]);
            }
            this.JoinActiveBuyersData=data
            this.currentJoinActiveBuyersData=this.JoinActiveBuyersData.slice(startIndex,endIndex) //当前页面显示明细
          } else {
            this.JoinActiveBuyersData=[]
            this.currentJoinActiveBuyersData=[]
            // this.currentJoinActiveBuyersData=this.JoinActiveBuyersData.slice(startIndex,endIndex) //当前页面显示明细
            console.log(this.JoinActiveBuyersData)
          }
        })
      },

      refreshParams() {
        let flag = true;
        for(let i = 0;i<this.tabList[0].list.length;i++){
          if(this.tabList[0].list[i].VALUE){
            flag = false;
            break;
          }
        }
        for(let i = 0;i<this.tabList[1].list.length;i++){
          if(this.tabList[1].list[i].VALUE){
            flag = false;
            break;
          }
        }
        if(this.currentReturnData.length > 0){
          flag = false
        }
        if(!flag){
          this.showTip = true;
        }
      },
      rangeDate(e) {
        this.startTime = e[0];
        this.endTime = e[1];
      },
      setLimitStartDate(e) {
        this.limitStartDate = e
      },
      setLimitEndDate(e) {
        this.limitEndDate = e
      },
      // 判断字符串
      judgeStr(str){
        let judge=true
        if(str.indexOf('~~')==-1){
          if(str.indexOf('$$')==-1){
              if(str.indexOf('##')==-1){
                if(str.indexOf('&&')==-1){
                  judge=true
                }else{
                  judge=false
                }
              }else{
                 judge=false
              }
          }else{
            judge=false
          }
        }else{
          judge=false
        }
        return judge
      },
      changCheckbox(e,i){ // 指定商品和排除商品checkbox框变化tabName
        if(i.SKEY == 'restricted_goods'){
          this.tabName = e ? 'name2':'name1'
        }else if(i.SKEY == 'exclude_goods'){
          this.tabName = e ? 'name3':'name1'
        }else if(i.SKEY == 'activity_grouping'){
          if(e){
            let obj = {
              title: '组号',
              align: 'center',
              key: 'ORDERBY',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.ORDERBY,
                    },
                    on: {
                      'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          // this.returnData[params.index].ORDERBY = event.target.value;
                          this.returnData[((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index].ORDERBY = this.parser(event.target.value);
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                      }
                    }
                  },
                );
              },
            }
            let addFlag = true;
            this.returnColumns.forEach(item => {
              if(item.key == 'ORDERBY'){
                addFlag = false
              }
            })
            if(addFlag){
              this.returnColumns.push(obj);
            }
          }else {
            let removeFlag = false;
            let removeIndex = this.returnColumns.length-1;
            this.returnColumns.forEach((item,index) => {
              if(item.key == 'ORDERBY'){
                removeFlag = true;
                removeIndex = index;
              }
            })
            if(removeFlag){
              this.returnColumns.splice(removeIndex,1)
            }
          }
        }
      },
      changeSelectGoodTypeOne(){ // 指定商品商品选择类型更改
        this.selectJoinSKUID = '';
        this.SKUArrJoin = [];
        this.SKUAllDataJoin = [];
        this.selectJoinSKUData = [];
        this.SKUArrJoin = [];
      },
      changeSelectGoodTypeTwo() { // 排除商品商品选择类型更改
        this.selecExcludeSKUID = '';
        this.SKUArrExclude = [];
        this.SKUAllDataExclude = [];
        this.selectExcludeSKUData = [];
        this.SKUArrExclude = [];
      },
      // 重置数据
      resetData(){
        this.tabList.forEach(item=>{
          item.list.forEach(i=>{
            if(i.TYPEONE=='checkbox'){
              i.VALUE=false
            }else{
              i.VALUE=''
            }
          })
        })
        this.tabName = 'name1';
        this.showDetailTable = true;
        this.returnData = []; // 赠送商品置空
        this.currentReturnData = []; // 赠送商品置空
        this.JoinData = []; // 指定商品置空
        this.currentJoinData = []; //  指定商品置空
        this.ExcludeData = []; // 排除商品置空
        this.currentExcludeData = []; //  排除商品置空
        this.clearSearchFn();
        // 赠送商品搜索栏重置
        if(this.$refs.returnSelect){
          this.$refs.returnSelect.clearSingleSelect()
        }
        // 指定商品搜索栏重置
        if(this.$refs.JoinSelect){
          this.$refs.JoinSelect.clearSingleSelect()
        }
        // 排除商品搜索栏重置
        if(this.$refs.ExcludeSelect){
          this.$refs.ExcludeSelect.clearSingleSelect()
        }
      },
      // 关闭当前页面
      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_V_OMSACTIVE',
            tableId:'10776',
            back:true
          });
        },0)
      },
      // 获取赠送商品数据
      // /p/cs/getIesSku系统SKU编码；/p/cs/getProductCode系统商品编码；PLATFORMSKU
      getReturnSkuList(val){
        let virtual={sku: val}
        network.post('/p/cs/getIesSku', virtual).then((res) => {
          if(res.data.Code==0){
            this.SKUArrReturn=res.data.Rows.map(i=>{
              return {
                label:i.SKU,
                value:i.ID,
                NORMS1CODE: i.NORMS1CODE,
                NORMS1NAME: i.NORMS1NAME,
                NORMS2CODE: i.NORMS2CODE,
                NORMS2NAME: i.NORMS2NAME
              }
            })
            this.SKUAllDataReturn=res.data.Rows
            if(this.SKUAllDataReturn.length == 1){
              this.selectReturnSKUData=this.SKUAllDataReturn[0] //添加的数据
              this.selectReturnSKUID=this.selectReturnSKUData.ID //双向数据绑定
            }
          }else{
            this.SKUArrReturn=[]
            this.SKUAllDataReturn=[]
          }
        })
      },
      // 获取指定商品数据
      getJoinSkuList(val){
         if(this.selectGoodTypeOne == 1){
           let virtual={sku: val}
            network.post('/p/cs/getIesSku', virtual).then((res) => {
              if(res.data.Code==0){
                this.SKUArrJoin=res.data.Rows.map(i=>{
                  return {
                    label:i.SKU,
                    value:i.ID
                  }
                })
                this.SKUAllDataJoin=res.data.Rows
              }else{
                this.SKUArrJoin=[]
                this.SKUAllDataJoin=[]
              }
            })
         }else if(this.selectGoodTypeOne == 2){
           if(!val){
             return
           }else {
            let virtual={productCode: val}
            network.post('/p/cs/getProductCode', virtual).then((res) => {
              if(res.data.Code==0){
                this.SKUArrJoin=res.data.Rows.map(i=>{
                  return {
                    label:i.PRODUCTCODE,
                    value:i.ID
                  }
                })
                this.SKUAllDataJoin=res.data.Rows
              }else{
                this.SKUArrJoin=[]
                this.SKUAllDataJoin=[]
              }
            })
           }
         }else if(this.selectGoodTypeOne == 3){
           if(!val){
             return
           }else {
            let virtual={
              searchdata: {
                "table":"T_V_IESPLATFORMSKU",
                "startindex":0,
                'range':3000,
                "fixedcolumns":{"EXTSKUID":val},
                "column_include_uicontroller":true,
                "isolr":false}
            }
            network.post('/p/cs/QueryList', urlSearchParams(virtual)).then((res) => {
              let list = [];
              let newList = [];
              let paramsList = [];
              for (var key in res.data.data.row[0]) {
                paramsList.push(key);
              }
              res.data.data.row.forEach(item => {
                let obj = {
                  label: item.EXTSKUID.val,
                  value: item.ID.val
                };
                let objParams = {}
                paramsList.forEach(param => {
                  objParams[param] = item[param].val
                })
                list.push(obj);
                newList.push(objParams)
              });
              if(list.length > 0) {
                this.SKUArrJoin = list;
                this.SKUAllDataJoin = newList;
              }else {
                this.SKUArrJoin=[]
                this.SKUAllDataJoin=[]
              }
            })
           }
         }else if(this.selectGoodTypeOne == 4){
           if(!val){
             return
           }else {
            let virtual={
              searchdata: {
                "table":"T_V_IESPLATFORMSKU",
                "startindex":0,
                'range':3000,
                "fixedcolumns":{"NUMIID":val},
                "column_include_uicontroller":true,
                "isolr":false}
            }
            network.post('/p/cs/QueryList', urlSearchParams(virtual)).then((res) => {
              let list = [];
              let newList = [];
              let paramsList = [];
              for (var key in res.data.data.row[0]) {
                paramsList.push(key);
              }
              res.data.data.row.forEach(item => {
                let obj = {
                  label: item.NUMIID.val,
                  value: item.ID.val
                };
                let objParams = {}
                paramsList.forEach(param => {
                  objParams[param] = item[param].val
                })
                list.push(obj);
                newList.push(objParams)
              });
              if(list.length > 0) {
                this.SKUArrJoin = list;
                this.SKUAllDataJoin = newList;
              }else {
                this.SKUArrJoin=[]
                this.SKUAllDataJoin=[]
              }
            })
           }
         }
      },
      // 获取排除商品数据
      getExcludeSkuList(val){
         if(this.selectGoodTypeTwo == 1){
           let virtual={sku: val}
            network.post('/p/cs/getIesSku', virtual).then((res) => {
              if(res.data.Code==0){
                this.SKUArrExclude=res.data.Rows.map(i=>{
                  return {
                    label:i.SKU,
                    value:i.ID
                  }
                })
                this.SKUAllDataExclude=res.data.Rows
              }else{
                this.SKUArrExclude=[]
                this.SKUAllDataExclude=[]
              }
            })
         }else if(this.selectGoodTypeTwo == 2){
           if(!val){
             return
           }else {
            let virtual={productCode: val}
            network.post('/p/cs/getProductCode', virtual).then((res) => {
              if(res.data.Code==0){
                this.SKUArrExclude=res.data.Rows.map(i=>{
                  return {
                    label:i.PRODUCTCODE,
                    value:i.ID
                  }
                })
                this.SKUAllDataExclude=res.data.Rows
              }else{
                this.SKUArrExclude=[]
                this.SKUAllDataExclude=[]
              }
            })
           }
         }else if(this.selectGoodTypeTwo == 3){
           if(!val){
             return
           }else {
            let virtual={
              searchdata: {
                "table":"T_V_IESPLATFORMSKU",
                "startindex":0,
                'range':3000,
                "fixedcolumns":{"EXTSKUID":val},
                "column_include_uicontroller":true,
                "isolr":false}
            }
            network.post('/p/cs/QueryList', urlSearchParams(virtual)).then((res) => {
              let list = [];
              let newList = [];
              let paramsList = [];
              for (var key in res.data.data.row[0]) {
                paramsList.push(key);
              }
              res.data.data.row.forEach(item => {
                let obj = {
                  label: item.EXTSKUID.val,
                  value: item.ID.val
                };
                let objParams = {}
                paramsList.forEach(param => {
                  objParams[param] = item[param].val
                })
                list.push(obj);
                newList.push(objParams)
              });
              if(list.length > 0) {
                this.SKUArrExclude = list;
                this.SKUAllDataExclude = newList;
              }else {
                this.SKUArrExclude=[]
                this.SKUAllDataExclude=[]
              }
            })
           }
         }else if(this.selectGoodTypeTwo == 4){
           if(!val){
             return
           }else {
            let virtual={
              searchdata: {
                "table":"T_V_IESPLATFORMSKU",
                "startindex":0,
                'range':3000,
                "fixedcolumns":{"NUMIID":val},
                "column_include_uicontroller":true,
                "isolr":false}
            }
            network.post('/p/cs/QueryList', urlSearchParams(virtual)).then((res) => {
              let list = [];
              let newList = [];
              let paramsList = [];
              for (var key in res.data.data.row[0]) {
                paramsList.push(key);
              }
              res.data.data.row.forEach(item => {
                let obj = {
                  label: item.NUMIID.val,
                  value: item.ID.val
                };
                let objParams = {}
                paramsList.forEach(param => {
                  objParams[param] = item[param].val
                })
                list.push(obj);
                newList.push(objParams)
              });
              if(list.length > 0) {
                this.SKUArrExclude = list;
                this.SKUAllDataExclude = newList;
              }else {
                this.SKUArrExclude=[]
                this.SKUAllDataExclude=[]
              }
            })
           }
         }
      },

      // 赠送商品查询option选中
      selectReturnGoods(val){
        if(this.selectReturnSKUID){
          this.selectReturnSKUData=this.SKUAllDataReturn.find(item=>{
            return item.ID==val
          })
        }else{
          this.selectReturnSKUData={}
        }
      },
      // 指定商品查询option选中
      selectJoinGoods(val) {
        if(this.selectJoinSKUID){
          this.selectJoinSKUData=this.SKUAllDataJoin.find(item=>{
            return item.ID==val
          })
        }else{
          this.selectJoinSKUData={}
        }
      },
      // 排除商品查询option选中
      selectExcludeGoods(val) {
        if(this.selectExcludeSKUID){
          this.selectExcludeSKUData=this.SKUAllDataExclude.find(item=>{
            return item.ID==val
          })
        }else{
          this.selectExcludeSKUData={}
        }
      },
      // 添加赠送商品到表格
      addReturnGoods(){
          if(JSON.stringify(this.selectReturnSKUData)=='{}'){
            this.$Message.warning('添加条码不能为空');
            return
          }
          let obj=this.selectReturnSKUData
          if(obj){
              let addData= {
                  ID: 'cs'+ Math.floor(Math.random()*10000),
                  TITLE:obj.SKUNAME,
                  PRODUCTCODE:obj.PRODUCTCODE,
                  SKU:obj.SKU,
                  SKUID:obj.ID,
                  NUM: this.returnGoodsNum,
                  ORDERBY: 1
                }
                // 是否有重复项
                if(this.returnData.length){
                  let gift_method = this.tabList[1].list.find(item=>item.SKEY=='gift_method').VALUE
                  console.log(gift_method)
                  if(['8','9'].includes(gift_method)) {
                    addData.NUM=this.returnGoodsNum//数量,
                    this.returnData.push(addData)
                  } else {
                    let sameData=this.returnData.find(i=>i.SKU==obj.SKU);
                    if(!sameData){
                      addData.NUM=this.returnGoodsNum//数量,
                      this.returnData.push(addData)
                    }else{
                      this.returnData.forEach(item=>{
                        if(obj.SKU==item.SKU){
                          let NUM=item.NUM
                          item=sameData
                          item.NUM=Number(NUM)+Number(this.returnGoodsNum)//数量,
                        }
                      })
                    }
                  }
                }else {
                  this.returnData.push(addData)
                }
                this.$refs.returnSelect.clearSingleSelect()
                this.returnGoodsNum=1
                this.totalReturn=this.returnData.length
                 if(this.totalReturn){ //翻页
                    this.returnCurrentPage=parseInt((this.totalReturn-1)/this.pageSizeReturn)+1
                }

                //每次添加完数据，清空搜索项内容
                this.returnGoodsNum = 1;
                // 截取数组
                let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                let endIndex=startIndex+this.pageSizeReturn
                this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细

            }
      },
      // 添加指定商品到表格
      addJoinGoods(){
          if(JSON.stringify(this.selectJoinSKUData)=='{}'){
            this.$Message.warning('添加编码不能为空');
            return
          }
          let obj=this.selectJoinSKUData
          if(obj){
              let addData= {
                  ID: 'cs'+ Math.floor(Math.random()*10000),
                  GoodsTypeName: this.selectGoodTypeOne == '1'?'按系统SKU编码':this.selectGoodTypeOne == '2'?'按系统商品编码':this.selectGoodTypeOne == '3'?'按平台SKU编码':'按平台商品编码',
                  GoodsType: this.selectGoodTypeOne,
                  TITLE:(this.selectGoodTypeOne == '1')?obj.SKUNAME:obj.TITLE,
                  PRODUCTCODE:obj.PRODUCTCODE,
                  GOODCODE: this.selectGoodTypeOne == '1'?obj.SKU:this.selectGoodTypeOne == '2'?obj.PRODUCTCODE:this.selectGoodTypeOne == '3'?obj.EXTSKUID:obj.NUMIID,
                  SKU:obj.SKU,
                  SKUID:obj.ID,
                  NUM: this.JoinGoodsNum,
                }
                // 是否有重复项
                if(this.JoinData.length){
                  let sameData=this.JoinData.find(i=>i.GoodsType==addData.GoodsType&&i.GOODCODE==addData.GOODCODE)
                  if(!sameData){
                    this.JoinData.push(addData)
                  }else{
                    this.JoinData.forEach(item=>{
                      if(addData.SKU==item.SKU&&addData.ID==item.SKUID){
                        let NUM=item.NUM
                        item=sameData
                      }
                    })
                  }
                }else {
                  this.JoinData.push(addData)
                }
                this.$refs.JoinSelect.clearSingleSelect()
                this.JoinGoodsNum=1
                this.totalJoin=this.JoinData.length
                 if(this.totalJoin){ //翻页
                    this.JoinCurrentPage=parseInt((this.totalJoin-1)/this.pageSizeJoin)+1
                }

                //每次添加完数据，清空搜索项内容
                this.JoinGoodsNum = '';
                // 截取数组
                let startIndex=this.pageSizeJoin*(this.JoinCurrentPage-1)
                let endIndex=startIndex+this.pageSizeJoin
                this.currentJoinData=this.JoinData.slice(startIndex,endIndex) //当前页面显示明细

            }
      },
      // 添加排除商品到表格
      addExcludeGoods(){
          if(JSON.stringify(this.selectExcludeSKUData)=='{}'){
            this.$Message.warning('添加编码不能为空');
            return
          }
          let obj=this.selectExcludeSKUData
          if(obj){
              let addData= {
                  ID: 'cs'+ Math.floor(Math.random()*10000),
                  GoodsTypeName: this.selectGoodTypeTwo == '1'?'按系统SKU编码':this.selectGoodTypeTwo == '2'?'按系统商品编码':this.selectGoodTypeTwo == '3'?'按平台SKU编码':'按平台商品编码',
                  GoodsType: this.selectGoodTypeTwo,
                  TITLE:(this.selectGoodTypeTwo == '1')?obj.SKUNAME:obj.TITLE,
                  PRODUCTCODE:obj.PRODUCTCODE,
                  GOODCODE: this.selectGoodTypeTwo == '1'?obj.SKU:this.selectGoodTypeTwo == '2'?obj.PRODUCTCODE:this.selectGoodTypeTwo == '3'?obj.EXTSKUID:obj.NUMIID,
                  SKU:obj.SKU,
                  SKUID:obj.ID,
                  NUM: this.ExcludeGoodsNum,
                }
                // 是否有重复项
                if(this.ExcludeData.length){
                  let sameData=this.ExcludeData.find(i=>i.GoodsType==addData.GoodsType&&i.GOODCODE==addData.GOODCODE)
                  if(!sameData){
                    this.ExcludeData.push(addData)
                  }else{
                    this.ExcludeData.forEach(item=>{
                      if(addData.SKU==item.SKU&&addData.ID==item.SKUID){
                        let NUM=item.NUM
                        item=sameData
                      }
                    })
                  }
                }else {
                  this.ExcludeData.push(addData)
                }
                this.$refs.ExcludeSelect.clearSingleSelect()
                this.ExcludeGoodsNum=1
                this.totalExclude=this.ExcludeData.length
                 if(this.totalExclude){ //翻页
                    this.ExcludeCurrentPage=parseInt((this.totalExclude-1)/this.pageSizeExclude)+1
                }

                //每次添加完数据，清空搜索项内容
                this.ExcludeGoodsNum = '';
                // 截取数组
                let startIndex=this.pageSizeExclude*(this.ExcludeCurrentPage-1)
                let endIndex=startIndex+this.pageSizeExclude
                this.currentExcludeData=this.ExcludeData.slice(startIndex,endIndex) //当前页面显示明细

            }
      },
      //初始查询标准下拉框数据
      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 if(tableName=='T_IESWAREHOUSE'){
                  item.optionList= res.data.rows.map(i=>{
                    return {
                      label:i.WAREHOUSENAME.val,
                      value:i.ID.val
                    }
                  })
                }else if(tableName=='T_IESBRAND'){
                  item.optionList= res.data.rows.map(i=>{
                    return {
                      label:i.BRANDNAME.val,
                      value:i.ID.val
                    }
                  })
                }else if(tableName=='T_OMSREGION'){
                  // item.optionList= res.data.rows.map(i=>{
                  //   return {
                  //     label:i.REGIONNAME.val,
                  //     value:i.ID.val
                  //   }
                  // })
                }else{
                  item.optionList= res.data.rows.map(i=>{
                    return {
                      label:i.NAME.val,
                      value:i.ID.val
                    }
                  })
                }

              }
            })
          })
      },

      // 选择系统商品 在单选下有效，选中某一项时触发
      selectGoods(selection){
        this.submitArrGoods=[selection]
      },
      // 选择平台商品 在单选下有效，选中某一项是触发
      selectPlatformGoods(selection){
        this.submitArrPlatformGoods=[selection]
      },

      // 选择系统商品页码改变时触发
      changePageGoods(val) {
        // 1=>0 2=>10 3=>20
        this.currentGoodsPage = (val - 1) * 10;
        this.searchGoodsData();
      },
      // 选择平台商品页码改变时触发
      changePagePlatformGoods(val) {
        // 1=>0 2=>10 3=>20
        this.currentPlatformGoodsPage = (val - 1) * 10;
        this.searchPlatformGoodsData();
      },
      // 选择系统商品页数改变时触发
      changeSizeGoods(val) {
        this.pageSizeGoods = val;
        this.currentGoodsPage = 1;
        this.searchGoodsData();
      },
      // 选择平台商品页数改变时触发
      changeSizePlatformGoods(val) {
        this.pageSizePlatformGoods = val;
        this.currentPlatformGoodsPage = 1;
        this.searchPlatformGoodsData();
      },
      // 打开系统商品选择商品弹窗
      searchGoods(name){
        if((this.tabName == 'name2' && (this.selectGoodTypeOne == 3 || this.selectGoodTypeOne == 4)) || (this.tabName == 'name3' &&  (this.selectGoodTypeTwo == 3 || this.selectGoodTypeTwo == 4))) {
          this.searchPlatformGoods();
        }else {
          this.nowGoodsType=name
          this.searchGoodsData()
          this.selectGoodsModal=true
        }
      },
      // 打开平台商品选择商品弹窗
      searchPlatformGoods(name){
        this.nowGoodsType=name
        this.searchPlatformGoodsData()
        this.selectPlatformGoodsModal=true
      },
      // 关闭系统商品选择商品弹窗
      cancelSelectGoods(){
        this.selectGoodsData={
          NORMS1NAME:'',//颜色
          NORMS2NAME:'',//尺寸
          SKU:'',//SKU
          GBCODE:'',//国标码
          // SELLPRICE:'',//销售价
          // BASEPRICE:'',//成本价
          PRODUCTCODE:'',//商品编码
          PRODUCTNAME:''//商品名称
        }
        this.submitArrGoods=[]
        this.selectGoodsModal=false
      },
      // 关闭平台商品选择商品弹框
      cancelSelectPlatformGoods(){
        this.selectPlatformGoodsData={
          SHOPID:'',//店铺
          SKUID:'',//系统SKU编码
          EXTSKUID:'',//平台SKU编码
          NUMIID:'',//平台商品编码
          PRODUCTCODE:'',//系统商品编码
          TITLE:''//平台商品标题
        }
        this.submitArrPlatformGoods=[]
        this.selectPlatformGoodsModal=false
      },
      // 选择系统商品确认按钮
      okSelectGoods(){
        if(!this.submitArrGoods.length){
          this.$Message.warning('请选择商品');
          return
        }
        if(this.tabName == 'name1' || (this.tabName == 'name2' && this.selectGoodTypeOne == 1) || (this.tabName == 'name3' && this.selectGoodTypeTwo == 1)){  // 赠送商品，指定商品（商品选择为按系统SKU编码），排除商品（商品选择为按系统SKU编码）
          network.post('/p/cs/getIesSku', {sku: this.submitArrGoods[0].SKU}).then((res) => {
            if(res.data.Code==0){
              if(!res.data.Rows.length){
                this.$Message.warning('该SKU无法添加，请重新选择');
                return
              }
              if(this.tabName == 'name2'){
                this.SKUArrJoin=res.data.Rows.map(i=>{
                  return {
                    label:i.SKU,
                    value:i.ID
                  }
                })
                this.SKUAllDataJoin=res.data.Rows
              }else if(this.tabName == 'name3'){
                this.SKUArrExclude=res.data.Rows.map(i=>{
                  return {
                    label:i.SKU,
                    value:i.ID
                  }
                })
                this.SKUAllDataExclude=res.data.Rows
              }else {
                this.SKUArrReturn=res.data.Rows.map(i=>{
                  return {
                    label:i.SKU,
                    value:i.ID
                  }
                })
                this.SKUAllDataReturn=res.data.Rows
              }
            }else{
              if(this.tabName == 'name2'){
                this.SKUArrJoin=[]
                this.SKUAllDataJoin=[]
              }else if(this.tabName == 'name3'){
                this.SKUArrExclude=[]
                this.SKUAllDataExclude=[]
              }else {
                this.SKUArrReturn=[]
                this.SKUAllDataReturn=[]
              }
            }
            if(this.tabName == 'name2'){
              this.selectJoinSKUData=this.SKUAllDataJoin.find(item=>{
                return item.ID==this.submitArrGoods[0].ID
              }) //添加的数据
              this.selectJoinSKUID=this.selectJoinSKUData.ID //双向数据绑定
            }else if(this.tabName == 'name3'){
              this.selectExcludeSKUData=this.SKUAllDataExclude.find(item=>{
                return item.ID==this.submitArrGoods[0].ID
              }) //添加的数据
              this.selectExcludeSKUID=this.selectExcludeSKUData.ID //双向数据绑定
            }else {
              this.selectReturnSKUData=this.SKUAllDataReturn.find(item=>{
                return item.ID==this.submitArrGoods[0].ID
              }) //添加的数据
              this.selectReturnSKUID=this.selectReturnSKUData.ID //双向数据绑定
            }
            this.cancelSelectGoods()
          })
        }else if((this.tabName == 'name2' && this.selectGoodTypeOne == 2) || (this.tabName == 'name3' && this.selectGoodTypeTwo == 2)){ // 指定商品（商品选择为按系统商品编码），排除商品（商品选择为按系统商品编码）
          network.post('/p/cs/getProductCode', {productCode: this.submitArrGoods[0].PRODUCTCODE}).then((res) => {
              if(res.data.Code==0){
                  if(!res.data.Rows.length){
                    this.$Message.warning('该商品编码无法添加，请重新选择');
                    return
                  }
                  if(this.tabName == 'name2'){
                    this.SKUArrJoin=res.data.Rows.map(i=>{
                      return {
                        label:i.PRODUCTCODE,
                        value:i.ID
                      }
                    })
                    this.SKUAllDataJoin=res.data.Rows
                  }else if(this.tabName == 'name3') {
                    this.SKUArrExclude=res.data.Rows.map(i=>{
                      return {
                        label:i.PRODUCTCODE,
                        value:i.ID
                      }
                    })
                    this.SKUAllDataExclude=res.data.Rows
                  }
              }else {
                if(this.tabName == 'name2'){
                  this.SKUArrJoin=[]
                  this.SKUAllDataJoin=[]
                }else if(this.tabName == 'name3') {
                  this.SKUArrExclude=[]
                  this.SKUAllDataExclude=[]
                }
              }
              if(this.tabName == 'name2'){
                this.selectJoinSKUData=this.SKUAllDataJoin.find(item=>{
                  return item.ID==this.submitArrGoods[0].IESPRODUCTID
                }) //添加的数据
                this.selectJoinSKUID=this.selectJoinSKUData.ID //双向数据绑定
                this.cancelSelectGoods()
              }else if(this.tabName == 'name3'){
                this.selectExcludeSKUData=this.SKUAllDataExclude.find(item=>{
                  return item.ID==this.submitArrGoods[0].IESPRODUCTID
                }) //添加的数据
                this.selectExcludeSKUID=this.selectExcludeSKUData.ID //双向数据绑定
                this.cancelSelectGoods()
              }
          })
        }
      },
      // 选择平台商品确认按钮
      okSelectPlatformGoods() {
        if(!this.submitArrPlatformGoods.length){
          this.$Message.warning('请选择商品');
          return
        }
        if((this.tabName == 'name2' && this.selectGoodTypeOne == 3) || (this.tabName == 'name3' && this.selectGoodTypeTwo == 3)){ // 指定商品（商品选择为按平台SKU编码），排除商品（商品选择为按平台SKU编码）
            if(this.tabName == 'name2'){
              this.SKUArrJoin=this.submitArrPlatformGoods.map(i=>{
                return {
                  label:i.EXTSKUID,
                  value:i.ID
                }
              })
              this.SKUAllDataJoin = this.submitArrPlatformGoods
            }else if(this.tabName == 'name3'){
              this.SKUArrExclude=this.submitArrPlatformGoods.map(i=>{
                return {
                  label:i.EXTSKUID,
                  value:i.ID
                }
              })
              this.SKUAllDataExclude=this.submitArrPlatformGoods
            }
            if(this.tabName == 'name2'){
              this.selectJoinSKUData=this.SKUAllDataJoin.find(item=>{
                return item.ID==this.submitArrPlatformGoods[0].ID
              }) //添加的数据
              this.selectJoinSKUID=this.selectJoinSKUData.ID //双向数据绑定
            }else if(this.tabName == 'name3'){
              this.selectExcludeSKUData=this.SKUAllDataExclude.find(item=>{
                return item.ID==this.submitArrPlatformGoods[0].ID
              }) //添加的数据
              this.selectExcludeSKUID=this.selectExcludeSKUData.ID //双向数据绑定
            }
            this.cancelSelectPlatformGoods()
        }else if((this.tabName == 'name2' && this.selectGoodTypeOne == 4) || (this.tabName == 'name3' && this.selectGoodTypeTwo == 4)){ // 指定商品（商品选择为按平台商品编码），排除商品（商品选择为按平台商品编码）
            if(this.tabName == 'name2'){
              this.SKUArrJoin=this.submitArrPlatformGoods.map(i=>{
                return {
                  label:i.NUMIID,
                  value:i.ID
                }
              })
              this.SKUAllDataJoin = this.submitArrPlatformGoods
            }else if(this.tabName == 'name3'){
              this.SKUArrExclude=this.submitArrPlatformGoods.map(i=>{
                return {
                  label:i.NUMIID,
                  value:i.ID
                }
              })
              this.SKUAllDataExclude=this.submitArrPlatformGoods
            }
            if(this.tabName == 'name2'){
              this.selectJoinSKUData=this.SKUAllDataJoin.find(item=>{
                return item.ID==this.submitArrPlatformGoods[0].ID
              }) //添加的数据
              this.selectJoinSKUID=this.selectJoinSKUData.ID //双向数据绑定
            }else if(this.tabName == 'name3'){
              this.selectExcludeSKUData=this.SKUAllDataExclude.find(item=>{
                return item.ID==this.submitArrPlatformGoods[0].ID
              }) //添加的数据
              this.selectExcludeSKUID=this.selectExcludeSKUData.ID //双向数据绑定
            }
            this.cancelSelectPlatformGoods()
        }
      },
      // 重置选择系统商品搜索条件
      resetGoodsData(){
        this.selectGoodsData={
          NORMS1NAME:'',//颜色
          NORMS2NAME:'',//尺寸
          SKU:'',//SKU
          GBCODE:'',//国标码
          // SELLPRICE:'',//销售价
          // BASEPRICE:'',//成本价
          PRODUCTCODE:'',//商品编码
          PRODUCTNAME:''//商品名称
        }
        this.submitArrGoods=[]
        this.searchGoodsData()
      },
      // 重置选择平台商品搜索条件
      resetPlatformGoodsData() {
        this.selectPlatformGoodsData={
          SHOPID:'',//店铺
          SKUID:'',//系统SKU编码
          EXTSKUID:'',//平台SKU编码
          NUMIID:'',//平台商品编码
          PRODUCTCODE:'',//系统商品编码
          TITLE:''//平台商品标题
        }
        this.defaultSelectedSystemSKU = [];
        this.defaultSelectedshopID = [];
        this.submitArrPlatformGoods=[]
        this.searchPlatformGoodsData()
      },
      // 查询符合搜索条件的系统商品
      searchGoodsData(){
        let virtual = {
          fixedcolumns: this.selectGoodsData ? this.selectGoodsData : {},
          isdroplistsearch: false,
          range: this.pageSizeGoods,
          startindex: this.currentGoodsPage,
          table: 'T_V_IESNOGROUPSKU',
        };
          network.post('/p/cs/list/query', virtual).then((res) => {
            this.totalGoods = res.data.total;
            let data = [];
            for (let i = 0; i < res.data.rows.length; i++) {
              for (let j = 0; j < Object.keys(res.data.rows[i]).length; j++) {
                let keyName = Object.keys(res.data.rows[i])[j];
                res.data.rows[i][keyName] = res.data.rows[i][keyName].val;
              }
              data.push(res.data.rows[i]);
            }
            this.GoodsData = data;
            this.GoodsData.forEach(i=>i.ISGIFT=0)
            this.GoodsData.forEach(i=>i.ISGROUP=0)
            if(this.nowGoodsType=='return'){
              if(this.returnData.length){
                let sameArr = [...this.GoodsData].filter((x) => [...this.returnData].some((y) => y.SKU == x.SKU));
                this.returnDataNoSame= [...this.returnData].filter((x) => [...this.GoodsData].every((y) => y.SKU != x.SKU));
                if(sameArr.length){
                  this.GoodsData.forEach(item=>{
                    sameArr.forEach(i=>{
                      if(i.SKU==item.SKU){
                          item._checked=true
                          item.isSame=true //标记是否为之前选择项
                      }
                    })
                  })
                  this.submitArrGoods=[...this.submitArrGoods,...sameArr]
                }
              }else{
                this.GoodsData.forEach(item=>{
                  item.NUM=1
                  item.REFUNDNUM=1
                })
              }
            }
          });
      },
      // 查询符合搜索条件的平台商品
      searchPlatformGoodsData() { // PlatformGoodsData  T_V_IESPLATFORMSKU
        let virtual={
          searchdata: {
            "table":"T_V_IESPLATFORMSKU",
            "startindex":this.currentPlatformGoodsPage,
            'range':this.pageSizePlatformGoods,
            "fixedcolumns": this.selectPlatformGoodsData ? this.selectPlatformGoodsData : {},
            "column_include_uicontroller":true,
            "isolr":false
          }
        }
        network.post('/p/cs/QueryList', urlSearchParams(virtual)).then((res) => {
          this.totalPlatformGoods = res.data.data.totalRowCount;
          let data = [];
          for(let i = 0;i < res.data.data.row.length;i++) {
            for (let j = 0; j < Object.keys(res.data.data.row[i]).length; j++) {
              let keyName = Object.keys(res.data.data.row[i])[j];
              res.data.data.row[i][keyName] = res.data.data.row[i][keyName].val;
            }
            data.push(res.data.data.row[i]);
          }
          this.PlatformGoodsData = data;
          this.PlatformGoodsData.forEach(i=>i.ISGIFT=0)
          this.PlatformGoodsData.forEach(i=>i.ISGROUP=0)
          if(this.nowGoodsType=='return'){
            if(this.returnData.length){
              let sameArr = [...this.GoodsData].filter((x) => [...this.returnData].some((y) => y.SKU == x.SKU));
              this.returnDataNoSame= [...this.returnData].filter((x) => [...this.GoodsData].every((y) => y.SKU != x.SKU));
              if(sameArr.length){
                this.GoodsData.forEach(item=>{
                  sameArr.forEach(i=>{
                    if(i.SKU==item.SKU){
                        item._checked=true
                       item.isSame=true //标记是否为之前选择项
                    }
                  })
                })
                this.submitArrGoods=[...this.submitArrGoods,...sameArr]
              }
            }else{
              this.GoodsData.forEach(item=>{
                item.NUM=1
                item.REFUNDNUM=1
              })
            }
          }
        })
      },


      // 赠送商品表删除
      deleteReturnGoods(){
        let idArray=this.submitArrReturn.map(item=>item.ID)
        this.returnData = this.returnData.filter(i =>{
         return !idArray.includes(i.ID)
        });
        this.totalReturn=this.returnData.length //总条数
        // 截取数组
        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturn
        this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
        if (this.freeFilterData.length) {
          this.filterFreeGoodsFn({
            ...this.freeFilterOption,
            reFilter: false,
          })
        }
      },
      // 指定商品表删除
      deleteJoinGoods() {
         if(this.submitArrJoin.length > 0){
          this.$Modal.fcWarning({
                title: '提示',
                mask: true,
                showCancel: true,
                content: '确认删除选中的指定商品？',
                onOk:()=>{
                  let idArray=this.submitArrJoin.map(item=>item.ID)
                  this.JoinData = this.JoinData.filter(i =>{
                    return !idArray.includes(i.ID)
                  });
                  this.totalJoin=this.JoinData.length //总条数
                  // 截取数组
                  let startIndex=this.pageSizeJoin*(this.JoinCurrentPage-1)
                  let endIndex=startIndex+this.pageSizeJoin
                  this.currentJoinData=this.JoinData.slice(startIndex,endIndex) //当前页面显示明细
                  if (this.joinFilterData.length) {
                    this.filterJoinFn({
                      ...this.joinFilterOption,
                      reFilter: false,
                    })
                  }
                }
              })
         }
      },
      // 排除商品表删除
      deleteExcludeGoods() {
        let idArray=this.submitArrExclude.map(item=>item.ID)
        this.ExcludeData = this.ExcludeData.filter(i =>{
         return !idArray.includes(i.ID)
        });
        this.totalExclude=this.ExcludeData.length //总条数
        // 截取数组
        let startIndex=this.pageSizeExclude*(this.ExcludeCurrentPage-1)
        let endIndex=startIndex+this.pageSizeExclude
        this.currentExcludeData=this.ExcludeData.slice(startIndex,endIndex) //当前页面显示明细
        if (this.excludeFilterData.length) {
          this.filterExcludeFn({
            ...excludeFilterOption,
            reFilter: false,
          })
        }
      },

      // 指定商品表导入
      exportJoinGoods() {
        this.JoinActiveGoodsvisible = true;
      },
      // 指定商品表导入弹框关闭
      closeActionDialog() {
        this.JoinActiveGoodsvisible = false;
      },

      // 赠送商品表导入
      importGiftGoodsExcel() {
        this.GiftActiveGoodsvisible = true;
      },
      // 赠送商品表导入弹框关闭
      closeActionDialogGift() {
        this.GiftActiveGoodsvisible = false;
      },
      changeGiftGoodsImport(value) {
        value.forEach(item => {
          item.CURNUM = 0;
        })
        this.returnData=[...this.returnData,...value]
        this.totalReturn=this.returnData.length;
        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturn
        this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
      },

      // 赠送商品页码改变时触发
      changePageReturn(val){
         // 1=>0 2=>10 3=>20
         this.returnCurrentPage=val
        // 截取数组
        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturn
        let originData = this.returnData
        if (this.freeFilterData.length) {
          originData = this.freeFilterData;
        }
        this.currentReturnData=originData.slice(startIndex,endIndex)
      },
      // 指定商品页码改变时触发
      changePageJoin(val){
         // 1=>0 2=>10 3=>20
         this.JoinCurrentPage=val
        // 截取数组
        let startIndex=this.pageSizeJoin*(this.JoinCurrentPage-1)
        let endIndex=startIndex+this.pageSizeJoin
        let originData = this.JoinData
        if (this.joinFilterData.length) {
          originData = this.joinFilterData;
        }
        this.currentJoinData=originData.slice(startIndex,endIndex)
      },
      // 排除商品页码改变时触发
      changePageExclude(val){
         // 1=>0 2=>10 3=>20
         this.ExcludeCurrentPage=val
        // 截取数组
        let startIndex=this.pageSizeExclude*(this.ExcludeCurrentPage-1)
        let endIndex=startIndex+this.pageSizeExclude
        let originData = this.ExcludeData
        if (this.excludeFilterData.length) {
          originData = this.excludeFilterData;
        }
        this.currentExcludeData=originData.slice(startIndex,endIndex)
      },
      // 参与活动买家页面改变时触发
      changePageJoinActiveBuyers(val) {
        this.JoinActiveBuyersCurrentPage=val
        // 截取数组
        let startIndex=this.pageSizeJoinActiveBuyers*(this.JoinActiveBuyersCurrentPage-1)
        let endIndex=startIndex+this.pageSizeJoinActiveBuyers
        this.currentJoinActiveBuyersData=this.JoinActiveBuyersData.slice(startIndex,endIndex)
      },
      // 参与活动订单页面改变时触发
      changePageJoinActiveOrders(val) {
        this.JoinActiveOrdersCurrentPage=val
        // 截取数组
        let startIndex=this.pageSizeJoinActiveOrders*(this.JoinActiveOrdersCurrentPage-1)
        let endIndex=startIndex+this.pageSizeJoinActiveOrders
        this.currentJoinActiveOrdersData=this.JoinActiveOrdersData.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
        let originData = this.returnData
        if (this.freeFilterData.length) {
          originData = this.freeFilterData;
        }
        this.currentReturnData=originData.slice(startIndex,endIndex)
      },
      // 指定商品页数改变时触发
      changeSizeJoin(val){
        this.pageSizeJoin = val;
        this.JoinCurrentPage=1;
        // this.currentReturnPage = 0;
        // 截取数组
        let startIndex=this.pageSizeJoin*(this.JoinCurrentPage-1)
        let endIndex=startIndex+this.pageSizeJoin
        let originData = this.JoinData
        if (this.joinFilterData.length) {
          originData = this.joinFilterData;
        }
        this.currentJoinData=originData.slice(startIndex,endIndex)
      },
      // 排除商品页数改变时触发
      changeSizeExclude(val){
        this.pageSizeExclude = val;
        this.ExcludeCurrentPage=1;
        // this.currentReturnPage = 0;
        // 截取数组
        let startIndex=this.pageSizeExclude*(this.ExcludeCurrentPage-1)
        let endIndex=startIndex+this.pageSizeExclude
        let originData = this.ExcludeData
        if (this.excludeFilterData.length) {
          originData = this.excludeFilterData;
        }
        this.currentExcludeData=originData.slice(startIndex,endIndex)
      },
      // 参与活动买家页数改变时触发
      changeSizeJoinActiveBuyers(val){
        this.pageSizeJoinActiveBuyers = val;
        this.JoinActiveBuyersCurrentPage=1;
        // this.currentReturnPage = 0;
        // 截取数组
        let startIndex=this.pageSizeJoinActiveBuyers*(this.JoinActiveBuyersCurrentPage-1)
        let endIndex=startIndex+this.pageSizeJoinActiveBuyers
        this.currentJoinActiveBuyersData=this.JoinActiveBuyersData.slice(startIndex,endIndex)
      },
      // 参与活动订单页数改变时触发
      changeSizeJoinActiveOrders(val){
        this.pageSizeJoinActiveOrders = val;
        this.JoinActiveOrdersCurrentPage=1;
        // this.currentReturnPage = 0;
        // 截取数组
        let startIndex=this.pageSizeJoinActiveOrders*(this.JoinActiveOrdersCurrentPage-1)
        let endIndex=startIndex+this.pageSizeJoinActiveOrders
        this.currentJoinActiveOrdersData=this.JoinActiveOrdersData.slice(startIndex,endIndex)
      },
      // 赠送商品表格选中某项时触发
      selectReturnData(selection, row) {
        this.submitArrReturn = selection;
      },
      // 指定商品表格选中某项时触发
      selectJoinData(selection, row) {
        this.submitArrJoin = selection;
      },
      // 排除商品表格选中某项时触发
      selectExcludeData(selection, row) {
        this.submitArrExclude = selection;
      },
      // 赠送商品表格取消某项时触发
      selectReturnCancel(selection, row) {
        this.submitArrReturn = selection;
      },
      // 指定商品表格取消某项时触发
      selectJoinCancel(selection, row) {
        this.submitArrJoin = selection;
      },
      // 排除商品表格取消某项时触发
      selectExcludeCancel(selection, row) {
        this.submitArrExclude = selection;
      },
      // 赠送商品表格全选
      selectReturnDataAll(selection) {
        this.submitArrReturn = selection;
      },
      // 指定商品表格全选
      selectJoinDataAll(selection) {
        this.submitArrJoin = selection;
      },
      // 排除商品表格全选
      selectExcludeDataAll(selection) {
        this.submitArrExclude = selection;
      },
      // 赠送商品表格取消全选
      selectReturnDataCancel(selection) {
        this.submitArrReturn = selection;
      },
      // 指定商品表格取消全选
      selectJoinDataCancel(selection) {
        this.submitArrJoin = selection;
      },
      // 排除商品表格取消全选
      selectExcludeDataCancel(selection) {
        this.submitArrExclude = selection;
      },


      parser(value) {
        if((typeof value=='string')){
          return parseFloat(value.replace(/[^\d\.-]/g, ''));
        }else{
          return value
        }

      },

      checkInputSKU(e,i){
        if(i.SKEY == 'gift_method' && !['普通赠送','满金额件数赠送','按排名分组赠送','随机分组赠送','按尺码对应赠送','按买家备注赠送','按卖家备注赠送','按金额阶梯赠送','按数量阶梯赠送'].includes(e)) {
          return
        }

        if(i.SKEY=='activegoodstype'){
          this.ISShowTab4 = false;
          this.ISShowTab5 = false;
          this.ISShowTab6 = false;
          if(e == '指定商品') {
            this.tabName = 'name2'
            this.limitGoodsType = '1';
            this.getOMSACTIVEJOINGOODS(); // 获取活动参与（排除）商品表
            // this.ISShowTab4 = true;
          }else if(e == '排除商品') {
            this.tabName = 'name3'
            this.limitGoodsType = '2';
            this.getOMSACTIVEJOINGOODS(); // 获取活动参与（排除）商品表
            // this.ISShowTab4 = true;
          }else {
            this.limitGoodsType = '0';
            this.tabName = 'name1'
            this.ISShowTab4 = true;
            this.ISShowTab5 = this.LIMITGIFTNUM?true:false;
            this.ISShowTab6 = true;
          }
        }else if(i.SKEY == 'gift_method'){
          this.tabList[1].list.find(item=>item.SKEY=='satisfied_amount').disabled = false;
          this.tabList[1].list.find(item=>item.SKEY=='satisfied_pieces').disabled = false;
          this.returnColumns = [ //赠送商品
            {
              type: 'selection',
              width: 60,
              align: 'center'
            },
            {
              type: 'index',
              align: 'center',
              title: '序号',
            },
            {
              title: '商品名称',
              align: 'center',
              key: 'TITLE'
            },
            {
              title: '商品SKU',
              align: 'center',
              key: 'SKU'
            },
            // 新增字段
            {
              title: '赠送件数',
              align: 'center',
              key: 'NUM',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.NUM,
                      number: true
                    },
                    on: {
                      'on-blur': (event) => {
                        let chengeData=this.currentReturnData[params.index]
                        // this.returnData[params.index].NUM = event.target.value
                        // this.returnData.forEach((item)=>{
                        //     if((item.SKU==chengeData.SKU)){
                        //       item.NUM = event.target.value
                        //     }
                        // })
                        const value = event.target.value
                        const index = ((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index
                        this.returnData[index].NUM = value;
                        this.totalReturn=this.returnData.length;
                        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                        let endIndex=startIndex+this.pageSizeReturn
                        this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                      }
                    }
                  },
                );
              },
            },
            {
              title: '总共要送的件数',
              align: 'center',
              key: 'ALLNUM',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.ALLNUM,
                    },
                    on: {
                      'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          // this.returnData.forEach((item)=>{
                          //   if((item.SKU==chengeData.SKU)){
                          //     item.ALLNUM = event.target.value
                          //   }
                          // })
                          const value = event.target.value
                          const index = ((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index
                          this.returnData[index].ALLNUM = value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                      }
                    }
                  },
                );
              },
            },
            {
              title: '已赠送数量',
              align: 'center',
              key: 'CURNUM',
            },
            {
              title: '赠品无需退回',
              align: 'center',
              key: 'AUTOREFUND',
              render: (h, params) => {
                let this_=this
                return h(
                  'Checkbox',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.AUTOREFUND
                    },
                    on: {
                      'on-change': (event) => {
                        const currentData=this.currentReturnData[params.index]
                        this.returnData.forEach((item)=>{
                            if((item.SKU==currentData.SKU)){
                              item.AUTOREFUND = event
                            }
                        })
                      }
                    }
                  },
                );
              },
            },
          ]
          if(this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').VALUE){
            let obj = {
              title: '组号',
              align: 'center',
              key: 'ORDERBY',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.ORDERBY,
                    },
                    on: {
                      'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          // this.returnData[params.index].ORDERBY = event.target.value;
                          this.returnData[((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index].ORDERBY = this.parser(event.target.value);
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                      }
                    }
                  },
                );
              },
            }
            this.returnColumns.push(obj);
          }
          if(e == '随机分组赠送'){
            if(!this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').VALUE){
              this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').VALUE = true;
            }
            this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').disabled = true;
            let obj = {
                title: '组号',
                align: 'center',
                key: 'ORDERBY',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        value: params.row.ORDERBY,
                      },
                      on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                            event.target.value=event.target.value
                            // this.returnData[params.index].ORDERBY = event.target.value;
                            this.returnData[((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index].ORDERBY = this.parser(event.target.value);
                            this.totalReturn=this.returnData.length;
                            let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                            let endIndex=startIndex+this.pageSizeReturn
                            this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
            }
            // 删除组号
            const index = this.returnColumns.findIndex(item => item.key === 'ORDERBY')
            if(index > -1) {
              this.returnColumns.splice(index,1)
            }
            this.returnColumns.push(obj);
          }else if(e == '满金额件数赠送'){
            this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').disabled = false;
            let obj = [
              {
                title: '满足金额',
                align: 'center',
                key: 'PRODUCTBUYPRICE',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        regx: this.regx,
                        value: params.row.PRODUCTBUYPRICE,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          this.returnData[params.index].PRODUCTBUYPRICE = event.target.value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              },
              {
                title: '满足件数',
                align: 'center',
                key: 'PRODUCTBUYUNIT',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        regx: this.regx,
                        value: params.row.PRODUCTBUYUNIT,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          this.returnData[params.index].PRODUCTBUYUNIT = event.target.value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              }
            ]
            obj.forEach(item => {
              this.returnColumns.push(item)
            })
          }else if(e == '按排名分组赠送'){
            this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').disabled = false;
            let obj = [
              {
                title: '起始排名',
                align: 'center',
                key: 'STARTSECTION',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        regx: this.regx,
                        value: params.row.STARTSECTION,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          this.returnData[params.index].STARTSECTION = event.target.value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              },
              {
                title: '结束排名',
                align: 'center',
                key: 'ENDSECTION',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        regx: this.regx,
                        value: params.row.ENDSECTION,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          this.returnData[params.index].ENDSECTION = event.target.value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              },
              {
                title: '指定排名',
                align: 'center',
                key: 'APPOINTRANGE',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      props: {
                        value: params.row.APPOINTRANGE,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=this.parser(event.target.value)
                          this.returnData[params.index].APPOINTRANGE = this.parser(event.target.value);
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              }
            ]
            obj.forEach(item => {
              this.returnColumns.push(item)
            })
          }else if(e == '按尺码对应赠送'){
            this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').disabled = false;
            this.tabList[1].list.find(item=>item.SKEY=='satisfied_amount').disabled = true;
            this.tabList[1].list.find(item=>item.SKEY=='satisfied_pieces').disabled = true;
            this.tabList[1].list.find(item=>item.SKEY=='satisfied_amount').VALUE = '';
            this.tabList[1].list.find(item=>item.SKEY=='satisfied_pieces').VALUE = '';
            let obj = [
              {
                title: '参与活动规格类型',
                align: 'center',
                key: 'NORMSTYPE',
                render: (h, params) => {
                  const vm = this;
                  return h('Select', {
                    style: {
                      width:'100px',
                      zIndex: 999,
                    },
                    props: {
                      transfer: true,
                      value: params.row.NORMSTYPE, // 获取选择的下拉框的值
                    },
                      on: {
                        'on-change': (e) => {
                          let chengeData=vm.currentReturnData[params.index]
                            vm.returnData.forEach((item)=>{
                              if((item.SKU==chengeData.SKU)){
                                  item.NORMSTYPE =e;
                              }
                            })
                          vm.totalReturn=vm.returnData.length;
                          let startIndex=vm.pageSizeReturn*(vm.returnCurrentPage-1)
                          let endIndex=startIndex+vm.pageSizeReturn
                          vm.currentReturnData=vm.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                    vm.NORMSTYPEOptions.map(item => h('Option', {
                      props: {
                        value: item.value, // 绑定的值
                      }
                    }, item.name)
                  ));
                }
              },
              {
                title: '参与活动规格值',
                align: 'center',
                key: 'NORMSVALUES',
                renderHeader: this.tooltipRenderHeader('多个可使用英文逗号/分号或空格分隔'),
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'100px'
                      },
                      props: {
                        value: params.row.NORMSVALUES,
                      },
                      on: {
                        'on-blur': (event) => {
                          let chengeData=this.currentReturnData[params.index]
                          event.target.value=event.target.value
                          this.returnData[params.index].NORMSVALUES = event.target.value;
                          this.totalReturn=this.returnData.length;
                          let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                          let endIndex=startIndex+this.pageSizeReturn
                          this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
              },
            ]
            obj.forEach(item => {
              this.returnColumns.push(item)
            })
          }else if(e == '按买家备注赠送'){
            // 表单里联动显示备注字段
            this.showKeyWord('6')
          }else if(e == '按卖家备注赠送'){
            // 表单里联动显示备注字段
            this.showKeyWord('7')
          }else if(e == '按金额阶梯赠送'){
            // 选择“按金额阶梯赠送”
            this.priceLinkage('8')
          }else if(e == '按数量阶梯赠送'){
            // 选择“按数量阶梯赠送”
            this.numLinkage('9')
          }else {
            this.tabList[1].list.find(item=>item.SKEY=='activity_grouping').disabled = false;
          }
        }else {
          let tableName=i.ID
          if(tableName=='T_V_IESSHOP'){
            this.getQuery(tableName,{SHOPTITLE:e})
          }else if(tableName=='T_IESWAREHOUSE'){
            this.getQuery(tableName,{WAREHOUSENAME:e})
          }else if(tableName=='T_IESBRAND'){
            this.getQuery(tableName,{BRANDNAME:e})
          }
        }
      },
      // 平台单号，退款单号(换货单没有)，退回物流单号禁止输入空格
      noSpaces(e,i){
        if(i.SKEY=='satisfied_amount'||i.SKEY=='satisfied_pieces'){
          if(e.keyCode == 32) e.returnValue = false
        }
      },
      upOrDown(height) {
        this.currentValue = !this.currentValue;
        document.getElementsByClassName('conditionContent')[0].style.maxHeight = this.currentValue ? height : '';
        this.tableHeight = this.currentValue ? '250' : '200';
      },
      upOrDownOne(height) {
        this.currentValue = !this.currentValue;
        document.getElementsByClassName('conditionContentOne')[0].style.maxHeight = this.currentValue ? height : '';
        this.tableHeight = this.currentValue ? '250' : '200';
      },
        nowdate() { // d当前时间
            var myDate = new Date();
            //获取当前年
            var year = myDate.getFullYear();
            //获取当前月
            var month = myDate.getMonth() + 1;
            //获取当前日
            var date = myDate.getDate();
            var h = myDate.getHours();       //获取当前小时数(0-23)
            var m = myDate.getMinutes();     //获取当前分钟数(0-59)
            var s = myDate.getSeconds();
            var now = year + '-' + this.p(month) + "-" + this.p(date) + " " + this.p(h) + ':' + this.p(m) + ":" + this.p(s);
            return now;
        },
        p(s) {
            return s < 10 ? '0' + s : s;
        },
        // 保存
        saveAll(){
          var nowdata = new Date(this.nowdate().replace(new RegExp(/-/gm) ,"/"));
          var starttime = new Date(this.startTime.replace(new RegExp(/-/gm) ,"/"));
          var endtime = new Date(this.endTime.replace(new RegExp(/-/gm) ,"/"));
          var oldstarttime = new Date(this.oldstartTime.replace(new RegExp(/-/gm) ,"/"));
          var oldendtime = new Date(this.oldendTime.replace(new RegExp(/-/gm) ,"/"));
          // if (nowdata >= oldendtime){
          //   return this.$Message.warning("活动已经结束，不能修改");
          // }
          // if (nowdata >= oldstarttime){
          //   return this.$Message.warning("活动已经开始，不能修改");
          // }
          if(this.tabList[0].list.find(item=>item.SKEY=='Enable').VALUE){
            return this.$Message.warning("活动已启用,不能修改");
          }
          if(this.VIRSTATUS != "正常"){
            // return this.$Message.warning("活动已经终止,不能修改");
            return this.$Message.warning("活动为非正常状态,不能修改");
          }
          const actGroupItem = this.tabList[1].list.find( item => item.SKEY == 'activity_grouping') || {};
          const freeMethod = this.tabList[1].list.find(item => item.SKEY == 'gift_method') || {};
          const isCheckGroup = actGroupItem.VALUE || null;
          const freeMethodVal = freeMethod.VALUE || null;
          const isWillCheck = (freeMethodVal == 8) || (freeMethodVal == 9);
          // 如果设置了按金额/数量阶梯赠送,且有>1赠品，且没选中分组
          let isHaveSameItem = false;
          if(this.returnData.length > 1 && !isCheckGroup && isWillCheck){
            // =8时明细相同阶梯金额PRODUCTBUYPRICE>=2条 或者 =9时明细相同阶梯数量PRODUCTBUYUNIT >=2 都报错拦截
            const sameInfoMap = this.returnData.reduce((acc, item) => {
              const key1 = item.PRODUCTBUYPRICE || null;
              const key2 = item.PRODUCTBUYUNIT || null;
              if (key1) acc[key1] = (acc[key1] || 0) + 1;
              if (key2) acc[key2] = (acc[key2] || 0) + 1;
              return acc;
            }, {});
            for (const key in sameInfoMap) {
              const num = sameInfoMap[key] || 0;
              if (num >= 2) {
                isHaveSameItem = true;
                break;
              }
              console.log(key, 'wjf_001');
            }
            console.log(isHaveSameItem, sameInfoMap, 'returnData_01');
          }
          if (isHaveSameItem) {
            this.$Modal.fcWarning({
                title: '提示',
                mask: true,
                showCancel: true,
                content: '该活动没有设置分组但包含多个赠品，确认要赠送多个商品吗？',
                onOk:()=>{
                  let buyerMsg = this.tabList[1]; //特殊设置
                  var rs = new Object();
                  //初始化
                  for (var i = 0; i < this.returnData.length; i++) {
                      rs[this.returnData[i].ORDERBY] = [];
                  }
                  //分组
                  this.returnData.forEach(item => {
                    var key = item.ORDERBY;
                    rs[key].push(item);
                  })
                  var res = true;
                  for (var key in rs) {
                      // var arr1 = new Array();
                      for (var k = 0; k < rs[key].length; k++) {//rs[key]为每组数据
                          switch (buyerMsg.list.find(item=>item.SKEY=='gift_method').VALUE) {
                              case '2':
                                  for (var i=0; i<rs[key].length; i++) {
                                      for (var j=i+1; j<rs[key].length; j++) {
                                          if (rs[key][i].PRODUCTBUYPRICE != rs[key][j].PRODUCTBUYPRICE) {
                                            res = false;
                                          }else if(rs[key][i].PRODUCTBUYUNIT != rs[key][j].PRODUCTBUYUNIT) {
                                            res = false;
                                          }
                                      }
                                  }
                                  break;
                              case '3':
                                  for (var i=0; i<rs[key].length; i++) {
                                      for (var j=i+1; j<rs[key].length; j++) {
                                          if (rs[key][i].STARTSECTION != rs[key][j].STARTSECTION) {
                                            res = false;
                                          }else if(rs[key][i].ENDSECTION != rs[key][j].ENDSECTION) {
                                            res = false;
                                          }else if(rs[key][i].APPOINTRANGE != rs[key][j].APPOINTRANGE) {
                                            res = false;
                                          }
                                      }
                                  }
                                  break;
                              case '5':
                                  for (var i=0; i<rs[key].length; i++) {
                                      for (var j=i+1; j<rs[key].length; j++) {
                                          if (rs[key][i].NORMSVALUES != rs[key][j].NORMSVALUES) {
                                            res = false;
                                          }else if(rs[key][i].NORMSTYPE != rs[key][j].NORMSTYPE) {
                                            res = false;
                                          }
                                      }
                                  }
                                  break;
                          }
                      }
                      if (!res) {
                          //同一分组设置的规则不一致
                          this.$Modal.fcWarning({
                            title: '提示',
                            mask: true,
                            showCancel: false,
                            content: '同一分组设置的规则不一致',
                          })
                          return false;
                      }else {
                        this.saveContinue()
                      }

                  }
                },
            });
          } else {
            this.saveContinue()
          }
        },
        saveContinue() {
          let baseMsg = this.tabList[0]; //基本设置
          let buyerMsg = this.tabList[1]; //特殊设置
          let flag = true;

          if(!baseMsg.list.find(item=>item.SKEY=='activeName').VALUE){
            return this.$Message.warning('活动名称不能为空！');
          }
          if(!baseMsg.list.find(item=>item.SKEY=='orderType').VALUE){
            return this.$Message.warning('订单类型不能为空！');
          }
          if(!baseMsg.list.find(item=>item.SKEY=='shop_name').VALUE){
            return this.$Message.warning('活动店铺不能为空！');
          }
          if(!baseMsg.list.find(item=>item.SKEY=='orderTimeType').VALUE){
            return this.$Message.warning('时间类型不能为空！');
          }
          if(!this.startTime || !this.endTime){
            return this.$Message.warning('起止时间不能为空！');
          }
          if(buyerMsg.list.find(item=>item.SKEY=='multiple_gifts').VALUE && buyerMsg.list.find(item=>item.SKEY=='gift_method').VALUE!=5){
            if(!buyerMsg.list.find(item=>item.SKEY=='satisfied_amount').VALUE && !buyerMsg.list.find(item=>item.SKEY=='satisfied_pieces').VALUE){
              return this.$Message.warning('已选择多倍赠送，必须填写满足金额或者满足件数！');
            }
          }
          if(!buyerMsg.list.find(item=>item.SKEY=='restricted_double11_presale').VALUE){
            return this.$Message.warning('限制双十一预售不能为空！');
          }
          if(buyerMsg.list.find(item=>item.SKEY=='restricted_double11_presale').VALUE!='0' && !buyerMsg.list.find(item=>item.SKEY=='restricted_double11_presale_node').VALUE){
            return this.$Message.warning('定金预售订单执行促销节点不能为空！');
          }
          if(!buyerMsg.list.find(item=>item.SKEY=='gift_method').VALUE){
            return this.$Message.warning('赠送方式不能为空！');
          }
          const gift_method = buyerMsg.list.find(item=>item.SKEY=='gift_method').VALUE
          const keywordItem = this.tabList[1].list.find(item=>item.SKEY=='REMARKEGIFT') // 备注关键词
          let keyword = ''
          if(['6','7'].includes(gift_method)) {
            if(keywordItem && keywordItem.VALUE) {
              keyword = keywordItem.VALUE.trim()
            } else {
              this.$Message.warning('备注关键字不能为空！');
              return
            }
          }

          if(gift_method === '8') {
            const invalidIndex = this.returnData.findIndex(item => !item.PRODUCTBUYPRICE)
            if(invalidIndex > -1) {
              this.$Message.warning('阶梯金额不能为空！');
              return
            }
          }
          if(gift_method === '9') {
            const invalidIndex = this.returnData.findIndex(item => !item.PRODUCTBUYUNIT)
            if(invalidIndex > -1) {
              this.$Message.warning('阶梯数量不能为空！');
              return
            }
          }

          if(buyerMsg.list.find(item=>item.SKEY=='activity_grouping').VALUE){
            try {
              this.returnData.forEach(item => {
                if(!item.ORDERBY){
                  flag = false;
                  this.$Message.warning("该活动已设置了活动分组，请修改赠送商品的组号来给赠品分组！！")
                  throw new Error
                }
              })
            }catch {}
          }
          let T_V_OMSACTIVE = {
            'ID': this.pageMsgId,
            "TITLE": baseMsg.list.find(item=>item.SKEY=='activeName').VALUE,
            "RANK": baseMsg.list.find(item=>item.SKEY=='priority').VALUE,
            "ORDERTYPE": baseMsg.list.find(item=>item.SKEY=='orderType').VALUE,
            "SHOPID": baseMsg.list.find(item=>item.SKEY=='shop_name').VALUE?baseMsg.list.find(item=>item.SKEY=='shop_name').VALUE.join(','):'',
            "IESWAREHOUSEIDS": baseMsg.list.find(item=>item.SKEY=='warehouse_name').VALUE?baseMsg.list.find(item=>item.SKEY=='warehouse_name').VALUE.join(','):'',
            "IESBRANDIDS": baseMsg.list.find(item=>item.SKEY=='brand_name').VALUE?baseMsg.list.find(item=>item.SKEY=='brand_name').VALUE.join(','):'',
            "TIMESIGN": baseMsg.list.find(item=>item.SKEY=='orderTimeType').VALUE,
            "STARTTIME": this.startTime,
            "ENDTIME": this.endTime,
            // "EXPROVINCEIDS": baseMsg.list.find(item=>item.SKEY=='region_name').VALUE?baseMsg.list.find(item=>item.SKEY=='region_name').VALUE.join(','):'',
            "REMARK": baseMsg.list.find(item=>item.SKEY=='remark').VALUE,
            "ISLIMITBOOKORDER": buyerMsg.list.find(item=>item.SKEY=='restricted_double11_presale').VALUE,
            "ACTIVESTARTTIME": this.limitStartDate,
            "ACTIVEENDTIME": this.limitEndDate,
            "GIFTTYPE": gift_method,
            "BUYPRICE": gift_method == 5?0:buyerMsg.list.find(item=>item.SKEY=='satisfied_amount').VALUE,
            "BUYUNIT": gift_method == 5?0:buyerMsg.list.find(item=>item.SKEY=='satisfied_pieces').VALUE,
            "ISACTIVE": baseMsg.list.find(item=>item.SKEY=='Enable').VALUE?'Y':'N',
            "ISADD":buyerMsg.list.find(item=>item.SKEY=='activity_accumulation').VALUE?1:0,
            "ISOOSGIFT":buyerMsg.list.find(item=>item.SKEY=='out_of_stock_gift').VALUE?1:0,
            "ISGROUPACTIVITY":buyerMsg.list.find(item=>item.SKEY=='activity_grouping').VALUE?1:0,
            "ONE_YUAN_RESERVATION":buyerMsg.list.find(item=>item.SKEY=='one_yuan_reservation').VALUE?1:0,
            "ISSUPERIMPOSE":buyerMsg.list.find(item=>item.SKEY=='multiple_gifts').VALUE?1:0,
            "ISSENDLATER":buyerMsg.list.find(item=>item.SKEY=='is_send_later').VALUE?1:0,
            // "ISLIMITTIME": buyerMsg.list.find(item=>item.SKEY=='limit_time').VALUE?1:0,
            ISLIMITTIME: this.limitStartDate || this.limitEndDate ? 1:0,
            "activegoodstype": buyerMsg.list.find(item=>item.SKEY=='activegoodstype').VALUE,
            // "LIMITGIFTNUM": buyerMsg.list.find(item=>item.SKEY=='limit_buy_number').VALUE,
            "ALLHOSTNO": buyerMsg.list.find(item=>item.SKEY=='ALLHOSTNO').VALUE,

          }
          if(keyword) {
            T_V_OMSACTIVE.REMARKEGIFT = keyword
          }
          if(buyerMsg.list.find(item=>item.SKEY=='limit_buy_number') != undefined){
            T_V_OMSACTIVE.LIMITGIFTNUM = buyerMsg.list.find(item=>item.SKEY=='limit_buy_number').VALUE
          }
          if(buyerMsg.list.find(item=>item.SKEY=='restricted_double11_presale').VALUE != '0'){
            T_V_OMSACTIVE.PREORDER_PAYTIME_NODES = buyerMsg.list.find(item=>item.SKEY=='restricted_double11_presale_node').VALUE
          }else {
            T_V_OMSACTIVE.PREORDER_PAYTIME_NODES = -1
          }
          // 赠送商品
          let T_OMSActiveSku = []
          try {
            this.returnData.forEach((item,index) => {
              let obj = {
                  "SKU":item.SKU,
                  "OMSACTIVEID": this.pageMsgId,
                  "TITLE": item.TITLE,
                  "NUM": item.NUM,
                  "ALLNUM": item.ALLNUM,
                  AUTOREFUND: item.AUTOREFUND ? 1 : 0,
              }
              if(gift_method == '2'){
                if(!item.PRODUCTBUYPRICE && !item.PRODUCTBUYUNIT){
                  flag = false;
                  this.$Message.warning('赠送商品必须有满足金额或者满足件数！')
                  throw new Error
                }else {
                  obj.PRODUCTBUYPRICE = item.PRODUCTBUYPRICE
                  obj.PRODUCTBUYUNIT = item.PRODUCTBUYUNIT
                }
              }else if(gift_method == '3'){
                if(!item.STARTSECTION && !item.ENDSECTION && !item.APPOINTRANGE){
                  flag = false;
                  this.$Message.warning('排名区间和指定排名两项至少要填写一项！')
                  throw new Error
                }else if((!item.STARTSECTION && item.ENDSECTION)||(item.STARTSECTION && !item.ENDSECTION)){
                  flag = false;
                  this.$Message.warning('起始排名和结束排名必须保持一致,要么都填要么都不填！')
                  throw new Error
                }else if(parseInt(item.STARTSECTION) > parseInt(item.ENDSECTION)){
                  flag = false;
                  this.$Message.warning('起始排名不能大于结束排名！')
                  throw new Error
                }else {
                  var regx3 = /^[0-9,]+$/;
                  if (item.APPOINTRANGE && !regx3.test(item.APPOINTRANGE)){
                    flag = false;
                    this.$Message.warning('指定排名数据格式错误,只能输入数字（正整数）和逗号！')
                    throw new Error
                  }else {
                    obj.STARTSECTION = item.STARTSECTION
                    obj.ENDSECTION = item.ENDSECTION
                    obj.APPOINTRANGE = item.APPOINTRANGE
                  }
                }
              }else if(gift_method == '5'){
                if(!item.NORMSTYPE){
                  flag = false;
                  this.$Message.warning('参与活动规格类型不能为空！')
                  throw new Error
                }else if(!item.NORMSVALUES) {
                  flag = false;
                  this.$Message.warning('参与活动规格值不能为空！')
                  throw new Error
                }else {
                  obj.NORMSTYPE = item.NORMSTYPE;
                  obj.NORMSVALUES = item.NORMSVALUES;
                }
              }else if(gift_method === '8') {
                if(!item.PRODUCTBUYPRICE) {
                  flag = false;
                  this.$Message.warning('阶梯金额不能为空！');
                  throw new Error
                } else {
                  obj.PRODUCTBUYPRICE = item.PRODUCTBUYPRICE
                }
              } else if(gift_method === '9') {
                if(!item.PRODUCTBUYUNIT) {
                  flag = false;
                  this.$Message.warning('阶梯数量不能为空！');
                  throw new Error
                } else {
                  obj.PRODUCTBUYUNIT = item.PRODUCTBUYUNIT
                }
              }
              if(buyerMsg.list.find(item=>item.SKEY=='activity_grouping').VALUE){
                obj.ORDERBY = item.ORDERBY
              }
              // else {
              //   obj.ORDERBY = index + 1
              // }
              T_OMSActiveSku.push(obj)
            })
          }catch {}
          // 指定商品or排除商品
          let T_OMSACTIVEJOINGOODS = []
          if(buyerMsg.list.find(item=>item.SKEY=='activegoodstype').VALUE == 1){
            this.JoinData.forEach(item => {
              let obj = {
                  "GOODSTYPE": item.GoodsType,
                  "GOODSCODE": item.GOODCODE,
                  "TITLE": item.TITLE,
                  "OMSACTIVEID": this.pageMsgId,
              }
              T_OMSACTIVEJOINGOODS.push(obj)
            })
          }else if(buyerMsg.list.find(item=>item.SKEY=='activegoodstype').VALUE == 2) {
            this.ExcludeData.forEach(item => {
              let obj = {
                "GOODSTYPE": item.GoodsType,
                "GOODSCODE": item.GOODCODE,
                "TITLE": item.TITLE,
                "OMSACTIVEID":this.pageMsgId,
              }
              T_OMSACTIVEJOINGOODS.push(obj)
            })
          }


          let params = { // 保存接口参数
            OMSACTIVEID: this.pageMsgId,
            T_OMSActiveSku,
            T_V_OMSACTIVE,
            T_OMSACTIVEAREA: this.sendAreaList || [],

          }
          if(buyerMsg.list.find(item=>item.SKEY=='activegoodstype').VALUE == 1 || buyerMsg.list.find(item=>item.SKEY=='activegoodstype').VALUE == 2) {
            params.T_OMSACTIVEJOINGOODS = T_OMSACTIVEJOINGOODS;
          }
          if(flag){
            this.saveSubmit(params)
          }
        },
        saveSubmit(params) {
          network.post('/p/cs/updateOmsActive',params).then(res => {
            if(res.data.Code == '0'){
              this.closePage();
              this.returnColumns = [ //赠送商品
                  {
                    type: 'selection',
                    width: 60,
                    align: 'center'
                  },
                  {
                    type: 'index',
                    align: 'center',
                    title: '序号',
                  },
                  {
                    title: '商品名称',
                    align: 'center',
                    key: 'TITLE'
                  },
                  {
                    title: '商品SKU',
                    align: 'center',
                    key: 'SKU'
                  },
                  // 新增字段
                  {
                    title: '赠送件数',
                    align: 'center',
                    key: 'NUM',
                    render: (h, params) => {
                      let this_=this
                      return h(
                        'Input',
                        {
                          style: {
                            width:'66px'
                          },
                          props: {
                            value: params.row.NUM,
                            number: true
                          },
                          on: {
                            'on-blur': (event) => {
                              let chengeData=this.currentReturnData[params.index]
                              // this.returnData[params.index].NUM = event.target.value
                              // this.returnData.forEach((item)=>{
                              //     if((item.SKU==chengeData.SKU)){
                              //       item.NUM = event.target.value
                              //     }
                              // })
                              const value = event.target.value
                              const index = ((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index
                              this.returnData[index].NUM = value;
                              this.totalReturn=this.returnData.length;
                              let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                              let endIndex=startIndex+this.pageSizeReturn
                              this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                            }
                          }
                        },
                      );
                    },
                  },
                  {
                    title: '总共要送的件数',
                    align: 'center',
                    key: 'ALLNUM',
                    render: (h, params) => {
                      let this_=this
                      return h(
                        'Input',
                        {
                          style: {
                            width:'66px'
                          },
                          props: {
                            value: params.row.ALLNUM
                          },
                          on: {
                            'on-blur': (event) => {
                                let chengeData=this.currentReturnData[params.index]
                                // event.target.value=this.parser(event.target.value)
                                // this.returnData[params.index].ALLNUM = this.parser(event.target.value);
                                // this.returnData.forEach((item)=>{
                                //   if((item.SKU==chengeData.SKU)){
                                //     item.ALLNUM = event.target.value
                                //   }
                                // })
                                const value = event.target.value
                                const index = ((this.returnCurrentPage - 1) * this.pageSizeReturn)+params.index
                                this.returnData[index].ALLNUM = value;
                                this.totalReturn=this.returnData.length;
                                let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                                let endIndex=startIndex+this.pageSizeReturn
                                this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                            }
                          }
                        },
                      );
                    },
                  },
                  {
                    title: '已赠送数量',
                    align: 'center',
                    key: 'CURNUM',
                  },
              ]
              this.getOMSACTIVE(); // 获取活动主表信息
              this.getOMSActiveSku(); // 获取活动赠送商品表
              this.getOMSACTIVEJOINGOODS(); // 获取活动参与（排除）商品表
              this.$Message.success('修改活动成功！');
              // this.closePage();
            }else {
              this.$Modal.fcError({
                title: '提示',
                mask:true,
                content: res.data.Message
              })
            }
          })
        },

        // 选择入库单弹框中的筛选下拉框数据start
      // 单选下拉分页改变
      changePageShop(e,type) {
        if(type == 'SKUID'){
          this.SystemSKUcurrentIndex = (e - 1) * 10;
          this.searchShopData('SKUID');
        }else if(type == 'shopID') {
          this.shopIDcurrentIndex = (e - 1) * 10;
          this.searchShopData('shopID');
        }
      },
      // 外键下拉框1234
      searchShopData(type) {
        if(type == 'SKUID'){
          let virtual = {
            searchdata: {
              isdroplistsearch: true,
              refcolid: 198192,
              startindex: this.SystemSKUcurrentIndex,
              range: 10,
            }
          }
          network.post('/p/cs/QueryList', urlSearchParams(virtual)).then((res) => {
            if (res.data.code == 0) {
              this.SystemSKUtotalRowCount = res.data.data.totalRowCount;
              this.SystemSKUList = res.data.data;
              this.SystemSKUcurrentIndex = 0;
            }
          });
        }else if(type == 'shopID'){
          let virtual = {
            searchdata: {
              isdroplistsearch: true,
              refcolid: 198185,
              startindex: this.shopIDcurrentIndex,
              range: 10,
            }
          }
          network.post('/p/cs/QueryList', urlSearchParams(virtual)).then((res) => {
            if (res.data.code == 0) {
              this.shopIDtotalRowCount = res.data.data.totalRowCount;
              this.shopIDList = res.data.data;
              this.shopIDcurrentIndex = 0;
            }
          });
        }
      },
      // 单选下拉模糊搜索数据
      InputValueChangeShop(e,type) {
        if(type == 'SKUID'){
          let virtual = {
            ak: e,
            colid: 198192,
            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);
              });
              this.SystemSKUAutoData = list;
            }
          });
        }else if(type == 'shopID'){
          let virtual = {
            ak: e,
            colid: 198185,
            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);
              });
              this.shopIDAutoData = list;
            }
          });
        }
      },
      // 外键下拉框搜索
      focusInputValueChangeShop(e,type) {
        if(type == 'SKUID'){
          let virtual = {
            ak: e.target.value,
            colid: 198192,
            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);
              });
              this.SystemSKUAutoData = list;
            }
          });
        }else if(type == 'shopID'){
          let virtual = {
            ak: e.target.value,
            colid: 198185,
            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);
              });
              this.shopIDAutoData = list;
            }
          });
        }
      },
      // 单选下拉选中
      checkDataShop(val,type) {
        if(type == 'SKUID'){
          let list = [];
          list.push(val[0]);
          this.selectPlatformGoodsData.SKUID = list[0].ID;
        }else if(type == 'shopID'){
          let list = [];
          list.push(val[0]);
          this.selectPlatformGoodsData.SHOPID = list[0].ID;
        }
      },
      clearDataShop(type) {
        if(type == 'SKUID'){
          this.selectPlatformGoodsData.SKUID = '';
        }else if(type == 'shopID'){
          this.selectPlatformGoodsData.SHOPID = '';
        }
      },

      // 获取日志明细
      getOMSActiveLogs() {
          let virtual = {
            fixedcolumns: {ACTIVEID: [`=${this.pageMsgId}`]},
            isdroplistsearch: false,
            range: this.pageSizeLogs,
            startindex: (this.LogsCurrentPage - 1) * this.pageSizeLogs,
            table: 'T_OMSACTIVELOG',
          };
          network.post('/p/cs/list/query', virtual).then((res) => {
            let rows = [];
            res.data.rows.forEach((item) => {
              let itemOne = {};
              Object.keys(item).forEach(key => {
                itemOne[key] = item[key].val;
              })
              rows.push(itemOne)
            })
            this.totalLogs=res.data.total
            this.logsData = rows // [...this.logsData,...rows]
            // 截取数组
            // let startIndex=this.pageSizeLogs*(this.LogsCurrentPage-1)
            // let endIndex=startIndex+this.pageSizeLogs
            this.currentLogsData=this.logsData;// .slice(startIndex,endIndex) //当前页面显示明细
          })
      },

      // 日志页码改变时触发
      changePageLogs(val){
        // 1=>0 2=>10 3=>20
        this.LogsCurrentPage=val
        this.getOMSActiveLogs();
      },
      // 日志页数改变时触发
      changeSizeLogs(val){
        this.pageSizeLogs = val;
        this.LogsCurrentPage=1;
        this.getOMSActiveLogs();
      },
    }
  };
</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: 120px;
      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;
    }
}

.onlyReturnMoneyOrder .ark-upload-drag {
  border: none;
}
.onlyReturnMoneyOrder .ark-select-multiple .ark-select-item.ark-select-item-all {
display: none;
}

</style>
<style lang="less" scoped>
  // .onlyReturnMoneyOrder {
  //  min-width: 1320px;
  // }
 .pageContent {
    height: 30px;
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
  }
  .order-setting-input-error:before{
    content: '*';
    color: red;
    // position: absolute;
    // left: 8px;
  }
  .conditionContent,.conditionContentOne {
    width: 100%;
    display: flex;
    max-height: 3000px;
    overflow: hidden;
    flex-wrap: wrap;
    padding-top: 8px;
    // padding-right: 51px;
    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;
        justify-content: space-between;
        padding: 0 14px;
        .handleItem{
          width: 48px;
          height: 16px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #1D73FF;
          line-height: 16px;
          margin: 0 2px;
          cursor: pointer;
        }
      .operate-wrap-left,
      .operate-wrap-right {
        display: flex;
      }
    }
    .handleBtnSearch{
      height: 40px;
      background-color: #eee;
      position: relative;
      padding-top: 8px;
      .searchList {
          position: absolute;
          right: 8px;
        }
    }
  }
  .content /deep/ .ark-select-input[disabled]{
      color: #575757;
  }
</style>
