<template>
  <div class="edit-return-order">
    <div class="quickOperation" data-key="EDITOR_RETURN">
      快捷操作：
      <div  v-if="showSaveBtn">
          <Button
          type="fcdefault"
          style="margin-right:8px"
          v-if="canVerify && showBatchAudit"
          :data-can='`canVerify:${canVerify}-showBatchAudit:${showBatchAudit}`'
          @click="toVerify"
        >
          审核
        </Button>
        <Button
          type="fcdefault"
          style="margin-right:8px"
          v-if="canAfterSaleVerify && showAudioPowerOne"
          @click="toAfterSaleVerify"
        >
          售后审核
        </Button>
        <Button
          type="fcdefault"
          style="margin-right:8px"
          v-if="canAfterSaleVerify && showAudioPower && saveArr.REFUNDTYPE==1"
          @click="toAfterSaleVerify('noAg')"
        >
          售后审核(无AG)
        </Button>
        <Button
          type="fcdefault"
          v-if="IS_ABNORMALPACKAGE==1 && (queryVirstatus==10 || queryVirstatus==20)"
          style="margin-right:8px"
          @click="toManualMatch"
        >
        <!-- v-if="IS_ABNORMALPACKAGE==1 && queryVirstatus!=10 && queryVirstatus!=20" -->
          三无包裹匹配
        </Button>
        <Button
          :class="{'saveBtn':hideBtn}"
          type="fcdefault"
          style="margin-right:8px"
          @click="saveAll"
        >
          保存
        </Button>
        <Button
          type="fcdefault"
          v-if='(ISUPDATEPLTLOGISTINFO == 1&& originLOGISTICSCOMPANYID && originSID)'
          style="margin-right:8px"
          @click="refillLogist"
        >
        物流上传至平台
        </Button>
        <Button
          type="fcdefault"
          v-if="(returnToOnlyReturnMoneyPower && saveArr.REFUNDTYPE==1&&((queryVirstatus=='1')||(queryVirstatus=='10')||(queryVirstatus=='20')))"
          style="margin-right:8px"
          @click="returnToOnlyReturnMoney"
        >
        <!-- :disabled="!(saveArr.REFUNDTYPE==1&&((queryVirstatus=='1')||(queryVirstatus=='10')||(queryVirstatus=='20')))" -->
        退货转仅退款
        </Button>
        
        <Button
          type="fcdefault"
          v-if="returnToExchangePower && (saveArr.REFUNDTYPE==1)&&(saveArr.ORDERFROM=='手工新增') && queryVirstatus!='60' "
          style="margin-right:8px"
          @click="returnToExchange"
        >
        退货转换货
        </Button>
      </div>
      <Button type="fcdefault"
      @click="closePage"
      >
        返回
      </Button>
    </div>
    <div class="content">
      <div
        v-for="(item,tabId) in tabList"
        :key="tabId"
        v-if='item.blockShowOne'
        class="block"
      >
        <foldPanel
          v-model="item.blockShow"
          :title="item.tabtext"
        >
          <div
            slot="content"
            class="block"
          >
            <div class="item">
              <Row>
              <div
                v-for="(i,cindex) in tabList[tabId].list"
                :key="cindex"
                class="form"
                v-if="i.showTag"
              >
                <Col :span="type=='list'?8:6" v-if="i.standard" style="height:16px" > 
                  <!-- :span="type=='list'?8:6" -->
                    <div
                      v-if="i.title"
                      :class="{'title':true,'returnLongText':(i.SKEY=='return_logistics_num' && type!='list'),'nickTitle':(i.SKEY=='buyer_nickname' && type!='list'),'order-setting-input-error':(i.SKEY=='original_order_number'&&i.VALUE&&i.required) || (i.SKEY!='original_order_number'&&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>
                    <div v-if="i.SKEY=='exchange_postage'">
                      <InputNumber :disabled="i.disabled" v-model="i.VALUE"></InputNumber>
                      元
                    </div>

                  <Checkbox v-model="i.VALUE" :disabled="i.disabled" v-if="(i.SKEY=='exchange_reserved_stock')||(i.SKEY=='is_refund_to_store')" @on-change="changeWarehouse($event,i)"></Checkbox>
                  <Select v-model="i.VALUE" :filterable="(i.SKEY !== 'buyer_province' && i.SKEY !=='buyer_city' && i.SKEY !== 'buyer_area' && i.SKEY !== 'refund_pay_type' && i.SKEY!=='refund_delivery_type' && (i.SKEY=='return_warehouse' && !i.VALUE))?true:false" clearable :disabled="i.disabled" class="input_box" v-else-if="(i.SKEY=='reason_refund')||(i.SKEY=='buyer_province')||(i.SKEY=='buyer_city')||(i.SKEY=='buyer_area')
                    ||(i.SKEY=='shop_name')
                    ||(i.SKEY=='return_logistics_company')
                    ||(i.SKEY=='return_warehouse')
                    ||(i.SKEY=='refund_delivery_type')
                    ||(i.SKEY=='refund_pay_type')"
                    @on-change="checkInput(i)"
                    @on-query-change="checkInputSKU($event,i)"
                    @on-clear='clearInput(i)'>
                      <Option v-for="d in i.optionList" :value="d.value" :key="d.value">{{ d.label }}</Option>
                  </Select>
                  <Input
                    v-else-if="
                    (i.SKEY=='buyer_nickname')
                    ||(i.SKEY=='original_platform_number')
                    ||(i.SKEY=='system_order')
                    ||(i.SKEY=='refund_status')
                    ||(i.SKEY=='match_status')
                    ||(i.SKEY=='return_logistics_num')
                    ||(i.SKEY=='consignee_zip_code')
                    ||(i.SKEY=='buyer_town')
                    ||(i.SKEY=='consignee_people')
                    ||(i.SKEY=='consignee_mobile')
                    ||(i.SKEY=='consignee_phone')
                    ||(i.SKEY=='original_order_number')
                    ||(i.SKEY=='id_number')
                    ||(i.SKEY=='omsstoragein_id')
                    ||(i.SKEY=='refund_type')
                    ||(i.SKEY=='platform_refund_number')
                    ||(i.SKEY=='platform_exchange_number')
                    ||(i.SKEY=='responsibility_person')
                    ||(i.SKEY=='process_store_title')
                    ||(i.SKEY=='process_storeId')
                    ||(i.SKEY=='tmall_mcard_pz_sp')
                    ||(i.SKEY=='platform_vip_code')
                    ||(i.SKEY=='BUYER_OPEN_UID')
                    ||(i.SKEY=='ALLHOSTNAME')
                    ||(i.SKEY=='ALLHOSTNO')
                    "
                    class="input_box"
                    :id='i.SKEY=="consignee_people"?"consigneePeople":""'
                    v-model.trim="i.VALUE"
                    :placeholder="i.placeholder"
                    :disabled="i.disabled"
                    @on-blur="checkInput(i)"
                    @on-keydown="enterOk($event, i)"
                    @on-keypress='noSpaces($event,i)'
                    @paste.native='onPasteInput($event,i)'
                  />
                  <img v-if="i.expressImg&&i.VALUE" src="../../assets/orderEditorImg/moreExpress.png" style="height:18px;" @click="toExpressQuery(i)">
                  <img
                      v-if="i.search"
                      style="width:16px;margin-left:8px"
                      src="../../assets/icon/search.png"
                      @click="searchMsg(i)"
                      >
                  <span v-if="i.SKEY=='buyer_nickname'" > 
                    <!-- style="margin-left: 10px;" -->
                    <!-- v-if='PLATFORM==2 && BUYER_OPEN_UID' -->
                    <span ref='wangwang' v-if='PLATFORM==2 && BUYER_OPEN_UID' v-html='wangwangHtml'></span>
                    <span v-else-if='PLATFORM==2 && i.VALUE && i.VALUE.indexOf("*") < 0 && !BUYER_OPEN_UID'>
                      <a target="_blank" :href="'aliim:sendmsg?&touid=cntaobao'+i.VALUE+'&siteid=cntaobao&status=2&portalId=&gid=&itemsId=&scene=&toRole=&source=light&client=false&encryptuid=&bizdomain=taobao&openappkey=12585822&openuid=&sceneparam=%7B%22toRole%22:%22buyer%22%EF%BC%8C%22bizRef%22:%20%22%22%7D'" ><img class='wangwangIcon' border="0" src="../../assets/image/wangwanglink.gif" alt="有事点这里和我交流或留言！" /></a>
                    </span>
                  </span>
                  

                </Col>
                <Col span="24" v-else-if="i.all" :class="i.required?'order-setting-input-error':null">
                  <div class="refund-content" v-if="i.SKEY=='refund_amount'">
                    <div
                      class="count-part"
                      style="display:flex;"
                    >
                      <div class="item">
                        <div class="text">
                          商品应退总金额

                          <Tooltip
                            max-width="200"
                            content="新增时根据商品的申请数量来计算,入库后根据入库数量计算.公式:商品单价*申请(入库)数量+调整金额"
                            placement="bottom"
                          >
                            <img
                              class="img-framelanflag"
                              src="../../assets/icon/help.png"
                            >
                          </Tooltip>
                        </div>
                        <Input
                          v-model="refundableAmount"
                          class="input-money"
                          disabled
                        />
                        <div class="text">
                          元
                        </div>
                        <div class="plus">
                          +
                        </div>
                      </div>
                      <div class="item">
                        <div class="text">
                          应退邮费
                          <Tooltip
                            max-width="200"
                            content="由卖家原因导致需要退运费给买家的。"
                            placement="bottom"
                          >
                            <img
                              class="img-framelanflag"
                              placeholder="请输入"
                              src="../../assets/icon/help.png"
                            >
                          </Tooltip>
                        </div>
                        <Input
                          v-model="refundablePostage"
                          class="input-money"
                          :disabled="allDisabled"
                          @on-blur="checkMoney('refundablePostage')"
                          @on-keyup="($event)=> commonKeyupHandle({$event, calcType: 'refundablePostage'})"
                        />
                        <div class="text">
                          元
                        </div>
                        <!-- <div class="plus">
                          +
                        </div>
                      </div -->
                      <!-- <div class="item">
                        <div class="text">
                          其他金额
                          <Tooltip
                            max-width="200"
                            content="补偿给客户的金额，勿用于其他用途。"
                            placement="bottom"
                          >
                            <img
                              class="img-framelanflag"
                              placeholder="请输入"
                              src="../../assets/icon/help.png"
                            >
                          </Tooltip>
                        </div>
                        <Input
                          v-model="otherAmount"
                          class="input-money"
                          @on-blur="checkMoney('otherAmount')"
                          :disabled="allDisabled"
                        />
                        <div class="text">
                          元
                        </div>-->
                        <div class="plus">
                          -
                        </div>
                      </div>
                      <div class="item">
                        <div class="text">
                          换货金额
                          <Tooltip
                            max-width="200"
                            content="计算公式：换货商品数量*单价+调整金额。请确保金额正确，否则影响新生成换货单的金额。"
                            placement="bottom"
                          >
                            <img
                              class="img-framelanflag"
                              placeholder="请输入"
                              src="../../assets/icon/help.png"
                            >
                          </Tooltip>
                        </div>
                        <Input
                          v-model="exchangeAmount"
                          class="input-money"
                          disabled
                        />
                        <div class="text">
                          元
                        </div>
                      </div>
                    </div>
                    <div class="total-part">
                      退货单总金额
                      <span
                        style="font-size: 24px;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;color: #FD8B2E;"
                      >￥{{ total }}</span>
                    </div>
                  </div>
                </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>
                  <!-- <Tooltip
                    max-width="1000px"
                    style='width:calc(100% - 100px)'
                    :content="i.VALUE"
                    placement="bottom"
                  > -->
                  <!-- :title='i.VALUE' -->
                    <Input
                    style="max-width: 1000px;"
                    :rows="2"
                    :disabled="i.disabled"
                    :title='i.VALUE'
                    v-model="i.VALUE"
                    type="textarea"
                    v-if="(i.SKEY=='refund_reasons')||(i.SKEY=='refund_instructions')||(i.SKEY=='system_remarks')||(i.SKEY=='buyer_message')"
                    :placeholder="i.placeholder" />
                  <!-- </Tooltip> -->
                </Col>
                <Col span="12" v-else >
                    <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>
                  <!-- <Checkbox v-model="i.VALUE" v-if="i.SKEY=='is_refund_to_store'"></Checkbox> -->
                  <Input class="textPart" style="width:620px; min-height:36px"
                    :autosize='{minRows:2,maxRows: 5}'
                    v-model="i.VALUE"
                    :disabled="i.disabled"
                    type="textarea"
                    v-if="(i.SKEY=='consignee_address')"
                    placeholder="请输入内容" />
                </Col>
              </div>
              </Row>
            </div>
            <Form
                v-if='item.tabtext === "收货人信息"'
                class="form"
                :model="formValidate"
                label-position="top"
                style="padding-left: 20px"
              >
                <FormItem label="智能识别">
                  <Input
                    v-model="formValidate.desc"
                    class="text1"
                    type="textarea"
                    placeholder="粘贴地址信息后回车,自动识别姓名、电话和地址"
                    @on-keydown="searchsmart"
                  />
                </FormItem>
              </Form>
          </div>
        </foldpanel>
      </div>


    </div>
    <div class="tableArea">
      <Tabs type="card" v-model="nowTabTable">
        <TabPane label="退回商品" name='returnGoods'>
            <Row style="display: flex;
                justify-content: space-around;
                align-items: center;
                height: 48px;
                margin-bottom: 16px;
                background: #F8F8F8;"  v-if="!(queryVirstatus=='30'||queryVirstatus=='50'||queryVirstatus=='60'||returnToExchangeHandle)">
              <Col span="8">
              <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="addEnterReturnGoods"
                  filterable
                  clearable
                >
                  <Option v-for="(option,index) in SKUArrReturn" :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="8" >
              <div style="display: flex;align-items: center;">
                <label style="width: 30px;">数量</label>
                <InputNumber style="width:240px" :min="1" v-model="returnGoodsNum"  @on-enter="addReturnGoods"></InputNumber>
              </div>
              </Col>
              <Col span="2"  v-if="showSaveBtn">
              <Button type="primary" icon="md-return-left" @click="addReturnGoods">添加</Button>
              </Col>
            </Row>
            <div class="handleBtn"  v-if="showSaveBtn">
              <div class="handleItem" @click="deleteReturnGoods"   v-if="!(queryVirstatus=='30'||queryVirstatus=='50'||queryVirstatus=='60'||returnToExchangeHandle)">【删除】</div>
            </div>
            <div class='returnGoodsTableBox' data-key="RETURN_GOODS">
              <div class='returnGoodsTableOne' refs='returnGoodsTableOne' :style='tableStyleOne'>
                <Table height="300"
                  :columns="returnColumns"
                  :data="currentReturnData"
                  highlight-row
                  :index='defaultIndex'
                  @on-row-click='returnDataClick'
                  @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
                    :page-size-opts="pageSizeOpts"
                    :total="totalReturn"
                    show-total
                    show-sizer
                    @on-change="changePageReturn"
                    @on-page-size-change="changeSizeReturn"
                  />
                </div>
              </div>
               <div class='fold-btn' @click="foldTable">
                <Icon type="md-arrow-dropright" v-show='!isFold'/>
                <Icon type="md-arrow-dropleft" v-show='isFold'/>
              </div>
               <div class='returnGoodsTableOne' refs='returnGoodsTableTwo' :style='tableStyleTwo'>
                <Table height="300"
                  :columns="batchOrQrcodeColumns"
                  :data="batchOrQrcodeData"
                ></Table>
                <div class="pageContent">
                  <Page
                    size="small"
                    :current="batchOrQrcodeCurrentPage"
                    show-elevator
                    :page-size-opts="pageSizeOpts"
                    :total="totalBatchOrQrcode"
                    show-total
                    show-sizer
                    @on-change="changePageBatchOrQrcode"
                    @on-page-size-change="changeSizeBatchOrQrcode"
                  />
                </div>
               </div>
            </div>
        </TabPane>
        <TabPane label="未发已退商品" name='undeliveredAndReturnGoods' v-if='this.undeliveredAndReturnedData.length > 0'>
          <div class="handleBtn" style="margin-top:16px"></div>
           <Table height="300"
            :columns="undeliveredAndReturnedColumns"
            :data="undeliveredAndReturnedData"
           ></Table>
           <div class="pageContent">
              <Page
                size="small"
                :current="undeliveredAndReturnedCurrentPage"
                show-elevator
                :page-size-opts="pageSizeOpts"
                :total="totalUndeliveredAndReturned"
                show-total
                show-sizer
                @on-change="changePageUndeliveredAndReturned"
                @on-page-size-change="changeSizeUndeliveredAndReturned"
              />
            </div>
        </TabPane>
        <TabPane label="换货商品" name='exchangeGoods' v-if="saveArr.REFUNDTYPE=='2' && ISHAVEundeliveredAndReturned">
            <Row style="display: flex;
                justify-content: space-around;
                align-items: center;
                height: 48px;
                margin-bottom: 16px;
                background: #F8F8F8;"  v-if="!(queryVirstatus=='30'||queryVirstatus=='50'||queryVirstatus=='60') || (queryVirstatus=='30' && ISTOWMS=='1') || (returnToExchangeHandle)">
              <Col span="8">
              <div style="display: flex;align-items: center;">
                <label style="width: 30px;">SKU</label>
                <Select
                  ref="exchangeSelect"
                  v-model="selectSKUID"
                  style="width:240px"
                  @on-query-change="getSkuList"
                  @on-change="selectSkuGoods"
                  @on-enter="addEnterGoods"
                  filterable
                  clearable
                >
                <!-- v-model="selectSKUID" -->
                  <Option v-for="(option,index) in SKUArr" :key="index" :value="option.value">{{option.label}}</Option>
                </Select>
                  <img
                      style="width:16px;margin-left:8px"
                      src="../../assets/icon/search.png"
                      @click="searchGoods('exchange')"
                      >
              </div>
              </Col>
              <Col span="8" >
              <div style="display: flex;align-items: center;">
                <label style="width: 30px;">数量</label>
                <InputNumber style="width:240px" :min="1" v-model="exchangeGoodsNum"  @on-enter="addGoods"></InputNumber>
              </div>
              </Col>
              <Col span="2"  v-if="showSaveBtn">
                <Button type="primary" icon="md-return-left" @click="addGoods" >添加</Button>
              </Col>
            </Row>
            <div class="handleBtn" v-if="showSaveBtn">
              <div class="handleItem" @click="deleteExchangeGoods"  v-if="!(queryVirstatus=='30'||queryVirstatus=='50'||queryVirstatus=='60') || (queryVirstatus=='30' && ISTOWMS=='1') || (returnToExchangeHandle)">【删除】</div>
            </div>
           <Table height="300"
            :columns="exchangeColumns"
            :data="currentExchangeData"
            @on-select="selectExchangeData"
            @on-select-cancel="selectExchangeCancel"
            @on-select-all="selectExchangeDataAll"
            @on-select-all-cancel="selectExchangeDataCancel"
           >
           </Table>
            <div class="pageContent">
              <Page
                size="small"
                :current="exchangeCurrentPage"
                show-elevator
                :page-size-opts="pageSizeOpts"
                :total="totalExchange"
                show-total
                show-sizer
                @on-change="changePageExchange"
                @on-page-size-change="changeSizeExchange"
              />
            </div>
        </TabPane>
        <TabPane label="退换货日志" name='returnAndexchangeLog' v-if='ISHAVEundeliveredAndReturned'>
            <div class="handleBtn" style="margin-top:16px">
              <!-- <div class="handleItem" @click="deletejournalGoods">【删除】</div> -->
            </div>
           <Table height="300"
            :columns="journalColumns"
            :data="journalData"
            @on-select="selectJournalData"
            @on-select-cancel="selectJournalCancel"
            @on-select-all="selectJournalDataAll"
            @on-select-all-cancel="selectJournalDataCancel"
           ></Table>
           <div class="pageContent">
              <Page
                size="small"
                :current="JournalCurrentPage"
                show-elevator
                :total="totalJournal"
                show-total
                show-sizer
                @on-change="changePageJournal"
                @on-page-size-change="changeSizeJournal"
              />
            </div>
        </TabPane>
      </Tabs>
    </div>
    <Modal
      v-model="originalModal"
      title="选择原订单编号"
      width="900"
      :mask="mask"
      :closable="closable"
      :mask-closable="maskClosable"
      :footer-hide="hideFoot"
      @on-cancel="cancel">
         <div class="conditionContent">
          <div class="itemContent">
            <div class="itemLabel">
              订单编号
            </div>
            <Input
              v-model="originalOrderData.ID"
              clearable
            ></Input>
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              平台单号
            </div>
            <Input
              v-model="originalOrderData.TID"
              clearable
            ></Input>
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              物流单号
            </div>
            <Input
              v-model="originalOrderData.LOGISTICSNUMBER"
              clearable
            ></Input>
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              所有SKU
            </div>
            <Input
              v-model="originalOrderData.ALLSKU"
              clearable
            ></Input>
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              收件人手机号码
            </div>
            <Input
              v-model="originalOrderData.RECEIVMOBILE"
              clearable
            />
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              收件人
            </div>
            <Input
              v-model="originalOrderData.RECEIVNAME"
              clearable
            />
          </div>

          <div class="itemContent">
            <div class="itemLabel">
              买家昵称
            </div>
            <Input
              style="width:240px"
              v-model="originalOrderData.USERNICK"
              clearable
            />
          </div>
        </div>
        <ShrinkOrExtend
          :form-data="originalOrderData"
          :height="shrinkHeight"
          :current-value="currentValue"
          @click="upOrDown(shrinkHeight)"
          @on-reset="reset"
          @on-query="queryBtn(nowTab)"
        />
        <Tabs type="card" v-model="nowTab" @on-click="clickTab">
          <TabPane label="全部发货" name="all">
              <tableFaker
                ref="getAllDeliver"
                :tableHeight="tableHeight"
                :table-head="deliverColumns"
                :table-name="'T_V_OMSONLINEORDER'"
                :fixedcolumns="allFix"
                :highlightRow="highlightRow"
                @on-selectData="selectOneData"
              />
            </TabPane>
            <TabPane label="仓库发货" name="warehouse">
              <tableFaker
                ref="getWarehouseDeliver"
                :tableHeight="tableHeight"
                :table-head="deliverColumns"
                :table-name="'T_V_OMSONLINEORDER'"
                :fixedcolumns="warehouseFix"
                :highlightRow="highlightRow"
                @on-selectData="selectOneData"
              />
            </TabPane>
            <TabPane label="平台发货" name="platform">
              <tableFaker
                ref="getPlatformDeliver"
                :tableHeight="tableHeight"
                :table-head="deliverColumns"
                :table-name="'T_V_OMSONLINEORDER'"
                :fixedcolumns="platformFix"
                :highlightRow="highlightRow"
                @on-selectData="selectOneData"
              />
            </TabPane>
        </Tabs>


      <footer style="display: flex; justify-content: center; margin-top: 12px;padding-top: 16px;border-top: 1px solid #DEDEDE;;">
        <Button
          type="fcdefault"
          @click="cancel"
        >
          取消
        </Button>
        <Button
          type="posdefault"
          style="margin-left: 16px"
          @click="okSelectId"
        >
          确认
        </Button>
      </footer>
    </Modal>
     <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 class="itemContent">
            <div class="itemLabel">
              销售价
            </div>
            <Input
              v-model="selectGoodsData.SELLPRICE"
              clearable
            />
          </div>
          <div class="itemContent">
            <div class="itemLabel">
              成本价
            </div>
            <Input
              v-model="selectGoodsData.BASEPRICE"
              clearable
            />
          </div> -->

        </div>
        <ShrinkOrExtend
          :form-data="originalOrderData"
          :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="jumpNewOrder"
        title="提示"
        :mask="mask"
        :footer-hide="hideFoot"
        :showCancel="showCancel">
        操作成功，已作废原单，正在前往新单
    </Modal>
    <Spin fix v-if="spinShow">
      <Icon type="ios-loading" size=18 style="animation: ani-demo-spin 1s linear infinite"></Icon>
      <div>加载中...</div>
    </Spin>
  </div>
</template>
<script>
  import foldPanel from '../customizedContent/FoldPanel.vue'; // 折叠面板组件
  import ShrinkOrExtend from '../customizedContent/shrinkOrExtend' //收缩伸展搜索条件组件
  import tableFaker from '../customizedContent/tableFaker.vue'; //表格组件

  // import AddressParse from 'address-parse';
  import AddressParse from '../../../static/@address-parse/dist/parse/index';

  // import R3 from '../../../static/r3/r3.publish/r3.min';
  const R3 = window.R3;
  const { network, urlSearchParams, store } = R3;

  export default {
    props: {
      type: { // 活动明细
          type: String,
          default: ''
      },
      OrderIdFromList: { // 活动明细id
          type: String,
          default: ''
      },
    },
    data() {
      return {
        nowTabTable: 'returnGoods', // 默认展示退回商品tab
        pageSizeOpts: [10, 50, 100, 500], // 数据权限弹窗更改每页多少条
        jumpNewOrder:false,//跳转新单提示框
        showCancel:false,
        ISHAVEundliveredAndReturned: false,
        hideBtn:false,//隐藏保存按钮
        allDisabled:false,//完成和取消状态退款金额也不能修改
        queryVirstatus:'',//查询到的状态

        canVerify: false,//是否有审核按钮
        canAfterSaleVerify:false,//是否有售后审核按钮
        spinShow:true, //开启加载模式

        formValidate: { // 智能识别
          desc: '',
        },
        saveArr:{
          REFUNDTOSTORE:0, //是否拒收
          REFUNDTYPE:'2',//单据类型
          ORIGINALORDERNO:'',//原订单编号
          OMSREASONTYPEID:'',//退换货原因
          REMARK:'',//备注
          LOGISTICSCOMPANYID:'',//退回物流公司ID
          COMPANY_NAME:'',//退回物流公司名称
          IESWAREHOUSEID:'',//退货仓库ID
          RECEIVPROVINCE:'',//省id
          RECEIVPROVINCENAME:'',//省
          RECEIVCITY:'', //市id
          RECEIVCITYNAME:'',//市
          RECEIVAREA:'', //区id
          RECEIVAREANAME:'',//区
          RECEIVADDRESS:'',//换货/收货人地址
          RECEIVNAME:'', //换货/收货人
          RECEIVMOBILE:'', //换货/收货人手机
          RECEIVPHONE:'', //换货/收货人电话
          RECEIVTOWN: '', 
          RECEIVZIP: '',


          VIRSTATUS:'',//单据状态
          MATCHSTATUS: '', // 匹配状态
          ORDERFROM:'',
          ROWSTATUS:'UPDATE',
          ISRESERVEDSTOCK:0,//换货预留库存
        },//最终保存入参
        // exchangeSKU:'', //换货商品SKU
        exchangeGoodsNum:1,//换货商品数量
        selectSKUID:'',//换货商品sku下拉框双向数据绑定
        SKUArr:[], //SKU下拉框列表
        SKUAllData:[], //SKU下拉框列表完整数据
        selectSKUData:{},//换货商品选中的SKU数据
        // returnSKU:'',//退货商品SKU
        SKUArrReturn:[],//退货商品SKU下拉框列表
        SKUAllDataReturn:[],//退货商品SKU下拉框列表完整数据
        selectReturnSKUData:{},//退货商品选中的SKU数据
        selectReturnSKUID:'',//退货商品sku下拉框双向数据绑定
        returnGoodsNum:1,//退货商品数量

        refundableAmount: '0.0000', // 应退总金额
        refundablePostage: '0.0000', // 应退邮费
        otherAmount: '0.0000', // 其他金额
        exchangeAmount: '0.0000', // 换货金额
        total: 0, // 退货单总金额
        tabList: [
          {
            tabId: '1',
            tabtext: '基本信息',
            blockShow: true,
            blockShowOne: true,
            list: [
              {
                ID: '',
                SKEY: 'id_number',
                title: '单据编号',
                VALUE: '',
                company: '',
                tips: '',
                placeholder:'请输入内容',
                disabled:true,//不可编辑
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                required: false, // 是否为必填项
                explain:false, //是否有解释
                search:false,//是否有搜索弹窗 不可搜索
                explainContent:'',//解释文字
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'original_order_number',
                title: '原订单编号',
                VALUE: '',
                placeholder:'请输入内容',
                placeholder:'不关联原单，无原订单编号',
                company: '',
                tips: '',
                disabled:true,//不可编辑
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                explain:true, //是否有解释
                search:false,//是否有搜索弹窗 不可搜索
                explainContent:'',//解释文字
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'refund_status',
                title: '单据状态',
                VALUE: '创建',
                placeholder:'请输入内容',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                disabled:true, //输入框禁用
                flag: false, // 控制必填校验样式展示MATCHSTATUS
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'match_status',
                title: '匹配状态',
                VALUE: '未匹配',
                placeholder:'请输入内容',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                disabled:true, //输入框禁用
                flag: false, // 控制必填校验样式展示MATCHSTATUS
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'omsstoragein_id',
                title: '入库单号',
                VALUE: '',
                placeholder:'请输入内容',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                disabled:true, //输入框禁用
                flag: false, // 控制必填校验样式展示MATCHSTATUS
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'refund_type',
                title: '单据类型',
                VALUE: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                disabled:true, //输入框禁用
                showTag: true,
              },
              {
                ID: 'T_V_IESSHOP',
                SKEY: 'shop_name',
                title: '店铺',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:true,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
                optionList:[]
              },
              {
                ID: '',
                SKEY: 'process_store_title',
                title: '处理门店名称',
                VALUE: '',
                placeholder:'请输入内容',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                disabled:true, //输入框禁用
                flag: false, // 控制必填校验样式展示MATCHSTATUS
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'process_storeId',
                title: '处理门店ID',
                VALUE: '',
                placeholder:'请输入内容',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                disabled:true, //输入框禁用
                flag: false, // 控制必填校验样式展示MATCHSTATUS
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'original_platform_number',
                title: '平台单号',
                VALUE: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                disabled:true,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'system_order',
                title: '系统单号',
                VALUE: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                disabled:true,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'exchange_reserved_stock',
                title: '换货预留库存',
                VALUE: false,
                defaultvalue: '',
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                showTag: true,
                explain:true, //是否有解释
                explainContent:'创建退换货单同时，系统自动创建一张未收款的换货单，用来占用库存，请不要对换货单手工收款。',
              },
              {
                ID: '',
                SKEY: 'ALLHOSTNAME',
                title: '主播名称',
                VALUE: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                disabled:true,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'ALLHOSTNO',
                title: '主播ID',
                VALUE: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                disabled:true,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: 'T_V_OMSLOGISTICSCOMPANY',
                SKEY: 'return_logistics_company',
                title: '退回物流公司',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
                optionList:[]
              },
              {
                ID: '',
                SKEY: 'return_logistics_num',
                title: '退回物流单号',
                expressImg:true,
                VALUE: '',
                EXPRESSQUERYADDRESS:'',//对应物流公司
                placeholder:'请输入内容',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'is_refund_to_store',
                title: '是否拒收',
                VALUE: false,
                defaultvalue: '',
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                showTag: true,
                explain:true, //是否有解释
                explainContent:'拒收类订单必须勾选，系统会根据订单原发货仓做相应退单处理'
              },
              {
                ID: 'T_IESWAREHOUSE',
                SKEY: 'return_warehouse',
                title: '退回仓库',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:false,
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
                optionList:[]
              },
              {
                ID: '',
                SKEY: 'platform_refund_number',
                title: '平台退款单号',
                VALUE: '',
                placeholder:'请输入内容',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'platform_exchange_number',
                title: '平台换货单号',
                VALUE: '',
                placeholder:'请输入内容',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'buyer_nickname',
                title: '买家昵称',
                VALUE: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'platform_vip_code',
                title: '平台会员卡号',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: 'T_OMSREASONTYPE',
                SKEY: 'reason_refund',
                title: '退换货原因',
                VALUE:'',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
                optionList:[]
              },
              {
                ID: '',
                SKEY: 'responsibility_person',
                title: '担责人',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'refund_pay_type',
                title: '退款方式',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:false,
                required: false, // 是否为必填项
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
                optionList:[
                  { label: '线上退款',value: '1' },
                  { label: '线下打款',value: '2' }
                ]
              },
              {
                ID: '',
                SKEY: 'refund_delivery_type',
                title: '退货方式',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:true,
                required: false, // 是否为必填项
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
                optionList:[
                  { label: '物流退货',value: '1' },
                  { label: '到店退货',value: '2' }
                ]
              },
              {
                ID: '',
                SKEY: 'BUYER_OPEN_UID',
                title: '买家OPENID',
                VALUE: '',
                company: '',
                tips: '',
                disabled:false,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                SKEY: 'tmall_mcard_pz_sp',
                title: '权益金',
                VALUE: '',
                placeholder: '',
                disabled:true,
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'exchange_postage',
                title: '换货邮费',
                VALUE: 0,
                disabled:true,
                standard:true,//标准输入框长度
                explain:true, //是否有解释
                explainContent:'换货的新订单邮费',
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'refund_instructions',
                title: '退换货说明',
                VALUE: '',
                defaultvalue: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                standard:false,//标准输入框长度
                remark:true,//备注栏
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'buyer_message',
                title: '买家备注',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:false,//标准输入框长度
                remark:true,//备注栏
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'refund_reasons',
                title: '内部备注',
                VALUE: '',
                defaultvalue: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                standard:false,//标准输入框长度
                remark:true,//备注栏
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'system_remarks',
                title: '系统备注',
                VALUE: '',
                defaultvalue: '',
                placeholder:'',
                company: '',
                tips: '',
                standard:false,//标准输入框长度
                remark:true,//备注栏
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
            ],
          },
          {
            tabId: '2',
            tabtext: '收货人信息',
            blockShow:true,
            blockShowOne: true,
            list: [
              {
                ID: '',
                SKEY: 'consignee_people',
                title: '换货/收货人',
                VALUE: '',
                placeholder:'请输入内容',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
                required: true, // 是否为必填项
              },
              {
                ID: '',
                SKEY: 'consignee_mobile',
                title: '换货/收货人手机',
                VALUE: '',
                placeholder:'请输入内容',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'consignee_phone',
                title: '换货/收货人电话',
                VALUE: '',
                placeholder:'请输入内容',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: 'T_OMSREGION_PROVINCE',
                SKEY: 'buyer_province',
                title: '换货收货人省',
                VALUE: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                showTag: true,
                optionList:[]
              },
              {
                ID: 'T_OMSREGION_CITY',
                SKEY: 'buyer_city',
                title: '换货收货人市',
                VALUE: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                showTag: true,
                 optionList:[]
              },
              {
                ID: 'T_OMSREGION_AREA',
                SKEY: 'buyer_area',
                title: '换货收货人区县',
                VALUE: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
                optionList:[]
              },
              {
                ID: '',
                SKEY: 'buyer_town',
                title: '换货收货人街道',
                VALUE: '',
                placeholder:'',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'consignee_zip_code',
                title: '换货/收货人邮编',
                VALUE: '',
                placeholder:'请输入内容',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              },
              {
                ID: '',
                SKEY: 'consignee_address',
                title: '换货/收货人地址',
                VALUE: '',
                flag: false, // 控制必填校验样式展示
                showTag: true,
                required: true, // 是否为必填项
              }

            ],
          },
          {
            tabId: '3',
            tabtext: '退款金额',
            blockShow: true,
            blockShowOne: true,
            list: [
              {
                ID: '',
                SKEY: 'refund_amount',
                title: '',
                VALUE: '',
                company: '',
                tips: '',
                all:true,//100%长度
                flag: false, // 控制必填校验样式展示
                showTag: true,
              }
            ],
          }
        ],
        tabListOld:[], // 暂存所有的参数
        giftOptions:[ //是否赠品
          {
            name: '否',
            value: 0
          },
          {
            name: '是',
            value: 1
          },
        ],
        markOptions: [ //商品标记
          {
            name: '待定',
            value: 0
          },
          {
            name: '正品',
            value: 1
          },
          {
            name: '瑕疵品',
            value: 2
          },

          {
            name: '残次品',
            value: 3
          }
        ],
        returnColumns: [ //退货商品
            {
              type: 'selection',
              width: 60,
              align: 'center'
            },
            {
              type: 'index',
              align:'center',
              title: '序号',
            },
            {
                title: '商品名称',
                align:'center',
                key: 'TITLE'
            },
            {
              title:'商品图片',
              key: 'PICTUREURL',
              render: (h, params) => {
                return h(
                  'div',
                  {
                    class:{
                      imgBox:true
                    },
                    style: {
                      // zIndex: 999,
                      width:'20px',
                      height:'20px',
                      position:'relative'
                    },

                  },
                  [
                    h('Img',
                    {
                       style: {
                          width:'20px',
                          height:'20px'
                        },
                      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'
                          txt3.style.top=($(".imgBox")[params.index].top)+'px'
                          txt3.style.left=($(".imgBox")[0].offsetLeft)+30+'px'
                          $(".imgBox")[params.index].append(txt3)
                        },
                        'mouseleave':(e)=>{
                          $("#enlargeImg").remove();
                        }
                      }
                    },
                    )
                  ]

                )
              }
            },
            {
                title: '商品编码',
                align:'center',
                key: 'PRODUCTCODE'
            },
            {
                title: 'SKU',
                align:'center',
                key: 'SKU'
            },
            {
                title: '国标码',
                align:'center',
                key: 'GBCODE'
            },
            {
                title: '规格',
                align:'center',
                key: 'SHOWNORMSDETAILNAMES'
            },
            {
                title: '品牌',
              align: 'center',
                key: 'BRANDNAME'
            },
            {
                title: '商品单价',
                align:'center',
                key: 'PRICE'
            },
            // 新增字段
            {
              title: '订单商品数量',
              align: 'center',
              key: 'ORDERPRODUCTNUM',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    attrs:{
                      disabled:!this.returnToExchangeHandle && ((this_.queryVirstatus=='1') || (this_.queryVirstatus=='10')||(this_.queryVirstatus=='20')||(this_.queryVirstatus=='30'))?false:true
                    },
                    props: {
                      value: params.row.ORDERPRODUCTNUM,
                      number: true
                    },
                    on: {
                      'on-blur': (event) => {
                        let chengeData=this.currentReturnData[params.index]
                        this.returnData.forEach((item)=>{
                          if(item.ID && (item.ID==chengeData.ID)){
                            if(isNaN(event.target.value)){
                              event.target.value=item.ORDERPRODUCTNUM
                            }else{
                              if(isNaN(event.target.value)){
                                event.target.value=item.ORDERPRODUCTNUM
                              }else{
                                item.ORDERPRODUCTNUM =+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: 'ORDERPRODUCAMOUNT',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    attrs:{
                      disabled:!this.returnToExchangeHandle && ((this_.queryVirstatus=='1') || (this_.queryVirstatus=='10')||(this_.queryVirstatus=='20')||(this_.queryVirstatus=='30'))?false:true
                    },
                    props: {
                      value: params.row.ORDERPRODUCAMOUNT,
                    },
                    on: {
                      'on-blur': (event) => {
                        let chengeData=this.currentReturnData[params.index]
                        const tempVal = event.target.value;
                        const endVal = this.$comUtils.globalCarryAppend(tempVal, this.carryMethod);
                        event.target.value = endVal;
                        this.returnData.forEach((item)=>{
                          if(item.ID && (item.ID==chengeData.ID)){
                            item.ORDERPRODUCAMOUNT = endVal;
                          }
                        })
                        this.totalReturn=this.returnData.length;
                        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                        let endIndex=startIndex+this.pageSizeReturn
                        this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                      },
                      'on-keyup': (event) => {
                        const tempVal = event.target.value;
                        const endVal = this.$comUtils.globalCarryMethod(tempVal, this.carryMethod, true);
                        event.target.value = endVal;
                      }
                    }
                  },
                );
              },
            },
            {
                title: '申请数量',
                align:'center',
                key: 'REFUNDNUM',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      attrs:{
                        disabled:!this.returnToExchangeHandle && ((this_.queryVirstatus=='1')||(this_.queryVirstatus=='10')||(this_.queryVirstatus=='20'))?false:true
                      },
                      props: {
                        value: params.row.REFUNDNUM,
                        number: true
                      },
                      on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                             this.returnData.forEach((item)=>{
                                if(item.ID && (item.ID==chengeData.ID)){
                                    if(isNaN(event.target.value)){
                                      event.target.value=item.REFUNDNUM
                                    }else{
                                      item.REFUNDNUM =+event.target.value;
                                    }
                                    // 申请数量不能大于可退数量或小于0
                                    if(this.tabList[0].list[1].VALUE){
                                      if(item.ORDERPRODUCTNUM && (item.REFUNDNUM>item.ORDERPRODUCTNUM || item.REFUNDNUM<=0) && this.IS_CHECK_RENUM==1 && this.saveArr.ORDERFROM == '手工新增'){
                                        // this.$Message.warning('申请数量不能大于可退数量或小于0');
                                        // item.REFUNDNUM=1
                                        return this.$Modal.fcWarning({
                                          title: '警告',
                                          mask: true,
                                          content: '【'+item.SKU+'】申请数量不能大于订单商品数量，请修改后保存'
                                        });
                                      }
                                      // else if(item.ORDERPRODUCTNUM && item.REFUNDNUM<=0) {
                                      //   item.REFUNDNUM=1
                                      //   return this.$Modal.fcWarning({
                                      //     title: '警告',
                                      //     mask: true,
                                      //     content: '【'+item.SKU+'】申请数量需大于0'
                                      //   });
                                      // }
                                    }else {
                                      if(item.REFUNDNUM<=0){
                                        this.$Message.warning('申请数量需大于0');
                                        item.REFUNDNUM=1
                                      }
                                    }
                                    item.ADJUSTAMOUNT=this.standardMoney(this.parser(item.REFUND_FEE) - item.REFUNDNUM * this.parser(item.PRICE));

                                }
                             })
                            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: 'INSTORENUM',
                render: (h, params) => {
                  return h(
                    'div',
                    {},
                    [(!params.row.INSTORENUM)||(params.row.INSTORENUM=='')?0:params.row.INSTORENUM]
                  );
                },
            },
            {
                title: '是否赠品',
                align:'center',
                key: 'ISGIFT',
                render: (h, params) => {
                  const vm = this;
                  return h('Select', {
                    style: {
                      zIndex: 999,
                    },
                    props: {
                      transfer: true,
                      value: params.row.ISGIFT, // 获取选择的下拉框的值
                    },
                    attrs:{
                      disabled:!this.returnToExchangeHandle && ((vm.queryVirstatus=='1') || (vm.queryVirstatus=='10')||(vm.queryVirstatus=='20')||(vm.queryVirstatus=='30'))?false:true
                    },
                    on: {
                      'on-change': (e) => {
                        // vm.returnData[params.index].ISGIFT = e;

                        let chengeData=vm.currentReturnData[params.index]
                          vm.returnData.forEach((item)=>{
                            if(item.ID && (item.ID==chengeData.ID)){
                                item.ISGIFT =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.giftOptions.map(item => h('Option', {
                    props: {
                      value: item.value, // 绑定的值
                    }
                  }, item.name)
                  ));
                }
            },
            {
                title: '是否提前传ERP',
                align:'center',
                key: 'IS_ADVANCE_PASS_ERP',
            },
            {
                title: '唯品会虚拟条码',
                align:'center',
                key: 'ISVIPVIRTUALSKU',
            },
            {
                title: '总申请退款金额',
                align: 'center',
                key: 'RETURN_ALLAMOUNT'
            },
            {
                title: '退款金额',
                align:'center',
                key: 'REFUND_FEE',
                render: (h, params) => {
                    let this_=this
                    return h(
                    'Input',
                    {
                        style: {
                        width:'66px'
                        },
                        props: {
                        value: params.row.REFUND_FEE,
                        },
                        attrs:{
                          disabled:!this.returnToExchangeHandle && ((this_.queryVirstatus=='1')||(this_.queryVirstatus=='10')||(this_.queryVirstatus=='20')||(this_.queryVirstatus=='30'))?false:true
                        },
                        on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                            const tempVal = event.target.value;
                            const endVal = this.$comUtils.globalCarryAppend(tempVal, this.carryMethod);
                            event.target.value = endVal;
                            this.returnData.forEach((item)=>{
                              if(item.ID && (item.ID==chengeData.ID)){
                                item.REFUND_FEE = endVal;
                              }
                            })
                            event.target.value=this.standardMoney(this.parser(event.target.value))
                            this.refundableAmount=0
                            this.returnData.forEach(i=>{
                                this.refundableAmount = this.standardMoney(this.parser(this.refundableAmount)+this.parser(i.REFUND_FEE)); //应退总金额
                                this.checkMoney()
                            })

                            this.totalReturn=this.returnData.length;
                            let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                            let endIndex=startIndex+this.pageSizeReturn
                            this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细

                          },
                          'on-keyup': (event) => {
                            const tempVal = event.target.value;
                            const endVal = this.$comUtils.globalCarryMethod(tempVal, this.carryMethod, false);
                            event.target.value = endVal;
                          }
                        }
                    },
                  );
                },
            },
            {
                title: '退回余额',
                align: 'center',
                key: 'RETURN_BALANCE'
            },
            {
                title: '已退金额',
                align: 'center',
                key: 'REFUNDED_AMOUNT',
                renderHeader: this.tooltipRenderHeader('截止到该退单售后审核完成时，退单的全部已退金额'),
            },
            {
                title: '退单平台承担金额',
                align:'center',
                key: 'PLATUNDERTAKEAMOUNT'
            },
            {
                title: '残次数量',
                align:'center',
                key: 'CCP_NUM',
                render: (h, params) => {
                  return h(
                    'div',
                    {},
                      [(!params.row.CCP_NUM)||(params.row.CCP_NUM=='')?0:params.row.CCP_NUM]
                  );
                },
            },
            {
                title: '瑕疵数量',
                align:'center',
                key: 'XCP_NUM',
                render: (h, params) => {
                  return h(
                    'div',
                    {},
                      [(!params.row.XCP_NUM)||(params.row.XCP_NUM=='')?0:params.row.XCP_NUM]
                  );
                },
            },
            {
              title: '次品原因',
              align:'center',
              key: 'DEFECTIVE_CAUSE'
            },
            {
              title: 'QR码',
              key: 'QRCODE',
              align: 'center',
              render: (h, params) => {
                  return h(
                    'div',
                    {
                      style: {
                        maxWidth:'385px',
                        overflow: 'hidden',
                        height:'18px'
                      },
                    },
                    [
                      h('Tooltip',
                      {
                        attrs: {
                          placement:"top-start",
                          content:params.row.tip,
                          maxWidth:"385",
                          transfer:true
                        },
                      },
                      [h(
                        'div',
                        {
                          style: {
                            cursor: 'pointer',
                            overflow: 'hidden',
                            maxWidth:'385px',
                            textOverflow:'ellipsis',
                            whiteSpace: 'nowrap'

                          },
                          props: {
                            value: params.row.QRCODE,
                          },
                          on: {
                            click: () => {
                              console.log(params,111)
                              if(params.row.QRCODE){
                                let text = params.row.QRCODE;
                                let inputElement = document.createElement('input')
                                inputElement.value = text;
                                document.body.appendChild(inputElement);
                                inputElement .select(); //选中文本
                                document.execCommand("copy"); //执行浏览器复制命令
                                inputElement.remove();

                              }

                            }
                          }
                        },
                        [params.row.QRCODE]
                      ),
                    ]
                  ),
                    ]

                )
              }
            },
            {
              title: '主播名称',
              align:'center',
              key: 'HOSTNAME'
            },
            {
              title: '主播ID',
              align:'center',
              key: 'HOSTNO'
            },
            {
                title: 'PO',
                align: 'center',
                key: 'PO',
                renderHeader: this.tooltipRenderHeader('唯品会PO单号'),
                render: (h, params) => {
                  return h(
                    'Input',
                    {
                      attrs:{
                        disabled:!this.returnToExchangeHandle && ((this.queryVirstatus=='1')||(this.queryVirstatus=='10')||(this.queryVirstatus=='20'))?false:true
                      },
                      style: {
                        width:'90px',
                      },
                      props: {
                        value: params.row.PO,
                      },
                      on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                             this.returnData.forEach((item)=>{
                                if(item.ID && (item.ID==chengeData.ID)){
                                    item.PO =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: 'MATCHSTATUS'
            },
        ],
        OldReturnColumns: [ //退货商品
            {
              type: 'selection',
              width: 60,
              align: 'center'
            },
            {
              type: 'index',
              align:'center',
              title: '序号',
            },
            {
                title: '商品名称',
                align:'center',
                key: 'TITLE'
            },
            {
              title:'商品图片',
              key: 'PICTUREURL',
              render: (h, params) => {
                return h(
                  'div',
                  {
                    class:{
                      imgBox:true
                    },
                    style: {
                      // zIndex: 999,
                      width:'20px',
                      height:'20px',
                      position:'relative'
                    },

                  },
                  [
                    h('Img',
                    {
                       style: {
                          width:'20px',
                          height:'20px'
                        },
                      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'
                          txt3.style.top=($(".imgBox")[params.index].top)+'px'
                          txt3.style.left=($(".imgBox")[0].offsetLeft)+30+'px'
                          $(".imgBox")[params.index].append(txt3)
                        },
                        'mouseleave':(e)=>{
                          $("#enlargeImg").remove();
                        }
                      }
                    },
                    )
                  ]

                )
              }
            },
            {
                title: '商品编码',
                align:'center',
                key: 'PRODUCTCODE'
            },
            {
                title: 'SKU',
                align:'center',
                key: 'SKU'
            },
            {
                title: '国标码',
                align:'center',
                key: 'GBCODE'
            },
            {
                title: '规格',
                align:'center',
                key: 'SHOWNORMSDETAILNAMES'
            },
            {
                title: '品牌',
              align: 'center',
                key: 'BRANDNAME'
            },
            {
                title: '商品单价',
                align:'center',
                key: 'PRICE'
            },
            // 新增字段
            {
              title: '订单商品数量',
              align: 'center',
              key: 'ORDERPRODUCTNUM',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    attrs:{
                      disabled:(this_.queryVirstatus=='1')||(this_.queryVirstatus=='10')||(this_.queryVirstatus=='20')||(this_.queryVirstatus=='30')?false:true
                    },
                    props: {
                      value: params.row.ORDERPRODUCTNUM,
                      number: true
                    },
                    on: {
                      'on-blur': (event) => {
                        let chengeData=this.currentReturnData[params.index]
                        this.returnData.forEach((item)=>{
                          if(item.ID && (item.ID==chengeData.ID)){
                            if(isNaN(event.target.value)){
                              event.target.value=item.ORDERPRODUCTNUM
                            }else{
                              if(isNaN(event.target.value)){
                                event.target.value=item.ORDERPRODUCTNUM
                              }else{
                                item.ORDERPRODUCTNUM =+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: 'ORDERPRODUCAMOUNT',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    attrs:{
                      disabled:(this_.queryVirstatus=='1')||(this_.queryVirstatus=='10')||(this_.queryVirstatus=='20')||(this_.queryVirstatus=='30')?false:true
                    },
                    props: {
                      value: params.row.ORDERPRODUCAMOUNT,
                    },
                    on: {
                      'on-blur': (event) => {
                        //  this.returnData[params.index].ORDERPRODUCAMOUNT =this.standardMoney(this.parser(event.target.value)) ;
                        //   event.target.value=this.standardMoney(this.parser(event.target.value))

                        let chengeData=this.currentReturnData[params.index]
                        this.returnData.forEach((item)=>{
                          if(item.ID && (item.ID==chengeData.ID)){
                              item.ORDERPRODUCAMOUNT =this.standardMoney(this.parser(event.target.value)) ;
                              event.target.value=this.standardMoney(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) //当前页面显示明细
                      }
                    }
                  },
                );
              },
            },
            {
                title: '申请数量',
                align:'center',
                key: 'REFUNDNUM',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      attrs:{
                        disabled:(this_.queryVirstatus=='1')||(this_.queryVirstatus=='10')||(this_.queryVirstatus=='20')?false:true
                      },
                      props: {
                        value: params.row.REFUNDNUM,
                        number: true
                      },
                      on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                             this.returnData.forEach((item)=>{
                                if(item.ID && (item.ID==chengeData.ID)){
                                    if(isNaN(event.target.value)){
                                      event.target.value=item.REFUNDNUM
                                    }else{
                                      item.REFUNDNUM =+event.target.value;
                                    }
                                    // 申请数量不能大于可退数量或小于0
                                    if((item.REFUNDNUM>item.NUM||item.REFUNDNUM<=0) && this.IS_CHECK_RENUM==1 && this.saveArr.ORDERFROM == '手工新增'){
                                      // this.$Message.warning('申请数量不能大于可退数量或小于0');
                                      // item.REFUNDNUM=1
                                      return this.$Modal.fcWarning({
                                        title: '警告',
                                        mask: true,
                                        content: '【'+item.SKU+'】申请数量不能大于订单商品数量，请修改后保存'
                                      });
                                    }
                                    item.ADJUSTAMOUNT=this.standardMoney(this.parser(item.REFUND_FEE) - item.REFUNDNUM * this.parser(item.PRICE));

                                }
                             })
                            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: 'INSTORENUM',
                render: (h, params) => {
                  return h(
                    'div',
                    {},
                    [(!params.row.INSTORENUM)||(params.row.INSTORENUM=='')?0:params.row.INSTORENUM]
                  );
                },
            },
            {
                title: '是否赠品',
                align:'center',
                key: 'ISGIFT',
                render: (h, params) => {
                  const vm = this;
                  return h('Select', {
                    style: {
                      zIndex: 999,
                    },
                    props: {
                      transfer: true,
                      value: params.row.ISGIFT, // 获取选择的下拉框的值
                    },
                    attrs:{
                      disabled:(vm.queryVirstatus=='1')||(vm.queryVirstatus=='10')||(vm.queryVirstatus=='20')||(vm.queryVirstatus=='30')?false:true
                    },
                    on: {
                      'on-change': (e) => {
                        // vm.returnData[params.index].ISGIFT = e;

                        let chengeData=vm.currentReturnData[params.index]
                          vm.returnData.forEach((item)=>{
                            if(item.ID && (item.ID==chengeData.ID)){
                                item.ISGIFT =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.giftOptions.map(item => h('Option', {
                    props: {
                      value: item.value, // 绑定的值
                    }
                  }, item.name)
                  ));
                }
            },
            {
                title: '是否提前传ERP',
                align:'center',
                key: 'IS_ADVANCE_PASS_ERP',
            },
            {
              title: '唯品会虚拟条码',
              align:'center',
              key: 'ISVIPVIRTUALSKU',
            },
            {
                title: '退款金额',
                align:'center',
                key: 'REFUND_FEE',
                render: (h, params) => {
                    let this_=this
                    return h(
                    'Input',
                    {
                        style: {
                        width:'66px'
                        },
                        props: {
                        value: params.row.REFUND_FEE,
                        },
                        attrs:{
                          disabled:(this_.queryVirstatus=='1')||(this_.queryVirstatus=='10')||(this_.queryVirstatus=='20')||(this_.queryVirstatus=='30')?false:true
                        },
                        on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                             this.returnData.forEach((item)=>{
                                if(item.ID && (item.ID==chengeData.ID)){
                                    item.REFUND_FEE =this.standardMoney(this.parser(event.target.value)) ;
                                }
                             })
                            event.target.value=this.standardMoney(this.parser(event.target.value))
                            this.refundableAmount=0
                            this.returnData.forEach(i=>{
                                this.refundableAmount = this.standardMoney(this.parser(this.refundableAmount)+this.parser(i.REFUND_FEE)); //应退总金额
                                this.checkMoney()
                            })

                            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: 'PLATUNDERTAKEAMOUNT'
            },
            {
                title: '残次数量',
                align:'center',
                key: 'CCP_NUM',
                render: (h, params) => {
                  return h(
                    'div',
                    {
                      attrs: {
                        title: params.row.CCP_NUM != 0?params.row.CCP_QRCODE:''
                      }
                    },
                      [(!params.row.CCP_NUM)||(params.row.CCP_NUM=='')?0:params.row.CCP_NUM]
                  );
                },
            },
            {
                title: '瑕疵数量',
                align:'center',
                key: 'XCP_NUM',
                render: (h, params) => {
                  return h(
                    'div',
                    {
                      attrs: {
                        title: params.row.XCP_NUM !=0?params.row.XCP_QRCODE:''
                      }
                    },
                      [(!params.row.XCP_NUM)||(params.row.XCP_NUM=='')?0:params.row.XCP_NUM]
                  );
                },
            },
            {
              title: '次品原因',
              align:'center',
              key: 'DEFECTIVE_CAUSE'
            },
            {
              title: '原唯一码',
              width: '150',
              key: 'QRCODE',
              align: 'center',
              render: (h, params) => {
                  return h(
                    'div',
                    {
                      attrs: {
                        title: params.row.QRCODE
                      }
                    },
                    [params.row.QRCODE?params.row.QRCODE:'']
                  );
              },
            },
            {
              title: '入库唯一码',
              width: '150',
              key: 'REFUND_QRCODE',
              align: 'center',
              render: (h, params) => {
                  return h(
                    'div',
                    {
                      attrs: {
                        title: params.row.REFUND_QRCODE
                      }
                    },
                    [params.row.REFUND_QRCODE?params.row.REFUND_QRCODE:'']
                  );
              },
            },
            {
              title: '主播名称',
              align:'center',
              key: 'HOSTNAME'
            },
            {
              title: '主播ID',
              align:'center',
              key: 'HOSTNO'
            },
            {
                title: 'PO',
                align: 'center',
                key: 'PO',
                renderHeader: this.tooltipRenderHeader('唯品会PO单号'),
                render: (h, params) => {
                  return h(
                    'Input',
                    {
                      attrs:{
                        disabled:!this.returnToExchangeHandle && ((this.queryVirstatus=='1')||(this.queryVirstatus=='10')||(this.queryVirstatus=='20'))?false:true
                      },
                      style: {
                        width:'90px',
                      },
                      props: {
                        value: params.row.PO,
                      },
                      on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                             this.returnData.forEach((item)=>{
                                if(item.ID && (item.ID==chengeData.ID)){
                                    item.PO =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: 'MATCHSTATUS'
            },
            // {
            //   title: '入库唯一码',
            //   key: 'REFUND_QRCODE',
            //   align: 'center',
            //   width: '150',
            //   render: (h, params) => {
            //       return h(
            //         'div',
            //         {
            //           style: {
            //             maxWidth:'385px',
            //             overflow: 'hidden',
            //             height:'18px'
            //           },
            //         },
            //         [
            //           h('Tooltip',
            //           {
            //             attrs: {
            //               placement:"top-start",
            //               content:params.row.tip,
            //               maxWidth:"385",
            //               transfer:true
            //             },
            //           },
            //           [h(
            //             'div',
            //             {
            //               style: {
            //                 cursor: 'pointer',
            //                 overflow: 'hidden',
            //                 maxWidth:'385px',
            //                 textOverflow:'ellipsis',
            //                 whiteSpace: 'nowrap'

            //               },
            //               props: {
            //                 value: params.row.REFUND_QRCODE,
            //               },
            //               on: {
            //                 click: () => {
            //                   if(params.row.REFUND_QRCODE){
            //                     let text = params.row.REFUND_QRCODE;
            //                     let inputElement = document.createElement('input')
            //                     inputElement.value = text;
            //                     document.body.appendChild(inputElement);
            //                     inputElement .select(); //选中文本
            //                     document.execCommand("copy"); //执行浏览器复制命令
            //                     inputElement.remove();

            //                   }

            //                 }
            //               }
            //             },
            //             [params.row.REFUND_QRCODE]
            //           ),
            //         ]
            //       ),
            //         ]

            //     )
            //   }
            // },
        ],
        OldReturnColumns: [ //退货商品
            {
              type: 'selection',
              width: 60,
              align: 'center'
            },
            {
              type: 'index',
              align:'center',
              title: '序号',
            },
            {
                title: '商品名称',
                align:'center',
                key: 'TITLE'
            },
            {
              title:'商品图片',
              key: 'PICTUREURL',
              render: (h, params) => {
                return h(
                  'div',
                  {
                    class:{
                      imgBox:true
                    },
                    style: {
                      // zIndex: 999,
                      width:'20px',
                      height:'20px',
                      position:'relative'
                    },

                  },
                  [
                    h('Img',
                    {
                       style: {
                          width:'20px',
                          height:'20px'
                        },
                      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'
                          txt3.style.top=($(".imgBox")[params.index].top)+'px'
                          txt3.style.left=($(".imgBox")[0].offsetLeft)+30+'px'
                          $(".imgBox")[params.index].append(txt3)
                        },
                        'mouseleave':(e)=>{
                          $("#enlargeImg").remove();
                        }
                      }
                    },
                    )
                  ]

                )
              }
            },
            {
                title: '商品编码',
                align:'center',
                key: 'PRODUCTCODE'
            },
            {
                title: 'SKU',
                align:'center',
                key: 'SKU'
            },
            {
                title: '国标码',
                align:'center',
                key: 'GBCODE'
            },
            {
                title: '规格',
                align:'center',
                key: 'SHOWNORMSDETAILNAMES'
            },
            {
                title: '品牌',
                align:'center',
                key: 'BRANDNAME'
            },
            {
                title: '商品单价',
                align:'center',
                key: 'PRICE'
            },
            // 新增字段
            {
              title: '订单商品数量',
              align: 'center',
              key: 'ORDERPRODUCTNUM',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    attrs:{
                      disabled:!this.returnToExchangeHandle && ((this_.queryVirstatus=='1')||(this_.queryVirstatus=='10')||(this_.queryVirstatus=='20')||(this_.queryVirstatus=='30'))?false:true
                    },
                    props: {
                      value: params.row.ORDERPRODUCTNUM,
                      number: true
                    },
                    on: {
                      'on-blur': (event) => {
                        let chengeData=this.currentReturnData[params.index]
                        this.returnData.forEach((item)=>{
                          if(item.ID && (item.ID==chengeData.ID)){
                            if(isNaN(event.target.value)){
                              event.target.value=item.ORDERPRODUCTNUM
                            }else{
                              if(isNaN(event.target.value)){
                                event.target.value=item.ORDERPRODUCTNUM
                              }else{
                                item.ORDERPRODUCTNUM =+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: 'ORDERPRODUCAMOUNT',
              render: (h, params) => {
                let this_=this
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    attrs:{
                      disabled:!this.returnToExchangeHandle && ((this_.queryVirstatus=='1')||(this_.queryVirstatus=='10')||(this_.queryVirstatus=='20')||(this_.queryVirstatus=='30'))?false:true
                    },
                    props: {
                      value: params.row.ORDERPRODUCAMOUNT,
                    },
                    on: {
                      'on-blur': (event) => {
                        //  this.returnData[params.index].ORDERPRODUCAMOUNT =this.standardMoney(this.parser(event.target.value)) ;
                        //   event.target.value=this.standardMoney(this.parser(event.target.value))

                        let chengeData=this.currentReturnData[params.index]
                        this.returnData.forEach((item)=>{
                          if(item.ID && (item.ID==chengeData.ID)){
                              item.ORDERPRODUCAMOUNT =this.standardMoney(this.parser(event.target.value)) ;
                              event.target.value=this.standardMoney(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) //当前页面显示明细
                      }
                    }
                  },
                );
              },
            },
            {
                title: '申请数量',
                align:'center',
                key: 'REFUNDNUM',
                render: (h, params) => {
                  let this_=this
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      attrs:{
                        disabled:!this.returnToExchangeHandle && ((this_.queryVirstatus=='1')||(this_.queryVirstatus=='10')||(this_.queryVirstatus=='20'))?false:true
                      },
                      props: {
                        value: params.row.REFUNDNUM,
                        number: true
                      },
                      on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                             this.returnData.forEach((item)=>{
                                if(item.ID && (item.ID==chengeData.ID)){
                                    if(isNaN(event.target.value)){
                                      event.target.value=item.REFUNDNUM
                                    }else{
                                      item.REFUNDNUM =+event.target.value;
                                    }
                                    // 申请数量不能大于可退数量或小于0
                                    if(item.REFUNDNUM>item.NUM||item.REFUNDNUM<=0){
                                      this.$Message.warning('申请数量不能大于可退数量或小于0');
                                      item.REFUNDNUM=1
                                    }
                                    item.ADJUSTAMOUNT=this.standardMoney(this.parser(item.REFUND_FEE) - item.REFUNDNUM * this.parser(item.PRICE));

                                }
                             })
                            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: 'INSTORENUM',
                render: (h, params) => {
                  return h(
                    'div',
                    {},
                    [(!params.row.INSTORENUM)||(params.row.INSTORENUM=='')?0:params.row.INSTORENUM]
                  );
                },
            },
            {
                title: '是否赠品',
                align:'center',
                key: 'ISGIFT',
                render: (h, params) => {
                  const vm = this;
                  return h('Select', {
                    style: {
                      zIndex: 999,
                    },
                    props: {
                      transfer: true,
                      value: params.row.ISGIFT, // 获取选择的下拉框的值
                    },
                    attrs:{
                      disabled:!this.returnToExchangeHandle && ((vm.queryVirstatus=='1')||(vm.queryVirstatus=='10')||(vm.queryVirstatus=='20')||(vm.queryVirstatus=='30'))?false:true
                    },
                    on: {
                      'on-change': (e) => {
                        // vm.returnData[params.index].ISGIFT = e;

                        let chengeData=vm.currentReturnData[params.index]
                          vm.returnData.forEach((item)=>{
                            if(item.ID && (item.ID==chengeData.ID)){
                                item.ISGIFT =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.giftOptions.map(item => h('Option', {
                    props: {
                      value: item.value, // 绑定的值
                    }
                  }, item.name)
                  ));
                }
            },
            {
                title: '是否提前传ERP',
                align:'center',
                key: 'IS_ADVANCE_PASS_ERP',
            },
            {
              title: '唯品会虚拟条码',
              align:'center',
              key: 'ISVIPVIRTUALSKU',
            },
            {
                title: '总申请退款金额',
                align: 'center',
                key: 'RETURN_ALLAMOUNT'
            },
            {
                title: '退款金额',
                align:'center',
                key: 'REFUND_FEE',
                render: (h, params) => {
                    let this_=this
                    return h(
                    'Input',
                    {
                        style: {
                        width:'66px'
                        },
                        props: {
                        value: params.row.REFUND_FEE,
                        },
                        attrs:{
                          disabled:(this_.queryVirstatus=='1')||(this_.queryVirstatus=='10')||(this_.queryVirstatus=='20')||(this_.queryVirstatus=='30')?false:true
                        },
                        on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                             this.returnData.forEach((item)=>{
                                if(item.ID && (item.ID==chengeData.ID)){
                                    item.REFUND_FEE =this.standardMoney(this.parser(event.target.value)) ;
                                }
                             })
                            event.target.value=this.standardMoney(this.parser(event.target.value))
                            this.refundableAmount=0
                            this.returnData.forEach(i=>{
                                this.refundableAmount = this.standardMoney(this.parser(this.refundableAmount)+this.parser(i.REFUND_FEE)); //应退总金额
                                this.checkMoney()
                            })

                            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: 'RETURN_BALANCE'
            },
            {
                title: '已退金额',
                align: 'center',
                key: 'REFUNDED_AMOUNT',
                renderHeader: this.tooltipRenderHeader('截止到该退单售后审核完成时，退单的全部已退金额'),
            },
            {
                title: '退单平台承担金额',
                align:'center',
                key: 'PLATUNDERTAKEAMOUNT'
            },
            {
                title: '残次数量',
                align:'center',
                key: 'CCP_NUM',
                render: (h, params) => {
                  return h(
                    'div',
                    {
                      attrs: {
                        title: params.row.CCP_NUM != 0?params.row.CCP_QRCODE:''
                      }
                    },
                      [(!params.row.CCP_NUM)||(params.row.CCP_NUM=='')?0:params.row.CCP_NUM]
                  );
                },
            },
            {
                title: '瑕疵数量',
                align:'center',
                key: 'XCP_NUM',
                render: (h, params) => {
                  return h(
                    'div',
                    {
                      attrs: {
                        title: params.row.XCP_NUM !=0?params.row.XCP_QRCODE:''
                      }
                    },
                      [(!params.row.XCP_NUM)||(params.row.XCP_NUM=='')?0:params.row.XCP_NUM]
                  );
                },
            },
            {
              title: '次品原因',
              align:'center',
              key: 'DEFECTIVE_CAUSE'
            },
            {
              title: '原唯一码',
              width: '150',
              key: 'QRCODE',
              align: 'center',
              render: (h, params) => {
                  return h(
                    'div',
                    {
                      attrs: {
                        title: params.row.QRCODE
                      }
                    },
                    [params.row.QRCODE?params.row.QRCODE:'']
                  );
              },
            },
            {
              title: '入库唯一码',
              width: '150',
              key: 'REFUND_QRCODE',
              align: 'center',
              render: (h, params) => {
                  return h(
                    'div',
                    {
                      attrs: {
                        title: params.row.REFUND_QRCODE
                      }
                    },
                    [params.row.REFUND_QRCODE?params.row.REFUND_QRCODE:'']
                  );
              },
            },
            {
              title: '主播名称',
              align:'center',
              key: 'HOSTNAME'
            },
            {
              title: '主播ID',
              align:'center',
              key: 'HOSTNO'
            },
            {
                title: 'PO',
                align: 'center',
                key: 'PO',
                renderHeader: this.tooltipRenderHeader('唯品会PO单号'),
                render: (h, params) => {
                  return h(
                    'Input',
                    {
                      attrs:{
                        disabled:!this.returnToExchangeHandle && ((this.queryVirstatus=='1')||(this.queryVirstatus=='10')||(this.queryVirstatus=='20'))?false:true
                      },
                      style: {
                        width:'90px',
                      },
                      props: {
                        value: params.row.PO,
                      },
                      on: {
                        'on-blur': (event) => {
                            let chengeData=this.currentReturnData[params.index]
                             this.returnData.forEach((item)=>{
                                if(item.ID && (item.ID==chengeData.ID)){
                                    item.PO =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: 'MATCHSTATUS'
            },
            // {
            //   title: '入库唯一码',
            //   key: 'REFUND_QRCODE',
            //   align: 'center',
            //   width: '150',
            //   render: (h, params) => {
            //       return h(
            //         'div',
            //         {
            //           style: {
            //             maxWidth:'385px',
            //             overflow: 'hidden',
            //             height:'18px'
            //           },
            //         },
            //         [
            //           h('Tooltip',
            //           {
            //             attrs: {
            //               placement:"top-start",
            //               content:params.row.tip,
            //               maxWidth:"385",
            //               transfer:true
            //             },
            //           },
            //           [h(
            //             'div',
            //             {
            //               style: {
            //                 cursor: 'pointer',
            //                 overflow: 'hidden',
            //                 maxWidth:'385px',
            //                 textOverflow:'ellipsis',
            //                 whiteSpace: 'nowrap'

            //               },
            //               props: {
            //                 value: params.row.REFUND_QRCODE,
            //               },
            //               on: {
            //                 click: () => {
            //                   if(params.row.REFUND_QRCODE){
            //                     let text = params.row.REFUND_QRCODE;
            //                     let inputElement = document.createElement('input')
            //                     inputElement.value = text;
            //                     document.body.appendChild(inputElement);
            //                     inputElement .select(); //选中文本
            //                     document.execCommand("copy"); //执行浏览器复制命令
            //                     inputElement.remove();

            //                   }

            //                 }
            //               }
            //             },
            //             [params.row.REFUND_QRCODE]
            //           ),
            //         ]
            //       ),
            //         ]

            //     )
            //   }
            // },
        ],
        undeliveredAndReturnedColumns: [ //未发已退商品
            {
              type: 'index',
              align:'center',
              title: '序号',
            },
            {
                title: '商品名称',
                align:'center',
                key: 'TITLE',
                // width:150
            },
            {
                title: '商品编码',
                key: 'PRODUCTCODE',
                align:'left',
                // width:120
            },
            {
                title: 'SKU',
                key: 'SKU',
                align:'left',
                // width:120
            },
            {
                title: '国标码',
                key: 'GBCODE',
                align:'left',
                // width:120
            },
            {
                title: '规格',
                key: 'SKUSPEC',
                align:'left',
                // width:120
            },
            {
                title: '商品单价',
                key: 'PRICE',
                align:'left',
                // width:120
            },
            {
                title: '订单商品数量',
                key: 'ORDERPRODUCTNUM',
                align:'left',
                // width:120
            },
            {
                title: '订单成交金额',
                key: 'ORDERPRODUCAMOUNT',
                align:'left',
                // width:120
            },
            {
                title: '是否赠品',
                key: 'ISGIFT',
                align:'left',
                // width:80
            },
        ],
        undeliveredAndReturnedData: [],
        journalColumns: [ //退换货单日志
            {
                title: '编号',
                align:'center',
                key: 'ID',
                width:150
            },
            {
                title: '创建人',
                key: 'OWNERID',
                align:'left',
                width:120
            },
            {
                title: '创建日期',
                key: 'CREATIONDATE',
                align:'left',
                width:180
            },
            {
                title: '日志类型',
                key: 'LOGTYPE',
                align:'left',
                width:160
            },
            {
              title: '日志内容',
              key: 'LOGMESSAGE',
              align: 'left',
              // width:300,
              render: (h, params) => {
                return h(
                  'div',
                  {
                    style: {
                      whiteSpace:'normal',
                      wordBreak:'break-all',

                    },
                  },
                  [params.row.LOGMESSAGE]
                );
              },
            },
        ],
        submitArrJournal:[],//选中的退货商品
        journalData:[],
        exchangeColumns: [ //换货商品
          {
            type: 'selection',
            width: 60,
            align: 'center'
          },
          {
            type: 'index',
            align: 'center',
            title: '序号',
          },
          {
            title: '商品名称',
            align: 'center',
            key: 'TITLE'
          },
          {
            title: '商品编码',
            align: 'center',
            key: 'PRODUCTCODE'
          },
          {
            title: 'SKU',
            align: 'center',
            key: 'SKU'
          },
          {
              title: '国标码',
              align: 'center',
              key: 'GBCODE'
          },
          {
              title: '规格',
              align: 'center',
              key: 'SHOWNORMSDETAILNAMES'
          },
          {
              title: '商品单价',
              align: 'center',
              key: 'PRICE'
          },
          {
              title: '换货金额',
              align: 'center',
              key: 'REFUND_FEE',
              render: (h, params) => {
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.REFUND_FEE,
                    },
                    attrs:{
                      disabled:(this.queryVirstatus=='1')||(this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')?false:true
                    },
                    on: {
                      'on-blur': (event) => {
                        let chengeData=this.currentExchangeData[params.index]
                        this.exchangeData.forEach(item=>{
                            if(item.SKU==chengeData.SKU){
                              item.REFUND_FEE =this.standardMoney((this.parser(event.target.value))) ;
                              event.target.value=this.standardMoney((this.parser(event.target.value)))
                              item.ADJUSTAMOUNT=this.standardMoney(this.parser(item.REFUND_FEE) - item.REFUNDNUM * this.parser(item.PRICE));
                            }
                        })

                        this.exchangeAmount=0
                        this.exchangeData.forEach(item=>{
                            this.exchangeAmount =this.standardMoney(this.parser(this.exchangeAmount)+this.parser(item.REFUND_FEE)) ;// safeFloat(item.PRICE) * safeNumber(refundNum);
                            this.checkMoney('exchangeAmount')
                        });
                        // 截取数组
                        this.totalExchange=this.exchangeData.length;
                        let startIndex=this.pageSizeExchange*(this.exchangeCurrentPage-1)
                        let endIndex=startIndex+this.pageSizeExchange
                        this.currentExchangeData=this.exchangeData.slice(startIndex,endIndex)

                      }
                    }
                  },
                );
              },
          },
          {
              title: '换货数量',
              align: 'center',
              key: 'REFUNDNUM',
              render: (h, params) => {
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.REFUNDNUM,
                      number: true
                    },
                    attrs:{
                      disabled:(this.queryVirstatus=='1')||(this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')?false:true
                    },
                    on: {
                      'on-blur': (event) => {
                        let chengeData=this.currentExchangeData[params.index]
                        this.exchangeData.forEach(item=>{
                            if(item.SKU==chengeData.SKU){
                              item.REFUNDNUM =+event.target.value ;
                              item.ADJUSTAMOUNT=this.standardMoney(this.parser(item.REFUND_FEE) - item.REFUNDNUM * this.parser(item.PRICE));
                            }
                        })
                        // 截取数组
                        this.totalExchange=this.exchangeData.length;
                        let startIndex=this.pageSizeExchange*(this.exchangeCurrentPage-1)
                        let endIndex=startIndex+this.pageSizeExchange
                        this.currentExchangeData=this.exchangeData.slice(startIndex,endIndex)

                      }
                    }
                  },
                );
              },
          },
          {
              title: '店铺逻辑仓可用数',
              align: 'center',
              key: 'QTYFEE',
              render: (h, params) => {
                return h(
                  'div',
                  {
                    style: {
                      maxWidth:'385px',
                      overflow: 'hidden',
                      height:'18px'
                    },
                  },
                  [
                    h('Tooltip',
                      {
                        attrs: {
                          placement:"bottom",
                          content:params.row.TipList,
                          maxWidth:"385",
                          transfer:true,
                          delay:1000
                        },
                      },
                      [h(
                        'div',
                        {
                          style: {
                            cursor: 'pointer',
                            overflow: 'hidden',
                            maxWidth:'385px',
                            textOverflow:'ellipsis',
                            whiteSpace: 'nowrap'
                          },
                          props: {
                            value: params.row.QTYFEE,
                          },
                          on: {
                            mouseenter: () => {
                              this.getqtyfee(params)
                            }
                          }
                        },
                        [params.row.QTYFEE]
                      ),
                      h(
                      'div',
                      {
                        slot:"content",
                        domProps: {
                          innerHTML: params.row.TipList// 这里是要渲染的数据
                        }
                      },
                      ),
                      ],
                    ),
                  ]
                )
              },
          }
        ],
        // 批次/唯一码信息列表
        batchOrQrcodeColumns: [
          {
            type: 'index',
            title: '序号',
            align: 'left',
            width: '50',
          },
          {
            title: 'SKU',
            key: 'sku',
            align: 'center',
          },
          {
            title: '数量',
            key: 'num',
            align: 'center',
          },
          {
            title: '生产日期',
            key: 'productDate',
            align: 'center',
          },
          {
            title: '有效期',
            key: 'expireDate',
            align: 'center',
          },
          {
            title: '批次号',
            key: 'batchCode',
            align: 'center',
          },
          {
            title: '唯一码',
            key: 'sn',
            align: 'center',
          },
          {
            title: '商品标记',
            key: 'productmark',
            align: 'center',
          },
          {
            title: '第三方库存类型',
            key: 'thirdProductmark',
            align: 'center',
          },
          {
            title: '次品原因',
            key: 'defectiveCause',
            align: 'center',
          },
        ],
        batchOrQrcodeData: [], // 批次/唯一码信息列表数据
        currentExchangeData:[],//页面显示换货明细
        exchangeData:[],//所有换货明细
        originExchangeData:[],//原始数据
        exchangeDataNoSame:[],//弹窗中没有的换货商品
        submitArrExchange:[],//选中的换货商品
        // 换货商品page
        totalExchange: 0, // 总条数
        pageSizeExchange: 10, // 每页的条数
        exchangeCurrentPage: 1,

        highlightRow:true,//支持单选
        selectTableData:{},//选中的数据
        nowTab:'all',//默认当前tab页为全部
        lastTab:'',//上一个tab页
        deliverColumns: [
            {
                title: '订单编号',
                key: 'ID'
            },
            {
                title: '平台单号',
                key: 'TID'
            },
            {
                title: '物流单号',
                key: 'LOGISTICSNUMBER'
            },
            {
                title: '所有SKU',
                key: 'ALLSKU'
            },
            {
                title: '商品数量',
                key: 'ALLNUM'
            },
            {
                title: '订单总额',
                key: 'ORDERAMOUNT'
            }
        ],
        allFix:{
          OrderStatus:["=5","=6"]
        },//全部发货表格过滤条件
        warehouseFix:{ //仓库发货表格过滤条件
          OrderStatus: "=5"
        },
        platformFix:{ //平台发货表格过滤条件
          OrderStatus: "=6"
        },
        tableHeight:'200',//表格高度
        currentReturnData:[],//当前显示退款明细
        returnData:[],
        originReturnData:[],//原始数据
        returnDataNoSame:[],//弹窗中没有的退货商品
        submitArrReturn:[],//选中的退货商品
        // 退货商品page
        returnCurrentPage:1,
        totalReturn: 0, // 总条数
        // currentReturnPage:0,//页码
        pageSizeReturn: 10, // 每页的条数
        choosedSKU: '', // 选择的退回商品SKU
        //批次/唯一码table表
        batchOrQrcodeCurrentPage: 1,
        totalBatchOrQrcode: 0, // 总条数
        pageSizeBatchOrQrcode: 10, // 每页的条数

        // 日志page
        currentJournalPage: 0, // 页码
        pageSizeJournal: 10, // 每页的条数
        JournalCurrentPage:1,
        totalJournal: 0, // 总条数

        // 未发已退page
        currentUndeliveredAndReturnedPage: 1, // 页码
        pageSizeUndeliveredAndReturned: 10, // 每页的条数
        undeliveredAndReturnedCurrentPage:1,
        totalUndeliveredAndReturned: 0, // 总条数

        originalModal:false,//原始清单编号弹窗
        mask:true,
        closable: true,
        maskClosable: false,
        hideFoot: true,
        shrinkHeight: '58px',
        currentValue: false,//默认收缩
        originalOrderData:{
          ID:'',//订单编号
          TID:'',//平台单号
          LOGISTICSNUMBER: '',// 物流单号
          ALLSKU:'',//所有SKU
          RECEIVMOBILE:'',//收件人手机号码
          RECEIVNAME:'',//收件人
          USERNICK:'',//买家昵称
          // ORDERAMOUNT:'',//订单总额
          // ALLNUM:''//商品数量
        },
        selectGoodsModal:false,//选择商品弹窗
        nowGoodsType:'',//当前商品表类型
        selectGoodsData:{//选择商品搜索条件
          NORMS1NAME:'',//颜色
          NORMS2NAME:'',//尺寸
          SKU:'',//SKU
          GBCODE:'',//国标码
          // SELLPRICE:'',//销售价
          // BASEPRICE:'',//成本价
          PRODUCTCODE:'',//商品编码
          PRODUCTNAME:''//商品名称
        },
        submitArrGoods:[],//选择商品表格选中项
        SKUColumns:[
          // {
          //   type: 'selection',
          //   width: 60,
          //   align: 'center'
          // },
          {
            title: 'SKU',
            key: 'SKU'
          },
          {
            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: '图片地址',
          //   key: 'PICTUREURL',
          //   render: (h, params) => {
          //     const vm = this;
          //     return h(
          //       'Img',
          //       {
          //         style: {
          //           zIndex: 999,
          //           width:'60px',
          //           height:'60px'
          //         },
          //         attrs: {
          //           src:params.row.PICTUREURL==''?'/static/img/camera.png':params.row.PICTUREURL
          //         }
          //       },
          //     );
          //   },
          // },
          {
            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,

        // 是否已传WMS
        ISTOWMS:'',
        originLOGISTICSCOMPANYID:'',//原始退回物流公司
        originLOGISTICSCOMPANYNAME: '',
        originSID:'',//原始退回物流单号
        originIESWAREHOUSEID:'',//原始退回仓库

        OAID: '', // 存储OAID
        ISHAVEundeliveredAndReturned: false,
        defaultIndex: undefined,
        isFold: false, // 折叠批次信息
        tableStyleOne: 'width: calc(100% - 34px);', // 表格1样式
        tableStyleTwo: 'width: 0', // 表格2样式
        encryptColumns: [],
        disableColumns: [],
        // isGenerateRetail:false, // 【系统参数】退货入库是否生成零售

        IS_ABNORMALPACKAGE: 0, // 是否包裹异常
        showAudioPower: false, // 是否有售后审核（无AG）的权限

        ISUPDATEPLTLOGISTINFO: '', // 物流上传至平台
        showAudioPowerOne: false, // 是否有售后审核的权限
        showBatchAudit: false,// 审核按钮看是否有批量审核权限
        showSaveBtn: true, // 是否显示保存按钮
        BUYER_OPEN_UID: '', // 买家openid
        PLATFORM: '', // 退单平台
        returnToExchangePower: false, // 是否有退货转换货的权限

        returnToOnlyReturnMoneyPower: false, // 是否有退货转仅退款的权限

        returnToExchangeHandle: false, // 是否是退货转换货的保存
        IS_CHECK_RENUM: false, // 手工退单校验退回数量参数
        EXTSKUID:'', // 
        oldRECEIVEForm:{
          RECEIVNAME:'',
          RECEIVMOBILE:'',
          RECEIVPHONE:'',
          RECEIVADDRESS:'',
          RECEIVTOWN: '',
          RECEIVZIP: '',
        },
        carryMethod: 4, // 金额进位方式，保留2位小数还是4位小数,切换 原订单编号时会更新
      };
    },
    components: {
      foldPanel,
      ShrinkOrExtend,
      tableFaker
    },
    created(){
        this._initFormData={}
        this.clearPopTipList();
        if(this.type == 'list'){
          this.pageMsgId = this.OrderIdFromList;
        }else {
          this.pageMsgId = window.vm.$route.params.customizedModuleId;
        }
        this.tabListOld = JSON.parse(JSON.stringify(this.tabList))
        // this.pageMsgId = window.vm.$route.params.customizedModuleId;
        this.getPermission('showAudioPowerOne'); // 获取售后审核的功能权限
        this.getPermission('showAudioPower'); // 获取售后审核（无AG）的功能权限
        this.getPermission('returnToExchangePower'); // 获取退货转换货的功能权限
        this.getPermission('returnToOnlyReturnMoneyPower'); // 获取退货转仅退款的功能权限
        this.getPermission('showBatchAudit'); // 获取批量审核权限
        this.getQuery('T_V_OMSLOGISTICSCOMPANY',{isactive: ['=Y']})// 初始查询物流公司列表
        this.getQuery('T_V_IESSHOP')// 初始查询店铺名称列表
        this.getQuery('T_OMSREASONTYPE',{REFUNDTYPE:2})// 初始查询退换货原因
        // this.getobjectTab()//获取元数据权限
        this.getProvinceList()// 初始获取省列表
        // this.getQuery('T_IESWAREHOUSE')// 初始查询退货仓库
        this.getWAREHOUSE()// 初始查询退货仓库
        this.getRefundData()  //初始化查询退货表格数据
        this.getInitialData()  //初始化查询编辑数据
        this.getUndeliveredAndReturnedData() //初始化查询未发已退表格数据
        this.getJournalData()  //初始化查询日志数据
        this.getSystemParams()
    },
    mounted() {
      window.Light.init();
      // 计算文本在页面所占px宽度 -- 扩展String原型方法pxWidth
      String.prototype.pxWidth = function(font) {
        var canvas = String.prototype.pxWidth.canvas || (String.prototype.pxWidth.canvas = document.createElement("canvas")),
            context = canvas.getContext("2d");

        font && (context.font = font);
        var metrics = context.measureText(this);

        return metrics.width;
      }
    },
    methods: {
      getobjectTab(){
        // 获取元数据的配置权限
        network.post('/p/cs/objectTab', urlSearchParams({
          table:'T_V_OMSREFUNDORDERALL',
          objid:this.OrderIdFromList,
          ismaintable:'y'
        })).then((res) => {
            if(res.data.code == 0){
              const {tabcmd} = res.data.data;     
              if (tabcmd && tabcmd.cmds) {
                const index = tabcmd.cmds.findIndex(cmd => cmd === "actionMODIFY");
                if (index !== -1) {
                  this.showSaveBtn = tabcmd.prem[index] === true;
                } else {
                  this.showSaveBtn = true;
                }
              }
            
             
            }
         })

      },
      getPermission(type){
        if(type == 'showAudioPower') {
          let params = {
            "ad_table_id": 10612,
            "ad_action_id": 3956
          }
          network.post('/p/cs/group/have/permission', params).then((res) => {
            if(res.data.code == 0){
              this.showAudioPower = res.data.data
            }
          })
        }else if(type == 'showAudioPowerOne') {
          let params = {
            "ad_table_id": 10612,
            "ad_action_id": 2495
          }
          network.post('/p/cs/group/have/permission', params).then((res) => {
            if(res.data.code == 0){
              this.showAudioPowerOne = res.data.data
            }
          })
        }else if(type == 'returnToExchangePower'){
          let params = {
            "ad_table_id": 10612,
            "ad_action_id": 4026
          }
          network.post('/p/cs/group/have/permission', params).then((res) => {
            if(res.data.code == 0){
              this.returnToExchangePower = res.data.data
            }
          })
        }else if(type == 'returnToOnlyReturnMoneyPower') {
          let params = {
            "ad_table_id": 10612,
            "ad_action_id": 3966
          }
          network.post('/p/cs/group/have/permission', params).then((res) => {
            if(res.data.code == 0){
              this.returnToOnlyReturnMoneyPower = res.data.data
            }
          })
        } else if (type == 'showBatchAudit') {
          let params = {
            "ad_table_id": 10612,
            "ad_action_id": 3452
          }
          network.post('/p/cs/group/have/permission', params).then((res) => {
            if(res.data.code == 0){
              this.showBatchAudit = res.data.data
            }
          })
        }
      },
      getqtyfee(params) {
        if(params.row.TipList){
          return 
        }else {
          let TipList = '';
          let startIndex=this.pageSizeExchange*(this.exchangeCurrentPage-1)
          let endIndex=startIndex+this.pageSizeExchange
          params.row.QTYFEEITEM.forEach(item => {
            let tipsList = '<p>'+item.STORENAME+':'+item.QTYFEE+'</p>'
            TipList += tipsList;
          })
          this.exchangeData[params.index].TipList = TipList
          this.exchangeData = JSON.parse(JSON.stringify(this.exchangeData))
          this.currentExchangeData=this.exchangeData.slice(startIndex,endIndex)
          console.log(this.currentExchangeData)
        }
        
      },
      // 折叠信息
      foldTable() {
        this.isFold = !this.isFold
        this.setFold()
      },

        setFold() {
          if(this.isFold) {
            this.tableStyleOne = 'width: calc(100% - 34px);'
            this.tableStyleTwo = 'width: 0'
          } else {
            this.tableStyleOne = ''
            this.tableStyleTwo = ''
          }
        },

      // 获取当前设置的系统参数
    getSystemParams() {
      network.post('/p/cs/getSysParams').then(res => {
        if (res.data.code == 0) {
          let allParamsList = []
          res.data.data.forEach(item => {
            allParamsList=[...allParamsList,...item.sysParam]
          })
          allParamsList.forEach(param => {
            if(param.paraName == 'REFUND_BATCH_ISSHOW'){
              this.isFold = param.paraValue === 'True' ? false : true;
              this.setFold()
            }
          })
          console.log('系统配置', this.isFold)
        }
      })
    },

      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>`
                  }
                }),
              },
            })
          ]);
        }
      },

      clearPopTipList() {
        let getListReturnTableList = document.getElementsByClassName('getListReturnTable');
        for(let i=0;i<getListReturnTableList.length;i++){
          let objNode = getListReturnTableList[i].parentElement.parentElement.parentElement.parentElement
          objNode.style.display = 'none';
        }
      },
      // 点击跳转到快递100
      toExpressQuery(i){
        let params = {
          dataid: this.tabList[0].list.find(item=>item.SKEY=='id_number').VALUE,  // 退单单据编号
          datatype: 2
        }
        network.post('/p/cs/userclick/add',params).then(res => {}) // 点击跳转到快递100前记录点击信息
        if(i.VALUE){
          let text = i.VALUE
          let inputElement = document.createElement('input')
          inputElement.value = text;
          document.body.appendChild(inputElement);
          inputElement .select(); //选中文本
          document.execCommand("copy"); //执行浏览器复制命令
          inputElement.remove();
          if(i.EXPRESSQUERYADDRESS){
            window.open(i.EXPRESSQUERYADDRESS,'_blank') //+i.VALUE
            // R3.store.commit('global/tabOpen', {
            //   type: 'tableDetailAction' || 'C',
            //   label: '快递100查询',
            //   url: `/CUSTOMIZED/LINKTOKUSIDI/3677?EXPRESSQUERYADDRESS=${i.EXPRESSQUERYADDRESS}${i.ADDRESSFIELD}`,
            // });
          }else{
            this.$Message.warning('当前快递公司暂未维护，快递单号已复制到剪切板');
            setTimeout(()=>{
               window.open('https://www.kuaidi100.com/','_blank')
            },1000)
          }
        }
      },
      /**
       * 获取电商平台档案中订单发货流程校验省市区匹配系统地址
       * @param {*} str 
       * @returns 
       */
      async getPlatformInfo(option) {
        const { shopId } = option;
        if (!shopId) {
          return;
        }
        const params = {
          table: 'T_OMSPLATFORM',
          objid: shopId
        };
        const res = await network.post('/p/cs/getObject ', urlSearchParams(params))
        const resData = res.data || {};
        const { code, data } = resData || {};
        if (code == 0) {
          const forms = data.addcolums[0].childs;
          // 进位方式
          const calcItem = forms.find(item => item.colname === 'AMOUNT_SCALE');
          if (calcItem) {
            const calcVal = calcItem.valuedata;
            if (this.carryMethod !== calcVal) {
              this.carryMethod = calcVal;
            }
            console.log(this.carryMethod, 'wjf_carryMethod_02')
          }
        }
      },
      // 获取敏感列
      async getSensitiveColumns() {
        await network.post(`/p/cs/query/protect/column?hash=${+new Date()}`, {
          table: 'T_V_GETORDER'
        }).then(res=> {
          if (res.data.code == 0) {
            const data = res.data.data
            const encryptColumns = data.UNREADCOLUMUS // 加密字段
            const disableColumns = data.UNWRITECOLUMUS // 不可编辑字段
            this.encryptColumns = []
            this.disableColumns = []

            if(encryptColumns) {
              this.encryptColumns = encryptColumns.split(';')
            }

            if(disableColumns) {
              this.disableColumns = disableColumns.split(';')
            }
          }
        })
      },

      //查询编辑数据
        async getInitialData(){
          await this.getSensitiveColumns()
          let virtual={
            table: "T_V_OMSREFUNDORDERALL",
            objid: this.pageMsgId,
          }
          network.post('/p/cs/querySingleRefundOrder',virtual).then((res) => { // /p/cs/object/query
            console.log(res.data)
            let data=res.data
            this.OAID = data.OAID;
            this.ISTOWMS=data.ISTOWMS
            this.WMSCANCELSTATUS = data.WMSCANCELSTATUS
            this.IS_ABNORMALPACKAGE = data.IS_ABNORMALPACKAGE
            this.ISUPDATEPLTLOGISTINFO = data.ISUPDATEPLTLOGISTINFO?data.ISUPDATEPLTLOGISTINFO:''
            this.PLATFORM = data.PLATFORM?data.PLATFORM:''
            this.IS_CHECK_RENUM = data.IS_CHECK_RENUM
            this.saveArr.ORDERFROM=data.ORDERFROM
            this.saveArr.VIRSTATUS=data.VIRSTATUS
          //  if(this.ISTOWMS=='1'){ //已传wms
              this.originLOGISTICSCOMPANYID=data.LOGISTICSCOMPANYID==-1||!data.LOGISTICSCOMPANYID?'':data.LOGISTICSCOMPANYID.toString() //原始退回物流公司
              this.originLOGISTICSCOMPANYNAME = data['LOGISTICSCOMPANYID:NAME'] // 原始退回物流公司
              this.originSID=data.SID //原始退回物流单号
              this.originIESWAREHOUSEID=data.IESWAREHOUSEID==-1?'':data.IESWAREHOUSEID.toString() //原始退回仓库
          //  }
            this.refundablePostage=data.REFUNDSHIPAMOUNT
          //  this.otherAmount=data.REFUNDOTHERAMOUNT
          //  this.queryVirstatus=data['VIRSTATUS:DISPLAY']
            this.queryVirstatus=data.VIRSTATUS
            if(this.queryVirstatus=='60'){
            //  完成和取消状态 页面所有字段均不可编辑 保存按钮去掉
              this.allDisabled=true
              this.hideBtn=true
            }
            // 根据平台号获取对应字段值
            this.getPlatformInfo({ shopId: this.PLATFORM });
            this.checkMoney()
            if(data['REFUNDTYPE:DISPLAY']=='退换货'){
                // 删除是否拒收字段 退换货原因字段 平台退款单号
              this.tabList[0].list.find(item => item.SKEY=='is_refund_to_store').showTag = false;
              this.tabList[0].list.find(item => item.SKEY=='platform_refund_number').showTag = false;
              // this.tabList[0].list = this.tabList[0].list.filter(item => {
              //   return (item.SKEY!=='is_refund_to_store')&&(item.SKEY!=='platform_refund_number')
              // });
            }else if(data['REFUNDTYPE:DISPLAY']=='退货'){
              // 删除换货预留库存 换货邮费 平台换货单号
              this.tabList[0].list.find(item => item.SKEY=='exchange_reserved_stock').showTag = false;
              this.tabList[0].list.find(item => item.SKEY=='exchange_postage').showTag = false;
              this.tabList[0].list.find(item => item.SKEY=='platform_exchange_number').showTag = false;
              // this.tabList[0].list = this.tabList[0].list.filter(item => {
              //   return (item.SKEY!=='exchange_reserved_stock')&&(item.SKEY!=='exchange_postage')&&(item.SKEY!=='platform_exchange_number')
              // });
            }
            //添加退货表头字段
            if((this.queryVirstatus!=='50')&&(this.queryVirstatus!=='30')){
              // this.returnColumns.splice(11,0,obj)
              // (item.title!=='退回数量')&&
              this.returnColumns=this.returnColumns.filter(item=>{
                return (item.title!=='残次数量')&&(item.title!=='瑕疵数量')&&(item.title!=='次品原因')
              })
            }else if((this.queryVirstatus=='50')||(this.queryVirstatus=='30')){
              this.returnColumns = this.OldReturnColumns;
            }
            /**
             * 热修 1.45-唯品会退供单新增结算价,唯品会退货商品在PO后面追加唯品会订单号和净结算价显示
             */
            if (this.PLATFORM == 19) {
              const poIndex = this.returnColumns.findIndex(item => item.key === "PO");
              const appendHead = [
                {
                  title: '唯品会订单号',
                  align:'center',
                  key: 'ORDER_SN'
                },
                {
                  title: '净结算价',
                  align:'center',
                  key: 'PRICEACC'
                },
              ]
              // 插入新元素
              if (poIndex != -1) {
                // 因为splice的第二个参数是0，表示不删除元素，后面跟着要插入的元素
                this.returnColumns.splice(poIndex + 1, 0, ...appendHead);
              }
            }
            this.tabList[0].list.forEach((item,index)=>{
              if(item.SKEY=='buyer_nickname'){
                item.VALUE=data.BUYER_NICK
                this.BUYER_OPEN_UID = data.BUYER_OPEN_UID
                this.wangwangHtml = `<span class="J_WangWang" data-nick=${data.BUYER_NICK} data-encryptuid=${data.BUYER_OPEN_UID} data-bizdomain="taobao" data-appkey="12585822" data-biztype="1" data-sceneparam='{"toRole":"buyer"，"bizRef": ""}' data-icon="small"></span>`;
                setTimeout(() => {
                  window.Light.init();
                },200)
                if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')){
                    item.disabled=false
                }else{
                    item.disabled=true
                }
              }else if(item.SKEY=='platform_vip_code'){
                item.VALUE=data.PLATFORMVIPCODE
                if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')){
                  item.disabled=false
                }else{
                  item.disabled=true
                }
              }else if(item.SKEY=='original_order_number'){
                item.VALUE=data['ORIGINALORDERNO']
                if(item.VALUE){
                  item.explainContent='系统中的订单编号，非平台单号。'
                }else{
                  item.explainContent='未关联原单，无原订单编号。'
                }
              }else if(item.SKEY=='id_number'){ //单据编号
                item.VALUE=data.ID
              }else if(item.SKEY=='omsstoragein_id'){
                item.VALUE=data['OMSSTORAGEINID:ID']
                // item.VALUE = data.OMSSTORAGEINID
              }else if (item.SKEY == 'process_store_title') {
                item.VALUE = data.PROCESS_STORE_TITLE
              }else if (item.SKEY == 'process_storeId') {
                item.VALUE = data.PROCESS_STOREID
              }else if(item.SKEY=='original_platform_number'){
                // 平台单号
                item.VALUE=data.TID
              }else if(item.SKEY=='system_order'){
                // 系统单号
                item.VALUE=data.SOURCECODE
              }else if(item.SKEY=='shop_name'){
                if(data.SHOPID!=-1){
                  item.VALUE=data.SHOPID.toString()
                  item.optionList=[{
                    label:data['SHOPID:SHOPTITLE'],
                    value:data.SHOPID.toString()
                  }]
                }
              }else if(item.SKEY=='refund_type'){
                this.saveArr.REFUNDTYPE=data.REFUNDTYPE
                item.VALUE=data['REFUNDTYPE:DISPLAY']
                if(data['REFUNDTYPE:DISPLAY']=='退换货'){
                    this.getExchangeData() //查询换货表格数据
                }
              }else if(item.SKEY=='return_warehouse'){
                if(data.IESWAREHOUSEID!=-1){
                  item.VALUE=data.IESWAREHOUSEID.toString()
                  item.optionList=[{
                    label:data['IESWAREHOUSEID:WAREHOUSENAME'],
                    value:data.IESWAREHOUSEID.toString()
                  }]
                  // this.getQuery('T_IESWAREHOUSE')
                  this.getWAREHOUSE()// 初始查询退货仓库
                }
                  if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')){
                      item.disabled=false
                  }else{
                    item.disabled=true
                  }
              }else if(item.SKEY=='platform_refund_number'){//平台退款单号
                  item.VALUE=data.REFUND_ID
                  if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')){
                    item.disabled=false
                  }else{
                    item.disabled=true
                  }
              }else if(item.SKEY=='responsibility_person'){//担责人
                  item.VALUE=data.RESPONSIBILITYPERSON
                  if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')){
                    item.disabled=false
                  }else{
                    item.disabled=true
                  }
              }else if(item.SKEY == 'refund_pay_type'){
                  item.VALUE=data.REFUNDPAYTYPE
                  if(this.queryVirstatus=='50' || this.queryVirstatus=='60'){
                    item.disabled=true
                  }else{
                    item.disabled=false
                  }
              } else if(item.SKEY=='refund_delivery_type') {
                item.VALUE=data.REFUND_DELIVERY_TYPE // 退货方式
              } else if(item.SKEY=='tmall_mcard_pz_sp'){//权益金
                  item.VALUE=data.TMALL_MCARD_PZ_SP
              } else if(item.SKEY=='platform_exchange_number'){//平台换货单号
                  item.VALUE=data.DISPUTE_ID
                  if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')){
                    item.disabled=false
                  }else{
                    item.disabled=true
                  }
              }else if(item.SKEY=='refund_status'){
                item.VALUE=data['VIRSTATUS:DISPLAY']
                if(this.queryVirstatus=='30'){
                  this.canAfterSaleVerify=true //出现售后审核按钮
                }else{
                  this.canAfterSaleVerify=false //隐藏售后审核按钮
                }
                if(this.queryVirstatus=='1'){
                  this.canVerify=true //出现审核按钮
                }else{
                  this.canVerify=false //隐藏审核按钮
                }
              }else if(item.SKEY=='match_status'){
                item.VALUE=data['MATCHSTATUS:DISPLAY']
              }else if(item.SKEY=='return_logistics_company'){
                if(data.LOGISTICSCOMPANYID!=-1){
                  item.VALUE=data.LOGISTICSCOMPANYID.toString()
                  item.optionList=[{
                    label:data['LOGISTICSCOMPANYID:NAME'],
                    value:data.LOGISTICSCOMPANYID.toString()
                  }]
                }
                  if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')){
                      item.disabled=false
                  }else{
                    item.disabled=true
                  }
              }else if(item.SKEY=='reason_refund'){
                if(data.OMSREASONTYPEID!=-1){
                  item.VALUE=data.OMSREASONTYPEID.toString()
                  item.optionList=[{
                    label:data['OMSREASONTYPEID:NAME'],
                    value:data.OMSREASONTYPEID.toString()
                  }]
                  this.getQuery('T_OMSREASONTYPE',{REFUNDTYPE:2})
                }
                  if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')){
                    item.disabled=false
                  }else{
                    item.disabled=true
                  }
              }else if(item.SKEY=='is_refund_to_store'){
                item.VALUE=data.REFUNDTOSTORE=='1'?true:false
                if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')){
                    item.disabled=false
                }else{
                    item.disabled=true
                }
              }else if(item.SKEY=='exchange_reserved_stock'){// 接口开发新加
                item.VALUE=data.ISRESERVEDSTOCK=='1'?true:false
                // if((this.queryVirstatus=='10')||(this.queryVirstatus=='20')){
                //       item.disabled=false
                //   }else{
                      item.disabled=true
                  // }
              }else if(item.SKEY=='return_logistics_num'){
                item.VALUE=data.SID
                item.EXPRESSQUERYADDRESS=data.EXPRESSQUERYADDRESS //物流公司
                item.ADDRESSFIELD=data.ADDRESSFIELD // 物流查询参数
                let params = {
                    isactive: ['=Y']
                }
                if(this.saveArr.VIRSTATUS =='30' || this.saveArr.VIRSTATUS =='50'){
                  //VIRSTATUS 30和50 (等待售后确认和完成态)  退单状态下物流公司查询全部
                  params = {}
                }
                this.getQuery('T_V_OMSLOGISTICSCOMPANY',params)
                if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')){
                    item.disabled=false
                }else{
                    item.disabled=true
                }

              }else if(item.SKEY=='refund_reasons'){
                item.VALUE=data.REMARK
                if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')|| (this.queryVirstatus=='50')){
                    item.disabled=false
                }else{
                    item.disabled=true
                }
              }else if(item.SKEY=='refund_instructions'){
                item.VALUE=data.RETURNDESC
                if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')|| (this.queryVirstatus=='50')){
                    item.disabled=false
                }else{
                    item.disabled=true
                }
              }else if(item.SKEY=='buyer_message'){
                item.VALUE=data.BUYERMESSAGE
                if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')||(this.queryVirstatus=='30')|| (this.queryVirstatus=='50')){
                  item.disabled=false
                }else{
                    item.disabled=true
                }
              }else if(item.SKEY=='system_remarks'){
                item.VALUE=data.SYSREMARK
                    item.disabled=true
              }else if(item.SKEY=='exchange_postage'){
                if(!data.RECEIVSHIPAMOUNT){
                  data.RECEIVSHIPAMOUNT=0
                }
                item.VALUE=this.parser(data.RECEIVSHIPAMOUNT)
              } else if(item.SKEY=='BUYER_OPEN_UID'){
                item.VALUE=data.BUYER_OPEN_UID
              } else if(item.SKEY=='ALLHOSTNAME'){
                item.VALUE=data.ALLHOSTNAME
              } else if(item.SKEY=='ALLHOSTNO'){
                item.VALUE=data.ALLHOSTNO
              }
            })
            if(this.saveArr.REFUNDTYPE==2){
                  // 敏感列设置。不可见设置
                  if(this.encryptColumns.length > 0) {
                  const columns = this.encryptColumns
                  columns.forEach(col => {
                    data[col] = '***'
                  })
                  }
                  this._initFormData.mobile = res.data.RECEIVMOBILE
                  // 敏感列设置。不可见编辑
                  const disabledList = this.disableColumns
                //  let disabledList = []
                //  if(data.UNWRITECOLUMUS) {
                //     disabledList = data.UNWRITECOLUMUS.split(';')
                //  }

                  this.tabList[1].list.forEach(item=>{
                  if((this.queryVirstatus=='1') || (this.queryVirstatus=='10')||(this.queryVirstatus=='20')){
                      item.disabled=false
                  }else{
                    item.disabled=true
                  }
                  if(item.SKEY=='consignee_address'){
                      item.VALUE=data.RECEIVADDRESS
                      item.disabled=disabledList.includes('RECEIVADDRESS')
                  }else if(item.SKEY=='buyer_province'){
                      if(data.RECEIVPROVINCE.toString()!=-1){
                        this.tabList[1].list.forEach(item=>{
                          if(item.ID=='T_OMSREGION_CITY'){
                            item.optionList= [{
                                label:data['RECEIVPROVINCE:REGIONNAME'],
                                value:data.RECEIVPROVINCE.toString()
                              }]
                          }
                        })
                        item.VALUE=data.RECEIVPROVINCE.toString()
                        item.disabled=disabledList.includes('RECEIVPROVINCE')
                        this.saveArr.RECEIVPROVINCE=item.VALUE
                        this.saveArr.RECEIVPROVINCENAME=data['RECEIVPROVINCE:REGIONNAME']
                      this.getCityList(item.VALUE)
                      }
                  }else if(item.SKEY=='buyer_city'){
                      this.tabList[1].list.forEach(item=>{
                        if(item.ID=='T_OMSREGION_CITY'){
                          item.optionList= [{
                              label:data['RECEIVCITY:REGIONNAME'],
                              value:data.RECEIVCITY.toString()
                            }]
                        }
                      })
                      item.VALUE=data.RECEIVCITY.toString()
                      item.disabled=disabledList.includes('RECEIVCITY')
                      this.saveArr.RECEIVCITY=item.VALUE
                      this.saveArr.RECEIVCITYNAME=data['RECEIVCITY:REGIONNAME']
                      this.getAreaList(item.VALUE)
                  }else if(item.SKEY=='buyer_area'){
                    item.optionList= [{
                      label:data['RECEIVAREA:REGIONNAME'],
                      value:data.RECEIVAREA.toString()
                    }]
                    item.VALUE=data.RECEIVAREA.toString()
                    item.disabled=disabledList.includes('RECEIVAREA')
                    this.saveArr.RECEIVAREA=item.VALUE
                    this.saveArr.RECEIVAREANAME=data['RECEIVAREA:REGIONNAME']
                  }else if(item.SKEY=='buyer_town'){
                      item.VALUE = data.RECEIVTOWN
                      item.disabled=disabledList.includes('RECEIVTOWN')
                  }else if(item.SKEY=='consignee_zip_code'){
                      item.VALUE=data.RECEIVZIP
                      item.disabled=disabledList.includes('RECEIVZIP')
                  }else if(item.SKEY=='consignee_people'){
                      item.VALUE=data.RECEIVNAME
                      item.disabled=disabledList.includes('RECEIVNAME')
                  }else if(item.SKEY=='consignee_phone'){
                      item.VALUE=data.RECEIVPHONE
                      item.disabled=disabledList.includes('RECEIVPHONE')
                  }else if(item.SKEY=='consignee_mobile'){
                      item.VALUE=data.RECEIVMOBILE
                      item.disabled=disabledList.includes('RECEIVMOBILE')
                  }

              })
              //   // 等待售后确认状态基础信息不可编辑
              // if(data[0].VIRSTATUS.val=='等待售后确认'){
              //   this.tabList[1].list.forEach(item=>{
              //     item.disabled=true
              //   })
              // }
            }else{
              if(this.tabList[1].tabId=='2'){
                //  this.tabList.splice(1,1)
                this.tabList[1].blockShowOne = false;
              }
            }
            console.log(111,data)
            this.oldRECEIVEForm.RECEIVNAME = data.RECEIVNAME; // 收货人加密
            this.oldRECEIVEForm.RECEIVMOBILE = data.RECEIVMOBILE; // 收货人手机加密
            this.oldRECEIVEForm.RECEIVPHONE = data.RECEIVPHONE; // 收货人电话加密
            this.oldRECEIVEForm.RECEIVADDRESS = data.RECEIVADDRESS; // 收货人地址加密
            this.oldRECEIVEForm.RECEIVTOWN = data.RECEIVTOWN; 
            this.oldRECEIVEForm.RECEIVZIP = data.RECEIVZIP; // 收货人地址加密
            this.spinShow=false
          })
        },
        getRefundData(){
            let virtual={
                fixedcolumns: {OMSRefundOrderId: this.pageMsgId},
                range: 5000,//限制最多条数
                startindex: 0,
                table: "T_V_OMSRECEDEORDERPRODUCT",
            }
             network.post('/p/cs/list/query',virtual).then((res) => {
               this.totalReturn=res.data.total;
              let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
              let endIndex=startIndex+this.pageSizeReturn

                 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 == 'ISGIFT'){
                        res.data.rows[i][keyName] = res.data.rows[i][keyName].refobjval;
                      }else if(keyName == 'PICTUREURL') {
                        if(res.data.rows[i][keyName].val){
                          try {
                              let arr=JSON.parse(res.data.rows[i][keyName].val)
                              if(arr instanceof Array){
                                res.data.rows[i][keyName]=arr[0].URL
                              }
                          } catch (error) {
                            res.data.rows[i][keyName]=res.data.rows[i][keyName].val
                          }
                          
                        }else {
                          res.data.rows[i][keyName]=''
                        }
                      }else {
                        res.data.rows[i][keyName] = res.data.rows[i][keyName].val;
                      }
                    }

                    // 计算字符串的px长度
                   let arrpx= res.data.rows[i].QRCODE.pxWidth('normal 12px Robot')
                    if(arrpx>385){
                      res.data.rows[i].tip='数据超长，当前仅展示部分，点击可复制全部内容到剪切板'
                    }else{
                      res.data.rows[i].tip='点击可复制内容'
                    }
                    data.push(res.data.rows[i]);
                 }
                 this.originReturnData=JSON.parse(JSON.stringify(data))//保存时做对比
                 this.returnData=data
                 this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                 console.log(222333,this.currentReturnData)
                if(this.returnData.length){
                  this.refundableAmount=0
                  this.returnData.forEach(i=>{
                    i.RETURN_BALANCE = i.RETURN_BALANCE ? i.RETURN_BALANCE : '0.0000'
                    i.ISGIFT=(i.ISGIFT=='是'||i.ISGIFT==1)?1:0;
                    this.refundableAmount = this.standardMoney(this.parser(this.refundableAmount)+this.parser(i.REFUND_FEE)); //应退总金额

                    i.ADJUSTAMOUNT= this.standardMoney(this.parser(i.REFUND_FEE) - i.REFUNDNUM * this.parser(i.PRICE));
                  })
                  this.checkMoney()
                }
              // 获取第一条sku，请求批次/唯一码信息
              this.defaultIndex = 0;
              this.choosedSKU = this.currentReturnData[0].SKU;
              this.getBatchOrQRcodeList();
             })
        },
        // 深拷贝
        deepCopy(o, c) {
          var c = c || {}
          for (var i in o) {
              if (typeof o[i] === 'object') {
                  //要考虑深复制问题了
                  if (o[i].constructor === Array) {
                      //这是数组
                      c[i] = []
                  } else {
                      //这是对象
                      c[i] = {}
                  }
                  this.deepCopy(o[i], c[i])
              } else {
                  c[i] = o[i]
              }
          }
          return c
      },
      getUndeliveredAndReturnedData() { // 查询未发已退商品数据
        let virtual={
          id: this.pageMsgId,
          pageSize: this.pageSizeUndeliveredAndReturned,
          page:this.currentUndeliveredAndReturnedPage,
        }
        network.post('/p/cs/undeliveredReturned/goods',virtual).then((res) => {
          if(res.data.code == 0){
            this.totalUndeliveredAndReturned=res.data.data.total;
            res.data.data.resultList.forEach(item => {
              item.ISGIFT = item.ISGIFT == 1 ? '是':item.ISGIFT == 0?'否':''
            })
            this.undeliveredAndReturnedData=res.data.data.resultList
          }
          this.ISHAVEundeliveredAndReturned = true;
        })
      },
        getJournalData(){
            let virtual={
                fixedcolumns: {OMSRefundOrderId: [this.pageMsgId]},
                range: this.pageSizeJournal,
                startindex:this.currentJournalPage,
                table: "T_OMSREFUNDORDERLOGS",
                orderby: [{asc: false, column: "T_OMSREFUNDORDERLOGS.ID"}]
            }
             network.post('/p/cs/list/query',virtual).then((res) => {
                this.totalJournal=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.journalData=data
             })
        },
        getExchangeData(){
            let virtual={
                fixedcolumns: {OMSRefundOrderId: this.pageMsgId},
                range: 5000,
                startindex:0,
                table: "T_V_OMSCHANGEORDERPRODUCT",
            }
             network.post('/p/cs/refund/query/exchangeGoods',virtual).then((res) => { // /p/cs/list/query
                this.totalExchange=res.data.total;
                // 截取数组
                let startIndex=this.pageSizeExchange*(this.exchangeCurrentPage-1)
                let endIndex=startIndex+this.pageSizeExchange
                 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.exchangeData=data;
                 this.exchangeAmount=0
                 this.originExchangeData=JSON.parse(JSON.stringify(data))//保存时做对比
                 this.exchangeData.forEach(item=>{
                      this.exchangeAmount =this.standardMoney(this.parser(this.exchangeAmount)+this.parser(item.REFUND_FEE)) ;// safeFloat(item.PRICE) * safeNumber(refundNum);
                      this.checkMoney('exchangeAmount')
                      item.ADJUSTAMOUNT=this.standardMoney(this.parser(item.REFUND_FEE) - item.REFUNDNUM * this.parser(item.PRICE));
                  });

                this.currentExchangeData=this.exchangeData.slice(startIndex,endIndex)
             })
        },
      // 关闭当前页面
      closePage(){ 
        if(this.type == 'list'){
          this.$emit('closeOrderDetail',false)
        } else {
          if(this.returnToExchangeHandle){
            this.$Modal.fcWarning({
                title: '提示',
                mask: true,
                showCancel: true,
                content: '有修改的信息尚未保存，请确定是否返回？',
                onOk:()=>{
                  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_OMSREFUNDORDERALL',
                      tableId:'10612',
                      back:true
                    });
                  },0)
                }
            })
          }else {
            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_OMSREFUNDORDERALL',
                tableId:'10612',
                back:true
              });
            },0)
          }
        }
      },
      closePageOne() { // 售后审核后保留筛选条件刷新
        if(this.type == 'list'){
          this.$emit('closeOrderDetail',true)
          document.querySelector('#search').click(); // 标准列表查询按钮
        }else {
          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_OMSREFUNDORDERALL',
              tableId:'10612',
              back:true
            });
          },0)
        }
      },
      // 等待审核单审核
      toVerify() {
        let virtual={id:this.pageMsgId}
        network.post('/p/cs/refund/order/audit/single',virtual).then(res=>{
          if(res.data.code==0){
            this.$Message.success(res.data.message);
            this.getProvinceList()// 初始获取省列表

            this.getRefundData()  //初始化查询退货表格数据
            this.getInitialData()  //初始化查询编辑数据
            this.getJournalData()  //初始化查询日志数据}
          }else if(res.data.code==10){
             this.$Modal.fcWarning({
                  title: "审核",
                  content: res.data.message,
                  mask: true,
                  showCancel: true,
                  onOk:()=>{
                    network.post('/p/cs/refund/order/audit/confirm',{id:this.pageMsgId}).then(res=>{
                       if(res.data.code==0){
                          this.$Message.success('审核成功');
                          this.getQuery('T_V_OMSLOGISTICSCOMPANY',{isactive: ['=Y']})// 初始查询物流公司列表
                          this.getQuery('T_V_IESSHOP')// 初始查询店铺名称列表
                          this.getQuery('T_OMSREASONTYPE',{REFUNDTYPE:2})// 初始查询退换货原因
                          this.getProvinceList()// 初始获取省列表
                          // this.getQuery('T_IESWAREHOUSE')// 初始查询退货仓库
                          this.getWAREHOUSE()// 初始查询退货仓库

                          this.getRefundData()  //初始化查询退货表格数据
                          this.getInitialData()  //初始化查询编辑数据
                          this.getJournalData()  //初始化查询日志数据
                       }
                    })
                  },

              });
          }
        })
      },
      // 等待售后确认单审核
      toAfterSaleVerify(type){
        // this.pageMsgId
        let virtual={id:this.pageMsgId}
        if(type == 'noAg'){
          virtual.agPermissions = '1'
        }
        network.post('/p/cs/singleAuditRefund',virtual).then(res=>{
          if(res.data.code==0){
            this.$Message.success(res.data.message);
            this.getProvinceList()// 初始获取省列表

            this.getRefundData()  //初始化查询退货表格数据
            this.getInitialData()  //初始化查询编辑数据
            this.getJournalData()  //初始化查询日志数据}

            this.closePageOne(); // 返回列表页面并刷新

          }else if(res.data.code==-5){
            this.$Message.error(
              {
                content: res.data.message,
                duration: 3
              });
          }else if(res.data.code==-10){
            this.$Message.warning({
                content: res.data.message,
                duration: 3
              });
          }else if(res.data.code==10){
             this.$Modal.fcWarning({
                  title: "审核",
                  content: res.data.message,
                  mask: true,
                  showCancel: true,
                  onOk:()=>{
                    network.post('/p/cs/comfireAuditRefund',{id:this.pageMsgId}).then(res=>{
                       if(res.data.code==0){
                          this.$Message.success('审核成功');
                          this.getQuery('T_V_OMSLOGISTICSCOMPANY',{isactive: ['=Y']})// 初始查询物流公司列表
                          this.getQuery('T_V_IESSHOP')// 初始查询店铺名称列表
                          this.getQuery('T_OMSREASONTYPE',{REFUNDTYPE:2})// 初始查询退换货原因
                          this.getProvinceList()// 初始获取省列表
                          // this.getQuery('T_IESWAREHOUSE')// 初始查询退货仓库
                          this.getWAREHOUSE()// 初始查询退货仓库

                          this.getRefundData()  //初始化查询退货表格数据
                          this.getInitialData()  //初始化查询编辑数据
                          this.getJournalData()  //初始化查询日志数据

                          this.closePageOne(); // 返回列表页面并刷新
                       }
                    })
                  },

              });
          }
        })
      },
      //保存所有数据
      saveAll() {
        // 原订单编号
        this.saveArr.ORIGINALORDERNO=this.tabList[0].list.find(item=>item.SKEY=='original_order_number').VALUE
        this.saveArr.ID=this.tabList[0].list.find(item=>item.SKEY=='id_number').VALUE //单据编号新增字段
        this.saveArr.BUYER_OPEN_UID=this.tabList[0].list.find(item=>item.SKEY=='BUYER_OPEN_UID').VALUE //买家OPENID
        this.saveArr.ALLHOSTNAME=this.tabList[0].list.find(item=>item.SKEY=='ALLHOSTNAME').VALUE //主播ID
        this.saveArr.ALLHOSTNO=this.tabList[0].list.find(item=>item.SKEY=='ALLHOSTNO').VALUE //主播名称
        this.saveArr.BUYER_NICK=this.tabList[0].list.find(item=>item.SKEY=='buyer_nickname').VALUE //买家昵称
        this.saveArr.PLATFORMVIPCODE=this.tabList[0].list.find(item=>item.SKEY=='platform_vip_code').VALUE // 平台会员卡号
        this.saveArr.RESPONSIBILITYPERSON=this.tabList[0].list.find(item=>item.SKEY=='responsibility_person').VALUE//担责人
        this.saveArr.REFUNDPAYTYPE=this.tabList[0].list.find(item => item.SKEY == 'refund_pay_type').VALUE // 退款方式
        this.saveArr.REFUND_DELIVERY_TYPE=this.tabList[0].list.find(item => item.SKEY == 'refund_delivery_type').VALUE // 退货方式
        this.saveArr.TMALL_MCARD_PZ_SP=this.tabList[0].list.find(item=>item.SKEY=='tmall_mcard_pz_sp').VALUE // 权益金
        this.saveArr.REMARK=this.tabList[0].list.find(item=>item.SKEY=='refund_reasons').VALUE//内部备注
        this.saveArr.RETURNDESC=this.tabList[0].list.find(item=>item.SKEY=='refund_instructions').VALUE //退换货说明
        this.saveArr.BUYERMESSAGE=this.tabList[0].list.find(item=>item.SKEY=='buyer_message').VALUE //买家备注
        this.saveArr.SYSREMARK=this.tabList[0].list.find(item=>item.SKEY=='system_remarks').VALUE //系统备注
        this.saveArr.SHOPID=this.tabList[0].list.find(item=>item.SKEY=='shop_name').VALUE
        this.saveArr.SID=this.tabList[0].list.find(item=>item.SKEY=='return_logistics_num').VALUE
        this.saveArr.LOGISTICSCOMPANYID=this.tabList[0].list.find(item=>item.SKEY=='return_logistics_company').VALUE?this.tabList[0].list.find(item=>item.SKEY=='return_logistics_company').VALUE:-1//退回物流公司
        if(this.tabList[0].list.find(item=>item.SKEY=='return_logistics_company').VALUE){
          this.saveArr.COMPANY_NAME = this.tabList[0].list.find(item=>item.SKEY=='return_logistics_company').company?this.tabList[0].list.find(item=>item.SKEY=='return_logistics_company').company:this.originLOGISTICSCOMPANYNAME;
        }else {
          this.saveArr.COMPANY_NAME = '';
        }
        this.saveArr.SOURCECODE=this.tabList[0].list.find(item=>item.SKEY=='system_order').VALUE
        this.saveArr.IESWAREHOUSEID=this.tabList[0].list.find(item=>item.SKEY=='return_warehouse').VALUE //退货仓库 新加的
        //金额消除千分位
        this.saveArr.RefundShipAmount=this.parser(this.refundablePostage) // 应退邮费
        // this.saveArr.RefundOtherAmount=this.parser(this.otherAmount) // 其他金额
        if(this.saveArr.REFUNDTYPE==2){
          // 退换货单有换货预留库存
          this.saveArr.ISRESERVEDSTOCK=this.tabList[0].list.find(item=>item.SKEY=='exchange_reserved_stock').VALUE?1:0
          this.saveArr.RECEIVSHIPAMOUNT=this.tabList[0].list.find(item=>item.SKEY=='exchange_postage').VALUE //换货邮费
          this.saveArr.DISPUTE_ID=this.tabList[0].list.find(item=>item.SKEY=='platform_exchange_number').VALUE //平台换货单号
          this.saveArr.RECEIVTOWN = this.tabList[1].list.find(item=>item.SKEY=='buyer_town').VALUE
          this.saveArr.RECEIVADDRESS=this.tabList[1].list.find(item=>item.SKEY=='consignee_address').VALUE
          this.saveArr.RECEIVNAME=this.tabList[1].list.find(item=>item.SKEY=='consignee_people').VALUE
          this.saveArr.RECEIVMOBILE=this.tabList[1].list.find(item=>item.SKEY=='consignee_mobile').VALUE
          this.saveArr.RECEIVPHONE=this.tabList[1].list.find(item=>item.SKEY=='consignee_phone').VALUE
          this.saveArr.RECEIVZIP=this.tabList[1].list.find(item=>item.SKEY=='consignee_zip_code').VALUE
          if(this.returnToExchangeHandle){
            if(!this.saveArr.RECEIVNAME){
              this.$Message.warning('请填写换货/收货人！');
              return
            }
            if(!this.saveArr.RECEIVMOBILE){
              this.$Message.warning('请填写换货/收货人手机！');
              return
            }
            if(!this.saveArr.RECEIVPROVINCE){
              this.$Message.warning('请选择收件人省！');
              return
            }
            if(!this.saveArr.RECEIVCITY){
              this.$Message.warning('请选择收件人市');
              return
            }
            if(!this.saveArr.RECEIVADDRESS){
              this.$Message.warning('请填写收货人地址');
              return
            }
            if(this.exchangeData.length == 0){
              this.$Message.warning('换货商品不能为空');
              return
            }
          }else {
            if(!this.saveArr.RECEIVNAME){
              this.$Message.warning('请填写换货收货人');
              return
            }
            if(!this.saveArr.RECEIVMOBILE && !this.saveArr.RECEIVPHONE){
              this.$Message.warning('请填写换货/收货人手机或者换货/收货人电话');
              return
            }
            if(!this.saveArr.RECEIVPROVINCE){
              this.$Message.warning('请选择收件人省');
              return
            }
            if(!this.saveArr.RECEIVCITY){
              this.$Message.warning('请选择收件人市');
              return
            }
            if(!this.saveArr.RECEIVADDRESS){
              this.$Message.warning('请填写换货/收货人地址');
              return
            }
            if(this.returnData.length == 0 && this.exchangeData.length == 0){
              this.$Message.warning('退货商品和换货商品不能同时为空');
              return
            }
          }
        }else{
          // 退货单有是否拒收
          this.saveArr.REFUNDTOSTORE=this.tabList[0].list.find(item=>item.SKEY=='is_refund_to_store').VALUE?1:0
          this.saveArr.OMSREASONTYPEID=this.tabList[0].list.find(item=>item.SKEY=='reason_refund').VALUE //退换货原因
          this.saveArr.REFUND_ID=this.tabList[0].list.find(item=>item.SKEY=='platform_refund_number').VALUE
        }
        if(this.ISTOWMS=='1' && this.WMSCANCELSTATUS != '1'){//已传wms退单，不能直接修改商品
          // originLOGISTICSCOMPANYID:''//原始退回物流公司
          // originSID:'',//原始退回物流单号
          if(this.saveArr.LOGISTICSCOMPANYID === -1 && this.originLOGISTICSCOMPANYID === ''){
              // 兼容老的数据，这种场景默认物流公司未修改
          }else{
            /**
             * 退回物流公司ID 不等于 原始退回物流公司ID 或者
             * 退回仓库ID 不等于 原始原始退回仓库ID 或者
             * 退回物流单号 不等于 原始退回物流单号
             */
            if((this.saveArr.LOGISTICSCOMPANYID!=this.originLOGISTICSCOMPANYID)||
              (this.saveArr.IESWAREHOUSEID!=this.originIESWAREHOUSEID)||
              (this.saveArr.SID!=this.originSID)){
              this.$Modal.fcError({
                title: '提示',
                content: '修改失败，已通知WMS进行入库，如需修改商品、物流公司、物流单号、退回仓库，请操作按钮【WMS操作-撤回并复制】！',
                mask:true
              });
              return
            }
          }
        }
        if(!this.saveArr.IESWAREHOUSEID){
          this.$Message.warning('退回仓库不能为空');
          return;
        }
        let ss = /[*]+/;
        let isChangeReceiveForm = false;
        console.log(this.oldRECEIVEForm)
        console.log(this.saveArr)
        if((this.saveArr.RECEIVADDRESS != this.oldRECEIVEForm.RECEIVADDRESS)||(this.saveArr.RECEIVNAME != this.oldRECEIVEForm.RECEIVNAME)||(this.saveArr.RECEIVMOBILE != this.oldRECEIVEForm.RECEIVMOBILE)||(this.saveArr.RECEIVPHONE != this.oldRECEIVEForm.RECEIVPHONE)||(this.saveArr.RECEIVTOWN != this.oldRECEIVEForm.RECEIVTOWN)||(this.saveArr.RECEIVZIP != this.oldRECEIVEForm.RECEIVZIP)){
          isChangeReceiveForm=true;
        }
        console.log(isChangeReceiveForm)
        let r = !this.OAID && (ss.test(this.saveArr.RECEIVADDRESS) || ss.test(this.saveArr.RECEIVNAME) || ss.test(this.saveArr.RECEIVPHONE)|| ss.test(this.saveArr.RECEIVTOWN)|| ss.test(this.saveArr.RECEIVZIP));
        if (r && isChangeReceiveForm) {
          this.$Message.warning('收货人信息不能存在*号');
          return;
        }
        if(this.encryptColumns.includes('RECEIVMOBILE') || this.disableColumns.includes('RECEIVMOBILE')) {
          // 如果是敏感列
          // 被修改过就不能包含*
          if(this.saveArr.RECEIVMOBILE !== this._initFormData.mobile && isChangeReceiveForm) {
            if(ss.test(this.saveArr.RECEIVMOBILE)) {
              this.$Message.error('收货人信息不能存在*号');
              return;
            }
          } else {
            // 没有被修改过，就不处理
          }
        } else {
          // 如果不是敏感列,正常检测
          if(ss.test(this.saveArr.RECEIVMOBILE) && isChangeReceiveForm) {
            this.$Message.warning('收货人信息不能存在*号');
            return;
          }
        }
        let reg = RegExp(/(~{2,}|\${2,}|#{2,}|&{2,})/);
        let judge1=reg.test(this.saveArr.RECEIVADDRESS)||reg.test(this.saveArr.RECEIVNAME) ||reg.test(this.saveArr.RECEIVPHONE) ||reg.test(this.saveArr.RECEIVMOBILE);
        if(judge1){
          this.$Message.warning('收货人信息不能存在##,~~,&&,$$号');
          return;
        }
        this.submitData()
      },
      getdiffrent(arr, arr1) { // 获取两个数组不同项
        let c = [...arr, ...arr1];
        let d = new Set(c);
        let e = Array.from(d);
        let f = [...e.filter(_ => !arr.includes(_)), ...e.filter(_ => !arr1.includes(_))];
        return f;
      },
      uniq(arr, arr1) { // 数组去重
        const temp = [];
        const index = [];
        const array = [...arr, ...arr1];
        const l = array.length;
        for (let i = 0; i < l; i++) {
          for (let j = i + 1; j < l; j++) {
            if (array[i].ID === array[j].ID) {
              i++;
              j = i;
            }
          }
          temp.push(array[i]);
          index.push(i);
        }
        return temp;
      },
      submitData(){
        // 退货
        let returnDeleteData = [...this.originReturnData].filter(x => [...this.returnData].every(y => y.ID !== x.ID));
        let returnAddData = [...this.returnData].filter(x => [...this.originReturnData].every(y => y.ID !== x.ID));
        let returnUpdateData=[]
        this.returnData.forEach(item => {
          this.originReturnData.forEach(item1 => {
            if(item.ID == item1.ID){
              if((item.REFUND_FEE !== item1.REFUND_FEE) || (item.REFUNDNUM !== item1.REFUNDNUM) || (item.ORDERPRODUCTNUM   !== item1.ORDERPRODUCTNUM  ) || (item.ORDERPRODUCAMOUNT !== item1.ORDERPRODUCAMOUNT)|| (item.ISGIFT !== item1.ISGIFT) || (item.PO !== item1.PO)){
                returnUpdateData.push(item)
              }
            }
          })
        })
        if(this.saveArr.ORIGINALORDERNO && this.IS_CHECK_RENUM==1 && this.saveArr.ORDERFROM == '手工新增'){ // 数量校验只针对有原单数据
          for(let i=0;i<this.returnData.length;i++){
            if(this.saveArr.ORIGINALORDERNO){ // 数量校验只针对有原单数据
              if(this.returnData[i].ORDERPRODUCTNUM && (this.returnData[i].REFUNDNUM>this.returnData[i].ORDERPRODUCTNUM)){
                return this.$Modal.fcWarning({
                  title: '警告',
                  mask: true,
                  content: '【'+this.returnData[i].SKU+'】申请数量不能大于订单商品数量，请修改后保存'
                });
              }
            }
          }
        }
        // if(this.saveArr.ORIGINALORDERNO){
          for(let i=0;i<this.returnData.length;i++){ // 退单金额针对搜有数据
            // if(!this.returnData[i].REFUND_FEE){
            //   return this.$Modal.fcWarning({
            //     title: '警告',
            //     mask: true,
            //     content: '请填写退款金额!'
            //   });
            // }
            if(String(this.returnData[i].REFUND_FEE)=='' || this.returnData[i].REFUND_FEE==undefined|| this.returnData[i].REFUND_FEE==null){
              return this.$Modal.fcWarning({
                title: '警告',
                mask: true,
                content: '请填写退款金额!'
              });
            }
          }

        // }
        
        returnAddData.forEach(i=>i.ROWSTATUS='CREATE')
        returnDeleteData.forEach(i=>i.ROWSTATUS='DELETE')
        returnUpdateData.forEach(i=>i.ROWSTATUS='UPDATE')
        let OMSRECEDEORDERPRODUCT=[...returnAddData,...returnDeleteData,...returnUpdateData]
        OMSRECEDEORDERPRODUCT=OMSRECEDEORDERPRODUCT.map(item=>{
          return {
            ID:item.ROWSTATUS=='CREATE'?undefined:item.ID,
            TITLE:item.TITLE,
            PRODUCTCODE:item.PRODUCTCODE,
            SKU:item.SKU,
            GBCODE:item.GBCODE,
            NORMSDETAILNAMES:item.NORMSDETAILNAMES,
            PRICE:item.PRICE,
            ORDERPRODUCTNUM:item.ORDERPRODUCTNUM, //订单商品数量
            ORDERPRODUCAMOUNT:this.parser(item.ORDERPRODUCAMOUNT), //订单成交金额 消除千分位
            REFUNDNUM:item.REFUNDNUM, //申请数量
            // INSTORENUM:item.INSTORENUM, //退回数量
            ISGIFT:item.ISGIFT, //是否赠品
            REFUND_FEE:this.parser(item.REFUND_FEE), //退款金额
            // XCP_NUM:item.XCP_NUM, //瑕疵数量
            // CCP_NUM:item.CCP_NUM, //残次数量
            PO: item.PO, // po单号
            ROWSTATUS:item.ROWSTATUS,
            RETURN_BALANCE: item.RETURN_BALANCE
          }
        })

        //换货
        let exchangeDeleteData = [...this.originExchangeData].filter(x => [...this.exchangeData].every(y => y.ID !== x.ID));
        let exchangeAddData = [...this.exchangeData].filter(x => [...this.originExchangeData].every(y => y.ID !== x.ID));
        let exchangeUpdateData=[]
        this.exchangeData.forEach(item => {
          this.originExchangeData.forEach(item1 => {
            if(item.ID == item1.ID){
              if((item.REFUND_FEE !== item1.REFUND_FEE) || (item.REFUNDNUM !== item1.REFUNDNUM)){
                exchangeUpdateData.push(item)
              }
            }
          })
        })
        if(this.returnToExchangeHandle){ // 数量校验只针对有原单数据
          for(let i=0;i<this.exchangeData.length;i++){
            if(!this.exchangeData[i].REFUND_FEE || !this.exchangeData[i].REFUNDNUM){
              // this.$Message.warning('请填写换货信息！');
              this.$Message.warning('存在换货商品未填写换货金额或换货数量！');
              return
            }
          }
        }
        exchangeAddData.forEach(i=>i.ROWSTATUS='CREATE')
        exchangeDeleteData.forEach(i=>i.ROWSTATUS='DELETE')
        exchangeUpdateData.forEach(i=>i.ROWSTATUS='UPDATE')
        let OMSCHANGEORDERPRODUCT=[...exchangeAddData,...exchangeDeleteData,...exchangeUpdateData]
        OMSCHANGEORDERPRODUCT=OMSCHANGEORDERPRODUCT.map(item=>{
          return {
            ID:item.ROWSTATUS=='CREATE'?undefined:item.ID,
            TITLE:item.TITLE,
            PRODUCTCODE:item.PRODUCTCODE,
            SKU:item.SKU,
            GBCODE:item.GBCODE,
            NORMSDETAILNAMES:item.NORMSDETAILNAMES,
            PRICE:item.PRICE,
            REFUND_FEE:this.parser(item.REFUND_FEE),
            REFUNDNUM:item.REFUNDNUM,
            ROWSTATUS:item.ROWSTATUS
          }
        })
        let virtual={
            REFUNDORDERID: this.pageMsgId,
            OMSCHANGEORDERPRODUCT: OMSCHANGEORDERPRODUCT,
            OMSRECEDEORDERPRODUCT: OMSRECEDEORDERPRODUCT,
            OMSREFUNDORDER:this.saveArr,
            T_OMSRefundOrderLogs: []
        }
        if(this.returnToExchangeHandle){
          virtual.CVTTYPE = 2;
          network.post('/p/cs/refundorder/refundtoexchange',virtual).then(res=>{
              if(res.data.code==0){
                this.$Message.success('修改成功');
                this.returnToExchangeHandle = false;
              }else{
                this.$Message.error(res.data.Message);
              }
              this.getRefundData()  //初始化查询退货表格数据
              this.getInitialData()  //初始化查询编辑数据
              this.getJournalData()  //初始化查询日志数据
          })
        }else {
          network.post('/p/cs/updateOmsRefundOrder',virtual).then(res=>{
              if(res.data.Code==0){
                // this.setReturnOrderLog(returnAddData,returnDeleteData,returnUpdateData);
                if(res.data.objId != '-1'){
                  this.jumpNewOrder=true
                  setTimeout(()=>{
                    this.jumpNewOrder=false
                    const { fullPath } = this.$route;
                    const {
                      keepAliveModuleName,
                      tableName,
                    } = this.$store.state.global.activeTab;
                    this.$store.commit('global/tabCloseAppoint', {
                      tableName,
                      routeFullPath: fullPath,
                      keepAliveModuleName,
                      // stopRouterPush: true,
                    });
                    // 跳转
                    R3.store.commit('global/tabOpen', {
                      type: 'tableDetailAction' || 'C',
                      label: '退换货单编辑',
                      customizedModuleName: 'REFUNDUPDATE',
                      customizedModuleId: res.data.objId,
                    })
                  },2000)
                }else {
                  this.$Message.success('修改成功');
                }
              }else{
                this.$Message.error(res.data.Message);
              }
                this.getRefundData()  //初始化查询退货表格数据
                this.getInitialData()  //初始化查询编辑数据
                this.getJournalData()  //初始化查询日志数据
          })
        }
      },
      setReturnOrderLog(returnAddData,returnDeleteData,returnUpdateData) { // 修改退单写入日志
        let str = '';
        if(returnAddData.length > 0) {
          let addskuStr = ''
          returnAddData.forEach((item,index) => {
            if(index != returnAddData.length - 1){
              addskuStr += item.SKU + ','
            }else {
              addskuStr += item.SKU
            }
          })
          str += '新增退回商品【'+addskuStr+'】'
        }
        if(returnDeleteData.length > 0) {
          let delskuStr = ''
          returnDeleteData.forEach((item,index) => {
            if(index != returnDeleteData.length - 1){
              delskuStr += item.SKU + ','
            }else {
              delskuStr += item.SKU
            }
          })
          str += '删除退回商品【'+delskuStr+'】'
        }
        if(returnUpdateData.length > 0) {
          let updateskuStr = '';
          returnUpdateData.forEach(item => {
            this.originReturnData.forEach(item1 => {
              if(item.ID == item1.ID){
                if(item.ORDERPRODUCTNUM !== item1.ORDERPRODUCTNUM){
                  updateskuStr += '退回商品【'+item.SKU+'】【订单商品数量】由【'+item1.ORDERPRODUCTNUM+'】修改为【'+item.ORDERPRODUCTNUM+'】'
                }
                if(item.REFUNDNUM !== item1.REFUNDNUM){
                  updateskuStr += '退回商品【'+item.SKU+'】【申请数量】由【'+item1.REFUNDNUM+'】修改为【'+item.REFUNDNUM+'】'
                }
              }
            })
          })
          str += updateskuStr
        }
        let msg={
          "id": this.pageMsgId,
          "logType": "修改退换货单",
          "orderType": 2,
          "message": str
        }
        network.post('/p/cs/order/save/log', msg).then((resLog) => {
          if(resLog.data.code==0){

          }else {

          }
        })
      },
      // 获取退货表格所有SKU
      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
                }
              })
              this.SKUAllDataReturn=res.data.Rows
              // if(this.SKUAllDataReturn.length == 1){
              //   this.selectReturnSKUData=this.SKUAllDataReturn[0] //添加的数据
              //   this.selectReturnSKUID=this.selectReturnSKUData.ID //双向数据绑定
              //   // this.addReturnGoods();
              // }
            }else{
              this.SKUArrReturn=[]
              this.SKUAllDataReturn=[]
            }
          })
      },
      selectReturnGoods(val){
        if(this.selectReturnSKUID){
          this.selectReturnSKUData=this.SKUAllDataReturn.find(item=>{
            return item.ID==val
          })
        }else{
          this.selectReturnSKUData={}
        }
      },
      // 添加退货商品到表格
      addReturnGoods(val){
          if(JSON.stringify(this.selectReturnSKUData)=='{}'){
            this.$Message.warning('添加条码不能为空');
            return
          }
          let obj=this.selectReturnSKUData
          if (this.returnGoodsNum) {
            if(obj){
              if(obj['PICTUREURL']) {
                try {
                  let arr=JSON.parse(obj['PICTUREURL'])
                  if(arr instanceof Array){
                    obj['PICTUREURL']=arr[0].URL
                  }
                } catch (error) {
                  obj['PICTUREURL']=obj['PICTUREURL']
                }
              }else {
                obj['PICTUREURL'] = ''
              }
              let addData= {
                  BASEPRICE:obj.BASEPRICE,
                  TITLE:obj.SKUNAME,
                  PRODUCTCODE:obj.PRODUCTCODE,
                  SKU:obj.SKU,
                  GBCODE:obj.GBCODE?obj.GBCODE:'',
                  NORMSDETAILNAMES:obj.NORMSDETAILNAMES,
                  SHOWNORMSDETAILNAMES: obj.NORMS2NAME +'('+obj.NORMS2CODE+'),'+obj.NORMS1NAME, // obj.NORMSDETAILNAMES
                  BRANDNAME:obj.BRANDNAME,
                  PRICE:obj.SELLPRICE,
                  ISGIFT:obj.ISGIFT?obj.ISGIFT:0,
                  ID:obj.ID,
                  PICTUREURL:obj.PICTUREURL
                  // PRODUCTMARK:1, //商品标记
                  // ISRETURNGOODS = 0,
                }
                console.log(222,addData)
                if(this.returnData.length){
                  let sameData=this.returnData.find(i=>i.SKU==obj.SKU&&i.ID==obj.ID)
                  if(!sameData){
                    addData.NUM=this.returnGoodsNum//可退数量,
                    addData.REFUNDNUM=this.returnGoodsNum
                    addData.REFUND_FEE='' // this.standardMoney(addData.BASEPRICE * addData.NUM),
                    addData.ADJUSTAMOUNT=(addData.BASEPRICE - addData.PRICE) * addData.NUM,
                    this.returnData=[...this.returnData,addData]
                  }else{
                    this.returnData.forEach(item=>{
                      if(obj.SKU==item.SKU&&obj.ID==item.ID){
                        let REFUNDNUM=item.REFUNDNUM
                        let NUM=item.NUM
                        item=sameData
                        item.REFUNDNUM=(+REFUNDNUM)+this.returnGoodsNum
                        item.NUM=(+NUM)+this.returnGoodsNum//可退数量,
                        item.REFUND_FEE='' // this.standardMoney(item.BASEPRICE * item.NUM)
                        item.ADJUSTAMOUNT=(item.BASEPRICE?item.BASEPRICE:0 - item.PRICE) * item.NUM
                      }
                    })
                  }

                }else{
                  addData.REFUNDNUM=this.returnGoodsNum
                  addData.NUM=this.returnGoodsNum//可退数量,
                  addData.REFUND_FEE='' // this.standardMoney(addData.BASEPRICE * addData.NUM),
                  addData.ADJUSTAMOUNT=(addData.BASEPRICE - addData.PRICE) * addData.NUM,
                  this.returnData=[...this.returnData,addData]
                }
                this.refundableAmount=0
                this.returnGoodsNum=1
                this.returnData.forEach(i=>{
                    this.refundableAmount = this.standardMoney(this.parser(this.refundableAmount)+this.parser(i.REFUND_FEE)); //应退总金额
                })
                this.checkMoney()
                this.totalReturn=this.returnData.length
                 if(this.totalReturn){ //翻页
                    this.returnCurrentPage=parseInt((this.totalReturn-1)/this.pageSizeReturn)+1
                }
                // 截取数组
                let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
                let endIndex=startIndex+this.pageSizeReturn
                this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
                this.currentReturnData.forEach((item,index) => {
                  if(this.currentReturnData.SKU == this.choosedSKU){
                    this.defaultIndex = index;
                  }
                })
                this.$refs.returnSelect.clearSingleSelect()

                this.selectReturnSKUData = {};
                this.selectReturnSKUID = '';

            }
          }else{
            this.$Message.warning('请输入数量');
          }

      },
      addEnterReturnGoods(val){  // select框enter触发事件
          let virtual={sku: val.target.value,type: '1'}
          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
                }
              })
              this.SKUAllDataReturn=res.data.Rows
              if(this.SKUAllDataReturn.length == 1){
                this.selectReturnSKUData=this.SKUAllDataReturn[0] //添加的数据
                this.selectReturnSKUID=this.selectReturnSKUData.ID //双向数据绑定
                this.addReturnGoods();
              }else {
                this.$Message.warning('添加条码不能为空');
                return
              }
            }else{
              this.SKUArrReturn=[]
              this.SKUAllDataReturn=[]
            }
          })

      },
      //从当前行获取当前的指定字段的值 如果该字段正在编辑 则取出正在编辑的值，否则返回行中的值
      //如果返回值为null 则返回默认值
      getRowValue(selector, field, row, defv) {
          var v = null;
          var dgv = $(selector);
          var ind = dgv.datagrid('getRowIndex', row);
          var editor = dgv.datagrid('getEditor', { index: ind, field: field });
          if (editor != null) {
              v = editor.actions.getValue(editor.target);
          } else {
              v = row[field];
          }
          return v || defv;
      },
      //在添加换货商品的时候 ，根据商品编码与退货商品进行匹配 自动填充调整金额与退货金额
      getCacuItemByProductCode(item) {
        let refunds=this.returnData //退货商品表格数据
        var pc1 = (item.PRODUCTCODE || '').replace(/\s/g, '');
        var pc2 = null;
        var refund = null;
        for (var i = 0, k = refunds.length; i < k; i++) {
            refund = refunds[i];
            pc2 = (refund.PRODUCTCODE || '').replace(/\s/g, '');

            if (pc1 == pc2) {
                var refundnum =refund.REFUNDNUM?refund.REFUNDNUM:0
                if (refundnum == 0) {
                    //退货商品还没填写退货申请数量,商品金额可能会和退货商品不一致,请注意
                    this.$Message.warning('退货商品还没填写退货申请数量,商品金额可能会和退货商品不一致,请注意');
                }
                item.PRICE = refund.PRICE;
                item.REFUND_FEE = refund.REFUND_FEE;
                item.REFUNDNUM = refund.REFUNDNUM;
                item.ADJUSTAMOUNT = refund.REFUND_FEE - item.REFUNDNUM * item.PRICE;
                break;
            }
        }
    },
      // 获取换货表格所有SKU
      getSkuList(val){
         let virtual={sku: val}
          network.post('/p/cs/getIesSku', virtual).then((res) => {
            if(res.data.Code==0){
              this.SKUArr=res.data.Rows.map(i=>{
                return {
                  label:i.SKU,
                  value:i.ID
                }
              })
              this.SKUAllData=res.data.Rows
              // if(this.SKUAllData.length == 1){
              //   this.selectSKUData=this.SKUAllData[0] //添加的数据
              //   this.selectSKUID=this.selectSKUData.ID //双向数据绑定

              //   // this.addGoods();
              // }
            }else{
              this.SKUArr=[]
              this.SKUAllData=[]
            }
          })
      },
      selectSkuGoods(val){
        if(this.selectSKUID){
          this.selectSKUData=this.SKUAllData.find(item=>{
            return item.ID==val
          })
        }else{
          this.selectSKUData={}
        }

      },
      // 添加换货商品到表格
      addGoods(val){
          // let obj=this.SKUAllData.find(item=>{
          //   return item.ID==val
          // })

          if(JSON.stringify(this.selectSKUData)=='{}'){
            this.$Message.warning('添加条码不能为空');
            return
          }
          let obj=this.selectSKUData
          if (this.exchangeGoodsNum) {
            if(obj){
              let addData= {
                  TITLE:obj.SKUNAME,
                  PRODUCTCODE:obj.PRODUCTCODE,
                  SKU:obj.SKU,
                  GBCODE:obj.GBCODE?obj.GBCODE:'',
                  NORMSDETAILNAMES:obj.NORMSDETAILNAMES,
                  SHOWNORMSDETAILNAMES: obj.NORMS2NAME +'('+obj.NORMS2CODE+'),'+obj.NORMS1NAME, // obj.NORMSDETAILNAMES
                  PRICE:obj.SELLPRICE,
                  ADJUSTAMOUNT: 0,
                }
                if(this.exchangeData.length){
                  let sameData=this.exchangeData.find(i=>i.SKU==obj.SKU)
                  if(!sameData){
                    addData.REFUND_FEE=this.standardMoney(0)
                    addData.REFUNDNUM=this.exchangeGoodsNum
                    this.getCacuItemByProductCode(addData)
                    this.exchangeData=[...this.exchangeData,addData]
                  }else{
                    this.exchangeData.forEach(item=>{
                      if(obj.SKU==item.SKU){
                        let REFUNDNUM=item.REFUNDNUM
                        item=sameData
                        item.REFUNDNUM=(+REFUNDNUM)+this.exchangeGoodsNum
                      }
                    })
                  }

                }else{
                  addData.REFUND_FEE=this.standardMoney(0)
                  addData.REFUNDNUM=this.exchangeGoodsNum
                  this.getCacuItemByProductCode(addData)
                  this.exchangeData=[...this.exchangeData,addData]
                }
                this.exchangeGoodsNum=1
                this.exchangeAmount=0
                this.exchangeData.forEach(item=>{
                    this.exchangeAmount =this.standardMoney(this.parser(this.exchangeAmount)+this.parser(item.REFUND_FEE)) ;// safeFloat(item.PRICE) * safeNumber(refundNum);
                    this.checkMoney('exchangeAmount')
                });

                // 截取数组
                this.totalExchange=this.exchangeData.length;
                let startIndex=this.pageSizeExchange*(this.exchangeCurrentPage-1)
                let endIndex=startIndex+this.pageSizeExchange
                this.currentExchangeData=this.exchangeData.slice(startIndex,endIndex)

                this.$refs.exchangeSelect.clearSingleSelect()

                this.selectSKUData={} //添加的数据
                this.selectSKUID='' //双向数据绑定

            }
          }else{
            this.$Message.warning('请输入数量');
          }

      },
      addEnterGoods(val){  // select框enter触发事件
          let virtual={sku: val.target.value,type: '1'}
          network.post('/p/cs/getIesSku', virtual).then((res) => {
            if(res.data.Code==0){
              this.SKUArr=res.data.Rows.map(i=>{
                return {
                  label:i.SKU,
                  value:i.ID
                }
              })
              this.SKUAllData=res.data.Rows
              if(this.SKUAllData.length == 1){
                this.selectSKUData=this.SKUAllData[0] //添加的数据
                this.selectSKUID=this.SKUAllData[0].ID //双向数据绑定

                this.addGoods();
              }else {
                this.$Message.warning('添加条码不能为空');
                return
              }
            }else{
              this.SKUArr=[]
              this.SKUAllData=[]
            }
          })

      },
      //初始查询标准下拉框数据
      getQuery(tableName,fixed){
        let virtual={
          fixedcolumns:fixed?fixed:{},
          range: 1000,
          startindex: 0,
          table: tableName
        }
          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{
                  item.optionList= res.data.rows.map(i=>{
                    return {
                      label:i.NAME.val,
                      value:i.ID.val
                    }
                  })
                }

              }
            })
          })
      },
      getWAREHOUSE() {
        network.post('/p/cs/refund/queryWarehouse',{name:""}).then(res => {
          if(res.data.code == 0){
             this.tabList[0].list.forEach(item=>{
              if(item.ID == 'T_IESWAREHOUSE'){
                item.optionList= res.data.data.map(i=>{
                  return {
                    label:i.WAREHOUSENAME,
                    value:String(i.ID)
                  }
                })
              }
             })
          }
        })
      },
      // 获取省列表
      getProvinceList() {
        let virtual = {
          table: 'T_OMSREGION_PROVINCE',
          isdroplistsearch: true,
          range: 1000,
          startindex: 0,
        };
        network.post('/p/cs/list/query', virtual).then((res) => {
           this.tabList[1].list.forEach(item=>{
              if(item.ID=='T_OMSREGION_PROVINCE'){
                item.optionList= res.data.rows.map(i=>{
                  return {
                    label:i.REGIONNAME.val,
                    value:i.ID.val
                  }
                })

                this.provinceList = item.optionList
                // 获取省列表
                this.selectProvince(this.smartProvince)
              }
            })
        });
      },

      // 获取市列表
      getCityList(val) {
        if(val!=0&&val!=null&&val){
          // 市
          let virtual = {
            table: 'T_OMSREGION_CITY',
            isdroplistsearch: true,
            range: 1000,
            startindex: 0,
            fixedcolumns: { PARENTID: [`=${val}`] },
          };
          network.post('/p/cs/list/query', virtual).then((res) => {
           this.tabList[1].list.forEach(item=>{
              if(item.ID=='T_OMSREGION_CITY'){
                item.optionList= res.data.rows.map(i=>{
                  return {
                    label:i.REGIONNAME.val,
                    value:i.ID.val
                  }
                })
              }
            })
          });
        }

      },
      // 获取区列表
      getAreaList(val) {
        if(val!=0&&val!=null&&val){
          let virtual = {
            table: 'T_OMSREGION_AREA',
            isdroplistsearch: true,
            range: 1000,
            startindex: 0,
            fixedcolumns: { PARENTID: [`=${val}`] },
          };
          network.post('/p/cs/list/query', virtual).then((res) => {
            this.tabList[1].list.forEach(item=>{
              if(item.ID=='T_OMSREGION_AREA'){
                item.optionList= res.data.rows.map(i=>{
                  return {
                    label:i.REGIONNAME.val,
                    value:i.ID.val
                  }
                })
              }
            })
          });
        }

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

      // 选择商品页码改变时触发
      changePageGoods(val) {
        // 1=>0 2=>10 3=>20
        this.currentGoodsPage = (val - 1) * 10;
        this.searchGoodsData();
      },
      // 选择商品页数改变时触发
      changeSizeGoods(val) {
        this.pageSizeGoods = val;
        this.currentGoodsPage = 1;
        this.searchGoodsData();
      },
      // 打开选择商品弹窗
      searchGoods(name){
        this.nowGoodsType=name
        this.searchGoodsData()
        this.selectGoodsModal=true
      },
      // 关闭选择商品弹窗
      cancelSelectGoods(){
        this.selectGoodsData={
          NORMS1NAME:'',//颜色
          NORMS2NAME:'',//尺寸
          SKU:'',//SKU
          GBCODE:'',//国标码
          // SELLPRICE:'',//销售价
          // BASEPRICE:'',//成本价
          PRODUCTCODE:'',//商品编码
          PRODUCTNAME:''//商品名称
        }
        this.submitArrGoods=[]
        this.selectGoodsModal=false
      },
      okSelectGoods(){
        if(!this.submitArrGoods.length){
          this.$Message.warning('请选择商品');
          return
        }
        if(this.nowGoodsType=='exchange'){
            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
                }
                this.SKUArr=res.data.Rows.map(i=>{
                  return {
                    label:i.SKU,
                    value:i.ID
                  }
                })
                this.SKUAllData=res.data.Rows
              }else{
                this.SKUArr=[]
                this.SKUAllData=[]
              }
              this.selectSKUData=this.SKUAllData.find(item=>{
                return item.ID==this.submitArrGoods[0].ID
              }) //添加的数据
              this.selectSKUID=this.selectSKUData.ID //双向数据绑定
              this.cancelSelectGoods()
            })

        }else if(this.nowGoodsType=='return'){
          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
              }
              this.SKUArrReturn=res.data.Rows.map(i=>{
                return {
                  label:i.SKU,
                  value:i.ID
                }
              })
              this.SKUAllDataReturn=res.data.Rows
            }else{
              this.SKUArrReturn=[]
              this.SKUAllDataReturn=[]
            }
            this.selectReturnSKUData=this.SKUAllDataReturn.find(item=>{
              return item.ID==this.submitArrGoods[0].ID
            }) //添加的数据
            this.selectReturnSKUID=this.selectReturnSKUData.ID //双向数据绑定
            this.cancelSelectGoods()
          })

        }
      },
      // 重置选择商品搜索条件
      resetGoodsData(){
        this.selectGoodsData={
          NORMS1NAME:'',//颜色
          NORMS2NAME:'',//尺寸
          SKU:'',//SKU
          GBCODE:'',//国标码
          // SELLPRICE:'',//销售价
          // BASEPRICE:'',//成本价
          PRODUCTCODE:'',//商品编码
          PRODUCTNAME:''//商品名称
        }
        this.submitArrGoods=[]
        this.searchGoodsData()
      },
      // 查询符合搜索条件的商品
      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)
            if(this.nowGoodsType=='exchange'){
               if(this.exchangeData.length){
                  let sameArr = [...this.GoodsData].filter((x) => [...this.exchangeData].some((y) => y.SKU == x.SKU));
                  this.exchangeDataNoSame = [...this.exchangeData].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.REFUND_FEE='' // this.standardMoney(item.BASEPRICE * item.NUM)
                    item.REFUNDNUM=1
                    item.ADJUSTAMOUNT=(item.BASEPRICE - item.SELLPRICE) * item.NUM
                  })
                }
            }else 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.REFUND_FEE='' // this.standardMoney(item.BASEPRICE * item.NUM)
                  item.REFUNDNUM=1
                  item.ADJUSTAMOUNT=(item.BASEPRICE - item.SELLPRICE) * item.NUM
                  // item.PRODUCTMARK=1 //商品标记
                })
              }
            }
          });
      },
      // 删除
      deleteReturnGoods(){
        let idArray=this.submitArrReturn.map(item=>item.ID)
        this.returnData = this.returnData.filter(i =>{
         return !idArray.includes(i.ID)
        });
        this.refundableAmount=0
        this.returnData.forEach(i=>{
            this.refundableAmount = this.standardMoney(this.parser(this.refundableAmount)+this.parser(i.REFUND_FEE)); //应退总金额

        })
        this.checkMoney()
        this.totalReturn=this.returnData.length //总条数
        // 截取数组
        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturn
        this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
        // 删除时，恰好包含了高亮选中的sku行
        let flag = false;
        for(let i=0;i < this.submitArrReturn.length;i++){
          if(this.submitArrReturn[i].SKU == this.choosedSKU){
            flag = true;
            break;
          }
        }
        if(this.currentReturnData[0] && flag){
          this.defaultIndex = 0;
          this.choosedSKU = this.currentReturnData[0].SKU;
          this.getBatchOrQRcodeList();
        }else {
          this.currentReturnData.forEach((item,index) => {
            if(item.SKU == this.choosedSKU){
              this.defaultIndex = index;
            }
          })
        }
      },
      // 换货导入
      importExchangeGoods(){
        this.confirmSaveAll=true
      },
      // 换货删除
      deleteExchangeGoods(){
        let idArray=this.submitArrExchange.map(item=>item.SKU)
        this.exchangeData = this.exchangeData.filter(i =>{
         return !idArray.includes(i.SKU)
        });
        this.exchangeAmount=0
        this.exchangeData.forEach(item=>{
            this.exchangeAmount =this.standardMoney(this.parser(this.exchangeAmount)+this.parser(item.REFUND_FEE)) ;// safeFloat(item.PRICE) * safeNumber(refundNum);

        });

        // 截取数组
        this.totalExchange=this.exchangeData.length;
        let startIndex=this.pageSizeExchange*(this.exchangeCurrentPage-1)
        let endIndex=startIndex+this.pageSizeExchange
        this.currentExchangeData=this.exchangeData.slice(startIndex,endIndex)

        this.checkMoney('exchangeAmount')

      },
      // 换货表格选中某项时触发
      selectExchangeData(selection, row) {
        this.submitArrExchange = selection;
      },
      // 换货表格取消某项时触发
      selectExchangeCancel(selection, row) {
        this.submitArrExchange = selection;
      },
      // 换货表格全选
      selectExchangeDataAll(selection) {
        this.submitArrExchange = selection;
      },
      // 换货表格取消全选
      selectExchangeDataCancel(selection) {
        this.submitArrExchange = selection;
      },
      // 换货页码改变时触发
      changePageExchange(val){
         // 1=>0 2=>10 3=>20
         this.exchangeCurrentPage=val
        // 截取数组
        let startIndex=this.pageSizeExchange*(this.exchangeCurrentPage-1)
        let endIndex=startIndex+this.pageSizeExchange
        this.currentExchangeData=this.exchangeData.slice(startIndex,endIndex)
        // this.currentExchangePage = (val - 1) * 10;
      },
      // 换货页数改变时触发
      changeSizeExchange(val){
        this.pageSizeExchange = val;
        this.exchangeCurrentPage=1;
        // 截取数组
        let startIndex=this.pageSizeExchange*(this.exchangeCurrentPage-1)
        let endIndex=startIndex+this.pageSizeExchange
        this.currentExchangeData=this.exchangeData.slice(startIndex,endIndex)
      },
      // 未发已退页码改变时触发
      changePageUndeliveredAndReturned(val){
         // 1=>0 2=>10 3=>20
        this.currentUndeliveredAndReturnedPage = val;
        this.getUndeliveredAndReturnedData()//调用获取换货商品接口
      },
      // 未发已退页数改变时触发
      changeSizeUndeliveredAndReturned(val){
        this.pageSizeUndeliveredAndReturned = val;
        this.currentUndeliveredAndReturnedPage = 0;
        this.getUndeliveredAndReturnedData()//调用获取换货商品接口
      },
      // 日志页码改变时触发
      changePageJournal(val){
         // 1=>0 2=>10 3=>20
        this.currentJournalPage = (val - 1) * 10;
        this.getJournalData()//调用获取换货商品接口
      },
      // 日志页数改变时触发
      changeSizeJournal(val){
        this.pageSizeJournal = val;
        this.currentJournalPage = 0;
        this.getJournalData()//调用获取换货商品接口
      },

      // 退货页码改变时触发
      changePageReturn(val){
         // 1=>0 2=>10 3=>20
         this.returnCurrentPage=val
        // 截取数组
        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturn
        this.currentReturnData=this.returnData.slice(startIndex,endIndex)
      },
      // 退货页数改变时触发
      changeSizeReturn(val){
        this.pageSizeReturn = val;
        this.returnCurrentPage=1;
        // this.currentReturnPage = 0;
        // 截取数组
        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturn
        this.currentReturnData=this.returnData.slice(startIndex,endIndex)
      },

      // 退货表格选中某项时触发
      selectReturnData(selection, row) {
        this.submitArrReturn = selection;
      },
      // 退货表格取消某项时触发
      selectReturnCancel(selection, row) {
        this.submitArrReturn = selection;
      },

      // 退货表格全选
      selectReturnDataAll(selection) {
        this.submitArrReturn = selection;
      },
      // 退货表格取消全选
      selectReturnDataCancel(selection) {
        this.submitArrReturn = selection;
      },

      returnDataClick(e,index) { // 单击退回商品单行函数
        this.defaultIndex = index;
        this.choosedSKU = e.SKU;
        this.getBatchOrQRcodeList();
      },

      // 根据明细id和sku获取批次/唯一码列表
      getBatchOrQRcodeList() {
        let params = {
          orderId: this.pageMsgId,
          sku: this.choosedSKU,
          page: this.batchOrQrcodeCurrentPage,
          pageSize: this.pageSizeBatchOrQrcode
        }
        network.post('/p/cs/refund/packages/batch',params).then(res => {
          if(res.data.code == 0){
            this.batchOrQrcodeData = res.data.data.resultList;
            this.totalBatchOrQrcode = res.data.data.total;
          }
        })
      },

      // 批次/唯一码页码改变时触发
      changePageBatchOrQrcode(val) {
        this.batchOrQrcodeCurrentPage = val;
        this.getBatchOrQRcodeList();
      },
      // 批次/唯一码页数改变时触发
      changeSizeBatchOrQrcode(val) {
        this.pageSizeBatchOrQrcode = val;
        this.getBatchOrQRcodeList();
      },

       // 日志表格选中某项时触发
      selectJournalData(selection, row) {
        this.submitArrJournal = selection;
      },
      // 日志表格取消某项时触发
      selectJournalCancel(selection, row) {
        this.submitArrJournal = selection;
      },
      // 日志表格全选
      selectJournalDataAll(selection) {
        this.submitArrJournal = selection;
      },
      // 日志表格取消全选
      selectJournalDataCancel(selection) {
        this.submitArrJournal = selection;
      },
      commonKeyupHandle(option) {
        const { $event, calcType } = option;
        const tempVal = $event.target.value;
        const endVal = this.$comUtils.globalCarryMethod(tempVal, this.carryMethod, false);
        if (calcType === 'refundablePostage') {
          this.refundablePostage = endVal;
        }
      },
      checkMoney(str) {
        let num;
        if (str == 'refundablePostage') {
          // 是否要补充.00|.0000
          this.refundablePostage = this.$comUtils.globalCarryAppend(this.refundablePostage, this.carryMethod);
          num = (+this.parser(this.refundableAmount)) + (+this.parser(this.refundablePostage)) + (+this.parser(this.otherAmount)) -this.parser(this.exchangeAmount);
        } else if (str == 'otherAmount') {
          this.otherAmount = this.standardMoney(this.parser(this.otherAmount));
          num = (+this.parser(this.refundableAmount)) + (+this.parser(this.refundablePostage)) + (+this.parser(this.otherAmount)) -this.parser(this.exchangeAmount);
        } else if (str == 'exchangeAmount') {
          this.exchangeAmount = this.standardMoney(this.parser(this.exchangeAmount));
          num = (+this.parser(this.refundableAmount)) + (+this.parser(this.refundablePostage)) + (+this.parser(this.otherAmount)) -this.parser(this.exchangeAmount);
        }else{
          num = (+this.parser(this.refundableAmount)) + (+this.parser(this.refundablePostage)) + (+this.parser(this.otherAmount)) -this.parser(this.exchangeAmount);
        }
        this.total = this.standardMoney(num);
      },
      standardMoney(number) {
        number = (`${number}`).replace(/[^0-9+-Ee.]/g, '');
        let n = !isFinite(+number) ? 0 : +number;
        let prec = !isFinite(+4) ? 0 : Math.abs(this.carryMethod); // 保留几位小数
        let sep = ','; // 千分位符号
        let dec = '.'; // 小数点符号
        let s = '';
        let toFixedFix = function (n, prec) {
          let k = Math.pow(10, prec);
          // return `${Math.ceil(n * k) / k}`;
          return `${Math.ceil(Math.floor(n * k * 100) / 100  ) / k}`;
        };

        s = (prec ? toFixedFix(n, prec) : `${Math.round(n)}`).split('.');
        let re = /(-?\d+)(\d{3})/;
        while (re.test(s[0])) {
          s[0] = s[0].replace(re, `$1${sep}$2`);
        }

        if ((s[1] || '').length < prec) {
          s[1] = s[1] || '';
          s[1] += new Array(prec - s[1].length + 1).join('0');
        }
        return s.join(dec);
      },
      parser(value) {
        if((typeof value=='string')){
          if(value==''){
            value='0'
          }
          return parseFloat(value.replace(/[^\d\.-]/g, ''));
        }else{
          return value
        }

      },
      checkInputSKU(e,i){
        if(i.VALUE){
          let tableName=i.ID
          if(tableName=='T_V_IESSHOP'){
            this.getQuery(tableName)
          }else if(tableName=='T_V_OMSLOGISTICSCOMPANY'){
            this.getQuery(tableName,{isactive: ['=Y']})
          }else if(tableName=='T_OMSREASONTYPE'){
            this.getQuery(tableName,{NAME:e,REFUNDTYPE:2})
          }
          // else if(tableName=='T_IESWAREHOUSE'){
          //   this.getQuery(tableName)
          // }
        }else {
          let tableName=i.ID
          if(tableName=='T_V_IESSHOP'){
            this.getQuery(tableName,{SHOPTITLE:e})
          }else if(tableName=='T_V_OMSLOGISTICSCOMPANY'){
            this.getQuery(tableName,{NAME:e,isactive: ['=Y']})
          }else if(tableName=='T_OMSREASONTYPE'){
            this.getQuery(tableName,{NAME:e,REFUNDTYPE:2})
          }
          // else if(tableName=='T_IESWAREHOUSE'){
          //   this.getQuery(tableName,{WAREHOUSENAME:e})
          // }
        }
      },
      checkInputSKUOpen(e, i) {
        if(e && i.VALUE){
          let tableName=i.ID
          if(tableName=='T_V_IESSHOP'){
            this.getQuery(tableName)
          }else if(tableName=='T_IESWAREHOUSE'){
            this.getQuery(tableName)
          }else if(tableName=='T_V_OMSLOGISTICSCOMPANY'){
            this.getQuery(tableName,{isactive: ['=Y']})
          }else if(tableName=='T_OMSREASONTYPE'){
            this.getQuery(tableName,{NAME:e,REFUNDTYPE:2})
          }
        }
      },
      checkInput(i){ //下拉框选中事件
        let skey = i.SKEY;
        let inputValue = i.VALUE;
          if(skey=='reason_refund'){ //退换货原因
            this.saveArr.OMSREASONTYPEID=inputValue
          }else if(skey=='return_warehouse'){ //退回仓库
          this.saveArr.IESWAREHOUSEID=i.optionList.find((item) => item.value == inputValue)?i.optionList.find((item) => item.value == inputValue).value:''
          }else if(skey=='return_logistics_company'){ //退款物流公司
            let companyData = i.optionList.find((item) => item.value == inputValue);
            i.company = companyData?companyData.label:''
            this.saveArr.LOGISTICSCOMPANYID=companyData?companyData.value:''
            this.saveArr.COMPANY_NAME=companyData?companyData.label:''
          }else if(skey=='buyer_province'){
            let provinceData = i.optionList.find((item) => item.value == inputValue); //在省列表中找对应的省id
            this.saveArr.RECEIVPROVINCE=provinceData?provinceData.value:''
            this.saveArr.RECEIVPROVINCENAME=provinceData?provinceData.label:''
            if(inputValue) {
              this.smartCode = ''
              this.tabList[1].list[4].VALUE = ''
              this.tabList[1].list[5].VALUE = ''
            }
            this.getCityList(inputValue) //获取对应省的市列表
          }else if(skey=='buyer_city'){
            let cityData = ''
            if(!inputValue && this.smartCity){
              cityData = {
                value: this.smartCode.slice(0, 4)+ '00',
                label: this.smartCity
              };
              inputValue = cityData.value
              this.tabList[1].list[4].VALUE = this.smartCode.slice(0, 4)+ '00';
            } else {
              cityData = i.optionList.find((item) => item.value == inputValue); //在市列表中找对应的市id
            }

            this.saveArr.RECEIVCITY=cityData?cityData.value:''
            this.saveArr.RECEIVCITYNAME=cityData?cityData.label:''
            this.getAreaList(inputValue) //获取对应省的市列表
          }else if(skey=='buyer_area'){
            let AreaData = ''
            if(!inputValue && this.smartArea){
              AreaData = {
                value: this.smartCode,
                label: this.smartArea
              };
              // AreaData = this.smartCode;
              this.tabList[1].list[5].VALUE = this.smartCode;
            }else {
              AreaData = i.optionList.find((item) => item.value == inputValue); //在市列表中找对应的市id
            }
            // let AreaData = i.optionList.find((item) => item.value == inputValue); //在区列表中找对应的区id
            this.saveArr.RECEIVAREA=AreaData?AreaData.value:''
            this.saveArr.RECEIVAREANAME=AreaData?AreaData.label:''
          }

      },
      clearInput(i){ //清空下拉框
        let skey = i.SKEY;
        if(skey=='return_logistics_company'){
          i.company = ''
          i.VALUE = ''
        }else if(skey == 'return_warehouse') {
          this.getWAREHOUSE()
        }
      },
      // 是否拒收勾选时，改变仓库
      changeWarehouse(val,i){
        if(i.SKEY=='is_refund_to_store'){
          if(val){
            let id=this.tabList[0].list.find(item=>item.SKEY=='original_order_number').VALUE
            if(id){
              network.post('/p/cs/getReturnWarehouseId', {id:id}).then((res) => {
                if(res.data.code==0){
                    this.tabList[0].list.forEach(item=>{
                      if(item.SKEY=='return_warehouse'){
                        if(res.data.data.IESWAREHOUSEID==0){
                          // this.getQuery('T_IESWAREHOUSE')// 初始查询退货仓库
                          this.getWAREHOUSE()// 初始查询退货仓库
                          setTimeout(()=>{
                            item.VALUE=''
                          },200)
                        }else{
                          // item.title='原订单发货仓库',
                          // this.getQuery('T_IESWAREHOUSE',{ID:res.data.data.IESWAREHOUSEID.toString()})
                          // this.getQuery('T_IESWAREHOUSE')
                          this.getWAREHOUSE()// 初始查询退货仓库
                          setTimeout(()=>{
                            item.VALUE=res.data.data.IESWAREHOUSEID.toString()
                          },200)
                        }
                      }else if(item.SKEY=='return_logistics_company'){
                        if(res.data.data.LOGISTICSCOMPANYID==0){
                          this.getQuery('T_V_OMSLOGISTICSCOMPANY',{isactive: ['=Y']})// 初始查询退回物流公司
                          setTimeout(()=>{
                            item.VALUE=''
                          },200)
                        }else{
                          this.getQuery('T_V_OMSLOGISTICSCOMPANY',{isactive: ['=Y']})
                          setTimeout(()=>{
                            item.VALUE=res.data.data.LOGISTICSCOMPANYID.toString()
                          },200)
                        }
                      }else if(item.SKEY=='return_logistics_num'){
                        item.VALUE=res.data.data.LOGISTICSNUMBER
                      }
                    })
                }
              })
            }
          }else{
            // originLOGISTICSCOMPANYID:'',//原始退回物流公司
            // originSID:'',//原始退回物流单号
            // originIESWAREHOUSEID:'',原始退回仓库
            this.tabList[0].list.forEach(item=>{
              if(item.SKEY=='return_warehouse'){
                if(!this.originIESWAREHOUSEID){
                  // this.getQuery('T_IESWAREHOUSE')// 初始查询退货仓库
                  this.getWAREHOUSE()// 初始查询退货仓库
                  setTimeout(()=>{
                    item.VALUE=''
                  },200)
                }else{
                  // this.getQuery('T_IESWAREHOUSE',{ID:this.originIESWAREHOUSEID})
                  this.getWAREHOUSE()// 初始查询退货仓库
                  setTimeout(()=>{
                    item.VALUE=this.originIESWAREHOUSEID
                  },200)
                }
              }else if(item.SKEY=='return_logistics_company'){
                if(!this.originLOGISTICSCOMPANYID){
                    this.getQuery('T_V_OMSLOGISTICSCOMPANY',{isactive: ['=Y']})// 初始查询退回物流公司
                    setTimeout(()=>{
                      item.VALUE=''
                    },200)
                }else{
                    this.getQuery('T_V_OMSLOGISTICSCOMPANY',{ID:this.originLOGISTICSCOMPANYID,isactive: ['=Y']})// 初始查询退回物流公司
                    setTimeout(()=>{
                      item.VALUE=this.originLOGISTICSCOMPANYID
                    },200)
                }
              }else if(item.SKEY=='return_logistics_num'){
                item.VALUE=this.originSID
              }
            })
          }
        }
        
      },
      // 平台单号，退款单号，退回物流单号禁止输入空格
      noSpaces(e,i){
        if( i.SKEY=='original_platform_number' || i.SKEY=='system_order'|| i.SKEY=='return_logistics_num'||i.SKEY=='platform_refund_number'){
          if(e.keyCode == 32) e.returnValue = false
        }
      },
      searchMsg(i){  //原订单编号弹窗
        let skey = i.SKEY;
        let inputValue = +i.VALUE;
        if(!isNaN(inputValue)){
          if(skey=='original_order_number'){ //退换货原因
            this.originalModal=true
          }
        }else{
          i.VALUE=''
          this.$Message.error('订单编号输入格式不正确，请重新输入');
        }
      },
      // 关闭弹窗
      cancel(){
        this.originalOrderData={
          ID:'',//订单编号
          TID:'',//平台单号
          ALLSKU:'',//所有SKU
          RECEIVMOBILE:'',//收件人手机号码
          RECEIVNAME:'',//收件人
          USERNICK:'',//买家昵称
        },
        // 初始化过滤条条件
        this.allFix={//全部发货表格过滤条件
          OrderStatus:["=5","=6"]
        }
        this.warehouseFix={ //仓库发货表格过滤条件
          OrderStatus: "=5"
        }
        this.platformFix={ //平台发货表格过滤条件
          OrderStatus: "=6"
        }
        this.nowTab='all'
        this.originalModal=false
      },
      okSelectId(){
        this.tabList[0].list.forEach(item=>{
          if(item.SKEY=='original_order_number'){
            item.VALUE=this.selectTableData.ID
            if(item.VALUE){
              let virtual = {
                id: +item.VALUE,
              };
              this.ok(virtual)
            }else{
              this.$Message.warning('至少选择一条订单')
            }
          }
        })
      },
      ok(virtual){
            network.post('/p/cs/findOrderByParam', virtual).then((res) => {
              if(res.data.code==0){
                let data=res.data.data
                this.returnData=data.DETAILS
                if(this.returnData.length){
                  this.returnData.forEach(i=>{
                    i.REFUND_FEE=i.REFUND_FEE?this.parser(i.REFUND_FEE):0
                  })
                }

                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.tabList[0].list.forEach(item=>{
                    if(item.SKEY=='buyer_nickname'){
                      item.VALUE=data.USERNICK
                    }else if(item.SKEY=='original_order_number'){
                      item.VALUE=data.ID
                    }else if(item.SKEY=='original_platform_number'){
                      item.VALUE=data.TID
                      item.disabled = false;
                    }else if(item.SKEY=='system_order'){
                      item.VALUE=data.SOURCECODE
                      item.disabled = false;
                    }else if(item.SKEY=='shop_name'){
                      item.VALUE=data.ORDERSHOPID.toString()
                    }else if(item.SKEY=='platform_vip_code'){//平台会员卡号
                      item.VALUE=data.PLATFORMVIPCODE
                    }
                  })
                  this.tabList[1].list.forEach(item=>{
                    if(item.SKEY=='consignee_address'){
                      item.VALUE=data.RECEIVADDRESS
                    }else if(item.SKEY=='buyer_province'){
                      let provinceData = item.optionList.find((item) => item.value == data.RECEIVPROVINCE); //在省列表中找对应的省id
                      item.VALUE=provinceData?provinceData.value.toString():''
                      this.getCityList(item.VALUE)
                    }else if(item.SKEY=='buyer_city'){
                      item.VALUE=data.RECEIVCITY?data.RECEIVCITY.toString():''
                      this.getAreaList(data.RECEIVCITY)
                    }else if(item.SKEY=='buyer_area'){
                      item.VALUE=data.RECEIVAREA.toString()
                    }else if(item.SKEY=='buyer_town'){
                      item.VALUE=data.RECEIVTOWN
                    }else if(item.SKEY=='consignee_mobile'){
                      item.VALUE=data.RECEIVMOBILE
                    }else if(item.SKEY=='consignee_people'){
                      item.VALUE=data.RECEIVNAME
                    }else if(item.SKEY=='consignee_phone'){
                      item.VALUE=data.RECEIVPHONE
                    }else if(item.SKEY=='consignee_zip_code'){
                      item.VALUE=data.RECEIVZIP
                    }else if(item.SKEY=='original_platform_number'){
                      item.VALUE=data.TID
                    }else if(item.SKEY=='system_order'){
                      item.VALUE=data.SOURCECODE
                    }else if(item.SKEY=='consignee_phone'){
                      item.VALUE=data.RECEIVPHONE
                    }
                  })
              }
              if(this.originalModal){
                this.cancel()
              }
            })
      },
      onPasteInput(e, item) {
        e.preventDefault()
        e.target.value = e.clipboardData.getData('text/plain').trim()
        item.VALUE = e.target.value
      },
      enterOk(e, item){ //回车查询原订单编号
        // if(e.keyCode==13){
        //  let ID= this.tabList[0].list.find(i=>i.SKEY=='original_order_number').VALUE
        //  let virtual={id:ID}
        //   this.ok(virtual)
        // }
      },
       // 重置
      reset() {
        this.originalOrderData={
          ID:'',//订单编号
          SOURCECODE:'',//平台单号
          ALLSKU:'',//所有SKU
          RECEIVMOBILE:'',//收件人手机号码
          RECEIVNAME:'',//收件人
          USERNICK:'',//买家昵称
          // ORDERAMOUNT:'',//订单总额
          // ALLNUM:''//商品数量
        },
        this.queryBtn(this.nowTab)
      },
      // 查询按钮点击
      queryBtn(nowTab) {
        if(nowTab=='all'){
          this.allFix=this.originalOrderData
          this.allFix.OrderStatus=["=5","=6"]
          setTimeout(()=>{
            this.$refs.getAllDeliver.currentPage = 1;
            this.$refs.getAllDeliver.currentPageOfferInfo=0
            this.$refs.getAllDeliver.getInfoData()
          },200)
        }else if(nowTab=='warehouse'){
          this.warehouseFix=this.originalOrderData
          this.warehouseFix.OrderStatus="=5"
          setTimeout(()=>{
            this.$refs.getWarehouseDeliver.currentPage = 1;
            this.$refs.getWarehouseDeliver.currentPageOfferInfo=0
            this.$refs.getWarehouseDeliver.getInfoData();
          },200)
        }else if(nowTab=='platform'){
          this.platformFix=this.originalOrderData
          this.platformFix.OrderStatus="=6"
          setTimeout(()=>{
            this.$refs.getPlatformDeliver.currentPage = 1;
            this.$refs.getPlatformDeliver.currentPageOfferInfo=0
            this.$refs.getPlatformDeliver.getInfoData();
          },200)
        }
      },
      // 选择表格标签页
      clickTab(name){
        this.queryBtn(name) //切换就查询
        //清除上一tab页单选项
        if(this.lastTab==''){
          this.$refs.getAllDeliver.handleClearCurrentRow(); //初始页是all
        }else{
          if(this.lastTab!=name){
            if(this.lastTab=='all'){
              this.$refs.getAllDeliver.handleClearCurrentRow();
            }else if(this.lastTab=='warehouse'){
                this.$refs.getWarehouseDeliver.handleClearCurrentRow();
            }else if(this.lastTab=='platform'){
                this.$refs.getPlatformDeliver.handleClearCurrentRow();
            }
          }
        }
        this.lastTab=name
      },
      // 表格单选一项
      selectOneData(val){
        this.selectTableData=val
      },
      upOrDown(height) {
        this.currentValue = !this.currentValue;
        document.getElementsByClassName('conditionContent')[0].style.maxHeight = this.currentValue ? height : '';
        this.tableHeight = this.currentValue ? '250' : '200';
      },

      // 智能识别获取省编号

      // 选择省份
      selectProvince(val) {
        let data = this.provinceList.find((item) => item.label == val); //在省列表中找对应的省id
        if(data){
          // 市
          let virtual = {
            table: 'T_OMSREGION_CITY',
            isdroplistsearch: true,
            range: 1000,
            startindex: 0,
            fixedcolumns: { PARENTID: [`=${data.value}`] },
          };
          network.post('/p/cs/list/query', virtual).then((res) => {
            this.cityList = res.data.rows.map((item) => ({
              value: item.ID.val,
              label: item.REGIONNAME.val,
            }));
            this.tabList[1].list[4].optionList = this.cityList
            // 获取市列表
            if (this.smartCity) { //智能识别市就获取市ID
              this.getCityNum(this.smartCity);
            } else {//识别不到就通过默认的选择
              this.selectCity(this.formValidate.city);
            }
          });
        }

      },
      // 选择市
      selectCity(val) {
        let data = this.cityList.find((item) => item.label == val);//在市列表中找对应的市id
        // 市
        if (data) {
          let virtual = {
            table: 'T_OMSREGION_AREA',
            isdroplistsearch: true,
            range: 1000,
            startindex: 0,
            fixedcolumns: { PARENTID: [`=${data.value}`] },
          };
          network.post('/p/cs/list/query', virtual).then((res) => {
            this.areaList = res.data.rows.map((item) => ({
              value: item.ID.val,
              label: item.REGIONNAME.val,
            }));
            this.tabList[1].list[5].optionList = this.areaList
            // 获取区列表
            if( this.areaList.length==0){  //没有区就不要
              this.formValidate.areaId = '';
              this.formValidate.area = '';
            }
            if (this.smartArea) { //智能识别到区获取区ID
              this.getAreaNum(this.smartArea,data.value);
            }
          });
        }
      },


      getProvinceNum(province) {
        let virtual = {
          table: 'T_OMSREGION_PROVINCE',
          isdroplistsearch: false,
          range: 1000,
          startindex: 0,
          fixedcolumns: { REGIONNAME: province },
        };
        network.post('/p/cs/list/query', virtual).then((res) => {
          if (res.data.rows.length) {
            this.tabList[1].list.find(item=>item.SKEY=='buyer_province').VALUE = res.data.rows[0].ID.val;
            this.saveArr.RECEIVPROVINCE = res.data.rows[0].ID.val;
            this.saveArr.RECEIVPROVINCENAME = res.data.rows[0].REGIONNAME.val;
            // this.formValidate.provinceId = res.data.rows[0].ID.val;
            // this.formValidate.province = res.data.rows[0].REGIONNAME.val;
            this.selectProvince(res.data.rows[0].REGIONNAME.val);
          }
        });
      },
      // 智能识别获取市编号
      getCityNum(city) {
        let virtual = {
          table: 'T_OMSREGION_CITY',
          isdroplistsearch: false,
          range: 1000,
          startindex: 0,
          fixedcolumns: { REGIONNAME: city },
        };
        network.post('/p/cs/list/query', virtual).then((res) => {
          if (res.data.rows.length) {
            this.tabList[1].list.find(item=>item.SKEY=='buyer_city').VALUE = res.data.rows[0].ID.val;
            this.saveArr.RECEIVCITY = res.data.rows[0].ID.val;
            this.saveArr.RECEIVCITYNAME = res.data.rows[0].REGIONNAME.val;
            // this.formValidate.cityId = res.data.rows[0].ID.val;
            // this.formValidate.city = res.data.rows[0].REGIONNAME.val;
            this.selectCity(res.data.rows[0].REGIONNAME.val);
          }
        });
      },
      // 智能识别获取区编号
      getAreaNum(area,PARENTID) {
        let virtual = {
          table: 'T_OMSREGION_AREA',
          isdroplistsearch: false,
          range: 1000,
          startindex: 0,
          fixedcolumns: { REGIONNAME: [`=${area}`], PARENTID: [`=${PARENTID}`]},
        };
        network.post('/p/cs/list/query', virtual).then((res) => {
          if (res.data.rows.length) {
            this.tabList[1].list.find(item=>item.SKEY=='buyer_area').VALUE = res.data.rows[0].ID.val;
            this.saveArr.RECEIVAREA = res.data.rows[0].ID.val;
            this.saveArr.RECEIVAREANAME = res.data.rows[0].REGIONNAME.val;
            // this.formValidate.areaId = res.data.rows[0].ID.val;
            // this.formValidate.area = res.data.rows[0].REGIONNAME.val;
            this.smartProvince = '';
            this.smartCity = '',
            this.smartArea = '';
          }
        });
      },


       // 智能识别回车事件
      searchsmart(e){
        if(e.keyCode == 13) {
          this.tabList[1].list.find(item=>item.SKEY=='buyer_town').VALUE = '';
          this.smartParse()
        }
      },
      // 智能识别
      smartParse() {
        const [smartResult] = AddressParse.parse(this.formValidate.desc);
        this.smartCode = smartResult.code;
        this.tabList[1].list[0].VALUE = smartResult.name;
        this.tabList[1].list[1].VALUE = smartResult.mobile;
        this.tabList[1].list[2].VALUE = smartResult.phone;
        // this.tabList[1].list[3].VALUE = `${smartResult.code.slice(0, 2)}0000`;
        // this.tabList[1].list[4].VALUE = `${smartResult.code.slice(0, 4)}00`;
        // this.tabList[1].list[5].VALUE = smartResult.code;
        this.tabList[1].list[7].VALUE = smartResult.zip_code;
        this.tabList[1].list[8].VALUE = smartResult.details;

        // this.saveArr.RECEIVPROVINCE = `${smartResult.code.slice(0, 2)}0000`;
        // this.saveArr.RECEIVPROVINCENAME = smartResult.province;

        // this.saveArr.RECEIVCITY = `${smartResult.code.slice(0, 4)}00`
        // this.saveArr.RECEIVCITYNAME = smartResult.city

        // this.saveArr.RECEIVAREA = smartResult.code
        // this.saveArr.RECEIVAREANAME = smartResult.area

        this.smartProvince = smartResult.province;
        // this.smartCity = smartResult.city;
        this.smartCity = smartResult.city == '省直辖县'?smartResult.area: smartResult.city;  // 跟系统统一，如果识别出的市区为省直辖县，带入识别出来的区
        this.smartArea = smartResult.area;
        // 有省
        if (smartResult.province) {
          this.smartProvince = smartResult.province;
          this.getProvinceList();
          this.getProvinceNum(this.smartProvince);
        }
      },

      // 跳转到三无包裹匹配
      toManualMatch() {
        R3.store.commit('global/tabOpen', {
          type: 'tableDetailAction' || 'C',
          label: '三无包裹匹配',
          url: `/CUSTOMIZED/MANUALMATCH/3248?refundOrderId=${this.pageMsgId}`,
        })
      },

      // 物流上传至平台
      refillLogist() {
        let params = {
          objId: this.pageMsgId
        }
        network.post('/p/cs/taobao/returngoods/refill', params).then((res) => {
          if(res.data.code == 0){
            return this.$Message.success('物流上传至平台成功');
          }
        })
      },
      // 退货转仅退款
      returnToOnlyReturnMoney() {
        let params = {
          ids: [this.pageMsgId]
        }
        network.post('/p/cs/refund/cvt/refund-only',params).then(res => {
          if(res.data.code == 0){
              // const id = res.data.data.objId
              // const { fullPath } = this.$route;
              // const {
              //   keepAliveModuleName,tableName
              // } = this.$store.state.global.activeTab;
              // window.parent.R3.store.commit("global/tabCloseAppoint", {
              //   routeFullPath: fullPath, // 当前路由fullPath
              //   stopRouterPush: false, // 是否阻止默认跳转到前一个tab
              //   keepAliveModuleName, // 当前模块名称
              //   tableName, // 当前自定义表标识
              //   event() { }, // type:function;调用方法前执行的回调
              // });
              // // 跳转
              // window.parent.R3.store.commit('global/tabOpen', {
              //     type: 'V',
              //     tableName: 'T_V_OMSINCIDENTALSRECORD',
              //     tableId: '10573',
              //     id: id,
              //     dynamicRoutingForCustomizePage: true
              // });
            this.getInitialData()  //初始化查询编辑数据
            this.getJournalData()  
            return this.$Message.success(res.data.message);
            // return this.$Message.success(res.data.message);
          }
        })
      },

      // 退货转换货
      returnToExchange() {
        this.ISHAVEundeliveredAndReturned = false;
        this.returnToExchangeHandle = true;
        // 自动修改单据类型为退换货单
        this.tabList[0].list.find(item=>item.SKEY=='refund_type').VALUE = '退换货';
        this.saveArr.REFUNDTYPE = 2;
        // this.returnData=JSON.parse(JSON.stringify(this.returnData));
        let startIndex=this.pageSizeReturn*(this.returnCurrentPage-1)
        let endIndex=startIndex+this.pageSizeReturn
        this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细

        // 显示收货人信息区域
        this.tabList[1].blockShowOne = true;
        setTimeout(() => {
          $(`#consigneePeople`).find('input').focus();
          this.nowTabTable = 'exchangeGoods'
          this.ISHAVEundeliveredAndReturned = true;
        },50);

        // 基础信息区域更新参数
        this.tabList[0].list.find(item => item.SKEY=='is_refund_to_store').showTag = false;
        this.tabList[0].list.find(item => item.SKEY=='platform_refund_number').showTag = false;
        this.tabList[0].list.find(item => item.SKEY=='exchange_reserved_stock').showTag = true;
        this.tabList[0].list.find(item => item.SKEY=='exchange_reserved_stock').disabled = false;
        this.tabList[0].list.find(item => item.SKEY=='exchange_postage').showTag = true;
        this.tabList[0].list.find(item => item.SKEY=='platform_exchange_number').showTag = true;

      }

    }
  };
</script>
<style lang="less">
.edit-return-order .foldPanelContent .ark-collapse > .ark-collapse-item > .ark-collapse-content {
  padding-top: 0px;
}
.edit-return-order .ark-collapse-content > .ark-collapse-content-box {
  padding-bottom: 0px;
}
.edit-return-order .content .ark-col {
  margin-bottom: 8px !important;
}
.edit-return-order .content .ark-col-span-6 {
  margin-bottom: 16px !important;
}
.edit-return-order .content .ark-col-span-8 {
  margin-bottom: 16px !important;
}
// .edit-return-order .content .block {
//   padding-top: 12px;
// }
</style>
<style lang="less" scoped>
.edit-return-order {
  padding: 0 16px;
}
.quickOperation{
  height: 64px;
  border-bottom: 1px solid #D8D8D8;
  display: flex;
  align-items: center;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #333333;
  margin-bottom: -12px;
}
.content{
  .block{
    padding-top: 12px;
  }
  .ark-col{
    display: flex;
    align-items: center;
    // justify-content: flex-end;
    margin-bottom: 16px;
    .input_box{
      max-width: 220px;   // 240px
      min-width: 180px;
    }

   .ark-input-wrapper /deep/ textarea{
      resize: none;
    }
    .title{
      width: 100px;
      display: flex;
      justify-content: flex-end;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #333333;
      display: flex;
      align-items: center;
      margin-right: 8px;
      img{
        margin-left: 5px;
        width: 16px;
      }
    }
    // .returnLongText {
    //   width: 170px;
    // }
    // .nickTitle {
    //   margin-left: 36px;
    // }
  }

}
.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;
    }
}

</style>
<style lang="less" scoped>
  .textPart /deep/ textarea{
    min-height:36px !important;
  }
 .pageContent {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
  }
  .order-setting-input-error:before{
    content: '*';
    color: red;
    // position: absolute;
    // left: 8px;
  }
  .conditionContent {
    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;
        .handleItem{
          width: 48px;
          height: 16px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: var(--primary-color);
          line-height: 16px;
          margin: 0 2px;
          cursor: pointer;
        }
    }
  }
  .saveBtn{
    display: none;
  }
  .content /deep/ .ark-select-input[disabled]{
      color: #575757;
  }

  .returnGoodsTableBox {
    display: flex;
    align-items: center;
    height: 380px;
    .returnGoodsTableOne:first-child {
      width: calc(60% - 34px);
      margin-right: 16px;
      transition: width 0.3s;
    }
    .fold-btn {
      flex: 0 0 16px;
      height: 44px;
      box-shadow: 0 2px 8px 0 rgba(0,0,0,.06);
      background: #EFF0F0;
      // margin-right: 16px;
      border: 1px solid #E7E9E8;
      // border-radius: 0 8px 8px 0;
      border-radius: 8px 0px 0px 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }
    .returnGoodsTableOne:last-child {
      width: 40%;
      transition: width 0.3s;
      overflow: hidden;
    }
  }

  .text1 /deep/ .ark-input {
    height: 80px;
    resize: none;
    background-color: #f5f5f5;
  }
</style>
